@ixiam/n8n-nodes-civicrm 2.1.2 → 2.1.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.
@@ -15,15 +15,17 @@ const ENTITY_MAP = {
15
15
  /* ============================================================================
16
16
  LOCATION TYPE CACHE
17
17
  ============================================================================ */
18
- let locationTypeCache = null;
18
+ const locationTypeCache = {};
19
19
  function normalizeLocationKey(s) {
20
20
  return String(s || '')
21
21
  .toLowerCase()
22
22
  .replace(/[^a-z0-9]+/g, '');
23
23
  }
24
24
  async function getLocationTypeMap() {
25
- if (locationTypeCache)
26
- return locationTypeCache;
25
+ const credentials = await this.getCredentials('civiCrmApi');
26
+ const baseUrl = String((credentials === null || credentials === void 0 ? void 0 : credentials.baseUrl) || 'default');
27
+ if (locationTypeCache[baseUrl])
28
+ return locationTypeCache[baseUrl];
27
29
  const res = await GenericFunctions_1.civicrmApiRequest.call(this, 'POST', '/civicrm/ajax/api4/OptionValue/get', {
28
30
  where: [['option_group_id:name', '=', 'location_type']],
29
31
  select: ['name', 'label'],
@@ -41,7 +43,7 @@ async function getLocationTypeMap() {
41
43
  if (k2)
42
44
  map[k2] = name;
43
45
  }
44
- locationTypeCache = map;
46
+ locationTypeCache[baseUrl] = map;
45
47
  return map;
46
48
  }
47
49
  /* ============================================================================
@@ -56,20 +58,17 @@ class CiviCrm {
56
58
  group: ['transform'],
57
59
  version: 1,
58
60
  description: 'Interact with CiviCRM API v4 (Civi-Go compatible).\n\n' +
59
- 'Supports Contact, Membership, Group, Relationship and Activity entities.\n' +
61
+ 'Supports Contact, Membership, Group, Relationship, Activity entities, and Custom API Call.\n' +
60
62
  'Includes dynamic mapping of email, phone, address and location types.\n' +
61
63
  'Includes birth_date validation and JSON filters for GET MANY.\n',
62
64
  defaults: { name: 'CiviCRM' },
63
- subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
65
+ subtitle: '={{{"get":"Get","getMany":"Get Many","create":"Create","update":"Update","delete":"Delete"}[$parameter["operation"]] + ": " + {"contact":"Contact","membership":"Membership","group":"Group","relationship":"Relationship","activity":"Activity","customApi":"Custom API Call"}[$parameter["resource"]]}}',
64
66
  inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
65
67
  outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
66
68
  // @ts-ignore
67
69
  usableAsTool: true,
68
70
  // @ts-ignore
69
71
  actions: [
70
- // ======================================================================
71
- // CONTACT
72
- // ======================================================================
73
72
  {
74
73
  displayName: 'Get Contact',
75
74
  name: 'getContact',
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.upsertFields = exports.genericFields = void 0;
4
4
  exports.genericFields = [
5
5
  { displayName: 'Return All', name: 'returnAll', type: 'boolean', default: false, description: 'Whether to return all results or only up to a given limit.', displayOptions: { show: { operation: ['getMany'] } } },
6
- { displayName: 'Limit', name: 'limit', type: 'number', typeOptions: { minValue: 1, maxValue: 1000 }, default: 100, description: 'Max number of results to return.', displayOptions: { show: { operation: ['getMany'], returnAll: [false] } } },
6
+ { displayName: 'Limit', name: 'limit', type: 'number', typeOptions: { minValue: 1, maxValue: 1000 }, default: 100, description: 'Max number of results to return. Defaults to 100.', displayOptions: { show: { operation: ['getMany'], returnAll: [false] } } },
7
7
  { displayName: 'Where (JSON)', name: 'whereJson', type: 'string', default: '', placeholder: `[["first_name","=","Alice"]]`, description: 'JSON array of arrays for filtering. Example: [["first_name","=","Alice"], ["contact_type","=","Individual"]]', displayOptions: { show: { operation: ['getMany'] } } },
8
8
  ];
9
9
  exports.upsertFields = [
@@ -10,14 +10,15 @@ exports.resourceProp = {
10
10
  displayName: 'Resource',
11
11
  name: 'resource',
12
12
  type: 'options',
13
+ noDataExpression: true,
13
14
  default: 'contact',
14
15
  description: 'The entity to operate on. Choose "Custom API Call" to access any CiviCRM APIv4 entity not listed.',
15
16
  options: [
17
+ { name: 'Activity', value: 'activity' },
16
18
  { name: 'Contact', value: 'contact' },
17
- { name: 'Membership', value: 'membership' },
18
19
  { name: 'Group', value: 'group' },
20
+ { name: 'Membership', value: 'membership' },
19
21
  { name: 'Relationship', value: 'relationship' },
20
- { name: 'Activity', value: 'activity' },
21
22
  { name: 'Custom API Call', value: 'customApi' },
22
23
  ],
23
24
  };
@@ -34,10 +35,10 @@ exports.operationProp = {
34
35
  noDataExpression: true,
35
36
  description: 'The action to perform on the selected resource.',
36
37
  options: [
37
- { name: 'Create', value: 'create' },
38
- { name: 'Delete', value: 'delete' },
39
- { name: 'Get', value: 'get' },
40
- { name: 'Get Many', value: 'getMany' },
41
- { name: 'Update', value: 'update' },
38
+ { name: 'Create', value: 'create', description: 'Create a new record' },
39
+ { name: 'Delete', value: 'delete', description: 'Delete a record by ID' },
40
+ { name: 'Get', value: 'get', description: 'Retrieve a single record by ID' },
41
+ { name: 'Get Many', value: 'getMany', description: 'Retrieve multiple records with optional filtering' },
42
+ { name: 'Update', value: 'update', description: 'Update a record by ID' },
42
43
  ],
43
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixiam/n8n-nodes-civicrm",
3
- "version": "2.1.2",
3
+ "version": "2.1.5",
4
4
  "description": "Full-featured CiviCRM API v4 integration for n8n",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -12,7 +12,9 @@
12
12
  ],
13
13
  "main": "dist/index.js",
14
14
  "types": "dist/index.d.ts",
15
- "files": ["dist"],
15
+ "files": [
16
+ "dist"
17
+ ],
16
18
  "scripts": {
17
19
  "dev": "n8n-node dev",
18
20
  "build": "n8n-node build && pnpm run copy:assets",
@@ -44,7 +46,7 @@
44
46
  ]
45
47
  },
46
48
  "devDependencies": {
47
- "@n8n/node-cli": "^0.17.0",
49
+ "@n8n/node-cli": "^0.23.1",
48
50
  "@types/node": "^20.11.30",
49
51
  "eslint": "9.32.0",
50
52
  "prettier": "3.6.2",
@@ -54,5 +56,10 @@
54
56
  "peerDependencies": {
55
57
  "n8n-workflow": "*"
56
58
  },
59
+ "pnpm": {
60
+ "overrides": {
61
+ "change-case": "4.1.2"
62
+ }
63
+ },
57
64
  "packageManager": "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a"
58
65
  }