perf(tooling): Upgrade to TypeScript 4.8 (#4207)

* ⬆️ Upgrade to TypeScript 4.8

* 🔥 Remove unneeded setting

* 📦 Update `package-lock.json`

*  Restore `skipLibCheck`

* 📦 Re-update `package-lock.json`

* ♻️ Apply feedback

* ♻️ Add check to new WhatsApp node

* 📦 Update `package-lock.json`

* Update package-lock.json

* ran `npm run lintfix`

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Iván Ovejero 2022-10-05 13:36:09 +02:00 committed by GitHub
parent cc2a2e438b
commit 9089dbe942
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 21217 additions and 11086 deletions

31909
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -101,7 +101,7 @@
"supertest": "^6.2.2",
"ts-jest": "^27.1.3",
"ts-node": "^8.9.1",
"typescript": "~4.6.0"
"typescript": "~4.8.0"
},
"dependencies": {
"@oclif/command": "^1.5.18",

View file

@ -13,6 +13,7 @@ import {
EntityTarget,
getRepository,
LoggerOptions,
ObjectLiteral,
Repository,
} from 'typeorm';
import { TlsOptions } from 'tls';
@ -38,7 +39,9 @@ export async function transaction<T>(fn: (entityManager: EntityManager) => Promi
return connection.transaction(fn);
}
export function linkRepository<Entity>(entityClass: EntityTarget<Entity>): Repository<Entity> {
export function linkRepository<Entity extends ObjectLiteral>(
entityClass: EntityTarget<Entity>,
): Repository<Entity> {
return getRepository(entityClass, connection.name);
}
@ -183,9 +186,12 @@ export async function init(
}
}
// @ts-ignore
collections.Credentials = linkRepository(entities.CredentialsEntity);
// @ts-ignore
collections.Execution = linkRepository(entities.ExecutionEntity);
collections.Workflow = linkRepository(entities.WorkflowEntity);
// @ts-ignore
collections.Webhook = linkRepository(entities.WebhookEntity);
collections.Tag = linkRepository(entities.TagEntity);

View file

@ -1,6 +1,6 @@
import express from 'express';
import { FindManyOptions, In } from 'typeorm';
import { FindManyOptions, In, ObjectLiteral } from 'typeorm';
import { ActiveWorkflowRunner, Db } from '../../../..';
import config = require('../../../../../config');
@ -110,7 +110,7 @@ export = {
let workflows: WorkflowEntity[];
let count: number;
const query: FindManyOptions<WorkflowEntity> = {
const query: FindManyOptions<WorkflowEntity> & { where: ObjectLiteral } = {
skip: offset,
take: limit,
where: {

View file

@ -40,7 +40,7 @@
"jest": "^27.4.7",
"source-map-support": "^0.5.9",
"ts-jest": "^27.1.3",
"typescript": "~4.6.0"
"typescript": "~4.8.0"
},
"dependencies": {
"axios": "^0.21.1",

View file

@ -964,18 +964,16 @@ export async function requestOAuth2(
// Signs the request by adding authorization headers or query parameters depending
// on the token-type used.
const newRequestOptions = token.sign(requestOptions as clientOAuth2.RequestObject);
const newRequestHeaders = (newRequestOptions.headers = newRequestOptions.headers ?? {});
// If keep bearer is false remove the it from the authorization header
if (oAuth2Options?.keepBearer === false) {
// @ts-ignore
newRequestOptions?.headers?.Authorization =
newRequestHeaders.Authorization =
// @ts-ignore
newRequestOptions?.headers?.Authorization.split(' ')[1];
newRequestHeaders.Authorization.split(' ')[1];
}
// @ts-ignore
if (oAuth2Options?.keyToIncludeInAccessTokenHeader) {
Object.assign(newRequestOptions.headers, {
// @ts-ignore
Object.assign(newRequestHeaders, {
[oAuth2Options.keyToIncludeInAccessTokenHeader]: token.accessToken,
});
}
@ -1030,10 +1028,8 @@ export async function requestOAuth2(
);
const refreshedRequestOption = newToken.sign(requestOptions as clientOAuth2.RequestObject);
// @ts-ignore
if (oAuth2Options?.keyToIncludeInAccessTokenHeader) {
Object.assign(newRequestOptions.headers, {
// @ts-ignore
Object.assign(newRequestHeaders, {
[oAuth2Options.keyToIncludeInAccessTokenHeader]: token.accessToken,
});
}
@ -1108,6 +1104,7 @@ export async function requestOAuth2(
// Make the request again with the new token
const newRequestOptions = newToken.sign(requestOptions as clientOAuth2.RequestObject);
newRequestOptions.headers = newRequestOptions.headers ?? {};
// @ts-ignore
if (oAuth2Options?.keyToIncludeInAccessTokenHeader) {

View file

@ -74,7 +74,7 @@ export async function prepareUserSettings(): Promise<IUserSettings> {
export async function getEncryptionKey(): Promise<string> {
if (process.env[ENCRYPTION_KEY_ENV_OVERWRITE] !== undefined) {
return process.env[ENCRYPTION_KEY_ENV_OVERWRITE] as string;
return process.env[ENCRYPTION_KEY_ENV_OVERWRITE];
}
const userSettings = await getUserSettings();
@ -233,7 +233,7 @@ export function getUserSettingsPath(): string {
export function getUserN8nFolderPath(): string {
let userFolder;
if (process.env[USER_FOLDER_ENV_OVERWRITE] !== undefined) {
userFolder = process.env[USER_FOLDER_ENV_OVERWRITE] as string;
userFolder = process.env[USER_FOLDER_ENV_OVERWRITE];
} else {
userFolder = getUserHome();
}

View file

@ -43,8 +43,7 @@ export class CredentialsHelper extends ICredentialsHelper {
credentialsExpired: boolean,
): Promise<ICredentialDataDecryptedObject | undefined> {
return undefined;
};
}
getParentTypes(name: string): string[] {
return [];

View file

@ -60,7 +60,7 @@
"storybook-addon-designs": "^6.3.1",
"storybook-addon-themes": "^6.1.0",
"trim": ">=0.0.3",
"typescript": "~4.6.0",
"typescript": "~4.8.0",
"vite": "2.9.5",
"vite-plugin-vue2": "1.9.3",
"vitest": "0.9.3",

View file

@ -95,7 +95,7 @@
"sass-loader": "^8.0.2",
"string-template-parser": "^1.2.6",
"tslint": "^6.1.2",
"typescript": "~4.6.0",
"typescript": "~4.8.0",
"vite": "2.9",
"vite-plugin-html": "^3.2.0",
"vite-plugin-monaco-editor": "^1.0.10",

View file

@ -66,6 +66,6 @@
"replace-in-file": "^6.0.0",
"request": "^2.88.2",
"tmp-promise": "^3.0.2",
"typescript": "~4.6.0"
"typescript": "~4.8.0"
}
}

View file

@ -22,9 +22,9 @@ export class PushoverApi implements ICredentialType {
credentials: ICredentialDataDecryptedObject,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
if (requestOptions.method === 'GET') {
if (requestOptions.method === 'GET' && requestOptions.qs) {
Object.assign(requestOptions.qs, { token: credentials.apiKey });
} else {
} else if (requestOptions.body) {
Object.assign(requestOptions.body, { token: credentials.apiKey });
}
return requestOptions;

View file

@ -48,7 +48,7 @@ export class WooCommerceApi implements ICredentialType {
user: credentials.consumerKey as string,
password: credentials.consumerSecret as string,
};
if (credentials.includeCredentialsInQuery === true) {
if (credentials.includeCredentialsInQuery === true && requestOptions.qs) {
delete requestOptions.auth;
Object.assign(requestOptions.qs, {
consumer_key: credentials.consumerKey,

View file

@ -235,7 +235,7 @@ export class ActionNetwork implements INodeType {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
if (Object.keys(additionalFields).length) {
if (Object.keys(additionalFields).length && body.person) {
Object.assign(body.person, adjustPersonPayload(additionalFields));
}

View file

@ -599,7 +599,7 @@ export class AwsS3 implements INodeType {
binary: {},
};
if (items[i].binary !== undefined) {
if (items[i].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -382,42 +382,44 @@ export class AwsTranscribe implements INodeType {
body.LanguageCode = this.getNodeParameter('languageCode', i) as string;
}
if (options.channelIdentification) {
Object.assign(body.Settings, {
ChannelIdentification: options.channelIdentification,
});
}
if (body.Settings) {
if (options.channelIdentification) {
Object.assign(body.Settings, {
ChannelIdentification: options.channelIdentification,
});
}
if (options.maxAlternatives) {
Object.assign(body.Settings, {
ShowAlternatives: true,
MaxAlternatives: options.maxAlternatives,
});
}
if (options.maxAlternatives) {
Object.assign(body.Settings, {
ShowAlternatives: true,
MaxAlternatives: options.maxAlternatives,
});
}
if (options.maxSpeakerLabels) {
Object.assign(body.Settings, {
ShowSpeakerLabels: true,
MaxSpeakerLabels: options.maxSpeakerLabels,
});
}
if (options.maxSpeakerLabels) {
Object.assign(body.Settings, {
ShowSpeakerLabels: true,
MaxSpeakerLabels: options.maxSpeakerLabels,
});
}
if (options.vocabularyName) {
Object.assign(body.Settings, {
VocabularyName: options.vocabularyName,
});
}
if (options.vocabularyName) {
Object.assign(body.Settings, {
VocabularyName: options.vocabularyName,
});
}
if (options.vocabularyFilterName) {
Object.assign(body.Settings, {
VocabularyFilterName: options.vocabularyFilterName,
});
}
if (options.vocabularyFilterName) {
Object.assign(body.Settings, {
VocabularyFilterName: options.vocabularyFilterName,
});
}
if (options.vocabularyFilterMethod) {
Object.assign(body.Settings, {
VocabularyFilterMethod: options.vocabularyFilterMethod,
});
if (options.vocabularyFilterMethod) {
Object.assign(body.Settings, {
VocabularyFilterMethod: options.vocabularyFilterMethod,
});
}
}
const action = 'Transcribe.StartTranscriptionJob';

View file

@ -53,7 +53,7 @@ export async function get(this: IExecuteFunctions, index: number) {
binary: {},
};
if (items[index].binary !== undefined) {
if (items[index].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -40,7 +40,7 @@ export async function download(this: IExecuteFunctions, index: number) {
binary: {},
};
if (items[index].binary !== undefined) {
if (items[index].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -53,7 +53,7 @@ export async function upload(this: IExecuteFunctions, index: number) {
resolveWithFullResponse: true,
};
if (options.hasOwnProperty('share')) {
if (options.hasOwnProperty('share') && body.formData) {
Object.assign(body.formData, options.share ? { share: 'yes' } : { share: 'no' });
}
//endpoint

View file

@ -40,7 +40,7 @@ export async function download(this: IExecuteFunctions, index: number) {
binary: {},
};
if (items[index].binary !== undefined) {
if (items[index].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -51,7 +51,9 @@ export async function upload(this: IExecuteFunctions, index: number) {
resolveWithFullResponse: true,
};
Object.assign(body.formData, share ? { share: 'yes' } : { share: 'no' });
if (body.formData) {
Object.assign(body.formData, share ? { share: 'yes' } : { share: 'no' });
}
//endpoint
const endpoint = `files`;

View file

@ -1262,7 +1262,7 @@ export class EditImage implements INodeType {
}
}
if (item.binary !== undefined) {
if (item.binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -456,7 +456,7 @@ export class Ftp implements INodeType {
binary: {},
};
if (items[i].binary !== undefined) {
if (items[i].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -422,7 +422,7 @@ export class HomeAssistant implements INodeType {
mimeType = responseData.headers['content-type'];
}
if (items[i].binary !== undefined) {
if (items[i].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -69,7 +69,7 @@ export const questionsOperations: INodeProperties[] = [
binary: {},
};
if (items[i].binary !== undefined) {
if (items[i].binary !== undefined && newItem.binary) {
Object.assign(newItem.binary, items[i].binary);
}
items[i] = newItem;

View file

@ -32,7 +32,7 @@ export async function postmarkApiRequest(
uri: 'https://api.postmarkapp.com' + endpoint,
json: true,
};
if (body === {}) {
if (Object.keys(body).length === 0) {
delete options.body;
}
options = Object.assign({}, options, option);

View file

@ -78,7 +78,7 @@ export class ReadBinaryFile implements INodeType {
},
};
if (item.binary !== undefined) {
if (item.binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -233,7 +233,7 @@ export class SecurityScorecard implements INodeType {
binary: {},
};
if (items[i].binary !== undefined) {
if (items[i].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -323,7 +323,7 @@ export class Ssh implements INodeType {
},
};
if (items[i].binary !== undefined) {
if (items[i].binary !== undefined && newItem.binary) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.

View file

@ -49,7 +49,9 @@ export async function storyblokApiRequest(
options.uri = `https://mapi.storyblok.com${resource}`;
Object.assign(options.headers, { Authorization: credentials.accessToken });
if (options.headers) {
Object.assign(options.headers, { Authorization: credentials.accessToken });
}
}
try {

View file

@ -52,7 +52,9 @@ export async function setType(this: IExecuteSingleFunctions, requestOptions: IHt
actualType = 'template';
}
Object.assign(requestOptions.body, { type: actualType });
if (requestOptions.body) {
Object.assign(requestOptions.body, { type: actualType });
}
return requestOptions;
}

View file

@ -742,7 +742,7 @@
"n8n-workflow": "~0.118.0",
"ts-jest": "^27.1.3",
"tslint": "^6.1.2",
"typescript": "~4.6.0"
"typescript": "~4.8.0"
},
"dependencies": {
"@kafkajs/confluent-schema-registry": "1.0.6",

View file

@ -51,7 +51,7 @@
"jest-environment-jsdom": "^27.5.1",
"prettier": "^2.3.2",
"ts-jest": "^27.1.3",
"typescript": "~4.6.0"
"typescript": "~4.8.0"
},
"dependencies": {
"@n8n_io/riot-tmpl": "^1.0.1",

View file

@ -241,7 +241,7 @@ export class RoutingNode {
merge(destinationOptions.options, sourceOptions.options);
destinationOptions.preSend.push(...sourceOptions.preSend);
destinationOptions.postReceive.push(...sourceOptions.postReceive);
if (sourceOptions.requestOperations) {
if (sourceOptions.requestOperations && destinationOptions.requestOperations) {
destinationOptions.requestOperations = Object.assign(
destinationOptions.requestOperations,
sourceOptions.requestOperations,

View file

@ -1,75 +1,75 @@
import { toCronExpression } from "../src/Cron"
import { toCronExpression } from '../src/Cron';
describe('Cron', () => {
describe('toCronExpression', () => {
test('should generate a valid cron for `everyMinute` triggers', () => {
const expression = toCronExpression({
mode: 'everyMinute',
})
expect(expression).toMatch(/^[1-6]?[0-9] \* \* \* \* \*$/)
})
describe('toCronExpression', () => {
test('should generate a valid cron for `everyMinute` triggers', () => {
const expression = toCronExpression({
mode: 'everyMinute',
});
expect(expression).toMatch(/^[1-6]?[0-9] \* \* \* \* \*$/);
});
test('should generate a valid cron for `everyHour` triggers', () => {
const expression = toCronExpression({
mode: 'everyHour',
minute: 11,
})
expect(expression).toMatch(/^[1-6]?[0-9] 11 \* \* \* \*$/)
})
test('should generate a valid cron for `everyHour` triggers', () => {
const expression = toCronExpression({
mode: 'everyHour',
minute: 11,
});
expect(expression).toMatch(/^[1-6]?[0-9] 11 \* \* \* \*$/);
});
test('should generate a valid cron for `everyX[minutes]` triggers', () => {
const expression = toCronExpression({
mode: 'everyX',
unit: 'minutes',
value: 42,
})
expect(expression).toMatch(/^[1-6]?[0-9] \*\/42 \* \* \* \*$/)
})
test('should generate a valid cron for `everyX[minutes]` triggers', () => {
const expression = toCronExpression({
mode: 'everyX',
unit: 'minutes',
value: 42,
});
expect(expression).toMatch(/^[1-6]?[0-9] \*\/42 \* \* \* \*$/);
});
test('should generate a valid cron for `everyX[hours]` triggers', () => {
const expression = toCronExpression({
mode: 'everyX',
unit: 'hours',
value: 3,
})
expect(expression).toMatch(/^[1-6]?[0-9] 0 \*\/3 \* \* \*$/)
})
test('should generate a valid cron for `everyX[hours]` triggers', () => {
const expression = toCronExpression({
mode: 'everyX',
unit: 'hours',
value: 3,
});
expect(expression).toMatch(/^[1-6]?[0-9] 0 \*\/3 \* \* \*$/);
});
test('should generate a valid cron for `everyDay` triggers', () => {
const expression = toCronExpression({
mode: 'everyDay',
hour: 13,
minute: 17,
})
expect(expression).toMatch(/^[1-6]?[0-9] 17 13 \* \* \*$/)
})
test('should generate a valid cron for `everyDay` triggers', () => {
const expression = toCronExpression({
mode: 'everyDay',
hour: 13,
minute: 17,
});
expect(expression).toMatch(/^[1-6]?[0-9] 17 13 \* \* \*$/);
});
test('should generate a valid cron for `everyWeek` triggers', () => {
const expression = toCronExpression({
mode: 'everyWeek',
hour: 13,
minute: 17,
weekday: 4,
})
expect(expression).toMatch(/^[1-6]?[0-9] 17 13 \* \* 4$/)
})
test('should generate a valid cron for `everyWeek` triggers', () => {
const expression = toCronExpression({
mode: 'everyWeek',
hour: 13,
minute: 17,
weekday: 4,
});
expect(expression).toMatch(/^[1-6]?[0-9] 17 13 \* \* 4$/);
});
test('should generate a valid cron for `everyMonth` triggers', () => {
const expression = toCronExpression({
mode: 'everyMonth',
hour: 13,
minute: 17,
dayOfMonth: 12,
})
expect(expression).toMatch(/^[1-6]?[0-9] 17 13 12 \* \*$/)
})
test('should generate a valid cron for `everyMonth` triggers', () => {
const expression = toCronExpression({
mode: 'everyMonth',
hour: 13,
minute: 17,
dayOfMonth: 12,
});
expect(expression).toMatch(/^[1-6]?[0-9] 17 13 12 \* \*$/);
});
test('should trim custom cron expressions', () => {
const expression = toCronExpression({
mode: 'custom',
cronExpression: ' 0 9-17 * * * ',
})
expect(expression).toEqual('0 9-17 * * *')
})
})
})
test('should trim custom cron expressions', () => {
const expression = toCronExpression({
mode: 'custom',
cronExpression: ' 0 9-17 * * * ',
});
expect(expression).toEqual('0 9-17 * * *');
});
});
});

View file

@ -2,43 +2,32 @@
* @jest-environment jsdom
*/
import {
Expression,
Workflow,
} from "../src";
import * as Helpers from "./Helpers";
import {
DateTime,
Duration,
Interval
} from "luxon";
import { Expression, Workflow } from '../src';
import * as Helpers from './Helpers';
import { DateTime, Duration, Interval } from 'luxon';
describe('Expression', () => {
describe('getParameterValue()', () => {
const nodeTypes = Helpers.NodeTypes();
const workflow = new Workflow({ nodes: [
{
name: 'node',
typeVersion: 1,
type: 'test.set',
id: 'uuid-1234',
position: [0, 0],
parameters: {}
}
], connections: {}, active: false, nodeTypes });
const workflow = new Workflow({
nodes: [
{
name: 'node',
typeVersion: 1,
type: 'test.set',
id: 'uuid-1234',
position: [0, 0],
parameters: {},
},
],
connections: {},
active: false,
nodeTypes,
});
const expression = new Expression(workflow);
const evaluate = (value: string) => expression.getParameterValue(
value,
null,
0,
0,
'node',
[],
'manual',
'',
{},
);
const evaluate = (value: string) =>
expression.getParameterValue(value, null, 0, 0, 'node', [], 'manual', '', {});
it('should not be able to use global built-ins from denylist', () => {
expect(evaluate('={{document}}')).toEqual({});
@ -81,8 +70,12 @@ describe('Expression', () => {
it('should be able to use global built-ins from allowlist', () => {
expect(evaluate('={{new Date()}}')).toBeInstanceOf(Date);
expect(evaluate('={{DateTime.now().toLocaleString()}}')).toEqual(DateTime.now().toLocaleString());
expect(evaluate('={{Interval.after(new Date(), 100)}}')).toEqual(Interval.after(new Date(), 100));
expect(evaluate('={{DateTime.now().toLocaleString()}}')).toEqual(
DateTime.now().toLocaleString(),
);
expect(evaluate('={{Interval.after(new Date(), 100)}}')).toEqual(
Interval.after(new Date(), 100),
);
expect(evaluate('={{Duration.fromMillis(100)}}')).toEqual(Duration.fromMillis(100));
expect(evaluate('={{new Object()}}')).toEqual(new Object());
@ -116,31 +109,41 @@ describe('Expression', () => {
expect(evaluate('={{Intl}}')).toEqual(Intl);
expect(evaluate('={{new String()}}')).toEqual(new String());
expect(evaluate('={{new RegExp(\'\')}}')).toEqual(new RegExp(''));
expect(evaluate("={{new RegExp('')}}")).toEqual(new RegExp(''));
expect(evaluate('={{Math}}')).toEqual(Math);
expect(evaluate('={{new Number()}}')).toEqual(new Number());
expect(evaluate('={{BigInt(\'1\')}}')).toEqual(BigInt('1'));
expect(evaluate("={{BigInt('1')}}")).toEqual(BigInt('1'));
expect(evaluate('={{Infinity}}')).toEqual(Infinity);
expect(evaluate('={{NaN}}')).toEqual(NaN);
expect(evaluate('={{isFinite(1)}}')).toEqual(isFinite(1));
expect(evaluate('={{isNaN(1)}}')).toEqual(isNaN(1));
expect(evaluate('={{parseFloat(\'1\')}}')).toEqual(parseFloat('1'));
expect(evaluate('={{parseInt(\'1\', 10)}}')).toEqual(parseInt('1', 10));
expect(evaluate("={{parseFloat('1')}}")).toEqual(parseFloat('1'));
expect(evaluate("={{parseInt('1', 10)}}")).toEqual(parseInt('1', 10));
expect(evaluate('={{JSON.stringify({})}}')).toEqual(JSON.stringify({}));
expect(evaluate('={{new ArrayBuffer(10)}}')).toEqual(new ArrayBuffer(10));
expect(evaluate('={{new SharedArrayBuffer(10)}}')).toEqual(new SharedArrayBuffer(10));
expect(evaluate('={{Atomics}}')).toEqual(Atomics);
expect(evaluate('={{new DataView(new ArrayBuffer(1))}}')).toEqual(new DataView(new ArrayBuffer(1)));
expect(evaluate('={{new DataView(new ArrayBuffer(1))}}')).toEqual(
new DataView(new ArrayBuffer(1)),
);
expect(evaluate('={{encodeURI(\'https://google.com\')}}')).toEqual(encodeURI('https://google.com'));
expect(evaluate('={{encodeURIComponent(\'https://google.com\')}}')).toEqual(encodeURIComponent('https://google.com'));
expect(evaluate('={{decodeURI(\'https://google.com\')}}')).toEqual(decodeURI('https://google.com'));
expect(evaluate('={{decodeURIComponent(\'https://google.com\')}}')).toEqual(decodeURIComponent('https://google.com'));
expect(evaluate("={{encodeURI('https://google.com')}}")).toEqual(
encodeURI('https://google.com'),
);
expect(evaluate("={{encodeURIComponent('https://google.com')}}")).toEqual(
encodeURIComponent('https://google.com'),
);
expect(evaluate("={{decodeURI('https://google.com')}}")).toEqual(
decodeURI('https://google.com'),
);
expect(evaluate("={{decodeURIComponent('https://google.com')}}")).toEqual(
decodeURIComponent('https://google.com'),
);
expect(evaluate('={{Boolean(1)}}')).toEqual(Boolean(1));
expect(evaluate('={{Symbol(1).toString()}}')).toEqual(Symbol(1).toString());
});
});
})
});

View file

@ -119,8 +119,8 @@ export class CredentialsHelper extends ICredentialsHelper {
node: INode,
credentialsExpired: boolean,
): Promise<{ updatedCredentials: boolean; data: ICredentialDataDecryptedObject }> {
return { updatedCredentials: false, data: {} }
};
return { updatedCredentials: false, data: {} };
}
getParentTypes(name: string): string[] {
return [];

View file

@ -181,11 +181,7 @@ function numericId(length = positiveDigit()) {
}
function alphanumericId() {
return chooseRandomly([
`john${numericId()}`,
`title${numericId(1)}`,
numericId(),
]);
return chooseRandomly([`john${numericId()}`, `title${numericId(1)}`, numericId()]);
}
const chooseRandomly = <T>(array: T[]) => array[Math.floor(Math.random() * array.length)];

View file

@ -17,7 +17,8 @@
"resolveJsonModule": true,
"incremental": true,
"declaration": true,
"sourceMap": true
"sourceMap": true,
"skipLibCheck": true
},
"exclude": ["**/dist/**/*", "**/node_modules/**/*"]
}