n8n-nodes-yourang 0.3.2 → 0.5.1
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/nodes/Yourang/Yourang.node.js +33 -8
- package/dist/nodes/Yourang/Yourang.node.js.map +1 -1
- package/dist/nodes/Yourang/YourangDescription.js +9 -0
- package/dist/nodes/Yourang/YourangDescription.js.map +1 -1
- package/dist/nodes/Yourang/descriptions/agent.description.d.ts +3 -0
- package/dist/nodes/Yourang/descriptions/agent.description.js +110 -0
- package/dist/nodes/Yourang/descriptions/agent.description.js.map +1 -0
- package/dist/nodes/Yourang/descriptions/agentTool.description.d.ts +3 -0
- package/dist/nodes/Yourang/descriptions/agentTool.description.js +467 -0
- package/dist/nodes/Yourang/descriptions/agentTool.description.js.map +1 -0
- package/dist/nodes/Yourang/descriptions/workflow.description.d.ts +3 -0
- package/dist/nodes/Yourang/descriptions/workflow.description.js +329 -0
- package/dist/nodes/Yourang/descriptions/workflow.description.js.map +1 -0
- package/dist/nodes/Yourang/resources/AgentHandler.d.ts +4 -0
- package/dist/nodes/Yourang/resources/AgentHandler.js +32 -0
- package/dist/nodes/Yourang/resources/AgentHandler.js.map +1 -0
- package/dist/nodes/Yourang/resources/AgentToolHandler.d.ts +6 -0
- package/dist/nodes/Yourang/resources/AgentToolHandler.js +114 -0
- package/dist/nodes/Yourang/resources/AgentToolHandler.js.map +1 -0
- package/dist/nodes/Yourang/resources/WorkflowHandler.d.ts +11 -0
- package/dist/nodes/Yourang/resources/WorkflowHandler.js +133 -0
- package/dist/nodes/Yourang/resources/WorkflowHandler.js.map +1 -0
- package/dist/package.json +17 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -6
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workflowFields = exports.workflowOperations = void 0;
|
|
4
|
+
exports.workflowOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['workflow'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Execute',
|
|
18
|
+
value: 'execute',
|
|
19
|
+
description: 'Execute a workflow',
|
|
20
|
+
action: 'Execute a workflow',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Get',
|
|
24
|
+
value: 'get',
|
|
25
|
+
description: 'Get workflow details',
|
|
26
|
+
action: 'Get workflow details',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Get Execution Details',
|
|
30
|
+
value: 'getExecutionDetails',
|
|
31
|
+
action: 'Get execution details',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Get Executions',
|
|
35
|
+
value: 'getExecutions',
|
|
36
|
+
description: 'List workflow executions',
|
|
37
|
+
action: 'List workflow executions',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Get Many',
|
|
41
|
+
value: 'getAll',
|
|
42
|
+
description: 'List many workflows',
|
|
43
|
+
action: 'List all workflows',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
default: 'getAll',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
exports.workflowFields = [
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Return All',
|
|
52
|
+
name: 'returnAll',
|
|
53
|
+
type: 'boolean',
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
resource: ['workflow'],
|
|
57
|
+
operation: ['getAll', 'getExecutions'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
default: false,
|
|
61
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Limit',
|
|
65
|
+
name: 'limit',
|
|
66
|
+
type: 'number',
|
|
67
|
+
displayOptions: {
|
|
68
|
+
show: {
|
|
69
|
+
resource: ['workflow'],
|
|
70
|
+
operation: ['getAll', 'getExecutions'],
|
|
71
|
+
returnAll: [false],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
typeOptions: {
|
|
75
|
+
minValue: 1,
|
|
76
|
+
},
|
|
77
|
+
default: 50,
|
|
78
|
+
description: 'Max number of results to return',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Filters',
|
|
82
|
+
name: 'filters',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Filter',
|
|
85
|
+
displayOptions: {
|
|
86
|
+
show: {
|
|
87
|
+
resource: ['workflow'],
|
|
88
|
+
operation: ['getAll'],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
default: {},
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Display Name',
|
|
95
|
+
name: 'display_name',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Filter by workflow display name (substring match)',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Is Enabled',
|
|
102
|
+
name: 'is_enabled',
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
default: true,
|
|
105
|
+
description: 'Whether to filter by enabled workflows only',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Sort',
|
|
109
|
+
name: 'sort',
|
|
110
|
+
type: 'options',
|
|
111
|
+
options: [
|
|
112
|
+
{
|
|
113
|
+
name: 'Created At (Ascending)',
|
|
114
|
+
value: 'created_at',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Created At (Descending)',
|
|
118
|
+
value: '-created_at',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'Display Name (Ascending)',
|
|
122
|
+
value: 'display_name',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'Display Name (Descending)',
|
|
126
|
+
value: '-display_name',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'Version (Ascending)',
|
|
130
|
+
value: 'version',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'Version (Descending)',
|
|
134
|
+
value: '-version',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
default: '-created_at',
|
|
138
|
+
description: 'Sort field and order',
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
displayName: 'Advanced Filter Query',
|
|
144
|
+
name: 'advancedFilter',
|
|
145
|
+
type: 'string',
|
|
146
|
+
displayOptions: {
|
|
147
|
+
show: {
|
|
148
|
+
resource: ['workflow'],
|
|
149
|
+
operation: ['getAll'],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
default: '',
|
|
153
|
+
placeholder: 'display_name:My Workflow&is_enabled:true',
|
|
154
|
+
description: 'Advanced filter query with AND (&) operators. Overrides simple filters if provided.',
|
|
155
|
+
hint: 'Format: field:value&field:value',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
displayName: 'Workflow ID',
|
|
159
|
+
name: 'workflowId',
|
|
160
|
+
type: 'string',
|
|
161
|
+
displayOptions: {
|
|
162
|
+
show: {
|
|
163
|
+
resource: ['workflow'],
|
|
164
|
+
operation: ['get', 'execute', 'getExecutions', 'getExecutionDetails'],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
default: '',
|
|
168
|
+
required: true,
|
|
169
|
+
description: 'The ID of the workflow',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
displayName: 'To Number',
|
|
173
|
+
name: 'to_number',
|
|
174
|
+
type: 'string',
|
|
175
|
+
displayOptions: {
|
|
176
|
+
show: {
|
|
177
|
+
resource: ['workflow'],
|
|
178
|
+
operation: ['execute'],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
default: '',
|
|
182
|
+
placeholder: '+393348470651',
|
|
183
|
+
description: 'Phone number to call',
|
|
184
|
+
required: true,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
displayName: 'Filters',
|
|
188
|
+
name: 'executionFilters',
|
|
189
|
+
type: 'collection',
|
|
190
|
+
placeholder: 'Add Filter',
|
|
191
|
+
displayOptions: {
|
|
192
|
+
show: {
|
|
193
|
+
resource: ['workflow'],
|
|
194
|
+
operation: ['getExecutions'],
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
default: {},
|
|
198
|
+
options: [
|
|
199
|
+
{
|
|
200
|
+
displayName: 'Offset',
|
|
201
|
+
name: 'offset',
|
|
202
|
+
type: 'number',
|
|
203
|
+
default: 0,
|
|
204
|
+
typeOptions: {
|
|
205
|
+
minValue: 0,
|
|
206
|
+
},
|
|
207
|
+
description: 'Number of executions to skip for pagination',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
displayName: 'Status',
|
|
211
|
+
name: 'status',
|
|
212
|
+
type: 'options',
|
|
213
|
+
options: [
|
|
214
|
+
{
|
|
215
|
+
name: 'Cancelled',
|
|
216
|
+
value: 'cancelled',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'Completed',
|
|
220
|
+
value: 'completed',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'Failed',
|
|
224
|
+
value: 'failed',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: 'Pending',
|
|
228
|
+
value: 'pending',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'Running',
|
|
232
|
+
value: 'running',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'Timed Out',
|
|
236
|
+
value: 'timed_out',
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
default: 'pending',
|
|
240
|
+
description: 'Filter by execution status',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
displayName: 'Type',
|
|
244
|
+
name: 'type',
|
|
245
|
+
type: 'options',
|
|
246
|
+
options: [
|
|
247
|
+
{
|
|
248
|
+
name: 'API',
|
|
249
|
+
value: 'api',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'Campaign',
|
|
253
|
+
value: 'campaign',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'Manual',
|
|
257
|
+
value: 'manual',
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: 'Scheduled',
|
|
261
|
+
value: 'scheduled',
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: 'Triggered',
|
|
265
|
+
value: 'triggered',
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
default: 'api',
|
|
269
|
+
description: 'Filter by execution type',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
displayName: 'Sort',
|
|
273
|
+
name: 'sort',
|
|
274
|
+
type: 'options',
|
|
275
|
+
options: [
|
|
276
|
+
{
|
|
277
|
+
name: 'Completed At (Ascending)',
|
|
278
|
+
value: 'completed_at',
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: 'Completed At (Descending)',
|
|
282
|
+
value: '-completed_at',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'Created At (Ascending)',
|
|
286
|
+
value: 'created_at',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'Created At (Descending)',
|
|
290
|
+
value: '-created_at',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
name: 'Started At (Ascending)',
|
|
294
|
+
value: 'started_at',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: 'Started At (Descending)',
|
|
298
|
+
value: '-started_at',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: 'Status (Ascending)',
|
|
302
|
+
value: 'status',
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: 'Status (Descending)',
|
|
306
|
+
value: '-status',
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
default: '-created_at',
|
|
310
|
+
description: 'Sort field and order',
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
displayName: 'Execution ID',
|
|
316
|
+
name: 'executionId',
|
|
317
|
+
type: 'string',
|
|
318
|
+
displayOptions: {
|
|
319
|
+
show: {
|
|
320
|
+
resource: ['workflow'],
|
|
321
|
+
operation: ['getExecutionDetails'],
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
default: '',
|
|
325
|
+
required: true,
|
|
326
|
+
description: 'The ID of the execution',
|
|
327
|
+
},
|
|
328
|
+
];
|
|
329
|
+
//# sourceMappingURL=workflow.description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.description.js","sourceRoot":"","sources":["../../../../nodes/Yourang/descriptions/workflow.description.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAsB;IACpD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;aACtB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,oBAAoB;gBACjC,MAAM,EAAE,oBAAoB;aAC5B;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,sBAAsB;gBACnC,MAAM,EAAE,sBAAsB;aAC9B;YACD;gBACC,IAAI,EAAE,uBAAuB;gBAC7B,KAAK,EAAE,qBAAqB;gBAC5B,MAAM,EAAE,uBAAuB;aAC/B;YACD;gBACC,IAAI,EAAE,gBAAgB;gBACtB,KAAK,EAAE,eAAe;gB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,qBAAqB;wBAC3B,KAAK,EAAE,SAAS;qBAChB;iBACD;gBACD,OAAO,EAAE,aAAa;gBACtB,WAAW,EAAE,sBAAsB;aACnC;SACD;KACD;IAKD;QACC,WAAW,EAAE,cAAc;QAC3B,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,qBAAqB,CAAC;aAClC;SACD;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,yBAAyB;KACtC;CACD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentHandler = void 0;
|
|
4
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
5
|
+
class AgentHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
6
|
+
async execute(operation, itemIndex) {
|
|
7
|
+
if (operation === 'getAll') {
|
|
8
|
+
const filters = this.getParameter('filters', itemIndex, {});
|
|
9
|
+
const agentType = filters.agent_type;
|
|
10
|
+
const { limit, returnAll } = this.getPaginationParams(itemIndex);
|
|
11
|
+
const qs = this.buildQueryParams({
|
|
12
|
+
agent_type: agentType,
|
|
13
|
+
limit: returnAll ? undefined : limit,
|
|
14
|
+
});
|
|
15
|
+
return await this.httpRequest({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `${this.baseUrl}/agents`,
|
|
18
|
+
qs,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
else if (operation === 'get') {
|
|
22
|
+
const agentId = this.getParameter('agentId', itemIndex);
|
|
23
|
+
return await this.httpRequest({
|
|
24
|
+
method: 'GET',
|
|
25
|
+
url: `${this.baseUrl}/agents/${agentId}`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.AgentHandler = AgentHandler;
|
|
32
|
+
//# sourceMappingURL=AgentHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentHandler.js","sourceRoot":"","sources":["../../../../nodes/Yourang/resources/AgentHandler.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAE5D,MAAa,YAAa,SAAQ,yCAAmB;IACpD,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,SAAiB;QACjD,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAc,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YACzE,MAAM,SAAS,GAAG,OAAO,CAAC,UAAoB,CAAC;YAE/C,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAEjE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC;gBAChC,UAAU,EAAE,SAAS;gBACrB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;aACpC,CAAC,CAAC;YAEH,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC;gBAC7B,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,SAAS;gBAC7B,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;aAAM,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAS,SAAS,EAAE,SAAS,CAAC,CAAC;YAEhE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC;gBAC7B,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,WAAW,OAAO,EAAE;aACxC,CAAC,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IACpD,CAAC;CACD;AA7BD,oCA6BC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentToolHandler = void 0;
|
|
4
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
5
|
+
class AgentToolHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
6
|
+
async execute(operation, itemIndex) {
|
|
7
|
+
if (operation === 'getAll') {
|
|
8
|
+
const agentId = this.getParameter('agentId', itemIndex);
|
|
9
|
+
return await this.httpRequest({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
url: `${this.baseUrl}/agents/${agentId}/tools`,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
else if (operation === 'get') {
|
|
15
|
+
const agentId = this.getParameter('agentId', itemIndex);
|
|
16
|
+
const toolName = this.getParameter('toolName', itemIndex);
|
|
17
|
+
return await this.httpRequest({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
url: `${this.baseUrl}/agents/${agentId}/tools/${toolName}`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else if (operation === 'update') {
|
|
23
|
+
const agentId = this.getParameter('agentId', itemIndex);
|
|
24
|
+
const toolName = this.getParameter('toolName', itemIndex);
|
|
25
|
+
const toolFieldsMap = {
|
|
26
|
+
'make-reservation': [
|
|
27
|
+
{ param: 'is_enabled' },
|
|
28
|
+
{ param: 'send_sms' },
|
|
29
|
+
{ param: 'allow_overlapping_reservations' },
|
|
30
|
+
{ param: 'include_guests' },
|
|
31
|
+
{ param: 'sms_text' },
|
|
32
|
+
{ param: 'reservation_duration_minutes' },
|
|
33
|
+
{ param: 'reservation_hours' },
|
|
34
|
+
{ param: 'default_checkin_time' },
|
|
35
|
+
{ param: 'default_checkout_time' },
|
|
36
|
+
],
|
|
37
|
+
'transfer-to-operator': [
|
|
38
|
+
{ param: 'is_enabled' },
|
|
39
|
+
{ param: 'available_hours' },
|
|
40
|
+
{ param: 'enabled_departments' },
|
|
41
|
+
],
|
|
42
|
+
'transfer-to-phone': [
|
|
43
|
+
{ param: 'is_enabled' },
|
|
44
|
+
{ param: 'phone_destinations' },
|
|
45
|
+
{ param: 'transfer_message' },
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
const fields = toolFieldsMap[toolName] || [{ param: 'is_enabled' }];
|
|
49
|
+
const body = this.buildBody(fields, itemIndex);
|
|
50
|
+
if (toolName === 'make-reservation') {
|
|
51
|
+
const scheduleUi = this.getParameter('reservation_hours_ui', itemIndex, {});
|
|
52
|
+
if (scheduleUi.scheduleValues) {
|
|
53
|
+
body.reservation_hours = this.transformSchedule(scheduleUi.scheduleValues);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (toolName === 'transfer-to-operator') {
|
|
57
|
+
const scheduleUi = this.getParameter('available_hours_ui', itemIndex, {});
|
|
58
|
+
if (scheduleUi.scheduleValues) {
|
|
59
|
+
body.available_hours = this.transformSchedule(scheduleUi.scheduleValues);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (toolName === 'transfer-to-phone') {
|
|
63
|
+
const destinationsUi = this.getParameter('phone_destinations_ui', itemIndex, {});
|
|
64
|
+
if (destinationsUi.destinationValues) {
|
|
65
|
+
body.phone_destinations = this.transformDestinations(destinationsUi.destinationValues);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return await this.httpRequest({
|
|
69
|
+
method: 'PATCH',
|
|
70
|
+
url: `${this.baseUrl}/agents/${agentId}/tools/${toolName}`,
|
|
71
|
+
body,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
75
|
+
}
|
|
76
|
+
transformSchedule(scheduleItems) {
|
|
77
|
+
const result = {};
|
|
78
|
+
for (const item of scheduleItems) {
|
|
79
|
+
if (item.day) {
|
|
80
|
+
const day = item.day;
|
|
81
|
+
const mode = item.mode || 'hours';
|
|
82
|
+
if (mode === 'open') {
|
|
83
|
+
result[day] = ['00:00 - 23:59'];
|
|
84
|
+
}
|
|
85
|
+
else if (mode === 'closed') {
|
|
86
|
+
result[day] = [];
|
|
87
|
+
}
|
|
88
|
+
else if (mode === 'hours' && item.ranges) {
|
|
89
|
+
const ranges = item.ranges
|
|
90
|
+
.split(',')
|
|
91
|
+
.map((r) => r.trim())
|
|
92
|
+
.filter((r) => r.length > 0);
|
|
93
|
+
result[day] = ranges;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
transformDestinations(destinationItems) {
|
|
100
|
+
return destinationItems.map((item) => {
|
|
101
|
+
const destination = {
|
|
102
|
+
name: item.name,
|
|
103
|
+
phone_number: item.phone_number,
|
|
104
|
+
description: item.description,
|
|
105
|
+
};
|
|
106
|
+
if (item.available_hours_ui && item.available_hours_ui.scheduleValues) {
|
|
107
|
+
destination.available_hours = this.transformSchedule(item.available_hours_ui.scheduleValues);
|
|
108
|
+
}
|
|
109
|
+
return destination;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.AgentToolHandler = AgentToolHandler;
|
|
114
|
+
//# sourceMappingURL=AgentToolHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentToolHandler.js","sourceRoot":"","sources":["../../../../nodes/Yourang/resources/AgentToolHandler.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAE5D,MAAa,gBAAiB,SAAQ,yCAAmB;IACxD,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,SAAiB;QACjD,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAS,SAAS,EAAE,SAAS,CAAC,CAAC;YAEhE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC;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uB;QACpD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACpC,MAAM,WAAW,GAAQ;gBACxB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;aAC7B,CAAC;YAEF,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC;gBACvE,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAiB,CACnD,IAAI,CAAC,kBAAkB,CAAC,cAAuB,CAC/C,CAAC;YACH,CAAC;YAED,OAAO,WAAW,CAAC;QACpB,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAtID,4CAsIC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseResourceHandler } from './BaseResourceHandler';
|
|
2
|
+
export declare class WorkflowHandler extends BaseResourceHandler {
|
|
3
|
+
execute(operation: string, itemIndex: number): Promise<any>;
|
|
4
|
+
private getAll;
|
|
5
|
+
private get;
|
|
6
|
+
private executeWorkflow;
|
|
7
|
+
private getExecutions;
|
|
8
|
+
private getExecutionDetails;
|
|
9
|
+
private buildWorkflowFilters;
|
|
10
|
+
private buildExecutionFilter;
|
|
11
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowHandler = void 0;
|
|
4
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
5
|
+
class WorkflowHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
6
|
+
async execute(operation, itemIndex) {
|
|
7
|
+
switch (operation) {
|
|
8
|
+
case 'getAll':
|
|
9
|
+
return this.getAll(itemIndex);
|
|
10
|
+
case 'get':
|
|
11
|
+
return this.get(itemIndex);
|
|
12
|
+
case 'execute':
|
|
13
|
+
return this.executeWorkflow(itemIndex);
|
|
14
|
+
case 'getExecutions':
|
|
15
|
+
return this.getExecutions(itemIndex);
|
|
16
|
+
case 'getExecutionDetails':
|
|
17
|
+
return this.getExecutionDetails(itemIndex);
|
|
18
|
+
default:
|
|
19
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async getAll(itemIndex) {
|
|
23
|
+
const { limit } = this.getPaginationParams(itemIndex);
|
|
24
|
+
const filters = this.getParameter('filters', itemIndex, {});
|
|
25
|
+
const advancedFilter = this.getParameter('advancedFilter', itemIndex, '');
|
|
26
|
+
const qs = this.buildWorkflowFilters(filters, advancedFilter, limit);
|
|
27
|
+
return this.httpRequest({
|
|
28
|
+
method: 'GET',
|
|
29
|
+
url: `${this.baseUrl}/workflows/`,
|
|
30
|
+
qs,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async get(itemIndex) {
|
|
34
|
+
const workflowId = this.getParameter('workflowId', itemIndex);
|
|
35
|
+
if (!workflowId || !workflowId.trim()) {
|
|
36
|
+
throw new Error('Workflow ID is required');
|
|
37
|
+
}
|
|
38
|
+
return this.httpRequest({
|
|
39
|
+
method: 'GET',
|
|
40
|
+
url: `${this.baseUrl}/workflows/${workflowId}`,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async executeWorkflow(itemIndex) {
|
|
44
|
+
const workflowId = this.getParameter('workflowId', itemIndex);
|
|
45
|
+
const toNumber = this.getParameter('to_number', itemIndex);
|
|
46
|
+
if (!workflowId || !workflowId.trim()) {
|
|
47
|
+
throw new Error('Workflow ID is required');
|
|
48
|
+
}
|
|
49
|
+
if (!toNumber || !toNumber.trim()) {
|
|
50
|
+
throw new Error('To Number is required');
|
|
51
|
+
}
|
|
52
|
+
const body = {
|
|
53
|
+
to_number: toNumber,
|
|
54
|
+
};
|
|
55
|
+
return this.httpRequest({
|
|
56
|
+
method: 'POST',
|
|
57
|
+
url: `${this.baseUrl}/workflows/${workflowId}/execute`,
|
|
58
|
+
body,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async getExecutions(itemIndex) {
|
|
62
|
+
const workflowId = this.getParameter('workflowId', itemIndex);
|
|
63
|
+
const { limit } = this.getPaginationParams(itemIndex);
|
|
64
|
+
const filters = this.getParameter('executionFilters', itemIndex, {});
|
|
65
|
+
if (!workflowId || !workflowId.trim()) {
|
|
66
|
+
throw new Error('Workflow ID is required');
|
|
67
|
+
}
|
|
68
|
+
const qs = this.buildQueryParams({
|
|
69
|
+
limit,
|
|
70
|
+
offset: filters.offset,
|
|
71
|
+
sort: filters.sort,
|
|
72
|
+
filter: this.buildExecutionFilter(filters),
|
|
73
|
+
});
|
|
74
|
+
return this.httpRequest({
|
|
75
|
+
method: 'GET',
|
|
76
|
+
url: `${this.baseUrl}/workflows/${workflowId}/executions`,
|
|
77
|
+
qs,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async getExecutionDetails(itemIndex) {
|
|
81
|
+
const workflowId = this.getParameter('workflowId', itemIndex);
|
|
82
|
+
const executionId = this.getParameter('executionId', itemIndex);
|
|
83
|
+
if (!workflowId || !workflowId.trim()) {
|
|
84
|
+
throw new Error('Workflow ID is required');
|
|
85
|
+
}
|
|
86
|
+
if (!executionId || !executionId.trim()) {
|
|
87
|
+
throw new Error('Execution ID is required');
|
|
88
|
+
}
|
|
89
|
+
return this.httpRequest({
|
|
90
|
+
method: 'GET',
|
|
91
|
+
url: `${this.baseUrl}/workflows/${workflowId}/executions/${executionId}`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
buildWorkflowFilters(filters, advancedFilter, limit) {
|
|
95
|
+
const qs = {};
|
|
96
|
+
if (limit) {
|
|
97
|
+
qs.limit = limit;
|
|
98
|
+
}
|
|
99
|
+
if (advancedFilter && advancedFilter.trim()) {
|
|
100
|
+
qs.filter = advancedFilter.trim();
|
|
101
|
+
if (filters.sort) {
|
|
102
|
+
qs.sort = filters.sort;
|
|
103
|
+
}
|
|
104
|
+
return qs;
|
|
105
|
+
}
|
|
106
|
+
const filterArray = [];
|
|
107
|
+
if (filters.display_name) {
|
|
108
|
+
filterArray.push(`display_name:${filters.display_name}`);
|
|
109
|
+
}
|
|
110
|
+
if (filters.is_enabled !== undefined && filters.is_enabled !== null && filters.is_enabled !== '') {
|
|
111
|
+
filterArray.push(`is_enabled:${filters.is_enabled}`);
|
|
112
|
+
}
|
|
113
|
+
if (filterArray.length > 0) {
|
|
114
|
+
qs.filter = filterArray.join('&');
|
|
115
|
+
}
|
|
116
|
+
if (filters.sort) {
|
|
117
|
+
qs.sort = filters.sort;
|
|
118
|
+
}
|
|
119
|
+
return qs;
|
|
120
|
+
}
|
|
121
|
+
buildExecutionFilter(filters) {
|
|
122
|
+
const filterArray = [];
|
|
123
|
+
if (filters.status) {
|
|
124
|
+
filterArray.push(`status:${filters.status}`);
|
|
125
|
+
}
|
|
126
|
+
if (filters.type) {
|
|
127
|
+
filterArray.push(`type:${filters.type}`);
|
|
128
|
+
}
|
|
129
|
+
return filterArray.length > 0 ? filterArray.join('&') : '';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.WorkflowHandler = WorkflowHandler;
|
|
133
|
+
//# sourceMappingURL=WorkflowHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowHandler.js","sourceRoot":"","sources":["../../../../nodes/Yourang/resources/WorkflowHandler.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAE5D,MAAa,eAAgB,SAAQ,yCAAmB;IACvD,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,SAAiB;QACjD,QAAQ,SAAS,EAAE,CAAC;YACnB,KAAK,QAAQ;gBACZ,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC/B,KAAK,KAAK;gBACT,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC5B,KAAK,SAAS;gBACb,OAAO,IAAI,CAAC,eA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