@limetech/n8n-nodes-lime 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.
Files changed (192) hide show
  1. package/nodes/lime-crm/LimeCrm.node.json +16 -16
  2. package/package.json +47 -47
  3. package/{dist/tsconfig.tsbuildinfo → tsconfig.tsbuildinfo} +1 -1
  4. package/.eslintrc.js +0 -58
  5. package/.github/copilot-instructions.md +0 -20
  6. package/.github/workflows/publish.yml +0 -34
  7. package/README.md +0 -79
  8. package/credentials/LimeCrmApi.credentials.ts +0 -57
  9. package/credentials/LimeGoApi.credentials.ts +0 -31
  10. package/dist/nodes/lime-crm/LimeCrm.node.json +0 -18
  11. package/dist/nodes/lime-crm/lime-crm.svg +0 -1
  12. package/dist/nodes/lime-go/lime-go.svg +0 -1
  13. package/dist/package.json +0 -49
  14. package/docker-compose.yml +0 -44
  15. package/index.js +0 -3
  16. package/nodes/lime-crm/GenericTypes.ts +0 -114
  17. package/nodes/lime-crm/LimeCrmNode.node.ts +0 -154
  18. package/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.ts +0 -461
  19. package/nodes/lime-crm/LimeCrmTrigger.node.ts +0 -505
  20. package/nodes/lime-crm/methods/getAllSortableFields.ts +0 -73
  21. package/nodes/lime-crm/methods/getLimeTypeProperties.ts +0 -48
  22. package/nodes/lime-crm/methods/getLimeTypeRelations.ts +0 -32
  23. package/nodes/lime-crm/methods/getLimeTypes.ts +0 -33
  24. package/nodes/lime-crm/methods/getRelatedTypeProperties.ts +0 -47
  25. package/nodes/lime-crm/methods/index.ts +0 -5
  26. package/nodes/lime-crm/resources/limeObject/commonFields.ts +0 -179
  27. package/nodes/lime-crm/resources/limeObject/index.ts +0 -64
  28. package/nodes/lime-crm/resources/limeObject/operations/common.operation.ts +0 -35
  29. package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +0 -234
  30. package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +0 -136
  31. package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +0 -124
  32. package/nodes/lime-crm/resources/limeObject/operations/getAll.operation.ts +0 -242
  33. package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +0 -242
  34. package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +0 -201
  35. package/nodes/lime-crm/resources/limeType/index.ts +0 -66
  36. package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +0 -105
  37. package/nodes/lime-crm/resources/limeType/operations/getRelations.operation.ts +0 -105
  38. package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +0 -58
  39. package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +0 -76
  40. package/nodes/lime-crm/resources/queryApi/index.ts +0 -42
  41. package/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.ts +0 -605
  42. package/nodes/lime-crm/transport/index.ts +0 -74
  43. package/nodes/lime-go/LimeGo.node.ts +0 -146
  44. package/nodes/lime-go/actions/organization/get.operation.ts +0 -42
  45. package/nodes/lime-go/actions/organization/getByExternalKey.operation.ts +0 -57
  46. package/nodes/lime-go/actions/organization/index.ts +0 -69
  47. package/nodes/lime-go/actions/organization/organizationFields.ts +0 -160
  48. package/nodes/lime-go/actions/organization/search.operation.ts +0 -73
  49. package/nodes/lime-go/actions/organization/update.operation.ts +0 -140
  50. package/nodes/lime-go/actions/person/createMail.operation.ts +0 -140
  51. package/nodes/lime-go/actions/person/get.operation.ts +0 -51
  52. package/nodes/lime-go/actions/person/index.ts +0 -69
  53. package/nodes/lime-go/actions/person/personFields.ts +0 -132
  54. package/nodes/lime-go/actions/person/search.operation.ts +0 -88
  55. package/nodes/lime-go/actions/person/update.operation.ts +0 -122
  56. package/nodes/lime-go/transport/graphqlRequest.ts +0 -30
  57. package/tsconfig.json +0 -30
  58. /package/{dist/credentials → credentials}/LimeCrmApi.credentials.d.ts +0 -0
  59. /package/{dist/credentials → credentials}/LimeCrmApi.credentials.js +0 -0
  60. /package/{dist/credentials → credentials}/LimeCrmApi.credentials.js.map +0 -0
  61. /package/{dist/credentials → credentials}/LimeGoApi.credentials.d.ts +0 -0
  62. /package/{dist/credentials → credentials}/LimeGoApi.credentials.js +0 -0
  63. /package/{dist/credentials → credentials}/LimeGoApi.credentials.js.map +0 -0
  64. /package/{dist/nodes → nodes}/lime-crm/GenericTypes.d.ts +0 -0
  65. /package/{dist/nodes → nodes}/lime-crm/GenericTypes.js +0 -0
  66. /package/{dist/nodes → nodes}/lime-crm/GenericTypes.js.map +0 -0
  67. /package/{dist/nodes → nodes}/lime-crm/LimeCrmNode.node.d.ts +0 -0
  68. /package/{dist/nodes → nodes}/lime-crm/LimeCrmNode.node.js +0 -0
  69. /package/{dist/nodes → nodes}/lime-crm/LimeCrmNode.node.js.map +0 -0
  70. /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.d.ts +0 -0
  71. /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js +0 -0
  72. /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js.map +0 -0
  73. /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger.node.d.ts +0 -0
  74. /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger.node.js +0 -0
  75. /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger.node.js.map +0 -0
  76. /package/{dist/nodes → nodes}/lime-crm/methods/getAllSortableFields.d.ts +0 -0
  77. /package/{dist/nodes → nodes}/lime-crm/methods/getAllSortableFields.js +0 -0
  78. /package/{dist/nodes → nodes}/lime-crm/methods/getAllSortableFields.js.map +0 -0
  79. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeProperties.d.ts +0 -0
  80. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeProperties.js +0 -0
  81. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeProperties.js.map +0 -0
  82. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeRelations.d.ts +0 -0
  83. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeRelations.js +0 -0
  84. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeRelations.js.map +0 -0
  85. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypes.d.ts +0 -0
  86. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypes.js +0 -0
  87. /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypes.js.map +0 -0
  88. /package/{dist/nodes → nodes}/lime-crm/methods/getRelatedTypeProperties.d.ts +0 -0
  89. /package/{dist/nodes → nodes}/lime-crm/methods/getRelatedTypeProperties.js +0 -0
  90. /package/{dist/nodes → nodes}/lime-crm/methods/getRelatedTypeProperties.js.map +0 -0
  91. /package/{dist/nodes → nodes}/lime-crm/methods/index.d.ts +0 -0
  92. /package/{dist/nodes → nodes}/lime-crm/methods/index.js +0 -0
  93. /package/{dist/nodes → nodes}/lime-crm/methods/index.js.map +0 -0
  94. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/commonFields.d.ts +0 -0
  95. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/commonFields.js +0 -0
  96. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/commonFields.js.map +0 -0
  97. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/index.d.ts +0 -0
  98. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/index.js +0 -0
  99. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/index.js.map +0 -0
  100. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/common.operation.d.ts +0 -0
  101. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/common.operation.js +0 -0
  102. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/common.operation.js.map +0 -0
  103. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/create.operation.d.ts +0 -0
  104. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/create.operation.js +0 -0
  105. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/create.operation.js.map +0 -0
  106. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/delete.operation.d.ts +0 -0
  107. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/delete.operation.js +0 -0
  108. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/delete.operation.js.map +0 -0
  109. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/get.operation.d.ts +0 -0
  110. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/get.operation.js +0 -0
  111. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/get.operation.js.map +0 -0
  112. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/getAll.operation.d.ts +0 -0
  113. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/getAll.operation.js +0 -0
  114. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/getAll.operation.js.map +0 -0
  115. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/search.operation.d.ts +0 -0
  116. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/search.operation.js +0 -0
  117. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/search.operation.js.map +0 -0
  118. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/update.operation.d.ts +0 -0
  119. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/update.operation.js +0 -0
  120. /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/update.operation.js.map +0 -0
  121. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/index.d.ts +0 -0
  122. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/index.js +0 -0
  123. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/index.js.map +0 -0
  124. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getProperties.operation.d.ts +0 -0
  125. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getProperties.operation.js +0 -0
  126. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getProperties.operation.js.map +0 -0
  127. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getRelations.operation.d.ts +0 -0
  128. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getRelations.operation.js +0 -0
  129. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getRelations.operation.js.map +0 -0
  130. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getType.operation.d.ts +0 -0
  131. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getType.operation.js +0 -0
  132. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getType.operation.js.map +0 -0
  133. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/listTypes.operation.d.ts +0 -0
  134. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/listTypes.operation.js +0 -0
  135. /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/listTypes.operation.js.map +0 -0
  136. /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/index.d.ts +0 -0
  137. /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/index.js +0 -0
  138. /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/index.js.map +0 -0
  139. /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/operations/executeQuery.operation.d.ts +0 -0
  140. /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/operations/executeQuery.operation.js +0 -0
  141. /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/operations/executeQuery.operation.js.map +0 -0
  142. /package/{dist/nodes → nodes}/lime-crm/transport/index.d.ts +0 -0
  143. /package/{dist/nodes → nodes}/lime-crm/transport/index.js +0 -0
  144. /package/{dist/nodes → nodes}/lime-crm/transport/index.js.map +0 -0
  145. /package/{dist/nodes → nodes}/lime-go/LimeGo.node.d.ts +0 -0
  146. /package/{dist/nodes → nodes}/lime-go/LimeGo.node.js +0 -0
  147. /package/{dist/nodes → nodes}/lime-go/LimeGo.node.js.map +0 -0
  148. /package/{dist/nodes → nodes}/lime-go/actions/organization/get.operation.d.ts +0 -0
  149. /package/{dist/nodes → nodes}/lime-go/actions/organization/get.operation.js +0 -0
  150. /package/{dist/nodes → nodes}/lime-go/actions/organization/get.operation.js.map +0 -0
  151. /package/{dist/nodes → nodes}/lime-go/actions/organization/getByExternalKey.operation.d.ts +0 -0
  152. /package/{dist/nodes → nodes}/lime-go/actions/organization/getByExternalKey.operation.js +0 -0
  153. /package/{dist/nodes → nodes}/lime-go/actions/organization/getByExternalKey.operation.js.map +0 -0
  154. /package/{dist/nodes → nodes}/lime-go/actions/organization/index.d.ts +0 -0
  155. /package/{dist/nodes → nodes}/lime-go/actions/organization/index.js +0 -0
  156. /package/{dist/nodes → nodes}/lime-go/actions/organization/index.js.map +0 -0
  157. /package/{dist/nodes → nodes}/lime-go/actions/organization/organizationFields.d.ts +0 -0
  158. /package/{dist/nodes → nodes}/lime-go/actions/organization/organizationFields.js +0 -0
  159. /package/{dist/nodes → nodes}/lime-go/actions/organization/organizationFields.js.map +0 -0
  160. /package/{dist/nodes → nodes}/lime-go/actions/organization/search.operation.d.ts +0 -0
  161. /package/{dist/nodes → nodes}/lime-go/actions/organization/search.operation.js +0 -0
  162. /package/{dist/nodes → nodes}/lime-go/actions/organization/search.operation.js.map +0 -0
  163. /package/{dist/nodes → nodes}/lime-go/actions/organization/update.operation.d.ts +0 -0
  164. /package/{dist/nodes → nodes}/lime-go/actions/organization/update.operation.js +0 -0
  165. /package/{dist/nodes → nodes}/lime-go/actions/organization/update.operation.js.map +0 -0
  166. /package/{dist/nodes → nodes}/lime-go/actions/person/createMail.operation.d.ts +0 -0
  167. /package/{dist/nodes → nodes}/lime-go/actions/person/createMail.operation.js +0 -0
  168. /package/{dist/nodes → nodes}/lime-go/actions/person/createMail.operation.js.map +0 -0
  169. /package/{dist/nodes → nodes}/lime-go/actions/person/get.operation.d.ts +0 -0
  170. /package/{dist/nodes → nodes}/lime-go/actions/person/get.operation.js +0 -0
  171. /package/{dist/nodes → nodes}/lime-go/actions/person/get.operation.js.map +0 -0
  172. /package/{dist/nodes → nodes}/lime-go/actions/person/index.d.ts +0 -0
  173. /package/{dist/nodes → nodes}/lime-go/actions/person/index.js +0 -0
  174. /package/{dist/nodes → nodes}/lime-go/actions/person/index.js.map +0 -0
  175. /package/{dist/nodes → nodes}/lime-go/actions/person/personFields.d.ts +0 -0
  176. /package/{dist/nodes → nodes}/lime-go/actions/person/personFields.js +0 -0
  177. /package/{dist/nodes → nodes}/lime-go/actions/person/personFields.js.map +0 -0
  178. /package/{dist/nodes → nodes}/lime-go/actions/person/search.operation.d.ts +0 -0
  179. /package/{dist/nodes → nodes}/lime-go/actions/person/search.operation.js +0 -0
  180. /package/{dist/nodes → nodes}/lime-go/actions/person/search.operation.js.map +0 -0
  181. /package/{dist/nodes → nodes}/lime-go/actions/person/update.operation.d.ts +0 -0
  182. /package/{dist/nodes → nodes}/lime-go/actions/person/update.operation.js +0 -0
  183. /package/{dist/nodes → nodes}/lime-go/actions/person/update.operation.js.map +0 -0
  184. /package/{dist/nodes → nodes}/lime-go/transport/graphqlRequest.d.ts +0 -0
  185. /package/{dist/nodes → nodes}/lime-go/transport/graphqlRequest.js +0 -0
  186. /package/{dist/nodes → nodes}/lime-go/transport/graphqlRequest.js.map +0 -0
  187. /package/{dist/nodes → nodes}/lime-go/transport/transport.d.ts +0 -0
  188. /package/{dist/nodes → nodes}/lime-go/transport/transport.js +0 -0
  189. /package/{dist/nodes → nodes}/lime-go/transport/transport.js.map +0 -0
  190. /package/{dist/nodes → nodes}/lime-go/triggers/webhook.d.ts +0 -0
  191. /package/{dist/nodes → nodes}/lime-go/triggers/webhook.js +0 -0
  192. /package/{dist/nodes → nodes}/lime-go/triggers/webhook.js.map +0 -0
@@ -1,605 +0,0 @@
1
- import {
2
- IExecuteFunctions,
3
- INodeProperties,
4
- IDataObject,
5
- NodeOperationError,
6
- } from 'n8n-workflow';
7
-
8
- export const description = {
9
- name: 'Execute Query',
10
- value: 'executeQuery',
11
- description: 'Execute a custom query against the Lime CRM database',
12
- action: 'Execute a custom query',
13
- };
14
-
15
- export const properties: INodeProperties[] = [
16
- // Limetype selection (dropdown)
17
- {
18
- displayName: 'LimeType',
19
- name: 'limeType',
20
- type: 'options',
21
- typeOptions: {
22
- loadOptionsMethod: 'getLimeTypes',
23
- },
24
- required: true,
25
- default: '',
26
- description: 'The entity type in Lime CRM to query',
27
- displayOptions: {
28
- show: {
29
- resource: [
30
- 'queryApi',
31
- ],
32
- operation: [
33
- 'executeQuery',
34
- ],
35
- queryMode: [
36
- 'guided',
37
- ],
38
- },
39
- },
40
- },
41
-
42
- // Query Mode toggle
43
- {
44
- displayName: 'Query Mode',
45
- name: 'queryMode',
46
- type: 'options',
47
- options: [
48
- {
49
- name: 'Guided (UI Builder)',
50
- value: 'guided',
51
- description: 'Build your query using the user interface',
52
- },
53
- {
54
- name: 'Code (JSON)',
55
- value: 'code',
56
- description: 'Write your query as a JSON object',
57
- },
58
- ],
59
- default: 'guided',
60
- displayOptions: {
61
- show: {
62
- resource: [
63
- 'queryApi',
64
- ],
65
- operation: [
66
- 'executeQuery',
67
- ],
68
- },
69
- },
70
- },
71
-
72
- // Original JSON query field (for code mode)
73
- {
74
- displayName: 'Query',
75
- name: 'query',
76
- type: 'json',
77
- default: '{\n "limetype": "company",\n "properties": ["name", "phone"],\n "filter": {\n "relation": {\n "equals": "customer"\n }\n },\n "take": 10\n}',
78
- required: true,
79
- description: 'The query to execute. Must be valid JSON format. See <a href="https://docs.lime-crm.com/query-api/" target="_blank">Query API documentation</a>.',
80
- displayOptions: {
81
- show: {
82
- resource: [
83
- 'queryApi',
84
- ],
85
- operation: [
86
- 'executeQuery',
87
- ],
88
- queryMode: [
89
- 'code',
90
- ],
91
- },
92
- },
93
- typeOptions: {
94
- alwaysOpenEditWindow: true,
95
- },
96
- },
97
-
98
- // Properties selection (UI for adding properties) - simplified without aliases
99
- {
100
- displayName: 'Properties',
101
- name: 'properties',
102
- type: 'multiOptions',
103
- typeOptions: {
104
- loadOptionsMethod: 'getLimeTypeProperties',
105
- loadOptionsDependsOn: ['limeType'],
106
- },
107
- default: [],
108
- description: 'Properties to retrieve from the selected Lime type',
109
- displayOptions: {
110
- show: {
111
- resource: [
112
- 'queryApi',
113
- ],
114
- operation: [
115
- 'executeQuery',
116
- ],
117
- queryMode: [
118
- 'guided',
119
- ],
120
- },
121
- },
122
- },
123
-
124
- // Relation properties (for accessing related objects)
125
- {
126
- displayName: 'Include Relations',
127
- name: 'includeRelations',
128
- type: 'boolean',
129
- default: false,
130
- description: 'Whether to include properties from related objects',
131
- displayOptions: {
132
- show: {
133
- resource: [
134
- 'queryApi',
135
- ],
136
- operation: [
137
- 'executeQuery',
138
- ],
139
- queryMode: [
140
- 'guided',
141
- ],
142
- },
143
- },
144
- },
145
- {
146
- displayName: 'Relations Configuration',
147
- name: 'relationsConfig',
148
- placeholder: 'Add Relation',
149
- type: 'fixedCollection',
150
- typeOptions: {
151
- multipleValues: true,
152
- },
153
- default: {},
154
- description: 'Configure properties from related objects',
155
- displayOptions: {
156
- show: {
157
- resource: [
158
- 'queryApi',
159
- ],
160
- operation: [
161
- 'executeQuery',
162
- ],
163
- queryMode: [
164
- 'guided',
165
- ],
166
- includeRelations: [
167
- true,
168
- ],
169
- },
170
- },
171
- options: [
172
- {
173
- name: 'relation',
174
- displayName: 'Relation',
175
- values: [
176
- {
177
- displayName: 'Relation Name',
178
- name: 'relationName',
179
- type: 'options',
180
- typeOptions: {
181
- loadOptionsMethod: 'getLimeTypeRelations',
182
- loadOptionsDependsOn: ['limetype'],
183
- },
184
- default: '',
185
- description: 'The name of the relation',
186
- },
187
- {
188
- displayName: 'Properties',
189
- name: 'properties',
190
- type: 'multiOptions',
191
- typeOptions: {
192
- loadOptionsMethod: 'getRelatedTypeProperties',
193
- loadOptionsDependsOn: ['limetype', 'relationsConfig.relation[].relationName'],
194
- },
195
- default: [],
196
- description: 'Properties from the related entity',
197
- },
198
- ],
199
- },
200
- ],
201
- },
202
-
203
- // Filter (using code editor for flexibility)
204
- {
205
- displayName: 'Add Filter',
206
- name: 'addFilter',
207
- type: 'boolean',
208
- default: false,
209
- description: 'Whether to add a filter to the query',
210
- displayOptions: {
211
- show: {
212
- resource: [
213
- 'queryApi',
214
- ],
215
- operation: [
216
- 'executeQuery',
217
- ],
218
- queryMode: [
219
- 'guided',
220
- ],
221
- },
222
- },
223
- },
224
- {
225
- displayName: 'Filter',
226
- name: 'filter',
227
- type: 'json',
228
- default: '{\n "key": "name",\n "op": "contains",\n "exp": "Lime"\n}',
229
- description: 'Filter to apply to the query (JSON format)',
230
- displayOptions: {
231
- show: {
232
- resource: [
233
- 'queryApi',
234
- ],
235
- operation: [
236
- 'executeQuery',
237
- ],
238
- queryMode: [
239
- 'guided',
240
- ],
241
- addFilter: [
242
- true,
243
- ],
244
- },
245
- },
246
- typeOptions: {
247
- alwaysOpenEditWindow: true,
248
- },
249
- },
250
-
251
- // Pagination
252
- {
253
- displayName: 'Limit',
254
- name: 'limit',
255
- type: 'number',
256
- default: 50,
257
- description: 'Maximum number of records to return',
258
- displayOptions: {
259
- show: {
260
- resource: [
261
- 'queryApi',
262
- ],
263
- operation: [
264
- 'executeQuery',
265
- ],
266
- queryMode: [
267
- 'guided',
268
- ],
269
- returnAll: [
270
- false,
271
- ],
272
- },
273
- },
274
- },
275
- {
276
- displayName: 'Offset',
277
- name: 'offset',
278
- type: 'number',
279
- default: 0,
280
- description: 'Number of records to skip',
281
- displayOptions: {
282
- show: {
283
- resource: [
284
- 'queryApi',
285
- ],
286
- operation: [
287
- 'executeQuery',
288
- ],
289
- queryMode: [
290
- 'guided',
291
- ],
292
- },
293
- },
294
- },
295
-
296
- // Sorting - simplified without nested structures
297
- {
298
- displayName: 'Add Sorting',
299
- name: 'addSorting',
300
- type: 'boolean',
301
- default: false,
302
- description: 'Whether to add sorting to the query',
303
- displayOptions: {
304
- show: {
305
- resource: [
306
- 'queryApi',
307
- ],
308
- operation: [
309
- 'executeQuery',
310
- ],
311
- queryMode: [
312
- 'guided',
313
- ],
314
- },
315
- },
316
- },
317
- {
318
- displayName: 'Sort Field',
319
- name: 'sortField',
320
- type: 'options',
321
- typeOptions: {
322
- loadOptionsMethod: 'getAllSortableFields',
323
- loadOptionsDependsOn: ['limetype', 'includeRelations', 'relationsConfig.relation'],
324
- },
325
- default: '',
326
- description: 'Field to sort by',
327
- displayOptions: {
328
- show: {
329
- resource: [
330
- 'queryApi',
331
- ],
332
- operation: [
333
- 'executeQuery',
334
- ],
335
- queryMode: [
336
- 'guided',
337
- ],
338
- addSorting: [
339
- true,
340
- ],
341
- },
342
- },
343
- },
344
- {
345
- displayName: 'Sort Direction',
346
- name: 'sortDirection',
347
- type: 'options',
348
- options: [
349
- {
350
- name: 'Ascending (A-Z)',
351
- value: 'ASC',
352
- },
353
- {
354
- name: 'Descending (Z-A)',
355
- value: 'DESC',
356
- },
357
- ],
358
- default: 'ASC',
359
- description: 'Sort direction',
360
- displayOptions: {
361
- show: {
362
- resource: [
363
- 'queryApi',
364
- ],
365
- operation: [
366
- 'executeQuery',
367
- ],
368
- queryMode: [
369
- 'guided',
370
- ],
371
- addSorting: [
372
- true,
373
- ],
374
- },
375
- },
376
- },
377
-
378
- // Return all or limit results
379
- {
380
- displayName: 'Return All',
381
- name: 'returnAll',
382
- type: 'boolean',
383
- displayOptions: {
384
- show: {
385
- resource: [
386
- 'queryApi',
387
- ],
388
- operation: [
389
- 'executeQuery',
390
- ],
391
- },
392
- },
393
- default: false,
394
- description: 'Whether to return all results or respect the limit parameter',
395
- },
396
-
397
- // Options for the query
398
- {
399
- displayName: 'Options',
400
- name: 'options',
401
- type: 'collection',
402
- placeholder: 'Add Option',
403
- default: {},
404
- displayOptions: {
405
- show: {
406
- resource: [
407
- 'queryApi',
408
- ],
409
- operation: [
410
- 'executeQuery',
411
- ],
412
- },
413
- },
414
- options: [
415
- {
416
- displayName: 'Include Metadata',
417
- name: 'includeMetadata',
418
- type: 'boolean',
419
- default: false,
420
- description: 'Whether to include metadata about the query result (total count, pagination info, etc.)',
421
- },
422
- {
423
- displayName: 'Timeout (ms)',
424
- name: 'timeout',
425
- type: 'number',
426
- default: 30000,
427
- description: 'Timeout for the query in milliseconds',
428
- },
429
- ],
430
- },
431
- ];
432
-
433
- export async function execute(
434
- this: IExecuteFunctions,
435
- i: number,
436
- ) {
437
- // Use the API client from the transport directory
438
- const { apiRequest } = await import('../../../transport');
439
-
440
- const queryMode = this.getNodeParameter('queryMode', i) as string;
441
- const returnAll = this.getNodeParameter('returnAll', i) as boolean;
442
- const options = this.getNodeParameter('options', i, {}) as IDataObject;
443
-
444
- let queryObject: IDataObject;
445
-
446
- if (queryMode === 'code') {
447
- // Handle code mode (direct JSON input)
448
- const queryJson = this.getNodeParameter('query', i) as string;
449
- try {
450
- // Parse the JSON query
451
- if (typeof queryJson === 'string') {
452
- queryObject = JSON.parse(queryJson);
453
- } else {
454
- queryObject = queryJson as IDataObject;
455
- }
456
- } catch (error) {
457
- throw new NodeOperationError(this.getNode(), 'Invalid JSON in query: ' + error.message);
458
- }
459
- } else {
460
- // Handle guided mode (UI builder)
461
- queryObject = {};
462
-
463
- // 1. Add limetype
464
- const limetype = this.getNodeParameter('limeType', i) as string;
465
- queryObject.limetype = limetype;
466
-
467
- // 2. Add properties - simplified approach without aliases
468
- const properties = this.getNodeParameter('properties', i, []) as string[];
469
- const responseFormat: IDataObject = { object: {} };
470
-
471
- // Handle direct properties
472
- properties.forEach((property) => {
473
- (responseFormat.object as IDataObject)[property] = null;
474
- });
475
-
476
- // 3. Add relations if enabled
477
- const includeRelations = this.getNodeParameter('includeRelations', i, false) as boolean;
478
- if (includeRelations) {
479
- const relations = this.getNodeParameter('relationsConfig.relation', i, []) as IDataObject[];
480
-
481
- relations.forEach((relationConfig) => {
482
- const relationName = relationConfig.relationName as string;
483
- const relationProperties = relationConfig.properties as string[] || [];
484
-
485
- if (relationName && relationProperties.length > 0) {
486
- const relationObject: IDataObject = {};
487
-
488
- relationProperties.forEach((property) => {
489
- relationObject[property] = null;
490
- });
491
-
492
- (responseFormat.object as IDataObject)[relationName] = relationObject;
493
- }
494
- });
495
- }
496
-
497
- queryObject.responseFormat = responseFormat;
498
-
499
- // 4. Add filter if enabled
500
- const addFilter = this.getNodeParameter('addFilter', i, false) as boolean;
501
- if (addFilter) {
502
- try {
503
- const filterJson = this.getNodeParameter('filter', i) as string;
504
- queryObject.filter = typeof filterJson === 'string' ? JSON.parse(filterJson) : filterJson;
505
- } catch (error) {
506
- throw new NodeOperationError(this.getNode(), 'Invalid JSON in filter: ' + error.message);
507
- }
508
- }
509
-
510
- // 5. Add pagination
511
- if (!returnAll) {
512
- queryObject.limit = this.getNodeParameter('limit', i, 50) as number;
513
- }
514
- queryObject.offset = this.getNodeParameter('offset', i, 0) as number;
515
-
516
- // 6. Add sorting if enabled - simplified approach
517
- const addSorting = this.getNodeParameter('addSorting', i, false) as boolean;
518
- if (addSorting) {
519
- const sortField = this.getNodeParameter('sortField', i, '') as string;
520
- const sortDirection = this.getNodeParameter('sortDirection', i, 'ASC') as string;
521
-
522
- if (sortField) {
523
- const orderBy: IDataObject[] = [];
524
- const orderItem: IDataObject = {};
525
- orderItem[sortField] = sortDirection;
526
- orderBy.push(orderItem);
527
- queryObject.orderBy = orderBy;
528
- }
529
- }
530
- }
531
-
532
- // If returnAll is true, set a high value to override any take/limit parameter
533
- if (returnAll) {
534
- queryObject.limit = 10000; // Use a very high value as a practical limit
535
- }
536
-
537
- // Add metadata option if requested
538
- if (options.includeMetadata) {
539
- queryObject.includemetadata = true;
540
- }
541
-
542
- const endpoint = '/api/v1/query/';
543
-
544
- try {
545
- // Set request options
546
- const requestOptions: IDataObject = {
547
- method: 'GET',
548
- endpoint,
549
- qs: { q: JSON.stringify(queryObject) },
550
- };
551
-
552
- if (options.timeout) {
553
- requestOptions.timeout = options.timeout as number;
554
- }
555
-
556
- // If we need to handle pagination, do so
557
- if (returnAll && queryObject.limit) {
558
- const results: IDataObject[] = [];
559
- let hasMoreData = true;
560
- let currentOffset = queryObject.offset as number || 0;
561
-
562
- while (hasMoreData) {
563
- // Update offset for pagination
564
- queryObject.offset = currentOffset;
565
- requestOptions.qs = { q: JSON.stringify(queryObject) };
566
-
567
- const response = await apiRequest.call(this, requestOptions);
568
-
569
- // If data is received, add it to results
570
- if (response && response.data && Array.isArray(response.data)) {
571
- results.push(...response.data);
572
-
573
- // If we received fewer records than limit, we've reached the end
574
- if (response.data.length < (queryObject.limit as number)) {
575
- hasMoreData = false;
576
- } else {
577
- // Otherwise, prepare for the next page
578
- currentOffset += response.data.length;
579
- }
580
- } else {
581
- hasMoreData = false;
582
- }
583
- }
584
-
585
- // Prepare final response with all data
586
- const finalResponse: IDataObject = { data: results };
587
-
588
- // Include metadata if available and requested
589
- if (options.includeMetadata) {
590
- finalResponse.metadata = {
591
- totalCount: results.length,
592
- // Add other metadata if available
593
- };
594
- }
595
-
596
- return finalResponse.objects;
597
- } else {
598
- // Single request without pagination handling
599
- const response = await apiRequest.call(this, requestOptions);
600
- return response.objects;
601
- }
602
- } catch (error) {
603
- throw new NodeOperationError(this.getNode(), `Query execution failed: ${error.message}`);
604
- }
605
- }
@@ -1,74 +0,0 @@
1
- import { IExecuteFunctions, ILoadOptionsFunctions, IDataObject, NodeOperationError } from 'n8n-workflow';
2
-
3
- /**
4
- * Make an API request to the Lime CRM API
5
- */
6
- export async function apiRequest(
7
- this: IExecuteFunctions | ILoadOptionsFunctions,
8
- options: IDataObject,
9
- ): Promise<any> {
10
- // Get credentials for the API
11
- const credentials = await this.getCredentials('limeCrmApi');
12
-
13
- if (!credentials) {
14
- throw new NodeOperationError(this.getNode(), 'No credentials provided');
15
- }
16
-
17
- const baseURL = credentials.url as string;
18
- const apiKey = credentials.apiKey as string;
19
-
20
- // Add common headers for all requests
21
- const headers = {
22
- 'X-API-Key': apiKey,
23
- 'Accept': 'application/json',
24
- 'Content-Type': 'application/json',
25
- };
26
-
27
- const endpoint = options.endpoint as string;
28
- const method = options.method as string || 'GET';
29
-
30
- try {
31
- const requestOptions: IDataObject = {
32
- method,
33
- uri: `${baseURL}${endpoint}`,
34
- json: true,
35
- headers,
36
- };
37
-
38
- // Add query string parameters if they exist
39
- if (options.qs) {
40
- requestOptions.qs = options.qs;
41
- }
42
-
43
- // Add request body if it exists and method is not GET
44
- if (options.body && method !== 'GET') {
45
- requestOptions.body = options.body;
46
- }
47
-
48
- // Add timeout if specified
49
- if (options.timeout) {
50
- requestOptions.timeout = options.timeout as number;
51
- }
52
-
53
- // Execute the request using n8n's helper
54
- return await this.helpers.request(requestOptions);
55
- } catch (error) {
56
- // Add some context to the error message
57
- if (error.response) {
58
- // If we have a response with error info
59
- const statusCode = error.response.statusCode;
60
- const errorMessage = error.response.body?.message || error.message;
61
-
62
- throw new NodeOperationError(
63
- this.getNode(),
64
- `API request failed [${statusCode}]: ${errorMessage}`
65
- );
66
- } else {
67
- // Generic network error
68
- throw new NodeOperationError(
69
- this.getNode(),
70
- `API request failed: ${error.message}`
71
- );
72
- }
73
- }
74
- }