@limetech/n8n-nodes-lime 2.5.0-dev.1 → 2.5.0-dev.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.
Files changed (238) hide show
  1. package/.releaserc.json +1 -0
  2. package/CHANGELOG.md +7 -0
  3. package/dist/credentials/FortnoxApi.credentials.d.ts +9 -0
  4. package/dist/credentials/FortnoxApi.credentials.js +57 -0
  5. package/dist/credentials/FortnoxApi.credentials.js.map +1 -0
  6. package/dist/credentials/LimeCrmApi.credentials.d.ts +9 -0
  7. package/dist/credentials/LimeCrmApi.credentials.js +70 -0
  8. package/dist/credentials/LimeCrmApi.credentials.js.map +1 -0
  9. package/dist/credentials/index.d.ts +2 -0
  10. package/dist/credentials/index.js +19 -0
  11. package/dist/credentials/index.js.map +1 -0
  12. package/dist/nodes/errorHandling.d.ts +11 -0
  13. package/dist/nodes/errorHandling.js +20 -0
  14. package/dist/nodes/errorHandling.js.map +1 -0
  15. package/dist/nodes/fortnox/Fortnox.node.d.ts +5 -0
  16. package/dist/nodes/fortnox/Fortnox.node.js +95 -0
  17. package/dist/nodes/fortnox/Fortnox.node.js.map +1 -0
  18. package/dist/nodes/fortnox/Fortnox.node.json +18 -0
  19. package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +5 -0
  20. package/dist/nodes/fortnox/FortnoxTrigger.node.js +155 -0
  21. package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +1 -0
  22. package/dist/nodes/fortnox/FortnoxTrigger.node.json +18 -0
  23. package/dist/nodes/fortnox/commons.d.ts +25 -0
  24. package/dist/nodes/fortnox/commons.js +44 -0
  25. package/dist/nodes/fortnox/commons.js.map +1 -0
  26. package/dist/nodes/fortnox/fortnoxLogo.svg +15 -0
  27. package/dist/nodes/fortnox/index.d.ts +6 -0
  28. package/dist/nodes/fortnox/index.js +23 -0
  29. package/dist/nodes/fortnox/index.js.map +1 -0
  30. package/dist/nodes/fortnox/model.d.ts +20 -0
  31. package/dist/nodes/fortnox/model.js +3 -0
  32. package/dist/nodes/fortnox/model.js.map +1 -0
  33. package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +2 -0
  34. package/dist/nodes/fortnox/resources/customers/filterParameters.js +31 -0
  35. package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +1 -0
  36. package/dist/nodes/fortnox/resources/customers/index.d.ts +7 -0
  37. package/dist/nodes/fortnox/resources/customers/index.js +85 -0
  38. package/dist/nodes/fortnox/resources/customers/index.js.map +1 -0
  39. package/dist/nodes/fortnox/resources/customers/model.d.ts +99 -0
  40. package/dist/nodes/fortnox/resources/customers/model.js +3 -0
  41. package/dist/nodes/fortnox/resources/customers/model.js.map +1 -0
  42. package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +10 -0
  43. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +281 -0
  44. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +1 -0
  45. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +9 -0
  46. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +38 -0
  47. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +1 -0
  48. package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +10 -0
  49. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +38 -0
  50. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +1 -0
  51. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +10 -0
  52. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +68 -0
  53. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +1 -0
  54. package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +5 -0
  55. package/dist/nodes/fortnox/resources/customers/operations/index.js +42 -0
  56. package/dist/nodes/fortnox/resources/customers/operations/index.js.map +1 -0
  57. package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +10 -0
  58. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +261 -0
  59. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +1 -0
  60. package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +2 -0
  61. package/dist/nodes/fortnox/resources/customers/sortParameters.js +30 -0
  62. package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +1 -0
  63. package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +2 -0
  64. package/dist/nodes/fortnox/resources/invoice/filterParameters.js +72 -0
  65. package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +1 -0
  66. package/dist/nodes/fortnox/resources/invoice/index.d.ts +7 -0
  67. package/dist/nodes/fortnox/resources/invoice/index.js +81 -0
  68. package/dist/nodes/fortnox/resources/invoice/index.js.map +1 -0
  69. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +2 -0
  70. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +193 -0
  71. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +1 -0
  72. package/dist/nodes/fortnox/resources/invoice/model.d.ts +147 -0
  73. package/dist/nodes/fortnox/resources/invoice/model.js +3 -0
  74. package/dist/nodes/fortnox/resources/invoice/model.js.map +1 -0
  75. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +10 -0
  76. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +64 -0
  77. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +1 -0
  78. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +10 -0
  79. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +37 -0
  80. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +1 -0
  81. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +10 -0
  82. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +92 -0
  83. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +1 -0
  84. package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +4 -0
  85. package/dist/nodes/fortnox/resources/invoice/operations/index.js +41 -0
  86. package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +1 -0
  87. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +10 -0
  88. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +64 -0
  89. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +1 -0
  90. package/dist/nodes/fortnox/transport/errorCodes.d.ts +1 -0
  91. package/dist/nodes/fortnox/transport/errorCodes.js +50 -0
  92. package/dist/nodes/fortnox/transport/errorCodes.js.map +1 -0
  93. package/dist/nodes/fortnox/transport/index.d.ts +3 -0
  94. package/dist/nodes/fortnox/transport/index.js +76 -0
  95. package/dist/nodes/fortnox/transport/index.js.map +1 -0
  96. package/dist/nodes/index.d.ts +4 -0
  97. package/dist/nodes/index.js +21 -0
  98. package/dist/nodes/index.js.map +1 -0
  99. package/dist/nodes/lime-crm/LimeCrm.node.json +18 -0
  100. package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +19 -0
  101. package/dist/nodes/lime-crm/LimeCrmNode.node.js +122 -0
  102. package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -0
  103. package/dist/nodes/lime-crm/LimeCrmTrigger.node.d.ts +18 -0
  104. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +215 -0
  105. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +1 -0
  106. package/dist/nodes/lime-crm/assets/lime-crm.svg +1 -0
  107. package/dist/nodes/lime-crm/index.d.ts +9 -0
  108. package/dist/nodes/lime-crm/index.js +26 -0
  109. package/dist/nodes/lime-crm/index.js.map +1 -0
  110. package/dist/nodes/lime-crm/methods/getLimetypeProperties.d.ts +5 -0
  111. package/dist/nodes/lime-crm/methods/getLimetypeProperties.js +47 -0
  112. package/dist/nodes/lime-crm/methods/getLimetypeProperties.js.map +1 -0
  113. package/dist/nodes/lime-crm/methods/getLimetypes.d.ts +2 -0
  114. package/dist/nodes/lime-crm/methods/getLimetypes.js +20 -0
  115. package/dist/nodes/lime-crm/methods/getLimetypes.js.map +1 -0
  116. package/dist/nodes/lime-crm/methods/index.d.ts +3 -0
  117. package/dist/nodes/lime-crm/methods/index.js +15 -0
  118. package/dist/nodes/lime-crm/methods/index.js.map +1 -0
  119. package/dist/nodes/lime-crm/methods/resourceMapping.d.ts +4 -0
  120. package/dist/nodes/lime-crm/methods/resourceMapping.js +71 -0
  121. package/dist/nodes/lime-crm/methods/resourceMapping.js.map +1 -0
  122. package/dist/nodes/lime-crm/models/constants.d.ts +9 -0
  123. package/dist/nodes/lime-crm/models/constants.js +10 -0
  124. package/dist/nodes/lime-crm/models/constants.js.map +1 -0
  125. package/dist/nodes/lime-crm/models/index.d.ts +6 -0
  126. package/dist/nodes/lime-crm/models/index.js +13 -0
  127. package/dist/nodes/lime-crm/models/index.js.map +1 -0
  128. package/dist/nodes/lime-crm/models/limeobject.d.ts +4 -0
  129. package/dist/nodes/lime-crm/models/limeobject.js +3 -0
  130. package/dist/nodes/lime-crm/models/limeobject.js.map +1 -0
  131. package/dist/nodes/lime-crm/models/limetype.d.ts +24 -0
  132. package/dist/nodes/lime-crm/models/limetype.js +3 -0
  133. package/dist/nodes/lime-crm/models/limetype.js.map +1 -0
  134. package/dist/nodes/lime-crm/models/propertyTypes.d.ts +4 -0
  135. package/dist/nodes/lime-crm/models/propertyTypes.js +5 -0
  136. package/dist/nodes/lime-crm/models/propertyTypes.js.map +1 -0
  137. package/dist/nodes/lime-crm/models/users.d.ts +13 -0
  138. package/dist/nodes/lime-crm/models/users.js +3 -0
  139. package/dist/nodes/lime-crm/models/users.js.map +1 -0
  140. package/dist/nodes/lime-crm/models/webhook.d.ts +18 -0
  141. package/dist/nodes/lime-crm/models/webhook.js +3 -0
  142. package/dist/nodes/lime-crm/models/webhook.js.map +1 -0
  143. package/dist/nodes/lime-crm/resources/admin/index.d.ts +7 -0
  144. package/dist/nodes/lime-crm/resources/admin/index.js +89 -0
  145. package/dist/nodes/lime-crm/resources/admin/index.js.map +1 -0
  146. package/dist/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.d.ts +11 -0
  147. package/dist/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.js +123 -0
  148. package/dist/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.js.map +1 -0
  149. package/dist/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.d.ts +11 -0
  150. package/dist/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.js +87 -0
  151. package/dist/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.js.map +1 -0
  152. package/dist/nodes/lime-crm/resources/admin/operations/index.d.ts +2 -0
  153. package/dist/nodes/lime-crm/resources/admin/operations/index.js +39 -0
  154. package/dist/nodes/lime-crm/resources/admin/operations/index.js.map +1 -0
  155. package/dist/nodes/lime-crm/resources/data/index.d.ts +7 -0
  156. package/dist/nodes/lime-crm/resources/data/index.js +108 -0
  157. package/dist/nodes/lime-crm/resources/data/index.js.map +1 -0
  158. package/dist/nodes/lime-crm/resources/data/operations/createSingleObject.operation.d.ts +11 -0
  159. package/dist/nodes/lime-crm/resources/data/operations/createSingleObject.operation.js +124 -0
  160. package/dist/nodes/lime-crm/resources/data/operations/createSingleObject.operation.js.map +1 -0
  161. package/dist/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.d.ts +10 -0
  162. package/dist/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.js +52 -0
  163. package/dist/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.js.map +1 -0
  164. package/dist/nodes/lime-crm/resources/data/operations/getManyObjects.operation.d.ts +11 -0
  165. package/dist/nodes/lime-crm/resources/data/operations/getManyObjects.operation.js +299 -0
  166. package/dist/nodes/lime-crm/resources/data/operations/getManyObjects.operation.js.map +1 -0
  167. package/dist/nodes/lime-crm/resources/data/operations/getSingleFile.operation.d.ts +9 -0
  168. package/dist/nodes/lime-crm/resources/data/operations/getSingleFile.operation.js +125 -0
  169. package/dist/nodes/lime-crm/resources/data/operations/getSingleFile.operation.js.map +1 -0
  170. package/dist/nodes/lime-crm/resources/data/operations/getSingleObject.operation.d.ts +11 -0
  171. package/dist/nodes/lime-crm/resources/data/operations/getSingleObject.operation.js +79 -0
  172. package/dist/nodes/lime-crm/resources/data/operations/getSingleObject.operation.js.map +1 -0
  173. package/dist/nodes/lime-crm/resources/data/operations/index.d.ts +6 -0
  174. package/dist/nodes/lime-crm/resources/data/operations/index.js +43 -0
  175. package/dist/nodes/lime-crm/resources/data/operations/index.js.map +1 -0
  176. package/dist/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.d.ts +11 -0
  177. package/dist/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.js +146 -0
  178. package/dist/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.js.map +1 -0
  179. package/dist/nodes/lime-crm/resources/metadata/index.d.ts +7 -0
  180. package/dist/nodes/lime-crm/resources/metadata/index.js +93 -0
  181. package/dist/nodes/lime-crm/resources/metadata/index.js.map +1 -0
  182. package/dist/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.d.ts +10 -0
  183. package/dist/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.js +16 -0
  184. package/dist/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.js.map +1 -0
  185. package/dist/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.d.ts +11 -0
  186. package/dist/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.js +113 -0
  187. package/dist/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.js.map +1 -0
  188. package/dist/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.d.ts +11 -0
  189. package/dist/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.js +37 -0
  190. package/dist/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.js.map +1 -0
  191. package/dist/nodes/lime-crm/resources/metadata/operations/index.d.ts +3 -0
  192. package/dist/nodes/lime-crm/resources/metadata/operations/index.js +40 -0
  193. package/dist/nodes/lime-crm/resources/metadata/operations/index.js.map +1 -0
  194. package/dist/nodes/lime-crm/transport/commons.d.ts +14 -0
  195. package/dist/nodes/lime-crm/transport/commons.js +52 -0
  196. package/dist/nodes/lime-crm/transport/commons.js.map +1 -0
  197. package/dist/nodes/lime-crm/transport/files.d.ts +26 -0
  198. package/dist/nodes/lime-crm/transport/files.js +96 -0
  199. package/dist/nodes/lime-crm/transport/files.js.map +1 -0
  200. package/dist/nodes/lime-crm/transport/index.d.ts +7 -0
  201. package/dist/nodes/lime-crm/transport/index.js +32 -0
  202. package/dist/nodes/lime-crm/transport/index.js.map +1 -0
  203. package/dist/nodes/lime-crm/transport/limeQuery.d.ts +10 -0
  204. package/dist/nodes/lime-crm/transport/limeQuery.js +18 -0
  205. package/dist/nodes/lime-crm/transport/limeQuery.js.map +1 -0
  206. package/dist/nodes/lime-crm/transport/limeobjects.d.ts +16 -0
  207. package/dist/nodes/lime-crm/transport/limeobjects.js +76 -0
  208. package/dist/nodes/lime-crm/transport/limeobjects.js.map +1 -0
  209. package/dist/nodes/lime-crm/transport/limetypes.d.ts +33 -0
  210. package/dist/nodes/lime-crm/transport/limetypes.js +85 -0
  211. package/dist/nodes/lime-crm/transport/limetypes.js.map +1 -0
  212. package/dist/nodes/lime-crm/transport/users.d.ts +6 -0
  213. package/dist/nodes/lime-crm/transport/users.js +159 -0
  214. package/dist/nodes/lime-crm/transport/users.js.map +1 -0
  215. package/dist/nodes/lime-crm/transport/webhooks.d.ts +14 -0
  216. package/dist/nodes/lime-crm/transport/webhooks.js +51 -0
  217. package/dist/nodes/lime-crm/transport/webhooks.js.map +1 -0
  218. package/dist/nodes/lime-crm/utils/files.d.ts +8 -0
  219. package/dist/nodes/lime-crm/utils/files.js +103 -0
  220. package/dist/nodes/lime-crm/utils/files.js.map +1 -0
  221. package/dist/nodes/lime-crm/utils/hmac.d.ts +1 -0
  222. package/dist/nodes/lime-crm/utils/hmac.js +11 -0
  223. package/dist/nodes/lime-crm/utils/hmac.js.map +1 -0
  224. package/dist/nodes/lime-crm/utils/index.d.ts +4 -0
  225. package/dist/nodes/lime-crm/utils/index.js +16 -0
  226. package/dist/nodes/lime-crm/utils/index.js.map +1 -0
  227. package/dist/nodes/lime-crm/utils/webhook.d.ts +2 -0
  228. package/dist/nodes/lime-crm/utils/webhook.js +34 -0
  229. package/dist/nodes/lime-crm/utils/webhook.js.map +1 -0
  230. package/dist/nodes/modules.d.ts +12 -0
  231. package/dist/nodes/modules.js +16 -0
  232. package/dist/nodes/modules.js.map +1 -0
  233. package/dist/nodes/response.d.ts +18 -0
  234. package/dist/nodes/response.js +3 -0
  235. package/dist/nodes/response.js.map +1 -0
  236. package/dist/package.json +69 -0
  237. package/dist/tsconfig.tsbuildinfo +1 -0
  238. package/package.json +1 -1
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchManyUsers = fetchManyUsers;
4
+ exports.fetchSingleUserById = fetchSingleUserById;
5
+ exports.fetchSingleUserByLimeobjectId = fetchSingleUserByLimeobjectId;
6
+ const commons_1 = require("./commons");
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const models_1 = require("../models");
9
+ const limetypes_1 = require("./limetypes");
10
+ const limeQuery_1 = require("./limeQuery");
11
+ const limeobjects_1 = require("./limeobjects");
12
+ const errorHandling_1 = require("../../errorHandling");
13
+ const USERS_URL = 'api/v1/admin/users/';
14
+ function findCoworkerLimetype(limetypes) {
15
+ for (const limetype of limetypes) {
16
+ for (const property of limetype.properties) {
17
+ if (property.type === 'user') {
18
+ n8n_workflow_1.LoggerProxy.info('Found coworker limetype');
19
+ return limetype;
20
+ }
21
+ }
22
+ }
23
+ n8n_workflow_1.LoggerProxy.warn('No coworker limetype found');
24
+ return undefined;
25
+ }
26
+ async function findCoworker(nodeContext) {
27
+ const response = await (0, limetypes_1.getLimetypesFromApi)(nodeContext);
28
+ if (!response.success) {
29
+ return response;
30
+ }
31
+ const coworker = findCoworkerLimetype(response.data);
32
+ if (!coworker) {
33
+ return (0, errorHandling_1.handleWorkflowError)(nodeContext, {
34
+ message: `No limetype with 'user' property found to get coworker`,
35
+ }, true);
36
+ }
37
+ return {
38
+ success: true,
39
+ data: coworker,
40
+ };
41
+ }
42
+ async function getCoworker(nodeContext, coworker, userId) {
43
+ const properties = Object.fromEntries(coworker.properties
44
+ .filter((prop) => prop.type !== 'hasmany')
45
+ .map((prop) => [prop.name, '']));
46
+ const userProperty = coworker.properties.find((prop) => prop.type === 'user');
47
+ if (!userProperty) {
48
+ throw new n8n_workflow_1.NodeApiError(nodeContext.getNode(), {
49
+ message: `No property of type 'user' found in ${coworker.name} limetype`,
50
+ });
51
+ }
52
+ const responseFormat = {
53
+ object: properties,
54
+ };
55
+ const filter = {
56
+ key: userProperty.name,
57
+ op: '=',
58
+ exp: userId,
59
+ };
60
+ const q = JSON.stringify({
61
+ limetype: coworker.name,
62
+ responseFormat: responseFormat,
63
+ filter: filter,
64
+ });
65
+ return await (0, limeQuery_1.queryLimeobjects)(nodeContext, q);
66
+ }
67
+ async function fetchManyUsers(nodeContext, active = '', userType = '', limit = models_1.DEFAULT_API_OBJECT_LIMIT, withCoworker = false) {
68
+ const queryParams = {
69
+ _limit: limit,
70
+ };
71
+ if (active !== '') {
72
+ queryParams.active = active;
73
+ }
74
+ if (userType !== '') {
75
+ queryParams.user_type = userType;
76
+ }
77
+ const response = await (0, commons_1.callLimeApi)(nodeContext, {
78
+ method: 'GET',
79
+ url: USERS_URL,
80
+ requestOptions: {
81
+ qs: queryParams,
82
+ },
83
+ });
84
+ if (!response.success || !withCoworker)
85
+ return response;
86
+ const coworkerLimetypeResponse = await findCoworker(nodeContext);
87
+ if (!coworkerLimetypeResponse.success)
88
+ return coworkerLimetypeResponse;
89
+ const coworkerLimetype = coworkerLimetypeResponse.data;
90
+ const usersWithCoworkers = [];
91
+ for (const user of response.data) {
92
+ const coworkerResponse = await getCoworker(nodeContext, coworkerLimetype, user.id);
93
+ if (!coworkerResponse.success)
94
+ return coworkerResponse;
95
+ usersWithCoworkers.push({
96
+ ...user,
97
+ [coworkerLimetype.name]: coworkerResponse.data.objects[0] || null,
98
+ });
99
+ }
100
+ return {
101
+ success: true,
102
+ data: usersWithCoworkers,
103
+ };
104
+ }
105
+ async function fetchSingleUserById(nodeContext, id, withCoworker = false) {
106
+ const url = `${USERS_URL}${id}`;
107
+ const userResponse = await (0, commons_1.callLimeApi)(nodeContext, {
108
+ method: 'GET',
109
+ url: url,
110
+ errorMetadata: {
111
+ user_id: id,
112
+ },
113
+ });
114
+ if (!userResponse.success || !withCoworker)
115
+ return userResponse;
116
+ const coworkerLimetypeResponse = await findCoworker(nodeContext);
117
+ if (!coworkerLimetypeResponse.success)
118
+ return coworkerLimetypeResponse;
119
+ const coworkerResponse = await getCoworker(nodeContext, coworkerLimetypeResponse.data, id);
120
+ if (!coworkerResponse.success)
121
+ return coworkerResponse;
122
+ return {
123
+ ...userResponse,
124
+ [coworkerLimetypeResponse.data.name]: coworkerResponse.data.objects[0] || null,
125
+ };
126
+ }
127
+ async function fetchSingleUserByLimeobjectId(nodeContext, id, withCoworker = false) {
128
+ const coworkerLimetypeResponse = await findCoworker(nodeContext);
129
+ if (!coworkerLimetypeResponse.success)
130
+ return coworkerLimetypeResponse;
131
+ const coworkerLimetype = coworkerLimetypeResponse.data;
132
+ const coworkerResponse = await (0, limeobjects_1.getLimeobject)(nodeContext, coworkerLimetype.name, id);
133
+ if (!coworkerResponse.success)
134
+ return coworkerResponse;
135
+ const userProperty = coworkerLimetype.properties.find((prop) => prop.type === 'user');
136
+ if (!userProperty) {
137
+ return (0, errorHandling_1.handleWorkflowError)(nodeContext, {
138
+ message: `No property of type 'user' found in ${coworkerLimetype.name} limetype`,
139
+ }, true);
140
+ }
141
+ const url = `${USERS_URL}${coworkerResponse.data[userProperty.name]}`;
142
+ const userResponse = await (0, commons_1.callLimeApi)(nodeContext, {
143
+ method: 'GET',
144
+ url: url,
145
+ errorMetadata: {
146
+ user_id: id,
147
+ },
148
+ });
149
+ if (!userResponse.success || !withCoworker)
150
+ return userResponse;
151
+ return {
152
+ success: true,
153
+ data: {
154
+ ...userResponse.data,
155
+ [coworkerLimetype.name]: coworkerResponse.data || null,
156
+ },
157
+ };
158
+ }
159
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/transport/users.ts"],"names":[],"mappings":";;AA4IA,wCAkDC;AAcD,kDA8BC;AAiBD,sEAgDC;AA3SD,uCAAwC;AACxC,+CAIsB;AACtB,sCAMmB;AACnB,2CAAkD;AAClD,2CAA8D;AAC9D,+CAA8C;AAE9C,uDAA0D;AAC1D,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAgBxC,SAAS,oBAAoB,CAAC,SAAqB;IAC/C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACzC,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBAC3B,0BAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;gBACvC,OAAO,QAAQ,CAAC;YACpB,CAAC;QACL,CAAC;IACL,CAAC;IACD,0BAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,SAAS,CAAC;AACrB,CAAC;AAUD,KAAK,UAAU,YAAY,CACvB,WAAiC;IAEjC,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAmB,EAAC,WAAW,CAAC,CAAC;IACxD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,IAAA,mCAAm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EACxC,WAAW,EACX,gBAAgB,CAAC,IAAI,EACrB,EAAE,CACL,CAAC;IACF,IAAI,CAAC,gBAAgB,CAAC,OAAO;QAAE,OAAO,gBAAgB,CAAC;IAEvD,MAAM,YAAY,GAAG,gBAAgB,CAAC,UAAU,CAAC,IAAI,CACjD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CACjC,CAAC;IACF,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,OAAO,IAAA,mCAAmB,EACtB,WAAW,EACX;YACI,OAAO,EAAE,uCAAuC,gBAAgB,CAAC,IAAI,WAAW;SACnF,EACD,IAAI,CACP,CAAC;IACN,CAAC;IAED,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IACtE,MAAM,YAAY,GAAG,MAAM,IAAA,qBAAW,EAAO,WAAW,EAAE;QACtD,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,GAAG;QACR,aAAa,EAAE;YACX,OAAO,EAAE,EAAE;SACd;KACJ,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,CAAC,YAAY;QAAE,OAAO,YAAY,CAAC;IAEhE,OAAO;QACH,OAAO,EAAE,IAAI;QACb,IAAI,EAAE;YACF,GAAG,YAAY,CAAC,IAAI;YACpB,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAI,IAAI,IAAI;SACzD;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { IAllExecuteFunctions } from 'n8n-workflow';
2
+ import { CreateWebhook, Webhook } from '../models';
3
+ import { APIResponse } from '../../response';
4
+ export interface ApiResponseWebhook {
5
+ id: string;
6
+ name: string;
7
+ enabled: boolean;
8
+ events: string[];
9
+ target_url: string;
10
+ }
11
+ export declare function getSubscription(nodeContext: IAllExecuteFunctions, webhook: Webhook): Promise<APIResponse<ApiResponseWebhook>>;
12
+ export declare function listSubscriptionsWithExistingData(nodeContext: IAllExecuteFunctions, webhook: Webhook): Promise<APIResponse<ApiResponseWebhook[]>>;
13
+ export declare function createSubscription(nodeContext: IAllExecuteFunctions, webhook: CreateWebhook): Promise<APIResponse<ApiResponseWebhook>>;
14
+ export declare function deleteSubscription(nodeContext: IAllExecuteFunctions, webhook: Webhook): Promise<APIResponse<void>>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSubscription = getSubscription;
4
+ exports.listSubscriptionsWithExistingData = listSubscriptionsWithExistingData;
5
+ exports.createSubscription = createSubscription;
6
+ exports.deleteSubscription = deleteSubscription;
7
+ const _1 = require(".");
8
+ const SUBSCRIPTION_URL = 'api/v1/subscription/';
9
+ async function getSubscription(nodeContext, webhook) {
10
+ return await (0, _1.callLimeApi)(nodeContext, {
11
+ method: 'GET',
12
+ url: `${SUBSCRIPTION_URL}${webhook.data.webhookId}`,
13
+ });
14
+ }
15
+ async function listSubscriptionsWithExistingData(nodeContext, webhook) {
16
+ return await (0, _1.callLimeApi)(nodeContext, {
17
+ method: 'GET',
18
+ url: SUBSCRIPTION_URL,
19
+ requestOptions: {
20
+ qs: {
21
+ events: webhook.events.join(','),
22
+ target_url: webhook.url,
23
+ enabled: true,
24
+ },
25
+ },
26
+ });
27
+ }
28
+ async function createSubscription(nodeContext, webhook) {
29
+ return await (0, _1.callLimeApi)(nodeContext, {
30
+ method: 'POST',
31
+ url: SUBSCRIPTION_URL,
32
+ requestOptions: {
33
+ body: {
34
+ events: webhook.events,
35
+ target_url: webhook.url,
36
+ name: webhook.name,
37
+ secret: webhook.secret,
38
+ },
39
+ },
40
+ });
41
+ }
42
+ async function deleteSubscription(nodeContext, webhook) {
43
+ return await (0, _1.callLimeApi)(nodeContext, {
44
+ method: 'DELETE',
45
+ url: `${SUBSCRIPTION_URL}${webhook.data.webhookId}/`,
46
+ errorMetadata: {
47
+ id: webhook.data.webhookId,
48
+ },
49
+ });
50
+ }
51
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/transport/webhooks.ts"],"names":[],"mappings":";;AA4CA,0CAQC;AAaD,8EAeC;AAaD,gDAgBC;AAaD,gDAWC;AArID,wBAAgC;AAWhC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAiCzC,KAAK,UAAU,eAAe,CACjC,WAAiC,EACjC,OAAgB;IAEhB,OAAO,MAAM,IAAA,cAAW,EAAC,WAAW,EAAE;QAClC,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE;KACtD,CAAC,CAAC;AACP,CAAC;AAaM,KAAK,UAAU,iCAAiC,CACnD,WAAiC,EACjC,OAAgB;IAEhB,OAAO,MAAM,IAAA,cAAW,EAAC,WAAW,EAAE;QAClC,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,gBAAgB;QACrB,cAAc,EAAE;YACZ,EAAE,EAAE;gBACA,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;gBAChC,UAAU,EAAE,OAAO,CAAC,GAAG;gBACvB,OAAO,EAAE,IAAI;aAChB;SACJ;KACJ,CAAC,CAAC;AACP,CAAC;AAaM,KAAK,UAAU,kBAAkB,CACpC,WAAiC,EACjC,OAAsB;IAEtB,OAAO,MAAM,IAAA,cAAW,EAAC,WAAW,EAAE;QAClC,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,gBAAgB;QACrB,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,UAAU,EAAE,OAAO,CAAC,GAAG;gBACvB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,OAAO,CAAC,MAAM;aACzB;SACJ;KACJ,CAAC,CAAC;AACP,CAAC;AAaM,KAAK,UAAU,kBAAkB,CACpC,WAAiC,EACjC,OAAgB;IAEhB,OAAO,MAAM,IAAA,cAAW,EAAC,WAAW,EAAE;QAClC,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,GAAG;QACpD,aAAa,EAAE;YACX,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS;SAC7B;KACJ,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { IBinaryData, IDataObject, IExecuteFunctions } from 'n8n-workflow';
2
+ import { APIResponse, FileAPIResponse } from '../../response';
3
+ import { LimetypeProperty } from '../models';
4
+ export declare const setFilename: (preparedBinaryData: IBinaryData, responseFileName: string) => string | undefined;
5
+ export declare function getFilenameFromHeader(headers: Record<string, string | string[] | undefined>): string | null;
6
+ export declare function getFilePropertiesNames(properties: LimetypeProperty[], allowedProperties?: Set<string>): Set<string>;
7
+ export declare function setFileProperties(context: IExecuteFunctions, i: number, fileProperties: Set<string>, definedProperties: IDataObject): Promise<APIResponse<IDataObject>>;
8
+ export declare function processFileResponse<T extends Record<string, unknown>>(nodeContext: IExecuteFunctions, fileProperties: Set<string>, data: T, includeFileContent?: boolean): Promise<FileAPIResponse<T>>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setFilename = void 0;
4
+ exports.getFilenameFromHeader = getFilenameFromHeader;
5
+ exports.getFilePropertiesNames = getFilePropertiesNames;
6
+ exports.setFileProperties = setFileProperties;
7
+ exports.processFileResponse = processFileResponse;
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ const transport_1 = require("../transport");
10
+ const setFilename = (preparedBinaryData, responseFileName) => {
11
+ if (!preparedBinaryData.fileName && preparedBinaryData.fileExtension) {
12
+ return responseFileName;
13
+ }
14
+ return preparedBinaryData.fileName;
15
+ };
16
+ exports.setFilename = setFilename;
17
+ function getFilenameFromHeader(headers) {
18
+ let contentDisposition = headers['content-disposition'] || headers['Content-Disposition'];
19
+ if (!contentDisposition)
20
+ return null;
21
+ if (Array.isArray(contentDisposition)) {
22
+ contentDisposition = contentDisposition[0];
23
+ }
24
+ const filenameStarMatch = /filename\*\s*=\s*UTF-8''([^;]+)/i.exec(contentDisposition);
25
+ if (filenameStarMatch) {
26
+ try {
27
+ return decodeURIComponent(filenameStarMatch[1]);
28
+ }
29
+ catch {
30
+ return filenameStarMatch[1];
31
+ }
32
+ }
33
+ const filenameMatch = /filename\s*=\s*"([^"]+)"|filename\s*=\s*([^;]+)/i.exec(contentDisposition);
34
+ if (filenameMatch) {
35
+ return filenameMatch[1] || filenameMatch[2];
36
+ }
37
+ return null;
38
+ }
39
+ function getFilePropertiesNames(properties, allowedProperties) {
40
+ return new Set(properties
41
+ .filter((property) => property.type === 'file' &&
42
+ (!allowedProperties || allowedProperties.has(property.name)))
43
+ .map((property) => property.name));
44
+ }
45
+ async function setFileProperties(context, i, fileProperties, definedProperties) {
46
+ for (const fileProperty of fileProperties) {
47
+ if (!(fileProperty in definedProperties))
48
+ continue;
49
+ let binaryData;
50
+ try {
51
+ n8n_workflow_1.LoggerProxy.info(`Checking whether "${definedProperties[fileProperty]}" is a valid binary object for property "${fileProperty}"...`);
52
+ binaryData = context.helpers.assertBinaryData(i, definedProperties[fileProperty]);
53
+ }
54
+ catch {
55
+ n8n_workflow_1.LoggerProxy.info(`Invalid or missing binary data for "${fileProperty}". Using original value instead.`);
56
+ continue;
57
+ }
58
+ const response = await (0, transport_1.createFile)(context, binaryData, definedProperties[fileProperty]);
59
+ if (response.success) {
60
+ definedProperties[fileProperty] = response.data.id;
61
+ }
62
+ else
63
+ return response;
64
+ }
65
+ return {
66
+ success: true,
67
+ data: definedProperties,
68
+ };
69
+ }
70
+ async function processFileResponse(nodeContext, fileProperties, data, includeFileContent = false) {
71
+ let updatedData = { ...data };
72
+ const binaryData = {};
73
+ for (const fileProperty of fileProperties) {
74
+ if (!data[fileProperty])
75
+ continue;
76
+ const fileMetadataResponse = await (0, transport_1.getFileMetadata)(nodeContext, data[fileProperty]);
77
+ if (!fileMetadataResponse.success)
78
+ return {
79
+ json: fileMetadataResponse,
80
+ };
81
+ updatedData = {
82
+ ...updatedData,
83
+ [fileProperty]: fileMetadataResponse.data,
84
+ };
85
+ if (includeFileContent) {
86
+ const fileContentResponse = await (0, transport_1.getFileContent)(nodeContext, fileMetadataResponse.data.id);
87
+ if (fileContentResponse.success) {
88
+ binaryData[fileProperty] = fileContentResponse.data;
89
+ }
90
+ else {
91
+ return { json: fileContentResponse };
92
+ }
93
+ }
94
+ }
95
+ return {
96
+ json: {
97
+ success: true,
98
+ data: updatedData,
99
+ },
100
+ binary: binaryData,
101
+ };
102
+ }
103
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/utils/files.ts"],"names":[],"mappings":";;;AAyCA,sDAiCC;AAaD,wDAaC;AAkBD,8CAsCC;AAeD,kDA2CC;AAtND,+CAKsB;AACtB,4CAA2E;AAcpE,MAAM,WAAW,GAAG,CACvB,kBAA+B,EAC/B,gBAAwB,EAC1B,EAAE;IACA,IAAI,CAAC,kBAAkB,CAAC,QAAQ,IAAI,kBAAkB,CAAC,aAAa,EAAE,CAAC;QACnE,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,OAAO,kBAAkB,CAAC,QAAQ,CAAC;AACvC,CAAC,CAAC;AATW,QAAA,WAAW,eAStB;AAYF,SAAgB,qBAAqB,CACjC,OAAsD;IAEtD,IAAI,kBAAkB,GAClB,OAAO,CAAC,qBAAqB,CAAC,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrE,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACpC,kBAAkB,GAAG,kBAAkB,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,EAC5C,WAAW,EACX,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAC/B,CAAC;YACF,IAAI,mBAAmB,CAAC,OAAO,EAAE,CAAC;gBAC9B,UAAU,CAAC,YAAY,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACJ,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;YACzC,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO;QACH,IAAI,EAAE;YACF,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,WAAW;SACpB;QACD,MAAM,EAAE,UAAU;KACrB,CAAC;AACN,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function verifyHmac(key: string, data: Buffer, comparedHmac: string): boolean;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyHmac = verifyHmac;
4
+ const node_crypto_1 = require("node:crypto");
5
+ function generateHmac(key, data) {
6
+ return 'sha256=' + (0, node_crypto_1.createHmac)('sha256', key).update(data).digest('hex');
7
+ }
8
+ function verifyHmac(key, data, comparedHmac) {
9
+ return generateHmac(key, data) === comparedHmac;
10
+ }
11
+ //# sourceMappingURL=hmac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/utils/hmac.ts"],"names":[],"mappings":";;AA4BA,gCAMC;AAlCD,6CAAyC;AAYzC,SAAS,YAAY,CAAC,GAAW,EAAE,IAAY;IAC3C,OAAO,SAAS,GAAG,IAAA,wBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5E,CAAC;AAcD,SAAgB,UAAU,CACtB,GAAW,EACX,IAAY,EACZ,YAAoB;IAEpB,OAAO,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,YAAY,CAAC;AACpD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { setFilename, getFilenameFromHeader, getFilePropertiesNames, processFileResponse, setFileProperties, } from './files';
2
+ export { verifyHmac } from './hmac';
3
+ export { getWebhook } from './webhook';
4
+ export { handleWorkflowError, WorkflowErrorContext } from '../../errorHandling';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleWorkflowError = exports.getWebhook = exports.verifyHmac = exports.setFileProperties = exports.processFileResponse = exports.getFilePropertiesNames = exports.getFilenameFromHeader = exports.setFilename = void 0;
4
+ var files_1 = require("./files");
5
+ Object.defineProperty(exports, "setFilename", { enumerable: true, get: function () { return files_1.setFilename; } });
6
+ Object.defineProperty(exports, "getFilenameFromHeader", { enumerable: true, get: function () { return files_1.getFilenameFromHeader; } });
7
+ Object.defineProperty(exports, "getFilePropertiesNames", { enumerable: true, get: function () { return files_1.getFilePropertiesNames; } });
8
+ Object.defineProperty(exports, "processFileResponse", { enumerable: true, get: function () { return files_1.processFileResponse; } });
9
+ Object.defineProperty(exports, "setFileProperties", { enumerable: true, get: function () { return files_1.setFileProperties; } });
10
+ var hmac_1 = require("./hmac");
11
+ Object.defineProperty(exports, "verifyHmac", { enumerable: true, get: function () { return hmac_1.verifyHmac; } });
12
+ var webhook_1 = require("./webhook");
13
+ Object.defineProperty(exports, "getWebhook", { enumerable: true, get: function () { return webhook_1.getWebhook; } });
14
+ var errorHandling_1 = require("../../errorHandling");
15
+ Object.defineProperty(exports, "handleWorkflowError", { enumerable: true, get: function () { return errorHandling_1.handleWorkflowError; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/utils/index.ts"],"names":[],"mappings":";;;AAAA,iCAMiB;AALb,oGAAA,WAAW,OAAA;AACX,8GAAA,qBAAqB,OAAA;AACrB,+GAAA,sBAAsB,OAAA;AACtB,4GAAA,mBAAmB,OAAA;AACnB,0GAAA,iBAAiB,OAAA;AAErB,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AACnB,qDAAgF;AAAvE,oHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { Webhook, WebhookFunctions } from '../models';
2
+ export declare function getWebhook(hookData: WebhookFunctions): Webhook;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWebhook = getWebhook;
4
+ function getEvents(hookData) {
5
+ const eventData = hookData.getNodeParameter('events', []);
6
+ const eventItems = eventData.event;
7
+ const events = [];
8
+ for (const eventItem of eventItems) {
9
+ events.push(`${eventItem.limetype}.${eventItem.eventType}`);
10
+ }
11
+ return events;
12
+ }
13
+ function createWebhookName(hookData) {
14
+ const events = hookData.getNodeParameter('events');
15
+ return `${events.event[0].limetype}-${events.event[0].eventType}-${Date.now()}`;
16
+ }
17
+ function getWebhook(hookData) {
18
+ const node = hookData.getNode();
19
+ const workflow = hookData.getWorkflow();
20
+ const context = {
21
+ nodeId: node.id,
22
+ nodeName: node.name,
23
+ workflowId: workflow.id,
24
+ workflowName: workflow.name,
25
+ };
26
+ return {
27
+ data: hookData.getWorkflowStaticData('node'),
28
+ events: getEvents(hookData),
29
+ url: hookData.getNodeWebhookUrl('default'),
30
+ context: context,
31
+ name: createWebhookName(hookData),
32
+ };
33
+ }
34
+ //# sourceMappingURL=webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/utils/webhook.ts"],"names":[],"mappings":";;AA+DA,gCAiBC;AAlED,SAAS,SAAS,CAAC,QAA0B;IACzC,MAAM,SAAS,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAKvD,CAAC;IACF,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC;IACnC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAcD,SAAS,iBAAiB,CAAC,QAA0B;IAQjD,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAW,CAAC;IAC7D,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;AACpF,CAAC;AAYD,SAAgB,UAAU,CAAC,QAA0B;IACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,OAAO,GAAmB;QAC5B,MAAM,EAAE,IAAI,CAAC,EAAE;QACf,QAAQ,EAAE,IAAI,CAAC,IAAI;QACnB,UAAU,EAAE,QAAQ,CAAC,EAAE;QACvB,YAAY,EAAE,QAAQ,CAAC,IAAI;KAC9B,CAAC;IAEF,OAAO;QACH,IAAI,EAAE,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC;QAC5C,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC;QAC3B,GAAG,EAAE,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC;QAC1C,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,iBAAiB,CAAC,QAAQ,CAAC;KACpC,CAAC;AACN,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { INodeProperties, INodePropertyOptions } from 'n8n-workflow';
2
+ interface N8NOperationModule {
3
+ description: INodePropertyOptions;
4
+ properties?: INodeProperties[];
5
+ }
6
+ export declare class N8NOperationModuleHandler {
7
+ modules: N8NOperationModule[];
8
+ constructor(modules: N8NOperationModule[]);
9
+ getDescriptions(): INodePropertyOptions[];
10
+ getProperties(): INodeProperties[];
11
+ }
12
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.N8NOperationModuleHandler = void 0;
4
+ class N8NOperationModuleHandler {
5
+ constructor(modules) {
6
+ this.modules = modules.sort((operation1, operation2) => operation1.description.name.localeCompare(operation2.description.name, 'en'));
7
+ }
8
+ getDescriptions() {
9
+ return this.modules.map((operation) => operation.description);
10
+ }
11
+ getProperties() {
12
+ return this.modules.flatMap((operation) => operation.properties || []);
13
+ }
14
+ }
15
+ exports.N8NOperationModuleHandler = N8NOperationModuleHandler;
16
+ //# sourceMappingURL=modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules.js","sourceRoot":"","sources":["../../nodes/modules.ts"],"names":[],"mappings":";;;AAcA,MAAa,yBAAyB;IAOlC,YAAY,OAA6B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CACnD,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CACrC,UAAU,CAAC,WAAW,CAAC,IAAI,EAC3B,IAAI,CACP,CACJ,CAAC;IACN,CAAC;IAKD,eAAe;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAClE,CAAC;IAKD,aAAa;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;CACJ;AA7BD,8DA6BC"}
@@ -0,0 +1,18 @@
1
+ import { IBinaryData } from 'n8n-workflow';
2
+ import { ErrorResponse, WorkflowErrorContext } from './errorHandling';
3
+ export type SuccessResponse<T> = {
4
+ success: true;
5
+ data: T;
6
+ };
7
+ export type WorkflowResponse<T> = T | {
8
+ error: WorkflowErrorContext;
9
+ };
10
+ export type APIResponse<T> = SuccessResponse<T> | ErrorResponse;
11
+ export type FileAPIResponse<T> = {
12
+ json: APIResponse<T>;
13
+ binary?: Record<string, IBinaryData>;
14
+ };
15
+ export type WorkflowFileResponse<T> = {
16
+ json: WorkflowResponse<T>;
17
+ binary?: Record<string, IBinaryData>;
18
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../nodes/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@limetech/n8n-nodes-lime",
3
+ "version": "0.0.0-semantically-released",
4
+ "description": "n8n node to connect to Lime CRM",
5
+ "main": "nodes/index.ts",
6
+ "scripts": {
7
+ "build": "tsc && copyfiles \"nodes/**/*.svg\" dist",
8
+ "dev": "tsc --watch",
9
+ "dev:reload": "nodemon --watch dist --exec 'cp -R dist/* ~/.n8n/custom/dist/'",
10
+ "watch": "concurrently \"npm run dev\" \"npm run dev:reload\"",
11
+ "lint": "eslint --max-warnings=0 .",
12
+ "lint:fix": "eslint --max-warnings=0 . --fix",
13
+ "format": "prettier -c .",
14
+ "format:fix": "prettier --write .",
15
+ "test": "jest",
16
+ "docs": "npx typedoc",
17
+ "knip": "knip"
18
+ },
19
+ "keywords": [
20
+ "n8n",
21
+ "n8n-node",
22
+ "lime-crm",
23
+ "crm",
24
+ "n8n-community-node-package"
25
+ ],
26
+ "n8n": {
27
+ "n8nNodesApiVersion": 1,
28
+ "credentials": [
29
+ "dist/credentials/LimeCrmApi.credentials.js",
30
+ "dist/credentials/FortnoxApi.credentials.js"
31
+ ],
32
+ "nodes": [
33
+ "dist/nodes/lime-crm/LimeCrmNode.node.js",
34
+ "dist/nodes/lime-crm/LimeCrmTrigger.node.js",
35
+ "dist/nodes/fortnox/Fortnox.node.js",
36
+ "dist/nodes/fortnox/FortnoxTrigger.node.js"
37
+ ]
38
+ },
39
+ "devDependencies": {
40
+ "@limetech/eslint-config": "^4.0.0",
41
+ "@semantic-release/changelog": "^6.0.3",
42
+ "@semantic-release/exec": "^7.1.0",
43
+ "@semantic-release/git": "^10.0.1",
44
+ "@types/jest": "^30.0.0",
45
+ "@types/node": "^24.10.1",
46
+ "@types/ws": "^8.18.1",
47
+ "concurrently": "^9.2.1",
48
+ "copyfiles": "^2.4.1",
49
+ "eslint": "^9.39.1",
50
+ "jest": "^30.2.0",
51
+ "knip": "^5.69.0",
52
+ "nodemon": "^3.1.11",
53
+ "prettier": "^3.6.2",
54
+ "semantic-release": "^25.0.2",
55
+ "ts-jest": "^29.4.5",
56
+ "typedoc": "^0.28.14",
57
+ "typescript": "^5.9.3"
58
+ },
59
+ "dependencies": {
60
+ "currency-codes": "^2.2.0",
61
+ "ws": "^8.18.3"
62
+ },
63
+ "peerDependencies": {
64
+ "n8n-workflow": "^1.109.0"
65
+ },
66
+ "publishConfig": {
67
+ "access": "public"
68
+ }
69
+ }