n8n-nodes-cala 0.4.0 → 0.4.2
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,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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;
|
|
8
7
|
test: ICredentialTestRequest;
|
|
9
8
|
}
|
|
@@ -19,19 +19,14 @@ class CalaApi {
|
|
|
19
19
|
description: 'Your Cala API key',
|
|
20
20
|
},
|
|
21
21
|
];
|
|
22
|
-
this.authenticate = {
|
|
23
|
-
type: 'generic',
|
|
24
|
-
properties: {
|
|
25
|
-
headers: {
|
|
26
|
-
'X-API-KEY': '={{$credentials.apiKey}}',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
22
|
this.test = {
|
|
31
23
|
request: {
|
|
32
24
|
baseURL: 'https://api.cala.ai',
|
|
33
25
|
url: '/v1/knowledge/search',
|
|
34
26
|
method: 'POST',
|
|
27
|
+
headers: {
|
|
28
|
+
'X-API-KEY': '={{$credentials.apiKey}}',
|
|
29
|
+
},
|
|
35
30
|
body: {
|
|
36
31
|
input: 'test',
|
|
37
32
|
},
|
|
@@ -138,66 +138,6 @@ class Cala {
|
|
|
138
138
|
show: { resource: ['knowledge'], operation: ['getEntity'] },
|
|
139
139
|
},
|
|
140
140
|
},
|
|
141
|
-
// ── Custom API Call ─────────────────────────────────────────────────
|
|
142
|
-
{
|
|
143
|
-
displayName: 'HTTP Method',
|
|
144
|
-
name: 'method',
|
|
145
|
-
type: 'options',
|
|
146
|
-
options: [
|
|
147
|
-
{ name: 'DELETE', value: 'DELETE' },
|
|
148
|
-
{ name: 'GET', value: 'GET' },
|
|
149
|
-
{ name: 'PATCH', value: 'PATCH' },
|
|
150
|
-
{ name: 'POST', value: 'POST' },
|
|
151
|
-
{ name: 'PUT', value: 'PUT' },
|
|
152
|
-
],
|
|
153
|
-
default: 'GET',
|
|
154
|
-
displayOptions: {
|
|
155
|
-
show: { operation: ['__CUSTOM_API_CALL__'] },
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
displayName: 'URL',
|
|
160
|
-
name: 'url',
|
|
161
|
-
type: 'string',
|
|
162
|
-
default: '',
|
|
163
|
-
placeholder: '/v1/knowledge/search',
|
|
164
|
-
description: 'API path relative to https://api.cala.ai',
|
|
165
|
-
displayOptions: {
|
|
166
|
-
show: { operation: ['__CUSTOM_API_CALL__'] },
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
displayName: 'Query Parameters',
|
|
171
|
-
name: 'qs',
|
|
172
|
-
type: 'fixedCollection',
|
|
173
|
-
typeOptions: { multipleValues: true },
|
|
174
|
-
default: {},
|
|
175
|
-
options: [
|
|
176
|
-
{
|
|
177
|
-
name: 'parameter',
|
|
178
|
-
displayName: 'Parameter',
|
|
179
|
-
values: [
|
|
180
|
-
{ displayName: 'Name', name: 'name', type: 'string', default: '' },
|
|
181
|
-
{ displayName: 'Value', name: 'value', type: 'string', default: '' },
|
|
182
|
-
],
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
displayOptions: {
|
|
186
|
-
show: { operation: ['__CUSTOM_API_CALL__'] },
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
displayName: 'Request Body',
|
|
191
|
-
name: 'body',
|
|
192
|
-
type: 'json',
|
|
193
|
-
default: '{}',
|
|
194
|
-
displayOptions: {
|
|
195
|
-
show: {
|
|
196
|
-
operation: ['__CUSTOM_API_CALL__'],
|
|
197
|
-
method: ['POST', 'PUT', 'PATCH'],
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
141
|
],
|
|
202
142
|
};
|
|
203
143
|
}
|
|
@@ -211,30 +151,10 @@ class Cala {
|
|
|
211
151
|
headers['X-API-KEY'] = apiKey;
|
|
212
152
|
}
|
|
213
153
|
const resource = this.getNodeParameter('resource', 0);
|
|
214
|
-
if (resource === '__CUSTOM_API_CALL__') {
|
|
215
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'To make a custom API call, use the HTTP Request node and select the Cala API credential.');
|
|
216
|
-
}
|
|
217
154
|
const operation = this.getNodeParameter('operation', 0);
|
|
218
155
|
for (let i = 0; i < items.length; i++) {
|
|
219
156
|
let response;
|
|
220
|
-
if (
|
|
221
|
-
const method = this.getNodeParameter('method', i);
|
|
222
|
-
const url = this.getNodeParameter('url', i);
|
|
223
|
-
const qsParams = this.getNodeParameter('qs.parameter', i, []);
|
|
224
|
-
const qs = Object.fromEntries(qsParams.map(({ name, value }) => [name, value]));
|
|
225
|
-
const requestOptions = {
|
|
226
|
-
method,
|
|
227
|
-
url: `${BASE_URL}${url}`,
|
|
228
|
-
headers,
|
|
229
|
-
json: true,
|
|
230
|
-
...(Object.keys(qs).length > 0 && { qs }),
|
|
231
|
-
...(['POST', 'PUT', 'PATCH'].includes(method) && {
|
|
232
|
-
body: JSON.parse(this.getNodeParameter('body', i, '{}')),
|
|
233
|
-
}),
|
|
234
|
-
};
|
|
235
|
-
response = await this.helpers.httpRequest(requestOptions);
|
|
236
|
-
}
|
|
237
|
-
else if (resource === 'knowledge') {
|
|
157
|
+
if (resource === 'knowledge') {
|
|
238
158
|
if (operation === 'search') {
|
|
239
159
|
const query = this.getNodeParameter('query', i);
|
|
240
160
|
response = await this.helpers.httpRequest({
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-cala.cala",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["AI", "Data & Storage"],
|
|
6
|
+
"subcategories": {
|
|
7
|
+
"AI": ["Tools"]
|
|
8
|
+
},
|
|
9
|
+
"resources": {
|
|
10
|
+
"primaryDocumentation": [
|
|
11
|
+
{
|
|
12
|
+
"url": "https://docs.cala.ai"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-cala",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "n8n nodes for Cala AI knowledge search",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"typescript-eslint": "^8.53.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"n8n-workflow": "
|
|
52
|
+
"n8n-workflow": ">=1.0.0"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
|
-
"node": ">=
|
|
55
|
+
"node": ">=18",
|
|
56
56
|
"pnpm": ">=10"
|
|
57
57
|
},
|
|
58
58
|
"volta": {
|