n8n-workflow
Advanced tools
Comparing version 0.143.0 to 0.143.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.augmentObject = exports.augmentArray = void 0; | ||
const defaultPropertyDescriptor = Object.freeze({ enumerable: true, configurable: true }); | ||
const augmentedObjects = new WeakSet(); | ||
function augment(value) { | ||
if (typeof value !== 'object' || | ||
value === null || | ||
value instanceof RegExp || | ||
augmentedObjects.has(value)) | ||
if (typeof value !== 'object' || value === null || value instanceof RegExp) | ||
return value; | ||
augmentedObjects.add(value); | ||
if (value instanceof Date) | ||
return new Date(value.valueOf()); | ||
if (value instanceof Uint8Array) | ||
return value.slice(); | ||
if (Array.isArray(value)) | ||
@@ -19,2 +18,4 @@ return augmentArray(value); | ||
function augmentArray(data) { | ||
if (augmentedObjects.has(data)) | ||
return data; | ||
let newData = undefined; | ||
@@ -27,3 +28,3 @@ function getData() { | ||
} | ||
return new Proxy(data, { | ||
const proxy = new Proxy(data, { | ||
deleteProperty(target, key) { | ||
@@ -43,2 +44,3 @@ return Reflect.deleteProperty(getData(), key); | ||
getOwnPropertyDescriptor(target, key) { | ||
var _a; | ||
if (newData === undefined) { | ||
@@ -50,3 +52,3 @@ return Reflect.getOwnPropertyDescriptor(target, key); | ||
} | ||
return { configurable: true, enumerable: true }; | ||
return (_a = Object.getOwnPropertyDescriptor(data, key)) !== null && _a !== void 0 ? _a : defaultPropertyDescriptor; | ||
}, | ||
@@ -60,14 +62,15 @@ has(target, key) { | ||
set(target, key, newValue) { | ||
if (newValue !== null && typeof newValue === 'object') { | ||
newValue = new Proxy(newValue, {}); | ||
} | ||
return Reflect.set(getData(), key, newValue); | ||
return Reflect.set(getData(), key, augment(newValue)); | ||
}, | ||
}); | ||
augmentedObjects.add(proxy); | ||
return proxy; | ||
} | ||
exports.augmentArray = augmentArray; | ||
function augmentObject(data) { | ||
if (augmentedObjects.has(data)) | ||
return data; | ||
const newData = {}; | ||
const deletedProperties = []; | ||
return new Proxy(data, { | ||
const proxy = new Proxy(data, { | ||
get(target, key, receiver) { | ||
@@ -115,13 +118,15 @@ if (deletedProperties.indexOf(key) !== -1) { | ||
ownKeys(target) { | ||
return [...new Set([...Reflect.ownKeys(target), ...Object.keys(newData)])].filter((key) => deletedProperties.indexOf(key) === -1); | ||
const originalKeys = Reflect.ownKeys(target); | ||
const newKeys = Object.keys(newData); | ||
return [...new Set([...originalKeys, ...newKeys])].filter((key) => deletedProperties.indexOf(key) === -1); | ||
}, | ||
getOwnPropertyDescriptor(k) { | ||
return { | ||
enumerable: true, | ||
configurable: true, | ||
}; | ||
getOwnPropertyDescriptor(target, key) { | ||
var _a; | ||
return (_a = Object.getOwnPropertyDescriptor(data, key)) !== null && _a !== void 0 ? _a : defaultPropertyDescriptor; | ||
}, | ||
}); | ||
augmentedObjects.add(proxy); | ||
return proxy; | ||
} | ||
exports.augmentObject = augmentObject; | ||
//# sourceMappingURL=AugmentObject.js.map |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.143.0", | ||
"version": "0.143.1", | ||
"description": "Workflow base code of n8n", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
642066
8698