mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat: Upgrade nodes-base package to use modern tsconfig.json (no-changelog) (#16884)
This commit is contained in:
@@ -37,7 +37,7 @@ export class JsTaskRunnerSandbox {
|
||||
|
||||
return executionResult.ok
|
||||
? executionResult.result
|
||||
: this.throwExecutionError(executionResult.error);
|
||||
: this.throwExecutionError('error' in executionResult ? executionResult.error : {});
|
||||
}
|
||||
|
||||
async runCodeForEachItem(numInputItems: number): Promise<INodeExecutionData[]> {
|
||||
@@ -64,7 +64,7 @@ export class JsTaskRunnerSandbox {
|
||||
);
|
||||
|
||||
if (!executionResult.ok) {
|
||||
return this.throwExecutionError(executionResult.error);
|
||||
return this.throwExecutionError('error' in executionResult ? executionResult.error : {});
|
||||
}
|
||||
|
||||
executionResults = executionResults.concat(executionResult.result);
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
type AssignmentCollectionValue,
|
||||
type IExecuteFunctions,
|
||||
type INodeTypes,
|
||||
type NodeParameterValueType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { GoogleSheet } from '../../Google/Sheet/v2/helpers/GoogleSheet';
|
||||
@@ -62,7 +63,7 @@ describe('Test Evaluation', () => {
|
||||
sheetMode: 'id',
|
||||
operation: 'setOutputs',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -88,7 +89,7 @@ describe('Test Evaluation', () => {
|
||||
sheetMode: 'id',
|
||||
operation: 'setOutputs',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -125,7 +126,7 @@ describe('Test Evaluation', () => {
|
||||
sheetMode: 'id',
|
||||
operation: 'setOutputs',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
mockExecuteFunctions.getParentNodes.mockReturnValue([]);
|
||||
@@ -152,7 +153,7 @@ describe('Test Evaluation', () => {
|
||||
sheetMode: 'id',
|
||||
operation: 'setOutputs',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -299,7 +300,7 @@ describe('Test Evaluation', () => {
|
||||
const mockParams: { [key: string]: unknown } = {
|
||||
operation: 'checkIfEvaluating',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import type { IExecuteFunctions } from 'n8n-workflow';
|
||||
import type { IExecuteFunctions, NodeParameterValueType } from 'n8n-workflow';
|
||||
|
||||
import { GoogleSheet } from '../../Google/Sheet/v2/helpers/GoogleSheet';
|
||||
import { EvaluationTrigger } from '../EvaluationTrigger/EvaluationTrigger.node.ee';
|
||||
@@ -72,7 +72,7 @@ describe('Evaluation Trigger Node', () => {
|
||||
sheetName,
|
||||
sheetMode: 'id',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -123,7 +123,7 @@ describe('Evaluation Trigger Node', () => {
|
||||
sheetName,
|
||||
sheetMode: 'id',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -174,7 +174,7 @@ describe('Evaluation Trigger Node', () => {
|
||||
sheetName,
|
||||
sheetMode: 'id',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -213,7 +213,7 @@ describe('Evaluation Trigger Node', () => {
|
||||
limitRows: true,
|
||||
maxRows: 1,
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -282,7 +282,7 @@ describe('Evaluation Trigger Node', () => {
|
||||
sheetName,
|
||||
sheetMode: 'id',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -364,7 +364,7 @@ describe('Evaluation Trigger Node', () => {
|
||||
limitRows: true,
|
||||
maxRows: 2,
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -431,7 +431,7 @@ describe('Evaluation Trigger Node', () => {
|
||||
sheetName,
|
||||
sheetMode: 'id',
|
||||
};
|
||||
return mockParams[key] ?? fallbackValue;
|
||||
return (mockParams[key] ?? fallbackValue) as NodeParameterValueType;
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
AddressFixedCollection,
|
||||
FreshserviceCredentials,
|
||||
LoadedResource,
|
||||
LoadedUser,
|
||||
RolesParameter,
|
||||
} from './types';
|
||||
|
||||
@@ -12,6 +12,7 @@ import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
FreshworksConfigResponse,
|
||||
FreshworksCrmApiCredentials,
|
||||
LoadedResource,
|
||||
SalesAccounts,
|
||||
ViewsResponse,
|
||||
} from './types';
|
||||
|
||||
@@ -7,6 +7,11 @@ export type FreshworksConfigResponse<T> = {
|
||||
[key: string]: T[];
|
||||
};
|
||||
|
||||
export type LoadedResource = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type LoadOption = {
|
||||
name: string;
|
||||
value: string;
|
||||
|
||||
@@ -56,7 +56,7 @@ export async function readSheet(
|
||||
data,
|
||||
headerRow: keyRowIndex,
|
||||
firstDataRow: dataStartRowIndex,
|
||||
} = prepareSheetData(sheetData, dataLocationOnSheetOptions);
|
||||
} = prepareSheetData(sheetData, dataLocationOnSheetOptions as RangeDetectionOptions);
|
||||
|
||||
let responseData = [];
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ export async function execute(
|
||||
}
|
||||
|
||||
if (typeof entityToSplit !== 'object' || entityToSplit === null) {
|
||||
entityToSplit = [entityToSplit];
|
||||
entityToSplit = [entityToSplit] as unknown as IDataObject[];
|
||||
}
|
||||
|
||||
if (!Array.isArray(entityToSplit)) {
|
||||
|
||||
@@ -193,7 +193,9 @@ export function getAddressesUi(): INodeProperties {
|
||||
};
|
||||
}
|
||||
|
||||
export function adjustAddresses(addresses: [{ street: string; [key: string]: string }]): Address[] {
|
||||
export function adjustAddresses(
|
||||
addresses: Array<{ street: string; [key: string]: string }>,
|
||||
): Address[] {
|
||||
const _addresses: Address[] = [];
|
||||
for (let i = 0; i < addresses.length; i++) {
|
||||
if (addresses[i]?.region === '') {
|
||||
|
||||
@@ -169,6 +169,7 @@ export class Magento2 implements INodeType {
|
||||
)) as CustomerAttributeMetadata[];
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
for (const attribute of attributes) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
|
||||
if (attribute.system === false && attribute.frontend_label !== '') {
|
||||
returnData.push({
|
||||
name: attribute.frontend_label as string,
|
||||
@@ -189,6 +190,7 @@ export class Magento2 implements INodeType {
|
||||
)) as CustomerAttributeMetadata[];
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
for (const attribute of attributes) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
|
||||
if (attribute.system === true && attribute.frontend_label !== null) {
|
||||
returnData.push({
|
||||
name: attribute.frontend_label as string,
|
||||
@@ -346,7 +348,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
body.customer!.addresses = adjustAddresses(addresses?.address || []);
|
||||
|
||||
body.customer!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
body.customer!.custom_attributes = customAttributes?.customAttribute || [];
|
||||
|
||||
body.customer!.extension_attributes = [
|
||||
'amazon_id',
|
||||
@@ -490,7 +492,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
body.customer!.addresses = adjustAddresses(addresses?.address || []);
|
||||
|
||||
body.customer!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
body.customer!.custom_attributes = customAttributes?.customAttribute || [];
|
||||
|
||||
body.customer!.extension_attributes = [
|
||||
'amazon_id',
|
||||
@@ -661,7 +663,7 @@ export class Magento2 implements INodeType {
|
||||
},
|
||||
};
|
||||
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || [];
|
||||
|
||||
Object.assign(body.product!, rest);
|
||||
|
||||
@@ -776,7 +778,7 @@ export class Magento2 implements INodeType {
|
||||
},
|
||||
};
|
||||
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || [];
|
||||
|
||||
Object.assign(body.product!, rest);
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ export async function execute(
|
||||
const mergeIntoSingleObject = selectMergeMethod(clashHandling);
|
||||
|
||||
for (let i = 0; i < numEntries; i++) {
|
||||
const preferredEntry = preferred[i] ?? {};
|
||||
const restEntries = inputsData.map((input) => input[i] ?? {});
|
||||
const preferredEntry = preferred[i] ?? ({} as INodeExecutionData);
|
||||
const restEntries = inputsData.map((input) => input[i] ?? ({} as INodeExecutionData));
|
||||
|
||||
const json = {
|
||||
...mergeIntoSingleObject(
|
||||
|
||||
@@ -207,7 +207,7 @@ export async function handleErrorPostReceive(
|
||||
if (resource === 'file' && operation === 'download' && Buffer.isBuffer(response.body)) {
|
||||
response.body = jsonParse((response.body as Buffer).toString());
|
||||
}
|
||||
const error = (response.body as IErrorResponse)?.error ?? {};
|
||||
const error = (response.body as IErrorResponse)?.error ?? ({} as IErrorResponse['error']);
|
||||
|
||||
if (resource === 'file') {
|
||||
if (operation === 'download') {
|
||||
|
||||
@@ -8,6 +8,7 @@ import type {
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
@@ -388,7 +389,7 @@ export class MicrosoftTeamsTrigger implements INodeType {
|
||||
workflowData: eventNotifications.map((event) => [
|
||||
{
|
||||
json: (event.resourceData as IDataObject) ?? event,
|
||||
},
|
||||
} as INodeExecutionData,
|
||||
]),
|
||||
};
|
||||
|
||||
|
||||
@@ -271,8 +271,7 @@ function getTexts(texts: TextData[]) {
|
||||
type: 'mention',
|
||||
mention: {
|
||||
type: text.mentionType,
|
||||
//@ts-expect-error any
|
||||
[text.mentionType]: { id: text[text.mentionType] as string },
|
||||
[text.mentionType]: { id: text[text.mentionType as keyof TextData] as string },
|
||||
},
|
||||
annotations: text.annotationUi,
|
||||
});
|
||||
|
||||
@@ -184,10 +184,10 @@ export const parseMessage = async (
|
||||
};
|
||||
} else {
|
||||
let content: IDataObject | string = message.content.toString();
|
||||
if (options.jsonParseBody) {
|
||||
if ('jsonParseBody' in options && options.jsonParseBody) {
|
||||
content = jsonParse(content);
|
||||
}
|
||||
if (options.onlyContent) {
|
||||
if ('onlyContent' in options && options.onlyContent) {
|
||||
return { json: content as IDataObject };
|
||||
} else {
|
||||
message.content = content as unknown as Buffer;
|
||||
|
||||
@@ -208,7 +208,10 @@ export class SeaTableTriggerV2 implements INodeType {
|
||||
const newRows: any = [];
|
||||
for (const row of rows) {
|
||||
if (assetColumnType === 'digital-sign') {
|
||||
const signature = (row[assetColumn] as IColumnDigitalSignature) || [];
|
||||
const signature = (row[assetColumn] as IColumnDigitalSignature) || {
|
||||
sign_time: undefined,
|
||||
};
|
||||
|
||||
if (signature.sign_time) {
|
||||
if (new Date(signature.sign_time) > new Date(startDate)) {
|
||||
newRows.push(signature);
|
||||
|
||||
@@ -206,7 +206,7 @@ export const validateEntry = (
|
||||
if (ignoreErrors) {
|
||||
return { name, value: value ?? null };
|
||||
} else {
|
||||
const message = `${validationResult.errorMessage} [item ${itemIndex}]`;
|
||||
const message = `${'errorMessage' in validationResult ? validationResult.errorMessage : 'Error'} [item ${itemIndex}]`;
|
||||
throw new NodeOperationError(node, message, {
|
||||
itemIndex,
|
||||
description,
|
||||
|
||||
@@ -11,6 +11,7 @@ import type {
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
import type { LoadedResource, Resource } from './types';
|
||||
|
||||
export async function getAuthorization(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
|
||||
@@ -26,6 +26,15 @@ import {
|
||||
throwOnEmptyUpdate,
|
||||
toOptions,
|
||||
} from './GenericFunctions';
|
||||
import type {
|
||||
LoadedEpic,
|
||||
LoadedResource,
|
||||
LoadedTags,
|
||||
LoadedUser,
|
||||
LoadedUserStory,
|
||||
Operation,
|
||||
Resource,
|
||||
} from './types';
|
||||
|
||||
export class Taiga implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { getAutomaticSecret, taigaApiRequest } from './GenericFunctions';
|
||||
import type { Operations, Resources, WebhookPayload } from './types';
|
||||
|
||||
// import {
|
||||
// createHmac,
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
type Resource = 'epic' | 'issue' | 'task' | 'userStory';
|
||||
export type Resource = 'epic' | 'issue' | 'task' | 'userStory';
|
||||
|
||||
type Operation = 'create' | 'delete' | 'update' | 'get' | 'getAll';
|
||||
export type Operation = 'create' | 'delete' | 'update' | 'get' | 'getAll';
|
||||
|
||||
type LoadedResource = {
|
||||
export type LoadedResource = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
type LoadOption = {
|
||||
export type LoadOption = {
|
||||
value: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
type LoadedUser = {
|
||||
export type LoadedUser = {
|
||||
id: string;
|
||||
full_name_display: string;
|
||||
};
|
||||
|
||||
type LoadedUserStory = {
|
||||
export type LoadedUserStory = {
|
||||
id: string;
|
||||
subject: string;
|
||||
};
|
||||
|
||||
type LoadedEpic = LoadedUserStory;
|
||||
export type LoadedEpic = LoadedUserStory;
|
||||
|
||||
type LoadedTags = {
|
||||
export type LoadedTags = {
|
||||
[tagName: string]: string | null; // hex color
|
||||
};
|
||||
|
||||
type Operations = 'all' | 'create' | 'delete' | 'change';
|
||||
export type Operations = 'all' | 'create' | 'delete' | 'change';
|
||||
|
||||
type Resources = 'all' | 'issue' | 'milestone' | 'task' | 'userstory' | 'wikipage';
|
||||
export type Resources = 'all' | 'issue' | 'milestone' | 'task' | 'userstory' | 'wikipage';
|
||||
|
||||
type WebhookPayload = {
|
||||
export type WebhookPayload = {
|
||||
action: Operations;
|
||||
type: Resources;
|
||||
by: Record<string, string | number>;
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import OTPAuth from 'otpauth';
|
||||
import * as OTPAuth from 'otpauth';
|
||||
|
||||
export class Totp implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
||||
@@ -173,7 +173,7 @@ export class SplitOut implements INodeType {
|
||||
}
|
||||
|
||||
if (typeof entityToSplit !== 'object' || entityToSplit === null) {
|
||||
entityToSplit = [entityToSplit];
|
||||
entityToSplit = [entityToSplit] as unknown as IDataObject[];
|
||||
}
|
||||
|
||||
if (!Array.isArray(entityToSplit)) {
|
||||
|
||||
Reference in New Issue
Block a user