n8n-nodes-cala 0.2.0 → 0.2.1

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.
@@ -9,7 +9,7 @@ class Cala {
9
9
  icon: 'file:cala.svg',
10
10
  group: ['transform'],
11
11
  version: 1,
12
- subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
12
+ subtitle: '={{$parameter["operation"]}}',
13
13
  description: 'Search verified knowledge with Cala AI',
14
14
  defaults: {
15
15
  name: 'Cala',
@@ -23,38 +23,20 @@ class Cala {
23
23
  },
24
24
  ],
25
25
  properties: [
26
- {
27
- displayName: 'Resource',
28
- name: 'resource',
29
- type: 'options',
30
- noDataExpression: true,
31
- options: [
32
- {
33
- name: 'Knowledge',
34
- value: 'knowledge',
35
- },
36
- ],
37
- default: 'knowledge',
38
- },
39
26
  {
40
27
  displayName: 'Operation',
41
28
  name: 'operation',
42
29
  type: 'options',
43
30
  noDataExpression: true,
44
- displayOptions: {
45
- show: {
46
- resource: ['knowledge'],
47
- },
48
- },
49
31
  options: [
50
32
  {
51
- name: 'Search',
52
- value: 'search',
33
+ name: 'Knowledge Search',
34
+ value: 'knowledgeSearch',
53
35
  description: 'Search verified knowledge',
54
36
  action: 'Search verified knowledge',
55
37
  },
56
38
  ],
57
- default: 'search',
39
+ default: 'knowledgeSearch',
58
40
  },
59
41
  {
60
42
  displayName: 'Query',
@@ -63,8 +45,7 @@ class Cala {
63
45
  required: true,
64
46
  displayOptions: {
65
47
  show: {
66
- resource: ['knowledge'],
67
- operation: ['search'],
48
+ operation: ['knowledgeSearch'],
68
49
  },
69
50
  },
70
51
  default: '',
@@ -81,9 +62,8 @@ class Cala {
81
62
  const baseUrl = credentials.baseUrl.replace(/\/$/, '');
82
63
  const apiKey = credentials.apiKey;
83
64
  for (let i = 0; i < items.length; i++) {
84
- const resource = this.getNodeParameter('resource', i);
85
65
  const operation = this.getNodeParameter('operation', i);
86
- if (resource === 'knowledge' && operation === 'search') {
66
+ if (operation === 'knowledgeSearch') {
87
67
  const query = this.getNodeParameter('query', i);
88
68
  const headers = {
89
69
  'Content-Type': 'application/json',
@@ -7,14 +7,11 @@ describe('Cala Node', () => {
7
7
  node = new Cala_node_1.Cala();
8
8
  });
9
9
  describe('execute', () => {
10
- const createExecutionContext = ({ baseUrl = 'https://api.cala.ai/', apiKey = 'test-key', resource = 'knowledge', operation = 'search', query = 'What is Cala?', response = { content: 'ok' }, } = {}) => {
10
+ const createExecutionContext = ({ baseUrl = 'https://api.cala.ai/', apiKey = 'test-key', operation = 'knowledgeSearch', query = 'What is Cala?', response = { content: 'ok' }, } = {}) => {
11
11
  const httpRequest = jest.fn(async () => response);
12
12
  return {
13
13
  getInputData: jest.fn(() => [{ json: { input: 'one' } }]),
14
14
  getNodeParameter: jest.fn((name, _index) => {
15
- if (name === 'resource') {
16
- return resource;
17
- }
18
15
  if (name === 'operation') {
19
16
  return operation;
20
17
  }
@@ -70,10 +67,8 @@ describe('Cala Node', () => {
70
67
  const context = {
71
68
  getInputData: jest.fn(() => queries.map(q => ({ json: { query: q } }))),
72
69
  getNodeParameter: jest.fn((name, index) => {
73
- if (name === 'resource')
74
- return 'knowledge';
75
70
  if (name === 'operation')
76
- return 'search';
71
+ return 'knowledgeSearch';
77
72
  if (name === 'query')
78
73
  return queries[index];
79
74
  throw new Error(`Unexpected parameter: ${name}`);
@@ -93,10 +88,8 @@ describe('Cala Node', () => {
93
88
  const context = {
94
89
  getInputData: jest.fn(() => [{ json: {} }]),
95
90
  getNodeParameter: jest.fn((name) => {
96
- if (name === 'resource')
97
- return 'knowledge';
98
91
  if (name === 'operation')
99
- return 'search';
92
+ return 'knowledgeSearch';
100
93
  if (name === 'query')
101
94
  return 'test query';
102
95
  throw new Error(`Unexpected parameter: ${name}`);
@@ -106,15 +99,13 @@ describe('Cala Node', () => {
106
99
  };
107
100
  await expect(node.execute.call(context)).rejects.toThrow('API Error: 500 Internal Server Error');
108
101
  });
109
- it('should return empty array for unsupported resource/operation', async () => {
102
+ it('should return empty array for unsupported operation', async () => {
110
103
  const httpRequest = jest.fn();
111
104
  const context = {
112
105
  getInputData: jest.fn(() => [{ json: {} }]),
113
106
  getNodeParameter: jest.fn((name) => {
114
- if (name === 'resource')
115
- return 'unsupported';
116
107
  if (name === 'operation')
117
- return 'unknown';
108
+ return 'unsupported';
118
109
  throw new Error(`Unexpected parameter: ${name}`);
119
110
  }),
120
111
  getCredentials: jest.fn(async () => ({ baseUrl: 'https://api.cala.ai', apiKey: 'test-key' })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-cala",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "n8n nodes for Cala AI knowledge search",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",