n8n-nodes-arubaclearpass 1.0.0

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 (80) hide show
  1. package/dist/credentials/ClearPassApi.credentials.d.ts +7 -0
  2. package/dist/credentials/ClearPassApi.credentials.js +69 -0
  3. package/dist/credentials/ClearPassOAuth2Api.credentials.d.ts +10 -0
  4. package/dist/credentials/ClearPassOAuth2Api.credentials.js +55 -0
  5. package/dist/nodes/ArubaCentral/clearpass.svg +4 -0
  6. package/dist/nodes/ArubaClearPass/ArubaClearPass.node.d.ts +5 -0
  7. package/dist/nodes/ArubaClearPass/ArubaClearPass.node.js +173 -0
  8. package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/EnforcementProfile.descriptions.d.ts +4 -0
  9. package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/EnforcementProfile.descriptions.js +361 -0
  10. package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/index.d.ts +2 -0
  11. package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/index.js +11 -0
  12. package/dist/nodes/ArubaClearPass/descriptions/Identities/ApiClient.descriptions.d.ts +0 -0
  13. package/dist/nodes/ArubaClearPass/descriptions/Identities/ApiClient.descriptions.js +0 -0
  14. package/dist/nodes/ArubaClearPass/descriptions/Identities/DenyListedUsers.descriptions.d.ts +0 -0
  15. package/dist/nodes/ArubaClearPass/descriptions/Identities/DenyListedUsers.descriptions.js +0 -0
  16. package/dist/nodes/ArubaClearPass/descriptions/Identities/Device.descriptions.d.ts +4 -0
  17. package/dist/nodes/ArubaClearPass/descriptions/Identities/Device.descriptions.js +668 -0
  18. package/dist/nodes/ArubaClearPass/descriptions/Identities/Endpoint.descriptions.d.ts +4 -0
  19. package/dist/nodes/ArubaClearPass/descriptions/Identities/Endpoint.descriptions.js +255 -0
  20. package/dist/nodes/ArubaClearPass/descriptions/Identities/ExternalAccount.descriptions.d.ts +0 -0
  21. package/dist/nodes/ArubaClearPass/descriptions/Identities/ExternalAccount.descriptions.js +0 -0
  22. package/dist/nodes/ArubaClearPass/descriptions/Identities/GuestUser.descriptions.d.ts +4 -0
  23. package/dist/nodes/ArubaClearPass/descriptions/Identities/GuestUser.descriptions.js +477 -0
  24. package/dist/nodes/ArubaClearPass/descriptions/Identities/LocalUser.descriptions.d.ts +4 -0
  25. package/dist/nodes/ArubaClearPass/descriptions/Identities/LocalUser.descriptions.js +384 -0
  26. package/dist/nodes/ArubaClearPass/descriptions/Identities/StaticHostList.descriptions.d.ts +0 -0
  27. package/dist/nodes/ArubaClearPass/descriptions/Identities/StaticHostList.descriptions.js +0 -0
  28. package/dist/nodes/ArubaClearPass/descriptions/Identities/index.d.ts +2 -0
  29. package/dist/nodes/ArubaClearPass/descriptions/Identities/index.js +23 -0
  30. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/EnforcementPolicy.descriptions.d.ts +4 -0
  31. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/EnforcementPolicy.descriptions.js +432 -0
  32. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/Role.descriptions.d.ts +4 -0
  33. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/Role.descriptions.js +263 -0
  34. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/RoleMapping.descriptions.d.ts +4 -0
  35. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/RoleMapping.descriptions.js +365 -0
  36. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/index.d.ts +2 -0
  37. package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/index.js +19 -0
  38. package/dist/nodes/ArubaClearPass/helpers/apiRequest.d.ts +9 -0
  39. package/dist/nodes/ArubaClearPass/helpers/apiRequest.js +72 -0
  40. package/dist/nodes/ArubaClearPass/helpers/errorHandler.d.ts +4 -0
  41. package/dist/nodes/ArubaClearPass/helpers/errorHandler.js +31 -0
  42. package/dist/nodes/ArubaClearPass/helpers/executeOperation.d.ts +5 -0
  43. package/dist/nodes/ArubaClearPass/helpers/executeOperation.js +164 -0
  44. package/dist/nodes/ArubaClearPass/helpers/responseFormatter.d.ts +5 -0
  45. package/dist/nodes/ArubaClearPass/helpers/responseFormatter.js +17 -0
  46. package/dist/nodes/ArubaClearPass/helpers/tokenManager.d.ts +5 -0
  47. package/dist/nodes/ArubaClearPass/helpers/tokenManager.js +63 -0
  48. package/dist/nodes/ArubaClearPass/methods/EnforcementProfile/EnforcementProfile.methods.d.ts +41 -0
  49. package/dist/nodes/ArubaClearPass/methods/EnforcementProfile/EnforcementProfile.methods.js +395 -0
  50. package/dist/nodes/ArubaClearPass/methods/Identities/Device.methods.d.ts +41 -0
  51. package/dist/nodes/ArubaClearPass/methods/Identities/Device.methods.js +409 -0
  52. package/dist/nodes/ArubaClearPass/methods/Identities/Endpoint.methods.d.ts +33 -0
  53. package/dist/nodes/ArubaClearPass/methods/Identities/Endpoint.methods.js +212 -0
  54. package/dist/nodes/ArubaClearPass/methods/Identities/GuestUser.methods.d.ts +41 -0
  55. package/dist/nodes/ArubaClearPass/methods/Identities/GuestUser.methods.js +589 -0
  56. package/dist/nodes/ArubaClearPass/methods/Identities/LocalUser.methods.d.ts +41 -0
  57. package/dist/nodes/ArubaClearPass/methods/Identities/LocalUser.methods.js +407 -0
  58. package/dist/nodes/ArubaClearPass/methods/PolicyElements/EnforcementPolicy.methods.d.ts +41 -0
  59. package/dist/nodes/ArubaClearPass/methods/PolicyElements/EnforcementPolicy.methods.js +361 -0
  60. package/dist/nodes/ArubaClearPass/methods/PolicyElements/Role.methods.d.ts +41 -0
  61. package/dist/nodes/ArubaClearPass/methods/PolicyElements/Role.methods.js +298 -0
  62. package/dist/nodes/ArubaClearPass/methods/PolicyElements/RoleMapping.methods.d.ts +41 -0
  63. package/dist/nodes/ArubaClearPass/methods/PolicyElements/RoleMapping.methods.js +358 -0
  64. package/dist/nodes/ArubaClearPass/types/EnforcementProfile/EnforcementProfile.types.d.ts +131 -0
  65. package/dist/nodes/ArubaClearPass/types/EnforcementProfile/EnforcementProfile.types.js +2 -0
  66. package/dist/nodes/ArubaClearPass/types/Identities/Device.types.d.ts +55 -0
  67. package/dist/nodes/ArubaClearPass/types/Identities/Device.types.js +2 -0
  68. package/dist/nodes/ArubaClearPass/types/Identities/Endpoint.types.d.ts +12 -0
  69. package/dist/nodes/ArubaClearPass/types/Identities/Endpoint.types.js +2 -0
  70. package/dist/nodes/ArubaClearPass/types/Identities/GuestUser.types.d.ts +31 -0
  71. package/dist/nodes/ArubaClearPass/types/Identities/GuestUser.types.js +2 -0
  72. package/dist/nodes/ArubaClearPass/types/Identities/LocalUser.types.d.ts +51 -0
  73. package/dist/nodes/ArubaClearPass/types/Identities/LocalUser.types.js +2 -0
  74. package/dist/nodes/ArubaClearPass/types/PolicyElements/EnforcementPolicy.types.d.ts +37 -0
  75. package/dist/nodes/ArubaClearPass/types/PolicyElements/EnforcementPolicy.types.js +2 -0
  76. package/dist/nodes/ArubaClearPass/types/PolicyElements/Role.types.d.ts +15 -0
  77. package/dist/nodes/ArubaClearPass/types/PolicyElements/Role.types.js +2 -0
  78. package/dist/nodes/ArubaClearPass/types/PolicyElements/RoleMapping.types.d.ts +63 -0
  79. package/dist/nodes/ArubaClearPass/types/PolicyElements/RoleMapping.types.js +2 -0
  80. package/package.json +72 -0
@@ -0,0 +1,409 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listDevices = listDevices;
4
+ exports.getDevice = getDevice;
5
+ exports.getDeviceByMac = getDeviceByMac;
6
+ exports.createDevice = createDevice;
7
+ exports.updateDevice = updateDevice;
8
+ exports.updateDeviceByMac = updateDeviceByMac;
9
+ exports.replaceDevice = replaceDevice;
10
+ exports.replaceDeviceByMac = replaceDeviceByMac;
11
+ exports.deleteDevice = deleteDevice;
12
+ exports.deleteDeviceByMac = deleteDeviceByMac;
13
+ // methods/Identities/Device.methods.ts
14
+ const n8n_workflow_1 = require("n8n-workflow");
15
+ const apiRequest_1 = require("../../helpers/apiRequest");
16
+ const responseFormatter_1 = require("../../helpers/responseFormatter");
17
+ /**
18
+ * List all device accounts
19
+ */
20
+ async function listDevices() {
21
+ try {
22
+ const returnAll = this.getNodeParameter('returnAll', 0);
23
+ const filters = this.getNodeParameter('filters', 0, {});
24
+ const endpoint = '/device';
25
+ let responseData;
26
+ if (returnAll) {
27
+ responseData = await apiRequest_1.apiRequestAllItems.call(this, 'GET', endpoint, {}, filters);
28
+ }
29
+ else {
30
+ const limit = this.getNodeParameter('limit', 0);
31
+ if (!filters.limit) {
32
+ filters.limit = limit;
33
+ }
34
+ responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, filters);
35
+ }
36
+ return responseFormatter_1.formatResponse.call(this, responseData);
37
+ }
38
+ catch (error) {
39
+ const errorObject = {};
40
+ if (error instanceof Error) {
41
+ errorObject.message = error.message;
42
+ if (error.stack) {
43
+ errorObject.stackTrace = error.stack;
44
+ }
45
+ }
46
+ else {
47
+ errorObject.message = 'Unknown error in listDevices';
48
+ }
49
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
50
+ }
51
+ }
52
+ /**
53
+ * Get a device account by ID
54
+ */
55
+ async function getDevice() {
56
+ try {
57
+ const deviceId = this.getNodeParameter('deviceId', 0);
58
+ const endpoint = `/device/${deviceId}`;
59
+ const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
60
+ return responseFormatter_1.formatResponse.call(this, responseData);
61
+ }
62
+ catch (error) {
63
+ const errorObject = {};
64
+ if (error instanceof Error) {
65
+ errorObject.message = error.message;
66
+ if (error.stack) {
67
+ errorObject.stackTrace = error.stack;
68
+ }
69
+ }
70
+ else {
71
+ errorObject.message = 'Unknown error in getDevice';
72
+ }
73
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
74
+ }
75
+ }
76
+ /**
77
+ * Get a device account by MAC address
78
+ */
79
+ async function getDeviceByMac() {
80
+ try {
81
+ const macAddress = this.getNodeParameter('macAddress', 0);
82
+ const endpoint = `/device/mac/${macAddress}`;
83
+ const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
84
+ return responseFormatter_1.formatResponse.call(this, responseData);
85
+ }
86
+ catch (error) {
87
+ const errorObject = {};
88
+ if (error instanceof Error) {
89
+ errorObject.message = error.message;
90
+ if (error.stack) {
91
+ errorObject.stackTrace = error.stack;
92
+ }
93
+ }
94
+ else {
95
+ errorObject.message = 'Unknown error in getDeviceByMac';
96
+ }
97
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
98
+ }
99
+ }
100
+ /**
101
+ * Create a new device account
102
+ */
103
+ async function createDevice() {
104
+ try {
105
+ const body = {};
106
+ // Add required fields
107
+ body.mac = this.getNodeParameter('mac', 0);
108
+ body.role_id = this.getNodeParameter('role_id', 0);
109
+ // Add optional fields
110
+ const additionalFields = this.getNodeParameter('additionalFields', 0, {});
111
+ Object.assign(body, additionalFields);
112
+ // Add custom fields if provided
113
+ if (additionalFields.customFields) {
114
+ try {
115
+ const customFields = JSON.parse(additionalFields.customFields);
116
+ delete additionalFields.customFields; // Remove from body as we'll add the parsed fields directly
117
+ // Merge custom fields with the body
118
+ Object.entries(customFields).forEach(([key, value]) => {
119
+ body[key] = value;
120
+ });
121
+ }
122
+ catch (parseError) {
123
+ throw new Error(`Invalid JSON in customFields: ${parseError.message}`);
124
+ }
125
+ }
126
+ // Get options for query parameters
127
+ const options = this.getNodeParameter('options', 0, {});
128
+ const queryParams = {};
129
+ if (options.changeOfAuthorization !== undefined) {
130
+ queryParams.change_of_authorization = options.changeOfAuthorization;
131
+ }
132
+ const endpoint = '/device';
133
+ const responseData = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, queryParams);
134
+ return responseFormatter_1.formatResponse.call(this, responseData);
135
+ }
136
+ catch (error) {
137
+ const errorObject = {};
138
+ if (error instanceof Error) {
139
+ errorObject.message = error.message;
140
+ if (error.stack) {
141
+ errorObject.stackTrace = error.stack;
142
+ }
143
+ }
144
+ else {
145
+ errorObject.message = 'Unknown error in createDevice';
146
+ }
147
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
148
+ }
149
+ }
150
+ /**
151
+ * Update a device account by ID
152
+ */
153
+ async function updateDevice() {
154
+ try {
155
+ const deviceId = this.getNodeParameter('deviceId', 0);
156
+ const updateFields = this.getNodeParameter('updateFields', 0, {});
157
+ if (!Object.keys(updateFields).length) {
158
+ throw new Error('Please specify at least one field to update');
159
+ }
160
+ const body = { ...updateFields };
161
+ // Handle custom fields if provided
162
+ if (updateFields.customFields) {
163
+ try {
164
+ const customFields = JSON.parse(updateFields.customFields);
165
+ delete body.customFields; // Remove from body as we'll add the parsed fields directly
166
+ // Merge custom fields with the body
167
+ Object.entries(customFields).forEach(([key, value]) => {
168
+ body[key] = value;
169
+ });
170
+ }
171
+ catch (parseError) {
172
+ throw new Error(`Invalid JSON in customFields: ${parseError.message}`);
173
+ }
174
+ }
175
+ // Get options for query parameters
176
+ const options = this.getNodeParameter('options', 0, {});
177
+ const queryParams = {};
178
+ if (options.changeOfAuthorization !== undefined) {
179
+ queryParams.change_of_authorization = options.changeOfAuthorization;
180
+ }
181
+ const endpoint = `/device/${deviceId}`;
182
+ const responseData = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, queryParams);
183
+ return responseFormatter_1.formatResponse.call(this, responseData);
184
+ }
185
+ catch (error) {
186
+ const errorObject = {};
187
+ if (error instanceof Error) {
188
+ errorObject.message = error.message;
189
+ if (error.stack) {
190
+ errorObject.stackTrace = error.stack;
191
+ }
192
+ }
193
+ else {
194
+ errorObject.message = 'Unknown error in updateDevice';
195
+ }
196
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
197
+ }
198
+ }
199
+ /**
200
+ * Update a device account by MAC address
201
+ */
202
+ async function updateDeviceByMac() {
203
+ try {
204
+ const macAddress = this.getNodeParameter('macAddress', 0);
205
+ const updateFields = this.getNodeParameter('updateFields', 0, {});
206
+ if (!Object.keys(updateFields).length) {
207
+ throw new Error('Please specify at least one field to update');
208
+ }
209
+ const body = { ...updateFields };
210
+ // Handle custom fields if provided
211
+ if (updateFields.customFields) {
212
+ try {
213
+ const customFields = JSON.parse(updateFields.customFields);
214
+ delete body.customFields; // Remove from body as we'll add the parsed fields directly
215
+ // Merge custom fields with the body
216
+ Object.entries(customFields).forEach(([key, value]) => {
217
+ body[key] = value;
218
+ });
219
+ }
220
+ catch (parseError) {
221
+ throw new Error(`Invalid JSON in customFields: ${parseError.message}`);
222
+ }
223
+ }
224
+ // Get options for query parameters
225
+ const options = this.getNodeParameter('options', 0, {});
226
+ const queryParams = {};
227
+ if (options.changeOfAuthorization !== undefined) {
228
+ queryParams.change_of_authorization = options.changeOfAuthorization;
229
+ }
230
+ const endpoint = `/device/mac/${macAddress}`;
231
+ const responseData = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, queryParams);
232
+ return responseFormatter_1.formatResponse.call(this, responseData);
233
+ }
234
+ catch (error) {
235
+ const errorObject = {};
236
+ if (error instanceof Error) {
237
+ errorObject.message = error.message;
238
+ if (error.stack) {
239
+ errorObject.stackTrace = error.stack;
240
+ }
241
+ }
242
+ else {
243
+ errorObject.message = 'Unknown error in updateDeviceByMac';
244
+ }
245
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
246
+ }
247
+ }
248
+ /**
249
+ * Replace a device account by ID
250
+ */
251
+ async function replaceDevice() {
252
+ try {
253
+ const deviceId = this.getNodeParameter('deviceId', 0);
254
+ const body = {};
255
+ // Add required fields
256
+ body.mac = this.getNodeParameter('mac', 0);
257
+ body.role_id = this.getNodeParameter('role_id', 0);
258
+ // Add optional fields
259
+ const additionalFields = this.getNodeParameter('additionalFields', 0, {});
260
+ Object.assign(body, additionalFields);
261
+ // Add custom fields if provided
262
+ if (additionalFields.customFields) {
263
+ try {
264
+ const customFields = JSON.parse(additionalFields.customFields);
265
+ delete body.customFields; // Remove from body as we'll add the parsed fields directly
266
+ // Merge custom fields with the body
267
+ Object.entries(customFields).forEach(([key, value]) => {
268
+ body[key] = value;
269
+ });
270
+ }
271
+ catch (parseError) {
272
+ throw new Error(`Invalid JSON in customFields: ${parseError.message}`);
273
+ }
274
+ }
275
+ // Get options for query parameters
276
+ const options = this.getNodeParameter('options', 0, {});
277
+ const queryParams = {};
278
+ if (options.changeOfAuthorization !== undefined) {
279
+ queryParams.change_of_authorization = options.changeOfAuthorization;
280
+ }
281
+ const endpoint = `/device/${deviceId}`;
282
+ const responseData = await apiRequest_1.apiRequest.call(this, 'PUT', endpoint, body, queryParams);
283
+ return responseFormatter_1.formatResponse.call(this, responseData);
284
+ }
285
+ catch (error) {
286
+ const errorObject = {};
287
+ if (error instanceof Error) {
288
+ errorObject.message = error.message;
289
+ if (error.stack) {
290
+ errorObject.stackTrace = error.stack;
291
+ }
292
+ }
293
+ else {
294
+ errorObject.message = 'Unknown error in replaceDevice';
295
+ }
296
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
297
+ }
298
+ }
299
+ /**
300
+ * Replace a device account by MAC address
301
+ */
302
+ async function replaceDeviceByMac() {
303
+ try {
304
+ const macAddress = this.getNodeParameter('macAddress', 0);
305
+ const body = {};
306
+ // Add required fields
307
+ body.mac = this.getNodeParameter('mac', 0);
308
+ body.role_id = this.getNodeParameter('role_id', 0);
309
+ // Add optional fields
310
+ const additionalFields = this.getNodeParameter('additionalFields', 0, {});
311
+ Object.assign(body, additionalFields);
312
+ // Add custom fields if provided
313
+ if (additionalFields.customFields) {
314
+ try {
315
+ const customFields = JSON.parse(additionalFields.customFields);
316
+ delete body.customFields; // Remove from body as we'll add the parsed fields directly
317
+ // Merge custom fields with the body
318
+ Object.entries(customFields).forEach(([key, value]) => {
319
+ body[key] = value;
320
+ });
321
+ }
322
+ catch (parseError) {
323
+ throw new Error(`Invalid JSON in customFields: ${parseError.message}`);
324
+ }
325
+ }
326
+ // Get options for query parameters
327
+ const options = this.getNodeParameter('options', 0, {});
328
+ const queryParams = {};
329
+ if (options.changeOfAuthorization !== undefined) {
330
+ queryParams.change_of_authorization = options.changeOfAuthorization;
331
+ }
332
+ const endpoint = `/device/mac/${macAddress}`;
333
+ const responseData = await apiRequest_1.apiRequest.call(this, 'PUT', endpoint, body, queryParams);
334
+ return responseFormatter_1.formatResponse.call(this, responseData);
335
+ }
336
+ catch (error) {
337
+ const errorObject = {};
338
+ if (error instanceof Error) {
339
+ errorObject.message = error.message;
340
+ if (error.stack) {
341
+ errorObject.stackTrace = error.stack;
342
+ }
343
+ }
344
+ else {
345
+ errorObject.message = 'Unknown error in replaceDeviceByMac';
346
+ }
347
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
348
+ }
349
+ }
350
+ /**
351
+ * Delete a device account by ID
352
+ */
353
+ async function deleteDevice() {
354
+ try {
355
+ const deviceId = this.getNodeParameter('deviceId', 0);
356
+ // Get options for query parameters
357
+ const options = this.getNodeParameter('options', 0, {});
358
+ const queryParams = {};
359
+ if (options.changeOfAuthorization !== undefined) {
360
+ queryParams.change_of_authorization = options.changeOfAuthorization;
361
+ }
362
+ const endpoint = `/device/${deviceId}`;
363
+ await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, queryParams);
364
+ return [{ json: { success: true } }];
365
+ }
366
+ catch (error) {
367
+ const errorObject = {};
368
+ if (error instanceof Error) {
369
+ errorObject.message = error.message;
370
+ if (error.stack) {
371
+ errorObject.stackTrace = error.stack;
372
+ }
373
+ }
374
+ else {
375
+ errorObject.message = 'Unknown error in deleteDevice';
376
+ }
377
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
378
+ }
379
+ }
380
+ /**
381
+ * Delete a device account by MAC address
382
+ */
383
+ async function deleteDeviceByMac() {
384
+ try {
385
+ const macAddress = this.getNodeParameter('macAddress', 0);
386
+ // Get options for query parameters
387
+ const options = this.getNodeParameter('options', 0, {});
388
+ const queryParams = {};
389
+ if (options.changeOfAuthorization !== undefined) {
390
+ queryParams.change_of_authorization = options.changeOfAuthorization;
391
+ }
392
+ const endpoint = `/device/mac/${macAddress}`;
393
+ await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, queryParams);
394
+ return [{ json: { success: true } }];
395
+ }
396
+ catch (error) {
397
+ const errorObject = {};
398
+ if (error instanceof Error) {
399
+ errorObject.message = error.message;
400
+ if (error.stack) {
401
+ errorObject.stackTrace = error.stack;
402
+ }
403
+ }
404
+ else {
405
+ errorObject.message = 'Unknown error in deleteDeviceByMac';
406
+ }
407
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
408
+ }
409
+ }
@@ -0,0 +1,33 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ /**
3
+ * Get a list of all endpoints
4
+ */
5
+ export declare function listEndpoints(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
6
+ /**
7
+ * Get an endpoint by ID
8
+ */
9
+ export declare function getEndpoint(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
10
+ /**
11
+ * Get an endpoint by MAC address
12
+ */
13
+ export declare function getEndpointByMac(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
14
+ /**
15
+ * Create a new endpoint
16
+ */
17
+ export declare function createEndpoint(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
18
+ /**
19
+ * Update an endpoint by ID
20
+ */
21
+ export declare function updateEndpoint(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
22
+ /**
23
+ * Update an endpoint by MAC address
24
+ */
25
+ export declare function updateEndpointByMac(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
26
+ /**
27
+ * Delete an endpoint by ID
28
+ */
29
+ export declare function deleteEndpoint(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
30
+ /**
31
+ * Delete an endpoint by MAC address
32
+ */
33
+ export declare function deleteEndpointByMac(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listEndpoints = listEndpoints;
4
+ exports.getEndpoint = getEndpoint;
5
+ exports.getEndpointByMac = getEndpointByMac;
6
+ exports.createEndpoint = createEndpoint;
7
+ exports.updateEndpoint = updateEndpoint;
8
+ exports.updateEndpointByMac = updateEndpointByMac;
9
+ exports.deleteEndpoint = deleteEndpoint;
10
+ exports.deleteEndpointByMac = deleteEndpointByMac;
11
+ const apiRequest_1 = require("../../helpers/apiRequest");
12
+ const responseFormatter_1 = require("../../helpers/responseFormatter");
13
+ /**
14
+ * Get a list of all endpoints
15
+ */
16
+ async function listEndpoints() {
17
+ try {
18
+ const returnAll = this.getNodeParameter('returnAll', 0);
19
+ const filters = this.getNodeParameter('filters', 0, {});
20
+ const endpoint = '/endpoint';
21
+ let responseData;
22
+ if (returnAll) {
23
+ responseData = await apiRequest_1.apiRequestAllItems.call(this, 'GET', endpoint, {}, filters);
24
+ }
25
+ else {
26
+ const limit = this.getNodeParameter('limit', 0);
27
+ if (!filters.limit) {
28
+ filters.limit = limit;
29
+ }
30
+ responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, filters);
31
+ }
32
+ return responseFormatter_1.formatResponse.call(this, responseData);
33
+ }
34
+ catch (error) {
35
+ console.log('Error in listEndpoints:', error);
36
+ throw error;
37
+ }
38
+ }
39
+ /**
40
+ * Get an endpoint by ID
41
+ */
42
+ async function getEndpoint() {
43
+ try {
44
+ const endpointId = this.getNodeParameter('endpointId', 0);
45
+ const endpoint = `/endpoint/${endpointId}`;
46
+ const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
47
+ return responseFormatter_1.formatResponse.call(this, responseData);
48
+ }
49
+ catch (error) {
50
+ console.log('Error in getEndpoint:', error);
51
+ throw error;
52
+ }
53
+ }
54
+ /**
55
+ * Get an endpoint by MAC address
56
+ */
57
+ async function getEndpointByMac() {
58
+ try {
59
+ const macAddress = this.getNodeParameter('macAddress', 0);
60
+ const endpoint = `/endpoint/mac-address/${macAddress}`;
61
+ const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
62
+ return responseFormatter_1.formatResponse.call(this, responseData);
63
+ }
64
+ catch (error) {
65
+ console.log('Error in getEndpointByMac:', error);
66
+ throw error;
67
+ }
68
+ }
69
+ /**
70
+ * Create a new endpoint
71
+ */
72
+ async function createEndpoint() {
73
+ try {
74
+ const body = {};
75
+ // Required parameters
76
+ body.mac_address = this.getNodeParameter('macAddress', 0);
77
+ // Optional parameters
78
+ const description = this.getNodeParameter('description', 0, '');
79
+ if (description)
80
+ body.description = description;
81
+ const status = this.getNodeParameter('status', 0, '');
82
+ if (status)
83
+ body.status = status;
84
+ const randomizedMac = this.getNodeParameter('randomizedMac', 0, false);
85
+ body.randomized_mac = randomizedMac;
86
+ const deviceInsightTags = this.getNodeParameter('deviceInsightTags', 0, '');
87
+ if (deviceInsightTags)
88
+ body.device_insight_tags = deviceInsightTags;
89
+ const attributesJson = this.getNodeParameter('attributes', 0, '{}');
90
+ try {
91
+ if (attributesJson) {
92
+ body.attributes = JSON.parse(attributesJson);
93
+ }
94
+ }
95
+ catch (error) {
96
+ throw new Error(`Invalid JSON in attributes field: ${error.message}`);
97
+ }
98
+ const endpoint = '/endpoint';
99
+ const responseData = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body);
100
+ return responseFormatter_1.formatResponse.call(this, responseData);
101
+ }
102
+ catch (error) {
103
+ console.log('Error in createEndpoint:', error);
104
+ throw error;
105
+ }
106
+ }
107
+ /**
108
+ * Update an endpoint by ID
109
+ */
110
+ async function updateEndpoint() {
111
+ try {
112
+ const endpointId = this.getNodeParameter('endpointId', 0);
113
+ const body = {};
114
+ // Optional parameters
115
+ const description = this.getNodeParameter('description', 0, '');
116
+ if (description)
117
+ body.description = description;
118
+ const status = this.getNodeParameter('status', 0, '');
119
+ if (status)
120
+ body.status = status;
121
+ const randomizedMac = this.getNodeParameter('randomizedMac', 0, null);
122
+ if (randomizedMac !== null)
123
+ body.randomized_mac = randomizedMac;
124
+ const deviceInsightTags = this.getNodeParameter('deviceInsightTags', 0, '');
125
+ if (deviceInsightTags)
126
+ body.device_insight_tags = deviceInsightTags;
127
+ const attributesJson = this.getNodeParameter('attributes', 0, '');
128
+ try {
129
+ if (attributesJson) {
130
+ body.attributes = JSON.parse(attributesJson);
131
+ }
132
+ }
133
+ catch (error) {
134
+ throw new Error(`Invalid JSON in attributes field: ${error.message}`);
135
+ }
136
+ const endpoint = `/endpoint/${endpointId}`;
137
+ const responseData = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body);
138
+ return responseFormatter_1.formatResponse.call(this, responseData);
139
+ }
140
+ catch (error) {
141
+ console.log('Error in updateEndpoint:', error);
142
+ throw error;
143
+ }
144
+ }
145
+ /**
146
+ * Update an endpoint by MAC address
147
+ */
148
+ async function updateEndpointByMac() {
149
+ try {
150
+ const macAddress = this.getNodeParameter('macAddress', 0);
151
+ const body = {};
152
+ // Optional parameters
153
+ const description = this.getNodeParameter('description', 0, '');
154
+ if (description)
155
+ body.description = description;
156
+ const status = this.getNodeParameter('status', 0, '');
157
+ if (status)
158
+ body.status = status;
159
+ const randomizedMac = this.getNodeParameter('randomizedMac', 0, null);
160
+ if (randomizedMac !== null)
161
+ body.randomized_mac = randomizedMac;
162
+ const deviceInsightTags = this.getNodeParameter('deviceInsightTags', 0, '');
163
+ if (deviceInsightTags)
164
+ body.device_insight_tags = deviceInsightTags;
165
+ const attributesJson = this.getNodeParameter('attributes', 0, '');
166
+ try {
167
+ if (attributesJson) {
168
+ body.attributes = JSON.parse(attributesJson);
169
+ }
170
+ }
171
+ catch (error) {
172
+ throw new Error(`Invalid JSON in attributes field: ${error.message}`);
173
+ }
174
+ const endpoint = `/endpoint/mac-address/${macAddress}`;
175
+ const responseData = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body);
176
+ return responseFormatter_1.formatResponse.call(this, responseData);
177
+ }
178
+ catch (error) {
179
+ console.log('Error in updateEndpointByMac:', error);
180
+ throw error;
181
+ }
182
+ }
183
+ /**
184
+ * Delete an endpoint by ID
185
+ */
186
+ async function deleteEndpoint() {
187
+ try {
188
+ const endpointId = this.getNodeParameter('endpointId', 0);
189
+ const endpoint = `/endpoint/${endpointId}`;
190
+ await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint);
191
+ return [{ json: { success: true } }];
192
+ }
193
+ catch (error) {
194
+ console.log('Error in deleteEndpoint:', error);
195
+ throw error;
196
+ }
197
+ }
198
+ /**
199
+ * Delete an endpoint by MAC address
200
+ */
201
+ async function deleteEndpointByMac() {
202
+ try {
203
+ const macAddress = this.getNodeParameter('macAddress', 0);
204
+ const endpoint = `/endpoint/mac-address/${macAddress}`;
205
+ await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint);
206
+ return [{ json: { success: true } }];
207
+ }
208
+ catch (error) {
209
+ console.log('Error in deleteEndpointByMac:', error);
210
+ throw error;
211
+ }
212
+ }
@@ -0,0 +1,41 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ /**
3
+ * Get a list of all guest accounts
4
+ */
5
+ export declare function listGuestUsers(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
6
+ /**
7
+ * Get a guest account by ID
8
+ */
9
+ export declare function getGuestUser(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
10
+ /**
11
+ * Get a guest account by username
12
+ */
13
+ export declare function getGuestUserByUsername(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
14
+ /**
15
+ * Create a new guest user account
16
+ */
17
+ export declare function createGuestUser(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
18
+ /**
19
+ * Update a guest user account
20
+ */
21
+ export declare function updateGuestUser(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
22
+ /**
23
+ * Update a guest user account by username
24
+ */
25
+ export declare function updateGuestUserByUsername(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
26
+ /**
27
+ * Replace a guest user account
28
+ */
29
+ export declare function replaceGuestUser(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
30
+ /**
31
+ * Replace a guest user account by username
32
+ */
33
+ export declare function replaceGuestUserByUsername(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
34
+ /**
35
+ * Delete a guest user account
36
+ */
37
+ export declare function deleteGuestUser(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
38
+ /**
39
+ * Delete a guest user account by username
40
+ */
41
+ export declare function deleteGuestUserByUsername(this: IExecuteFunctions): Promise<INodeExecutionData[]>;