@connectorx/n8n-nodes-cortex 0.1.5 → 0.1.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.
@@ -11,7 +11,15 @@ class CortexApi {
11
11
  name: 'apiBaseUrl',
12
12
  type: 'string',
13
13
  default: 'https://api.your-cortex-instance.com',
14
- description: 'The base URL of the Cortex API (e.g. https://api.example.com)',
14
+ description: 'The base URL of the Cortex API (e.g. https://your-project.supabase.co/functions/v1/api) - Do not include trailing slash',
15
+ required: true,
16
+ },
17
+ {
18
+ displayName: 'Tenant ID',
19
+ name: 'tenantId',
20
+ type: 'string',
21
+ default: '',
22
+ description: 'The Tenant ID (e.g. tenant_123)',
15
23
  required: true,
16
24
  },
17
25
  {
@@ -27,8 +35,8 @@ class CortexApi {
27
35
  ];
28
36
  this.test = {
29
37
  request: {
30
- baseURL: '={{$credentials.apiBaseUrl}}',
31
- url: '/auth/validate',
38
+ baseURL: '={{$credentials.apiBaseUrl.replace(/\\/$/, "")}}',
39
+ url: '/auth/me',
32
40
  method: 'GET',
33
41
  headers: {
34
42
  Authorization: '={{ "Bearer " + $credentials.accessToken }}',
@@ -281,13 +281,14 @@ class Cortex {
281
281
  async getColumns() {
282
282
  const credentials = await this.getCredentials('cortexApi');
283
283
  const baseUrl = credentials.apiBaseUrl.replace(/\/$/, '');
284
+ const tenantId = credentials.tenantId;
284
285
  const options = {
285
286
  headers: {
286
287
  'Content-Type': 'application/json',
287
288
  'Authorization': `Bearer ${credentials.accessToken}`,
288
289
  },
289
290
  method: 'GET',
290
- uri: `${baseUrl}/kanban/columns`,
291
+ uri: `${baseUrl}/kanban/${tenantId}/columns`,
291
292
  json: true,
292
293
  };
293
294
  try {
@@ -301,13 +302,14 @@ class Cortex {
301
302
  async getUsers() {
302
303
  const credentials = await this.getCredentials('cortexApi');
303
304
  const baseUrl = credentials.apiBaseUrl.replace(/\/$/, '');
305
+ const tenantId = credentials.tenantId;
304
306
  const options = {
305
307
  headers: {
306
308
  'Content-Type': 'application/json',
307
309
  'Authorization': `Bearer ${credentials.accessToken}`,
308
310
  },
309
311
  method: 'GET',
310
- uri: `${baseUrl}/kanban/users`,
312
+ uri: `${baseUrl}/kanban/${tenantId}/users`,
311
313
  json: true,
312
314
  };
313
315
  try {
@@ -328,6 +330,7 @@ class Cortex {
328
330
  const operation = this.getNodeParameter('operation', 0);
329
331
  const credentials = await this.getCredentials('cortexApi');
330
332
  const baseUrl = credentials.apiBaseUrl.replace(/\/$/, '');
333
+ const tenantId = credentials.tenantId;
331
334
  for (let i = 0; i < items.length; i++) {
332
335
  try {
333
336
  const conversationId = this.getNodeParameter('conversation_id', i);
@@ -354,6 +357,7 @@ class Cortex {
354
357
  const reactTo = this.getNodeParameter('react_to_message_id', i);
355
358
  const body = {
356
359
  conversation_id: conversationId,
360
+ tenant_id: tenantId,
357
361
  type: msgType,
358
362
  sender_type: senderType,
359
363
  };
@@ -373,6 +377,7 @@ class Cortex {
373
377
  const status = this.getNodeParameter('typing_status', i);
374
378
  options.body = {
375
379
  conversation_id: conversationId,
380
+ tenant_id: tenantId,
376
381
  status: status,
377
382
  };
378
383
  }
@@ -380,7 +385,7 @@ class Cortex {
380
385
  else if (resource === 'conversation') {
381
386
  if (operation === 'update') {
382
387
  options.method = 'PATCH';
383
- options.uri = `${baseUrl}/kanban/conversations/${conversationId}`;
388
+ options.uri = `${baseUrl}/kanban/${tenantId}/conversations/${conversationId}`;
384
389
  const columnId = this.getNodeParameter('column_id', i);
385
390
  const ownerId = this.getNodeParameter('owner_id', i);
386
391
  const status = this.getNodeParameter('status', i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectorx/n8n-nodes-cortex",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "n8n nodes for Cortex API",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "main": "index.js",
14
14
  "scripts": {
15
- "build": "tsc && npm run copy-files",
15
+ "build": "node node_modules/typescript/lib/tsc.js && npm run copy-files",
16
16
  "copy-files": "copyfiles -u 1 \"nodes/**/*.svg\" \"nodes/**/*.png\" dist/nodes && copyfiles -u 1 \"credentials/**/*.svg\" \"credentials/**/*.png\" dist/credentials",
17
17
  "dev": "tsc --watch",
18
18
  "lint": "eslint nodes credentials --ext .ts",
Binary file