n8n-nodes-digitalsac 1.0.3 → 1.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.
@@ -1,4 +1,4 @@
1
- import { ICredentialType, NodePropertyTypes } from 'n8n-workflow';
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, NodePropertyTypes } from 'n8n-workflow';
2
2
  export declare class DigitalsacApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
@@ -9,11 +9,17 @@ export declare class DigitalsacApi implements ICredentialType {
9
9
  type: NodePropertyTypes;
10
10
  default: string;
11
11
  description: string;
12
+ typeOptions?: undefined;
12
13
  } | {
13
14
  displayName: string;
14
15
  name: string;
15
16
  type: NodePropertyTypes;
16
17
  default: string;
18
+ typeOptions: {
19
+ password: boolean;
20
+ };
17
21
  description?: undefined;
18
22
  })[];
23
+ authenticate: IAuthenticateGeneric;
24
+ test: ICredentialTestRequest;
19
25
  }
@@ -19,8 +19,25 @@ class DigitalsacApi {
19
19
  name: 'token',
20
20
  type: 'string',
21
21
  default: '',
22
+ typeOptions: { password: true },
22
23
  },
23
24
  ];
25
+ this.authenticate = {
26
+ type: 'generic',
27
+ properties: {
28
+ headers: {
29
+ Authorization: '=Bearer {{$credentials.token}}',
30
+ Accept: 'application/json',
31
+ },
32
+ },
33
+ };
34
+ this.test = {
35
+ request: {
36
+ baseURL: '={{$credentials.baseUrl}}',
37
+ url: '/version',
38
+ method: 'GET',
39
+ },
40
+ };
24
41
  }
25
42
  }
26
43
  exports.DigitalsacApi = DigitalsacApi;
@@ -716,6 +716,7 @@ class Digitalsac {
716
716
  };
717
717
  }
718
718
  async execute() {
719
+ var _a, _b, _c;
719
720
  const items = this.getInputData();
720
721
  const returnData = [];
721
722
  const credentials = await this.getCredentials('digitalsacApi');
@@ -1287,12 +1288,21 @@ class Digitalsac {
1287
1288
  };
1288
1289
  }
1289
1290
  try {
1290
- responseData = await this.helpers.request(options);
1291
+ // httpRequest usa 'url' (request está deprecated)
1292
+ const requestUrl = options.uri || `${baseUrl}${url}`;
1293
+ const requestOptions = {
1294
+ url: requestUrl,
1295
+ method: options.method || method,
1296
+ headers: options.headers || headers,
1297
+ ...(options.body !== undefined && { body: options.body }),
1298
+ };
1299
+ responseData = await this.helpers.httpRequest(requestOptions);
1291
1300
  returnData.push({ json: responseData });
1292
1301
  }
1293
1302
  catch (error) {
1303
+ const body = (_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : (_c = error.response) === null || _c === void 0 ? void 0 : _c.body;
1294
1304
  if (error.response) {
1295
- returnData.push({ json: { error: error.response.body || error.message } });
1305
+ returnData.push({ json: { error: body || error.message } });
1296
1306
  }
1297
1307
  else {
1298
1308
  returnData.push({ json: { error: error.message } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-digitalsac",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Izing Pro Digitalsac - Compatible with n8n v2.x",
5
5
  "keywords": [
6
6
  "n8n",