Add batch

This commit is contained in:
Charlie Kolb 2024-11-29 10:55:54 +01:00
parent 40a7445f08
commit a6fe16cdb5
No known key found for this signature in database
16 changed files with 35 additions and 26 deletions

View file

@ -115,8 +115,7 @@ export class ClientOAuth2 {
const body = this.parseResponseBody<T>(response.data);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error getAuthError is not correctly typed
const authErr = getAuthError(body);
if (authErr) throw authErr;

View file

@ -76,8 +76,8 @@ export class CodeFlow {
const data =
typeof url.search === 'string' ? qs.parse(url.search.substring(1)) : url.search || {};
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @Cleanup: URL above should never not be a string, so we shouldn't need the fallback that breaks type-safety here
// @ts-expect-error We don't mind this throwing, as that's what we're about to do
const error = getAuthError(data);
if (error) throw error;

View file

@ -35,6 +35,7 @@ export function getAuthError(body: {
error: string;
error_description?: string;
}): Error | undefined {
// @Cleanup: This should explicitly handle optional `error` on body, which is how this function is used by callers
const message: string | undefined =
ERROR_RESPONSES[body.error] ?? body.error_description ?? body.error;

View file

@ -394,7 +394,6 @@ export function logWrapper(
return async (
query: string,
k?: number,
// @ts-ignore
filter?: BiquadFilterType | undefined,
_callbacks?: Callbacks | undefined,
): Promise<Document[]> => {

View file

@ -49,7 +49,7 @@ if (!inE2ETests && !inTest) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
const innerData = data[prefix];
if (prefix in globalConfig) {
// @ts-ignore
// @ts-expect-error We verify `prefix` is in `globalConfig` above
merge(globalConfig[prefix], innerData);
} else {
const flattenedData: Record<string, string> = flatten(innerData);
@ -69,7 +69,8 @@ if (!inE2ETests && !inTest) {
Object.entries(process.env).forEach(([envName, fileName]) => {
if (envName.endsWith('_FILE') && fileName) {
const configEnvName = envName.replace(/_FILE$/, '');
// @ts-ignore
// @Cleanup: Check if we can use `config.getEnv(configEnvName)` instead
// @ts-expect-error This uses the private `_env` property @Internal
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const key = config._env[configEnvName]?.[0] as string;
if (key) {

View file

@ -77,7 +77,8 @@ export class OAuth1CredentialController extends AbstractOAuthController {
const data = oauth.toHeader(oauth.authorize(options));
// @ts-ignore
// @Cleanup: Move this to the declaration of `options` and type to `RequestOptions & { headers: OAuth.Header}
// @ts-expect-error This intentionally sets a new property
options.headers = data;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

View file

@ -130,12 +130,12 @@ export class CredentialsHelper extends ICredentialsHelper {
node,
);
// @ts-ignore
// @ts-expect-error These transfer all properties from a type subset to a wider type
if (!requestOptions[outerKey]) {
// @ts-ignore
// @ts-expect-error These transfer all properties from a type subset to a wider type
requestOptions[outerKey] = {};
}
// @ts-ignore
// @ts-expect-error These transfer all properties from a type subset to a wider type
requestOptions[outerKey][keyResolved] = valueResolved;
});
});

View file

@ -51,8 +51,7 @@ export class CredentialsOverwrites {
const returnData = deepCopy(data);
// Overwrite only if there is currently no data set
for (const key of Object.keys(overwrites)) {
// @ts-ignore
if ([null, undefined, ''].includes(returnData[key])) {
if (([null, undefined, ''] as unknown[]).includes(returnData[key])) {
returnData[key] = overwrites[key];
}
}

View file

@ -289,7 +289,8 @@ export class CredentialsService {
// Do not overwrite the oauth data else data like the access or refresh token would get lost
// every time anybody changes anything on the credentials even if it is just the name.
if (decryptedData.oauthTokenData) {
// @ts-ignore
// @Cleanup We should instead properly define the type of `updateData`
// @ts-expect-error updateData has an incorrect type due to the cast in its definition
updateData.data.oauthTokenData = decryptedData.oauthTokenData;
}
return updateData;

View file

@ -146,10 +146,12 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
(credentials) => credentials.id == creds.id && credentials.type === type,
);
if (matchingCredentials) {
// @ts-ignore
// @Problem This should drop `.name`? Unless we intentionally need it like this when generating the SQL
// @ts-expect-error This appears to actually be incorrect
node.credentials[type] = matchingCredentials.name;
} else {
// @ts-ignore
// @Problem This should drop `.name`? Unless we intentionally need it like this when generating the SQL
// @ts-expect-error This appears to actually be incorrect
node.credentials[type] = creds.name;
}
credentialsUpdated = true;
@ -188,10 +190,12 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
(credentials) => credentials.id == creds.id && credentials.type === type,
);
if (matchingCredentials) {
// @ts-ignore
// @Problem This should drop `.name`? Unless we intentionally need it like this when generating the SQL
// @ts-expect-error This appears to actually be incorrect
node.credentials[type] = matchingCredentials.name;
} else {
// @ts-ignore
// @Problem This should drop `.name`? Unless we intentionally need it like this when generating the SQL
// @ts-expect-error This appears to actually be incorrect
node.credentials[type] = creds.name;
}
credentialsUpdated = true;
@ -230,10 +234,12 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
(credentials) => credentials.id == creds.id && credentials.type === type,
);
if (matchingCredentials) {
// @ts-ignore
// @Problem This should drop `.name`? Unless we intentionally need it like this when generating the SQL
// @ts-expect-error This appears to actually be incorrect
node.credentials[type] = matchingCredentials.name;
} else {
// @ts-ignore
// @Problem This should drop `.name`? Unless we intentionally need it like this when generating the SQL
// @ts-expect-error This appears to actually be incorrect
node.credentials[type] = creds.name;
}
credentialsUpdated = true;

View file

@ -394,7 +394,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
if (data) {
executionData.data = stringify(data);
}
// @ts-ignore
// @ts-expect-error A deeply nested error type does not line up with unknown
await this.executionDataRepository.update({ executionId }, executionData);
}
}

View file

@ -76,7 +76,8 @@ export const createFilter = (filter: string, userFilter: string) => {
};
export const escapeFilter = (filter: string): string => {
//@ts-ignore
// @Problem Create a class that extends Filter instead
// @ts-expect-error This creates an instance of an abstract class, see https://github.com/n8n-io/n8n/pull/3835/files#r1042626072
return new Filter().escape(filter); /* eslint-disable-line */
};

View file

@ -68,7 +68,7 @@ export class LoadNodesAndCredentials {
const delimiter = process.platform === 'win32' ? ';' : ':';
process.env.NODE_PATH = module.paths.join(delimiter);
// @ts-ignore
// @ts-expect-error This is a NodeJS internal function @Internal
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
module.constructor._initPaths();

View file

@ -111,7 +111,8 @@ export async function encryptCredential(credential: CredentialsEntity): Promise<
// Encrypt the data
const coreCredential = new Credentials({ id: null, name: credential.name }, credential.type);
// @ts-ignore
// @Cleanup Investigate whether ICredentialsEncrypted['data'] is incorrect and a change is feasible
// @ts-expect-error Either this is mistyped, or `ICredentialsEncrypted['data']` is mistyped
coreCredential.setData(credential.data);
return coreCredential.getDataToSave() as ICredentialsDb;

View file

@ -131,7 +131,8 @@ export const setupPushServer = (restEndpoint: string, server: Server, app: Appli
return response;
};
// @ts-ignore
// @Problem: Find a public alternative
// @ts-expect-error This uses a private function https://github.com/expressjs/express/blob/e4a61bd88e2f170eab64d937f3bf6c0812b4a649/lib/application.js#L153
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
app.handle(request, response);
});

View file

@ -137,7 +137,6 @@ export class FlowTrigger implements INodeType {
if (resource === 'task') {
resourceIds = (this.getNodeParameter('taskIds') as string).split(',');
}
// @ts-ignore
for (const resourceId of resourceIds) {
body = {
organization_id: credentials.organizationId as number,