@joshuanode/n8n-nodes-scalepad 0.0.3 → 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.
|
@@ -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,
|
|
@@ -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') {
|
|
@@ -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.page_size = 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/
|
|
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
|
-
//
|
|
224
|
+
// Resources using the shared resourceMap pattern
|
|
267
225
|
const resourceMap = {
|
|
268
|
-
contract: 'contracts',
|
|
269
|
-
hardwareAsset: 'hardware
|
|
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];
|
package/package.json
CHANGED
|
@@ -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
|
-
];
|