n8n-nodes-hebing-parameter-input 2.0.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/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# n8n-nodes-parameter-input
|
|
2
|
+
|
|
3
|
+
A custom n8n node for inputting parameters with bilingual support. This node allows you to define custom parameters in English and Chinese with various data types and default values, and outputs them as a JSON object for use throughout your workflow.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Bilingual Support**: Define parameter names in both English and Chinese
|
|
8
|
+
- **Multiple Data Types**: Supports String, Number, Boolean, Date, JSON, and Dropdown types
|
|
9
|
+
- **Default Values**: Set default values for each parameter
|
|
10
|
+
- **Dynamic Parameters**: Add multiple parameters (up to 20)
|
|
11
|
+
- **JSON Output**: All parameters are output as a JSON object for easy use in subsequent nodes
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### n8n Cloud
|
|
16
|
+
|
|
17
|
+
1. Go to the n8n Cloud dashboard
|
|
18
|
+
2. Click on "Settings" > "Community Nodes"
|
|
19
|
+
3. Add the "n8n-nodes-parameter-input" node
|
|
20
|
+
4. Click "Install"
|
|
21
|
+
|
|
22
|
+
### n8n Self-Hosted
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install n8n-nodes-parameter-input
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then restart n8n.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
1. Drag and drop the "Parameter Input" node into your workflow
|
|
33
|
+
2. Set the number of parameters you want to define
|
|
34
|
+
3. For each parameter:
|
|
35
|
+
- Enter the English name (used as the JSON key)
|
|
36
|
+
- Enter the Chinese name (for display only)
|
|
37
|
+
- Select the parameter type
|
|
38
|
+
- Enter a default value
|
|
39
|
+
4. Connect the node to other nodes in your workflow
|
|
40
|
+
5. The parameter values will be available as `$json.parameterName` in subsequent nodes
|
|
41
|
+
|
|
42
|
+
## Parameter Types
|
|
43
|
+
|
|
44
|
+
| Type | Description |
|
|
45
|
+
|------|-------------|
|
|
46
|
+
| String | A text string |
|
|
47
|
+
| Number | A numeric value |
|
|
48
|
+
| Boolean | True/false value |
|
|
49
|
+
| Date | A date and time value |
|
|
50
|
+
| JSON | A JSON object or array |
|
|
51
|
+
| Dropdown | A dropdown selection (requires additional configuration) |
|
|
52
|
+
|
|
53
|
+
## Example Output
|
|
54
|
+
|
|
55
|
+
If you define two parameters:
|
|
56
|
+
- English name: "apiKey", Chinese name: "API密钥", Type: String, Value: "1234567890"
|
|
57
|
+
- English name: "userId", Chinese name: "用户ID", Type: Number, Value: 1234
|
|
58
|
+
|
|
59
|
+
The output will be:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"apiKey": "1234567890",
|
|
64
|
+
"userId": 1234
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
### Parameter Count
|
|
71
|
+
|
|
72
|
+
The number of parameters to define (1-20).
|
|
73
|
+
|
|
74
|
+
### Parameter Fields
|
|
75
|
+
|
|
76
|
+
Each parameter has the following fields:
|
|
77
|
+
|
|
78
|
+
#### Parameter Name (English)
|
|
79
|
+
|
|
80
|
+
The English name of the parameter. This will be used as the key in the output JSON object. It's recommended to use camelCase or snake_case for compatibility.
|
|
81
|
+
|
|
82
|
+
#### Parameter Name (Chinese)
|
|
83
|
+
|
|
84
|
+
The Chinese name of the parameter. This is for display purposes only and will not be included in the output JSON.
|
|
85
|
+
|
|
86
|
+
#### Parameter Type
|
|
87
|
+
|
|
88
|
+
The data type of the parameter. See "Parameter Types" section for details.
|
|
89
|
+
|
|
90
|
+
#### Parameter Value
|
|
91
|
+
|
|
92
|
+
The default value of the parameter. The format depends on the parameter type.
|
|
93
|
+
|
|
94
|
+
## Version History
|
|
95
|
+
|
|
96
|
+
- 2.0.0: Initial release
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterInput.node.js","sourceRoot":"","sources":["../nodes/ParameterInput/ParameterInput.node.ts"],"names":[],"mappings":";;AAEA,wCAoCC;AAp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
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><rect width="64" height="64" fill="#FFF" rx="8" ry="8"/><g stroke="#333" stroke-width="2" fill="#333"><path d="M20 18h24v28H20z" fill="none"/><path d="M24 24h16m-16 6h16m-16 6h16M28 42h8"/><rect x="14" y="14" width="36" height="36" fill="none" rx="4" ry="4"/><circle cx="46" cy="24" r="3" fill="none"/><circle cx="46" cy="30" r="3" fill="none"/><circle cx="46" cy="36" r="3" fill="none"/></g></svg>
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-hebing-parameter-input",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "A custom n8n node for parameter input with bilingual support",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"parameter",
|
|
9
|
+
"input",
|
|
10
|
+
"workflow"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "",
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "",
|
|
16
|
+
"email": ""
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": ""
|
|
21
|
+
},
|
|
22
|
+
"main": "index.js",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc --skipLibCheck && gulp build:icons",
|
|
25
|
+
"dev": "tsc --watch",
|
|
26
|
+
"format": "prettier nodes --write",
|
|
27
|
+
"lint": "eslint nodes package.json",
|
|
28
|
+
"lintfix": "eslint nodes package.json --fix",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"n8n": {
|
|
35
|
+
"n8nNodesApiVersion": 1,
|
|
36
|
+
"nodes": [
|
|
37
|
+
"dist/nodes/ParameterInput/ParameterInput.node.js"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
42
|
+
"eslint": "^8.0.0",
|
|
43
|
+
"eslint-plugin-n8n-nodes-base": "^1.11.0",
|
|
44
|
+
"gulp": "^4.0.2",
|
|
45
|
+
"gulp-svgmin": "^4.1.0",
|
|
46
|
+
"n8n-workflow": "^1.0.0",
|
|
47
|
+
"prettier": "^2.7.1",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"n8n-workflow": "^1.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|