@joshuanode/n8n-nodes-scalepad 0.0.4 → 0.0.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.
Files changed (43) hide show
  1. package/README.md +73 -131
  2. package/dist/nodes/ScalePadCore/ScalePadCore.node.js +798 -11
  3. package/dist/nodes/ScalePadCore/descriptions/ActionItemDescription.d.ts +3 -0
  4. package/dist/nodes/ScalePadCore/descriptions/ActionItemDescription.js +306 -0
  5. package/dist/nodes/ScalePadCore/descriptions/AssessmentDescription.d.ts +3 -0
  6. package/dist/nodes/ScalePadCore/descriptions/AssessmentDescription.js +291 -0
  7. package/dist/nodes/ScalePadCore/descriptions/AssessmentTemplateDescription.d.ts +3 -0
  8. package/dist/nodes/ScalePadCore/descriptions/AssessmentTemplateDescription.js +59 -0
  9. package/dist/nodes/ScalePadCore/descriptions/ContractDescription.js +242 -21
  10. package/dist/nodes/ScalePadCore/descriptions/GoalDescription.d.ts +3 -0
  11. package/dist/nodes/ScalePadCore/descriptions/GoalDescription.js +468 -0
  12. package/dist/nodes/ScalePadCore/descriptions/HardwareLifecycleDescription.d.ts +3 -0
  13. package/dist/nodes/ScalePadCore/descriptions/HardwareLifecycleDescription.js +81 -0
  14. package/dist/nodes/ScalePadCore/descriptions/InitiativeDescription.d.ts +3 -0
  15. package/dist/nodes/ScalePadCore/descriptions/InitiativeDescription.js +565 -0
  16. package/dist/nodes/ScalePadCore/descriptions/LmContractDescription.d.ts +3 -0
  17. package/dist/nodes/ScalePadCore/descriptions/LmContractDescription.js +342 -0
  18. package/dist/nodes/ScalePadCore/descriptions/MeetingDescription.d.ts +3 -0
  19. package/dist/nodes/ScalePadCore/descriptions/MeetingDescription.js +501 -0
  20. package/dist/nodes/ScalePadCore/descriptions/NoteDescription.d.ts +3 -0
  21. package/dist/nodes/ScalePadCore/descriptions/NoteDescription.js +289 -0
  22. package/dist/nodes/ScalePadLifecycleManager/ScalePadLifecycleManager.node.d.ts +6 -0
  23. package/dist/nodes/ScalePadLifecycleManager/ScalePadLifecycleManager.node.js +837 -0
  24. package/dist/nodes/ScalePadLifecycleManager/descriptions/ActionItemDescription.d.ts +3 -0
  25. package/dist/nodes/ScalePadLifecycleManager/descriptions/ActionItemDescription.js +306 -0
  26. package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentDescription.d.ts +3 -0
  27. package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentDescription.js +291 -0
  28. package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentTemplateDescription.d.ts +3 -0
  29. package/dist/nodes/ScalePadLifecycleManager/descriptions/AssessmentTemplateDescription.js +59 -0
  30. package/dist/nodes/ScalePadLifecycleManager/descriptions/ContractDescription.d.ts +3 -0
  31. package/dist/nodes/ScalePadLifecycleManager/descriptions/ContractDescription.js +342 -0
  32. package/dist/nodes/ScalePadLifecycleManager/descriptions/GoalDescription.d.ts +3 -0
  33. package/dist/nodes/ScalePadLifecycleManager/descriptions/GoalDescription.js +468 -0
  34. package/dist/nodes/ScalePadLifecycleManager/descriptions/HardwareLifecycleDescription.d.ts +3 -0
  35. package/dist/nodes/ScalePadLifecycleManager/descriptions/HardwareLifecycleDescription.js +81 -0
  36. package/dist/nodes/ScalePadLifecycleManager/descriptions/InitiativeDescription.d.ts +3 -0
  37. package/dist/nodes/ScalePadLifecycleManager/descriptions/InitiativeDescription.js +565 -0
  38. package/dist/nodes/ScalePadLifecycleManager/descriptions/MeetingDescription.d.ts +3 -0
  39. package/dist/nodes/ScalePadLifecycleManager/descriptions/MeetingDescription.js +501 -0
  40. package/dist/nodes/ScalePadLifecycleManager/descriptions/NoteDescription.d.ts +3 -0
  41. package/dist/nodes/ScalePadLifecycleManager/descriptions/NoteDescription.js +289 -0
  42. package/dist/nodes/ScalePadLifecycleManager/scalepad.svg +17 -0
  43. package/package.json +1 -1
@@ -2,6 +2,7 @@
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");
@@ -10,10 +11,20 @@ const MemberDescription_1 = require("./descriptions/MemberDescription");
10
11
  const OpportunityDescription_1 = require("./descriptions/OpportunityDescription");
11
12
  const SaasDescription_1 = require("./descriptions/SaasDescription");
12
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");
13
24
  class ScalePadCore {
14
25
  constructor() {
15
26
  this.description = {
16
- displayName: 'ScalePad Core',
27
+ displayName: 'ScalePad',
17
28
  name: 'scalePadCore',
18
29
  icon: 'file:scalepad.svg',
19
30
  group: ['transform'],
@@ -21,7 +32,7 @@ class ScalePadCore {
21
32
  subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
22
33
  description: 'Interact with ScalePad Core API and Lifecycle Manager',
23
34
  defaults: {
24
- name: 'ScalePad Core',
35
+ name: 'ScalePad',
25
36
  },
26
37
  inputs: ['main'],
27
38
  outputs: ['main'],
@@ -45,41 +56,97 @@ class ScalePadCore {
45
56
  type: 'options',
46
57
  noDataExpression: true,
47
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
48
76
  {
49
77
  name: 'Client',
50
78
  value: 'client',
79
+ description: 'Core API: Client records',
51
80
  },
52
81
  {
53
82
  name: 'Contact',
54
83
  value: 'contact',
84
+ description: 'Core API: Contact records',
55
85
  },
56
86
  {
57
- name: 'Contract',
87
+ name: 'Contract (Core)',
58
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',
59
100
  },
60
101
  {
61
102
  name: 'Hardware Asset',
62
103
  value: 'hardwareAsset',
104
+ description: 'Core API: Hardware assets',
105
+ },
106
+ {
107
+ name: 'Hardware Lifecycle',
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',
63
120
  },
64
121
  {
65
122
  name: 'Member',
66
123
  value: 'member',
124
+ description: 'Core API: Team members',
125
+ },
126
+ {
127
+ name: 'Note',
128
+ value: 'note',
129
+ description: 'Lifecycle Manager: Client notes',
67
130
  },
68
131
  {
69
132
  name: 'Opportunity',
70
133
  value: 'opportunity',
134
+ description: 'Core API: Sales opportunities',
71
135
  },
72
136
  {
73
137
  name: 'SaaS',
74
138
  value: 'saas',
139
+ description: 'Core API: SaaS subscriptions',
75
140
  },
76
141
  {
77
142
  name: 'Ticket',
78
143
  value: 'ticket',
144
+ description: 'Core API: Service tickets',
79
145
  },
80
146
  ],
81
147
  default: 'client',
82
148
  },
149
+ // Core API operations and fields
83
150
  ...ClientDescription_1.clientOperations,
84
151
  ...ClientDescription_1.clientFields,
85
152
  ...ContactDescription_1.contactOperations,
@@ -96,6 +163,25 @@ class ScalePadCore {
96
163
  ...SaasDescription_1.saasFields,
97
164
  ...TicketDescription_1.ticketOperations,
98
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,
99
185
  ],
100
186
  };
101
187
  }
@@ -104,8 +190,10 @@ class ScalePadCore {
104
190
  const returnData = [];
105
191
  const resource = this.getNodeParameter('resource', 0);
106
192
  const operation = this.getNodeParameter('operation', 0);
193
+ const lmBasePath = '/lifecycle-manager/v1';
107
194
  for (let i = 0; i < items.length; i++) {
108
195
  try {
196
+ // ==================== CORE API: CLIENT ====================
109
197
  if (resource === 'client') {
110
198
  if (operation === 'get') {
111
199
  const clientId = this.getNodeParameter('clientId', i);
@@ -119,7 +207,6 @@ class ScalePadCore {
119
207
  if (!returnAll) {
120
208
  qs.page_size = this.getNodeParameter('limit', i);
121
209
  }
122
- // Handle filters
123
210
  if (additionalFields.filter) {
124
211
  const filterData = additionalFields.filter;
125
212
  if (filterData.filters && Array.isArray(filterData.filters)) {
@@ -131,7 +218,6 @@ class ScalePadCore {
131
218
  }
132
219
  }
133
220
  }
134
- // Handle sorting
135
221
  if (additionalFields.sort) {
136
222
  const sortData = additionalFields.sort;
137
223
  if (sortData.sortFields) {
@@ -154,6 +240,7 @@ class ScalePadCore {
154
240
  });
155
241
  }
156
242
  }
243
+ // ==================== CORE API: CONTACT ====================
157
244
  if (resource === 'contact') {
158
245
  if (operation === 'get') {
159
246
  const contactId = this.getNodeParameter('contactId', i);
@@ -186,6 +273,7 @@ class ScalePadCore {
186
273
  });
187
274
  }
188
275
  }
276
+ // ==================== CORE API: TICKET ====================
189
277
  if (resource === 'ticket') {
190
278
  if (operation === 'get') {
191
279
  const ticketId = this.getNodeParameter('ticketId', i);
@@ -221,16 +309,16 @@ class ScalePadCore {
221
309
  });
222
310
  }
223
311
  }
224
- // Resources using the shared resourceMap pattern
225
- const resourceMap = {
312
+ // ==================== CORE API: SHARED RESOURCES ====================
313
+ const coreResourceMap = {
226
314
  contract: 'service/contracts',
227
315
  hardwareAsset: 'assets/hardware',
228
316
  member: 'members',
229
317
  opportunity: 'opportunities',
230
318
  saas: 'assets/saas',
231
319
  };
232
- if (Object.keys(resourceMap).includes(resource)) {
233
- const endpoint = resourceMap[resource];
320
+ if (Object.keys(coreResourceMap).includes(resource)) {
321
+ const endpoint = coreResourceMap[resource];
234
322
  const idParamMap = {
235
323
  contract: 'contractId',
236
324
  hardwareAsset: 'assetId',
@@ -250,14 +338,12 @@ class ScalePadCore {
250
338
  if (!returnAll) {
251
339
  qs.page_size = this.getNodeParameter('limit', i);
252
340
  }
253
- // Apply common filters
254
341
  if (additionalFields.clientId) {
255
342
  qs['filter[client_id]'] = `eq:${additionalFields.clientId}`;
256
343
  }
257
344
  if (additionalFields.status) {
258
345
  qs['filter[status]'] = `eq:${additionalFields.status}`;
259
346
  }
260
- // Apply resource-specific filters
261
347
  if (resource === 'hardwareAsset' && additionalFields.assetType) {
262
348
  qs['filter[asset_type]'] = `eq:${additionalFields.assetType}`;
263
349
  }
@@ -280,6 +366,707 @@ class ScalePadCore {
280
366
  });
281
367
  }
282
368
  }
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
+ }
385
+ if (operation === 'get') {
386
+ const meetingId = this.getNodeParameter('meetingId', i);
387
+ const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/meetings/${meetingId}`);
388
+ returnData.push({ json: responseData });
389
+ }
390
+ if (operation === 'getAll') {
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);
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);
538
+ const qs = {};
539
+ if (!returnAll) {
540
+ qs.page_size = this.getNodeParameter('limit', i);
541
+ }
542
+ if (filters.clientId) {
543
+ qs['filter[client_id]'] = `eq:${filters.clientId}`;
544
+ }
545
+ if (filters.status) {
546
+ qs['filter[status]'] = `eq:${filters.status}`;
547
+ }
548
+ if (filters.priority) {
549
+ qs['filter[priority]'] = `eq:${filters.priority}`;
550
+ }
551
+ let responseData;
552
+ if (returnAll) {
553
+ responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/initiatives`, {}, qs);
554
+ }
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}`;
689
+ }
690
+ let responseData;
691
+ if (returnAll) {
692
+ responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', `${lmBasePath}/goals`, {}, qs);
693
+ }
694
+ else {
695
+ const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `${lmBasePath}/goals`, {}, qs);
696
+ responseData = response.data || [];
697
+ }
698
+ responseData.forEach((item) => {
699
+ returnData.push({ json: item });
700
+ });
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
+ }
1069
+ }
283
1070
  }
284
1071
  catch (error) {
285
1072
  if (this.continueOnFail()) {