@joshuanode/n8n-nodes-datto-backup 0.1.0-beta.7 → 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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ICredentialDataDecryptedObject, ICredentialTestFunctions, ICredentialType, INodeCredentialTestResult, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
export declare class DattoBackupApi implements ICredentialType {
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
@@ -8,7 +8,9 @@ export declare class DattoBackupApi implements ICredentialType {
|
|
|
8
8
|
readonly dark: "file:../nodes/DattoBackup/dattobackup.svg";
|
|
9
9
|
};
|
|
10
10
|
properties: INodeProperties[];
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
testedBy: {
|
|
12
|
+
credentialType: string;
|
|
13
|
+
testRequest: (this: ICredentialTestFunctions, credential: ICredentialDataDecryptedObject) => Promise<INodeCredentialTestResult>;
|
|
14
|
+
};
|
|
13
15
|
}
|
|
14
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,
|
|
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"}
|
|
@@ -30,23 +30,58 @@ class DattoBackupApi {
|
|
|
30
30
|
description: 'The Secret API Key from Datto Partner Portal (Admin > Integrations > API Keys)',
|
|
31
31
|
},
|
|
32
32
|
];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
// Custom credential tester that runs in full Node.js context
|
|
34
|
+
// This avoids n8n expression limitations with Buffer.from()
|
|
35
|
+
testedBy = {
|
|
36
|
+
credentialType: 'dattoBackupApi',
|
|
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
|
+
}
|
|
50
85
|
},
|
|
51
86
|
};
|
|
52
87
|
}
|
|
@@ -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,QAA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