@ixiam/n8n-nodes-civicrm 1.0.4 → 1.0.6

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,9 @@ 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
+ // ✔ NECESARIO PARA QUE N8N DETECTE EL TEST
13
+ extends = ['genericApi'];
14
+
12
15
  authenticate = {
13
16
  type: 'generic' as const,
14
17
  properties: {
@@ -18,20 +21,20 @@ export class CiviCrmApi implements ICredentialType {
18
21
  },
19
22
  };
20
23
 
21
- // ✔ Credential test correct structure for ICredentialType
24
+ // ✔ TEST reconocido por el validador
22
25
  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,
26
+ request: {
27
+ method: 'POST' as IHttpRequestMethods,
28
+ url: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/civicrm/ajax/api4/Contact/get',
29
+ headers: {
30
+ 'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
31
+ 'Content-Type': 'application/json',
32
+ },
33
+ body: {
34
+ limit: 1,
35
+ },
32
36
  },
33
- },
34
- };
37
+ };
35
38
 
36
39
  properties: INodeProperties[] = [
37
40
  {
@@ -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.6",
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": [