n8n-nodes-doppelganger 0.1.0 → 0.1.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.
@@ -5,14 +5,14 @@ const n8n_workflow_1 = require("n8n-workflow");
5
5
  class Doppelganger {
6
6
  constructor() {
7
7
  this.description = {
8
- displayName: 'doppelganger',
8
+ displayName: 'Doppelganger',
9
9
  name: 'doppelganger',
10
10
  icon: 'file:icon.png',
11
11
  group: ['transform'],
12
12
  version: 1,
13
13
  description: 'Run a Doppelganger task via the API',
14
14
  defaults: {
15
- name: 'doppelganger',
15
+ name: 'Doppelganger',
16
16
  },
17
17
  inputs: ['main'],
18
18
  outputs: ['main'],
@@ -23,6 +23,21 @@ class Doppelganger {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Execute Task',
34
+ value: 'executeTask',
35
+ description: 'Run a Doppelganger task',
36
+ action: 'Execute a task',
37
+ },
38
+ ],
39
+ default: 'executeTask',
40
+ },
26
41
  {
27
42
  displayName: 'Task ID',
28
43
  name: 'taskId',
@@ -32,36 +47,61 @@ class Doppelganger {
32
47
  description: 'Task ID from the Doppelganger dashboard',
33
48
  },
34
49
  {
35
- displayName: 'Variables (JSON)',
50
+ displayName: 'Variables',
36
51
  name: 'variables',
37
- type: 'json',
38
- default: '{}',
52
+ type: 'fixedCollection',
53
+ default: {},
39
54
  required: false,
40
- description: 'JSON object to override task variables',
55
+ description: 'Optional task variables to override',
56
+ typeOptions: {
57
+ multipleValues: true,
58
+ },
59
+ options: [
60
+ {
61
+ name: 'values',
62
+ displayName: 'Variable',
63
+ values: [
64
+ {
65
+ displayName: 'Name',
66
+ name: 'name',
67
+ type: 'string',
68
+ default: '',
69
+ required: true,
70
+ },
71
+ {
72
+ displayName: 'Value',
73
+ name: 'value',
74
+ type: 'string',
75
+ default: '',
76
+ },
77
+ ],
78
+ },
79
+ ],
41
80
  },
42
81
  ],
43
82
  };
44
83
  }
45
84
  async execute() {
85
+ var _a, _b;
46
86
  const items = this.getInputData();
47
87
  const returnData = [];
48
88
  for (let i = 0; i < items.length; i++) {
89
+ const operation = this.getNodeParameter('operation', i);
90
+ if (operation !== 'executeTask') {
91
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Unsupported operation.', {
92
+ itemIndex: i,
93
+ });
94
+ }
49
95
  const taskId = this.getNodeParameter('taskId', i);
50
96
  const variablesRaw = this.getNodeParameter('variables', i);
51
- let variables = {};
52
- if (variablesRaw) {
53
- if (typeof variablesRaw === 'string') {
54
- try {
55
- variables = JSON.parse(variablesRaw);
56
- }
57
- catch (error) {
58
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Variables must be valid JSON.', {
59
- itemIndex: i,
60
- });
97
+ const variables = {};
98
+ if ((_a = variablesRaw === null || variablesRaw === void 0 ? void 0 : variablesRaw.values) === null || _a === void 0 ? void 0 : _a.length) {
99
+ for (const entry of variablesRaw.values) {
100
+ const key = (entry.name || '').trim();
101
+ if (!key) {
102
+ continue;
61
103
  }
62
- }
63
- else {
64
- variables = variablesRaw;
104
+ variables[key] = (_b = entry.value) !== null && _b !== void 0 ? _b : '';
65
105
  }
66
106
  }
67
107
  const credentials = await this.getCredentials('doppelgangerApi');
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-doppelganger",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "n8n node for running Doppelganger tasks",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [