@joshuanode/n8n-nodes-datto-backup 0.1.0-beta.1

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/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/dist/credentials/DattoBackupApi.credentials.d.ts +14 -0
  4. package/dist/credentials/DattoBackupApi.credentials.d.ts.map +1 -0
  5. package/dist/credentials/DattoBackupApi.credentials.js +54 -0
  6. package/dist/credentials/DattoBackupApi.credentials.js.map +1 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +19 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/nodes/DattoBackup/DattoBackup.node.d.ts +12 -0
  12. package/dist/nodes/DattoBackup/DattoBackup.node.d.ts.map +1 -0
  13. package/dist/nodes/DattoBackup/DattoBackup.node.js +495 -0
  14. package/dist/nodes/DattoBackup/DattoBackup.node.js.map +1 -0
  15. package/dist/nodes/DattoBackup/GenericFunctions.d.ts +24 -0
  16. package/dist/nodes/DattoBackup/GenericFunctions.d.ts.map +1 -0
  17. package/dist/nodes/DattoBackup/GenericFunctions.js +106 -0
  18. package/dist/nodes/DattoBackup/GenericFunctions.js.map +1 -0
  19. package/dist/nodes/DattoBackup/dattobackup.svg +38 -0
  20. package/dist/nodes/DattoBackup/descriptions/ActivityLogDescription.d.ts +4 -0
  21. package/dist/nodes/DattoBackup/descriptions/ActivityLogDescription.d.ts.map +1 -0
  22. package/dist/nodes/DattoBackup/descriptions/ActivityLogDescription.js +135 -0
  23. package/dist/nodes/DattoBackup/descriptions/ActivityLogDescription.js.map +1 -0
  24. package/dist/nodes/DattoBackup/descriptions/AgentDescription.d.ts +4 -0
  25. package/dist/nodes/DattoBackup/descriptions/AgentDescription.d.ts.map +1 -0
  26. package/dist/nodes/DattoBackup/descriptions/AgentDescription.js +80 -0
  27. package/dist/nodes/DattoBackup/descriptions/AgentDescription.js.map +1 -0
  28. package/dist/nodes/DattoBackup/descriptions/AlertDescription.d.ts +4 -0
  29. package/dist/nodes/DattoBackup/descriptions/AlertDescription.d.ts.map +1 -0
  30. package/dist/nodes/DattoBackup/descriptions/AlertDescription.js +81 -0
  31. package/dist/nodes/DattoBackup/descriptions/AlertDescription.js.map +1 -0
  32. package/dist/nodes/DattoBackup/descriptions/AssetDescription.d.ts +4 -0
  33. package/dist/nodes/DattoBackup/descriptions/AssetDescription.d.ts.map +1 -0
  34. package/dist/nodes/DattoBackup/descriptions/AssetDescription.js +78 -0
  35. package/dist/nodes/DattoBackup/descriptions/AssetDescription.js.map +1 -0
  36. package/dist/nodes/DattoBackup/descriptions/DeviceDescription.d.ts +4 -0
  37. package/dist/nodes/DattoBackup/descriptions/DeviceDescription.d.ts.map +1 -0
  38. package/dist/nodes/DattoBackup/descriptions/DeviceDescription.js +122 -0
  39. package/dist/nodes/DattoBackup/descriptions/DeviceDescription.js.map +1 -0
  40. package/dist/nodes/DattoBackup/descriptions/DtcAssetDescription.d.ts +4 -0
  41. package/dist/nodes/DattoBackup/descriptions/DtcAssetDescription.d.ts.map +1 -0
  42. package/dist/nodes/DattoBackup/descriptions/DtcAssetDescription.js +110 -0
  43. package/dist/nodes/DattoBackup/descriptions/DtcAssetDescription.js.map +1 -0
  44. package/dist/nodes/DattoBackup/descriptions/DtcRmmTemplateDescription.d.ts +4 -0
  45. package/dist/nodes/DattoBackup/descriptions/DtcRmmTemplateDescription.d.ts.map +1 -0
  46. package/dist/nodes/DattoBackup/descriptions/DtcRmmTemplateDescription.js +29 -0
  47. package/dist/nodes/DattoBackup/descriptions/DtcRmmTemplateDescription.js.map +1 -0
  48. package/dist/nodes/DattoBackup/descriptions/DtcStoragePoolDescription.d.ts +4 -0
  49. package/dist/nodes/DattoBackup/descriptions/DtcStoragePoolDescription.d.ts.map +1 -0
  50. package/dist/nodes/DattoBackup/descriptions/DtcStoragePoolDescription.js +29 -0
  51. package/dist/nodes/DattoBackup/descriptions/DtcStoragePoolDescription.js.map +1 -0
  52. package/dist/nodes/DattoBackup/descriptions/SaasApplicationDescription.d.ts +4 -0
  53. package/dist/nodes/DattoBackup/descriptions/SaasApplicationDescription.d.ts.map +1 -0
  54. package/dist/nodes/DattoBackup/descriptions/SaasApplicationDescription.js +80 -0
  55. package/dist/nodes/DattoBackup/descriptions/SaasApplicationDescription.js.map +1 -0
  56. package/dist/nodes/DattoBackup/descriptions/SaasDomainDescription.d.ts +4 -0
  57. package/dist/nodes/DattoBackup/descriptions/SaasDomainDescription.d.ts.map +1 -0
  58. package/dist/nodes/DattoBackup/descriptions/SaasDomainDescription.js +61 -0
  59. package/dist/nodes/DattoBackup/descriptions/SaasDomainDescription.js.map +1 -0
  60. package/dist/nodes/DattoBackup/descriptions/SaasSeatDescription.d.ts +4 -0
  61. package/dist/nodes/DattoBackup/descriptions/SaasSeatDescription.d.ts.map +1 -0
  62. package/dist/nodes/DattoBackup/descriptions/SaasSeatDescription.js +80 -0
  63. package/dist/nodes/DattoBackup/descriptions/SaasSeatDescription.js.map +1 -0
  64. package/dist/nodes/DattoBackup/descriptions/ShareDescription.d.ts +4 -0
  65. package/dist/nodes/DattoBackup/descriptions/ShareDescription.d.ts.map +1 -0
  66. package/dist/nodes/DattoBackup/descriptions/ShareDescription.js +78 -0
  67. package/dist/nodes/DattoBackup/descriptions/ShareDescription.js.map +1 -0
  68. package/dist/nodes/DattoBackup/descriptions/VmRestoreDescription.d.ts +4 -0
  69. package/dist/nodes/DattoBackup/descriptions/VmRestoreDescription.d.ts.map +1 -0
  70. package/dist/nodes/DattoBackup/descriptions/VmRestoreDescription.js +49 -0
  71. package/dist/nodes/DattoBackup/descriptions/VmRestoreDescription.js.map +1 -0
  72. package/dist/nodes/DattoBackup/descriptions/VolumeDescription.d.ts +4 -0
  73. package/dist/nodes/DattoBackup/descriptions/VolumeDescription.d.ts.map +1 -0
  74. package/dist/nodes/DattoBackup/descriptions/VolumeDescription.js +64 -0
  75. package/dist/nodes/DattoBackup/descriptions/VolumeDescription.js.map +1 -0
  76. package/dist/nodes/DattoBackup/descriptions/index.d.ts +15 -0
  77. package/dist/nodes/DattoBackup/descriptions/index.d.ts.map +1 -0
  78. package/dist/nodes/DattoBackup/descriptions/index.js +31 -0
  79. package/dist/nodes/DattoBackup/descriptions/index.js.map +1 -0
  80. package/package.json +65 -0
@@ -0,0 +1,495 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DattoBackup = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const GenericFunctions_1 = require("./GenericFunctions");
6
+ const descriptions_1 = require("./descriptions");
7
+ class DattoBackup {
8
+ description = {
9
+ displayName: 'Datto Backup',
10
+ name: 'dattoBackup',
11
+ icon: 'file:dattobackup.svg',
12
+ group: ['transform'],
13
+ version: 1,
14
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
15
+ description: 'Interact with Datto BCDR API for backup monitoring and management',
16
+ defaults: {
17
+ name: 'Datto Backup',
18
+ },
19
+ inputs: ['main'],
20
+ outputs: ['main'],
21
+ credentials: [
22
+ {
23
+ name: 'dattoBackupApi',
24
+ required: true,
25
+ },
26
+ ],
27
+ properties: [
28
+ {
29
+ displayName: 'Resource',
30
+ name: 'resource',
31
+ type: 'options',
32
+ noDataExpression: true,
33
+ options: [
34
+ {
35
+ name: 'Activity Log',
36
+ value: 'activityLog',
37
+ description: 'User activity audit log',
38
+ },
39
+ {
40
+ name: 'Agent',
41
+ value: 'agent',
42
+ description: 'Backup agents on protected systems',
43
+ },
44
+ {
45
+ name: 'Alert',
46
+ value: 'alert',
47
+ description: 'Device alerts and notifications',
48
+ },
49
+ {
50
+ name: 'Asset',
51
+ value: 'asset',
52
+ description: 'Combined agents and shares for a device',
53
+ },
54
+ {
55
+ name: 'Device',
56
+ value: 'device',
57
+ description: 'BCDR hardware and cloud devices',
58
+ },
59
+ {
60
+ name: 'DTC Asset',
61
+ value: 'dtcAsset',
62
+ description: 'Direct-to-Cloud assets (endpoint backup)',
63
+ },
64
+ {
65
+ name: 'DTC RMM Template',
66
+ value: 'dtcRmmTemplate',
67
+ description: 'RMM deployment templates',
68
+ },
69
+ {
70
+ name: 'DTC Storage Pool',
71
+ value: 'dtcStoragePool',
72
+ description: 'Storage pool usage information',
73
+ },
74
+ {
75
+ name: 'SaaS Application',
76
+ value: 'saasApplication',
77
+ description: 'SaaS Protection backup data',
78
+ },
79
+ {
80
+ name: 'SaaS Domain',
81
+ value: 'saasDomain',
82
+ description: 'SaaS Protection domains',
83
+ },
84
+ {
85
+ name: 'SaaS Seat',
86
+ value: 'saasSeat',
87
+ description: 'SaaS Protection seats',
88
+ },
89
+ {
90
+ name: 'Share',
91
+ value: 'share',
92
+ description: 'Network shares being backed up',
93
+ },
94
+ {
95
+ name: 'VM Restore',
96
+ value: 'vmRestore',
97
+ description: 'Virtual machine restore operations',
98
+ },
99
+ {
100
+ name: 'Volume',
101
+ value: 'volume',
102
+ description: 'Storage volumes on a device',
103
+ },
104
+ ],
105
+ default: 'device',
106
+ },
107
+ // Device
108
+ ...descriptions_1.deviceOperations,
109
+ ...descriptions_1.deviceFields,
110
+ // Agent
111
+ ...descriptions_1.agentOperations,
112
+ ...descriptions_1.agentFields,
113
+ // Alert
114
+ ...descriptions_1.alertOperations,
115
+ ...descriptions_1.alertFields,
116
+ // Asset
117
+ ...descriptions_1.assetOperations,
118
+ ...descriptions_1.assetFields,
119
+ // Share
120
+ ...descriptions_1.shareOperations,
121
+ ...descriptions_1.shareFields,
122
+ // Volume
123
+ ...descriptions_1.volumeOperations,
124
+ ...descriptions_1.volumeFields,
125
+ // VM Restore
126
+ ...descriptions_1.vmRestoreOperations,
127
+ ...descriptions_1.vmRestoreFields,
128
+ // Activity Log
129
+ ...descriptions_1.activityLogOperations,
130
+ ...descriptions_1.activityLogFields,
131
+ // SaaS Domain
132
+ ...descriptions_1.saasDomainOperations,
133
+ ...descriptions_1.saasDomainFields,
134
+ // SaaS Seat
135
+ ...descriptions_1.saasSeatOperations,
136
+ ...descriptions_1.saasSeatFields,
137
+ // SaaS Application
138
+ ...descriptions_1.saasApplicationOperations,
139
+ ...descriptions_1.saasApplicationFields,
140
+ // DTC Asset
141
+ ...descriptions_1.dtcAssetOperations,
142
+ ...descriptions_1.dtcAssetFields,
143
+ // DTC RMM Template
144
+ ...descriptions_1.dtcRmmTemplateOperations,
145
+ ...descriptions_1.dtcRmmTemplateFields,
146
+ // DTC Storage Pool
147
+ ...descriptions_1.dtcStoragePoolOperations,
148
+ ...descriptions_1.dtcStoragePoolFields,
149
+ ],
150
+ usableAsTool: true,
151
+ };
152
+ methods = {
153
+ loadOptions: {
154
+ async getDevices() {
155
+ return GenericFunctions_1.getDevices.call(this);
156
+ },
157
+ async getSaasCustomers() {
158
+ return GenericFunctions_1.getSaasCustomers.call(this);
159
+ },
160
+ },
161
+ };
162
+ async execute() {
163
+ const items = this.getInputData();
164
+ const returnData = [];
165
+ const resource = this.getNodeParameter('resource', 0);
166
+ const operation = this.getNodeParameter('operation', 0);
167
+ for (let i = 0; i < items.length; i++) {
168
+ try {
169
+ let responseData;
170
+ // ----------------------------------------
171
+ // device
172
+ // ----------------------------------------
173
+ if (resource === 'device') {
174
+ if (operation === 'get') {
175
+ const serialNumber = this.getNodeParameter('serialNumber', i);
176
+ responseData = await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/bcdr/device/${serialNumber}`);
177
+ }
178
+ else if (operation === 'getMany') {
179
+ const returnAll = this.getNodeParameter('returnAll', i);
180
+ const options = this.getNodeParameter('options', i);
181
+ const qs = {};
182
+ if (options.showHiddenDevices !== undefined) {
183
+ qs.showHiddenDevices = options.showHiddenDevices ? '1' : '0';
184
+ }
185
+ if (options.showChildResellerDevices !== undefined) {
186
+ qs.showChildResellerDevices = options.showChildResellerDevices ? '1' : '0';
187
+ }
188
+ if (returnAll) {
189
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', '/bcdr/device', {}, qs);
190
+ }
191
+ else {
192
+ const limit = this.getNodeParameter('limit', i);
193
+ qs._perPage = limit;
194
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', '/bcdr/device', {}, qs));
195
+ responseData = response.items || [];
196
+ }
197
+ }
198
+ else {
199
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
200
+ }
201
+ }
202
+ // ----------------------------------------
203
+ // agent
204
+ // ----------------------------------------
205
+ else if (resource === 'agent') {
206
+ if (operation === 'getMany') {
207
+ const serialNumber = this.getNodeParameter('serialNumber', i);
208
+ const returnAll = this.getNodeParameter('returnAll', i);
209
+ if (returnAll) {
210
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', `/bcdr/device/${serialNumber}/asset/agent`);
211
+ }
212
+ else {
213
+ const limit = this.getNodeParameter('limit', i);
214
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/bcdr/device/${serialNumber}/asset/agent`, {}, { _perPage: limit }));
215
+ responseData = response.items || [];
216
+ }
217
+ }
218
+ else {
219
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
220
+ }
221
+ }
222
+ // ----------------------------------------
223
+ // alert
224
+ // ----------------------------------------
225
+ else if (resource === 'alert') {
226
+ if (operation === 'getMany') {
227
+ const serialNumber = this.getNodeParameter('serialNumber', i);
228
+ const returnAll = this.getNodeParameter('returnAll', i);
229
+ if (returnAll) {
230
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', `/bcdr/device/${serialNumber}/alert`);
231
+ }
232
+ else {
233
+ const limit = this.getNodeParameter('limit', i);
234
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/bcdr/device/${serialNumber}/alert`, {}, { _perPage: limit }));
235
+ responseData = response.items || [];
236
+ }
237
+ }
238
+ else {
239
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
240
+ }
241
+ }
242
+ // ----------------------------------------
243
+ // asset
244
+ // ----------------------------------------
245
+ else if (resource === 'asset') {
246
+ if (operation === 'getMany') {
247
+ const serialNumber = this.getNodeParameter('serialNumber', i);
248
+ const returnAll = this.getNodeParameter('returnAll', i);
249
+ if (returnAll) {
250
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', `/bcdr/device/${serialNumber}/asset`);
251
+ }
252
+ else {
253
+ const limit = this.getNodeParameter('limit', i);
254
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/bcdr/device/${serialNumber}/asset`, {}, { _perPage: limit }));
255
+ responseData = response.items || [];
256
+ }
257
+ }
258
+ else {
259
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
260
+ }
261
+ }
262
+ // ----------------------------------------
263
+ // share
264
+ // ----------------------------------------
265
+ else if (resource === 'share') {
266
+ if (operation === 'getMany') {
267
+ const serialNumber = this.getNodeParameter('serialNumber', i);
268
+ const returnAll = this.getNodeParameter('returnAll', i);
269
+ if (returnAll) {
270
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', `/bcdr/device/${serialNumber}/asset/share`);
271
+ }
272
+ else {
273
+ const limit = this.getNodeParameter('limit', i);
274
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/bcdr/device/${serialNumber}/asset/share`, {}, { _perPage: limit }));
275
+ responseData = response.items || [];
276
+ }
277
+ }
278
+ else {
279
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
280
+ }
281
+ }
282
+ // ----------------------------------------
283
+ // volume
284
+ // ----------------------------------------
285
+ else if (resource === 'volume') {
286
+ if (operation === 'get') {
287
+ const serialNumber = this.getNodeParameter('serialNumber', i);
288
+ const volumeName = this.getNodeParameter('volumeName', i);
289
+ responseData = await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/bcdr/device/${serialNumber}/asset/volume`, {}, { volumeName });
290
+ }
291
+ else {
292
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
293
+ }
294
+ }
295
+ // ----------------------------------------
296
+ // vmRestore
297
+ // ----------------------------------------
298
+ else if (resource === 'vmRestore') {
299
+ if (operation === 'getMany') {
300
+ const serialNumber = this.getNodeParameter('serialNumber', i);
301
+ responseData = await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/bcdr/device/${serialNumber}/vm-restores`);
302
+ // Normalize response to array
303
+ if (!Array.isArray(responseData)) {
304
+ responseData = responseData.items || [responseData];
305
+ }
306
+ }
307
+ else {
308
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
309
+ }
310
+ }
311
+ // ----------------------------------------
312
+ // activityLog
313
+ // ----------------------------------------
314
+ else if (resource === 'activityLog') {
315
+ if (operation === 'getMany') {
316
+ const returnAll = this.getNodeParameter('returnAll', i);
317
+ const filters = this.getNodeParameter('filters', i);
318
+ const qs = {};
319
+ if (filters.clientName) {
320
+ qs.clientName = filters.clientName;
321
+ }
322
+ if (filters.since) {
323
+ qs.since = filters.since;
324
+ }
325
+ if (filters.sinceUnits) {
326
+ qs.sinceUnits = filters.sinceUnits;
327
+ }
328
+ if (filters.targetType) {
329
+ qs.targetType = filters.targetType;
330
+ }
331
+ if (filters.user) {
332
+ qs.user = filters.user;
333
+ }
334
+ if (returnAll) {
335
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', '/report/activity-log', {}, qs);
336
+ }
337
+ else {
338
+ const limit = this.getNodeParameter('limit', i);
339
+ qs._perPage = limit;
340
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', '/report/activity-log', {}, qs));
341
+ responseData = response.items || [];
342
+ }
343
+ }
344
+ else {
345
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
346
+ }
347
+ }
348
+ // ----------------------------------------
349
+ // saasDomain
350
+ // ----------------------------------------
351
+ else if (resource === 'saasDomain') {
352
+ if (operation === 'getMany') {
353
+ const returnAll = this.getNodeParameter('returnAll', i);
354
+ if (returnAll) {
355
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', '/saas/domains');
356
+ }
357
+ else {
358
+ const limit = this.getNodeParameter('limit', i);
359
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', '/saas/domains', {}, { _perPage: limit }));
360
+ responseData = response.items || [];
361
+ }
362
+ }
363
+ else {
364
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
365
+ }
366
+ }
367
+ // ----------------------------------------
368
+ // saasSeat
369
+ // ----------------------------------------
370
+ else if (resource === 'saasSeat') {
371
+ if (operation === 'getMany') {
372
+ const saasCustomerId = this.getNodeParameter('saasCustomerId', i);
373
+ const returnAll = this.getNodeParameter('returnAll', i);
374
+ if (returnAll) {
375
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', `/saas/${saasCustomerId}/seats`);
376
+ }
377
+ else {
378
+ const limit = this.getNodeParameter('limit', i);
379
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/saas/${saasCustomerId}/seats`, {}, { _perPage: limit }));
380
+ responseData = response.items || [];
381
+ }
382
+ }
383
+ else {
384
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
385
+ }
386
+ }
387
+ // ----------------------------------------
388
+ // saasApplication
389
+ // ----------------------------------------
390
+ else if (resource === 'saasApplication') {
391
+ if (operation === 'getMany') {
392
+ const saasCustomerId = this.getNodeParameter('saasCustomerId', i);
393
+ const returnAll = this.getNodeParameter('returnAll', i);
394
+ if (returnAll) {
395
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', `/saas/${saasCustomerId}/applications`);
396
+ }
397
+ else {
398
+ const limit = this.getNodeParameter('limit', i);
399
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/saas/${saasCustomerId}/applications`, {}, { _perPage: limit }));
400
+ responseData = response.items || [];
401
+ }
402
+ }
403
+ else {
404
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
405
+ }
406
+ }
407
+ // ----------------------------------------
408
+ // dtcAsset
409
+ // ----------------------------------------
410
+ else if (resource === 'dtcAsset') {
411
+ if (operation === 'get') {
412
+ const clientId = this.getNodeParameter('clientId', i);
413
+ const assetUuid = this.getNodeParameter('assetUuid', i);
414
+ responseData = await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/dtc/${clientId}/assets/${assetUuid}`);
415
+ }
416
+ else if (operation === 'getMany') {
417
+ const returnAll = this.getNodeParameter('returnAll', i);
418
+ if (returnAll) {
419
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', '/dtc/assets');
420
+ }
421
+ else {
422
+ const limit = this.getNodeParameter('limit', i);
423
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', '/dtc/assets', {}, { _perPage: limit }));
424
+ responseData = response.items || [];
425
+ }
426
+ }
427
+ else if (operation === 'getManyByClient') {
428
+ const clientId = this.getNodeParameter('clientId', i);
429
+ const returnAll = this.getNodeParameter('returnAll', i);
430
+ if (returnAll) {
431
+ responseData = await GenericFunctions_1.dattoApiRequestAllItems.call(this, 'GET', `/dtc/${clientId}/assets`);
432
+ }
433
+ else {
434
+ const limit = this.getNodeParameter('limit', i);
435
+ const response = (await GenericFunctions_1.dattoApiRequest.call(this, 'GET', `/dtc/${clientId}/assets`, {}, { _perPage: limit }));
436
+ responseData = response.items || [];
437
+ }
438
+ }
439
+ else {
440
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
441
+ }
442
+ }
443
+ // ----------------------------------------
444
+ // dtcRmmTemplate
445
+ // ----------------------------------------
446
+ else if (resource === 'dtcRmmTemplate') {
447
+ if (operation === 'getMany') {
448
+ responseData = await GenericFunctions_1.dattoApiRequest.call(this, 'GET', '/dtc/rmm-templates');
449
+ // Normalize response to array
450
+ if (!Array.isArray(responseData)) {
451
+ responseData = responseData.items || [responseData];
452
+ }
453
+ }
454
+ else {
455
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
456
+ }
457
+ }
458
+ // ----------------------------------------
459
+ // dtcStoragePool
460
+ // ----------------------------------------
461
+ else if (resource === 'dtcStoragePool') {
462
+ if (operation === 'getMany') {
463
+ responseData = await GenericFunctions_1.dattoApiRequest.call(this, 'GET', '/dtc/storage-pool');
464
+ // Normalize response to array
465
+ if (!Array.isArray(responseData)) {
466
+ responseData = responseData.items || [responseData];
467
+ }
468
+ }
469
+ else {
470
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
471
+ }
472
+ }
473
+ else {
474
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
475
+ }
476
+ // Handle response
477
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
478
+ returnData.push(...executionData);
479
+ }
480
+ catch (error) {
481
+ if (this.continueOnFail()) {
482
+ returnData.push({
483
+ json: { error: error.message },
484
+ pairedItem: { item: i },
485
+ });
486
+ continue;
487
+ }
488
+ throw error;
489
+ }
490
+ }
491
+ return [returnData];
492
+ }
493
+ }
494
+ exports.DattoBackup = DattoBackup;
495
+ //# sourceMappingURL=DattoBackup.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DattoBackup.node.js","sourceRoot":"","sources":["../../../nodes/DattoBackup/DattoBackup.node.ts"],"names":[],"mappings":";;;AASA,+CAAkD;AAElD,yDAK4B;AAE5B,iDA6BwB;AAExB,MAAa,WAAW;IACvB,WAAW,GAAyB;QACnC,WAAW,EAAE,cAAc;QAC3B,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,8DAA8D;QACxE,WAAW,EAAE,mEAAmE;Q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,aAAa,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAxnBD,kCAwnBC"}
@@ -0,0 +1,24 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, IHttpRequestMethods, IDataObject } from 'n8n-workflow';
2
+ /**
3
+ * Make an authenticated request to the Datto API
4
+ */
5
+ export declare function dattoApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject | IDataObject[]>;
6
+ /**
7
+ * Make an authenticated request and return all items (handles pagination)
8
+ */
9
+ export declare function dattoApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject[]>;
10
+ /**
11
+ * Load devices for dropdown selection (fetches ALL pages for MSPs with many devices)
12
+ */
13
+ export declare function getDevices(this: ILoadOptionsFunctions): Promise<Array<{
14
+ name: string;
15
+ value: string;
16
+ }>>;
17
+ /**
18
+ * Load SaaS domains/customers for dropdown selection
19
+ */
20
+ export declare function getSaasCustomers(this: ILoadOptionsFunctions): Promise<Array<{
21
+ name: string;
22
+ value: string;
23
+ }>>;
24
+ //# sourceMappingURL=GenericFunctions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.d.ts","sourceRoot":"","sources":["../../../nodes/DattoBackup/GenericFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EAEnB,WAAW,EAEX,MAAM,cAAc,CAAC;AAKtB;;GAEG;AACH,wBAAsB,eAAe,CACpC,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,EAC/C,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,WAAgB,EACtB,EAAE,GAAE,WAAgB,GAClB,OAAO,CAAC,WAAW,GAAG,WAAW,EAAE,CAAC,CAuBtC;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,EAC/C,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,WAAgB,EACtB,EAAE,GAAE,WAAgB,GAClB,OAAO,CAAC,WAAW,EAAE,CAAC,CA6BxB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC/B,IAAI,EAAE,qBAAqB,GACzB,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAuBjD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACrC,IAAI,EAAE,qBAAqB,GACzB,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAsBjD"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dattoApiRequest = dattoApiRequest;
4
+ exports.dattoApiRequestAllItems = dattoApiRequestAllItems;
5
+ exports.getDevices = getDevices;
6
+ exports.getSaasCustomers = getSaasCustomers;
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const BASE_URL = 'https://api.datto.com/v1';
9
+ /**
10
+ * Make an authenticated request to the Datto API
11
+ */
12
+ async function dattoApiRequest(method, endpoint, body = {}, qs = {}) {
13
+ const options = {
14
+ method,
15
+ url: `${BASE_URL}${endpoint}`,
16
+ qs,
17
+ body,
18
+ json: true,
19
+ };
20
+ if (Object.keys(body).length === 0) {
21
+ delete options.body;
22
+ }
23
+ try {
24
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'dattoBackupApi', options);
25
+ return response;
26
+ }
27
+ catch (error) {
28
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
29
+ }
30
+ }
31
+ /**
32
+ * Make an authenticated request and return all items (handles pagination)
33
+ */
34
+ async function dattoApiRequestAllItems(method, endpoint, body = {}, qs = {}) {
35
+ const returnData = [];
36
+ let page = 1;
37
+ const perPage = 100;
38
+ let hasMorePages = true;
39
+ while (hasMorePages) {
40
+ qs._page = page;
41
+ qs._perPage = perPage;
42
+ const response = (await dattoApiRequest.call(this, method, endpoint, body, qs));
43
+ const items = response.items || [];
44
+ returnData.push(...items);
45
+ // Check pagination metadata
46
+ const pagination = response.pagination;
47
+ if (pagination) {
48
+ const totalPages = pagination.totalPages;
49
+ hasMorePages = page < totalPages;
50
+ }
51
+ else {
52
+ // If no pagination info, assume single page
53
+ hasMorePages = false;
54
+ }
55
+ page++;
56
+ }
57
+ return returnData;
58
+ }
59
+ /**
60
+ * Load devices for dropdown selection (fetches ALL pages for MSPs with many devices)
61
+ */
62
+ async function getDevices() {
63
+ const devices = [];
64
+ try {
65
+ // Use pagination to get ALL devices, not just first page
66
+ const items = await dattoApiRequestAllItems.call(this, 'GET', '/bcdr/device');
67
+ for (const device of items) {
68
+ const name = device.name || device.serialNumber;
69
+ const serialNumber = device.serialNumber;
70
+ if (serialNumber) {
71
+ devices.push({
72
+ name: name || serialNumber,
73
+ value: serialNumber,
74
+ });
75
+ }
76
+ }
77
+ }
78
+ catch {
79
+ // Return empty array if API call fails - user can still use expressions
80
+ }
81
+ return devices;
82
+ }
83
+ /**
84
+ * Load SaaS domains/customers for dropdown selection
85
+ */
86
+ async function getSaasCustomers() {
87
+ const customers = [];
88
+ try {
89
+ const items = await dattoApiRequestAllItems.call(this, 'GET', '/saas/domains');
90
+ for (const domain of items) {
91
+ const name = domain.domain || domain.saasCustomerId;
92
+ const customerId = String(domain.saasCustomerId || '');
93
+ if (customerId) {
94
+ customers.push({
95
+ name: name || customerId,
96
+ value: customerId,
97
+ });
98
+ }
99
+ }
100
+ }
101
+ catch {
102
+ // Return empty array if API call fails - user can still use expressions
103
+ }
104
+ return customers;
105
+ }
106
+ //# sourceMappingURL=GenericFunctions.js.map