n8n-nodes-cala 0.4.3 → 0.4.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,8 +1,9 @@
1
- import { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class CalaApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
6
  properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
7
8
  test: ICredentialTestRequest;
8
9
  }
@@ -19,16 +19,21 @@ class CalaApi {
19
19
  description: 'Your Cala API key',
20
20
  },
21
21
  ];
22
- this.test = {
23
- request: {
24
- baseURL: 'https://api.cala.ai',
25
- url: '/v1/knowledge/search',
26
- method: 'POST',
22
+ this.authenticate = {
23
+ type: 'generic',
24
+ properties: {
27
25
  headers: {
28
26
  'X-API-KEY': '={{$credentials.apiKey}}',
29
27
  },
30
- body: {
31
- input: 'test',
28
+ },
29
+ };
30
+ this.test = {
31
+ request: {
32
+ baseURL: 'https://api.cala.ai',
33
+ url: '/v1/knowledge/entities',
34
+ method: 'GET',
35
+ qs: {
36
+ name: 'test',
32
37
  },
33
38
  },
34
39
  };
@@ -16,6 +16,20 @@ class Cala {
16
16
  defaults: {
17
17
  name: 'Cala',
18
18
  },
19
+ codex: {
20
+ categories: ['AI'],
21
+ subcategories: {
22
+ AI: ['Tools'],
23
+ },
24
+ alias: ['cala', 'knowledge', 'search', 'ai', 'rag'],
25
+ resources: {
26
+ primaryDocumentation: [
27
+ {
28
+ url: 'https://cala.ai',
29
+ },
30
+ ],
31
+ },
32
+ },
19
33
  inputs: ['main'],
20
34
  outputs: ['main'],
21
35
  credentials: [
@@ -132,7 +146,7 @@ class Cala {
132
146
  name: 'entityId',
133
147
  type: 'number',
134
148
  required: true,
135
- default: 0,
149
+ default: null,
136
150
  description: 'The numeric ID of the entity to retrieve',
137
151
  displayOptions: {
138
152
  show: { resource: ['knowledge'], operation: ['getEntity'] },
@@ -144,12 +158,6 @@ class Cala {
144
158
  async execute() {
145
159
  const items = this.getInputData();
146
160
  const returnData = [];
147
- const credentials = await this.getCredentials('calaApi');
148
- const apiKey = credentials.apiKey;
149
- const headers = { 'Content-Type': 'application/json' };
150
- if (apiKey) {
151
- headers['X-API-KEY'] = apiKey;
152
- }
153
161
  const resource = this.getNodeParameter('resource', 0);
154
162
  const operation = this.getNodeParameter('operation', 0);
155
163
  for (let i = 0; i < items.length; i++) {
@@ -157,20 +165,18 @@ class Cala {
157
165
  if (resource === 'knowledge') {
158
166
  if (operation === 'search') {
159
167
  const query = this.getNodeParameter('query', i);
160
- response = await this.helpers.httpRequest({
168
+ response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
161
169
  method: 'POST',
162
170
  url: `${BASE_URL}/v1/knowledge/search`,
163
- headers,
164
171
  body: { input: query },
165
172
  json: true,
166
173
  });
167
174
  }
168
175
  else if (operation === 'query') {
169
176
  const query = this.getNodeParameter('query', i);
170
- response = await this.helpers.httpRequest({
177
+ response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
171
178
  method: 'POST',
172
179
  url: `${BASE_URL}/v1/knowledge/query`,
173
- headers,
174
180
  body: { input: query },
175
181
  json: true,
176
182
  });
@@ -178,20 +184,18 @@ class Cala {
178
184
  else if (operation === 'searchEntities') {
179
185
  const name = this.getNodeParameter('name', i);
180
186
  const limit = this.getNodeParameter('limit', i);
181
- response = await this.helpers.httpRequest({
187
+ response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
182
188
  method: 'GET',
183
189
  url: `${BASE_URL}/v1/knowledge/entities`,
184
- headers,
185
190
  qs: { name, limit },
186
191
  json: true,
187
192
  });
188
193
  }
189
194
  else if (operation === 'getEntity') {
190
195
  const entityId = this.getNodeParameter('entityId', i);
191
- response = await this.helpers.httpRequest({
196
+ response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
192
197
  method: 'GET',
193
198
  url: `${BASE_URL}/v1/knowledge/entities/${entityId}`,
194
- headers,
195
199
  json: true,
196
200
  });
197
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-cala",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "n8n nodes for Cala AI knowledge search",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",