@joshuanode/n8n-nodes-scalepad 0.0.3 → 0.0.5
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 +41 -121
- package/dist/nodes/ScalePadCore/ScalePadCore.node.js +798 -53
- package/dist/nodes/ScalePadCore/descriptions/ActionItemDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/ActionItemDescription.js +306 -0
- package/dist/nodes/ScalePadCore/descriptions/AssessmentDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/AssessmentDescription.js +291 -0
- package/dist/nodes/ScalePadCore/descriptions/AssessmentTemplateDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/AssessmentTemplateDescription.js +59 -0
- package/dist/nodes/ScalePadCore/descriptions/ContractDescription.js +242 -21
- package/dist/nodes/ScalePadCore/descriptions/GoalDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/GoalDescription.js +468 -0
- package/dist/nodes/ScalePadCore/descriptions/HardwareLifecycleDescription.js +5 -66
- package/dist/nodes/ScalePadCore/descriptions/InitiativeDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/InitiativeDescription.js +565 -0
- package/dist/nodes/ScalePadCore/descriptions/LmContractDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/LmContractDescription.js +342 -0
- package/dist/nodes/ScalePadCore/descriptions/MeetingDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/MeetingDescription.js +501 -0
- package/dist/nodes/ScalePadCore/descriptions/NoteDescription.d.ts +3 -0
- package/dist/nodes/ScalePadCore/descriptions/NoteDescription.js +289 -0
- package/dist/nodes/ScalePadLifecycleManager/ScalePadLifecycleManager.node.d.ts +6 -0
- package/dist/nodes/ScalePadLifecycleManager/ScalePadLifecycleManager.node.js +837 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/ActionItemDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/ActionItemDescription.js +306 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentDescription.js +291 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentTemplateDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentTemplateDescription.js +59 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/ContractDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/ContractDescription.js +342 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/GoalDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/GoalDescription.js +468 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/HardwareLifecycleDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/HardwareLifecycleDescription.js +81 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/InitiativeDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/InitiativeDescription.js +565 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/MeetingDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/MeetingDescription.js +501 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/NoteDescription.d.ts +3 -0
- package/dist/nodes/ScalePadLifecycleManager/descriptions/NoteDescription.js +289 -0
- package/dist/nodes/ScalePadLifecycleManager/scalepad.svg +17 -0
- package/package.json +1 -1
|
@@ -2,19 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ScalePadCore = void 0;
|
|
4
4
|
const GenericFunctions_1 = require("../shared/GenericFunctions");
|
|
5
|
+
// Core API descriptions
|
|
5
6
|
const ClientDescription_1 = require("./descriptions/ClientDescription");
|
|
6
7
|
const ContactDescription_1 = require("./descriptions/ContactDescription");
|
|
7
8
|
const ContractDescription_1 = require("./descriptions/ContractDescription");
|
|
8
9
|
const HardwareAssetDescription_1 = require("./descriptions/HardwareAssetDescription");
|
|
9
|
-
const HardwareLifecycleDescription_1 = require("./descriptions/HardwareLifecycleDescription");
|
|
10
10
|
const MemberDescription_1 = require("./descriptions/MemberDescription");
|
|
11
11
|
const OpportunityDescription_1 = require("./descriptions/OpportunityDescription");
|
|
12
12
|
const SaasDescription_1 = require("./descriptions/SaasDescription");
|
|
13
13
|
const TicketDescription_1 = require("./descriptions/TicketDescription");
|
|
14
|
+
// Lifecycle Manager API descriptions
|
|
15
|
+
const MeetingDescription_1 = require("./descriptions/MeetingDescription");
|
|
16
|
+
const InitiativeDescription_1 = require("./descriptions/InitiativeDescription");
|
|
17
|
+
const GoalDescription_1 = require("./descriptions/GoalDescription");
|
|
18
|
+
const ActionItemDescription_1 = require("./descriptions/ActionItemDescription");
|
|
19
|
+
const AssessmentDescription_1 = require("./descriptions/AssessmentDescription");
|
|
20
|
+
const NoteDescription_1 = require("./descriptions/NoteDescription");
|
|
21
|
+
const AssessmentTemplateDescription_1 = require("./descriptions/AssessmentTemplateDescription");
|
|
22
|
+
const HardwareLifecycleDescription_1 = require("./descriptions/HardwareLifecycleDescription");
|
|
23
|
+
const LmContractDescription_1 = require("./descriptions/LmContractDescription");
|
|
14
24
|
class ScalePadCore {
|
|
15
25
|
constructor() {
|
|
16
26
|
this.description = {
|
|
17
|
-
displayName: 'ScalePad
|
|
27
|
+
displayName: 'ScalePad',
|
|
18
28
|
name: 'scalePadCore',
|
|
19
29
|
icon: 'file:scalepad.svg',
|
|
20
30
|
group: ['transform'],
|
|
@@ -22,7 +32,7 @@ class ScalePadCore {
|
|
|
22
32
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
23
33
|
description: 'Interact with ScalePad Core API and Lifecycle Manager',
|
|
24
34
|
defaults: {
|
|
25
|
-
name: 'ScalePad
|
|
35
|
+
name: 'ScalePad',
|
|
26
36
|
},
|
|
27
37
|
inputs: ['main'],
|
|
28
38
|
outputs: ['main'],
|
|
@@ -46,45 +56,97 @@ class ScalePadCore {
|
|
|
46
56
|
type: 'options',
|
|
47
57
|
noDataExpression: true,
|
|
48
58
|
options: [
|
|
59
|
+
// Lifecycle Manager resources
|
|
60
|
+
{
|
|
61
|
+
name: 'Action Item',
|
|
62
|
+
value: 'actionItem',
|
|
63
|
+
description: 'Lifecycle Manager: Action items for clients',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Assessment',
|
|
67
|
+
value: 'assessment',
|
|
68
|
+
description: 'Lifecycle Manager: Client assessments',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Assessment Template',
|
|
72
|
+
value: 'assessmentTemplate',
|
|
73
|
+
description: 'Lifecycle Manager: Assessment templates',
|
|
74
|
+
},
|
|
75
|
+
// Core API resources
|
|
49
76
|
{
|
|
50
77
|
name: 'Client',
|
|
51
78
|
value: 'client',
|
|
79
|
+
description: 'Core API: Client records',
|
|
52
80
|
},
|
|
53
81
|
{
|
|
54
82
|
name: 'Contact',
|
|
55
83
|
value: 'contact',
|
|
84
|
+
description: 'Core API: Contact records',
|
|
56
85
|
},
|
|
57
86
|
{
|
|
58
|
-
name: 'Contract',
|
|
87
|
+
name: 'Contract (Core)',
|
|
59
88
|
value: 'contract',
|
|
89
|
+
description: 'Core API: Service contracts',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'Contract (Lifecycle)',
|
|
93
|
+
value: 'lmContract',
|
|
94
|
+
description: 'Lifecycle Manager: Contracts',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Goal',
|
|
98
|
+
value: 'goal',
|
|
99
|
+
description: 'Lifecycle Manager: Client goals',
|
|
60
100
|
},
|
|
61
101
|
{
|
|
62
102
|
name: 'Hardware Asset',
|
|
63
103
|
value: 'hardwareAsset',
|
|
104
|
+
description: 'Core API: Hardware assets',
|
|
64
105
|
},
|
|
65
106
|
{
|
|
66
107
|
name: 'Hardware Lifecycle',
|
|
67
108
|
value: 'hardwareLifecycle',
|
|
109
|
+
description: 'Lifecycle Manager: Hardware lifecycle records',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'Initiative',
|
|
113
|
+
value: 'initiative',
|
|
114
|
+
description: 'Lifecycle Manager: Client initiatives',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Meeting',
|
|
118
|
+
value: 'meeting',
|
|
119
|
+
description: 'Lifecycle Manager: Client meetings',
|
|
68
120
|
},
|
|
69
121
|
{
|
|
70
122
|
name: 'Member',
|
|
71
123
|
value: 'member',
|
|
124
|
+
description: 'Core API: Team members',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'Note',
|
|
128
|
+
value: 'note',
|
|
129
|
+
description: 'Lifecycle Manager: Client notes',
|
|
72
130
|
},
|
|
73
131
|
{
|
|
74
132
|
name: 'Opportunity',
|
|
75
133
|
value: 'opportunity',
|
|
134
|
+
description: 'Core API: Sales opportunities',
|
|
76
135
|
},
|
|
77
136
|
{
|
|
78
137
|
name: 'SaaS',
|
|
79
138
|
value: 'saas',
|
|
139
|
+
description: 'Core API: SaaS subscriptions',
|
|
80
140
|
},
|
|
81
141
|
{
|
|
82
142
|
name: 'Ticket',
|
|
83
143
|
value: 'ticket',
|
|
144
|
+
description: 'Core API: Service tickets',
|
|
84
145
|
},
|
|
85
146
|
],
|
|
86
147
|
default: 'client',
|
|
87
148
|
},
|
|
149
|
+
// Core API operations and fields
|
|
88
150
|
...ClientDescription_1.clientOperations,
|
|
89
151
|
...ClientDescription_1.clientFields,
|
|
90
152
|
...ContactDescription_1.contactOperations,
|
|
@@ -93,8 +155,6 @@ class ScalePadCore {
|
|
|
93
155
|
...ContractDescription_1.contractFields,
|
|
94
156
|
...HardwareAssetDescription_1.hardwareAssetOperations,
|
|
95
157
|
...HardwareAssetDescription_1.hardwareAssetFields,
|
|
96
|
-
...HardwareLifecycleDescription_1.hardwareLifecycleOperations,
|
|
97
|
-
...HardwareLifecycleDescription_1.hardwareLifecycleFields,
|
|
98
158
|
...MemberDescription_1.memberOperations,
|
|
99
159
|
...MemberDescription_1.memberFields,
|
|
100
160
|
...OpportunityDescription_1.opportunityOperations,
|
|
@@ -103,6 +163,25 @@ class ScalePadCore {
|
|
|
103
163
|
...SaasDescription_1.saasFields,
|
|
104
164
|
...TicketDescription_1.ticketOperations,
|
|
105
165
|
...TicketDescription_1.ticketFields,
|
|
166
|
+
// Lifecycle Manager operations and fields
|
|
167
|
+
...MeetingDescription_1.meetingOperations,
|
|
168
|
+
...MeetingDescription_1.meetingFields,
|
|
169
|
+
...InitiativeDescription_1.initiativeOperations,
|
|
170
|
+
...InitiativeDescription_1.initiativeFields,
|
|
171
|
+
...GoalDescription_1.goalOperations,
|
|
172
|
+
...GoalDescription_1.goalFields,
|
|
173
|
+
...ActionItemDescription_1.actionItemOperations,
|
|
174
|
+
...ActionItemDescription_1.actionItemFields,
|
|
175
|
+
...AssessmentDescription_1.assessmentOperations,
|
|
176
|
+
...AssessmentDescription_1.assessmentFields,
|
|
177
|
+
...NoteDescription_1.noteOperations,
|
|
178
|
+
...NoteDescription_1.noteFields,
|
|
179
|
+
...AssessmentTemplateDescription_1.assessmentTemplateOperations,
|
|
180
|
+
...AssessmentTemplateDescription_1.assessmentTemplateFields,
|
|
181
|
+
...HardwareLifecycleDescription_1.hardwareLifecycleOperations,
|
|
182
|
+
...HardwareLifecycleDescription_1.hardwareLifecycleFields,
|
|
183
|
+
...LmContractDescription_1.lmContractOperations,
|
|
184
|
+
...LmContractDescription_1.lmContractFields,
|
|
106
185
|
],
|
|
107
186
|
};
|
|
108
187
|
}
|
|
@@ -111,8 +190,10 @@ class ScalePadCore {
|
|
|
111
190
|
const returnData = [];
|
|
112
191
|
const resource = this.getNodeParameter('resource', 0);
|
|
113
192
|
const operation = this.getNodeParameter('operation', 0);
|
|
193
|
+
const lmBasePath = '/lifecycle-manager/v1';
|
|
114
194
|
for (let i = 0; i < items.length; i++) {
|
|
115
195
|
try {
|
|
196
|
+
// ==================== CORE API: CLIENT ====================
|
|
116
197
|
if (resource === 'client') {
|
|
117
198
|
if (operation === 'get') {
|
|
118
199
|
const clientId = this.getNodeParameter('clientId', i);
|
|
@@ -126,7 +207,6 @@ class ScalePadCore {
|
|
|
126
207
|
if (!returnAll) {
|
|
127
208
|
qs.page_size = this.getNodeParameter('limit', i);
|
|
128
209
|
}
|
|
129
|
-
// Handle filters
|
|
130
210
|
if (additionalFields.filter) {
|
|
131
211
|
const filterData = additionalFields.filter;
|
|
132
212
|
if (filterData.filters && Array.isArray(filterData.filters)) {
|
|
@@ -138,7 +218,6 @@ class ScalePadCore {
|
|
|
138
218
|
}
|
|
139
219
|
}
|
|
140
220
|
}
|
|
141
|
-
// Handle sorting
|
|
142
221
|
if (additionalFields.sort) {
|
|
143
222
|
const sortData = additionalFields.sort;
|
|
144
223
|
if (sortData.sortFields) {
|
|
@@ -161,6 +240,7 @@ class ScalePadCore {
|
|
|
161
240
|
});
|
|
162
241
|
}
|
|
163
242
|
}
|
|
243
|
+
// ==================== CORE API: CONTACT ====================
|
|
164
244
|
if (resource === 'contact') {
|
|
165
245
|
if (operation === 'get') {
|
|
166
246
|
const contactId = this.getNodeParameter('contactId', i);
|
|
@@ -193,10 +273,11 @@ class ScalePadCore {
|
|
|
193
273
|
});
|
|
194
274
|
}
|
|
195
275
|
}
|
|
276
|
+
// ==================== CORE API: TICKET ====================
|
|
196
277
|
if (resource === 'ticket') {
|
|
197
278
|
if (operation === 'get') {
|
|
198
279
|
const ticketId = this.getNodeParameter('ticketId', i);
|
|
199
|
-
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1/tickets/${ticketId}`);
|
|
280
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1/service/tickets/${ticketId}`);
|
|
200
281
|
returnData.push({ json: responseData });
|
|
201
282
|
}
|
|
202
283
|
if (operation === 'getAll') {
|
|
@@ -217,10 +298,10 @@ class ScalePadCore {
|
|
|
217
298
|
}
|
|
218
299
|
let responseData;
|
|
219
300
|
if (returnAll) {
|
|
220
|
-
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', '/core/v1/tickets', {}, qs);
|
|
301
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', '/core/v1/service/tickets', {}, qs);
|
|
221
302
|
}
|
|
222
303
|
else {
|
|
223
|
-
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', '/core/v1/tickets', {}, qs);
|
|
304
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', '/core/v1/service/tickets', {}, qs);
|
|
224
305
|
responseData = response.data || [];
|
|
225
306
|
}
|
|
226
307
|
responseData.forEach((item) => {
|
|
@@ -228,10 +309,26 @@ class ScalePadCore {
|
|
|
228
309
|
});
|
|
229
310
|
}
|
|
230
311
|
}
|
|
231
|
-
|
|
312
|
+
// ==================== CORE API: SHARED RESOURCES ====================
|
|
313
|
+
const coreResourceMap = {
|
|
314
|
+
contract: 'service/contracts',
|
|
315
|
+
hardwareAsset: 'assets/hardware',
|
|
316
|
+
member: 'members',
|
|
317
|
+
opportunity: 'opportunities',
|
|
318
|
+
saas: 'assets/saas',
|
|
319
|
+
};
|
|
320
|
+
if (Object.keys(coreResourceMap).includes(resource)) {
|
|
321
|
+
const endpoint = coreResourceMap[resource];
|
|
322
|
+
const idParamMap = {
|
|
323
|
+
contract: 'contractId',
|
|
324
|
+
hardwareAsset: 'assetId',
|
|
325
|
+
member: 'memberId',
|
|
326
|
+
opportunity: 'opportunityId',
|
|
327
|
+
saas: 'saasId',
|
|
328
|
+
};
|
|
232
329
|
if (operation === 'get') {
|
|
233
|
-
const
|
|
234
|
-
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1
|
|
330
|
+
const id = this.getNodeParameter(idParamMap[resource], i);
|
|
331
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1/${endpoint}/${id}`);
|
|
235
332
|
returnData.push({ json: responseData });
|
|
236
333
|
}
|
|
237
334
|
if (operation === 'getAll') {
|
|
@@ -244,18 +341,24 @@ class ScalePadCore {
|
|
|
244
341
|
if (additionalFields.clientId) {
|
|
245
342
|
qs['filter[client_id]'] = `eq:${additionalFields.clientId}`;
|
|
246
343
|
}
|
|
247
|
-
if (additionalFields.
|
|
248
|
-
qs['filter[
|
|
344
|
+
if (additionalFields.status) {
|
|
345
|
+
qs['filter[status]'] = `eq:${additionalFields.status}`;
|
|
249
346
|
}
|
|
250
|
-
if (additionalFields.
|
|
251
|
-
qs['filter[
|
|
347
|
+
if (resource === 'hardwareAsset' && additionalFields.assetType) {
|
|
348
|
+
qs['filter[asset_type]'] = `eq:${additionalFields.assetType}`;
|
|
349
|
+
}
|
|
350
|
+
if (resource === 'member' && additionalFields.role) {
|
|
351
|
+
qs['filter[role]'] = `eq:${additionalFields.role}`;
|
|
352
|
+
}
|
|
353
|
+
if (resource === 'opportunity' && additionalFields.stage) {
|
|
354
|
+
qs['filter[stage]'] = `eq:${additionalFields.stage}`;
|
|
252
355
|
}
|
|
253
356
|
let responseData;
|
|
254
357
|
if (returnAll) {
|
|
255
|
-
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET',
|
|
358
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `/core/v1/${endpoint}`, {}, qs);
|
|
256
359
|
}
|
|
257
360
|
else {
|
|
258
|
-
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET',
|
|
361
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1/${endpoint}`, {}, qs);
|
|
259
362
|
responseData = response.data || [];
|
|
260
363
|
}
|
|
261
364
|
responseData.forEach((item) => {
|
|
@@ -263,64 +366,706 @@ class ScalePadCore {
|
|
|
263
366
|
});
|
|
264
367
|
}
|
|
265
368
|
}
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
};
|
|
369
|
+
// ==================== LIFECYCLE MANAGER: MEETING ====================
|
|
370
|
+
if (resource === 'meeting') {
|
|
371
|
+
if (operation === 'create') {
|
|
372
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
373
|
+
const title = this.getNodeParameter('title', i);
|
|
374
|
+
const scheduledAt = this.getNodeParameter('scheduledAt', i);
|
|
375
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
376
|
+
const body = {
|
|
377
|
+
client_id: clientId,
|
|
378
|
+
title,
|
|
379
|
+
scheduled_at: scheduledAt,
|
|
380
|
+
...additionalFields,
|
|
381
|
+
};
|
|
382
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/meetings`, body);
|
|
383
|
+
returnData.push({ json: responseData });
|
|
384
|
+
}
|
|
283
385
|
if (operation === 'get') {
|
|
284
|
-
const
|
|
285
|
-
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET',
|
|
386
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
387
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/meetings/${meetingId}`);
|
|
286
388
|
returnData.push({ json: responseData });
|
|
287
389
|
}
|
|
288
390
|
if (operation === 'getAll') {
|
|
289
391
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
392
|
+
const filters = this.getNodeParameter('filters', i);
|
|
393
|
+
const qs = {};
|
|
394
|
+
if (!returnAll) {
|
|
395
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
396
|
+
}
|
|
397
|
+
if (filters.clientId) {
|
|
398
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
399
|
+
}
|
|
400
|
+
if (filters.isCompleted !== undefined) {
|
|
401
|
+
qs['filter[is_completed]'] = `eq:${filters.isCompleted}`;
|
|
402
|
+
}
|
|
403
|
+
let responseData;
|
|
404
|
+
if (returnAll) {
|
|
405
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/meetings`, {}, qs);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/meetings`, {}, qs);
|
|
409
|
+
responseData = response.data || [];
|
|
410
|
+
}
|
|
411
|
+
responseData.forEach((item) => {
|
|
412
|
+
returnData.push({ json: item });
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (operation === 'update') {
|
|
416
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
417
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
418
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/meetings/${meetingId}`, updateFields);
|
|
419
|
+
returnData.push({ json: responseData });
|
|
420
|
+
}
|
|
421
|
+
if (operation === 'delete') {
|
|
422
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
423
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/meetings/${meetingId}`);
|
|
424
|
+
returnData.push({ json: { success: true } });
|
|
425
|
+
}
|
|
426
|
+
if (operation === 'updateCompletionStatus') {
|
|
427
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
428
|
+
const isCompleted = this.getNodeParameter('isCompleted', i);
|
|
429
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/meetings/${meetingId}/completion-status`, { is_completed: isCompleted });
|
|
430
|
+
returnData.push({ json: responseData });
|
|
431
|
+
}
|
|
432
|
+
if (operation === 'addUserAttendees') {
|
|
433
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
434
|
+
const userIds = this.getNodeParameter('userIds', i)
|
|
435
|
+
.split(',')
|
|
436
|
+
.map((id) => id.trim());
|
|
437
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/meetings/${meetingId}/attendees/users`, { user_ids: userIds });
|
|
438
|
+
returnData.push({ json: responseData });
|
|
439
|
+
}
|
|
440
|
+
if (operation === 'removeUserAttendees') {
|
|
441
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
442
|
+
const userIds = this.getNodeParameter('userIds', i)
|
|
443
|
+
.split(',')
|
|
444
|
+
.map((id) => id.trim());
|
|
445
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/meetings/${meetingId}/attendees/users`, { user_ids: userIds });
|
|
446
|
+
returnData.push({ json: responseData });
|
|
447
|
+
}
|
|
448
|
+
if (operation === 'addContactAttendees') {
|
|
449
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
450
|
+
const contactIds = this.getNodeParameter('contactIds', i)
|
|
451
|
+
.split(',')
|
|
452
|
+
.map((id) => id.trim());
|
|
453
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/meetings/${meetingId}/attendees/contacts`, { contact_ids: contactIds });
|
|
454
|
+
returnData.push({ json: responseData });
|
|
455
|
+
}
|
|
456
|
+
if (operation === 'removeContactAttendees') {
|
|
457
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
458
|
+
const contactIds = this.getNodeParameter('contactIds', i)
|
|
459
|
+
.split(',')
|
|
460
|
+
.map((id) => id.trim());
|
|
461
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/meetings/${meetingId}/attendees/contacts`, { contact_ids: contactIds });
|
|
462
|
+
returnData.push({ json: responseData });
|
|
463
|
+
}
|
|
464
|
+
if (operation === 'listInitiatives') {
|
|
465
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
466
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/meetings/${meetingId}/initiatives`);
|
|
467
|
+
returnData.push({ json: responseData });
|
|
468
|
+
}
|
|
469
|
+
if (operation === 'linkInitiative') {
|
|
470
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
471
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
472
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/meetings/${meetingId}/initiatives/${initiativeId}`);
|
|
473
|
+
returnData.push({ json: responseData });
|
|
474
|
+
}
|
|
475
|
+
if (operation === 'unlinkInitiative') {
|
|
476
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
477
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
478
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/meetings/${meetingId}/initiatives/${initiativeId}`);
|
|
479
|
+
returnData.push({ json: { success: true } });
|
|
480
|
+
}
|
|
481
|
+
if (operation === 'listGoals') {
|
|
482
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
483
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/meetings/${meetingId}/goals`);
|
|
484
|
+
returnData.push({ json: responseData });
|
|
485
|
+
}
|
|
486
|
+
if (operation === 'linkGoal') {
|
|
487
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
488
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
489
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/meetings/${meetingId}/goals/${goalId}`);
|
|
490
|
+
returnData.push({ json: responseData });
|
|
491
|
+
}
|
|
492
|
+
if (operation === 'unlinkGoal') {
|
|
493
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
494
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
495
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/meetings/${meetingId}/goals/${goalId}`);
|
|
496
|
+
returnData.push({ json: { success: true } });
|
|
497
|
+
}
|
|
498
|
+
if (operation === 'listActionItems') {
|
|
499
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
500
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/meetings/${meetingId}/action-items`);
|
|
501
|
+
returnData.push({ json: responseData });
|
|
502
|
+
}
|
|
503
|
+
if (operation === 'linkActionItem') {
|
|
504
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
505
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
506
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/meetings/${meetingId}/action-items/${actionItemId}`);
|
|
507
|
+
returnData.push({ json: responseData });
|
|
508
|
+
}
|
|
509
|
+
if (operation === 'unlinkActionItem') {
|
|
510
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
511
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
512
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/meetings/${meetingId}/action-items/${actionItemId}`);
|
|
513
|
+
returnData.push({ json: { success: true } });
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
// ==================== LIFECYCLE MANAGER: INITIATIVE ====================
|
|
517
|
+
if (resource === 'initiative') {
|
|
518
|
+
if (operation === 'create') {
|
|
519
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
520
|
+
const title = this.getNodeParameter('title', i);
|
|
290
521
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
522
|
+
const body = {
|
|
523
|
+
client_id: clientId,
|
|
524
|
+
title,
|
|
525
|
+
...additionalFields,
|
|
526
|
+
};
|
|
527
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/initiatives`, body);
|
|
528
|
+
returnData.push({ json: responseData });
|
|
529
|
+
}
|
|
530
|
+
if (operation === 'get') {
|
|
531
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
532
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/initiatives/${initiativeId}`);
|
|
533
|
+
returnData.push({ json: responseData });
|
|
534
|
+
}
|
|
535
|
+
if (operation === 'getAll') {
|
|
536
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
537
|
+
const filters = this.getNodeParameter('filters', i);
|
|
291
538
|
const qs = {};
|
|
292
539
|
if (!returnAll) {
|
|
293
540
|
qs.page_size = this.getNodeParameter('limit', i);
|
|
294
541
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
qs['filter[client_id]'] = `eq:${additionalFields.clientId}`;
|
|
542
|
+
if (filters.clientId) {
|
|
543
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
298
544
|
}
|
|
299
|
-
if (
|
|
300
|
-
qs['filter[status]'] = `eq:${
|
|
545
|
+
if (filters.status) {
|
|
546
|
+
qs['filter[status]'] = `eq:${filters.status}`;
|
|
301
547
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
qs['filter[asset_type]'] = `eq:${additionalFields.assetType}`;
|
|
548
|
+
if (filters.priority) {
|
|
549
|
+
qs['filter[priority]'] = `eq:${filters.priority}`;
|
|
305
550
|
}
|
|
306
|
-
|
|
307
|
-
|
|
551
|
+
let responseData;
|
|
552
|
+
if (returnAll) {
|
|
553
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/initiatives`, {}, qs);
|
|
308
554
|
}
|
|
309
|
-
|
|
310
|
-
|
|
555
|
+
else {
|
|
556
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/initiatives`, {}, qs);
|
|
557
|
+
responseData = response.data || [];
|
|
558
|
+
}
|
|
559
|
+
responseData.forEach((item) => {
|
|
560
|
+
returnData.push({ json: item });
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
if (operation === 'update') {
|
|
564
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
565
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
566
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}`, updateFields);
|
|
567
|
+
returnData.push({ json: responseData });
|
|
568
|
+
}
|
|
569
|
+
if (operation === 'delete') {
|
|
570
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
571
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/initiatives/${initiativeId}`);
|
|
572
|
+
returnData.push({ json: { success: true } });
|
|
573
|
+
}
|
|
574
|
+
if (operation === 'updateStatus') {
|
|
575
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
576
|
+
const status = this.getNodeParameter('status', i);
|
|
577
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}/status`, { status });
|
|
578
|
+
returnData.push({ json: responseData });
|
|
579
|
+
}
|
|
580
|
+
if (operation === 'updateSchedule') {
|
|
581
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
582
|
+
const fiscalYear = this.getNodeParameter('fiscalYear', i);
|
|
583
|
+
const fiscalQuarter = this.getNodeParameter('fiscalQuarter', i);
|
|
584
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}/schedule`, { fiscal_year: fiscalYear, fiscal_quarter: fiscalQuarter });
|
|
585
|
+
returnData.push({ json: responseData });
|
|
586
|
+
}
|
|
587
|
+
if (operation === 'updatePriority') {
|
|
588
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
589
|
+
const priority = this.getNodeParameter('priority', i);
|
|
590
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}/priority`, { priority });
|
|
591
|
+
returnData.push({ json: responseData });
|
|
592
|
+
}
|
|
593
|
+
if (operation === 'updateBudget') {
|
|
594
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
595
|
+
const oneTimeInvestment = this.getNodeParameter('oneTimeInvestment', i);
|
|
596
|
+
const recurringInvestment = this.getNodeParameter('recurringInvestment', i);
|
|
597
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}/budget`, {
|
|
598
|
+
one_time_investment: oneTimeInvestment,
|
|
599
|
+
recurring_investment: recurringInvestment,
|
|
600
|
+
});
|
|
601
|
+
returnData.push({ json: responseData });
|
|
602
|
+
}
|
|
603
|
+
if (operation === 'listMeetings') {
|
|
604
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
605
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/initiatives/${initiativeId}/meetings`);
|
|
606
|
+
returnData.push({ json: responseData });
|
|
607
|
+
}
|
|
608
|
+
if (operation === 'linkMeeting') {
|
|
609
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
610
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
611
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}/meetings/${meetingId}`);
|
|
612
|
+
returnData.push({ json: responseData });
|
|
613
|
+
}
|
|
614
|
+
if (operation === 'unlinkMeeting') {
|
|
615
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
616
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
617
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/initiatives/${initiativeId}/meetings/${meetingId}`);
|
|
618
|
+
returnData.push({ json: { success: true } });
|
|
619
|
+
}
|
|
620
|
+
if (operation === 'listGoals') {
|
|
621
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
622
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/initiatives/${initiativeId}/goals`);
|
|
623
|
+
returnData.push({ json: responseData });
|
|
624
|
+
}
|
|
625
|
+
if (operation === 'linkGoal') {
|
|
626
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
627
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
628
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}/goals/${goalId}`);
|
|
629
|
+
returnData.push({ json: responseData });
|
|
630
|
+
}
|
|
631
|
+
if (operation === 'unlinkGoal') {
|
|
632
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
633
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
634
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/initiatives/${initiativeId}/goals/${goalId}`);
|
|
635
|
+
returnData.push({ json: { success: true } });
|
|
636
|
+
}
|
|
637
|
+
if (operation === 'listActionItems') {
|
|
638
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
639
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/initiatives/${initiativeId}/action-items`);
|
|
640
|
+
returnData.push({ json: responseData });
|
|
641
|
+
}
|
|
642
|
+
if (operation === 'linkActionItem') {
|
|
643
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
644
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
645
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/initiatives/${initiativeId}/action-items/${actionItemId}`);
|
|
646
|
+
returnData.push({ json: responseData });
|
|
647
|
+
}
|
|
648
|
+
if (operation === 'unlinkActionItem') {
|
|
649
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
650
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
651
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/initiatives/${initiativeId}/action-items/${actionItemId}`);
|
|
652
|
+
returnData.push({ json: { success: true } });
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
// ==================== LIFECYCLE MANAGER: GOAL ====================
|
|
656
|
+
if (resource === 'goal') {
|
|
657
|
+
if (operation === 'create') {
|
|
658
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
659
|
+
const title = this.getNodeParameter('title', i);
|
|
660
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
661
|
+
const body = {
|
|
662
|
+
client_id: clientId,
|
|
663
|
+
title,
|
|
664
|
+
...additionalFields,
|
|
665
|
+
};
|
|
666
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/goals`, body);
|
|
667
|
+
returnData.push({ json: responseData });
|
|
668
|
+
}
|
|
669
|
+
if (operation === 'get') {
|
|
670
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
671
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/goals/${goalId}`);
|
|
672
|
+
returnData.push({ json: responseData });
|
|
673
|
+
}
|
|
674
|
+
if (operation === 'getAll') {
|
|
675
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
676
|
+
const filters = this.getNodeParameter('filters', i);
|
|
677
|
+
const qs = {};
|
|
678
|
+
if (!returnAll) {
|
|
679
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
680
|
+
}
|
|
681
|
+
if (filters.clientId) {
|
|
682
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
683
|
+
}
|
|
684
|
+
if (filters.status) {
|
|
685
|
+
qs['filter[status]'] = `eq:${filters.status}`;
|
|
686
|
+
}
|
|
687
|
+
if (filters.category) {
|
|
688
|
+
qs['filter[category]'] = `eq:${filters.category}`;
|
|
311
689
|
}
|
|
312
690
|
let responseData;
|
|
313
691
|
if (returnAll) {
|
|
314
|
-
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET',
|
|
692
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/goals`, {}, qs);
|
|
315
693
|
}
|
|
316
694
|
else {
|
|
317
|
-
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET',
|
|
695
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/goals`, {}, qs);
|
|
318
696
|
responseData = response.data || [];
|
|
319
697
|
}
|
|
320
698
|
responseData.forEach((item) => {
|
|
321
699
|
returnData.push({ json: item });
|
|
322
700
|
});
|
|
323
701
|
}
|
|
702
|
+
if (operation === 'update') {
|
|
703
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
704
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
705
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/goals/${goalId}`, updateFields);
|
|
706
|
+
returnData.push({ json: responseData });
|
|
707
|
+
}
|
|
708
|
+
if (operation === 'delete') {
|
|
709
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
710
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/goals/${goalId}`);
|
|
711
|
+
returnData.push({ json: { success: true } });
|
|
712
|
+
}
|
|
713
|
+
if (operation === 'updateStatus') {
|
|
714
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
715
|
+
const status = this.getNodeParameter('status', i);
|
|
716
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/goals/${goalId}/status`, { status });
|
|
717
|
+
returnData.push({ json: responseData });
|
|
718
|
+
}
|
|
719
|
+
if (operation === 'updateSchedule') {
|
|
720
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
721
|
+
const fiscalYear = this.getNodeParameter('fiscalYear', i);
|
|
722
|
+
const fiscalQuarter = this.getNodeParameter('fiscalQuarter', i);
|
|
723
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/goals/${goalId}/schedule`, { fiscal_year: fiscalYear, fiscal_quarter: fiscalQuarter });
|
|
724
|
+
returnData.push({ json: responseData });
|
|
725
|
+
}
|
|
726
|
+
if (operation === 'listMeetings') {
|
|
727
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
728
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/goals/${goalId}/meetings`);
|
|
729
|
+
returnData.push({ json: responseData });
|
|
730
|
+
}
|
|
731
|
+
if (operation === 'linkMeeting') {
|
|
732
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
733
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
734
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/goals/${goalId}/meetings/${meetingId}`);
|
|
735
|
+
returnData.push({ json: responseData });
|
|
736
|
+
}
|
|
737
|
+
if (operation === 'unlinkMeeting') {
|
|
738
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
739
|
+
const meetingId = this.getNodeParameter('meetingId', i);
|
|
740
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/goals/${goalId}/meetings/${meetingId}`);
|
|
741
|
+
returnData.push({ json: { success: true } });
|
|
742
|
+
}
|
|
743
|
+
if (operation === 'listInitiatives') {
|
|
744
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
745
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/goals/${goalId}/initiatives`);
|
|
746
|
+
returnData.push({ json: responseData });
|
|
747
|
+
}
|
|
748
|
+
if (operation === 'linkInitiative') {
|
|
749
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
750
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
751
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/goals/${goalId}/initiatives/${initiativeId}`);
|
|
752
|
+
returnData.push({ json: responseData });
|
|
753
|
+
}
|
|
754
|
+
if (operation === 'unlinkInitiative') {
|
|
755
|
+
const goalId = this.getNodeParameter('goalId', i);
|
|
756
|
+
const initiativeId = this.getNodeParameter('initiativeId', i);
|
|
757
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/goals/${goalId}/initiatives/${initiativeId}`);
|
|
758
|
+
returnData.push({ json: { success: true } });
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
// ==================== LIFECYCLE MANAGER: ACTION ITEM ====================
|
|
762
|
+
if (resource === 'actionItem') {
|
|
763
|
+
if (operation === 'create') {
|
|
764
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
765
|
+
const title = this.getNodeParameter('title', i);
|
|
766
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
767
|
+
const body = {
|
|
768
|
+
client_id: clientId,
|
|
769
|
+
title,
|
|
770
|
+
...additionalFields,
|
|
771
|
+
};
|
|
772
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/action-items`, body);
|
|
773
|
+
returnData.push({ json: responseData });
|
|
774
|
+
}
|
|
775
|
+
if (operation === 'get') {
|
|
776
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
777
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/action-items/${actionItemId}`);
|
|
778
|
+
returnData.push({ json: responseData });
|
|
779
|
+
}
|
|
780
|
+
if (operation === 'getAll') {
|
|
781
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
782
|
+
const filters = this.getNodeParameter('filters', i);
|
|
783
|
+
const qs = {};
|
|
784
|
+
if (!returnAll) {
|
|
785
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
786
|
+
}
|
|
787
|
+
if (filters.clientId) {
|
|
788
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
789
|
+
}
|
|
790
|
+
if (filters.assigneeId) {
|
|
791
|
+
qs['filter[assignee_id]'] = `eq:${filters.assigneeId}`;
|
|
792
|
+
}
|
|
793
|
+
if (filters.isCompleted !== undefined) {
|
|
794
|
+
qs['filter[is_completed]'] = `eq:${filters.isCompleted}`;
|
|
795
|
+
}
|
|
796
|
+
if (filters.priority) {
|
|
797
|
+
qs['filter[priority]'] = `eq:${filters.priority}`;
|
|
798
|
+
}
|
|
799
|
+
let responseData;
|
|
800
|
+
if (returnAll) {
|
|
801
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/action-items`, {}, qs);
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/action-items`, {}, qs);
|
|
805
|
+
responseData = response.data || [];
|
|
806
|
+
}
|
|
807
|
+
responseData.forEach((item) => {
|
|
808
|
+
returnData.push({ json: item });
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
if (operation === 'update') {
|
|
812
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
813
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
814
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/action-items/${actionItemId}`, updateFields);
|
|
815
|
+
returnData.push({ json: responseData });
|
|
816
|
+
}
|
|
817
|
+
if (operation === 'delete') {
|
|
818
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
819
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/action-items/${actionItemId}`);
|
|
820
|
+
returnData.push({ json: { success: true } });
|
|
821
|
+
}
|
|
822
|
+
if (operation === 'toggleCompletion') {
|
|
823
|
+
const actionItemId = this.getNodeParameter('actionItemId', i);
|
|
824
|
+
const isCompleted = this.getNodeParameter('isCompleted', i);
|
|
825
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/action-items/${actionItemId}/completion-status`, { is_completed: isCompleted });
|
|
826
|
+
returnData.push({ json: responseData });
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
// ==================== LIFECYCLE MANAGER: ASSESSMENT ====================
|
|
830
|
+
if (resource === 'assessment') {
|
|
831
|
+
if (operation === 'create') {
|
|
832
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
833
|
+
const templateId = this.getNodeParameter('templateId', i);
|
|
834
|
+
const title = this.getNodeParameter('title', i);
|
|
835
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
836
|
+
const body = {
|
|
837
|
+
client_id: clientId,
|
|
838
|
+
template_id: templateId,
|
|
839
|
+
title,
|
|
840
|
+
...additionalFields,
|
|
841
|
+
};
|
|
842
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/assessments`, body);
|
|
843
|
+
returnData.push({ json: responseData });
|
|
844
|
+
}
|
|
845
|
+
if (operation === 'get') {
|
|
846
|
+
const assessmentId = this.getNodeParameter('assessmentId', i);
|
|
847
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/assessments/${assessmentId}`);
|
|
848
|
+
returnData.push({ json: responseData });
|
|
849
|
+
}
|
|
850
|
+
if (operation === 'getAll') {
|
|
851
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
852
|
+
const filters = this.getNodeParameter('filters', i);
|
|
853
|
+
const qs = {};
|
|
854
|
+
if (!returnAll) {
|
|
855
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
856
|
+
}
|
|
857
|
+
if (filters.clientId) {
|
|
858
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
859
|
+
}
|
|
860
|
+
if (filters.templateId) {
|
|
861
|
+
qs['filter[template_id]'] = `eq:${filters.templateId}`;
|
|
862
|
+
}
|
|
863
|
+
if (filters.isCompleted !== undefined) {
|
|
864
|
+
qs['filter[is_completed]'] = `eq:${filters.isCompleted}`;
|
|
865
|
+
}
|
|
866
|
+
let responseData;
|
|
867
|
+
if (returnAll) {
|
|
868
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/assessments`, {}, qs);
|
|
869
|
+
}
|
|
870
|
+
else {
|
|
871
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/assessments`, {}, qs);
|
|
872
|
+
responseData = response.data || [];
|
|
873
|
+
}
|
|
874
|
+
responseData.forEach((item) => {
|
|
875
|
+
returnData.push({ json: item });
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
if (operation === 'update') {
|
|
879
|
+
const assessmentId = this.getNodeParameter('assessmentId', i);
|
|
880
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
881
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/assessments/${assessmentId}`, updateFields);
|
|
882
|
+
returnData.push({ json: responseData });
|
|
883
|
+
}
|
|
884
|
+
if (operation === 'delete') {
|
|
885
|
+
const assessmentId = this.getNodeParameter('assessmentId', i);
|
|
886
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/assessments/${assessmentId}`);
|
|
887
|
+
returnData.push({ json: { success: true } });
|
|
888
|
+
}
|
|
889
|
+
if (operation === 'updateCompletionStatus') {
|
|
890
|
+
const assessmentId = this.getNodeParameter('assessmentId', i);
|
|
891
|
+
const isCompleted = this.getNodeParameter('isCompleted', i);
|
|
892
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/assessments/${assessmentId}/completion-status`, { is_completed: isCompleted });
|
|
893
|
+
returnData.push({ json: responseData });
|
|
894
|
+
}
|
|
895
|
+
if (operation === 'evaluate') {
|
|
896
|
+
const assessmentId = this.getNodeParameter('assessmentId', i);
|
|
897
|
+
const evaluationData = this.getNodeParameter('evaluationData', i);
|
|
898
|
+
const body = JSON.parse(evaluationData);
|
|
899
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/assessments/${assessmentId}/evaluate`, body);
|
|
900
|
+
returnData.push({ json: responseData });
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
// ==================== LIFECYCLE MANAGER: NOTE ====================
|
|
904
|
+
if (resource === 'note') {
|
|
905
|
+
if (operation === 'create') {
|
|
906
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
907
|
+
const title = this.getNodeParameter('title', i);
|
|
908
|
+
const content = this.getNodeParameter('content', i);
|
|
909
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
910
|
+
const body = {
|
|
911
|
+
client_id: clientId,
|
|
912
|
+
title,
|
|
913
|
+
content,
|
|
914
|
+
...additionalFields,
|
|
915
|
+
};
|
|
916
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/notes`, body);
|
|
917
|
+
returnData.push({ json: responseData });
|
|
918
|
+
}
|
|
919
|
+
if (operation === 'get') {
|
|
920
|
+
const noteId = this.getNodeParameter('noteId', i);
|
|
921
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/notes/${noteId}`);
|
|
922
|
+
returnData.push({ json: responseData });
|
|
923
|
+
}
|
|
924
|
+
if (operation === 'getAll') {
|
|
925
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
926
|
+
const filters = this.getNodeParameter('filters', i);
|
|
927
|
+
const qs = {};
|
|
928
|
+
if (!returnAll) {
|
|
929
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
930
|
+
}
|
|
931
|
+
if (filters.clientId) {
|
|
932
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
933
|
+
}
|
|
934
|
+
if (filters.isArchived !== undefined) {
|
|
935
|
+
qs['filter[is_archived]'] = `eq:${filters.isArchived}`;
|
|
936
|
+
}
|
|
937
|
+
if (filters.noteType) {
|
|
938
|
+
qs['filter[note_type]'] = `eq:${filters.noteType}`;
|
|
939
|
+
}
|
|
940
|
+
let responseData;
|
|
941
|
+
if (returnAll) {
|
|
942
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/notes`, {}, qs);
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
945
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/notes`, {}, qs);
|
|
946
|
+
responseData = response.data || [];
|
|
947
|
+
}
|
|
948
|
+
responseData.forEach((item) => {
|
|
949
|
+
returnData.push({ json: item });
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
if (operation === 'update') {
|
|
953
|
+
const noteId = this.getNodeParameter('noteId', i);
|
|
954
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
955
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/notes/${noteId}`, updateFields);
|
|
956
|
+
returnData.push({ json: responseData });
|
|
957
|
+
}
|
|
958
|
+
if (operation === 'toggleArchiveStatus') {
|
|
959
|
+
const noteId = this.getNodeParameter('noteId', i);
|
|
960
|
+
const isArchived = this.getNodeParameter('isArchived', i);
|
|
961
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/notes/${noteId}/archive-status`, { is_archived: isArchived });
|
|
962
|
+
returnData.push({ json: responseData });
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
// ==================== LIFECYCLE MANAGER: ASSESSMENT TEMPLATE ====================
|
|
966
|
+
if (resource === 'assessmentTemplate') {
|
|
967
|
+
if (operation === 'getAll') {
|
|
968
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
969
|
+
const qs = {};
|
|
970
|
+
if (!returnAll) {
|
|
971
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
972
|
+
}
|
|
973
|
+
let responseData;
|
|
974
|
+
if (returnAll) {
|
|
975
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/assessment-templates`, {}, qs);
|
|
976
|
+
}
|
|
977
|
+
else {
|
|
978
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/assessment-templates`, {}, qs);
|
|
979
|
+
responseData = response.data || [];
|
|
980
|
+
}
|
|
981
|
+
responseData.forEach((item) => {
|
|
982
|
+
returnData.push({ json: item });
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
// ==================== LIFECYCLE MANAGER: HARDWARE LIFECYCLE ====================
|
|
987
|
+
if (resource === 'hardwareLifecycle') {
|
|
988
|
+
if (operation === 'getAll') {
|
|
989
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
990
|
+
const filters = this.getNodeParameter('filters', i);
|
|
991
|
+
const qs = {};
|
|
992
|
+
if (!returnAll) {
|
|
993
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
994
|
+
}
|
|
995
|
+
if (filters.clientId) {
|
|
996
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
997
|
+
}
|
|
998
|
+
let responseData;
|
|
999
|
+
if (returnAll) {
|
|
1000
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/assets/hardware-lifecycles`, {}, qs);
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/assets/hardware-lifecycles`, {}, qs);
|
|
1004
|
+
responseData = response.data || [];
|
|
1005
|
+
}
|
|
1006
|
+
responseData.forEach((item) => {
|
|
1007
|
+
returnData.push({ json: item });
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
// ==================== LIFECYCLE MANAGER: CONTRACT ====================
|
|
1012
|
+
if (resource === 'lmContract') {
|
|
1013
|
+
if (operation === 'create') {
|
|
1014
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
1015
|
+
const name = this.getNodeParameter('name', i);
|
|
1016
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1017
|
+
const body = {
|
|
1018
|
+
client_id: clientId,
|
|
1019
|
+
name,
|
|
1020
|
+
...additionalFields,
|
|
1021
|
+
};
|
|
1022
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'POST', `${lmBasePath}/contracts`, body);
|
|
1023
|
+
returnData.push({ json: responseData });
|
|
1024
|
+
}
|
|
1025
|
+
if (operation === 'get') {
|
|
1026
|
+
const contractId = this.getNodeParameter('contractId', i);
|
|
1027
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/contracts/${contractId}`);
|
|
1028
|
+
returnData.push({ json: responseData });
|
|
1029
|
+
}
|
|
1030
|
+
if (operation === 'getAll') {
|
|
1031
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1032
|
+
const filters = this.getNodeParameter('filters', i);
|
|
1033
|
+
const qs = {};
|
|
1034
|
+
if (!returnAll) {
|
|
1035
|
+
qs.page_size = this.getNodeParameter('limit', i);
|
|
1036
|
+
}
|
|
1037
|
+
if (filters.clientId) {
|
|
1038
|
+
qs['filter[client_id]'] = `eq:${filters.clientId}`;
|
|
1039
|
+
}
|
|
1040
|
+
if (filters.contractType) {
|
|
1041
|
+
qs['filter[contract_type]'] = `eq:${filters.contractType}`;
|
|
1042
|
+
}
|
|
1043
|
+
if (filters.vendor) {
|
|
1044
|
+
qs['filter[vendor]'] = `eq:${filters.vendor}`;
|
|
1045
|
+
}
|
|
1046
|
+
let responseData;
|
|
1047
|
+
if (returnAll) {
|
|
1048
|
+
responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/contracts`, {}, qs);
|
|
1049
|
+
}
|
|
1050
|
+
else {
|
|
1051
|
+
const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/contracts`, {}, qs);
|
|
1052
|
+
responseData = response.data || [];
|
|
1053
|
+
}
|
|
1054
|
+
responseData.forEach((item) => {
|
|
1055
|
+
returnData.push({ json: item });
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
if (operation === 'update') {
|
|
1059
|
+
const contractId = this.getNodeParameter('contractId', i);
|
|
1060
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1061
|
+
const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'PUT', `${lmBasePath}/contracts/${contractId}`, updateFields);
|
|
1062
|
+
returnData.push({ json: responseData });
|
|
1063
|
+
}
|
|
1064
|
+
if (operation === 'delete') {
|
|
1065
|
+
const contractId = this.getNodeParameter('contractId', i);
|
|
1066
|
+
await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'DELETE', `${lmBasePath}/contracts/${contractId}`);
|
|
1067
|
+
returnData.push({ json: { success: true } });
|
|
1068
|
+
}
|
|
324
1069
|
}
|
|
325
1070
|
}
|
|
326
1071
|
catch (error) {
|