@ixiam/n8n-nodes-civicrm 1.0.4 → 1.0.5

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,6 +1,7 @@
1
1
  import type {
2
2
  ICredentialType,
3
3
  INodeProperties,
4
+ IHttpRequestMethods,
4
5
  } from 'n8n-workflow';
5
6
 
6
7
  export class CiviCrmApi implements ICredentialType {
@@ -8,7 +9,6 @@ export class CiviCrmApi implements ICredentialType {
8
9
  displayName = 'CiviCRM API';
9
10
  documentationUrl = 'https://docs.civicrm.org/dev/en/latest/api/';
10
11
 
11
- // ✔ Authentication block — must use literal type
12
12
  authenticate = {
13
13
  type: 'generic' as const,
14
14
  properties: {
@@ -18,20 +18,21 @@ export class CiviCrmApi implements ICredentialType {
18
18
  },
19
19
  };
20
20
 
21
- // Credential test correct structure for ICredentialType
21
+ // Credential test button (requerido por n8n)
22
22
  test = {
23
- request: {
24
- method: 'POST' as const,
25
- url: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/civicrm/ajax/api4/Contact/get',
26
- headers: {
27
- 'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
28
- 'Content-Type': 'application/json',
29
- },
30
- body: {
31
- limit: 1,
23
+ request: {
24
+ method: 'POST' as IHttpRequestMethods,
25
+ url: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/civicrm/ajax/api4/Contact/get',
26
+ headers: {
27
+ 'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
28
+ 'Content-Type': 'application/json',
29
+ },
30
+ body: {
31
+ limit: 1,
32
+ },
33
+ // IMPORTANTE: no pongas json: true aquí, rompe el tipo de test
32
34
  },
33
- },
34
- };
35
+ };
35
36
 
36
37
  properties: INodeProperties[] = [
37
38
  {
@@ -40,6 +41,8 @@ export class CiviCrmApi implements ICredentialType {
40
41
  type: 'string',
41
42
  default: '',
42
43
  required: true,
44
+ placeholder: 'https://crm.example.org',
45
+ description: 'Base URL without a trailing slash.',
43
46
  },
44
47
  {
45
48
  displayName: 'API Token',
@@ -48,6 +51,7 @@ export class CiviCrmApi implements ICredentialType {
48
51
  typeOptions: { password: true },
49
52
  default: '',
50
53
  required: true,
54
+ description: 'Sent as "X-Civi-Auth: Bearer <token>"',
51
55
  },
52
56
  ];
53
57
  }
@@ -1,4 +1,4 @@
1
- import type { ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import type { ICredentialType, INodeProperties, IHttpRequestMethods } from 'n8n-workflow';
2
2
  export declare class CiviCrmApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
@@ -13,7 +13,7 @@ export declare class CiviCrmApi implements ICredentialType {
13
13
  };
14
14
  test: {
15
15
  request: {
16
- method: "POST";
16
+ method: IHttpRequestMethods;
17
17
  url: string;
18
18
  headers: {
19
19
  'X-Civi-Auth': string;
@@ -6,7 +6,6 @@ class CiviCrmApi {
6
6
  this.name = 'civiCrmApi';
7
7
  this.displayName = 'CiviCRM API';
8
8
  this.documentationUrl = 'https://docs.civicrm.org/dev/en/latest/api/';
9
- // ✔ Authentication block — must use literal type
10
9
  this.authenticate = {
11
10
  type: 'generic',
12
11
  properties: {
@@ -15,7 +14,7 @@ class CiviCrmApi {
15
14
  },
16
15
  },
17
16
  };
18
- // Credential test correct structure for ICredentialType
17
+ // Credential test button (requerido por n8n)
19
18
  this.test = {
20
19
  request: {
21
20
  method: 'POST',
@@ -27,6 +26,7 @@ class CiviCrmApi {
27
26
  body: {
28
27
  limit: 1,
29
28
  },
29
+ // IMPORTANTE: no pongas json: true aquí, rompe el tipo de test
30
30
  },
31
31
  };
32
32
  this.properties = [
@@ -36,6 +36,8 @@ class CiviCrmApi {
36
36
  type: 'string',
37
37
  default: '',
38
38
  required: true,
39
+ placeholder: 'https://crm.example.org',
40
+ description: 'Base URL without a trailing slash.',
39
41
  },
40
42
  {
41
43
  displayName: 'API Token',
@@ -44,6 +46,7 @@ class CiviCrmApi {
44
46
  typeOptions: { password: true },
45
47
  default: '',
46
48
  required: true,
49
+ description: 'Sent as "X-Civi-Auth: Bearer <token>"',
47
50
  },
48
51
  ];
49
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixiam/n8n-nodes-civicrm",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Full-featured CiviCRM API v4 integration for n8n with support for Contacts, Memberships, Groups, Relationships, Activities and structured sub-entities like Email, Phone, and Address.",
5
5
  "license": "MIT",
6
6
  "keywords": [