@limetech/n8n-nodes-lime 0.3.8 → 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.
- package/CHANGELOG.md +7 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js +13 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -1
- package/dist/nodes/lime-crm/commons/constants.d.ts +1 -0
- package/dist/nodes/lime-crm/commons/constants.js +2 -1
- package/dist/nodes/lime-crm/commons/constants.js.map +1 -1
- package/dist/nodes/lime-crm/commons/index.d.ts +1 -1
- package/dist/nodes/lime-crm/commons/index.js +2 -1
- package/dist/nodes/lime-crm/commons/index.js.map +1 -1
- package/dist/nodes/lime-crm/resources/limeQuery/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/limeQuery/index.js +66 -0
- package/dist/nodes/lime-crm/resources/limeQuery/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js +191 -0
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/index.d.ts +3 -3
- package/dist/nodes/lime-crm/transport/index.d.ts +1 -0
- package/dist/nodes/lime-crm/transport/index.js +3 -1
- package/dist/nodes/lime-crm/transport/index.js.map +1 -1
- package/dist/nodes/lime-crm/transport/limeQuery.d.ts +10 -0
- package/dist/nodes/lime-crm/transport/limeQuery.js +15 -0
- package/dist/nodes/lime-crm/transport/limeQuery.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nodes/lime-crm/LimeCrmNode.node.ts +14 -0
- package/nodes/lime-crm/commons/constants.ts +1 -0
- package/nodes/lime-crm/commons/index.ts +1 -0
- package/nodes/lime-crm/resources/limeQuery/index.ts +40 -0
- package/nodes/lime-crm/resources/limeQuery/operations/query.operation.ts +222 -0
- package/nodes/lime-crm/transport/index.ts +1 -0
- package/nodes/lime-crm/transport/limeQuery.ts +28 -0
- package/package.json +1 -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 });
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|