n8n-nodes-cala 0.4.3 → 0.4.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,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,17 +19,19 @@ class CalaApi {
|
|
|
19
19
|
description: 'Your Cala API key',
|
|
20
20
|
},
|
|
21
21
|
];
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
this.test = {
|
|
31
|
+
request: {
|
|
32
|
+
baseURL: 'https://api.cala.ai',
|
|
33
|
+
url: '/v1/knowledge/entities',
|
|
34
|
+
method: 'GET',
|
|
33
35
|
},
|
|
34
36
|
};
|
|
35
37
|
}
|
|
@@ -144,12 +144,6 @@ class Cala {
|
|
|
144
144
|
async execute() {
|
|
145
145
|
const items = this.getInputData();
|
|
146
146
|
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
147
|
const resource = this.getNodeParameter('resource', 0);
|
|
154
148
|
const operation = this.getNodeParameter('operation', 0);
|
|
155
149
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -157,20 +151,18 @@ class Cala {
|
|
|
157
151
|
if (resource === 'knowledge') {
|
|
158
152
|
if (operation === 'search') {
|
|
159
153
|
const query = this.getNodeParameter('query', i);
|
|
160
|
-
response = await this.helpers.
|
|
154
|
+
response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
|
|
161
155
|
method: 'POST',
|
|
162
156
|
url: `${BASE_URL}/v1/knowledge/search`,
|
|
163
|
-
headers,
|
|
164
157
|
body: { input: query },
|
|
165
158
|
json: true,
|
|
166
159
|
});
|
|
167
160
|
}
|
|
168
161
|
else if (operation === 'query') {
|
|
169
162
|
const query = this.getNodeParameter('query', i);
|
|
170
|
-
response = await this.helpers.
|
|
163
|
+
response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
|
|
171
164
|
method: 'POST',
|
|
172
165
|
url: `${BASE_URL}/v1/knowledge/query`,
|
|
173
|
-
headers,
|
|
174
166
|
body: { input: query },
|
|
175
167
|
json: true,
|
|
176
168
|
});
|
|
@@ -178,20 +170,18 @@ class Cala {
|
|
|
178
170
|
else if (operation === 'searchEntities') {
|
|
179
171
|
const name = this.getNodeParameter('name', i);
|
|
180
172
|
const limit = this.getNodeParameter('limit', i);
|
|
181
|
-
response = await this.helpers.
|
|
173
|
+
response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
|
|
182
174
|
method: 'GET',
|
|
183
175
|
url: `${BASE_URL}/v1/knowledge/entities`,
|
|
184
|
-
headers,
|
|
185
176
|
qs: { name, limit },
|
|
186
177
|
json: true,
|
|
187
178
|
});
|
|
188
179
|
}
|
|
189
180
|
else if (operation === 'getEntity') {
|
|
190
181
|
const entityId = this.getNodeParameter('entityId', i);
|
|
191
|
-
response = await this.helpers.
|
|
182
|
+
response = await this.helpers.httpRequestWithAuthentication.call(this, 'calaApi', {
|
|
192
183
|
method: 'GET',
|
|
193
184
|
url: `${BASE_URL}/v1/knowledge/entities/${entityId}`,
|
|
194
|
-
headers,
|
|
195
185
|
json: true,
|
|
196
186
|
});
|
|
197
187
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-cala",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "n8n nodes for Cala AI knowledge search",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
"bugs": {
|
|
24
24
|
"url": "https://github.com/cala-ai/cala-n8n-node/issues"
|
|
25
25
|
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc && gulp build:icons",
|
|
28
|
+
"dev": "tsc --watch",
|
|
29
|
+
"test": "jest",
|
|
30
|
+
"lint": "eslint nodes credentials",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
26
33
|
"files": [
|
|
27
34
|
"dist",
|
|
28
35
|
"LICENSE",
|
|
@@ -58,10 +65,5 @@
|
|
|
58
65
|
"volta": {
|
|
59
66
|
"node": "22.13.1"
|
|
60
67
|
},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
"dev": "tsc --watch",
|
|
64
|
-
"test": "jest",
|
|
65
|
-
"lint": "eslint nodes credentials"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
+
"packageManager": "pnpm@10.2.1"
|
|
69
|
+
}
|