n8n-core 1.65.0 → 1.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NodeExecuteFunctions.d.ts +11 -4
- package/dist/NodeExecuteFunctions.js +131 -321
- package/dist/NodeExecuteFunctions.js.map +1 -1
- package/dist/PartialExecutionUtils/getIncomingData.d.ts +4 -0
- package/dist/PartialExecutionUtils/getIncomingData.js +14 -0
- package/dist/PartialExecutionUtils/getIncomingData.js.map +1 -1
- package/dist/PartialExecutionUtils/getSourceDataGroups.d.ts +6 -1
- package/dist/PartialExecutionUtils/getSourceDataGroups.js +34 -13
- package/dist/PartialExecutionUtils/getSourceDataGroups.js.map +1 -1
- package/dist/PartialExecutionUtils/recreateNodeExecutionStack.d.ts +4 -2
- package/dist/PartialExecutionUtils/recreateNodeExecutionStack.js +67 -57
- package/dist/PartialExecutionUtils/recreateNodeExecutionStack.js.map +1 -1
- package/dist/WorkflowExecute.d.ts +1 -1
- package/dist/WorkflowExecute.js +7 -7
- package/dist/WorkflowExecute.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/node-execution-context/execute-single-context.d.ts +28 -0
- package/dist/node-execution-context/execute-single-context.js +104 -0
- package/dist/node-execution-context/execute-single-context.js.map +1 -0
- package/dist/node-execution-context/helpers/binary-helpers.d.ts +15 -0
- package/dist/node-execution-context/helpers/binary-helpers.js +117 -0
- package/dist/node-execution-context/helpers/binary-helpers.js.map +1 -0
- package/dist/node-execution-context/helpers/request-helpers.d.ts +20 -0
- package/dist/node-execution-context/helpers/request-helpers.js +192 -0
- package/dist/node-execution-context/helpers/request-helpers.js.map +1 -0
- package/dist/node-execution-context/helpers/scheduling-helpers.d.ts +8 -0
- package/dist/node-execution-context/helpers/scheduling-helpers.js +21 -0
- package/dist/node-execution-context/helpers/scheduling-helpers.js.map +1 -0
- package/dist/node-execution-context/helpers/ssh-tunnel-helpers.d.ts +6 -0
- package/dist/node-execution-context/helpers/ssh-tunnel-helpers.js +20 -0
- package/dist/node-execution-context/helpers/ssh-tunnel-helpers.js.map +1 -0
- package/dist/node-execution-context/hook-context.d.ts +14 -0
- package/dist/node-execution-context/hook-context.js +42 -0
- package/dist/node-execution-context/hook-context.js.map +1 -0
- package/dist/node-execution-context/index.d.ts +6 -0
- package/dist/node-execution-context/index.js +16 -0
- package/dist/node-execution-context/index.js.map +1 -0
- package/dist/node-execution-context/load-options-context.d.ts +11 -0
- package/dist/node-execution-context/load-options-context.js +46 -0
- package/dist/node-execution-context/load-options-context.js.map +1 -0
- package/dist/node-execution-context/node-execution-context.d.ts +30 -0
- package/dist/node-execution-context/node-execution-context.js +83 -0
- package/dist/node-execution-context/node-execution-context.js.map +1 -0
- package/dist/node-execution-context/poll-context.d.ts +12 -0
- package/dist/node-execution-context/poll-context.js +45 -0
- package/dist/node-execution-context/poll-context.js.map +1 -0
- package/dist/node-execution-context/trigger-context.d.ts +12 -0
- package/dist/node-execution-context/trigger-context.js +47 -0
- package/dist/node-execution-context/trigger-context.js.map +1 -0
- package/dist/node-execution-context/webhook-context.d.ts +24 -0
- package/dist/node-execution-context/webhook-context.js +111 -0
- package/dist/node-execution-context/webhook-context.js.map +1 -0
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -19,3 +19,4 @@ export { ObjectStoreService } from './ObjectStore/ObjectStore.service.ee';
|
|
|
19
19
|
export { BinaryData } from './BinaryData/types';
|
|
20
20
|
export { isStoredMode as isValidNonDefaultMode } from './BinaryData/utils';
|
|
21
21
|
export * from './ExecutionMetadata';
|
|
22
|
+
export * from './node-execution-context';
|
package/dist/index.js
CHANGED
|
@@ -51,4 +51,5 @@ Object.defineProperty(exports, "ObjectStoreService", { enumerable: true, get: fu
|
|
|
51
51
|
var utils_1 = require("./BinaryData/utils");
|
|
52
52
|
Object.defineProperty(exports, "isValidNonDefaultMode", { enumerable: true, get: function () { return utils_1.isStoredMode; } });
|
|
53
53
|
__exportStar(require("./ExecutionMetadata"), exports);
|
|
54
|
+
__exportStar(require("./node-execution-context"), exports);
|
|
54
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAA+D;AAetD,oDAAoB;AAb7B,2CAAyB;AACzB,oDAAkC;AAClC,kEAAgD;AAChD,qDAAmC;AACnC,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,gDAA8B;AAC9B,8CAA4B;AAC5B,gDAA8B;AAC9B,oDAAkC;AAClC,+CAA6B;AAC7B,uDAAoE;AAA3D,oHAAA,gBAAgB,OAAA;AACzB,yDAAuC;AACvC,oDAAkC;AAElC,+DAA6C;AAC7C,2CAAyB;AACzB,+EAA0E;AAAjE,4HAAA,kBAAkB,OAAA;AAE3B,4CAA2E;AAAlE,8GAAA,YAAY,OAAyB;AAC9C,sDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAA+D;AAetD,oDAAoB;AAb7B,2CAAyB;AACzB,oDAAkC;AAClC,kEAAgD;AAChD,qDAAmC;AACnC,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,gDAA8B;AAC9B,8CAA4B;AAC5B,gDAA8B;AAC9B,oDAAkC;AAClC,+CAA6B;AAC7B,uDAAoE;AAA3D,oHAAA,gBAAgB,OAAA;AACzB,yDAAuC;AACvC,oDAAkC;AAElC,+DAA6C;AAC7C,2CAAyB;AACzB,+EAA0E;AAAjE,4HAAA,kBAAkB,OAAA;AAE3B,4CAA2E;AAAlE,8GAAA,YAAY,OAAyB;AAC9C,sDAAoC;AACpC,2DAAyC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ICredentialDataDecryptedObject, IGetNodeParameterOptions, INode, INodeExecutionData, IRunExecutionData, IExecuteSingleFunctions, IWorkflowExecuteAdditionalData, Workflow, WorkflowExecuteMode, ITaskDataConnections, IExecuteData, ContextType, AiEvent, ISourceData } from 'n8n-workflow';
|
|
2
|
+
import { NodeExecutionContext } from './node-execution-context';
|
|
3
|
+
export declare class ExecuteSingleContext extends NodeExecutionContext implements IExecuteSingleFunctions {
|
|
4
|
+
private readonly runExecutionData;
|
|
5
|
+
private readonly runIndex;
|
|
6
|
+
private readonly connectionInputData;
|
|
7
|
+
private readonly inputData;
|
|
8
|
+
private readonly itemIndex;
|
|
9
|
+
private readonly executeData;
|
|
10
|
+
private readonly abortSignal?;
|
|
11
|
+
readonly helpers: IExecuteSingleFunctions['helpers'];
|
|
12
|
+
constructor(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, runExecutionData: IRunExecutionData, runIndex: number, connectionInputData: INodeExecutionData[], inputData: ITaskDataConnections, itemIndex: number, executeData: IExecuteData, abortSignal?: AbortSignal | undefined);
|
|
13
|
+
getExecutionCancelSignal(): AbortSignal | undefined;
|
|
14
|
+
onExecutionCancellation(handler: () => unknown): void;
|
|
15
|
+
continueOnFail(): boolean;
|
|
16
|
+
evaluateExpression(expression: string, evaluateItemIndex: number | undefined): import("n8n-workflow").NodeParameterValue | import("n8n-workflow").INodeParameters | import("n8n-workflow").INodeParameters[] | import("n8n-workflow").NodeParameterValue[];
|
|
17
|
+
getContext(type: ContextType): import("n8n-workflow").IContextObject;
|
|
18
|
+
getInputData(inputIndex?: number, inputName?: string): INodeExecutionData | {
|
|
19
|
+
json: {};
|
|
20
|
+
};
|
|
21
|
+
getItemIndex(): number;
|
|
22
|
+
getNodeParameter(parameterName: string, fallbackValue?: any, options?: IGetNodeParameterOptions): object | import("n8n-workflow").NodeParameterValueType;
|
|
23
|
+
getCredentials<T extends object = ICredentialDataDecryptedObject>(type: string): Promise<T>;
|
|
24
|
+
getExecuteData(): IExecuteData;
|
|
25
|
+
getWorkflowDataProxy(): import("n8n-workflow").IWorkflowDataProxyData;
|
|
26
|
+
getInputSourceData(inputIndex?: number, inputName?: string): ISourceData;
|
|
27
|
+
logAiEvent(eventName: AiEvent, msg: string): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecuteSingleContext = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const NodeExecuteFunctions_1 = require("../NodeExecuteFunctions");
|
|
6
|
+
const binary_helpers_1 = require("./helpers/binary-helpers");
|
|
7
|
+
const request_helpers_1 = require("./helpers/request-helpers");
|
|
8
|
+
const node_execution_context_1 = require("./node-execution-context");
|
|
9
|
+
class ExecuteSingleContext extends node_execution_context_1.NodeExecutionContext {
|
|
10
|
+
constructor(workflow, node, additionalData, mode, runExecutionData, runIndex, connectionInputData, inputData, itemIndex, executeData, abortSignal) {
|
|
11
|
+
super(workflow, node, additionalData, mode);
|
|
12
|
+
this.runExecutionData = runExecutionData;
|
|
13
|
+
this.runIndex = runIndex;
|
|
14
|
+
this.connectionInputData = connectionInputData;
|
|
15
|
+
this.inputData = inputData;
|
|
16
|
+
this.itemIndex = itemIndex;
|
|
17
|
+
this.executeData = executeData;
|
|
18
|
+
this.abortSignal = abortSignal;
|
|
19
|
+
this.helpers = {
|
|
20
|
+
createDeferredPromise: n8n_workflow_1.createDeferredPromise,
|
|
21
|
+
returnJsonArray: NodeExecuteFunctions_1.returnJsonArray,
|
|
22
|
+
...new binary_helpers_1.BinaryHelpers(workflow, additionalData).exported,
|
|
23
|
+
...new request_helpers_1.RequestHelpers(this, workflow, node, additionalData).exported,
|
|
24
|
+
assertBinaryData: (propertyName, inputIndex = 0) => (0, NodeExecuteFunctions_1.assertBinaryData)(inputData, node, itemIndex, propertyName, inputIndex),
|
|
25
|
+
getBinaryDataBuffer: async (propertyName, inputIndex = 0) => await (0, NodeExecuteFunctions_1.getBinaryDataBuffer)(inputData, itemIndex, propertyName, inputIndex),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
getExecutionCancelSignal() {
|
|
29
|
+
return this.abortSignal;
|
|
30
|
+
}
|
|
31
|
+
onExecutionCancellation(handler) {
|
|
32
|
+
const fn = () => {
|
|
33
|
+
this.abortSignal?.removeEventListener('abort', fn);
|
|
34
|
+
handler();
|
|
35
|
+
};
|
|
36
|
+
this.abortSignal?.addEventListener('abort', fn);
|
|
37
|
+
}
|
|
38
|
+
continueOnFail() {
|
|
39
|
+
return (0, NodeExecuteFunctions_1.continueOnFail)(this.node);
|
|
40
|
+
}
|
|
41
|
+
evaluateExpression(expression, evaluateItemIndex) {
|
|
42
|
+
evaluateItemIndex = evaluateItemIndex ?? this.itemIndex;
|
|
43
|
+
return this.workflow.expression.resolveSimpleParameterValue(`=${expression}`, {}, this.runExecutionData, this.runIndex, evaluateItemIndex, this.node.name, this.connectionInputData, this.mode, (0, NodeExecuteFunctions_1.getAdditionalKeys)(this.additionalData, this.mode, this.runExecutionData), this.executeData);
|
|
44
|
+
}
|
|
45
|
+
getContext(type) {
|
|
46
|
+
return n8n_workflow_1.NodeHelpers.getContext(this.runExecutionData, type, this.node);
|
|
47
|
+
}
|
|
48
|
+
getInputData(inputIndex = 0, inputName = 'main') {
|
|
49
|
+
if (!this.inputData.hasOwnProperty(inputName)) {
|
|
50
|
+
return { json: {} };
|
|
51
|
+
}
|
|
52
|
+
if (this.inputData[inputName].length < inputIndex) {
|
|
53
|
+
throw new n8n_workflow_1.ApplicationError('Could not get input index', {
|
|
54
|
+
extra: { inputIndex, inputName },
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const allItems = this.inputData[inputName][inputIndex];
|
|
58
|
+
if (allItems === null || allItems === undefined) {
|
|
59
|
+
throw new n8n_workflow_1.ApplicationError('Input index was not set', {
|
|
60
|
+
extra: { inputIndex, inputName },
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const data = allItems[this.itemIndex];
|
|
64
|
+
if (data === null || data === undefined) {
|
|
65
|
+
throw new n8n_workflow_1.ApplicationError('Value of input with given index was not set', {
|
|
66
|
+
extra: { inputIndex, inputName, itemIndex: this.itemIndex },
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
getItemIndex() {
|
|
72
|
+
return this.itemIndex;
|
|
73
|
+
}
|
|
74
|
+
getNodeParameter(parameterName, fallbackValue, options) {
|
|
75
|
+
return (0, NodeExecuteFunctions_1.getNodeParameter)(this.workflow, this.runExecutionData, this.runIndex, this.connectionInputData, this.node, parameterName, this.itemIndex, this.mode, (0, NodeExecuteFunctions_1.getAdditionalKeys)(this.additionalData, this.mode, this.runExecutionData), this.executeData, fallbackValue, options);
|
|
76
|
+
}
|
|
77
|
+
async getCredentials(type) {
|
|
78
|
+
return await (0, NodeExecuteFunctions_1.getCredentials)(this.workflow, this.node, type, this.additionalData, this.mode, this.executeData, this.runExecutionData, this.runIndex, this.connectionInputData, this.itemIndex);
|
|
79
|
+
}
|
|
80
|
+
getExecuteData() {
|
|
81
|
+
return this.executeData;
|
|
82
|
+
}
|
|
83
|
+
getWorkflowDataProxy() {
|
|
84
|
+
return new n8n_workflow_1.WorkflowDataProxy(this.workflow, this.runExecutionData, this.runIndex, this.itemIndex, this.node.name, this.connectionInputData, {}, this.mode, (0, NodeExecuteFunctions_1.getAdditionalKeys)(this.additionalData, this.mode, this.runExecutionData), this.executeData).getDataProxy();
|
|
85
|
+
}
|
|
86
|
+
getInputSourceData(inputIndex = 0, inputName = 'main') {
|
|
87
|
+
if (this.executeData?.source === null) {
|
|
88
|
+
throw new n8n_workflow_1.ApplicationError('Source data is missing');
|
|
89
|
+
}
|
|
90
|
+
return this.executeData.source[inputName][inputIndex];
|
|
91
|
+
}
|
|
92
|
+
logAiEvent(eventName, msg) {
|
|
93
|
+
return this.additionalData.logAiEvent(eventName, {
|
|
94
|
+
executionId: this.additionalData.executionId ?? 'unsaved-execution',
|
|
95
|
+
nodeName: this.node.name,
|
|
96
|
+
workflowName: this.workflow.name ?? 'Unnamed workflow',
|
|
97
|
+
nodeType: this.node.type,
|
|
98
|
+
workflowId: this.workflow.id ?? 'unsaved-workflow',
|
|
99
|
+
msg,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.ExecuteSingleContext = ExecuteSingleContext;
|
|
104
|
+
//# sourceMappingURL=execute-single-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-single-context.js","sourceRoot":"","sources":["../../src/node-execution-context/execute-single-context.ts"],"names":[],"mappings":";;;AAgBA,+CAKsB;AAGtB,iEAQgC;AAEhC,6DAAyD;AACzD,+DAA2D;AAC3D,qEAAgE;AAEhE,MAAa,oBAAqB,SAAQ,6CAAoB;IAG7D,YACC,QAAkB,EAClB,IAAW,EACX,cAA8C,EAC9C,IAAyB,EACR,gBAAmC,EACnC,QAAgB,EAChB,mBAAyC,EACzC,SAA+B,EAC/B,SAAiB,EACjB,WAAyB,EACzB,WAAyB;QAE1C,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;QAR3B,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,wBAAmB,GAAnB,mBAAmB,CAAsB;QACzC,cAAS,GAAT,SAAS,CAAsB;QAC/B,cAAS,GAAT,SAAS,CAAQ;QACjB,gBAAW,GAAX,WAAW,CAAc;QACzB,gBAAW,GAAX,WAAW,CAAc;QAI1C,IAAI,CAAC,OAAO,GAAG;YACd,qBAAqB,EAArB,oCAAqB;YACrB,eAAe,EAAf,sCAAe;YACf,GAAG,IAAI,8BAAa,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,QAAQ;YACvD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xE,IAAI,CAAC,WAAW,CAChB,CAAC,YAAY,EAAE,CAAC;IAClB,CAAC;IAED,kBAAkB,CAAC,UAAU,GAAG,CAAC,EAAE,SAAS,GAAG,MAAM;QACpD,IAAI,IAAI,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,EAAE,CAAC;YAEvC,MAAM,IAAI,+BAAgB,CAAC,wBAAwB,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU,CAAgB,CAAC;IACtE,CAAC;IAED,UAAU,CAAC,SAAkB,EAAE,GAAW;QACzC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE;YAChD,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,WAAW,IAAI,mBAAmB;YACnE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACxB,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,kBAAkB;YACtD,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACxB,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,kBAAkB;YAClD,GAAG;SACH,CAAC,CAAC;IACJ,CAAC;CACD;AA7KD,oDA6KC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BinaryHelperFunctions, IWorkflowExecuteAdditionalData, Workflow, IBinaryData } from 'n8n-workflow';
|
|
2
|
+
import type { Readable } from 'stream';
|
|
3
|
+
export declare class BinaryHelpers {
|
|
4
|
+
private readonly workflow;
|
|
5
|
+
private readonly additionalData;
|
|
6
|
+
private readonly binaryDataService;
|
|
7
|
+
constructor(workflow: Workflow, additionalData: IWorkflowExecuteAdditionalData);
|
|
8
|
+
get exported(): BinaryHelperFunctions;
|
|
9
|
+
getBinaryPath(binaryDataId: string): string;
|
|
10
|
+
getBinaryMetadata(binaryDataId: string): Promise<import("../..").BinaryData.Metadata>;
|
|
11
|
+
getBinaryStream(binaryDataId: string, chunkSize?: number): Promise<Readable>;
|
|
12
|
+
prepareBinaryData(binaryData: Buffer | Readable, filePath?: string, mimeType?: string): Promise<IBinaryData>;
|
|
13
|
+
setBinaryDataBuffer(binaryData: IBinaryData, bufferOrStream: Buffer | Readable): Promise<IBinaryData>;
|
|
14
|
+
copyBinaryFile(): Promise<never>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BinaryHelpers = void 0;
|
|
7
|
+
const file_type_1 = __importDefault(require("file-type"));
|
|
8
|
+
const http_1 = require("http");
|
|
9
|
+
const mime_types_1 = __importDefault(require("mime-types"));
|
|
10
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const typedi_1 = __importDefault(require("typedi"));
|
|
13
|
+
const BinaryData_service_1 = require("../../BinaryData/BinaryData.service");
|
|
14
|
+
const utils_1 = require("../../BinaryData/utils");
|
|
15
|
+
const NodeExecuteFunctions_1 = require("../../NodeExecuteFunctions");
|
|
16
|
+
class BinaryHelpers {
|
|
17
|
+
constructor(workflow, additionalData) {
|
|
18
|
+
this.workflow = workflow;
|
|
19
|
+
this.additionalData = additionalData;
|
|
20
|
+
this.binaryDataService = typedi_1.default.get(BinaryData_service_1.BinaryDataService);
|
|
21
|
+
}
|
|
22
|
+
get exported() {
|
|
23
|
+
return {
|
|
24
|
+
getBinaryPath: this.getBinaryPath.bind(this),
|
|
25
|
+
getBinaryMetadata: this.getBinaryMetadata.bind(this),
|
|
26
|
+
getBinaryStream: this.getBinaryStream.bind(this),
|
|
27
|
+
binaryToBuffer: utils_1.binaryToBuffer,
|
|
28
|
+
binaryToString: NodeExecuteFunctions_1.binaryToString,
|
|
29
|
+
prepareBinaryData: this.prepareBinaryData.bind(this),
|
|
30
|
+
setBinaryDataBuffer: this.setBinaryDataBuffer.bind(this),
|
|
31
|
+
copyBinaryFile: this.copyBinaryFile.bind(this),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
getBinaryPath(binaryDataId) {
|
|
35
|
+
return this.binaryDataService.getPath(binaryDataId);
|
|
36
|
+
}
|
|
37
|
+
async getBinaryMetadata(binaryDataId) {
|
|
38
|
+
return await this.binaryDataService.getMetadata(binaryDataId);
|
|
39
|
+
}
|
|
40
|
+
async getBinaryStream(binaryDataId, chunkSize) {
|
|
41
|
+
return await this.binaryDataService.getAsStream(binaryDataId, chunkSize);
|
|
42
|
+
}
|
|
43
|
+
async prepareBinaryData(binaryData, filePath, mimeType) {
|
|
44
|
+
let fileExtension;
|
|
45
|
+
if (binaryData instanceof http_1.IncomingMessage) {
|
|
46
|
+
if (!filePath) {
|
|
47
|
+
try {
|
|
48
|
+
const { responseUrl } = binaryData;
|
|
49
|
+
filePath =
|
|
50
|
+
binaryData.contentDisposition?.filename ??
|
|
51
|
+
((responseUrl && new URL(responseUrl).pathname) ?? binaryData.req?.path)?.slice(1);
|
|
52
|
+
}
|
|
53
|
+
catch { }
|
|
54
|
+
}
|
|
55
|
+
if (!mimeType) {
|
|
56
|
+
mimeType = binaryData.contentType;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!mimeType) {
|
|
60
|
+
if (filePath) {
|
|
61
|
+
const mimeTypeLookup = mime_types_1.default.lookup(filePath);
|
|
62
|
+
if (mimeTypeLookup) {
|
|
63
|
+
mimeType = mimeTypeLookup;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!mimeType) {
|
|
67
|
+
if (Buffer.isBuffer(binaryData)) {
|
|
68
|
+
const fileTypeData = await file_type_1.default.fromBuffer(binaryData);
|
|
69
|
+
if (fileTypeData) {
|
|
70
|
+
mimeType = fileTypeData.mime;
|
|
71
|
+
fileExtension = fileTypeData.ext;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (binaryData instanceof http_1.IncomingMessage) {
|
|
75
|
+
mimeType = binaryData.headers['content-type'];
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (!fileExtension && mimeType) {
|
|
82
|
+
fileExtension = mime_types_1.default.extension(mimeType) || undefined;
|
|
83
|
+
}
|
|
84
|
+
if (!mimeType) {
|
|
85
|
+
mimeType = 'text/plain';
|
|
86
|
+
}
|
|
87
|
+
const returnData = {
|
|
88
|
+
mimeType,
|
|
89
|
+
fileType: (0, n8n_workflow_1.fileTypeFromMimeType)(mimeType),
|
|
90
|
+
fileExtension,
|
|
91
|
+
data: '',
|
|
92
|
+
};
|
|
93
|
+
if (filePath) {
|
|
94
|
+
if (filePath.includes('?')) {
|
|
95
|
+
filePath = filePath.split('?').shift();
|
|
96
|
+
}
|
|
97
|
+
const filePathParts = path_1.default.parse(filePath);
|
|
98
|
+
if (filePathParts.dir !== '') {
|
|
99
|
+
returnData.directory = filePathParts.dir;
|
|
100
|
+
}
|
|
101
|
+
returnData.fileName = filePathParts.base;
|
|
102
|
+
const extractedFileExtension = filePathParts.ext.slice(1);
|
|
103
|
+
if (extractedFileExtension) {
|
|
104
|
+
returnData.fileExtension = extractedFileExtension;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return await this.setBinaryDataBuffer(returnData, binaryData);
|
|
108
|
+
}
|
|
109
|
+
async setBinaryDataBuffer(binaryData, bufferOrStream) {
|
|
110
|
+
return await this.binaryDataService.store(this.workflow.id, this.additionalData.executionId, bufferOrStream, binaryData);
|
|
111
|
+
}
|
|
112
|
+
async copyBinaryFile() {
|
|
113
|
+
throw new n8n_workflow_1.ApplicationError('`copyBinaryFile` has been removed. Please upgrade this node.');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.BinaryHelpers = BinaryHelpers;
|
|
117
|
+
//# sourceMappingURL=binary-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-helpers.js","sourceRoot":"","sources":["../../../src/node-execution-context/helpers/binary-helpers.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAiC;AACjC,+BAAuC;AACvC,4DAAmC;AACnC,+CAAsE;AAOtE,gDAAwB;AAExB,oDAA+B;AAE/B,wEAAoE;AACpE,8CAAoD;AAEpD,iEAAwD;AAExD,MAAa,aAAa;IAGzB,YACkB,QAAkB,EAClB,cAA8C;QAD9C,aAAQ,GAAR,QAAQ,CAAU;QAClB,mBAAc,GAAd,cAAc,CAAgC;QAJ/C,sBAAiB,GAAG,gBAAS,CAAC,GAAG,CAAC,sCAAiB,CAAC,CAAC;IAKnE,CAAC;IAEJ,IAAI,QAAQ;QACX,OAAO;YACN,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;YACpD,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;YAChD,cAAc,EAAd,sBAAc;YACd,cAAc,EAAd,qCAAc;YACd,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;YACpD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;YACxD,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;SAC9C,CAAC;IACH,CAAC;IAED,aAAa,CAAC,YAAoB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,YAAoB;QAC3C,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,YAA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QACF,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,UAAuB,EAAE,cAAiC;QACnF,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,KAAK,CACxC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAChB,IAAI,CAAC,cAAc,CAAC,WAAY,EAChC,cAAc,EACd,UAAU,CACV,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAc;QACnB,MAAM,IAAI,+BAAgB,CAAC,8DAA8D,CAAC,CAAC;IAC5F,CAAC;CACD;AAhID,sCAgIC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RequestHelperFunctions, IAdditionalCredentialOptions, IAllExecuteFunctions, IHttpRequestOptions, INode, INodeExecutionData, IOAuth2Options, IRequestOptions, IRunExecutionData, IWorkflowExecuteAdditionalData, PaginationOptions, Workflow } from 'n8n-workflow';
|
|
2
|
+
import { httpRequest } from '../../NodeExecuteFunctions';
|
|
3
|
+
export declare class RequestHelpers {
|
|
4
|
+
private readonly context;
|
|
5
|
+
private readonly workflow;
|
|
6
|
+
private readonly node;
|
|
7
|
+
private readonly additionalData;
|
|
8
|
+
private readonly runExecutionData;
|
|
9
|
+
private readonly connectionInputData;
|
|
10
|
+
constructor(context: IAllExecuteFunctions, workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, runExecutionData?: IRunExecutionData | null, connectionInputData?: INodeExecutionData[]);
|
|
11
|
+
get exported(): RequestHelperFunctions;
|
|
12
|
+
get httpRequest(): typeof httpRequest;
|
|
13
|
+
httpRequestWithAuthentication(credentialsType: string, requestOptions: IHttpRequestOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
|
|
14
|
+
requestWithAuthenticationPaginated(requestOptions: IRequestOptions, itemIndex: number, paginationOptions: PaginationOptions, credentialsType?: string, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown[]>;
|
|
15
|
+
request(uriOrObject: string | IRequestOptions, options?: IRequestOptions): Promise<any>;
|
|
16
|
+
requestWithAuthentication(credentialsType: string, requestOptions: IRequestOptions, additionalCredentialOptions?: IAdditionalCredentialOptions, itemIndex?: number): Promise<any>;
|
|
17
|
+
requestOAuth1(credentialsType: string, requestOptions: IRequestOptions): Promise<any>;
|
|
18
|
+
requestOAuth2(credentialsType: string, requestOptions: IRequestOptions, oAuth2Options?: IOAuth2Options): Promise<any>;
|
|
19
|
+
private getResolvedValue;
|
|
20
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestHelpers = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
const stream_1 = require("stream");
|
|
8
|
+
const NodeExecuteFunctions_1 = require("../../NodeExecuteFunctions");
|
|
9
|
+
class RequestHelpers {
|
|
10
|
+
constructor(context, workflow, node, additionalData, runExecutionData = null, connectionInputData = []) {
|
|
11
|
+
this.context = context;
|
|
12
|
+
this.workflow = workflow;
|
|
13
|
+
this.node = node;
|
|
14
|
+
this.additionalData = additionalData;
|
|
15
|
+
this.runExecutionData = runExecutionData;
|
|
16
|
+
this.connectionInputData = connectionInputData;
|
|
17
|
+
}
|
|
18
|
+
get exported() {
|
|
19
|
+
return {
|
|
20
|
+
httpRequest: NodeExecuteFunctions_1.httpRequest,
|
|
21
|
+
httpRequestWithAuthentication: this.httpRequestWithAuthentication.bind(this),
|
|
22
|
+
requestWithAuthenticationPaginated: this.requestWithAuthenticationPaginated.bind(this),
|
|
23
|
+
request: this.request.bind(this),
|
|
24
|
+
requestWithAuthentication: this.requestWithAuthentication.bind(this),
|
|
25
|
+
requestOAuth1: this.requestOAuth1.bind(this),
|
|
26
|
+
requestOAuth2: this.requestOAuth2.bind(this),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
get httpRequest() {
|
|
30
|
+
return NodeExecuteFunctions_1.httpRequest;
|
|
31
|
+
}
|
|
32
|
+
async httpRequestWithAuthentication(credentialsType, requestOptions, additionalCredentialOptions) {
|
|
33
|
+
return await NodeExecuteFunctions_1.httpRequestWithAuthentication.call(this.context, credentialsType, requestOptions, this.workflow, this.node, this.additionalData, additionalCredentialOptions);
|
|
34
|
+
}
|
|
35
|
+
async requestWithAuthenticationPaginated(requestOptions, itemIndex, paginationOptions, credentialsType, additionalCredentialOptions) {
|
|
36
|
+
const responseData = [];
|
|
37
|
+
if (!requestOptions.qs) {
|
|
38
|
+
requestOptions.qs = {};
|
|
39
|
+
}
|
|
40
|
+
requestOptions.resolveWithFullResponse = true;
|
|
41
|
+
requestOptions.simple = false;
|
|
42
|
+
let tempResponseData;
|
|
43
|
+
let makeAdditionalRequest;
|
|
44
|
+
let paginateRequestData;
|
|
45
|
+
const runIndex = 0;
|
|
46
|
+
const additionalKeys = {
|
|
47
|
+
$request: requestOptions,
|
|
48
|
+
$response: {},
|
|
49
|
+
$version: this.node.typeVersion,
|
|
50
|
+
$pageCount: 0,
|
|
51
|
+
};
|
|
52
|
+
const executeData = {
|
|
53
|
+
data: {},
|
|
54
|
+
node: this.node,
|
|
55
|
+
source: null,
|
|
56
|
+
};
|
|
57
|
+
const hashData = {
|
|
58
|
+
identicalCount: 0,
|
|
59
|
+
previousLength: 0,
|
|
60
|
+
previousHash: '',
|
|
61
|
+
};
|
|
62
|
+
do {
|
|
63
|
+
paginateRequestData = this.getResolvedValue(paginationOptions.request, itemIndex, runIndex, executeData, additionalKeys, false);
|
|
64
|
+
const tempRequestOptions = (0, NodeExecuteFunctions_1.applyPaginationRequestData)(requestOptions, paginateRequestData);
|
|
65
|
+
if (!(0, NodeExecuteFunctions_1.validateUrl)(tempRequestOptions.uri)) {
|
|
66
|
+
throw new n8n_workflow_1.NodeOperationError(this.node, `'${paginateRequestData.url}' is not a valid URL.`, {
|
|
67
|
+
itemIndex,
|
|
68
|
+
runIndex,
|
|
69
|
+
type: 'invalid_url',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (credentialsType) {
|
|
73
|
+
tempResponseData = await this.requestWithAuthentication(credentialsType, tempRequestOptions, additionalCredentialOptions);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
tempResponseData = await this.request(tempRequestOptions);
|
|
77
|
+
}
|
|
78
|
+
const newResponse = Object.assign({
|
|
79
|
+
body: {},
|
|
80
|
+
headers: {},
|
|
81
|
+
statusCode: 0,
|
|
82
|
+
}, (0, lodash_1.pick)(tempResponseData, ['body', 'headers', 'statusCode']));
|
|
83
|
+
let contentBody;
|
|
84
|
+
if (newResponse.body instanceof stream_1.Readable && paginationOptions.binaryResult !== true) {
|
|
85
|
+
contentBody = await (0, NodeExecuteFunctions_1.binaryToString)(newResponse.body);
|
|
86
|
+
const responseContentType = newResponse.headers['content-type']?.toString() ?? '';
|
|
87
|
+
if (responseContentType.includes('application/json')) {
|
|
88
|
+
newResponse.body = (0, n8n_workflow_1.jsonParse)(contentBody, { fallbackValue: {} });
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
newResponse.body = contentBody;
|
|
92
|
+
}
|
|
93
|
+
tempResponseData.__bodyResolved = true;
|
|
94
|
+
tempResponseData.body = newResponse.body;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
contentBody = newResponse.body;
|
|
98
|
+
}
|
|
99
|
+
if (paginationOptions.binaryResult !== true || tempResponseData.headers.etag) {
|
|
100
|
+
let contentLength = 0;
|
|
101
|
+
if ('content-length' in tempResponseData.headers) {
|
|
102
|
+
contentLength = parseInt(tempResponseData.headers['content-length']) || 0;
|
|
103
|
+
}
|
|
104
|
+
if (hashData.previousLength === contentLength) {
|
|
105
|
+
let hash;
|
|
106
|
+
if (tempResponseData.headers.etag) {
|
|
107
|
+
hash = tempResponseData.headers.etag;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
if (typeof contentBody !== 'string') {
|
|
111
|
+
contentBody = JSON.stringify(contentBody);
|
|
112
|
+
}
|
|
113
|
+
hash = (0, crypto_1.createHash)('md5').update(contentBody).digest('base64');
|
|
114
|
+
}
|
|
115
|
+
if (hashData.previousHash === hash) {
|
|
116
|
+
hashData.identicalCount += 1;
|
|
117
|
+
if (hashData.identicalCount > 2) {
|
|
118
|
+
throw new n8n_workflow_1.NodeOperationError(this.node, 'The returned response was identical 5x, so requests got stopped', {
|
|
119
|
+
itemIndex,
|
|
120
|
+
description: 'Check if "Pagination Completed When" has been configured correctly.',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
hashData.identicalCount = 0;
|
|
126
|
+
}
|
|
127
|
+
hashData.previousHash = hash;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
hashData.identicalCount = 0;
|
|
131
|
+
}
|
|
132
|
+
hashData.previousLength = contentLength;
|
|
133
|
+
}
|
|
134
|
+
responseData.push(tempResponseData);
|
|
135
|
+
additionalKeys.$response = newResponse;
|
|
136
|
+
additionalKeys.$pageCount = additionalKeys.$pageCount + 1;
|
|
137
|
+
const maxRequests = this.getResolvedValue(paginationOptions.maxRequests, itemIndex, runIndex, executeData, additionalKeys, false);
|
|
138
|
+
if (maxRequests && additionalKeys.$pageCount >= maxRequests) {
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
makeAdditionalRequest = this.getResolvedValue(paginationOptions.continue, itemIndex, runIndex, executeData, additionalKeys, false);
|
|
142
|
+
if (makeAdditionalRequest) {
|
|
143
|
+
if (paginationOptions.requestInterval) {
|
|
144
|
+
const requestInterval = this.getResolvedValue(paginationOptions.requestInterval, itemIndex, runIndex, executeData, additionalKeys, false);
|
|
145
|
+
await (0, n8n_workflow_1.sleep)(requestInterval);
|
|
146
|
+
}
|
|
147
|
+
if (tempResponseData.statusCode < 200 || tempResponseData.statusCode >= 300) {
|
|
148
|
+
let data = tempResponseData.body;
|
|
149
|
+
if (data instanceof stream_1.Readable && paginationOptions.binaryResult !== true) {
|
|
150
|
+
data = await (0, NodeExecuteFunctions_1.binaryToString)(data);
|
|
151
|
+
}
|
|
152
|
+
else if (typeof data === 'object') {
|
|
153
|
+
data = JSON.stringify(data);
|
|
154
|
+
}
|
|
155
|
+
throw Object.assign(new Error(`${tempResponseData.statusCode} - "${data?.toString()}"`), {
|
|
156
|
+
statusCode: tempResponseData.statusCode,
|
|
157
|
+
error: data,
|
|
158
|
+
isAxiosError: true,
|
|
159
|
+
response: {
|
|
160
|
+
headers: tempResponseData.headers,
|
|
161
|
+
status: tempResponseData.statusCode,
|
|
162
|
+
statusText: tempResponseData.statusMessage,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} while (makeAdditionalRequest);
|
|
168
|
+
return responseData;
|
|
169
|
+
}
|
|
170
|
+
async request(uriOrObject, options) {
|
|
171
|
+
return await (0, NodeExecuteFunctions_1.proxyRequestToAxios)(this.workflow, this.additionalData, this.node, uriOrObject, options);
|
|
172
|
+
}
|
|
173
|
+
async requestWithAuthentication(credentialsType, requestOptions, additionalCredentialOptions, itemIndex) {
|
|
174
|
+
return await NodeExecuteFunctions_1.requestWithAuthentication.call(this.context, credentialsType, requestOptions, this.workflow, this.node, this.additionalData, additionalCredentialOptions, itemIndex);
|
|
175
|
+
}
|
|
176
|
+
async requestOAuth1(credentialsType, requestOptions) {
|
|
177
|
+
return await NodeExecuteFunctions_1.requestOAuth1.call(this.context, credentialsType, requestOptions);
|
|
178
|
+
}
|
|
179
|
+
async requestOAuth2(credentialsType, requestOptions, oAuth2Options) {
|
|
180
|
+
return await NodeExecuteFunctions_1.requestOAuth2.call(this.context, credentialsType, requestOptions, this.node, this.additionalData, oAuth2Options);
|
|
181
|
+
}
|
|
182
|
+
getResolvedValue(parameterValue, itemIndex, runIndex, executeData, additionalKeys, returnObjectAsString = false) {
|
|
183
|
+
const mode = 'internal';
|
|
184
|
+
if (typeof parameterValue === 'object' ||
|
|
185
|
+
(typeof parameterValue === 'string' && parameterValue.charAt(0) === '=')) {
|
|
186
|
+
return this.workflow.expression.getParameterValue(parameterValue, this.runExecutionData, runIndex, itemIndex, this.node.name, this.connectionInputData, mode, additionalKeys ?? {}, executeData, returnObjectAsString);
|
|
187
|
+
}
|
|
188
|
+
return parameterValue;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
exports.RequestHelpers = RequestHelpers;
|
|
192
|
+
//# sourceMappingURL=request-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-helpers.js","sourceRoot":"","sources":["../../../src/node-execution-context/helpers/request-helpers.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,mCAA8B;AAC9B,+CAAoE;AAqBpE,mCAAkC;AAGlC,iEAUgC;AAEhC,MAAa,cAAc;IAC1B,YACkB,OAA6B,EAC7B,QAAkB,EAClB,IAAW,EACX,cAA8C,EAC9C,mBAA6C,IAAI,EACjD,sBAA4C,EAAE;QAL9C,YAAO,GAAP,OAAO,CAAsB;QAC7B,aAAQ,GAAR,QAAQ,CAAU;QAClB,SAAI,GAAJ,IAAI,CAAO;QACX,mBAAc,GAAd,cAAc,CAAgC;QAC9C,qBAAgB,GAAhB,gBAAgB,CAAiC;QACjD,wBAAmB,GAAnB,mBAAmB,CAA2B;IAC7D,CAAC;IAEJ,IAAI,QAAQ;QACX,OAAO;YACN,WAAW,EAAX,kCAAW;YACX,6BAA6B,EAAE,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5E,kCAAkC,EAAE,IAAI,CAAC,kCAAkC,CAAC,IAAI,CAAC,IAAI,CAAC;YACtF,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;YAChC,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,CA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EACT,IAAI,CAAC,IAAI,CAAC,IAAI,EACd,IAAI,CAAC,mBAAmB,EACxB,IAAI,EACJ,cAAc,IAAI,EAAE,EACpB,WAAW,EACX,oBAAoB,CACpB,CAAC;QACH,CAAC;QAED,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AAtVD,wCAsVC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CronExpression, Workflow, SchedulingFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare class SchedulingHelpers {
|
|
3
|
+
private readonly workflow;
|
|
4
|
+
private readonly scheduledTaskManager;
|
|
5
|
+
constructor(workflow: Workflow);
|
|
6
|
+
get exported(): SchedulingFunctions;
|
|
7
|
+
registerCron(cronExpression: CronExpression, onTick: () => void): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchedulingHelpers = void 0;
|
|
4
|
+
const typedi_1 = require("typedi");
|
|
5
|
+
const ScheduledTaskManager_1 = require("../../ScheduledTaskManager");
|
|
6
|
+
class SchedulingHelpers {
|
|
7
|
+
constructor(workflow) {
|
|
8
|
+
this.workflow = workflow;
|
|
9
|
+
this.scheduledTaskManager = typedi_1.Container.get(ScheduledTaskManager_1.ScheduledTaskManager);
|
|
10
|
+
}
|
|
11
|
+
get exported() {
|
|
12
|
+
return {
|
|
13
|
+
registerCron: this.registerCron.bind(this),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
registerCron(cronExpression, onTick) {
|
|
17
|
+
this.scheduledTaskManager.registerCron(this.workflow, cronExpression, onTick);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.SchedulingHelpers = SchedulingHelpers;
|
|
21
|
+
//# sourceMappingURL=scheduling-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduling-helpers.js","sourceRoot":"","sources":["../../../src/node-execution-context/helpers/scheduling-helpers.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAEnC,iEAA8D;AAE9D,MAAa,iBAAiB;IAG7B,YAA6B,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QAF9B,yBAAoB,GAAG,kBAAS,CAAC,GAAG,CAAC,2CAAoB,CAAC,CAAC;IAE1B,CAAC;IAEnD,IAAI,QAAQ;QACX,OAAO;YACN,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;SAC1C,CAAC;IACH,CAAC;IAED,YAAY,CAAC,cAA8B,EAAE,MAAkB;QAC9D,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;CACD;AAdD,8CAcC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SSHCredentials, SSHTunnelFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare class SSHTunnelHelpers {
|
|
3
|
+
private readonly sshClientsManager;
|
|
4
|
+
get exported(): SSHTunnelFunctions;
|
|
5
|
+
getSSHClient(credentials: SSHCredentials): Promise<import("ssh2").Client>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SSHTunnelHelpers = void 0;
|
|
4
|
+
const typedi_1 = require("typedi");
|
|
5
|
+
const SSHClientsManager_1 = require("../../SSHClientsManager");
|
|
6
|
+
class SSHTunnelHelpers {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.sshClientsManager = typedi_1.Container.get(SSHClientsManager_1.SSHClientsManager);
|
|
9
|
+
}
|
|
10
|
+
get exported() {
|
|
11
|
+
return {
|
|
12
|
+
getSSHClient: this.getSSHClient.bind(this),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
async getSSHClient(credentials) {
|
|
16
|
+
return await this.sshClientsManager.getClient(credentials);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.SSHTunnelHelpers = SSHTunnelHelpers;
|
|
20
|
+
//# sourceMappingURL=ssh-tunnel-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-tunnel-helpers.js","sourceRoot":"","sources":["../../../src/node-execution-context/helpers/ssh-tunnel-helpers.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAEnC,2DAAwD;AAExD,MAAa,gBAAgB;IAA7B;QACkB,sBAAiB,GAAG,kBAAS,CAAC,GAAG,CAAC,qCAAiB,CAAC,CAAC;IAWvE,CAAC;IATA,IAAI,QAAQ;QACX,OAAO;YACN,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;SAC1C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,WAA2B;QAC7C,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC5D,CAAC;CACD;AAZD,4CAYC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ICredentialDataDecryptedObject, IGetNodeParameterOptions, INode, IHookFunctions, IWorkflowExecuteAdditionalData, NodeParameterValueType, Workflow, WorkflowActivateMode, WorkflowExecuteMode, IWebhookData, WebhookType } from 'n8n-workflow';
|
|
2
|
+
import { NodeExecutionContext } from './node-execution-context';
|
|
3
|
+
export declare class HookContext extends NodeExecutionContext implements IHookFunctions {
|
|
4
|
+
private readonly activation;
|
|
5
|
+
private readonly webhookData?;
|
|
6
|
+
readonly helpers: IHookFunctions['helpers'];
|
|
7
|
+
constructor(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, webhookData?: IWebhookData | undefined);
|
|
8
|
+
getActivationMode(): WorkflowActivateMode;
|
|
9
|
+
getCredentials<T extends object = ICredentialDataDecryptedObject>(type: string): Promise<T>;
|
|
10
|
+
getNodeParameter(parameterName: string, fallbackValue?: any, options?: IGetNodeParameterOptions): NodeParameterValueType | object;
|
|
11
|
+
getNodeWebhookUrl(name: WebhookType): string | undefined;
|
|
12
|
+
getWebhookName(): string;
|
|
13
|
+
getWebhookDescription(name: WebhookType): import("n8n-workflow").IWebhookDescription | undefined;
|
|
14
|
+
}
|