style: auto format whole project
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { IApp, IAuthenticationStep, IAuthenticationStepField } from '@automatisch/types';
|
||||
import {
|
||||
IApp,
|
||||
IAuthenticationStep,
|
||||
IAuthenticationStepField,
|
||||
} from '@automatisch/types';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
|
||||
const connectionIdArgument = {
|
||||
@@ -9,16 +13,11 @@ const connectionIdArgument = {
|
||||
const resetConnectionStep = {
|
||||
type: 'mutation' as const,
|
||||
name: 'resetConnection',
|
||||
arguments: [
|
||||
connectionIdArgument,
|
||||
],
|
||||
arguments: [connectionIdArgument],
|
||||
};
|
||||
|
||||
function replaceCreateConnection(string: string) {
|
||||
return string.replace(
|
||||
'{createConnection.id}',
|
||||
'{connection.id}'
|
||||
);
|
||||
return string.replace('{createConnection.id}', '{connection.id}');
|
||||
}
|
||||
|
||||
function removeAppKeyArgument(args: IAuthenticationStepField[]) {
|
||||
@@ -36,7 +35,7 @@ function addConnectionId(step: IAuthenticationStep) {
|
||||
return {
|
||||
name: property.name,
|
||||
value: replaceCreateConnection(property.value),
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,7 +59,7 @@ function replaceCreateConnectionsWithUpdate(steps: IAuthenticationStep[]) {
|
||||
}
|
||||
|
||||
return step;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function addReconnectionSteps(app: IApp): IApp {
|
||||
@@ -68,12 +67,11 @@ function addReconnectionSteps(app: IApp): IApp {
|
||||
|
||||
if (hasReconnectionSteps) return app;
|
||||
|
||||
const updatedSteps = replaceCreateConnectionsWithUpdate(app.auth.authenticationSteps);
|
||||
const updatedSteps = replaceCreateConnectionsWithUpdate(
|
||||
app.auth.authenticationSteps
|
||||
);
|
||||
|
||||
app.auth.reconnectionSteps = [
|
||||
resetConnectionStep,
|
||||
...updatedSteps,
|
||||
]
|
||||
app.auth.reconnectionSteps = [resetConnectionStep, ...updatedSteps];
|
||||
|
||||
return app;
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ const appInfoConverter = (rawAppData: IApp) => {
|
||||
};
|
||||
}
|
||||
|
||||
return field
|
||||
return field;
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -3,15 +3,15 @@ import logger from './logger';
|
||||
|
||||
type Error = {
|
||||
message: string;
|
||||
}
|
||||
};
|
||||
|
||||
const errorHandler = (err: Error, req: Request, res: Response): void => {
|
||||
if(err.message === 'Not Found') {
|
||||
res.status(404).end()
|
||||
if (err.message === 'Not Found') {
|
||||
res.status(404).end();
|
||||
} else {
|
||||
logger.error(err.message)
|
||||
res.status(500).end()
|
||||
logger.error(err.message);
|
||||
res.status(500).end();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default errorHandler;
|
||||
|
@@ -75,7 +75,10 @@ const globalVariable = async (
|
||||
},
|
||||
},
|
||||
pushTriggerItem: (triggerItem: ITriggerItem) => {
|
||||
if (isAlreadyProcessed(triggerItem.meta.internalId) && !$.execution.testRun) {
|
||||
if (
|
||||
isAlreadyProcessed(triggerItem.meta.internalId) &&
|
||||
!$.execution.testRun
|
||||
) {
|
||||
// early exit as we do not want to process duplicate items in actual executions
|
||||
throw new EarlyExitError();
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ const levels = {
|
||||
};
|
||||
|
||||
const level = () => {
|
||||
return appConfig.appEnv === 'development' ? 'debug' : 'info'
|
||||
return appConfig.appEnv === 'development' ? 'debug' : 'info';
|
||||
};
|
||||
|
||||
const colors = {
|
||||
@@ -27,8 +27,8 @@ const format = winston.format.combine(
|
||||
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),
|
||||
winston.format.colorize({ all: true }),
|
||||
winston.format.printf(
|
||||
(info) => `${info.timestamp} [${info.level}]: ${info.message}`,
|
||||
),
|
||||
(info) => `${info.timestamp} [${info.level}]: ${info.message}`
|
||||
)
|
||||
);
|
||||
|
||||
const transports = [
|
||||
|
@@ -3,13 +3,14 @@ import { Request } from 'express';
|
||||
import logger from './logger';
|
||||
|
||||
const stream: StreamOptions = {
|
||||
write: (message) => logger.http(message.substring(0, message.lastIndexOf("\n")))
|
||||
write: (message) =>
|
||||
logger.http(message.substring(0, message.lastIndexOf('\n'))),
|
||||
};
|
||||
|
||||
const registerGraphQLToken = () => {
|
||||
morgan.token("graphql-query", (req: Request) => {
|
||||
if(req.body.query) {
|
||||
return `GraphQL ${req.body.query}`
|
||||
morgan.token('graphql-query', (req: Request) => {
|
||||
if (req.body.query) {
|
||||
return `GraphQL ${req.body.query}`;
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -17,7 +18,7 @@ const registerGraphQLToken = () => {
|
||||
registerGraphQLToken();
|
||||
|
||||
const morganMiddleware = morgan(
|
||||
":method :url :status :res[content-length] - :response-time ms\n:graphql-query",
|
||||
':method :url :status :res[content-length] - :response-time ms\n:graphql-query',
|
||||
{ stream }
|
||||
);
|
||||
|
||||
|
@@ -25,7 +25,10 @@ export default function parseLinkHeader(link: string): TParsedLinkHeader {
|
||||
const items = link.split(',');
|
||||
|
||||
for (const item of items) {
|
||||
const [rawUriReference, ...rawLinkParameters] = item.split(';') as [string, ...string[]];
|
||||
const [rawUriReference, ...rawLinkParameters] = item.split(';') as [
|
||||
string,
|
||||
...string[]
|
||||
];
|
||||
const trimmedUriReference = rawUriReference.trim();
|
||||
|
||||
const reference = trimmedUriReference.slice(1, -1);
|
||||
@@ -45,4 +48,4 @@ export default function parseLinkHeader(link: string): TParsedLinkHeader {
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user