@limetech/n8n-nodes-lime 0.3.7 → 0.4.0

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/credentials/LimeCrmApi.credentials.ts +13 -0
  3. package/dist/credentials/LimeCrmApi.credentials.js +12 -0
  4. package/dist/credentials/LimeCrmApi.credentials.js.map +1 -1
  5. package/dist/nodes/lime-crm/LimeCrmNode.node.js +13 -0
  6. package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -1
  7. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +17 -2
  8. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +1 -1
  9. package/dist/nodes/lime-crm/commons/constants.d.ts +1 -0
  10. package/dist/nodes/lime-crm/commons/constants.js +2 -1
  11. package/dist/nodes/lime-crm/commons/constants.js.map +1 -1
  12. package/dist/nodes/lime-crm/commons/hmac.d.ts +1 -0
  13. package/dist/nodes/lime-crm/commons/hmac.js +11 -0
  14. package/dist/nodes/lime-crm/commons/hmac.js.map +1 -0
  15. package/dist/nodes/lime-crm/commons/index.d.ts +1 -1
  16. package/dist/nodes/lime-crm/commons/index.js +2 -1
  17. package/dist/nodes/lime-crm/commons/index.js.map +1 -1
  18. package/dist/nodes/lime-crm/commons/webhook.d.ts +3 -0
  19. package/dist/nodes/lime-crm/commons/webhook.js.map +1 -1
  20. package/dist/nodes/lime-crm/resources/erpConnector/index.d.ts +2 -2
  21. package/dist/nodes/lime-crm/resources/limeObject/index.js +6 -6
  22. package/dist/nodes/lime-crm/resources/limeObject/index.js.map +1 -1
  23. package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.d.ts +9 -0
  24. package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.js +103 -0
  25. package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.js.map +1 -0
  26. package/dist/nodes/lime-crm/resources/limeQuery/index.d.ts +6 -0
  27. package/dist/nodes/lime-crm/resources/limeQuery/index.js +66 -0
  28. package/dist/nodes/lime-crm/resources/limeQuery/index.js.map +1 -0
  29. package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.d.ts +9 -0
  30. package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js +191 -0
  31. package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js.map +1 -0
  32. package/dist/nodes/lime-crm/transport/index.d.ts +2 -1
  33. package/dist/nodes/lime-crm/transport/index.js +4 -2
  34. package/dist/nodes/lime-crm/transport/index.js.map +1 -1
  35. package/dist/nodes/lime-crm/transport/limeQuery.d.ts +10 -0
  36. package/dist/nodes/lime-crm/transport/limeQuery.js +15 -0
  37. package/dist/nodes/lime-crm/transport/limeQuery.js.map +1 -0
  38. package/dist/nodes/lime-crm/transport/limeobjects.d.ts +1 -1
  39. package/dist/nodes/lime-crm/transport/limeobjects.js +5 -3
  40. package/dist/nodes/lime-crm/transport/limeobjects.js.map +1 -1
  41. package/dist/nodes/lime-crm/transport/webhooks.d.ts +2 -1
  42. package/dist/nodes/lime-crm/transport/webhooks.js +1 -0
  43. package/dist/nodes/lime-crm/transport/webhooks.js.map +1 -1
  44. package/dist/package.json +2 -1
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/nodes/lime-crm/LimeCrmNode.node.ts +14 -0
  47. package/nodes/lime-crm/LimeCrmTrigger.node.ts +29 -3
  48. package/nodes/lime-crm/commons/constants.ts +1 -0
  49. package/nodes/lime-crm/commons/hmac.ts +13 -0
  50. package/nodes/lime-crm/commons/index.ts +1 -0
  51. package/nodes/lime-crm/commons/webhook.ts +4 -0
  52. package/nodes/lime-crm/resources/limeObject/index.ts +6 -6
  53. package/nodes/lime-crm/resources/limeObject/operations/{search.operation.ts → fetchMany.operation.ts} +11 -11
  54. package/nodes/lime-crm/resources/limeQuery/index.ts +40 -0
  55. package/nodes/lime-crm/resources/limeQuery/operations/query.operation.ts +222 -0
  56. package/nodes/lime-crm/transport/index.ts +2 -1
  57. package/nodes/lime-crm/transport/limeQuery.ts +28 -0
  58. package/nodes/lime-crm/transport/limeobjects.ts +8 -6
  59. package/nodes/lime-crm/transport/webhooks.ts +3 -1
  60. package/package.json +2 -1
@@ -14,12 +14,14 @@ import {
14
14
  } from './resources/erpConnector';
15
15
  import { limeTypeFields, limeTypeOperations } from './resources/limeType';
16
16
  import { limeObjectFields, limeObjectOperations } from './resources/limeObject';
17
+ import { queryFields, queryOperations } from './resources/limeQuery';
17
18
 
18
19
  import {
19
20
  LIMEOBJECT_RESOURCE,
20
21
  LIMETYPE_RESOURCE,
21
22
  LIME_CRM_API_CREDENTIAL_KEY,
22
23
  ERP_CONNECTOR_RESOURCE,
24
+ LIME_QUERY_RESOURCE,
23
25
  } from './commons';
24
26
 
25
27
  import {
@@ -71,6 +73,12 @@ export class LimeCrmNode implements INodeType {
71
73
  value: ERP_CONNECTOR_RESOURCE,
72
74
  description: 'Integrate data between ERP and Lime CRM',
73
75
  },
76
+ {
77
+ name: 'Lime Query',
78
+ value: LIME_QUERY_RESOURCE,
79
+ description:
80
+ 'Easily gather a particular set of limeobjects',
81
+ },
74
82
  ],
75
83
  default: LIMEOBJECT_RESOURCE,
76
84
  },
@@ -78,6 +86,7 @@ export class LimeCrmNode implements INodeType {
78
86
  ...(limeTypeFields as INodeProperties[]),
79
87
  ...(limeObjectFields as INodeProperties[]),
80
88
  ...(erpConnectorFields as INodeProperties[]),
89
+ ...(queryFields as INodeProperties[]),
81
90
  ],
82
91
  };
83
92
 
@@ -114,6 +123,11 @@ export class LimeCrmNode implements INodeType {
114
123
  operation,
115
124
  i,
116
125
  });
126
+ } else if (resource === LIME_QUERY_RESOURCE) {
127
+ responseData = await queryOperations.call(this, {
128
+ operation,
129
+ i,
130
+ });
117
131
  }
118
132
 
119
133
  returnData.push({ json: responseData });
@@ -19,6 +19,8 @@ import {
19
19
  listSubscriptionsWithExistingData,
20
20
  } from './transport';
21
21
 
22
+ import { verifyHmac } from './commons/hmac';
23
+
22
24
  export class LimeCrmTrigger implements INodeType {
23
25
  description: INodeTypeDescription = {
24
26
  displayName: 'Lime CRM Trigger',
@@ -174,9 +176,17 @@ export class LimeCrmTrigger implements INodeType {
174
176
  }
175
177
 
176
178
  if (existingSubscriptionResponse.data.length === 0) {
179
+ const credentials = await this.getCredentials(
180
+ LIME_CRM_API_CREDENTIAL_KEY
181
+ );
182
+ const webhookCreateData = {
183
+ ...webhook,
184
+ secret: credentials.webhookSecret as string,
185
+ };
186
+
177
187
  const createSubscriptionResponse = await createSubscription(
178
188
  this,
179
- webhook
189
+ webhookCreateData
180
190
  );
181
191
 
182
192
  if (!createSubscriptionResponse.success) {
@@ -238,7 +248,24 @@ export class LimeCrmTrigger implements INodeType {
238
248
  Logger.info('Webhook received. Starting webhook processing...', {
239
249
  ...webhook.context,
240
250
  });
251
+ const credentials = await this.getCredentials(
252
+ LIME_CRM_API_CREDENTIAL_KEY
253
+ );
254
+ const webhookSecret = credentials.webhookSecret as string;
255
+ const requestObject = this.getRequestObject();
256
+ const headerData = this.getHeaderData();
241
257
  const bodyData = this.getBodyData();
258
+ const limeSignature = headerData['x-lime-signature'] as string;
259
+
260
+ if (
261
+ (webhookSecret || limeSignature) &&
262
+ !verifyHmac(webhookSecret, requestObject.rawBody, limeSignature)
263
+ ) {
264
+ throw new NodeOperationError(
265
+ this.getNode(),
266
+ 'Webhook authentication failed, secret keys do not match!'
267
+ );
268
+ }
242
269
 
243
270
  if (!bodyData || !bodyData.event || !bodyData.body) {
244
271
  Logger.warn('Webhook data is invalid. Missing event or body', {
@@ -251,10 +278,9 @@ export class LimeCrmTrigger implements INodeType {
251
278
  }
252
279
 
253
280
  const returnData: IDataObject[] = [];
254
-
255
281
  returnData.push({
256
282
  body: bodyData,
257
- headers: this.getHeaderData(),
283
+ headers: headerData,
258
284
  query: this.getQueryData(),
259
285
  });
260
286
 
@@ -7,3 +7,4 @@ export const LIME_CRM_API_CREDENTIAL_KEY = 'limeCrmApi';
7
7
  export const LIMEOBJECT_RESOURCE = 'limeObject';
8
8
  export const LIMETYPE_RESOURCE = 'limeType';
9
9
  export const ERP_CONNECTOR_RESOURCE = 'erpConnector';
10
+ export const LIME_QUERY_RESOURCE = 'limeQuery';
@@ -0,0 +1,13 @@
1
+ import { createHmac } from 'node:crypto';
2
+
3
+ function _generateHmac(key: string, data: Buffer): string {
4
+ return 'sha256=' + createHmac('sha256', key).update(data).digest('hex');
5
+ }
6
+
7
+ export function verifyHmac(
8
+ key: string,
9
+ data: Buffer,
10
+ comparedHmac: string
11
+ ): boolean {
12
+ return _generateHmac(key, data) === comparedHmac;
13
+ }
@@ -3,6 +3,7 @@ export {
3
3
  LIMEOBJECT_RESOURCE,
4
4
  LIMETYPE_RESOURCE,
5
5
  ERP_CONNECTOR_RESOURCE,
6
+ LIME_QUERY_RESOURCE,
6
7
  } from './constants';
7
8
  export { Webhook, getWebhook } from './webhook';
8
9
 
@@ -17,6 +17,10 @@ export interface Webhook {
17
17
  name: string;
18
18
  }
19
19
 
20
+ export interface CreateWebhook extends Webhook {
21
+ secret?: string;
22
+ }
23
+
20
24
  function _getEvents(hookData: WebhookFunctions): string[] {
21
25
  const eventData = hookData.getNodeParameter('events', []) as {
22
26
  event: Array<{
@@ -8,7 +8,7 @@ import * as create from './operations/create.operation';
8
8
  import * as get from './operations/get.operation';
9
9
  import * as update from './operations/update.operation';
10
10
  import * as delete_ from './operations/delete.operation';
11
- import * as search from './operations/search.operation';
11
+ import * as fetchMany from './operations/fetchMany.operation';
12
12
 
13
13
  import { LIMEOBJECT_RESOURCE } from '../../commons';
14
14
 
@@ -28,16 +28,16 @@ export const limeObjectFields: INodeProperties[] = [
28
28
  get.description,
29
29
  update.description,
30
30
  delete_.description,
31
- search.description,
31
+ fetchMany.description,
32
32
  ],
33
- default: 'search',
33
+ default: 'fetchMany',
34
34
  },
35
35
 
36
36
  ...create.properties,
37
37
  ...get.properties,
38
38
  ...update.properties,
39
39
  ...delete_.properties,
40
- ...search.properties,
40
+ ...fetchMany.properties,
41
41
  ];
42
42
 
43
43
  export async function limeObjectOperations(
@@ -56,8 +56,8 @@ export async function limeObjectOperations(
56
56
  if (operation === 'delete') {
57
57
  return await delete_.execute.call(this, i);
58
58
  }
59
- if (operation === 'search') {
60
- return await search.execute.call(this, i);
59
+ if (operation === 'fetchMany') {
60
+ return await fetchMany.execute.call(this, i);
61
61
  }
62
62
 
63
63
  return null;
@@ -1,12 +1,12 @@
1
1
  import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
- import { searchLimeObject } from '../../../transport';
2
+ import { fetchManyLimeObjects } from '../../../transport';
3
3
  import { LIMEOBJECT_RESOURCE } from '../../../commons';
4
4
 
5
5
  export const description = {
6
- name: 'Search',
7
- value: 'search',
8
- description: 'Search for objects',
9
- action: 'Search for objects',
6
+ name: 'Fetch many',
7
+ value: 'fetchMany',
8
+ description: 'Fetch many Lime objects',
9
+ action: 'Fetch many objects',
10
10
  };
11
11
 
12
12
  export const properties: INodeProperties[] = [
@@ -23,7 +23,7 @@ export const properties: INodeProperties[] = [
23
23
  displayOptions: {
24
24
  show: {
25
25
  resource: [LIMEOBJECT_RESOURCE],
26
- operation: ['search'],
26
+ operation: ['fetchMany'],
27
27
  },
28
28
  },
29
29
  },
@@ -36,7 +36,7 @@ export const properties: INodeProperties[] = [
36
36
  displayOptions: {
37
37
  show: {
38
38
  resource: [LIMEOBJECT_RESOURCE],
39
- operation: ['search'],
39
+ operation: ['fetchMany'],
40
40
  },
41
41
  },
42
42
  },
@@ -54,7 +54,7 @@ export const properties: INodeProperties[] = [
54
54
  displayOptions: {
55
55
  show: {
56
56
  resource: [LIMEOBJECT_RESOURCE],
57
- operation: ['search'],
57
+ operation: ['fetchMany'],
58
58
  },
59
59
  },
60
60
  },
@@ -70,7 +70,7 @@ export const properties: INodeProperties[] = [
70
70
  displayOptions: {
71
71
  show: {
72
72
  resource: [LIMEOBJECT_RESOURCE],
73
- operation: ['search'],
73
+ operation: ['fetchMany'],
74
74
  },
75
75
  },
76
76
  },
@@ -86,7 +86,7 @@ export const properties: INodeProperties[] = [
86
86
  displayOptions: {
87
87
  show: {
88
88
  resource: [LIMEOBJECT_RESOURCE],
89
- operation: ['search'],
89
+ operation: ['fetchMany'],
90
90
  },
91
91
  },
92
92
  },
@@ -100,7 +100,7 @@ export async function execute(this: IExecuteFunctions, i: number) {
100
100
  const offset = this.getNodeParameter('offset', i, 0) as number;
101
101
  const options = this.getNodeParameter('options', i, {});
102
102
 
103
- return await searchLimeObject(
103
+ return await fetchManyLimeObjects(
104
104
  this,
105
105
  limeType,
106
106
  searchField,
@@ -0,0 +1,40 @@
1
+ import {
2
+ IExecuteFunctions,
3
+ INodeProperties,
4
+ NodePropertyTypes,
5
+ } from 'n8n-workflow';
6
+
7
+ import * as query from './operations/query.operation';
8
+ import { LIME_QUERY_RESOURCE } from '../../commons';
9
+
10
+ export const queryFields: INodeProperties[] = [
11
+ {
12
+ displayName: 'Operation',
13
+ name: 'operation',
14
+ type: 'options' as NodePropertyTypes,
15
+ noDataExpression: true,
16
+ displayOptions: {
17
+ show: {
18
+ resource: [LIME_QUERY_RESOURCE],
19
+ },
20
+ },
21
+ options: [
22
+ {
23
+ ...query.description,
24
+ },
25
+ ],
26
+ default: 'query',
27
+ },
28
+
29
+ ...query.properties,
30
+ ];
31
+
32
+ export async function queryOperations(
33
+ this: IExecuteFunctions,
34
+ { operation, i }: { operation: string; i: number }
35
+ ) {
36
+ if (operation === 'query') {
37
+ return await query.execute.call(this, i);
38
+ }
39
+ return null;
40
+ }
@@ -0,0 +1,222 @@
1
+ import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+
3
+ import { queryLimeObjects } from '../../../transport';
4
+ import { LIME_QUERY_RESOURCE } from '../../../commons';
5
+
6
+ export const description = {
7
+ name: 'Query',
8
+ value: 'query',
9
+ description: 'Query objects with Lime Query API',
10
+ action: 'Query objects',
11
+ };
12
+
13
+ interface OrderByCollection {
14
+ orderByFields: {
15
+ propertyName: string;
16
+ sortDirection: 'ASC' | 'DESC';
17
+ }[];
18
+ }
19
+
20
+ interface ActiveObjectCollection {
21
+ activeObjectFields: {
22
+ limetype: string;
23
+ id: number;
24
+ };
25
+ }
26
+
27
+ export const properties: INodeProperties[] = [
28
+ {
29
+ displayName: 'Lime Type',
30
+ name: 'limeType',
31
+ type: 'options',
32
+ typeOptions: {
33
+ loadOptionsMethod: 'getLimeTypes',
34
+ },
35
+ required: true,
36
+ default: '',
37
+ description: 'The type of entity to query',
38
+ displayOptions: {
39
+ show: {
40
+ resource: [LIME_QUERY_RESOURCE],
41
+ operation: ['query'],
42
+ },
43
+ },
44
+ },
45
+ {
46
+ displayName: 'Response Format (JSON)',
47
+ name: 'responseFormat',
48
+ type: 'json',
49
+ required: true,
50
+ default: '{}',
51
+ description: 'Information that should be included in the response',
52
+ displayOptions: {
53
+ show: {
54
+ resource: [LIME_QUERY_RESOURCE],
55
+ operation: ['query'],
56
+ },
57
+ },
58
+ },
59
+ {
60
+ displayName: 'Filter (JSON)',
61
+ name: 'filter',
62
+ type: 'json',
63
+ default: '{}',
64
+ description: "The filter DSL defining the query's conditions",
65
+ displayOptions: {
66
+ show: {
67
+ resource: [LIME_QUERY_RESOURCE],
68
+ operation: ['query'],
69
+ },
70
+ },
71
+ },
72
+ {
73
+ displayName: 'Limit',
74
+ name: 'limit',
75
+ type: 'number',
76
+ default: null,
77
+ description: 'The maximum number of records to return',
78
+ displayOptions: {
79
+ show: {
80
+ resource: [LIME_QUERY_RESOURCE],
81
+ operation: ['query'],
82
+ },
83
+ },
84
+ },
85
+ {
86
+ displayName: 'Order By',
87
+ name: 'orderBy',
88
+ type: 'fixedCollection',
89
+ typeOptions: {
90
+ multipleValues: true,
91
+ },
92
+ default: {},
93
+ description:
94
+ 'The list of properties by which to order the query results',
95
+ displayOptions: {
96
+ show: {
97
+ resource: [LIME_QUERY_RESOURCE],
98
+ operation: ['query'],
99
+ },
100
+ },
101
+ options: [
102
+ {
103
+ name: 'orderByFields',
104
+ displayName: 'Order By Fields',
105
+ values: [
106
+ {
107
+ displayName: 'Property Name',
108
+ name: 'propertyName',
109
+ type: 'string',
110
+ description: 'Name of the property to order by',
111
+ default: '',
112
+ required: true,
113
+ },
114
+ {
115
+ displayName: 'Sort Direction',
116
+ name: 'sortDirection',
117
+ type: 'options',
118
+ default: 'ASC',
119
+ description: 'Ordering direction',
120
+ options: [
121
+ { name: 'ASC', value: 'ASC' },
122
+ { name: 'DESC', value: 'DESC' },
123
+ ],
124
+ },
125
+ ],
126
+ },
127
+ ],
128
+ },
129
+ {
130
+ displayName: 'Offset',
131
+ name: 'offset',
132
+ type: 'number',
133
+ default: null,
134
+ description:
135
+ 'The offset from which to start returning records. This operation requires the `Order By` field to be set',
136
+ displayOptions: {
137
+ show: {
138
+ resource: [LIME_QUERY_RESOURCE],
139
+ operation: ['query'],
140
+ },
141
+ },
142
+ },
143
+ {
144
+ displayName: 'Active Object',
145
+ name: 'activeObject',
146
+ type: 'fixedCollection',
147
+ default: {},
148
+ description:
149
+ "A dict with keys 'limetype' and 'id' representing the active object in the context of the query",
150
+ displayOptions: {
151
+ show: {
152
+ resource: [LIME_QUERY_RESOURCE],
153
+ operation: ['query'],
154
+ },
155
+ },
156
+ options: [
157
+ {
158
+ name: 'activeObjectFields',
159
+ displayName: 'Active Object Fields',
160
+ values: [
161
+ {
162
+ displayName: 'Lime Type',
163
+ name: 'limetype',
164
+ type: 'options',
165
+ description: 'Name of the limetype',
166
+ default: '',
167
+ typeOptions: {
168
+ loadOptionsMethod: 'getLimeTypes',
169
+ },
170
+ required: true,
171
+ },
172
+ {
173
+ displayName: 'Lime Object ID',
174
+ name: 'id',
175
+ type: 'number',
176
+ default: 0,
177
+ description:
178
+ 'ID representing the object in the context of the query',
179
+ required: true,
180
+ },
181
+ ],
182
+ },
183
+ ],
184
+ },
185
+ ];
186
+
187
+ export async function execute(this: IExecuteFunctions, i: number) {
188
+ const limeType = this.getNodeParameter('limeType', i) as string;
189
+ const responseFormat = this.getNodeParameter('responseFormat', i) as string;
190
+ const filter = this.getNodeParameter('filter', i) as string;
191
+ const limit = this.getNodeParameter('limit', i) as number;
192
+ const offset = this.getNodeParameter('offset', i) as number;
193
+ const orderByCollection = this.getNodeParameter(
194
+ 'orderBy',
195
+ i
196
+ ) as OrderByCollection;
197
+ const activeObjectCollection = this.getNodeParameter(
198
+ 'activeObject',
199
+ i
200
+ ) as ActiveObjectCollection;
201
+
202
+ const orderBy =
203
+ orderByCollection.orderByFields &&
204
+ orderByCollection.orderByFields.map((field) => ({
205
+ [field.propertyName]: field.sortDirection,
206
+ }));
207
+
208
+ const q = JSON.stringify({
209
+ limetype: limeType,
210
+ responseFormat: JSON.parse(responseFormat),
211
+ filter: JSON.parse(filter),
212
+ limit: limit,
213
+ offset: offset,
214
+ orderBy: orderBy,
215
+ });
216
+
217
+ const activeObject = JSON.stringify(
218
+ activeObjectCollection.activeObjectFields
219
+ );
220
+
221
+ return queryLimeObjects(this, q, activeObject);
222
+ }
@@ -11,7 +11,8 @@ export {
11
11
  deleteLimeObject,
12
12
  updateLimeObject,
13
13
  getLimeObject,
14
- searchLimeObject,
14
+ fetchManyLimeObjects,
15
15
  } from './limeobjects';
16
16
  export { startCreateOrUpdateObjectsTask } from './erpConnector';
17
+ export { queryLimeObjects } from './limeQuery';
17
18
  export { callLimeApi } from './commons';
@@ -0,0 +1,28 @@
1
+ import { IAllExecuteFunctions } from 'n8n-workflow';
2
+ import { NodeResponse } from '../../nodeResponse';
3
+ import { callLimeApi } from './commons';
4
+
5
+ const LIME_QUERY_URL = '/api/v1/query/';
6
+
7
+ interface IncludedProperties {
8
+ [key: string]: IncludedProperties | string | number | boolean | null;
9
+ }
10
+
11
+ export interface QueryResponse {
12
+ objects: IncludedProperties[];
13
+ }
14
+
15
+ export async function queryLimeObjects(
16
+ nodeContext: IAllExecuteFunctions,
17
+ q: string,
18
+ activeObject: string
19
+ ): Promise<NodeResponse<QueryResponse>> {
20
+ const queryParameters = {
21
+ q: q,
22
+ activeObject: activeObject,
23
+ };
24
+
25
+ return await callLimeApi(nodeContext, 'GET', LIME_QUERY_URL, {
26
+ qs: queryParameters,
27
+ });
28
+ }
@@ -4,7 +4,7 @@ import { NodeResponse } from '../../nodeResponse';
4
4
 
5
5
  const LIMEOBJECT_URL = '/api/v1/limeobject/';
6
6
 
7
- interface SearchLimeobjectApiResponse {
7
+ interface FetchManyLimeObjectsApiResponse {
8
8
  _embedded: {
9
9
  limeobjects: Array<object>;
10
10
  };
@@ -103,7 +103,7 @@ async function _searchLimeObjectWithLimit(
103
103
  limit: number,
104
104
  offset: number,
105
105
  qs: IDataObject
106
- ): Promise<NodeResponse<SearchLimeobjectApiResponse>> {
106
+ ): Promise<NodeResponse<FetchManyLimeObjectsApiResponse>> {
107
107
  const returnData = [];
108
108
  let hasMoreData = true;
109
109
  let currentOffset = Math.max(0, offset);
@@ -113,7 +113,7 @@ async function _searchLimeObjectWithLimit(
113
113
  qs._limit = Math.min(limit, pageLimit);
114
114
  qs._offset = currentOffset;
115
115
 
116
- const response = await callLimeApi<SearchLimeobjectApiResponse>(
116
+ const response = await callLimeApi<FetchManyLimeObjectsApiResponse>(
117
117
  nodeContext,
118
118
  'GET',
119
119
  url,
@@ -143,7 +143,7 @@ async function _searchLimeObjectWithLimit(
143
143
  };
144
144
  }
145
145
 
146
- export async function searchLimeObject(
146
+ export async function fetchManyLimeObjects(
147
147
  nodeContext: IAllExecuteFunctions,
148
148
  limeType: string,
149
149
  searchField: string,
@@ -169,7 +169,7 @@ export async function searchLimeObject(
169
169
  qs
170
170
  );
171
171
  } else {
172
- response = await callLimeApi<SearchLimeobjectApiResponse>(
172
+ response = await callLimeApi<FetchManyLimeObjectsApiResponse>(
173
173
  nodeContext,
174
174
  'GET',
175
175
  url,
@@ -186,7 +186,9 @@ export async function searchLimeObject(
186
186
  };
187
187
  }
188
188
  return {
189
- ...response,
189
+ success: response.success,
190
+ error: response.error,
191
+ status: response.status,
190
192
  metadata: {
191
193
  ...response.metadata,
192
194
  limeType: limeType,
@@ -2,6 +2,7 @@ import { Webhook } from '../commons';
2
2
  import { callLimeApi } from '.';
3
3
  import { IAllExecuteFunctions } from 'n8n-workflow';
4
4
  import { NodeResponse } from '../../nodeResponse';
5
+ import { CreateWebhook } from '../commons/webhook';
5
6
 
6
7
  const SUBSCRIPTION_URL = 'api/v1/subscription/';
7
8
 
@@ -39,13 +40,14 @@ export async function listSubscriptionsWithExistingData(
39
40
 
40
41
  export async function createSubscription(
41
42
  nodeContext: IAllExecuteFunctions,
42
- webhook: Webhook
43
+ webhook: CreateWebhook
43
44
  ): Promise<NodeResponse<ApiResponseWebhook>> {
44
45
  return await callLimeApi(nodeContext, 'POST', SUBSCRIPTION_URL, {
45
46
  body: {
46
47
  events: webhook.events,
47
48
  target_url: webhook.url,
48
49
  name: webhook.name,
50
+ secret: webhook.secret,
49
51
  },
50
52
  });
51
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/n8n-nodes-lime",
3
- "version": "0.3.7",
3
+ "version": "0.4.0",
4
4
  "description": "n8n node to connect to Lime CRM",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -30,6 +30,7 @@
30
30
  ],
31
31
  "nodes": [
32
32
  "dist/nodes/lime-crm/LimeCrmNode.node.js",
33
+ "dist/nodes/lime-crm/LimeCrmTrigger.node.js",
33
34
  "dist/nodes/fortnox/Fortnox.node.js",
34
35
  "dist/nodes/fortnox/FortnoxTrigger.node.js"
35
36
  ]