@joshuanode/n8n-nodes-scalepad 0.0.2 → 0.0.4

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.
@@ -50,9 +50,6 @@ class ScalePadCoreApi {
50
50
  baseURL: '={{$credentials.environment === "production" ? "https://api.scalepad.com" : "https://api-sandbox.scalepad.com"}}',
51
51
  url: '/core/v1/clients',
52
52
  method: 'GET',
53
- qs: {
54
- limit: 1,
55
- },
56
53
  },
57
54
  };
58
55
  }
@@ -6,7 +6,6 @@ const ClientDescription_1 = require("./descriptions/ClientDescription");
6
6
  const ContactDescription_1 = require("./descriptions/ContactDescription");
7
7
  const ContractDescription_1 = require("./descriptions/ContractDescription");
8
8
  const HardwareAssetDescription_1 = require("./descriptions/HardwareAssetDescription");
9
- const HardwareLifecycleDescription_1 = require("./descriptions/HardwareLifecycleDescription");
10
9
  const MemberDescription_1 = require("./descriptions/MemberDescription");
11
10
  const OpportunityDescription_1 = require("./descriptions/OpportunityDescription");
12
11
  const SaasDescription_1 = require("./descriptions/SaasDescription");
@@ -62,10 +61,6 @@ class ScalePadCore {
62
61
  name: 'Hardware Asset',
63
62
  value: 'hardwareAsset',
64
63
  },
65
- {
66
- name: 'Hardware Lifecycle',
67
- value: 'hardwareLifecycle',
68
- },
69
64
  {
70
65
  name: 'Member',
71
66
  value: 'member',
@@ -93,8 +88,6 @@ class ScalePadCore {
93
88
  ...ContractDescription_1.contractFields,
94
89
  ...HardwareAssetDescription_1.hardwareAssetOperations,
95
90
  ...HardwareAssetDescription_1.hardwareAssetFields,
96
- ...HardwareLifecycleDescription_1.hardwareLifecycleOperations,
97
- ...HardwareLifecycleDescription_1.hardwareLifecycleFields,
98
91
  ...MemberDescription_1.memberOperations,
99
92
  ...MemberDescription_1.memberFields,
100
93
  ...OpportunityDescription_1.opportunityOperations,
@@ -124,7 +117,7 @@ class ScalePadCore {
124
117
  const additionalFields = this.getNodeParameter('additionalFields', i);
125
118
  const qs = {};
126
119
  if (!returnAll) {
127
- qs.limit = this.getNodeParameter('limit', i);
120
+ qs.page_size = this.getNodeParameter('limit', i);
128
121
  }
129
122
  // Handle filters
130
123
  if (additionalFields.filter) {
@@ -172,7 +165,7 @@ class ScalePadCore {
172
165
  const additionalFields = this.getNodeParameter('additionalFields', i);
173
166
  const qs = {};
174
167
  if (!returnAll) {
175
- qs.limit = this.getNodeParameter('limit', i);
168
+ qs.page_size = this.getNodeParameter('limit', i);
176
169
  }
177
170
  if (additionalFields.clientId) {
178
171
  qs['filter[client_id]'] = `eq:${additionalFields.clientId}`;
@@ -196,7 +189,7 @@ class ScalePadCore {
196
189
  if (resource === 'ticket') {
197
190
  if (operation === 'get') {
198
191
  const ticketId = this.getNodeParameter('ticketId', i);
199
- const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1/tickets/${ticketId}`);
192
+ const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1/service/tickets/${ticketId}`);
200
193
  returnData.push({ json: responseData });
201
194
  }
202
195
  if (operation === 'getAll') {
@@ -204,7 +197,7 @@ class ScalePadCore {
204
197
  const additionalFields = this.getNodeParameter('additionalFields', i);
205
198
  const qs = {};
206
199
  if (!returnAll) {
207
- qs.limit = this.getNodeParameter('limit', i);
200
+ qs.page_size = this.getNodeParameter('limit', i);
208
201
  }
209
202
  if (additionalFields.clientId) {
210
203
  qs['filter[client_id]'] = `eq:${additionalFields.clientId}`;
@@ -217,45 +210,10 @@ class ScalePadCore {
217
210
  }
218
211
  let responseData;
219
212
  if (returnAll) {
220
- responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', '/core/v1/tickets', {}, qs);
221
- }
222
- else {
223
- const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', '/core/v1/tickets', {}, qs);
224
- responseData = response.data || [];
225
- }
226
- responseData.forEach((item) => {
227
- returnData.push({ json: item });
228
- });
229
- }
230
- }
231
- if (resource === 'hardwareLifecycle') {
232
- if (operation === 'get') {
233
- const recordId = this.getNodeParameter('recordId', i);
234
- const responseData = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', `/core/v1/hardware-lifecycle/${recordId}`);
235
- returnData.push({ json: responseData });
236
- }
237
- if (operation === 'getAll') {
238
- const returnAll = this.getNodeParameter('returnAll', i);
239
- const additionalFields = this.getNodeParameter('additionalFields', i);
240
- const qs = {};
241
- if (!returnAll) {
242
- qs.limit = this.getNodeParameter('limit', i);
243
- }
244
- if (additionalFields.clientId) {
245
- qs['filter[client_id]'] = `eq:${additionalFields.clientId}`;
246
- }
247
- if (additionalFields.warrantyStatus) {
248
- qs['filter[warranty_status]'] = `eq:${additionalFields.warrantyStatus}`;
249
- }
250
- if (additionalFields.eolStatus) {
251
- qs['filter[eol_status]'] = `eq:${additionalFields.eolStatus}`;
252
- }
253
- let responseData;
254
- if (returnAll) {
255
- responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', '/core/v1/hardware-lifecycle', {}, qs);
213
+ responseData = await GenericFunctions_1.scalePadCoreApiRequestAllItems.call(this, 'GET', '/core/v1/service/tickets', {}, qs);
256
214
  }
257
215
  else {
258
- const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', '/core/v1/hardware-lifecycle', {}, qs);
216
+ const response = await GenericFunctions_1.scalePadCoreApiRequest.call(this, 'GET', '/core/v1/service/tickets', {}, qs);
259
217
  responseData = response.data || [];
260
218
  }
261
219
  responseData.forEach((item) => {
@@ -263,13 +221,13 @@ class ScalePadCore {
263
221
  });
264
222
  }
265
223
  }
266
- // Similar implementations for other resources
224
+ // Resources using the shared resourceMap pattern
267
225
  const resourceMap = {
268
- contract: 'contracts',
269
- hardwareAsset: 'hardware-assets',
226
+ contract: 'service/contracts',
227
+ hardwareAsset: 'assets/hardware',
270
228
  member: 'members',
271
229
  opportunity: 'opportunities',
272
- saas: 'saas',
230
+ saas: 'assets/saas',
273
231
  };
274
232
  if (Object.keys(resourceMap).includes(resource)) {
275
233
  const endpoint = resourceMap[resource];
@@ -290,7 +248,7 @@ class ScalePadCore {
290
248
  const additionalFields = this.getNodeParameter('additionalFields', i);
291
249
  const qs = {};
292
250
  if (!returnAll) {
293
- qs.limit = this.getNodeParameter('limit', i);
251
+ qs.page_size = this.getNodeParameter('limit', i);
294
252
  }
295
253
  // Apply common filters
296
254
  if (additionalFields.clientId) {
@@ -53,13 +53,12 @@ async function scalePadCoreApiRequest(method, endpoint, body = {}, qs = {}) {
53
53
  * Make an authenticated API request to ScalePad Core API with automatic pagination
54
54
  */
55
55
  async function scalePadCoreApiRequestAllItems(method, endpoint, body = {}, qs = {}) {
56
- var _a, _b;
57
56
  const returnData = [];
58
57
  let cursor;
59
58
  let hasMore = true;
60
- // Set default limit if not specified
61
- if (!qs.limit) {
62
- qs.limit = 200; // Maximum allowed by API
59
+ // Set default page size if not specified
60
+ if (!qs.page_size) {
61
+ qs.page_size = 200; // Maximum allowed by API
63
62
  }
64
63
  while (hasMore) {
65
64
  if (cursor) {
@@ -70,7 +69,7 @@ async function scalePadCoreApiRequestAllItems(method, endpoint, body = {}, qs =
70
69
  returnData.push(...response.data);
71
70
  }
72
71
  // Check for cursor-based pagination
73
- cursor = (_b = (_a = response.meta) === null || _a === void 0 ? void 0 : _a.pagination) === null || _b === void 0 ? void 0 : _b.cursor;
72
+ cursor = response.next_cursor;
74
73
  hasMore = !!cursor;
75
74
  // Safety check to prevent infinite loops
76
75
  if (returnData.length > 10000) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshuanode/n8n-nodes-scalepad",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "n8n community node for ScalePad Core API and Lifecycle Manager",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -1,3 +0,0 @@
1
- import { INodeProperties } from 'n8n-workflow';
2
- export declare const hardwareLifecycleOperations: INodeProperties[];
3
- export declare const hardwareLifecycleFields: INodeProperties[];
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hardwareLifecycleFields = exports.hardwareLifecycleOperations = void 0;
4
- exports.hardwareLifecycleOperations = [
5
- {
6
- displayName: 'Operation',
7
- name: 'operation',
8
- type: 'options',
9
- noDataExpression: true,
10
- displayOptions: {
11
- show: {
12
- resource: ['hardwareLifecycle'],
13
- },
14
- },
15
- options: [
16
- {
17
- name: 'Get',
18
- value: 'get',
19
- description: 'Get a hardware lifecycle record by ID',
20
- action: 'Get a hardware lifecycle record',
21
- },
22
- {
23
- name: 'Get Many',
24
- value: 'getAll',
25
- description: 'Get many hardware lifecycle records',
26
- action: 'Get many hardware lifecycle records',
27
- },
28
- ],
29
- default: 'getAll',
30
- },
31
- ];
32
- exports.hardwareLifecycleFields = [
33
- {
34
- displayName: 'Record ID',
35
- name: 'recordId',
36
- type: 'string',
37
- required: true,
38
- displayOptions: {
39
- show: {
40
- resource: ['hardwareLifecycle'],
41
- operation: ['get'],
42
- },
43
- },
44
- default: '',
45
- description: 'The ID of the hardware lifecycle record to retrieve',
46
- },
47
- {
48
- displayName: 'Return All',
49
- name: 'returnAll',
50
- type: 'boolean',
51
- displayOptions: {
52
- show: {
53
- resource: ['hardwareLifecycle'],
54
- operation: ['getAll'],
55
- },
56
- },
57
- default: false,
58
- description: 'Whether to return all results or only up to a given limit',
59
- },
60
- {
61
- displayName: 'Limit',
62
- name: 'limit',
63
- type: 'number',
64
- displayOptions: {
65
- show: {
66
- resource: ['hardwareLifecycle'],
67
- operation: ['getAll'],
68
- returnAll: [false],
69
- },
70
- },
71
- typeOptions: {
72
- minValue: 1,
73
- maxValue: 200,
74
- },
75
- default: 50,
76
- description: 'Max number of results to return',
77
- },
78
- {
79
- displayName: 'Additional Fields',
80
- name: 'additionalFields',
81
- type: 'collection',
82
- placeholder: 'Add Field',
83
- default: {},
84
- displayOptions: {
85
- show: {
86
- resource: ['hardwareLifecycle'],
87
- operation: ['getAll'],
88
- },
89
- },
90
- options: [
91
- {
92
- displayName: 'Client ID',
93
- name: 'clientId',
94
- type: 'string',
95
- default: '',
96
- description: 'Filter by client ID',
97
- },
98
- {
99
- displayName: 'Warranty Status',
100
- name: 'warrantyStatus',
101
- type: 'options',
102
- options: [
103
- {
104
- name: 'Active',
105
- value: 'active',
106
- },
107
- {
108
- name: 'Expired',
109
- value: 'expired',
110
- },
111
- {
112
- name: 'Expiring Soon',
113
- value: 'expiring_soon',
114
- },
115
- ],
116
- default: '',
117
- description: 'Filter by warranty status',
118
- },
119
- {
120
- displayName: 'End of Life Status',
121
- name: 'eolStatus',
122
- type: 'options',
123
- options: [
124
- {
125
- name: 'Active',
126
- value: 'active',
127
- },
128
- {
129
- name: 'End of Life',
130
- value: 'eol',
131
- },
132
- {
133
- name: 'Approaching EOL',
134
- value: 'approaching_eol',
135
- },
136
- ],
137
- default: '',
138
- description: 'Filter by end of life status',
139
- },
140
- ],
141
- },
142
- ];