n8n-nodes-hebing-parameter-input 2.0.0 → 2.0.2
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.
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParameterInput = void 0;
|
|
4
|
+
class ParameterInput {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'Parameter Input',
|
|
8
|
+
name: 'parameterInput',
|
|
9
|
+
group: ['transform'],
|
|
10
|
+
version: 1,
|
|
11
|
+
description: 'A custom node for parameter input with bilingual support',
|
|
12
|
+
defaults: {
|
|
13
|
+
name: 'Parameter Input',
|
|
14
|
+
},
|
|
15
|
+
inputs: ['main'],
|
|
16
|
+
outputs: ['main'],
|
|
17
|
+
credentials: [],
|
|
18
|
+
properties: [
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Parameters',
|
|
21
|
+
name: 'parameters',
|
|
22
|
+
type: 'fixedCollection',
|
|
23
|
+
placeholder: 'Add Parameter',
|
|
24
|
+
default: {},
|
|
25
|
+
typeOptions: {
|
|
26
|
+
multipleValues: true,
|
|
27
|
+
minimumValue: 1,
|
|
28
|
+
},
|
|
29
|
+
options: [
|
|
30
|
+
{
|
|
31
|
+
name: 'parameter',
|
|
32
|
+
displayName: 'Parameter',
|
|
33
|
+
values: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Parameter Name',
|
|
36
|
+
name: 'name',
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: '',
|
|
39
|
+
description: 'Parameter name (used as JSON key)',
|
|
40
|
+
placeholder: 'e.g., date',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Parameter Type',
|
|
44
|
+
name: 'type',
|
|
45
|
+
type: 'options',
|
|
46
|
+
default: 'string',
|
|
47
|
+
options: [
|
|
48
|
+
{
|
|
49
|
+
name: 'String',
|
|
50
|
+
value: 'string',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Number',
|
|
54
|
+
value: 'number',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Boolean',
|
|
58
|
+
value: 'boolean',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Date',
|
|
62
|
+
value: 'date',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'JSON',
|
|
66
|
+
value: 'json',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
description: 'Type of the parameter',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
displayName: 'Parameter Value',
|
|
73
|
+
name: 'value',
|
|
74
|
+
type: 'string',
|
|
75
|
+
default: '',
|
|
76
|
+
description: 'Value of the parameter',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async execute() {
|
|
86
|
+
const items = this.getInputData();
|
|
87
|
+
const returnData = [];
|
|
88
|
+
for (let i = 0; i < items.length; i++) {
|
|
89
|
+
// Get parameters from the UI
|
|
90
|
+
const parametersData = this.getNodeParameter('parameters.parameter', i, []);
|
|
91
|
+
const parameters = {};
|
|
92
|
+
// Loop through all parameters
|
|
93
|
+
for (const param of parametersData) {
|
|
94
|
+
const { name, value } = param;
|
|
95
|
+
// Use parameter name as the key
|
|
96
|
+
parameters[name] = value;
|
|
97
|
+
}
|
|
98
|
+
// Add the parameters object to the return data
|
|
99
|
+
returnData.push({
|
|
100
|
+
json: parameters,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return [returnData];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.ParameterInput = ParameterInput;
|
|
107
|
+
//# sourceMappingURL=ParameterInput.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterInput.node.js","sourceRoot":"","sources":["../../../nodes/ParameterInput/ParameterInput.node.ts"],"names":[],"mappings":";;;AAOA,MAAa,cAAc;IAA3B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE;gBACT,IAAI,EAAE,iBAAiB;aACvB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,EAAE;YACf,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,YAAY;oBACzB,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE,eAAe;oBAC5B,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE;wBACZ,cAAc,EAAE,IAAI;wBACpB,YAAY,EAAE,CAAC;qBACf;oBACD,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,WAAW;4BACjB,WAAW,EAAE,WAAW;4BACxB,MAAM,EAAE;gCACP;oCACC,WAAW,EAAE,gBAAgB;oCAC7B,IAAI,EAAE,MAAM;oCACZ,IAAI,EAAE,QAAQ;oCACd,OAAO,EAAE,EAAE;oCACX,WAAW,EAAE,mCAAmC;oCAChD,WAAW,EAAE,YAAY;iCACzB;gCACD;oCACC,WAAW,EAAE,gBAAgB;oCAC7B,IAAI,EAAE,MAAM;oCACZ,IAAI,EAAE,SAAS;oCACf,OAAO,EAAE,QAAQ;oCACjB,OAAO,EAAE;wCACR;4CACC,IAAI,EAAE,QAAQ;4CACd,KAAK,EAAE,QAAQ;yCACf;wCACD;4CACC,IAAI,EAAE,QAAQ;4CACd,KAAK,EAAE,QAAQ;yCACf;wCACD;4CACC,IAAI,EAAE,SAAS;4CACf,KAAK,EAAE,SAAS;yCAChB;wCACD;4CACC,IAAI,EAAE,MAAM;4CACZ,KAAK,EAAE,MAAM;yCACb;wCACD;4CACC,IAAI,EAAE,MAAM;4CACZ,KAAK,EAAE,MAAM;yCACb;qCACD;oCACD,WAAW,EAAE,uBAAuB;iCACpC;gCACD;oCACC,WAAW,EAAE,iBAAiB;oCAC9B,IAAI,EAAE,OAAO;oCACb,IAAI,EAAE,QAAQ;oCACd,OAAO,EAAE,EAAE;oCACX,WAAW,EAAE,wBAAwB;iCACrC;6BACD;yBACD;qBACD;iBACD;aACD;SACD,CAAC;IA+BH,CAAC;IA7BA,KAAK,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,UAAU,GAAyB,EAAE,CAAC;QAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,6BAA6B;YAC7B,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC,EAAE,EAAE,CAIxE,CAAC;YAEH,MAAM,UAAU,GAAwB,EAAE,CAAC;YAE3C,8BAA8B;YAC9B,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;gBACpC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;gBAC9B,gCAAgC;gBAChC,UAAU,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YAC1B,CAAC;YAED,+CAA+C;YAC/C,UAAU,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,UAAU;aAChB,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA7GD,wCA6GC"}
|
package/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
// Export the node module definition
|
|
2
1
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
version: require('./package.json').version,
|
|
5
|
-
credentials: require('./dist/credentials').default || [],
|
|
6
|
-
nodes: require('./dist/nodes').default || [],
|
|
2
|
+
nodeClass: require('./dist/nodes/ParameterInput/ParameterInput.node.js').ParameterInput,
|
|
7
3
|
};
|
package/package.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parameterInput = parameterInput;
|
|
4
|
-
async function parameterInput() {
|
|
5
|
-
const items = this.getInputData();
|
|
6
|
-
let returnData = [];
|
|
7
|
-
for (let i = 0; i < items.length; i++) {
|
|
8
|
-
// Get parameters from the UI
|
|
9
|
-
const parameterCount = this.getNodeParameter('parameterCount', i, 0);
|
|
10
|
-
const parameters = {};
|
|
11
|
-
// Loop through all parameters
|
|
12
|
-
for (let j = 0; j < parameterCount; j++) {
|
|
13
|
-
const parameterName = this.getNodeParameter(`parameters.${j}.name`, i, '');
|
|
14
|
-
const parameterChineseName = this.getNodeParameter(`parameters.${j}.chineseName`, i, '');
|
|
15
|
-
const parameterType = this.getNodeParameter(`parameters.${j}.type`, i, 'string');
|
|
16
|
-
const parameterValue = this.getNodeParameter(`parameters.${j}.value`, i, '');
|
|
17
|
-
// Use English name as the key, but store Chinese name as a comment?
|
|
18
|
-
// Wait, the requirement says "参数输入节点的输出是一个包含所有参数的json对象"
|
|
19
|
-
// The JSON keys should be English names for better compatibility in workflows
|
|
20
|
-
parameters[parameterName] = parameterValue;
|
|
21
|
-
// If we also need to include Chinese names, we could do something like:
|
|
22
|
-
// parameters[parameterChineseName] = parameterValue;
|
|
23
|
-
// But we should follow the JSON format convention
|
|
24
|
-
}
|
|
25
|
-
// Add the parameters object to the return data
|
|
26
|
-
returnData.push(parameters);
|
|
27
|
-
}
|
|
28
|
-
return [
|
|
29
|
-
{
|
|
30
|
-
json: returnData[0],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=ParameterInput.node.js.map
|
|
@@ -1 +0,0 @@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