n8n-nodes-soar 0.1.15 → 0.1.18

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.
Files changed (58) hide show
  1. package/dist/common/asset.js +141 -0
  2. package/dist/common/collector.js +32 -0
  3. package/dist/common/connectionType.js +15 -0
  4. package/dist/common/executor/docker.executor.js +97 -0
  5. package/dist/common/executor/executor.js +48 -0
  6. package/dist/common/executor/k8s.executor.js +190 -0
  7. package/dist/common/runner/container.runner.js +174 -0
  8. package/dist/common/runner/priority.js +44 -0
  9. package/dist/common/runner/priority.runner.js +38 -0
  10. package/dist/common/runner/runner.js +57 -0
  11. package/dist/credentials/Docker/Docker.credentials.js +149 -0
  12. package/dist/credentials/Docker/docker.svg +7 -0
  13. package/dist/credentials/{FofaCredentials.credentials.js → FofaApi/FofaApi.credentials.js} +5 -5
  14. package/dist/credentials/Kubernetes/Kubernetes.credentials.js +82 -0
  15. package/dist/credentials/Kubernetes/k8s.svg +1 -0
  16. package/dist/nodes/Asset/SplitAsset/SplitAsset.node.js +110 -0
  17. package/dist/nodes/Asset/SplitAsset/split.svg +13 -0
  18. package/dist/nodes/Collector/Collector.node.js +123 -0
  19. package/dist/nodes/Executor/DockerExecutor/DockerExecutor.node.js +59 -0
  20. package/dist/nodes/Executor/DockerExecutor/docker.svg +7 -0
  21. package/dist/nodes/Executor/KubernetesExecutor/KubernetesExecutor.node.js +59 -0
  22. package/dist/nodes/Executor/KubernetesExecutor/k8s.svg +1 -0
  23. package/dist/nodes/Fofa/Fofa.node.js +20 -7
  24. package/dist/nodes/Katana/Katana.node.js +1 -1
  25. package/dist/nodes/Nuclei/Nuclei.node.js +1 -1
  26. package/dist/nodes/Runner/Dns/Dns.node.js +199 -0
  27. package/dist/nodes/Runner/Dns/script.js +81 -0
  28. package/dist/nodes/Runner/Httpx/Httpx.node.js +830 -0
  29. package/dist/nodes/Runner/Httpx/httpx.svg +3 -0
  30. package/dist/nodes/Runner/Katana/Katana.node.js +521 -0
  31. package/dist/nodes/Runner/Katana/a.json +30 -0
  32. package/dist/nodes/Runner/Katana/katana.svg +3 -0
  33. package/dist/nodes/Runner/Masscan/Masscan.node.js +151 -0
  34. package/dist/nodes/Runner/Masscan/masscan.svg +70 -0
  35. package/dist/nodes/{Naabu → Runner/Naabu}/Naabu.node.js +86 -48
  36. package/dist/nodes/Runner/Naabu/naabu.svg +3 -0
  37. package/dist/nodes/Runner/Nuclei/Nuclei.node.js +1057 -0
  38. package/dist/nodes/Runner/Nuclei/a.json +48 -0
  39. package/dist/nodes/Runner/Nuclei/nuclei.svg +3 -0
  40. package/dist/nodes/Runner/Priority/Priority.node.js +110 -0
  41. package/dist/nodes/Runner/PriorityAdd/PriorityAdd.node.js +97 -0
  42. package/dist/nodes/Runner/Router/SwitchRouter/SwitchRouter.node.js +101 -0
  43. package/dist/nodes/{Subfinder → Runner/Subfinder}/Subfinder.node.js +74 -43
  44. package/dist/nodes/Runner/Subfinder/subfinder.svg +3 -0
  45. package/dist/nodes/Runner/Unauthor/Unauthor.node.js +169 -0
  46. package/dist/nodes/Unauthor/Unauthor.node.js +24 -18
  47. package/package.json +63 -59
  48. package/dist/nodes/Cdncheck/Cdncheck.node.json +0 -9
  49. package/dist/nodes/Fofa/Fofa.node.json +0 -9
  50. package/dist/nodes/Httpx/Httpx.node.json +0 -9
  51. package/dist/nodes/Naabu/Naabu.node.json +0 -9
  52. package/dist/nodes/Subfinder/Subfinder.node.json +0 -9
  53. package/dist/utils/executor.js +0 -233
  54. package/dist/utils/interface.js +0 -4
  55. package/dist/utils/runner/docker.runner.js +0 -72
  56. package/dist/utils/runner/k8s.runner.js +0 -167
  57. package/dist/utils/runner/runner.js +0 -11
  58. /package/dist/credentials/{fofa.svg → FofaApi/fofa.svg} +0 -0
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "Unauthor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return Unauthor;
9
+ }
10
+ });
11
+ const _connectionType = require("../../../common/connectionType");
12
+ const _containerrunner = require("../../../common/runner/container.runner");
13
+ const _priority = require("../../../common/runner/priority");
14
+ function _define_property(obj, key, value) {
15
+ if (key in obj) {
16
+ Object.defineProperty(obj, key, {
17
+ value: value,
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true
21
+ });
22
+ } else {
23
+ obj[key] = value;
24
+ }
25
+ return obj;
26
+ }
27
+ class UnauthorRunner extends _containerrunner.ContainerRunner {
28
+ cmd(assets) {
29
+ const type = this.func.getNodeParameter("type", this.itemIndex);
30
+ return [
31
+ "unauthor",
32
+ "--type",
33
+ type,
34
+ "-t",
35
+ assets.map((a)=>a.getHostAndPort()).join(","),
36
+ ...this.collectGeneratedOptions([
37
+ "options.option"
38
+ ])
39
+ ];
40
+ }
41
+ process(rawAssets, stdout) {
42
+ const result = new Map();
43
+ for (const line of stdout.trim().split("\n")){
44
+ const json = JSON.parse(line);
45
+ result.set(json.target, json);
46
+ }
47
+ return rawAssets.map((a)=>{
48
+ const res = result.get(a.getHostAndPort());
49
+ if (res) {
50
+ a.response = res;
51
+ a.success = res.success;
52
+ }
53
+ return a;
54
+ });
55
+ }
56
+ }
57
+ class Unauthor {
58
+ async supplyData(itemIndex) {
59
+ return {
60
+ response: [
61
+ new UnauthorRunner("unauthor", _priority.APP_RUNNER_PRIORITY, this, itemIndex)
62
+ ]
63
+ };
64
+ }
65
+ constructor(){
66
+ _define_property(this, "description", {
67
+ displayName: "Runner: Unauthor",
68
+ name: "unauthor",
69
+ icon: "fa:key",
70
+ group: [
71
+ "transform"
72
+ ],
73
+ codex: {
74
+ alias: [
75
+ "Unauthor"
76
+ ],
77
+ categories: [
78
+ "SOAR"
79
+ ],
80
+ subcategories: {
81
+ SOAR: [
82
+ "runner"
83
+ ]
84
+ },
85
+ resources: {
86
+ primaryDocumentation: [
87
+ {
88
+ url: "https://github.com/yoshino-s/unauthor"
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ version: 1,
94
+ description: "Interact with Unauthor, find unauthorized access to assets",
95
+ defaults: {
96
+ name: "Unauthor"
97
+ },
98
+ subtitle: '={{$parameter["type"]}}',
99
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
100
+ inputs: [],
101
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
102
+ outputs: [
103
+ _connectionType.NodeConnectionType.Runner
104
+ ],
105
+ properties: [
106
+ {
107
+ displayName: "Only Success",
108
+ name: "onlySuccess",
109
+ type: "boolean",
110
+ default: true
111
+ },
112
+ {
113
+ displayName: "Type",
114
+ name: "type",
115
+ type: "options",
116
+ default: "redis",
117
+ options: [
118
+ {
119
+ displayName: "Redis",
120
+ name: "Redis",
121
+ value: "redis"
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ displayName: "Options",
127
+ name: "options",
128
+ type: "fixedCollection",
129
+ default: {},
130
+ typeOptions: {
131
+ multipleValues: true
132
+ },
133
+ options: [
134
+ {
135
+ displayName: "Option",
136
+ name: "option",
137
+ values: [
138
+ {
139
+ displayName: "Options",
140
+ name: "key",
141
+ type: "options",
142
+ default: "--concurrent",
143
+ options: [
144
+ {
145
+ name: "Concurrent",
146
+ value: "--concurrent",
147
+ description: "Concurrent number (default 20)"
148
+ },
149
+ {
150
+ name: "Timeout",
151
+ value: "--timeout",
152
+ description: "Timeout seconds (default 10s)"
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ displayName: "Value",
158
+ name: "value",
159
+ type: "string",
160
+ default: ""
161
+ }
162
+ ]
163
+ }
164
+ ]
165
+ }
166
+ ]
167
+ });
168
+ }
169
+ }
@@ -33,7 +33,7 @@ class Unauthor {
33
33
  type
34
34
  ],
35
35
  extraArgParameters: [
36
- "options"
36
+ "options.option"
37
37
  ]
38
38
  });
39
39
  result.push(...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(JSON.parse(response.stdout)), {
@@ -98,28 +98,34 @@ class Unauthor {
98
98
  },
99
99
  options: [
100
100
  {
101
- displayName: "Options",
102
- name: "key",
103
- type: "options",
104
- default: "-concurrent",
105
- options: [
101
+ displayName: "Option",
102
+ name: "option",
103
+ values: [
106
104
  {
107
- name: "Concurrent",
108
- value: "-concurrent",
109
- description: "Concurrent number (default 20)"
105
+ displayName: "Options",
106
+ name: "key",
107
+ type: "options",
108
+ default: "--concurrent",
109
+ options: [
110
+ {
111
+ name: "Concurrent",
112
+ value: "--concurrent",
113
+ description: "Concurrent number (default 20)"
114
+ },
115
+ {
116
+ name: "Timeout",
117
+ value: "--timeout",
118
+ description: "Timeout seconds (default 10s)"
119
+ }
120
+ ]
110
121
  },
111
122
  {
112
- name: "Timeout",
113
- value: "-timeout",
114
- description: "Timeout seconds (default 10s)"
123
+ displayName: "Value",
124
+ name: "value",
125
+ type: "string",
126
+ default: ""
115
127
  }
116
128
  ]
117
- },
118
- {
119
- displayName: "Value",
120
- name: "value",
121
- type: "string",
122
- default: ""
123
129
  }
124
130
  ]
125
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-soar",
3
- "version": "0.1.15",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"
@@ -16,73 +16,65 @@
16
16
  "url": "https://github.com/yoshino-s/n8n-nodes-soar.git"
17
17
  },
18
18
  "main": "index.js",
19
- "scripts": {
20
- "prepare": "husky install",
21
- "build": "swc src -d dist && tsx ./scripts/copy.ts",
22
- "build:watch": "tsx ./scripts/copy.ts && swc src -d dist --watch",
23
- "new": "tsx ./scripts/new.ts",
24
- "parse": "tsx ./scripts/parse.ts",
25
- "lint": "eslint src --ext .ts",
26
- "lint:fix": "eslint src --ext .ts --fix",
27
- "prepublishOnly": "yarn build",
28
- "release": "standard-version",
29
- "commit": "git-cz",
30
- "test": "jest"
31
- },
32
19
  "files": [
33
20
  "dist"
34
21
  ],
35
22
  "n8n": {
36
23
  "n8nNodesApiVersion": 1,
37
24
  "credentials": [
38
- "dist/credentials/FofaCredentials.credentials.js"
25
+ "dist/credentials/FofaApi/FofaApi.credentials.js",
26
+ "dist/credentials/Docker/Docker.credentials.js",
27
+ "dist/credentials/Kubernetes/Kubernetes.credentials.js"
39
28
  ],
40
29
  "nodes": [
41
- "dist/nodes/Uncover/Uncover.node.js",
42
- "dist/nodes/Cdncheck/Cdncheck.node.js",
43
- "dist/nodes/Naabu/Naabu.node.js",
44
- "dist/nodes/Nuclei/Nuclei.node.js",
45
- "dist/nodes/Httpx/Httpx.node.js",
46
- "dist/nodes/Subfinder/Subfinder.node.js",
47
- "dist/nodes/Katana/Katana.node.js",
48
- "dist/nodes/Fofa/Fofa.node.js",
49
- "dist/nodes/Tshark/Tshark.node.js",
50
- "dist/nodes/Unauthor/Unauthor.node.js"
30
+ "dist/nodes/Executor/DockerExecutor/DockerExecutor.node.js",
31
+ "dist/nodes/Executor/KubernetesExecutor/KubernetesExecutor.node.js",
32
+ "dist/nodes/Collector/Collector.node.js",
33
+ "dist/nodes/Runner/Dns/Dns.node.js",
34
+ "dist/nodes/Runner/Httpx/Httpx.node.js",
35
+ "dist/nodes/Runner/Masscan/Masscan.node.js",
36
+ "dist/nodes/Runner/Naabu/Naabu.node.js",
37
+ "dist/nodes/Runner/Nuclei/Nuclei.node.js",
38
+ "dist/nodes/Runner/Subfinder/Subfinder.node.js",
39
+ "dist/nodes/Runner/Priority/Priority.node.js",
40
+ "dist/nodes/Runner/Unauthor/Unauthor.node.js",
41
+ "dist/nodes/Fofa/Fofa.node.js"
51
42
  ]
52
43
  },
53
44
  "devDependencies": {
54
- "@commitlint/cli": "^17.4.2",
55
- "@commitlint/config-conventional": "^17.4.2",
56
- "@swc/cli": "^0.1.59",
57
- "@swc/core": "^1.3.27",
58
- "@swc/jest": "^0.2.24",
59
- "@types/dockerode": "^3.3.19",
60
- "@types/glob": "^8.0.1",
61
- "@types/inquirer": "^9.0.3",
62
- "@types/jest": "^29.2.6",
63
- "@types/request-promise-native": "^1.0.18",
64
- "@typescript-eslint/eslint-plugin": "^5.30.5",
65
- "@typescript-eslint/parser": "^5.30.5",
66
- "chalk": "^4",
67
- "chokidar": "^3.5.3",
68
- "commitizen": "^4.2.6",
69
- "conventional-changelog-cli": "^2.2.2",
45
+ "@commitlint/cli": "^18.4.2",
46
+ "@commitlint/config-conventional": "^18.4.2",
47
+ "@swc/cli": "^0.1.63",
48
+ "@swc/core": "^1.3.96",
49
+ "@swc/jest": "^0.2.29",
50
+ "@types/dockerode": "^3.3.23",
51
+ "@types/glob": "^8.1.0",
52
+ "@types/inquirer": "^9.0.7",
53
+ "@types/jest": "^29.5.8",
54
+ "@types/lodash": "^4.14.201",
55
+ "@types/request-promise-native": "^1.0.21",
56
+ "@typescript-eslint/eslint-plugin": "^6.11.0",
57
+ "@typescript-eslint/parser": "^6.11.0",
58
+ "chalk": "^5.3.0",
59
+ "commitizen": "^4.3.0",
60
+ "conventional-changelog-cli": "^4.1.0",
70
61
  "cz-conventional-changelog": "^3.3.0",
71
- "eslint": "^8.19.0",
72
- "eslint-config-prettier": "^8.5.0",
73
- "eslint-import-resolver-typescript": "^3.5.3",
74
- "eslint-plugin-import": "^2.26.0",
75
- "eslint-plugin-n8n-nodes-base": "^1.13.0",
76
- "eslint-plugin-prettier": "^4.2.1",
77
- "glob": "^8.1.0",
62
+ "eslint": "^8.53.0",
63
+ "eslint-config-prettier": "^9.0.0",
64
+ "eslint-import-resolver-typescript": "^3.6.1",
65
+ "eslint-plugin-import": "^2.29.0",
66
+ "eslint-plugin-n8n-nodes-base": "^1.16.1",
67
+ "eslint-plugin-prettier": "^5.0.1",
68
+ "glob": "^10.3.10",
78
69
  "husky": "^8.0.3",
79
- "jest": "^29.3.1",
80
- "n8n-core": "^1.0.1",
81
- "n8n-workflow": "^1.0.1",
82
- "prettier": "^2.8.3",
70
+ "inquirer": "^9.2.12",
71
+ "jest": "^29.7.0",
72
+ "n8n-core": "^1.14.1",
73
+ "n8n-workflow": "^1.14.1",
74
+ "prettier": "^3.1.0",
83
75
  "standard-version": "^9.5.0",
84
- "tsx": "^3.12.8",
85
- "typescript": "^4.9.4"
76
+ "tsx": "^4.1.2",
77
+ "typescript": "^5.2.2"
86
78
  },
87
79
  "config": {
88
80
  "commitizen": {
@@ -101,9 +93,21 @@
101
93
  "header": "# Changelog\n\n"
102
94
  },
103
95
  "dependencies": {
104
- "axios": "^1.5.0",
105
- "dockerode": "^3.3.5",
106
- "inquirer": "^9.2.11",
107
- "n8n-nodes-container": "^0.1.8"
96
+ "@kubernetes/client-node": "^0.20.0",
97
+ "class-transformer": "^0.5.1",
98
+ "dockerode": "^4.0.0",
99
+ "lodash": "^4.17.21",
100
+ "reflect-metadata": "^0.1.13"
101
+ },
102
+ "scripts": {
103
+ "build": "swc src -d dist && tsx ./scripts/copy.ts",
104
+ "build:watch": "tsx ./scripts/copy.ts && swc src -d dist --watch",
105
+ "new": "tsx ./scripts/new.ts",
106
+ "parse": "tsx ./scripts/parse.ts",
107
+ "lint": "eslint src --ext .ts",
108
+ "lint:fix": "eslint src --ext .ts --fix",
109
+ "release": "standard-version",
110
+ "commit": "git-cz",
111
+ "test": "jest"
108
112
  }
109
- }
113
+ }
@@ -1,9 +0,0 @@
1
- {
2
- "node": "n8n-nodes-soar.cdncheck",
3
- "nodeVersion": "1.0",
4
- "codexVersion": "1.0",
5
- "categories": [
6
- "Development",
7
- "Container"
8
- ]
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "node": "n8n-nodes-soar.fofa",
3
- "nodeVersion": "1.0",
4
- "codexVersion": "1.0",
5
- "categories": [
6
- "Development",
7
- "Container"
8
- ]
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "node": "n8n-nodes-soar.httpx",
3
- "nodeVersion": "1.0",
4
- "codexVersion": "1.0",
5
- "categories": [
6
- "Development",
7
- "Container"
8
- ]
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "node": "n8n-nodes-soar.naabu",
3
- "nodeVersion": "1.0",
4
- "codexVersion": "1.0",
5
- "categories": [
6
- "Development",
7
- "Container"
8
- ]
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "node": "n8n-nodes-soar.subfinder",
3
- "nodeVersion": "1.0",
4
- "codexVersion": "1.0",
5
- "categories": [
6
- "Development",
7
- "Container"
8
- ]
9
- }
@@ -1,233 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- injectCommonProperties: function() {
13
- return injectCommonProperties;
14
- },
15
- SoarExecutor: function() {
16
- return SoarExecutor;
17
- }
18
- });
19
- const _n8nworkflow = require("n8n-workflow");
20
- const _dockerrunner = require("./runner/docker.runner");
21
- const _k8srunner = require("./runner/k8s.runner");
22
- function _define_property(obj, key, value) {
23
- if (key in obj) {
24
- Object.defineProperty(obj, key, {
25
- value: value,
26
- enumerable: true,
27
- configurable: true,
28
- writable: true
29
- });
30
- } else {
31
- obj[key] = value;
32
- }
33
- return obj;
34
- }
35
- const injectCommonProperties = (p, target = true)=>{
36
- const properties = [];
37
- if (target) {
38
- properties.push({
39
- displayName: "Batch",
40
- name: "batch",
41
- type: "boolean",
42
- default: false
43
- }, {
44
- displayName: "Target",
45
- name: "target",
46
- type: "string",
47
- default: "",
48
- displayOptions: {
49
- show: {
50
- batch: [
51
- false
52
- ]
53
- }
54
- }
55
- }, {
56
- displayName: "Targets",
57
- name: "targets",
58
- type: "json",
59
- default: "[]",
60
- displayOptions: {
61
- show: {
62
- batch: [
63
- true
64
- ]
65
- }
66
- }
67
- });
68
- }
69
- properties.push(...p);
70
- properties.push({
71
- displayName: "Advanced Config",
72
- name: "advanced",
73
- type: "fixedCollection",
74
- default: {},
75
- typeOptions: {
76
- multipleValues: true
77
- },
78
- options: [
79
- {
80
- name: "envs",
81
- displayName: "Envs",
82
- values: [
83
- {
84
- displayName: "Key",
85
- name: "key",
86
- type: "string",
87
- default: ""
88
- },
89
- {
90
- displayName: "Value",
91
- name: "value",
92
- type: "string",
93
- default: ""
94
- }
95
- ]
96
- },
97
- {
98
- name: "Files",
99
- displayName: "Files",
100
- values: [
101
- {
102
- displayName: "Name",
103
- name: "name",
104
- type: "string",
105
- default: ""
106
- },
107
- {
108
- displayName: "Content",
109
- name: "content",
110
- type: "string",
111
- default: ""
112
- }
113
- ]
114
- },
115
- {
116
- displayName: "Collect Files",
117
- name: "colllectFiles",
118
- values: [
119
- {
120
- displayName: "Name",
121
- name: "name",
122
- type: "string",
123
- default: ""
124
- }
125
- ]
126
- }
127
- ]
128
- });
129
- return properties;
130
- };
131
- class SoarExecutor {
132
- async getRunner(idx) {
133
- try {
134
- const dockerCredentials = await this.func.getCredentials("dockerCredentialsApi", idx);
135
- return new _dockerrunner.DockerRuneer(dockerCredentials, this.func);
136
- } catch (e) {
137
- //
138
- }
139
- try {
140
- const k8sCredentials = await this.func.getCredentials("kubernetesCredentialsApi", idx);
141
- return new _k8srunner.K8sRunner(k8sCredentials, this.func);
142
- } catch (e) {
143
- //
144
- }
145
- throw new _n8nworkflow.NodeOperationError(this.func.getNode(), "No credentials got returned!");
146
- }
147
- async run(idx, target, targetArg, { env = {}, files = {}, collectFiles = [], extraArgs = [], extraArgParameters = [], image } = {}) {
148
- const runner = await this.getRunner(idx);
149
- const cmdline = [
150
- "/usr/local/bin/runner"
151
- ];
152
- const _env = this.func.getNodeParameter("advanced.envs", idx, []);
153
- env = Object.assign({}, env, Object.fromEntries(_env.map(({ key, value })=>[
154
- key,
155
- value
156
- ])));
157
- const _files = this.func.getNodeParameter("advanced.files", idx, []);
158
- files = Object.assign({}, files, Object.fromEntries(_files.map(({ name, content })=>[
159
- name,
160
- content
161
- ])));
162
- const _collectFiles = this.func.getNodeParameter("advanced.collectFiles", idx, []);
163
- collectFiles = collectFiles.concat(_collectFiles.map(({ name })=>name));
164
- for (const [key, value] of Object.entries(files)){
165
- cmdline.push("--files", `${key}:${value}`);
166
- }
167
- for (const key of collectFiles){
168
- cmdline.push("--collect-files", key);
169
- }
170
- cmdline.push("--");
171
- const cmdd = [
172
- target,
173
- ...extraArgs
174
- ];
175
- if (targetArg) {
176
- let targets = [];
177
- if (this.func.getNodeParameter("batch", idx)) {
178
- targets = this.func.getNodeParameter("targets", idx, []);
179
- if (!Array.isArray(targets) || targets.every((t)=>typeof t !== "string")) {
180
- throw new _n8nworkflow.NodeOperationError(this.func.getNode(), "Invalid targets");
181
- }
182
- } else {
183
- targets = [
184
- this.func.getNodeParameter("target", idx, "")
185
- ];
186
- }
187
- cmdd.push(...targets.flatMap((target)=>[
188
- targetArg,
189
- target
190
- ]));
191
- }
192
- for (const parameter of extraArgParameters){
193
- const value = this.func.getNodeParameter(parameter, idx, null);
194
- if (!value) continue;
195
- if (typeof value === "string") {
196
- cmdd.push(parameter, value);
197
- } else if (Array.isArray(value)) {
198
- value.forEach((v)=>{
199
- if (typeof v === "string") {
200
- cmdd.push(v);
201
- } else {
202
- const { key, value } = v;
203
- if (value) {
204
- cmdd.push(key, value);
205
- } else {
206
- cmdd.push(key);
207
- }
208
- }
209
- });
210
- }
211
- }
212
- for (const cmd of cmdd){
213
- cmdline.push(cmd);
214
- }
215
- this.func.logger.debug("Running " + cmdline.join(" "));
216
- const { stdout, stderr, err, files: resultFiles } = await runner.run(cmdline, env, image);
217
- if (err) {
218
- throw new _n8nworkflow.NodeOperationError(this.func.getNode(), stderr);
219
- }
220
- if (stderr) {
221
- this.func.logger.warn(stderr);
222
- }
223
- this.func.logger.debug("Stdout: " + stdout);
224
- return {
225
- stdout,
226
- files: resultFiles
227
- };
228
- }
229
- constructor(func){
230
- _define_property(this, "func", void 0);
231
- this.func = func;
232
- }
233
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });