n8n-nodes-hudu 1.6.4 → 1.6.6
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/Hudu/descriptions/magic_dash.description.ts +308 -308
- package/dist/nodes/Hudu/resources/activity_logs/activity_logs.handler.js +28 -8
- package/dist/nodes/Hudu/resources/activity_logs/activity_logs.handler.js.map +1 -1
- package/dist/nodes/Hudu/resources/activity_logs/activity_logs.handler.ts +54 -25
- package/dist/nodes/Hudu/resources/assets/assets.handler.js +21 -12
- package/dist/nodes/Hudu/resources/assets/assets.handler.js.map +1 -1
- package/dist/nodes/Hudu/resources/assets/assets.handler.ts +32 -15
- package/dist/nodes/Hudu/resources/magic_dash/magic_dash.handler.ts +100 -100
- package/dist/nodes/Hudu/utils/constants.js +9 -1
- package/dist/nodes/Hudu/utils/constants.js.map +1 -1
- package/dist/nodes/Hudu/utils/constants.ts +15 -0
- package/dist/nodes/Hudu/utils/operations/magic_dash.ts +68 -68
- package/dist/nodes/Hudu/utils/requestUtils.js +48 -33
- package/dist/nodes/Hudu/utils/requestUtils.js.map +1 -1
- package/dist/nodes/Hudu/utils/requestUtils.ts +74 -50
- package/package.json +1 -1
|
@@ -1,308 +1,308 @@
|
|
|
1
|
-
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import { HUDU_API_CONSTANTS } from '../utils/constants';
|
|
3
|
-
|
|
4
|
-
export const magicDashOperations: INodeProperties[] = [
|
|
5
|
-
{
|
|
6
|
-
displayName: 'Operation',
|
|
7
|
-
name: 'operation',
|
|
8
|
-
type: 'options',
|
|
9
|
-
noDataExpression: true,
|
|
10
|
-
displayOptions: {
|
|
11
|
-
show: {
|
|
12
|
-
resource: ['magic_dash'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
options: [
|
|
16
|
-
{
|
|
17
|
-
name: 'Create or Update',
|
|
18
|
-
value: 'createOrUpdate',
|
|
19
|
-
description: 'Create or update item',
|
|
20
|
-
action: 'Create or update item',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'Delete',
|
|
24
|
-
value: 'deleteById',
|
|
25
|
-
description: 'Delete item',
|
|
26
|
-
action: 'Delete item',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'Delete by Title',
|
|
30
|
-
value: 'deleteByTitle',
|
|
31
|
-
description: 'Delete item by title and company name',
|
|
32
|
-
action: 'Delete item by title',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'Get',
|
|
36
|
-
value: 'get',
|
|
37
|
-
description: 'Get item',
|
|
38
|
-
action: 'Get item',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: 'Get Many',
|
|
42
|
-
value: 'getAll',
|
|
43
|
-
description: 'Get many items',
|
|
44
|
-
action: 'Get many items',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
default: 'getAll',
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
export const magicDashFields: INodeProperties[] = [
|
|
52
|
-
// ----------------------------------
|
|
53
|
-
// getAll
|
|
54
|
-
// ----------------------------------
|
|
55
|
-
{
|
|
56
|
-
displayName: 'Return All',
|
|
57
|
-
name: 'returnAll',
|
|
58
|
-
type: 'boolean',
|
|
59
|
-
displayOptions: {
|
|
60
|
-
show: {
|
|
61
|
-
resource: ['magic_dash'],
|
|
62
|
-
operation: ['getAll'],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
default: false,
|
|
66
|
-
description: 'Whether to return all results or only up to a given limit',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
displayName: 'Limit',
|
|
70
|
-
name: 'limit',
|
|
71
|
-
type: 'number',
|
|
72
|
-
displayOptions: {
|
|
73
|
-
show: {
|
|
74
|
-
resource: ['magic_dash'],
|
|
75
|
-
operation: ['getAll'],
|
|
76
|
-
returnAll: [false],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
typeOptions: {
|
|
80
|
-
minValue: 1,
|
|
81
|
-
},
|
|
82
|
-
default: HUDU_API_CONSTANTS.PAGE_SIZE,
|
|
83
|
-
description: 'Max number of results to return',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
displayName: 'Filters',
|
|
87
|
-
name: 'filters',
|
|
88
|
-
type: 'collection',
|
|
89
|
-
placeholder: 'Add Filter',
|
|
90
|
-
default: {},
|
|
91
|
-
displayOptions: {
|
|
92
|
-
show: {
|
|
93
|
-
resource: ['magic_dash'],
|
|
94
|
-
operation: ['getAll'],
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
options: [
|
|
98
|
-
{
|
|
99
|
-
displayName: 'Company Name or ID',
|
|
100
|
-
name: 'company_id',
|
|
101
|
-
type: 'options',
|
|
102
|
-
typeOptions: {
|
|
103
|
-
loadOptionsMethod: 'getCompanies',
|
|
104
|
-
loadOptionsParameters: {
|
|
105
|
-
includeBlank: true,
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
default: '',
|
|
109
|
-
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
displayName: 'Title',
|
|
113
|
-
name: 'title',
|
|
114
|
-
type: 'string',
|
|
115
|
-
default: '',
|
|
116
|
-
description: 'Filter by title',
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
// ----------------------------------
|
|
122
|
-
// createOrUpdate
|
|
123
|
-
// ----------------------------------
|
|
124
|
-
{
|
|
125
|
-
displayName: 'Message',
|
|
126
|
-
name: 'message',
|
|
127
|
-
type: 'string',
|
|
128
|
-
required: true,
|
|
129
|
-
displayOptions: {
|
|
130
|
-
show: {
|
|
131
|
-
resource: ['magic_dash'],
|
|
132
|
-
operation: ['createOrUpdate'],
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
default: '',
|
|
136
|
-
description: 'The primary content to be displayed on the Magic Dash Item',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
displayName: 'Company Name',
|
|
140
|
-
name: 'companyName',
|
|
141
|
-
type: 'string',
|
|
142
|
-
required: true,
|
|
143
|
-
displayOptions: {
|
|
144
|
-
show: {
|
|
145
|
-
resource: ['magic_dash'],
|
|
146
|
-
operation: ['createOrUpdate'],
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
default: '',
|
|
150
|
-
description: 'The company name attribute used to match an existing company',
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
displayName: 'Title',
|
|
154
|
-
name: 'title',
|
|
155
|
-
type: 'string',
|
|
156
|
-
required: true,
|
|
157
|
-
displayOptions: {
|
|
158
|
-
show: {
|
|
159
|
-
resource: ['magic_dash'],
|
|
160
|
-
operation: ['createOrUpdate'],
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
default: '',
|
|
164
|
-
description:
|
|
165
|
-
'The title attribute, used for matching existing Magic Dash Items with the same title and company name',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
displayName: 'Content',
|
|
169
|
-
name: 'content',
|
|
170
|
-
type: 'string',
|
|
171
|
-
typeOptions: {
|
|
172
|
-
rows: 4,
|
|
173
|
-
},
|
|
174
|
-
displayOptions: {
|
|
175
|
-
show: {
|
|
176
|
-
resource: ['magic_dash'],
|
|
177
|
-
operation: ['createOrUpdate'],
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
default: '',
|
|
181
|
-
description:
|
|
182
|
-
'HTML content (tables, images, videos, etc.) to be displayed in the Magic Dash Item',
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
displayName: 'Additional Fields',
|
|
186
|
-
name: 'additionalFields',
|
|
187
|
-
type: 'collection',
|
|
188
|
-
placeholder: 'Add Field',
|
|
189
|
-
default: {},
|
|
190
|
-
displayOptions: {
|
|
191
|
-
show: {
|
|
192
|
-
resource: ['magic_dash'],
|
|
193
|
-
operation: ['createOrUpdate'],
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
options: [
|
|
197
|
-
{
|
|
198
|
-
displayName: 'Company Name or ID',
|
|
199
|
-
name: 'company_id',
|
|
200
|
-
type: 'options',
|
|
201
|
-
typeOptions: {
|
|
202
|
-
loadOptionsMethod: 'getCompanies',
|
|
203
|
-
loadOptionsParameters: {
|
|
204
|
-
includeBlank: true,
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
default: '',
|
|
208
|
-
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
displayName: 'Content Link',
|
|
212
|
-
name: 'content_link',
|
|
213
|
-
type: 'string',
|
|
214
|
-
default: '',
|
|
215
|
-
description: "A link to an external website associated with the Magic Dash Item's content",
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
displayName: 'Icon',
|
|
219
|
-
name: 'icon',
|
|
220
|
-
type: 'string',
|
|
221
|
-
default: '',
|
|
222
|
-
description: 'Font Awesome icon code (e.g. fa-home). Search for icons at <a href="https://fontawesome.com/search">Font Awesome</a>.',
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
displayName: 'Image URL',
|
|
226
|
-
name: 'image_url',
|
|
227
|
-
type: 'string',
|
|
228
|
-
default: '',
|
|
229
|
-
description: 'A URL for an image to be used in the header of the Magic Dash Item',
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
displayName: 'Shade',
|
|
233
|
-
name: 'shade',
|
|
234
|
-
type: 'color',
|
|
235
|
-
default: '',
|
|
236
|
-
//description: 'An optional color for the Magic Dash Item to represent different contextual states (e.g., success, danger)',
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
// ----------------------------------
|
|
242
|
-
// deleteById
|
|
243
|
-
// ----------------------------------
|
|
244
|
-
{
|
|
245
|
-
displayName: 'ID',
|
|
246
|
-
name: 'id',
|
|
247
|
-
type: 'number',
|
|
248
|
-
displayOptions: {
|
|
249
|
-
show: {
|
|
250
|
-
resource: ['magic_dash'],
|
|
251
|
-
operation: ['deleteById'],
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
default: 0,
|
|
255
|
-
required: true,
|
|
256
|
-
description: 'The ID of the Magic Dash item to delete',
|
|
257
|
-
},
|
|
258
|
-
|
|
259
|
-
// ----------------------------------
|
|
260
|
-
// deleteByTitle
|
|
261
|
-
// ----------------------------------
|
|
262
|
-
{
|
|
263
|
-
displayName: 'Title',
|
|
264
|
-
name: 'title',
|
|
265
|
-
type: 'string',
|
|
266
|
-
required: true,
|
|
267
|
-
displayOptions: {
|
|
268
|
-
show: {
|
|
269
|
-
resource: ['magic_dash'],
|
|
270
|
-
operation: ['deleteByTitle'],
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
default: '',
|
|
274
|
-
description: 'The title of the Magic Dash item to delete',
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
displayName: 'Company Name',
|
|
278
|
-
name: 'companyName',
|
|
279
|
-
type: 'string',
|
|
280
|
-
required: true,
|
|
281
|
-
displayOptions: {
|
|
282
|
-
show: {
|
|
283
|
-
resource: ['magic_dash'],
|
|
284
|
-
operation: ['deleteByTitle'],
|
|
285
|
-
},
|
|
286
|
-
},
|
|
287
|
-
default: '',
|
|
288
|
-
description: 'The company name for the Magic Dash item to delete',
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
// ----------------------------------
|
|
292
|
-
// get
|
|
293
|
-
// ----------------------------------
|
|
294
|
-
{
|
|
295
|
-
displayName: 'ID',
|
|
296
|
-
name: 'id',
|
|
297
|
-
type: 'number',
|
|
298
|
-
displayOptions: {
|
|
299
|
-
show: {
|
|
300
|
-
resource: ['magic_dash'],
|
|
301
|
-
operation: ['get'],
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
default: 0,
|
|
305
|
-
required: true,
|
|
306
|
-
description: 'The ID of the Magic Dash item to get',
|
|
307
|
-
},
|
|
308
|
-
];
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { HUDU_API_CONSTANTS } from '../utils/constants';
|
|
3
|
+
|
|
4
|
+
export const magicDashOperations: INodeProperties[] = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['magic_dash'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Create or Update',
|
|
18
|
+
value: 'createOrUpdate',
|
|
19
|
+
description: 'Create or update item',
|
|
20
|
+
action: 'Create or update item',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Delete',
|
|
24
|
+
value: 'deleteById',
|
|
25
|
+
description: 'Delete item',
|
|
26
|
+
action: 'Delete item',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Delete by Title',
|
|
30
|
+
value: 'deleteByTitle',
|
|
31
|
+
description: 'Delete item by title and company name',
|
|
32
|
+
action: 'Delete item by title',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Get',
|
|
36
|
+
value: 'get',
|
|
37
|
+
description: 'Get item',
|
|
38
|
+
action: 'Get item',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Get Many',
|
|
42
|
+
value: 'getAll',
|
|
43
|
+
description: 'Get many items',
|
|
44
|
+
action: 'Get many items',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
default: 'getAll',
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export const magicDashFields: INodeProperties[] = [
|
|
52
|
+
// ----------------------------------
|
|
53
|
+
// getAll
|
|
54
|
+
// ----------------------------------
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Return All',
|
|
57
|
+
name: 'returnAll',
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
displayOptions: {
|
|
60
|
+
show: {
|
|
61
|
+
resource: ['magic_dash'],
|
|
62
|
+
operation: ['getAll'],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
default: false,
|
|
66
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Limit',
|
|
70
|
+
name: 'limit',
|
|
71
|
+
type: 'number',
|
|
72
|
+
displayOptions: {
|
|
73
|
+
show: {
|
|
74
|
+
resource: ['magic_dash'],
|
|
75
|
+
operation: ['getAll'],
|
|
76
|
+
returnAll: [false],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
typeOptions: {
|
|
80
|
+
minValue: 1,
|
|
81
|
+
},
|
|
82
|
+
default: HUDU_API_CONSTANTS.PAGE_SIZE,
|
|
83
|
+
description: 'Max number of results to return',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
displayName: 'Filters',
|
|
87
|
+
name: 'filters',
|
|
88
|
+
type: 'collection',
|
|
89
|
+
placeholder: 'Add Filter',
|
|
90
|
+
default: {},
|
|
91
|
+
displayOptions: {
|
|
92
|
+
show: {
|
|
93
|
+
resource: ['magic_dash'],
|
|
94
|
+
operation: ['getAll'],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
options: [
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Company Name or ID',
|
|
100
|
+
name: 'company_id',
|
|
101
|
+
type: 'options',
|
|
102
|
+
typeOptions: {
|
|
103
|
+
loadOptionsMethod: 'getCompanies',
|
|
104
|
+
loadOptionsParameters: {
|
|
105
|
+
includeBlank: true,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
default: '',
|
|
109
|
+
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
displayName: 'Title',
|
|
113
|
+
name: 'title',
|
|
114
|
+
type: 'string',
|
|
115
|
+
default: '',
|
|
116
|
+
description: 'Filter by title',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
// ----------------------------------
|
|
122
|
+
// createOrUpdate
|
|
123
|
+
// ----------------------------------
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Message',
|
|
126
|
+
name: 'message',
|
|
127
|
+
type: 'string',
|
|
128
|
+
required: true,
|
|
129
|
+
displayOptions: {
|
|
130
|
+
show: {
|
|
131
|
+
resource: ['magic_dash'],
|
|
132
|
+
operation: ['createOrUpdate'],
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
default: '',
|
|
136
|
+
description: 'The primary content to be displayed on the Magic Dash Item',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
displayName: 'Company Name',
|
|
140
|
+
name: 'companyName',
|
|
141
|
+
type: 'string',
|
|
142
|
+
required: true,
|
|
143
|
+
displayOptions: {
|
|
144
|
+
show: {
|
|
145
|
+
resource: ['magic_dash'],
|
|
146
|
+
operation: ['createOrUpdate'],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
default: '',
|
|
150
|
+
description: 'The company name attribute used to match an existing company',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
displayName: 'Title',
|
|
154
|
+
name: 'title',
|
|
155
|
+
type: 'string',
|
|
156
|
+
required: true,
|
|
157
|
+
displayOptions: {
|
|
158
|
+
show: {
|
|
159
|
+
resource: ['magic_dash'],
|
|
160
|
+
operation: ['createOrUpdate'],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
default: '',
|
|
164
|
+
description:
|
|
165
|
+
'The title attribute, used for matching existing Magic Dash Items with the same title and company name',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
displayName: 'Content',
|
|
169
|
+
name: 'content',
|
|
170
|
+
type: 'string',
|
|
171
|
+
typeOptions: {
|
|
172
|
+
rows: 4,
|
|
173
|
+
},
|
|
174
|
+
displayOptions: {
|
|
175
|
+
show: {
|
|
176
|
+
resource: ['magic_dash'],
|
|
177
|
+
operation: ['createOrUpdate'],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
default: '',
|
|
181
|
+
description:
|
|
182
|
+
'HTML content (tables, images, videos, etc.) to be displayed in the Magic Dash Item',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
displayName: 'Additional Fields',
|
|
186
|
+
name: 'additionalFields',
|
|
187
|
+
type: 'collection',
|
|
188
|
+
placeholder: 'Add Field',
|
|
189
|
+
default: {},
|
|
190
|
+
displayOptions: {
|
|
191
|
+
show: {
|
|
192
|
+
resource: ['magic_dash'],
|
|
193
|
+
operation: ['createOrUpdate'],
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
options: [
|
|
197
|
+
{
|
|
198
|
+
displayName: 'Company Name or ID',
|
|
199
|
+
name: 'company_id',
|
|
200
|
+
type: 'options',
|
|
201
|
+
typeOptions: {
|
|
202
|
+
loadOptionsMethod: 'getCompanies',
|
|
203
|
+
loadOptionsParameters: {
|
|
204
|
+
includeBlank: true,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
default: '',
|
|
208
|
+
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
displayName: 'Content Link',
|
|
212
|
+
name: 'content_link',
|
|
213
|
+
type: 'string',
|
|
214
|
+
default: '',
|
|
215
|
+
description: "A link to an external website associated with the Magic Dash Item's content",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
displayName: 'Icon',
|
|
219
|
+
name: 'icon',
|
|
220
|
+
type: 'string',
|
|
221
|
+
default: '',
|
|
222
|
+
description: 'Font Awesome icon code (e.g. fa-home). Search for icons at <a href="https://fontawesome.com/search">Font Awesome</a>.',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
displayName: 'Image URL',
|
|
226
|
+
name: 'image_url',
|
|
227
|
+
type: 'string',
|
|
228
|
+
default: '',
|
|
229
|
+
description: 'A URL for an image to be used in the header of the Magic Dash Item',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
displayName: 'Shade',
|
|
233
|
+
name: 'shade',
|
|
234
|
+
type: 'color',
|
|
235
|
+
default: '',
|
|
236
|
+
//description: 'An optional color for the Magic Dash Item to represent different contextual states (e.g., success, danger)',
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
// ----------------------------------
|
|
242
|
+
// deleteById
|
|
243
|
+
// ----------------------------------
|
|
244
|
+
{
|
|
245
|
+
displayName: 'ID',
|
|
246
|
+
name: 'id',
|
|
247
|
+
type: 'number',
|
|
248
|
+
displayOptions: {
|
|
249
|
+
show: {
|
|
250
|
+
resource: ['magic_dash'],
|
|
251
|
+
operation: ['deleteById'],
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
default: 0,
|
|
255
|
+
required: true,
|
|
256
|
+
description: 'The ID of the Magic Dash item to delete',
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
// ----------------------------------
|
|
260
|
+
// deleteByTitle
|
|
261
|
+
// ----------------------------------
|
|
262
|
+
{
|
|
263
|
+
displayName: 'Title',
|
|
264
|
+
name: 'title',
|
|
265
|
+
type: 'string',
|
|
266
|
+
required: true,
|
|
267
|
+
displayOptions: {
|
|
268
|
+
show: {
|
|
269
|
+
resource: ['magic_dash'],
|
|
270
|
+
operation: ['deleteByTitle'],
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
default: '',
|
|
274
|
+
description: 'The title of the Magic Dash item to delete',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
displayName: 'Company Name',
|
|
278
|
+
name: 'companyName',
|
|
279
|
+
type: 'string',
|
|
280
|
+
required: true,
|
|
281
|
+
displayOptions: {
|
|
282
|
+
show: {
|
|
283
|
+
resource: ['magic_dash'],
|
|
284
|
+
operation: ['deleteByTitle'],
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
default: '',
|
|
288
|
+
description: 'The company name for the Magic Dash item to delete',
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
// ----------------------------------
|
|
292
|
+
// get
|
|
293
|
+
// ----------------------------------
|
|
294
|
+
{
|
|
295
|
+
displayName: 'ID',
|
|
296
|
+
name: 'id',
|
|
297
|
+
type: 'number',
|
|
298
|
+
displayOptions: {
|
|
299
|
+
show: {
|
|
300
|
+
resource: ['magic_dash'],
|
|
301
|
+
operation: ['get'],
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
default: 0,
|
|
305
|
+
required: true,
|
|
306
|
+
description: 'The ID of the Magic Dash item to get',
|
|
307
|
+
},
|
|
308
|
+
];
|
|
@@ -4,6 +4,10 @@ exports.handleActivityLogsOperation = handleActivityLogsOperation;
|
|
|
4
4
|
const operations_1 = require("../../utils/operations");
|
|
5
5
|
const constants_1 = require("../../utils/constants");
|
|
6
6
|
const requestUtils_1 = require("../../utils/requestUtils");
|
|
7
|
+
const THROTTLE_CONFIG = {
|
|
8
|
+
BASE_DELAY_MS: 50,
|
|
9
|
+
RATE_LIMITED_DELAY_MS: 500,
|
|
10
|
+
};
|
|
7
11
|
function filterFields(item, fields) {
|
|
8
12
|
if (!fields || fields.length === 0) {
|
|
9
13
|
return item;
|
|
@@ -22,11 +26,14 @@ function applyFieldFiltering(results, fields) {
|
|
|
22
26
|
}
|
|
23
27
|
return results.map((item) => filterFields(item, fields));
|
|
24
28
|
}
|
|
25
|
-
async function fetchWithResourceTypeFilter(context, endpoint, filters, resourceType, returnAll, limit) {
|
|
29
|
+
async function fetchWithResourceTypeFilter(context, endpoint, filters, resourceType, returnAll, limit, delayMs = THROTTLE_CONFIG.BASE_DELAY_MS) {
|
|
26
30
|
const matchingResults = [];
|
|
27
31
|
let page = 1;
|
|
28
32
|
let hasMorePages = true;
|
|
29
33
|
while (hasMorePages) {
|
|
34
|
+
if (page > 1) {
|
|
35
|
+
await (0, requestUtils_1.sleep)(delayMs);
|
|
36
|
+
}
|
|
30
37
|
const qs = { ...filters, page, page_size: constants_1.HUDU_API_CONSTANTS.PAGE_SIZE };
|
|
31
38
|
const response = await requestUtils_1.huduApiRequest.call(context, 'GET', endpoint, {}, qs);
|
|
32
39
|
const items = Array.isArray(response)
|
|
@@ -74,15 +81,28 @@ async function handleActivityLogsOperation(operation, i) {
|
|
|
74
81
|
let results;
|
|
75
82
|
if (Array.isArray(actionMessages) && actionMessages.length > 1) {
|
|
76
83
|
const allResults = [];
|
|
77
|
-
|
|
84
|
+
let currentDelay = THROTTLE_CONFIG.BASE_DELAY_MS;
|
|
85
|
+
for (let actionIndex = 0; actionIndex < actionMessages.length; actionIndex++) {
|
|
86
|
+
const action = actionMessages[actionIndex];
|
|
78
87
|
const actionFilters = { ...cleanedFilters, action_message: action };
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
if (actionIndex > 0) {
|
|
89
|
+
await (0, requestUtils_1.sleep)(currentDelay);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
if (needsClientSideResourceTypeFilter) {
|
|
93
|
+
const actionResults = await fetchWithResourceTypeFilter(this, resourceEndpoint, actionFilters, resourceType, returnAll, limit, currentDelay);
|
|
94
|
+
allResults.push(...actionResults);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const actionResults = await operations_1.handleGetAllOperation.call(this, resourceEndpoint, 'activity_logs', actionFilters, returnAll, limit);
|
|
98
|
+
allResults.push(...(Array.isArray(actionResults) ? actionResults : [actionResults]));
|
|
99
|
+
}
|
|
82
100
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (error.statusCode === 429) {
|
|
103
|
+
currentDelay = THROTTLE_CONFIG.RATE_LIMITED_DELAY_MS;
|
|
104
|
+
}
|
|
105
|
+
throw error;
|
|
86
106
|
}
|
|
87
107
|
}
|
|
88
108
|
const uniqueMap = new Map();
|