@ixiam/n8n-nodes-civicrm 1.0.2 → 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,7 +1,6 @@
1
1
  import type {
2
2
  ICredentialType,
3
3
  INodeProperties,
4
- IHttpRequestMethods,
5
4
  } from 'n8n-workflow';
6
5
 
7
6
  export class CiviCrmApi implements ICredentialType {
@@ -9,31 +8,30 @@ export class CiviCrmApi implements ICredentialType {
9
8
  displayName = 'CiviCRM API';
10
9
  documentationUrl = 'https://docs.civicrm.org/dev/en/latest/api/';
11
10
 
11
+ // ✔ Authentication block — must use literal type
12
12
  authenticate = {
13
13
  type: 'generic' as const,
14
14
  properties: {
15
15
  headers: {
16
16
  'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
17
- 'Content-Type': 'application/x-www-form-urlencoded',
18
17
  },
19
18
  },
20
19
  };
21
20
 
22
- // Credential test button
21
+ // Credential test — correct structure for ICredentialType
23
22
  test = {
24
- request: {
25
- method: 'POST' as IHttpRequestMethods,
26
- url: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/civicrm/ajax/api4/Contact/get',
27
- headers: {
28
- 'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
29
- 'Content-Type': 'application/x-www-form-urlencoded',
30
- },
31
- body: {
32
- params: '={"limit":1}', // API4 compatible
33
- },
34
- json: true,
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',
35
29
  },
36
- };
30
+ body: {
31
+ limit: 1,
32
+ },
33
+ },
34
+ };
37
35
 
38
36
  properties: INodeProperties[] = [
39
37
  {
@@ -42,8 +40,6 @@ export class CiviCrmApi implements ICredentialType {
42
40
  type: 'string',
43
41
  default: '',
44
42
  required: true,
45
- placeholder: 'https://crm.example.org',
46
- description: 'Base URL without a trailing slash.',
47
43
  },
48
44
  {
49
45
  displayName: 'API Token',
@@ -52,7 +48,6 @@ export class CiviCrmApi implements ICredentialType {
52
48
  typeOptions: { password: true },
53
49
  default: '',
54
50
  required: true,
55
- description: 'Sent as "X-Civi-Auth: Bearer <token>"',
56
51
  },
57
52
  ];
58
53
  }
@@ -1,4 +1,4 @@
1
- import type { ICredentialType, INodeProperties, IHttpRequestMethods } from 'n8n-workflow';
1
+ import type { ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class CiviCrmApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
@@ -8,22 +8,20 @@ export declare class CiviCrmApi implements ICredentialType {
8
8
  properties: {
9
9
  headers: {
10
10
  'X-Civi-Auth': string;
11
- 'Content-Type': string;
12
11
  };
13
12
  };
14
13
  };
15
14
  test: {
16
15
  request: {
17
- method: IHttpRequestMethods;
16
+ method: "POST";
18
17
  url: string;
19
18
  headers: {
20
19
  'X-Civi-Auth': string;
21
20
  'Content-Type': string;
22
21
  };
23
22
  body: {
24
- params: string;
23
+ limit: number;
25
24
  };
26
- json: boolean;
27
25
  };
28
26
  };
29
27
  properties: INodeProperties[];
@@ -6,28 +6,27 @@ 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
9
10
  this.authenticate = {
10
11
  type: 'generic',
11
12
  properties: {
12
13
  headers: {
13
14
  'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
14
- 'Content-Type': 'application/x-www-form-urlencoded',
15
15
  },
16
16
  },
17
17
  };
18
- // Credential test button
18
+ // Credential test — correct structure for ICredentialType
19
19
  this.test = {
20
20
  request: {
21
21
  method: 'POST',
22
22
  url: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/civicrm/ajax/api4/Contact/get',
23
23
  headers: {
24
24
  'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
25
- 'Content-Type': 'application/x-www-form-urlencoded',
25
+ 'Content-Type': 'application/json',
26
26
  },
27
27
  body: {
28
- params: '={"limit":1}', // API4 compatible
28
+ limit: 1,
29
29
  },
30
- json: true,
31
30
  },
32
31
  };
33
32
  this.properties = [
@@ -37,8 +36,6 @@ class CiviCrmApi {
37
36
  type: 'string',
38
37
  default: '',
39
38
  required: true,
40
- placeholder: 'https://crm.example.org',
41
- description: 'Base URL without a trailing slash.',
42
39
  },
43
40
  {
44
41
  displayName: 'API Token',
@@ -47,7 +44,6 @@ class CiviCrmApi {
47
44
  typeOptions: { password: true },
48
45
  default: '',
49
46
  required: true,
50
- description: 'Sent as "X-Civi-Auth: Bearer <token>"',
51
47
  },
52
48
  ];
53
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixiam/n8n-nodes-civicrm",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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": [
@@ -27,7 +27,7 @@
27
27
  "bugs": {
28
28
  "url": "https://github.com/ixiam/n8n-nodes-civicrm/issues"
29
29
  },
30
- "author": "Ixiam/Julian Reartes <info@ixiam.com> (https://www.ixiam.com)",
30
+ "author": "Ixiam/Julian Reartes <j.reartes@ixiam.com> (https://www.ixiam.com)",
31
31
  "engines": {
32
32
  "node": ">=18"
33
33
  },