@keload/node-red-dxp 1.5.0 → 1.6.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/chunk-DATO2UPN.js +108 -0
- package/dist/chunk-DATO2UPN.js.map +1 -0
- package/dist/cli/index.cjs +40 -9
- package/dist/cli/index.cjs.map +1 -1
- package/dist/editor/index.js +1 -67
- package/dist/editor/index.js.map +1 -1
- package/dist/utils.cjs +119 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +12 -0
- package/dist/utils.d.ts +12 -0
- package/dist/utils.js +13 -0
- package/dist/utils.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/getType.js
|
|
8
|
+
function getType(payload) {
|
|
9
|
+
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/isArray.js
|
|
13
|
+
function isArray(payload) {
|
|
14
|
+
return getType(payload) === "Array";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/isPlainObject.js
|
|
18
|
+
function isPlainObject(payload) {
|
|
19
|
+
if (getType(payload) !== "Object")
|
|
20
|
+
return false;
|
|
21
|
+
const prototype = Object.getPrototypeOf(payload);
|
|
22
|
+
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/isSymbol.js
|
|
26
|
+
function isSymbol(payload) {
|
|
27
|
+
return getType(payload) === "Symbol";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// node_modules/.pnpm/merge-anything@6.0.2/node_modules/merge-anything/dist/extensions.js
|
|
31
|
+
function concatArrays(originVal, newVal) {
|
|
32
|
+
if (isArray(originVal) && isArray(newVal)) {
|
|
33
|
+
return originVal.concat(newVal);
|
|
34
|
+
}
|
|
35
|
+
return newVal;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// node_modules/.pnpm/merge-anything@6.0.2/node_modules/merge-anything/dist/merge.js
|
|
39
|
+
function assignProp(carry, key, newVal, originalObject) {
|
|
40
|
+
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
41
|
+
if (propType === "enumerable")
|
|
42
|
+
carry[key] = newVal;
|
|
43
|
+
if (propType === "nonenumerable") {
|
|
44
|
+
Object.defineProperty(carry, key, {
|
|
45
|
+
value: newVal,
|
|
46
|
+
enumerable: false,
|
|
47
|
+
writable: true,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function mergeRecursively(origin, newComer, compareFn) {
|
|
53
|
+
if (!isPlainObject(newComer))
|
|
54
|
+
return newComer;
|
|
55
|
+
let newObject = {};
|
|
56
|
+
if (isPlainObject(origin)) {
|
|
57
|
+
const props2 = Object.getOwnPropertyNames(origin);
|
|
58
|
+
const symbols2 = Object.getOwnPropertySymbols(origin);
|
|
59
|
+
newObject = [...props2, ...symbols2].reduce((carry, key) => {
|
|
60
|
+
const targetVal = origin[key];
|
|
61
|
+
if (!isSymbol(key) && !Object.getOwnPropertyNames(newComer).includes(key) || isSymbol(key) && !Object.getOwnPropertySymbols(newComer).includes(key)) {
|
|
62
|
+
assignProp(carry, key, targetVal, origin);
|
|
63
|
+
}
|
|
64
|
+
return carry;
|
|
65
|
+
}, {});
|
|
66
|
+
}
|
|
67
|
+
const props = Object.getOwnPropertyNames(newComer);
|
|
68
|
+
const symbols = Object.getOwnPropertySymbols(newComer);
|
|
69
|
+
const result = [...props, ...symbols].reduce((carry, key) => {
|
|
70
|
+
let newVal = newComer[key];
|
|
71
|
+
const targetVal = isPlainObject(origin) ? origin[key] : void 0;
|
|
72
|
+
if (targetVal !== void 0 && isPlainObject(newVal)) {
|
|
73
|
+
newVal = mergeRecursively(targetVal, newVal, compareFn);
|
|
74
|
+
}
|
|
75
|
+
const propToAssign = compareFn ? compareFn(targetVal, newVal, key) : newVal;
|
|
76
|
+
assignProp(carry, key, propToAssign, newComer);
|
|
77
|
+
return carry;
|
|
78
|
+
}, newObject);
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
function merge(object, ...otherObjects) {
|
|
82
|
+
return otherObjects.reduce((result, newComer) => {
|
|
83
|
+
return mergeRecursively(result, newComer);
|
|
84
|
+
}, object);
|
|
85
|
+
}
|
|
86
|
+
function mergeAndCompare(compareFn, object, ...otherObjects) {
|
|
87
|
+
return otherObjects.reduce((result, newComer) => {
|
|
88
|
+
return mergeRecursively(result, newComer, compareFn);
|
|
89
|
+
}, object);
|
|
90
|
+
}
|
|
91
|
+
function mergeAndConcat(object, ...otherObjects) {
|
|
92
|
+
return otherObjects.reduce((result, newComer) => {
|
|
93
|
+
return mergeRecursively(result, newComer, concatArrays);
|
|
94
|
+
}, object);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// node_modules/.pnpm/merge-anything@6.0.2/node_modules/merge-anything/dist/index.js
|
|
98
|
+
var dist_exports = {};
|
|
99
|
+
__export(dist_exports, {
|
|
100
|
+
concatArrays: () => concatArrays,
|
|
101
|
+
merge: () => merge,
|
|
102
|
+
mergeAndCompare: () => mergeAndCompare,
|
|
103
|
+
mergeAndConcat: () => mergeAndConcat
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export { dist_exports, merge };
|
|
107
|
+
//# sourceMappingURL=chunk-DATO2UPN.js.map
|
|
108
|
+
//# sourceMappingURL=chunk-DATO2UPN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/getType.js","../node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/isArray.js","../node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/isPlainObject.js","../node_modules/.pnpm/is-what@5.0.2/node_modules/is-what/dist/isSymbol.js","../node_modules/.pnpm/merge-anything@6.0.2/node_modules/merge-anything/dist/extensions.js","../node_modules/.pnpm/merge-anything@6.0.2/node_modules/merge-anything/dist/merge.js","../node_modules/.pnpm/merge-anything@6.0.2/node_modules/merge-anything/dist/index.js"],"names":["props","symbols"],"mappings":";;;;;;;AACO,SAAS,QAAQ,OAAS,EAAA;AAC7B,EAAO,OAAA,MAAA,CAAO,UAAU,QAAS,CAAA,IAAA,CAAK,OAAO,CAAE,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAA;AAC9D;;;ACDO,SAAS,QAAQ,OAAS,EAAA;AAC7B,EAAO,OAAA,OAAA,CAAQ,OAAO,CAAM,KAAA,OAAA;AAChC;;;ACCO,SAAS,cAAc,OAAS,EAAA;AACnC,EAAI,IAAA,OAAA,CAAQ,OAAO,CAAM,KAAA,QAAA;AACrB,IAAO,OAAA,KAAA;AACX,EAAM,MAAA,SAAA,GAAY,MAAO,CAAA,cAAA,CAAe,OAAO,CAAA;AAC/C,EAAA,OAAO,CAAC,CAAC,SAAA,IAAa,UAAU,WAAgB,KAAA,MAAA,IAAU,cAAc,MAAO,CAAA,SAAA;AACnF;;;ACRO,SAAS,SAAS,OAAS,EAAA;AAC9B,EAAO,OAAA,OAAA,CAAQ,OAAO,CAAM,KAAA,QAAA;AAChC;;;ACHO,SAAS,YAAA,CAAa,WAAW,MAAQ,EAAA;AAC5C,EAAA,IAAI,OAAQ,CAAA,SAAS,CAAK,IAAA,OAAA,CAAQ,MAAM,CAAG,EAAA;AAEvC,IAAO,OAAA,SAAA,CAAU,OAAO,MAAM,CAAA;AAAA;AAElC,E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A,EAAA,GAAW,YAAc,EAAA;AAChE,EAAA,OAAO,YAAa,CAAA,MAAA,CAAO,CAAC,MAAA,EAAQ,QAAa,KAAA;AAC7C,IAAO,OAAA,gBAAA,CAAiB,MAAQ,EAAA,QAAA,EAAU,SAAS,CAAA;AAAA,KACpD,MAAM,CAAA;AACb;AACO,SAAS,cAAA,CAAe,WAAW,YAAc,EAAA;AACpD,EAAA,OAAO,YAAa,CAAA,MAAA,CAAO,CAAC,MAAA,EAAQ,QAAa,KAAA;AAC7C,IAAO,OAAA,gBAAA,CAAiB,MAAQ,EAAA,QAAA,EAAU,YAAY,CAAA;AAAA,KACvD,MAAM,CAAA;AACb;;;ACvEA,IAAA,YAAA,GAAA;AAAA,QAAA,CAAA,YAAA,EAAA;AAAA,EAAA,YAAA,EAAA,MAAA,YAAA;AAAA,EAAA,KAAA,EAAA,MAAA,KAAA;AAAA,EAAA,eAAA,EAAA,MAAA,eAAA;AAAA,EAAA,cAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-DATO2UPN.js","sourcesContent":["/** Returns the object type of the given payload */\nexport function getType(payload) {\n return Object.prototype.toString.call(payload).slice(8, -1);\n}\n","import { getType } from './getType.js';\n/** Returns whether the payload is an array */\nexport function isArray(payload) {\n return getType(payload) === 'Array';\n}\n","import { getType } from './getType.js';\n/**\n * Returns whether the payload is a plain JavaScript object (excluding special classes or objects\n * with other prototypes)\n */\nexport function isPlainObject(payload) {\n if (getType(payload) !== 'Object')\n return false;\n const prototype = Object.getPrototypeOf(payload);\n return !!prototype && prototype.constructor === Object && prototype === Object.prototype;\n}\n","import { getType } from './getType.js';\n/** Returns whether the payload is a Symbol */\nexport function isSymbol(payload) {\n return getType(payload) === 'Symbol';\n}\n","import { isArray } from 'is-what';\nexport function concatArrays(originVal, newVal) {\n if (isArray(originVal) && isArray(newVal)) {\n // concat logic\n return originVal.concat(newVal);\n }\n return newVal; // always return newVal as fallback!!\n}\n","import { isPlainObject, isSymbol } from 'is-what';\nimport { concatArrays } from './extensions.js';\nfunction assignProp(carry, key, newVal, originalObject) {\n const propType = {}.propertyIsEnumerable.call(originalObject, key)\n ? 'enumerable'\n : 'nonenumerable';\n if (propType === 'enumerable')\n carry[key] = newVal;\n if (propType === 'nonenumerable') {\n Object.defineProperty(carry, key, {\n value: newVal,\n enumerable: false,\n writable: true,\n configurable: true,\n });\n }\n}\nfunction mergeRecursively(origin, newComer, compareFn) {\n // always return newComer if its not an object\n if (!isPlainObject(newComer))\n return newComer;\n // define newObject to merge all values upon\n let newObject = {};\n if (isPlainObject(origin)) {\n const props = Object.getOwnPropertyNames(origin);\n const symbols = Object.getOwnPropertySymbols(origin);\n newObject = [...props, ...symbols].reduce((carry, key) => {\n const targetVal = origin[key];\n if ((!isSymbol(key) && !Object.getOwnPropertyNames(newComer).includes(key)) ||\n (isSymbol(key) && !Object.getOwnPropertySymbols(newComer).includes(key))) {\n assignProp(carry, key, targetVal, origin);\n }\n return carry;\n }, {});\n }\n // newObject has all properties that newComer hasn't\n const props = Object.getOwnPropertyNames(newComer);\n const symbols = Object.getOwnPropertySymbols(newComer);\n const result = [...props, ...symbols].reduce((carry, key) => {\n // re-define the origin and newComer as targetVal and newVal\n let newVal = newComer[key];\n const targetVal = isPlainObject(origin) ? origin[key] : undefined;\n // When newVal is an object do the merge recursively\n if (targetVal !== undefined && isPlainObject(newVal)) {\n newVal = mergeRecursively(targetVal, newVal, compareFn);\n }\n const propToAssign = compareFn ? compareFn(targetVal, newVal, key) : newVal;\n assignProp(carry, key, propToAssign, newComer);\n return carry;\n }, newObject);\n return result;\n}\n/**\n * Merge anything recursively.\n * Objects get merged, special objects (classes etc.) are re-assigned \"as is\".\n * Basic types overwrite objects or other basic types.\n */\nexport function merge(object, ...otherObjects) {\n return otherObjects.reduce((result, newComer) => {\n return mergeRecursively(result, newComer);\n }, object);\n}\nexport function mergeAndCompare(compareFn, object, ...otherObjects) {\n return otherObjects.reduce((result, newComer) => {\n return mergeRecursively(result, newComer, compareFn);\n }, object);\n}\nexport function mergeAndConcat(object, ...otherObjects) {\n return otherObjects.reduce((result, newComer) => {\n return mergeRecursively(result, newComer, concatArrays);\n }, object);\n}\n// import { Timestamp } from '../test/Timestamp'\n// type T1 = { date: Timestamp }\n// type T2 = [{ b: string[] }, { b: number[] }, { date: Timestamp }]\n// type TestT = Merge<T1, T2>\n// type A1 = { arr: string[] }\n// type A2 = { arr: number[] }\n// type A3 = { arr: boolean[] }\n// type TestA = Merge<A1, [A2, A3]>\n// interface I1 {\n// date: Timestamp\n// }\n// interface I2 {\n// date: Timestamp\n// }\n// const _a: I2 = { date: '' } as unknown as I2\n// type TestI = Merge<I1, [I2]>\n// // ReturnType<(typeof merge)<I1, I2>>\n// const a = merge(_a, [_a])\n// interface Arguments extends Record<string | number | symbol, unknown> {\n// key: string;\n// }\n// const aa1: Arguments = { key: \"value1\" }\n// const aa2: Arguments = { key: \"value2\" }\n// const aa = merge(a1, a2);\n// interface Barguments {\n// key: string\n// }\n// const ba1: Barguments = { key: 'value1' }\n// const ba2: Barguments = { key: 'value2' }\n// const ba = merge(ba1, ba2)\n// interface Carguments {\n// key: string\n// }\n// const ca = merge<Carguments, Carguments[]>({ key: 'value1' }, { key: 'value2' })\n// type P = Pop<Carguments[]>\n","export * from './extensions.js';\nexport * from './merge.js';\n"]}
|
package/dist/cli/index.cjs
CHANGED
|
@@ -3068,7 +3068,7 @@ function ora(options) {
|
|
|
3068
3068
|
// package.json
|
|
3069
3069
|
var package_default = {
|
|
3070
3070
|
name: "@keload/node-red-dxp",
|
|
3071
|
-
version: "1.
|
|
3071
|
+
version: "1.5.0",
|
|
3072
3072
|
description: "",
|
|
3073
3073
|
type: "module",
|
|
3074
3074
|
scripts: {
|
|
@@ -3099,6 +3099,10 @@ var package_default = {
|
|
|
3099
3099
|
import: "./dist/editor/index.js",
|
|
3100
3100
|
require: "./dist/editor/index.cjs"
|
|
3101
3101
|
},
|
|
3102
|
+
"./utils": {
|
|
3103
|
+
import: "./dist/utils.js",
|
|
3104
|
+
require: "./dist/utils.cjs"
|
|
3105
|
+
},
|
|
3102
3106
|
"./package.json": "./package.json"
|
|
3103
3107
|
},
|
|
3104
3108
|
keywords: [],
|
|
@@ -3141,6 +3145,7 @@ var package_default = {
|
|
|
3141
3145
|
glob: "11.0.0",
|
|
3142
3146
|
handlebars: "4.7.8",
|
|
3143
3147
|
"html-minifier-terser": "7.2.0",
|
|
3148
|
+
"is-ip": "^5.0.1",
|
|
3144
3149
|
"merge-anything": "6.0.2",
|
|
3145
3150
|
nodemon: "3.1.7",
|
|
3146
3151
|
ora: "8.1.1",
|
|
@@ -3292,7 +3297,7 @@ function listNodeFolders() {
|
|
|
3292
3297
|
relativePath,
|
|
3293
3298
|
resolvedLocalesPaths: glob.globSync(`${fullPath}/${currentConfig.nodes.localesDirName}/*.json`),
|
|
3294
3299
|
nodeIdentifier: `${packageNameSlug}-${dashName}`,
|
|
3295
|
-
fullControllerPath: `${fullPath}
|
|
3300
|
+
fullControllerPath: `${fullPath}/controller.ts`,
|
|
3296
3301
|
editor: {
|
|
3297
3302
|
tsPath: `${fullEditorPath}/${currentConfig.nodes.editor.tsName}.ts`,
|
|
3298
3303
|
htmlPath: `${fullEditorPath}/${currentConfig.nodes.editor.htmlName}.html`,
|
|
@@ -3357,6 +3362,25 @@ async function cleanPaths(paths) {
|
|
|
3357
3362
|
}
|
|
3358
3363
|
}
|
|
3359
3364
|
}
|
|
3365
|
+
var addCredentialsExportPlugin = {
|
|
3366
|
+
name: "add-credentials-export",
|
|
3367
|
+
setup(build) {
|
|
3368
|
+
build.onLoad({ filter: /controller\.ts$/ }, async (args) => {
|
|
3369
|
+
const source = await fsPromise__default.default.readFile(args.path, "utf8");
|
|
3370
|
+
const hasCredentialsExport = /export\s+const\s+credentials\s*=/.test(source);
|
|
3371
|
+
if (!hasCredentialsExport) {
|
|
3372
|
+
return {
|
|
3373
|
+
contents: `${source}
|
|
3374
|
+
export const credentials = {};`,
|
|
3375
|
+
loader: "ts"
|
|
3376
|
+
};
|
|
3377
|
+
}
|
|
3378
|
+
return { contents: source, loader: "ts" };
|
|
3379
|
+
});
|
|
3380
|
+
}
|
|
3381
|
+
};
|
|
3382
|
+
|
|
3383
|
+
// src/builder/controller/BuilderController.class.ts
|
|
3360
3384
|
var BuilderController = class {
|
|
3361
3385
|
params;
|
|
3362
3386
|
constructor(params) {
|
|
@@ -3365,14 +3389,18 @@ var BuilderController = class {
|
|
|
3365
3389
|
async getControllerIndexContent() {
|
|
3366
3390
|
return `
|
|
3367
3391
|
import type { NodeAPI } from 'node-red';
|
|
3368
|
-
${currentContext.listNodesFull.map((node) => `import ${node.pascalName} from '${node.fullControllerPath}';`).join("\n")}
|
|
3392
|
+
${currentContext.listNodesFull.map((node) => `import ${node.pascalName}, {credentials as cred${node.pascalName}} from '${node.fullControllerPath}';`).join("\n")}
|
|
3369
3393
|
|
|
3370
3394
|
|
|
3371
3395
|
export default async (RED: NodeAPI): Promise<void> => {
|
|
3372
3396
|
global.RED = RED;
|
|
3373
3397
|
|
|
3374
|
-
${currentContext.listNodesFull.map(
|
|
3375
|
-
|
|
3398
|
+
${currentContext.listNodesFull.map(
|
|
3399
|
+
(node) => `// @ts-ignore
|
|
3400
|
+
global.RED.nodes.registerType('${node.name}', ${node.pascalName}, {
|
|
3401
|
+
credentials: cred${node.pascalName}
|
|
3402
|
+
});`
|
|
3403
|
+
).join("\n")}
|
|
3376
3404
|
};
|
|
3377
3405
|
`.trim();
|
|
3378
3406
|
}
|
|
@@ -3389,7 +3417,8 @@ global.RED.nodes.registerType('${node.name}', ${node.pascalName});`).join("\n")}
|
|
|
3389
3417
|
format: "cjs",
|
|
3390
3418
|
target: "es2018",
|
|
3391
3419
|
loader: { ".ts": "ts" },
|
|
3392
|
-
packages: "external"
|
|
3420
|
+
packages: "external",
|
|
3421
|
+
plugins: [addCredentialsExportPlugin]
|
|
3393
3422
|
});
|
|
3394
3423
|
}
|
|
3395
3424
|
async getControllerTask() {
|
|
@@ -3773,6 +3802,7 @@ var Builder = class {
|
|
|
3773
3802
|
return Promise.all([
|
|
3774
3803
|
this.builderController.getControllerTask(),
|
|
3775
3804
|
this.builderEditor.getEditorTask(),
|
|
3805
|
+
// TODO: optimize this part locales
|
|
3776
3806
|
this.localesBuilder.exportAll()
|
|
3777
3807
|
]);
|
|
3778
3808
|
}
|
|
@@ -3827,7 +3857,7 @@ var CreateNodeScaffolding = class {
|
|
|
3827
3857
|
prepareStructure() {
|
|
3828
3858
|
return [
|
|
3829
3859
|
{
|
|
3830
|
-
finalPath: `${this.newNodeDistPath}
|
|
3860
|
+
finalPath: `${this.newNodeDistPath}/controller.ts`,
|
|
3831
3861
|
templatePath: `${this.scaffoldedDistHbs}/controller.ts.hbs`,
|
|
3832
3862
|
templateData: {
|
|
3833
3863
|
nodePascalName: this.nodePascalName,
|
|
@@ -3967,12 +3997,13 @@ function runWatcher(params) {
|
|
|
3967
3997
|
// src/cli/index.ts
|
|
3968
3998
|
var program = new commander.Command();
|
|
3969
3999
|
program.name("node-red-dxp").description("node-red-dxp CLI").version(package_default.version);
|
|
3970
|
-
program.command("build").description("Build project").action(async (options) => {
|
|
4000
|
+
program.command("build").description("Build project").option("--no-minify", "No minify the output", true).action(async (options) => {
|
|
3971
4001
|
const nodesCount = currentContext.listNodesFull.length;
|
|
3972
4002
|
const start = perf_hooks.performance.now();
|
|
4003
|
+
console.log("node-red-dxp", package_default.version);
|
|
3973
4004
|
const spinner = ora(`Building ${nodesCount} node(s)...`).start();
|
|
3974
4005
|
const builder = new Builder({
|
|
3975
|
-
minify:
|
|
4006
|
+
minify: options.minify
|
|
3976
4007
|
});
|
|
3977
4008
|
await builder.buildAll();
|
|
3978
4009
|
const end = perf_hooks.performance.now();
|