mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-27 10:17:33 -07:00
1db4fa2bf8
* Introduce node deprecation (#3930) ✨ Introduce node deprecation * 🚧 Scaffold out Code node * 👕 Fix lint * 📘 Create types file * 🚚 Rename theme * 🔥 Remove unneeded prop * ⚡ Override keybindings * ⚡ Expand lintings * ⚡ Create editor content getter * 🚚 Ensure all helpers use `$` * ✨ Add autocompletion * ⚡ Filter out welcome note node * ⚡ Convey error line number * ⚡ Highlight error line * ⚡ Restore logging from node * ✨ More autocompletions * ⚡ Streamline completions * ✏️ Update placeholders * ⚡ Update linter to new methods * 🔥 Remove `$nodeItem` completions * ⚡ Re-update placeholders * 🎨 Fix formatting * 📦 Update `package-lock.json` * ⚡ Refresh with multi-line empty string * ⚡ Account for syntax errors * 🔥 Remove unneeded variant * ⚡ Minor improvements * ⚡ Add more autocompletions * 🚚 Rename extension * 🔥 Remove outdated comments * 🚚 Rename field * ✨ More autocompletions * ⚡ Fix up error display when empty text * 🔥 Remove logging * ✨ More error validation * 🐛 Fix `pairedItem` to `pairedItem()` * ⚡ Add item to validation info * 📦 Update `package-lock.json` * ⚡ Leftover fixes * ⚡ Set `insertNewlineAndIndent` * 📦 Update `package-lock.json` * 📦 Re-update `package-lock.json` * 👕 Add lint exception * 📘 Add type to mixin type * Clean up comment * ⚡ Refactor completion per new requirements * ⚡ Adjust placeholders * ⚡ Add `json` autocompletions for `$input` * 🎨 Set border * ⚡ Restore local completion source * ⚡ Implement autocompletion for imports * ⚡ Add `.*` to follow user typing on autocompletion * 📘 Fix typings in autocompletions * 👕 Add linting for use of `item()` * 📦 Update `package-lock.json` * 🐛 Fix for `$items(nodeName)[0]` * ⚡ Filter down built-in modules list * ⚡ Refactor error handling * ⚡ Linter and validation improvements * ⚡ Apply review feedback * ♻️ More general refactorings * ⚡ Add dot notation utility * Customize input handler * ⚡ Support `.json.` completions * ⚡ Adjust placeholder * ⚡ Sort imports * 🔥 Remove blank rows addition * ⚡ Add more error validation * 📦 Update `package-lock.json` * ⚡ Make date logging consistent * 🔧 Adjust linting highlight range * ⚡ Add line numbers to each item mode errors * ⚡ Allow for links in error descriptions * ⚡ More input validation * ⚡ Expand linting to loops * ⚡ Deprecate Function and Function Item nodes * 🐛 Fix placeholder syntax * 📘 Narrow down type * 🚚 Rename using kebab-case * 🔥 Remove `mapGetters` * ✏️ Fix casing * ⚡ Adjust import for type * ✏️ Fix quotes * 🐛 Fix `activeNode` reference * ⚡ Use constant * 🔥 Remove logging * ✏️ Fix typo * ⚡ Add missing `notice` * ✏️ Add tags * ✏️ Fix alias * ✏️ Update copy * 🔥 Remove wrong linting * ✏️ Update copy * ⚡ Add validation for `null` * ⚡ Add validation for non-object and non-array * ⚡ Add validation for non-array with json * ✏️ Intentionally use wrong spelling * ⚡ More validation * ✏️ More copy updates * ✏️ Placeholder updates * ⏪ Restore spelling * ⚡ Fix var name * ✏️ More copy updates * ⚡ Add luxon autocompletions * ⚡ Make scrollable * ⚡ Fix comma from merge conflict resolution * 📦 Update `package-lock.json` * 👕 Fix lint detail * 🎨 Set font family * ⚡ Bring in expressions fix * ♻️ Address feedback * ⚡ Exclude codemirror packages from render chunks * 🐛 Fix placeholder not showing on first load * feat(editor-ui): Replace `lezer` with `esprima` in client linter (#4192) * 🔥 Remove addition from misresolved conflict * ⚡ Replace `lezer` with `esprima` in client linter * ⚡ Add missing key * 📦 Update `package-lock.json` * ⚡ Match dependencies * 📦 Update `package-lock.json` * 📦 Re-update `package-lock.json` * ⚡ Match whitespace * 🐛 Fix selection * ⚡ Expand validation * 🔥 Remove validation * ✏️ Update copy * 🚚 Move to constants * ⚡ More `null` validation * ⚡ Support `all()` with index to access item * ⚡ Gloss over n8n syntax error * 🎨 Re-style diagnostic button * 🔥 Remove `item` as `itemAlias` * ⚡ Add linting for `item.json` in single item mode * ⚡ Refactor to add label info descriptions * ⚡ More autocompletions * 👕 Fix lint * ⚡ Simplify typings * feat(nodes-base): Multiline autocompletion for `code-node-editor` (#4220) * ⚡ Simplify typings * ⚡ Consolidate helpers in utils * ⚡ Multiline autocompletion for standalone vars * 🔥 Remove unneeded mixins * ✏️ Update copy * ✏️ Prep TODOs * ⚡ Multiline completion for `$input.method` + `$input.item` * 🔥 Remove unused method * 🔥 Remove another unused method * 🚚 Move luxon strings to helpers * ⚡ Multiline autocompletion for methods output * ⚡ Refactor to use optional chaining * 👕 Fix lint * ✏️ Update TODOs * ⚡ Multiline autocompletion for `json` fields * 📘 Add typings * ⚡ De-duplicate callback to forEach * 🐛 Fix autocompletions not working with leading whitespace * 🌐 Apply i18n * 👕 Fix lint * :constructor: Second-period var usage completions * 👕 Fix lint * 👕 Add exception * ⚡ Add completion telemetry * 📘 Add typing * ⚡ Major refactoring to organize * 🐛 Fix multiline `.all()[index]` * 🐛 Do not autoclose square brackets prior to `.json` * 🐛 Fix accessor for multiline `jsonField` completions * ⚡ Add completions for half-assignments * 🐛 Fix `jsonField` completions for `x.json` * ✏️ Improve comments * 🐛 Fix `.json[field]` for multiline matches * ⚡ Cleanup * 📦 Update `package-lock.json` * 👕 Fix lint * 🐛 Rely on original value for custom matcher * ⚡ Create `customMatcherJsonFieldCompletions` to simplify setup * 🐛 Include selector in `customMatcherJsonField` completions * ✏️ Make naming consistent * ✏️ Add docline * ⚡ Finish self-review cleanup * 🔥 Remove outdated comment * 📌 Pin luxon to major-minor * ✏️ Fix typo * 📦 Update `package-lock.json` * 📦 Update `package-lock.json` * 📦 Re-update `package-lock.json` * ➕ Add `luxon` for Gmail node * 📦 Update `package-lock.json` * ⚡ Replace Function with Code in suggested nodes * 🐛 Fix `$prevNode` completions * ✏️ Update `$execution.mode` copy * ⚡ Separate luxon getters from methods * ⚡ Adjusting linter to tolerate `.binary` * ⚡ Adjust top-level item keys check * ⚡ Anticipate user expecting `item` to pre-exist * ⚡ Add linting for legacy item access * ⚡ Add hint for attempted `items` access * ⚡ Add keybinding for toggling comments * ✏️ Update copy of `all`, `first`, `last` and `itemMatching` * 🐛 Make `input.all()` etc act on copies * 📦 Update `package-lock.json` * 🐛 Fix guard in `$input.last()` * ♻️ Address Jan's feedback * ⬆️ Upgrade `eslint-plugin-n8n-nodes-base` * 📦 Update `package-lock.json` * 🔥 Remove unneeded exceptions * ⚡ Restore placeholder logic * ⚡ Add placeholders to client * ⚡ Account for shadow item * ✏️ More completion info labels * 👕 Fix lint * ✏️ Update copy * ✏️ Update copy * ✏️ More copy updates * 📦 Update `package-lock.json` * ⚡ Add more validation * ⚡ Add placheolder on first load * Replace `Cmd` with `Mod` * 📦 Update `package-lock.json`
764 lines
18 KiB
TypeScript
764 lines
18 KiB
TypeScript
/* eslint-disable @typescript-eslint/naming-convention */
|
|
/* eslint-disable import/no-cycle */
|
|
import {
|
|
ExecutionError,
|
|
ICredentialDataDecryptedObject,
|
|
ICredentialsDecrypted,
|
|
ICredentialsEncrypted,
|
|
IDataObject,
|
|
IDeferredPromise,
|
|
IExecuteResponsePromiseData,
|
|
IPinData,
|
|
IRun,
|
|
IRunData,
|
|
IRunExecutionData,
|
|
ITaskData,
|
|
ITelemetrySettings,
|
|
ITelemetryTrackProperties,
|
|
IWorkflowBase as IWorkflowBaseWorkflow,
|
|
Workflow,
|
|
WorkflowActivateMode,
|
|
WorkflowExecuteMode,
|
|
} from 'n8n-workflow';
|
|
|
|
import { WorkflowExecute } from 'n8n-core';
|
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
import PCancelable from 'p-cancelable';
|
|
import { Repository } from 'typeorm';
|
|
|
|
import { ChildProcess } from 'child_process';
|
|
import { Url } from 'url';
|
|
|
|
import type { Request } from 'express';
|
|
import type { InstalledNodes } from './databases/entities/InstalledNodes';
|
|
import type { InstalledPackages } from './databases/entities/InstalledPackages';
|
|
import type { Role } from './databases/entities/Role';
|
|
import type { Settings } from './databases/entities/Settings';
|
|
import type { SharedCredentials } from './databases/entities/SharedCredentials';
|
|
import type { SharedWorkflow } from './databases/entities/SharedWorkflow';
|
|
import type { TagEntity } from './databases/entities/TagEntity';
|
|
import type { User } from './databases/entities/User';
|
|
import type { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
|
import { CredentialUsage } from './databases/entities/CredentialUsage';
|
|
|
|
export interface IActivationError {
|
|
time: number;
|
|
error: {
|
|
message: string;
|
|
};
|
|
}
|
|
|
|
export interface IQueuedWorkflowActivations {
|
|
activationMode: WorkflowActivateMode;
|
|
lastTimeout: number;
|
|
timeout: NodeJS.Timeout;
|
|
workflowData: IWorkflowDb;
|
|
}
|
|
|
|
export interface ICustomRequest extends Request {
|
|
parsedUrl: Url | undefined;
|
|
}
|
|
|
|
export interface ICredentialsTypeData {
|
|
[key: string]: {
|
|
className: string;
|
|
sourcePath: string;
|
|
};
|
|
}
|
|
|
|
export interface ICredentialsOverwrite {
|
|
[key: string]: ICredentialDataDecryptedObject;
|
|
}
|
|
|
|
export interface IDatabaseCollections {
|
|
Credentials: Repository<ICredentialsDb>;
|
|
Execution: Repository<IExecutionFlattedDb>;
|
|
Workflow: Repository<WorkflowEntity>;
|
|
Webhook: Repository<IWebhookDb>;
|
|
Tag: Repository<TagEntity>;
|
|
Role: Repository<Role>;
|
|
User: Repository<User>;
|
|
SharedCredentials: Repository<SharedCredentials>;
|
|
SharedWorkflow: Repository<SharedWorkflow>;
|
|
Settings: Repository<Settings>;
|
|
InstalledPackages: Repository<InstalledPackages>;
|
|
InstalledNodes: Repository<InstalledNodes>;
|
|
CredentialUsage: Repository<CredentialUsage>;
|
|
}
|
|
|
|
export interface IWebhookDb {
|
|
workflowId: number | string;
|
|
webhookPath: string;
|
|
method: string;
|
|
node: string;
|
|
webhookId?: string;
|
|
pathLength?: number;
|
|
}
|
|
|
|
// ----------------------------------
|
|
// settings
|
|
// ----------------------------------
|
|
|
|
export interface ISettingsDb {
|
|
key: string;
|
|
value: string | boolean | IDataObject | number;
|
|
loadOnStartup: boolean;
|
|
}
|
|
|
|
// ----------------------------------
|
|
// tags
|
|
// ----------------------------------
|
|
|
|
export interface ITagDb {
|
|
id: number;
|
|
name: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface ITagToImport {
|
|
id: string | number;
|
|
name: string;
|
|
createdAt?: string;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
export type UsageCount = {
|
|
usageCount: number;
|
|
};
|
|
|
|
export type ITagWithCountDb = ITagDb & UsageCount;
|
|
|
|
// ----------------------------------
|
|
// workflows
|
|
// ----------------------------------
|
|
|
|
export interface IWorkflowBase extends IWorkflowBaseWorkflow {
|
|
id?: number | string;
|
|
}
|
|
|
|
// Almost identical to editor-ui.Interfaces.ts
|
|
export interface IWorkflowDb extends IWorkflowBase {
|
|
id: number | string;
|
|
tags?: ITagDb[];
|
|
}
|
|
|
|
export interface IWorkflowToImport extends IWorkflowBase {
|
|
tags: ITagToImport[];
|
|
}
|
|
|
|
export interface IWorkflowResponse extends IWorkflowBase {
|
|
id: string;
|
|
}
|
|
|
|
// ----------------------------------
|
|
// credentials
|
|
// ----------------------------------
|
|
|
|
export interface ICredentialsBase {
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface ICredentialsDb extends ICredentialsBase, ICredentialsEncrypted {
|
|
id: number | string;
|
|
name: string;
|
|
shared?: SharedCredentials[];
|
|
}
|
|
|
|
export interface ICredentialsResponse extends ICredentialsDb {
|
|
id: string;
|
|
}
|
|
|
|
export interface ICredentialsDecryptedDb extends ICredentialsBase, ICredentialsDecrypted {
|
|
id: number | string;
|
|
}
|
|
|
|
export interface ICredentialsDecryptedResponse extends ICredentialsDecryptedDb {
|
|
id: string;
|
|
}
|
|
|
|
export type DatabaseType = 'mariadb' | 'postgresdb' | 'mysqldb' | 'sqlite';
|
|
export type SaveExecutionDataType = 'all' | 'none';
|
|
|
|
export interface IExecutionBase {
|
|
id?: number | string;
|
|
mode: WorkflowExecuteMode;
|
|
startedAt: Date;
|
|
stoppedAt?: Date; // empty value means execution is still running
|
|
workflowId?: string; // To be able to filter executions easily //
|
|
finished: boolean;
|
|
retryOf?: number | string; // If it is a retry, the id of the execution it is a retry of.
|
|
retrySuccessId?: number | string; // If it failed and a retry did succeed. The id of the successful retry.
|
|
}
|
|
|
|
// Data in regular format with references
|
|
export interface IExecutionDb extends IExecutionBase {
|
|
data: IRunExecutionData;
|
|
waitTill?: Date;
|
|
workflowData?: IWorkflowBase;
|
|
}
|
|
|
|
export interface IExecutionPushResponse {
|
|
executionId?: string;
|
|
waitingForWebhook?: boolean;
|
|
}
|
|
|
|
export interface IExecutionResponse extends IExecutionBase {
|
|
id: string;
|
|
data: IRunExecutionData;
|
|
retryOf?: string;
|
|
retrySuccessId?: string;
|
|
waitTill?: Date;
|
|
workflowData: IWorkflowBase;
|
|
}
|
|
|
|
// Flatted data to save memory when saving in database or transferring
|
|
// via REST API
|
|
export interface IExecutionFlatted extends IExecutionBase {
|
|
data: string;
|
|
workflowData: IWorkflowBase;
|
|
}
|
|
|
|
export interface IExecutionFlattedDb extends IExecutionBase {
|
|
id: number | string;
|
|
data: string;
|
|
waitTill?: Date | null;
|
|
workflowData: Omit<IWorkflowBase, 'pinData'>;
|
|
}
|
|
|
|
export interface IExecutionFlattedResponse extends IExecutionFlatted {
|
|
id: string;
|
|
retryOf?: string;
|
|
}
|
|
|
|
export interface IExecutionResponseApi {
|
|
id: number | string;
|
|
mode: WorkflowExecuteMode;
|
|
startedAt: Date;
|
|
stoppedAt?: Date;
|
|
workflowId?: string;
|
|
finished: boolean;
|
|
retryOf?: number | string;
|
|
retrySuccessId?: number | string;
|
|
data?: object;
|
|
waitTill?: Date | null;
|
|
workflowData: IWorkflowBase;
|
|
}
|
|
export interface IExecutionsListResponse {
|
|
count: number;
|
|
// results: IExecutionShortResponse[];
|
|
results: IExecutionsSummary[];
|
|
estimated: boolean;
|
|
}
|
|
|
|
export interface IExecutionsStopData {
|
|
finished?: boolean;
|
|
mode: WorkflowExecuteMode;
|
|
startedAt: Date;
|
|
stoppedAt?: Date;
|
|
}
|
|
|
|
export interface IExecutionsSummary {
|
|
id: string;
|
|
finished?: boolean;
|
|
mode: WorkflowExecuteMode;
|
|
retryOf?: string;
|
|
retrySuccessId?: string;
|
|
waitTill?: Date;
|
|
startedAt: Date;
|
|
stoppedAt?: Date;
|
|
workflowId: string;
|
|
workflowName?: string;
|
|
}
|
|
|
|
export interface IExecutionsCurrentSummary {
|
|
id: string;
|
|
retryOf?: string;
|
|
startedAt: Date;
|
|
mode: WorkflowExecuteMode;
|
|
workflowId: string;
|
|
}
|
|
|
|
export interface IExecutionDeleteFilter {
|
|
deleteBefore?: Date;
|
|
filters?: IDataObject;
|
|
ids?: string[];
|
|
}
|
|
|
|
export interface IExecutingWorkflowData {
|
|
executionData: IWorkflowExecutionDataProcess;
|
|
process?: ChildProcess;
|
|
startedAt: Date;
|
|
postExecutePromises: Array<IDeferredPromise<IRun | undefined>>;
|
|
responsePromise?: IDeferredPromise<IExecuteResponsePromiseData>;
|
|
workflowExecution?: PCancelable<IRun>;
|
|
}
|
|
|
|
export interface IExternalHooks {
|
|
credentials?: {
|
|
create?: Array<{
|
|
(this: IExternalHooksFunctions, credentialsData: ICredentialsEncrypted): Promise<void>;
|
|
}>;
|
|
delete?: Array<{ (this: IExternalHooksFunctions, credentialId: string): Promise<void> }>;
|
|
update?: Array<{
|
|
(this: IExternalHooksFunctions, credentialsData: ICredentialsDb): Promise<void>;
|
|
}>;
|
|
};
|
|
workflow?: {
|
|
activate?: Array<{ (this: IExternalHooksFunctions, workflowData: IWorkflowDb): Promise<void> }>;
|
|
create?: Array<{ (this: IExternalHooksFunctions, workflowData: IWorkflowBase): Promise<void> }>;
|
|
delete?: Array<{ (this: IExternalHooksFunctions, workflowId: string): Promise<void> }>;
|
|
execute?: Array<{
|
|
(
|
|
this: IExternalHooksFunctions,
|
|
workflowData: IWorkflowDb,
|
|
mode: WorkflowExecuteMode,
|
|
): Promise<void>;
|
|
}>;
|
|
update?: Array<{ (this: IExternalHooksFunctions, workflowData: IWorkflowDb): Promise<void> }>;
|
|
};
|
|
}
|
|
|
|
export interface IExternalHooksFileData {
|
|
[key: string]: {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
[key: string]: Array<(...args: any[]) => Promise<void>>;
|
|
};
|
|
}
|
|
|
|
export interface IExternalHooksFunctions {
|
|
dbCollections: IDatabaseCollections;
|
|
}
|
|
|
|
export interface IExternalHooksClass {
|
|
init(): Promise<void>;
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
run(hookName: string, hookParameters?: any[]): Promise<void>;
|
|
}
|
|
|
|
export interface IDiagnosticInfo {
|
|
versionCli: string;
|
|
databaseType: DatabaseType;
|
|
notificationsEnabled: boolean;
|
|
disableProductionWebhooksOnMainProcess: boolean;
|
|
basicAuthActive: boolean;
|
|
systemInfo: {
|
|
os: {
|
|
type?: string;
|
|
version?: string;
|
|
};
|
|
memory?: number;
|
|
cpus: {
|
|
count?: number;
|
|
model?: string;
|
|
speed?: number;
|
|
};
|
|
};
|
|
executionVariables: {
|
|
[key: string]: string | number | boolean | undefined;
|
|
};
|
|
deploymentType: string;
|
|
binaryDataMode: string;
|
|
n8n_multi_user_allowed: boolean;
|
|
smtp_set_up: boolean;
|
|
}
|
|
|
|
export interface ITelemetryUserDeletionData {
|
|
user_id: string;
|
|
target_user_old_status: 'active' | 'invited';
|
|
migration_strategy?: 'transfer_data' | 'delete_data';
|
|
target_user_id?: string;
|
|
migration_user_id?: string;
|
|
}
|
|
|
|
export interface IInternalHooksClass {
|
|
onN8nStop(): Promise<void>;
|
|
onServerStarted(
|
|
diagnosticInfo: IDiagnosticInfo,
|
|
firstWorkflowCreatedAt?: Date,
|
|
): Promise<unknown[]>;
|
|
onPersonalizationSurveySubmitted(userId: string, answers: Record<string, string>): Promise<void>;
|
|
onWorkflowCreated(userId: string, workflow: IWorkflowBase, publicApi: boolean): Promise<void>;
|
|
onWorkflowDeleted(userId: string, workflowId: string, publicApi: boolean): Promise<void>;
|
|
onWorkflowSaved(userId: string, workflow: IWorkflowBase, publicApi: boolean): Promise<void>;
|
|
onWorkflowPostExecute(
|
|
executionId: string,
|
|
workflow: IWorkflowBase,
|
|
runData?: IRun,
|
|
userId?: string,
|
|
): Promise<void>;
|
|
onUserDeletion(
|
|
userId: string,
|
|
userDeletionData: ITelemetryUserDeletionData,
|
|
publicApi: boolean,
|
|
): Promise<void>;
|
|
onUserInvite(userInviteData: { user_id: string; target_user_id: string[] }): Promise<void>;
|
|
onUserReinvite(userReinviteData: { user_id: string; target_user_id: string }): Promise<void>;
|
|
onUserUpdate(userUpdateData: { user_id: string; fields_changed: string[] }): Promise<void>;
|
|
onUserInviteEmailClick(userInviteClickData: { user_id: string }): Promise<void>;
|
|
onUserPasswordResetEmailClick(userPasswordResetData: { user_id: string }): Promise<void>;
|
|
onUserTransactionalEmail(userTransactionalEmailData: {
|
|
user_id: string;
|
|
message_type: 'Reset password' | 'New user invite' | 'Resend invite';
|
|
}): Promise<void>;
|
|
onUserPasswordResetRequestClick(userPasswordResetData: { user_id: string }): Promise<void>;
|
|
onInstanceOwnerSetup(instanceOwnerSetupData: { user_id: string }): Promise<void>;
|
|
onUserSignup(userSignupData: { user_id: string }): Promise<void>;
|
|
}
|
|
|
|
export interface IN8nConfig {
|
|
database: IN8nConfigDatabase;
|
|
endpoints: IN8nConfigEndpoints;
|
|
executions: IN8nConfigExecutions;
|
|
generic: IN8nConfigGeneric;
|
|
host: string;
|
|
nodes: IN8nConfigNodes;
|
|
port: number;
|
|
protocol: 'http' | 'https';
|
|
}
|
|
|
|
export interface IN8nConfigDatabase {
|
|
type: DatabaseType;
|
|
postgresdb: {
|
|
host: string;
|
|
password: string;
|
|
port: number;
|
|
user: string;
|
|
};
|
|
}
|
|
|
|
export interface IN8nConfigEndpoints {
|
|
rest: string;
|
|
webhook: string;
|
|
webhookTest: string;
|
|
}
|
|
|
|
// eslint-disable-next-line import/export
|
|
export interface IN8nConfigExecutions {
|
|
saveDataOnError: SaveExecutionDataType;
|
|
saveDataOnSuccess: SaveExecutionDataType;
|
|
saveDataManualExecutions: boolean;
|
|
}
|
|
|
|
// eslint-disable-next-line import/export
|
|
export interface IN8nConfigExecutions {
|
|
saveDataOnError: SaveExecutionDataType;
|
|
saveDataOnSuccess: SaveExecutionDataType;
|
|
saveDataManualExecutions: boolean;
|
|
}
|
|
|
|
export interface IN8nConfigGeneric {
|
|
timezone: string;
|
|
}
|
|
|
|
export interface IN8nConfigNodes {
|
|
errorTriggerType: string;
|
|
exclude: string[];
|
|
}
|
|
|
|
export interface IVersionNotificationSettings {
|
|
enabled: boolean;
|
|
endpoint: string;
|
|
infoUrl: string;
|
|
}
|
|
|
|
export interface IN8nNodePackageJson {
|
|
name: string;
|
|
version: string;
|
|
n8n?: {
|
|
credentials?: string[];
|
|
nodes?: string[];
|
|
};
|
|
author?: {
|
|
name?: string;
|
|
email?: string;
|
|
};
|
|
}
|
|
|
|
export interface IN8nUISettings {
|
|
endpointWebhook: string;
|
|
endpointWebhookTest: string;
|
|
saveDataErrorExecution: string;
|
|
saveDataSuccessExecution: string;
|
|
saveManualExecutions: boolean;
|
|
executionTimeout: number;
|
|
maxExecutionTimeout: number;
|
|
oauthCallbackUrls: {
|
|
oauth1: string;
|
|
oauth2: string;
|
|
};
|
|
timezone: string;
|
|
urlBaseWebhook: string;
|
|
urlBaseEditor: string;
|
|
versionCli: string;
|
|
n8nMetadata?: {
|
|
[key: string]: string | number | undefined;
|
|
};
|
|
versionNotifications: IVersionNotificationSettings;
|
|
instanceId: string;
|
|
telemetry: ITelemetrySettings;
|
|
personalizationSurveyEnabled: boolean;
|
|
defaultLocale: string;
|
|
userManagement: IUserManagementSettings;
|
|
publicApi: IPublicApiSettings;
|
|
workflowTagsDisabled: boolean;
|
|
logLevel: 'info' | 'debug' | 'warn' | 'error' | 'verbose' | 'silent';
|
|
hiringBannerEnabled: boolean;
|
|
templates: {
|
|
enabled: boolean;
|
|
host: string;
|
|
};
|
|
onboardingCallPromptEnabled: boolean;
|
|
missingPackages?: boolean;
|
|
executionMode: 'regular' | 'queue';
|
|
communityNodesEnabled: boolean;
|
|
deployment: {
|
|
type: string;
|
|
};
|
|
isNpmAvailable: boolean;
|
|
allowedModules: {
|
|
builtIn?: string;
|
|
external?: string;
|
|
};
|
|
enterprise: {
|
|
sharing: boolean;
|
|
workflowSharing: boolean;
|
|
};
|
|
}
|
|
|
|
export interface IPersonalizationSurveyAnswers {
|
|
codingSkill: string | null;
|
|
companyIndustry: string[];
|
|
companySize: string | null;
|
|
otherCompanyIndustry: string | null;
|
|
otherWorkArea: string | null;
|
|
workArea: string[] | string | null;
|
|
}
|
|
|
|
export interface IUserSettings {
|
|
isOnboarded?: boolean;
|
|
}
|
|
|
|
export interface IUserManagementSettings {
|
|
enabled: boolean;
|
|
showSetupOnFirstLoad?: boolean;
|
|
smtpSetup: boolean;
|
|
}
|
|
export interface IPublicApiSettings {
|
|
enabled: boolean;
|
|
latestVersion: number;
|
|
path: string;
|
|
}
|
|
|
|
export interface IPackageVersions {
|
|
cli: string;
|
|
}
|
|
|
|
export type IPushDataType = IPushData['type'];
|
|
|
|
export type IPushData =
|
|
| PushDataExecutionFinished
|
|
| PushDataExecutionStarted
|
|
| PushDataExecuteAfter
|
|
| PushDataExecuteBefore
|
|
| PushDataConsoleMessage
|
|
| PushDataReloadNodeType
|
|
| PushDataRemoveNodeType
|
|
| PushDataTestWebhook;
|
|
|
|
type PushDataExecutionFinished = {
|
|
data: IPushDataExecutionFinished;
|
|
type: 'executionFinished';
|
|
};
|
|
|
|
type PushDataExecutionStarted = {
|
|
data: IPushDataExecutionStarted;
|
|
type: 'executionStarted';
|
|
};
|
|
|
|
type PushDataExecuteAfter = {
|
|
data: IPushDataNodeExecuteAfter;
|
|
type: 'nodeExecuteAfter';
|
|
};
|
|
|
|
type PushDataExecuteBefore = {
|
|
data: IPushDataNodeExecuteBefore;
|
|
type: 'nodeExecuteBefore';
|
|
};
|
|
|
|
type PushDataConsoleMessage = {
|
|
data: IPushDataConsoleMessage;
|
|
type: 'sendConsoleMessage';
|
|
};
|
|
|
|
type PushDataReloadNodeType = {
|
|
data: IPushDataReloadNodeType;
|
|
type: 'reloadNodeType';
|
|
};
|
|
|
|
type PushDataRemoveNodeType = {
|
|
data: IPushDataRemoveNodeType;
|
|
type: 'removeNodeType';
|
|
};
|
|
|
|
type PushDataTestWebhook = {
|
|
data: IPushDataTestWebhook;
|
|
type: 'testWebhookDeleted' | 'testWebhookReceived';
|
|
};
|
|
|
|
export interface IPushDataExecutionFinished {
|
|
data: IRun;
|
|
executionId: string;
|
|
retryOf?: string;
|
|
}
|
|
|
|
export interface IPushDataExecutionStarted {
|
|
executionId: string;
|
|
mode: WorkflowExecuteMode;
|
|
startedAt: Date;
|
|
retryOf?: string;
|
|
workflowId: string;
|
|
workflowName?: string;
|
|
}
|
|
|
|
export interface IPushDataNodeExecuteAfter {
|
|
data: ITaskData;
|
|
executionId: string;
|
|
nodeName: string;
|
|
}
|
|
|
|
export interface IPushDataNodeExecuteBefore {
|
|
executionId: string;
|
|
nodeName: string;
|
|
}
|
|
|
|
export interface IPushDataReloadNodeType {
|
|
name: string;
|
|
version: number;
|
|
}
|
|
|
|
export interface IPushDataRemoveNodeType {
|
|
name: string;
|
|
version: number;
|
|
}
|
|
|
|
export interface IPushDataTestWebhook {
|
|
executionId: string;
|
|
workflowId: string;
|
|
}
|
|
|
|
export interface IPushDataConsoleMessage {
|
|
source: string;
|
|
message: string;
|
|
}
|
|
|
|
export interface IResponseCallbackData {
|
|
data?: IDataObject | IDataObject[];
|
|
headers?: object;
|
|
noWebhookResponse?: boolean;
|
|
responseCode?: number;
|
|
}
|
|
|
|
export interface ITransferNodeTypes {
|
|
[key: string]: {
|
|
className: string;
|
|
sourcePath: string;
|
|
};
|
|
}
|
|
|
|
export interface IWorkflowErrorData {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
[key: string]: any;
|
|
execution?: {
|
|
id?: string;
|
|
url?: string;
|
|
retryOf?: string;
|
|
error: ExecutionError;
|
|
lastNodeExecuted: string;
|
|
mode: WorkflowExecuteMode;
|
|
};
|
|
trigger?: {
|
|
error: ExecutionError;
|
|
mode: WorkflowExecuteMode;
|
|
};
|
|
workflow: {
|
|
id?: string;
|
|
name: string;
|
|
};
|
|
}
|
|
|
|
export interface IProcessMessageDataHook {
|
|
hook: string;
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
parameters: any[];
|
|
}
|
|
|
|
export interface IWorkflowExecutionDataProcess {
|
|
destinationNode?: string;
|
|
executionMode: WorkflowExecuteMode;
|
|
executionData?: IRunExecutionData;
|
|
runData?: IRunData;
|
|
pinData?: IPinData;
|
|
retryOf?: number | string;
|
|
sessionId?: string;
|
|
startNodes?: string[];
|
|
workflowData: IWorkflowBase;
|
|
userId: string;
|
|
}
|
|
|
|
export interface IWorkflowExecutionDataProcessWithExecution extends IWorkflowExecutionDataProcess {
|
|
credentialsOverwrite: ICredentialsOverwrite;
|
|
credentialsTypeData: ICredentialsTypeData;
|
|
executionId: string;
|
|
nodeTypeData: ITransferNodeTypes;
|
|
userId: string;
|
|
}
|
|
|
|
export interface IWorkflowExecuteProcess {
|
|
startedAt: Date;
|
|
workflow: Workflow;
|
|
workflowExecute: WorkflowExecute;
|
|
}
|
|
|
|
export type WhereClause = Record<string, { id: string }>;
|
|
|
|
// ----------------------------------
|
|
// community nodes
|
|
// ----------------------------------
|
|
|
|
export namespace CommunityPackages {
|
|
export type ParsedPackageName = {
|
|
packageName: string;
|
|
rawString: string;
|
|
scope?: string;
|
|
version?: string;
|
|
};
|
|
|
|
export type AvailableUpdates = {
|
|
[packageName: string]: {
|
|
current: string;
|
|
wanted: string;
|
|
latest: string;
|
|
location: string;
|
|
};
|
|
};
|
|
|
|
export type PackageStatusCheck = {
|
|
status: 'OK' | 'Banned';
|
|
reason?: string;
|
|
};
|
|
}
|
|
|
|
// ----------------------------------
|
|
// telemetry
|
|
// ----------------------------------
|
|
|
|
export interface IExecutionTrackProperties extends ITelemetryTrackProperties {
|
|
workflow_id: string;
|
|
success: boolean;
|
|
error_node_type?: string;
|
|
is_manual: boolean;
|
|
}
|