@joshuanode/n8n-nodes-datto-backup 0.1.0-beta.8 → 0.1.0-beta.9
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.
- package/dist/credentials/DattoBackupApi.credentials.d.ts +2 -14
- package/dist/credentials/DattoBackupApi.credentials.d.ts.map +1 -1
- package/dist/credentials/DattoBackupApi.credentials.js +50 -13
- package/dist/credentials/DattoBackupApi.credentials.js.map +1 -1
- package/package.json +1 -1
- package/dist/credentials/CredentialTester.d.ts +0 -3
- package/dist/credentials/CredentialTester.d.ts.map +0 -1
- package/dist/credentials/CredentialTester.js +0 -33
- package/dist/credentials/CredentialTester.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import { testDattoCredentials } from './CredentialTester';
|
|
1
|
+
import type { ICredentialDataDecryptedObject, ICredentialTestFunctions, ICredentialType, INodeCredentialTestResult, INodeProperties } from 'n8n-workflow';
|
|
3
2
|
export declare class DattoBackupApi implements ICredentialType {
|
|
4
3
|
name: string;
|
|
5
4
|
displayName: string;
|
|
@@ -9,20 +8,9 @@ export declare class DattoBackupApi implements ICredentialType {
|
|
|
9
8
|
readonly dark: "file:../nodes/DattoBackup/dattobackup.svg";
|
|
10
9
|
};
|
|
11
10
|
properties: INodeProperties[];
|
|
12
|
-
test: {
|
|
13
|
-
request: {
|
|
14
|
-
baseURL: string;
|
|
15
|
-
url: string;
|
|
16
|
-
method: "GET";
|
|
17
|
-
qs: {
|
|
18
|
-
_page: number;
|
|
19
|
-
_perPage: number;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
11
|
testedBy: {
|
|
24
12
|
credentialType: string;
|
|
25
|
-
testRequest:
|
|
13
|
+
testRequest: (this: ICredentialTestFunctions, credential: ICredentialDataDecryptedObject) => Promise<INodeCredentialTestResult>;
|
|
26
14
|
};
|
|
27
15
|
}
|
|
28
16
|
//# sourceMappingURL=DattoBackupApi.credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DattoBackupApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/DattoBackupApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,
|
|
1
|
+
{"version":3,"file":"DattoBackupApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/DattoBackupApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,8BAA8B,EAC9B,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EACzB,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACrD,IAAI,SAAoB;IAExB,WAAW,SAAsB;IAEjC,gBAAgB,SAAqD;IAErE,IAAI;;;MAGO;IAEX,UAAU,EAAE,eAAe,EAAE,CAoB3B;IAIF,QAAQ;;4BAGA,wBAAwB,cAClB,8BAA8B,KACxC,OAAO,CAAC,yBAAyB,CAAC;MAsDpC;CACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DattoBackupApi = void 0;
|
|
4
|
-
const CredentialTester_1 = require("./CredentialTester");
|
|
5
4
|
class DattoBackupApi {
|
|
6
5
|
name = 'dattoBackupApi';
|
|
7
6
|
displayName = 'Datto Backup API';
|
|
@@ -31,21 +30,59 @@ class DattoBackupApi {
|
|
|
31
30
|
description: 'The Secret API Key from Datto Partner Portal (Admin > Integrations > API Keys)',
|
|
32
31
|
},
|
|
33
32
|
];
|
|
34
|
-
test = {
|
|
35
|
-
request: {
|
|
36
|
-
baseURL: 'https://api.datto.com/v1',
|
|
37
|
-
url: '/bcdr/device',
|
|
38
|
-
method: 'GET',
|
|
39
|
-
qs: {
|
|
40
|
-
_page: 1,
|
|
41
|
-
_perPage: 1,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
33
|
// Custom credential tester that runs in full Node.js context
|
|
34
|
+
// This avoids n8n expression limitations with Buffer.from()
|
|
46
35
|
testedBy = {
|
|
47
36
|
credentialType: 'dattoBackupApi',
|
|
48
|
-
testRequest:
|
|
37
|
+
testRequest: async function (credential) {
|
|
38
|
+
const publicKey = credential.publicKey.trim();
|
|
39
|
+
const secretKey = credential.secretKey.trim();
|
|
40
|
+
// Construct Auth Header
|
|
41
|
+
const authHeader = `Basic ${Buffer.from(`${publicKey}:${secretKey}`).toString('base64')}`;
|
|
42
|
+
// Debug Log (Server-side)
|
|
43
|
+
console.log(`[DattoBackup] Testing connection for User: ${publicKey}`);
|
|
44
|
+
console.log(`[DattoBackup] Auth Header Length: ${authHeader.length}`);
|
|
45
|
+
try {
|
|
46
|
+
const response = await this.helpers.request({
|
|
47
|
+
method: 'GET',
|
|
48
|
+
url: 'https://api.datto.com/v1/bcdr/device',
|
|
49
|
+
qs: {
|
|
50
|
+
_page: 1,
|
|
51
|
+
_perPage: 1,
|
|
52
|
+
},
|
|
53
|
+
headers: {
|
|
54
|
+
Authorization: authHeader,
|
|
55
|
+
},
|
|
56
|
+
json: true,
|
|
57
|
+
resolveWithFullResponse: true, // Get full response to check headers/status
|
|
58
|
+
});
|
|
59
|
+
console.log(`[DattoBackup] Connection Successful! Status: ${response.statusCode}`);
|
|
60
|
+
return {
|
|
61
|
+
status: 'OK',
|
|
62
|
+
message: 'Connection successful!',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const err = error;
|
|
67
|
+
console.error('[DattoBackup] Connection Failed:', err.message);
|
|
68
|
+
if (err.response) {
|
|
69
|
+
console.error('[DattoBackup] Response Body:', JSON.stringify(err.response.body));
|
|
70
|
+
}
|
|
71
|
+
// Enhanced Error Message for UI
|
|
72
|
+
let uiMessage = `Connection failed: ${err.message}`;
|
|
73
|
+
if (err.response?.body?.messages) {
|
|
74
|
+
// Datto API often returns error details in 'messages' array
|
|
75
|
+
uiMessage += ` | Details: ${JSON.stringify(err.response.body.messages)}`;
|
|
76
|
+
}
|
|
77
|
+
else if (err.response?.status) {
|
|
78
|
+
uiMessage += ` (Status: ${err.response.status})`;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
status: 'Error',
|
|
82
|
+
message: uiMessage,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
},
|
|
49
86
|
};
|
|
50
87
|
}
|
|
51
88
|
exports.DattoBackupApi = DattoBackupApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DattoBackupApi.credentials.js","sourceRoot":"","sources":["../../credentials/DattoBackupApi.credentials.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"DattoBackupApi.credentials.js","sourceRoot":"","sources":["../../credentials/DattoBackupApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,cAAc;IAC1B,IAAI,GAAG,gBAAgB,CAAC;IAExB,WAAW,GAAG,kBAAkB,CAAC;IAEjC,gBAAgB,GAAG,iDAAiD,CAAC;IAErE,IAAI,GAAG;QACN,KAAK,EAAE,2CAA2C;QAClD,IAAI,EAAE,2CAA2C;KACxC,CAAC;IAEX,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,gBAAgB;YAC7B,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,gFAAgF;SAC7F;QACD;YACC,WAAW,EAAE,gBAAgB;YAC7B,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,gFAAgF;SAC7F;KACD,CAAC;IAEF,6DAA6D;IAC7D,4DAA4D;IAC5D,QAAQ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,CAAC,KAAK,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;gBAClF,CAAC;gBAED,gCAAgC;gBAChC,IAAI,SAAS,GAAG,sBAAsB,GAAG,CAAC,OAAO,EAAE,CAAC;gBACpD,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;oBAClC,4DAA4D;oBAC5D,SAAS,IAAI,eAAe,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1E,CAAC;qBAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;oBACjC,SAAS,IAAI,aAAa,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAClD,CAAC;gBAED,OAAO;oBACN,MAAM,EAAE,OAAO;oBACf,OAAO,EAAE,SAAS;iBAClB,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC;CACF;AAhGD,wCAgGC"}
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ICredentialDataDecryptedObject, ICredentialTestFunctions, INodeCredentialTestResult } from 'n8n-workflow';
|
|
2
|
-
export declare function testDattoCredentials(this: ICredentialTestFunctions, credential: ICredentialDataDecryptedObject): Promise<INodeCredentialTestResult>;
|
|
3
|
-
//# sourceMappingURL=CredentialTester.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialTester.d.ts","sourceRoot":"","sources":["../../credentials/CredentialTester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,cAAc,CAAC;AAEtB,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,wBAAwB,EAC9B,UAAU,EAAE,8BAA8B,GACxC,OAAO,CAAC,yBAAyB,CAAC,CA8BpC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testDattoCredentials = testDattoCredentials;
|
|
4
|
-
async function testDattoCredentials(credential) {
|
|
5
|
-
const publicKey = credential.publicKey.trim();
|
|
6
|
-
const secretKey = credential.secretKey.trim();
|
|
7
|
-
const authHeader = `Basic ${Buffer.from(`${publicKey}:${secretKey}`).toString('base64')}`;
|
|
8
|
-
try {
|
|
9
|
-
await this.helpers.request({
|
|
10
|
-
method: 'GET',
|
|
11
|
-
url: 'https://api.datto.com/v1/bcdr/device',
|
|
12
|
-
qs: {
|
|
13
|
-
_page: 1,
|
|
14
|
-
_perPage: 1,
|
|
15
|
-
},
|
|
16
|
-
headers: {
|
|
17
|
-
Authorization: authHeader,
|
|
18
|
-
},
|
|
19
|
-
json: true,
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
status: 'OK',
|
|
23
|
-
message: 'Connection successful!',
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
return {
|
|
28
|
-
status: 'Error',
|
|
29
|
-
message: `Connection failed: ${error.message}`,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=CredentialTester.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialTester.js","sourceRoot":"","sources":["../../credentials/CredentialTester.ts"],"names":[],"mappings":";;AAMA,oDAiCC;AAjCM,KAAK,UAAU,oBAAoB,CAEzC,UAA0C;IAE1C,MAAM,SAAS,GAAI,UAAU,CAAC,SAAoB,CAAC,IAAI,EAAE,CAAC;IAC1D,MAAM,SAAS,GAAI,UAAU,CAAC,SAAoB,CAAC,IAAI,EAAE,CAAC;IAE1D,MAAM,UAAU,GAAG,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IAE1F,IAAI,CAAC;QACJ,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAC1B,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,sCAAsC;YAC3C,EAAE,EAAE;gBACH,KAAK,EAAE,CAAC;gBACR,QAAQ,EAAE,CAAC;aACX;YACD,OAAO,EAAE;gBACR,aAAa,EAAE,UAAU;aACzB;YACD,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;QAEH,OAAO;YACN,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,wBAAwB;SACjC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO;YACN,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,sBAAuB,KAAe,CAAC,OAAO,EAAE;SACzD,CAAC;IACH,CAAC;AACF,CAAC"}
|