n8n-workflow
Advanced tools
Comparing version 0.142.0 to 0.143.0
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.augmentObject = exports.augmentArray = void 0; | ||
const util_1 = __importDefault(require("util")); | ||
const augmentedObjects = new WeakSet(); | ||
function augment(value) { | ||
if (typeof value !== 'object' || | ||
value === null || | ||
value instanceof RegExp || | ||
augmentedObjects.has(value)) | ||
return value; | ||
augmentedObjects.add(value); | ||
if (value instanceof Date) | ||
return new Date(value.valueOf()); | ||
if (Array.isArray(value)) | ||
return augmentArray(value); | ||
return augmentObject(value); | ||
} | ||
function augmentArray(data) { | ||
@@ -22,14 +32,7 @@ let newData = undefined; | ||
const value = Reflect.get(newData !== undefined ? newData : target, key, receiver); | ||
if (typeof value === 'object') { | ||
if (value === null || util_1.default.types.isProxy(value)) { | ||
return value; | ||
} | ||
const newValue = augment(value); | ||
if (newValue !== value) { | ||
newData = getData(); | ||
if (Array.isArray(value)) { | ||
Reflect.set(newData, key, augmentArray(value)); | ||
} | ||
else { | ||
Reflect.set(newData, key, augmentObject(value)); | ||
} | ||
return Reflect.get(newData, key); | ||
Reflect.set(newData, key, newValue); | ||
return newValue; | ||
} | ||
@@ -74,10 +77,6 @@ return value; | ||
const value = Reflect.get(target, key, receiver); | ||
if (value !== null && typeof value === 'object') { | ||
if (Array.isArray(value)) { | ||
newData[key] = augmentArray(value); | ||
} | ||
else { | ||
newData[key] = augmentObject(value); | ||
} | ||
return newData[key]; | ||
const newValue = augment(value); | ||
if (newValue !== value) { | ||
Object.assign(newData, { [key]: newValue }); | ||
return newValue; | ||
} | ||
@@ -84,0 +83,0 @@ return value; |
@@ -6,2 +6,2 @@ export interface IDeferredPromise<T> { | ||
} | ||
export declare function createDeferredPromise<T>(): Promise<IDeferredPromise<T>>; | ||
export declare function createDeferredPromise<T = void>(): Promise<IDeferredPromise<T>>; |
@@ -61,3 +61,3 @@ "use strict"; | ||
result = luxon_1.DateTime.fromJSDate(value, { | ||
zone: (_b = (_a = this.workflow.settings.timezone) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 'default', | ||
zone: (_b = (_a = this.workflow.settings) === null || _a === void 0 ? void 0 : _a.timezone) !== null && _b !== void 0 ? _b : 'default', | ||
}).toISO(); | ||
@@ -64,0 +64,0 @@ } |
@@ -26,3 +26,3 @@ /// <reference types="node" /> | ||
export { LoggerProxy, NodeHelpers, ObservableObject, TelemetryHelpers }; | ||
export { deepCopy, jsonParse, sleep, fileTypeFromMimeType, assert } from './utils'; | ||
export { deepCopy, jsonParse, jsonStringify, sleep, fileTypeFromMimeType, assert } from './utils'; | ||
export { isINodeProperties, isINodePropertyOptions, isINodePropertyCollection, isINodePropertiesList, isINodePropertyCollectionList, isINodePropertyOptionsList, } from './type-guards'; | ||
@@ -29,0 +29,0 @@ export { ExpressionExtensions } from './Extensions'; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NativeMethods = exports.ExpressionExtensions = exports.isINodePropertyOptionsList = exports.isINodePropertyCollectionList = exports.isINodePropertiesList = exports.isINodePropertyCollection = exports.isINodePropertyOptions = exports.isINodeProperties = exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonParse = exports.deepCopy = exports.TelemetryHelpers = exports.ObservableObject = exports.NodeHelpers = exports.LoggerProxy = exports.ErrorReporterProxy = void 0; | ||
exports.NativeMethods = exports.ExpressionExtensions = exports.isINodePropertyOptionsList = exports.isINodePropertyCollectionList = exports.isINodePropertiesList = exports.isINodePropertyCollection = exports.isINodePropertyOptions = exports.isINodeProperties = exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonStringify = exports.jsonParse = exports.deepCopy = exports.TelemetryHelpers = exports.ObservableObject = exports.NodeHelpers = exports.LoggerProxy = exports.ErrorReporterProxy = void 0; | ||
const LoggerProxy = __importStar(require("./LoggerProxy")); | ||
@@ -61,2 +61,3 @@ exports.LoggerProxy = LoggerProxy; | ||
Object.defineProperty(exports, "jsonParse", { enumerable: true, get: function () { return utils_1.jsonParse; } }); | ||
Object.defineProperty(exports, "jsonStringify", { enumerable: true, get: function () { return utils_1.jsonStringify; } }); | ||
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return utils_1.sleep; } }); | ||
@@ -63,0 +64,0 @@ Object.defineProperty(exports, "fileTypeFromMimeType", { enumerable: true, get: function () { return utils_1.fileTypeFromMimeType; } }); |
@@ -393,3 +393,6 @@ /// <reference types="node" /> | ||
} | ||
export interface JsonHelperFunctions { | ||
interface BaseHelperFunctions { | ||
createDeferredPromise: <T = void>() => Promise<IDeferredPromise<T>>; | ||
} | ||
interface JsonHelperFunctions { | ||
returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[]; | ||
@@ -403,3 +406,3 @@ } | ||
setBinaryDataBuffer(data: IBinaryData, binaryData: Buffer): Promise<IBinaryData>; | ||
copyBinaryFile(filePath: string, fileName: string, mimeType?: string): Promise<IBinaryData>; | ||
copyBinaryFile(): Promise<never>; | ||
binaryToBuffer(body: Buffer | Readable): Promise<Buffer>; | ||
@@ -409,2 +412,5 @@ getBinaryStream(binaryDataId: string, chunkSize?: number): Readable; | ||
} | ||
export interface NodeHelperFunctions { | ||
copyBinaryFile(filePath: string, fileName: string, mimeType?: string): Promise<IBinaryData>; | ||
} | ||
export interface RequestHelperFunctions { | ||
@@ -419,2 +425,3 @@ request(uriOrObject: string | IDataObject | any, options?: IDataObject): Promise<any>; | ||
export interface FunctionsBase { | ||
logger: ILogger; | ||
getCredentials(type: string, itemIndex?: number): Promise<ICredentialDataDecryptedObject>; | ||
@@ -447,3 +454,4 @@ getNode(): INode; | ||
sendResponse(response: IExecuteResponsePromiseData): void; | ||
helpers: RequestHelperFunctions & BinaryHelperFunctions & FileSystemHelperFunctions & JsonHelperFunctions & { | ||
nodeHelpers: NodeHelperFunctions; | ||
helpers: RequestHelperFunctions & BaseHelperFunctions & BinaryHelperFunctions & FileSystemHelperFunctions & JsonHelperFunctions & { | ||
normalizeItems(items: INodeExecutionData | INodeExecutionData[]): INodeExecutionData[]; | ||
@@ -461,3 +469,3 @@ constructExecutionMetaData(inputData: INodeExecutionData[], options: { | ||
getNodeParameter(parameterName: string, fallbackValue?: any, options?: IGetNodeParameterOptions): NodeParameterValueType | object; | ||
helpers: RequestHelperFunctions & BinaryHelperFunctions & { | ||
helpers: RequestHelperFunctions & BaseHelperFunctions & BinaryHelperFunctions & { | ||
assertBinaryData(propertyName: string, inputIndex?: number): IBinaryData; | ||
@@ -480,3 +488,3 @@ getBinaryDataBuffer(propertyName: string, inputIndex?: number): Promise<Buffer>; | ||
getNodeParameter(parameterName: string, fallbackValue?: any, options?: IGetNodeParameterOptions): NodeParameterValueType | object; | ||
helpers: RequestHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions; | ||
helpers: RequestHelperFunctions & BaseHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions; | ||
} | ||
@@ -487,3 +495,3 @@ export interface ITriggerFunctions extends FunctionsBaseWithRequiredKeys<'getMode' | 'getActivationMode'> { | ||
getNodeParameter(parameterName: string, fallbackValue?: any, options?: IGetNodeParameterOptions): NodeParameterValueType | object; | ||
helpers: RequestHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions; | ||
helpers: RequestHelperFunctions & BaseHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions; | ||
} | ||
@@ -508,3 +516,4 @@ export interface IHookFunctions extends FunctionsBaseWithRequiredKeys<'getMode' | 'getActivationMode'> { | ||
prepareOutputData(outputData: INodeExecutionData[], outputIndex?: number): Promise<INodeExecutionData[][]>; | ||
helpers: RequestHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions; | ||
nodeHelpers: NodeHelperFunctions; | ||
helpers: RequestHelperFunctions & BaseHelperFunctions & BinaryHelperFunctions & JsonHelperFunctions; | ||
} | ||
@@ -1023,3 +1032,3 @@ export interface INodeCredentialsDetails { | ||
mode: WorkflowExecuteMode; | ||
waitTill?: Date; | ||
waitTill?: Date | null; | ||
startedAt: Date; | ||
@@ -1039,2 +1048,3 @@ stoppedAt?: Date; | ||
lastNodeExecuted?: string; | ||
metadata?: Record<string, string>; | ||
}; | ||
@@ -1139,4 +1149,16 @@ executionData?: { | ||
} | ||
export declare namespace WorkflowSettings { | ||
type CallerPolicy = 'any' | 'none' | 'workflowsFromAList' | 'workflowsFromSameOwner'; | ||
type SaveDataExecution = 'DEFAULT' | 'all' | 'none'; | ||
} | ||
export interface IWorkflowSettings { | ||
[key: string]: IDataObject | string | number | boolean | undefined; | ||
timezone?: 'DEFAULT' | string; | ||
errorWorkflow?: string; | ||
callerIds?: string; | ||
callerPolicy?: WorkflowSettings.CallerPolicy; | ||
saveDataErrorExecution?: WorkflowSettings.SaveDataExecution; | ||
saveDataSuccessExecution?: WorkflowSettings.SaveDataExecution; | ||
saveManualExecutions?: 'DEFAULT' | boolean; | ||
saveExecutionProgress?: 'DEFAULT' | boolean; | ||
executionTimeout?: number; | ||
} | ||
@@ -1143,0 +1165,0 @@ export type LogTypes = 'debug' | 'verbose' | 'info' | 'warn' | 'error'; |
@@ -17,2 +17,6 @@ import type { BinaryFileType } from './Interfaces'; | ||
export declare const jsonParse: <T>(jsonString: string, options?: JSONParseOptions<T> | undefined) => T; | ||
type JSONStringifyOptions = { | ||
replaceCircularRefs?: boolean; | ||
}; | ||
export declare const jsonStringify: (obj: unknown, options?: JSONStringifyOptions) => string; | ||
export declare const sleep: (ms: number) => Promise<void>; | ||
@@ -19,0 +23,0 @@ export declare function fileTypeFromMimeType(mimeType: string): BinaryFileType | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonParse = exports.deepCopy = void 0; | ||
exports.assert = exports.fileTypeFromMimeType = exports.sleep = exports.jsonStringify = exports.jsonParse = exports.deepCopy = void 0; | ||
const deepCopy = (source, hash = new WeakMap(), path = '') => { | ||
@@ -48,2 +48,21 @@ const hasOwnProp = Object.prototype.hasOwnProperty.bind(source); | ||
exports.jsonParse = jsonParse; | ||
const replaceCircularReferences = (value, knownObjects = new WeakSet()) => { | ||
if (typeof value !== 'object' || value === null || value instanceof RegExp) | ||
return value; | ||
if ('toJSON' in value && typeof value.toJSON === 'function') | ||
return value.toJSON(); | ||
if (knownObjects.has(value)) | ||
return '[Circular Reference]'; | ||
knownObjects.add(value); | ||
const copy = (Array.isArray(value) ? [] : {}); | ||
for (const key in value) { | ||
copy[key] = replaceCircularReferences(value[key], knownObjects); | ||
} | ||
knownObjects.delete(value); | ||
return copy; | ||
}; | ||
const jsonStringify = (obj, options = {}) => { | ||
return JSON.stringify((options === null || options === void 0 ? void 0 : options.replaceCircularRefs) ? replaceCircularReferences(obj) : obj); | ||
}; | ||
exports.jsonStringify = jsonStringify; | ||
const sleep = async (ms) => new Promise((resolve) => { | ||
@@ -50,0 +69,0 @@ setTimeout(resolve, ms); |
@@ -47,2 +47,3 @@ "use strict"; | ||
constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, siblingParameters, mode, defaultTimezone, additionalKeys, executeData, defaultReturnRunIndex = -1, selfData = {}) { | ||
var _a, _b; | ||
this.activeNodeName = activeNodeName; | ||
@@ -64,3 +65,3 @@ this.workflow = workflow; | ||
this.defaultTimezone = defaultTimezone; | ||
this.timezone = this.workflow.settings.timezone || this.defaultTimezone; | ||
this.timezone = (_b = (_a = workflow.settings) === null || _a === void 0 ? void 0 : _a.timezone) !== null && _b !== void 0 ? _b : defaultTimezone; | ||
this.selfData = selfData; | ||
@@ -67,0 +68,0 @@ this.additionalKeys = additionalKeys; |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.142.0", | ||
"version": "0.143.0", | ||
"description": "Workflow base code of n8n", | ||
@@ -38,3 +38,3 @@ "license": "SEE LICENSE IN LICENSE.md", | ||
"@types/lodash.set": "^4.3.6", | ||
"@types/luxon": "^2.0.9", | ||
"@types/luxon": "^3.2.0", | ||
"@types/xml2js": "^0.4.3" | ||
@@ -54,3 +54,3 @@ }, | ||
"lodash.set": "^4.3.2", | ||
"luxon": "^3.1.0", | ||
"luxon": "^3.3.0", | ||
"recast": "^0.21.5", | ||
@@ -57,0 +57,0 @@ "title-case": "^3.0.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
641320
8693
Updatedluxon@^3.3.0