@limetech/n8n-nodes-lime 0.4.0 → 2.3.1-dev.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 (330) hide show
  1. package/.github/workflows/lint.yml +3 -1
  2. package/.github/workflows/release.yml +2 -49
  3. package/.github/workflows/test-and-build.yml +1 -1
  4. package/.prettierignore +3 -1
  5. package/.releaserc.json +2 -1
  6. package/CHANGELOG.md +215 -0
  7. package/README.md +2 -9
  8. package/credentials/LimeCrmApi.credentials.ts +44 -7
  9. package/credentials/index.ts +2 -0
  10. package/eslint.config.mjs +2 -1
  11. package/knip.json +9 -0
  12. package/nodes/fortnox/Fortnox.node.ts +3 -3
  13. package/nodes/fortnox/FortnoxTrigger.node.ts +2 -2
  14. package/nodes/fortnox/index.ts +6 -0
  15. package/nodes/fortnox/resources/customers/index.ts +18 -22
  16. package/nodes/fortnox/resources/customers/operations/create.operation.ts +12 -8
  17. package/nodes/fortnox/resources/customers/operations/delete.operation.ts +10 -15
  18. package/nodes/fortnox/resources/customers/operations/get.operation.ts +10 -15
  19. package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +1 -2
  20. package/nodes/fortnox/resources/customers/operations/index.ts +5 -0
  21. package/nodes/fortnox/resources/customers/operations/update.operation.ts +30 -30
  22. package/nodes/fortnox/resources/invoice/index.ts +16 -18
  23. package/nodes/fortnox/resources/invoice/model.ts +0 -4
  24. package/nodes/fortnox/resources/invoice/operations/create.operation.ts +1 -2
  25. package/nodes/fortnox/resources/invoice/operations/get.operation.ts +10 -15
  26. package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +1 -2
  27. package/nodes/fortnox/resources/invoice/operations/index.ts +4 -0
  28. package/nodes/fortnox/resources/invoice/operations/update.operation.ts +11 -16
  29. package/nodes/fortnox/transport/index.ts +14 -11
  30. package/nodes/index.ts +4 -0
  31. package/nodes/lime-crm/LimeCrmNode.node.ts +126 -69
  32. package/nodes/lime-crm/LimeCrmTrigger.node.ts +86 -53
  33. package/nodes/lime-crm/index.ts +9 -0
  34. package/nodes/lime-crm/methods/getLimetypeProperties.ts +110 -0
  35. package/nodes/lime-crm/methods/getLimetypes.ts +26 -0
  36. package/nodes/lime-crm/methods/index.ts +7 -3
  37. package/nodes/lime-crm/models/constants.ts +73 -0
  38. package/nodes/lime-crm/models/index.ts +21 -0
  39. package/nodes/lime-crm/models/limeobject.ts +13 -0
  40. package/nodes/lime-crm/models/limetype.ts +47 -0
  41. package/nodes/lime-crm/models/propertyTypes.ts +13 -0
  42. package/nodes/lime-crm/models/users.ts +46 -0
  43. package/nodes/lime-crm/models/webhook.ts +61 -0
  44. package/nodes/lime-crm/resources/admin/index.ts +89 -0
  45. package/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.ts +166 -0
  46. package/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.ts +113 -0
  47. package/nodes/lime-crm/resources/admin/operations/index.ts +8 -0
  48. package/nodes/lime-crm/resources/data/index.ts +117 -0
  49. package/nodes/lime-crm/resources/data/operations/createSingleObject.operation.ts +231 -0
  50. package/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.ts +83 -0
  51. package/nodes/lime-crm/resources/data/operations/getManyObjects.operation.ts +499 -0
  52. package/nodes/lime-crm/resources/data/operations/getSingleFile.operation.ts +162 -0
  53. package/nodes/lime-crm/resources/data/operations/getSingleObject.operation.ts +116 -0
  54. package/nodes/lime-crm/resources/data/operations/index.ts +24 -0
  55. package/nodes/lime-crm/resources/{limeObject/operations/update.operation.ts → data/operations/updateSingleObject.operation.ts} +91 -25
  56. package/nodes/lime-crm/resources/metadata/index.ts +97 -0
  57. package/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.ts +28 -0
  58. package/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.ts +147 -0
  59. package/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.ts +58 -0
  60. package/nodes/lime-crm/resources/metadata/operations/index.ts +12 -0
  61. package/nodes/lime-crm/transport/commons.ts +97 -27
  62. package/nodes/lime-crm/transport/files.ts +220 -0
  63. package/nodes/lime-crm/transport/index.ts +38 -13
  64. package/nodes/lime-crm/transport/limeQuery.ts +44 -10
  65. package/nodes/lime-crm/transport/limeobjects.ts +126 -168
  66. package/nodes/lime-crm/transport/limetypes.ts +169 -57
  67. package/nodes/lime-crm/transport/users.ts +264 -0
  68. package/nodes/lime-crm/transport/webhooks.ts +96 -37
  69. package/nodes/lime-crm/utils/files.ts +198 -0
  70. package/nodes/lime-crm/utils/hmac.ts +35 -0
  71. package/nodes/lime-crm/utils/index.ts +10 -0
  72. package/nodes/lime-crm/utils/propertyAdapters.ts +75 -0
  73. package/nodes/lime-crm/utils/webhook.ts +81 -0
  74. package/nodes/modules.ts +44 -0
  75. package/nodes/response.ts +16 -0
  76. package/package.json +21 -29
  77. package/restore_script/README +42 -0
  78. package/restore_script/api_key_download.txt +0 -0
  79. package/restore_script/api_key_upload.txt +0 -0
  80. package/restore_script/cli.py +73 -0
  81. package/restore_script/download.py +73 -0
  82. package/restore_script/main.py +19 -0
  83. package/restore_script/poetry.lock +162 -0
  84. package/restore_script/pyproject.toml +15 -0
  85. package/restore_script/transfer.py +41 -0
  86. package/restore_script/upload.py +66 -0
  87. package/restore_script/utils.py +42 -0
  88. package/tests/nodes/lime-crm/utils.spec.ts +238 -0
  89. package/typedoc.css +9 -0
  90. package/typedoc.json +19 -0
  91. package/.dockerignore +0 -1
  92. package/Dockerfile +0 -21
  93. package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
  94. package/dist/credentials/FortnoxApi.credentials.js +0 -57
  95. package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
  96. package/dist/credentials/LimeCrmApi.credentials.d.ts +0 -9
  97. package/dist/credentials/LimeCrmApi.credentials.js +0 -66
  98. package/dist/credentials/LimeCrmApi.credentials.js.map +0 -1
  99. package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
  100. package/dist/nodes/fortnox/Fortnox.node.js +0 -95
  101. package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
  102. package/dist/nodes/fortnox/Fortnox.node.json +0 -18
  103. package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
  104. package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
  105. package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
  106. package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
  107. package/dist/nodes/fortnox/commons.d.ts +0 -25
  108. package/dist/nodes/fortnox/commons.js +0 -44
  109. package/dist/nodes/fortnox/commons.js.map +0 -1
  110. package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
  111. package/dist/nodes/fortnox/model.d.ts +0 -20
  112. package/dist/nodes/fortnox/model.js +0 -3
  113. package/dist/nodes/fortnox/model.js.map +0 -1
  114. package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
  115. package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
  116. package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
  117. package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -20
  118. package/dist/nodes/fortnox/resources/customers/index.js +0 -87
  119. package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
  120. package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
  121. package/dist/nodes/fortnox/resources/customers/model.js +0 -3
  122. package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
  123. package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -12
  124. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -283
  125. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
  126. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -10
  127. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -45
  128. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
  129. package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -11
  130. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -45
  131. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
  132. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -11
  133. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
  134. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
  135. package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -12
  136. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -276
  137. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
  138. package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
  139. package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
  140. package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
  141. package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
  142. package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
  143. package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
  144. package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -20
  145. package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
  146. package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
  147. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
  148. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
  149. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
  150. package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -150
  151. package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
  152. package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
  153. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -11
  154. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
  155. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
  156. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -11
  157. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -44
  158. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
  159. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -11
  160. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
  161. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
  162. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -11
  163. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -71
  164. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
  165. package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
  166. package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
  167. package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
  168. package/dist/nodes/fortnox/transport/index.d.ts +0 -4
  169. package/dist/nodes/fortnox/transport/index.js +0 -77
  170. package/dist/nodes/fortnox/transport/index.js.map +0 -1
  171. package/dist/nodes/lime-crm/LimeCrm.node.json +0 -18
  172. package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +0 -14
  173. package/dist/nodes/lime-crm/LimeCrmNode.node.js +0 -126
  174. package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +0 -1
  175. package/dist/nodes/lime-crm/LimeCrmTrigger.node.d.ts +0 -18
  176. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +0 -215
  177. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +0 -1
  178. package/dist/nodes/lime-crm/assets/lime-crm.svg +0 -1
  179. package/dist/nodes/lime-crm/commons/constants.d.ts +0 -5
  180. package/dist/nodes/lime-crm/commons/constants.js +0 -9
  181. package/dist/nodes/lime-crm/commons/constants.js.map +0 -1
  182. package/dist/nodes/lime-crm/commons/hmac.d.ts +0 -1
  183. package/dist/nodes/lime-crm/commons/hmac.js +0 -11
  184. package/dist/nodes/lime-crm/commons/hmac.js.map +0 -1
  185. package/dist/nodes/lime-crm/commons/index.d.ts +0 -3
  186. package/dist/nodes/lime-crm/commons/index.js +0 -12
  187. package/dist/nodes/lime-crm/commons/index.js.map +0 -1
  188. package/dist/nodes/lime-crm/commons/limetype.d.ts +0 -10
  189. package/dist/nodes/lime-crm/commons/limetype.js +0 -3
  190. package/dist/nodes/lime-crm/commons/limetype.js.map +0 -1
  191. package/dist/nodes/lime-crm/commons/task.d.ts +0 -14
  192. package/dist/nodes/lime-crm/commons/task.js +0 -48
  193. package/dist/nodes/lime-crm/commons/task.js.map +0 -1
  194. package/dist/nodes/lime-crm/commons/webhook.d.ts +0 -20
  195. package/dist/nodes/lime-crm/commons/webhook.js +0 -30
  196. package/dist/nodes/lime-crm/commons/webhook.js.map +0 -1
  197. package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.d.ts +0 -5
  198. package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.js +0 -11
  199. package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.js.map +0 -1
  200. package/dist/nodes/lime-crm/methods/getLimeTypeProperties.d.ts +0 -2
  201. package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js +0 -20
  202. package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js.map +0 -1
  203. package/dist/nodes/lime-crm/methods/getLimeTypes.d.ts +0 -2
  204. package/dist/nodes/lime-crm/methods/getLimeTypes.js +0 -20
  205. package/dist/nodes/lime-crm/methods/getLimeTypes.js.map +0 -1
  206. package/dist/nodes/lime-crm/methods/index.d.ts +0 -3
  207. package/dist/nodes/lime-crm/methods/index.js +0 -10
  208. package/dist/nodes/lime-crm/methods/index.js.map +0 -1
  209. package/dist/nodes/lime-crm/resources/erpConnector/index.d.ts +0 -23
  210. package/dist/nodes/lime-crm/resources/erpConnector/index.js +0 -67
  211. package/dist/nodes/lime-crm/resources/erpConnector/index.js.map +0 -1
  212. package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.d.ts +0 -26
  213. package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.js +0 -65
  214. package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.js.map +0 -1
  215. package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.d.ts +0 -9
  216. package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.js +0 -220
  217. package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.js.map +0 -1
  218. package/dist/nodes/lime-crm/resources/erpConnector/transform.d.ts +0 -15
  219. package/dist/nodes/lime-crm/resources/erpConnector/transform.js +0 -11
  220. package/dist/nodes/lime-crm/resources/erpConnector/transform.js.map +0 -1
  221. package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.d.ts +0 -4
  222. package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.js +0 -7
  223. package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.js.map +0 -1
  224. package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.d.ts +0 -37
  225. package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.js +0 -124
  226. package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.js.map +0 -1
  227. package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.d.ts +0 -1
  228. package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.js +0 -6
  229. package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.js.map +0 -1
  230. package/dist/nodes/lime-crm/resources/limeObject/index.d.ts +0 -14
  231. package/dist/nodes/lime-crm/resources/limeObject/index.js +0 -88
  232. package/dist/nodes/lime-crm/resources/limeObject/index.js.map +0 -1
  233. package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.d.ts +0 -9
  234. package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js +0 -139
  235. package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js.map +0 -1
  236. package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.d.ts +0 -9
  237. package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js +0 -51
  238. package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js.map +0 -1
  239. package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.d.ts +0 -9
  240. package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.js +0 -103
  241. package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.js.map +0 -1
  242. package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.d.ts +0 -9
  243. package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js +0 -51
  244. package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js.map +0 -1
  245. package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.d.ts +0 -9
  246. package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js +0 -103
  247. package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js.map +0 -1
  248. package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.d.ts +0 -9
  249. package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js +0 -149
  250. package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js.map +0 -1
  251. package/dist/nodes/lime-crm/resources/limeQuery/index.d.ts +0 -6
  252. package/dist/nodes/lime-crm/resources/limeQuery/index.js +0 -66
  253. package/dist/nodes/lime-crm/resources/limeQuery/index.js.map +0 -1
  254. package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.d.ts +0 -9
  255. package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js +0 -191
  256. package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js.map +0 -1
  257. package/dist/nodes/lime-crm/resources/limeType/index.d.ts +0 -20
  258. package/dist/nodes/lime-crm/resources/limeType/index.js +0 -81
  259. package/dist/nodes/lime-crm/resources/limeType/index.js.map +0 -1
  260. package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.d.ts +0 -11
  261. package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js +0 -36
  262. package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js.map +0 -1
  263. package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.d.ts +0 -9
  264. package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js +0 -36
  265. package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js.map +0 -1
  266. package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.d.ts +0 -10
  267. package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js +0 -15
  268. package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js.map +0 -1
  269. package/dist/nodes/lime-crm/transport/commons.d.ts +0 -5
  270. package/dist/nodes/lime-crm/transport/commons.js +0 -33
  271. package/dist/nodes/lime-crm/transport/commons.js.map +0 -1
  272. package/dist/nodes/lime-crm/transport/erpConnector.d.ts +0 -9
  273. package/dist/nodes/lime-crm/transport/erpConnector.js +0 -11
  274. package/dist/nodes/lime-crm/transport/erpConnector.js.map +0 -1
  275. package/dist/nodes/lime-crm/transport/index.d.ts +0 -6
  276. package/dist/nodes/lime-crm/transport/index.js +0 -24
  277. package/dist/nodes/lime-crm/transport/index.js.map +0 -1
  278. package/dist/nodes/lime-crm/transport/limeQuery.d.ts +0 -10
  279. package/dist/nodes/lime-crm/transport/limeQuery.js +0 -15
  280. package/dist/nodes/lime-crm/transport/limeQuery.js.map +0 -1
  281. package/dist/nodes/lime-crm/transport/limeobjects.d.ts +0 -7
  282. package/dist/nodes/lime-crm/transport/limeobjects.js +0 -134
  283. package/dist/nodes/lime-crm/transport/limeobjects.js.map +0 -1
  284. package/dist/nodes/lime-crm/transport/limetypes.d.ts +0 -6
  285. package/dist/nodes/lime-crm/transport/limetypes.js +0 -54
  286. package/dist/nodes/lime-crm/transport/limetypes.js.map +0 -1
  287. package/dist/nodes/lime-crm/transport/task.d.ts +0 -13
  288. package/dist/nodes/lime-crm/transport/task.js +0 -13
  289. package/dist/nodes/lime-crm/transport/task.js.map +0 -1
  290. package/dist/nodes/lime-crm/transport/webhooks.d.ts +0 -16
  291. package/dist/nodes/lime-crm/transport/webhooks.js +0 -43
  292. package/dist/nodes/lime-crm/transport/webhooks.js.map +0 -1
  293. package/dist/nodes/nodeResponse.d.ts +0 -12
  294. package/dist/nodes/nodeResponse.js +0 -3
  295. package/dist/nodes/nodeResponse.js.map +0 -1
  296. package/dist/package.json +0 -75
  297. package/dist/tsconfig.tsbuildinfo +0 -1
  298. package/docker-compose.yml +0 -46
  299. package/nodes/lime-crm/commons/constants.ts +0 -10
  300. package/nodes/lime-crm/commons/hmac.ts +0 -13
  301. package/nodes/lime-crm/commons/index.ts +0 -10
  302. package/nodes/lime-crm/commons/limetype.ts +0 -11
  303. package/nodes/lime-crm/commons/task.ts +0 -55
  304. package/nodes/lime-crm/commons/webhook.ts +0 -56
  305. package/nodes/lime-crm/methods/getEntitiesForErpSystem.ts +0 -11
  306. package/nodes/lime-crm/methods/getLimeTypeProperties.ts +0 -27
  307. package/nodes/lime-crm/methods/getLimeTypes.ts +0 -23
  308. package/nodes/lime-crm/resources/erpConnector/index.ts +0 -43
  309. package/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.ts +0 -69
  310. package/nodes/lime-crm/resources/erpConnector/operations/transform.operation.ts +0 -274
  311. package/nodes/lime-crm/resources/erpConnector/transform.ts +0 -49
  312. package/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.ts +0 -18
  313. package/nodes/lime-crm/resources/erpConnector/transformers/fortnox.ts +0 -201
  314. package/nodes/lime-crm/resources/erpConnector/transformers/index.ts +0 -1
  315. package/nodes/lime-crm/resources/limeObject/index.ts +0 -64
  316. package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +0 -152
  317. package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +0 -55
  318. package/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.ts +0 -112
  319. package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +0 -54
  320. package/nodes/lime-crm/resources/limeQuery/index.ts +0 -40
  321. package/nodes/lime-crm/resources/limeQuery/operations/query.operation.ts +0 -222
  322. package/nodes/lime-crm/resources/limeType/index.ts +0 -58
  323. package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +0 -42
  324. package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +0 -36
  325. package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +0 -18
  326. package/nodes/lime-crm/transport/erpConnector.ts +0 -21
  327. package/nodes/lime-crm/transport/task.ts +0 -32
  328. package/nodes/nodeResponse.ts +0 -13
  329. package/tests/fixtures/fortnox.ts +0 -182
  330. package/tests/transform.spec.ts +0 -187
@@ -0,0 +1,264 @@
1
+ import { callLimeApi } from './commons';
2
+ import {
3
+ IAllExecuteFunctions,
4
+ LoggerProxy as Logger,
5
+ NodeOperationError,
6
+ } from 'n8n-workflow';
7
+ import {
8
+ User,
9
+ UserType,
10
+ DEFAULT_API_OBJECT_LIMIT,
11
+ NullOptionType,
12
+ Limetype,
13
+ } from '../models';
14
+ import { getLimetypesFromApi } from './limetypes';
15
+ import { queryLimeobjects, QueryResponse } from './limeQuery';
16
+ import { getLimeobject } from './limeobjects';
17
+
18
+ const USERS_URL = 'api/v1/admin/users/';
19
+
20
+ type UserQueryParameters = {
21
+ active?: boolean;
22
+ user_type?: UserType;
23
+ _limit: number;
24
+ };
25
+
26
+ /**
27
+ * Finds limetype that has a property of type 'user'.
28
+ * There should only be one such limetype in the system.
29
+ *
30
+ * @param limetypes - Array of limetype objects to search through
31
+ * @returns The first limetype with a 'user' property, or undefined if not found
32
+ * @internal
33
+ */
34
+ function findCoworkerLimetype(limetypes: Limetype[]): Limetype | undefined {
35
+ for (const limetype of limetypes) {
36
+ for (const property of limetype.properties) {
37
+ if (property.type === 'user') {
38
+ Logger.info('Found coworker limetype');
39
+ return limetype;
40
+ }
41
+ }
42
+ }
43
+ Logger.warn('No coworker limetype found');
44
+ return undefined;
45
+ }
46
+
47
+ /**
48
+ * Retrieves the coworker limetype from the API.
49
+ *
50
+ * @param nodeContext - The n8n execution context
51
+ * @returns The coworker limetype object
52
+ * @throws NodeOperationError if no coworker limetype is found
53
+ * @internal
54
+ */
55
+ async function findCoworker(
56
+ nodeContext: IAllExecuteFunctions
57
+ ): Promise<Limetype> {
58
+ const response = await getLimetypesFromApi(nodeContext);
59
+ const coworker = findCoworkerLimetype(response);
60
+ if (!coworker) {
61
+ throw new NodeOperationError(
62
+ nodeContext.getNode(),
63
+ `No limetype with 'user' property found to get coworker`
64
+ );
65
+ }
66
+ return coworker;
67
+ }
68
+
69
+ /**
70
+ * Fetches coworker data for a given user.
71
+ *
72
+ * @param nodeContext - The n8n execution context
73
+ * @param coworker - The limetype definition for the coworker
74
+ * @param userId - The ID of the user whose coworker data is to be fetched
75
+ * @returns The coworker data response from the Lime Query API
76
+ * @throws NodeOperationError if no 'user' property is found in the coworker limetype
77
+ * @internal
78
+ */
79
+ async function getCoworker(
80
+ nodeContext: IAllExecuteFunctions,
81
+ coworker: Limetype,
82
+ userId: string | number
83
+ ): Promise<QueryResponse> {
84
+ // 'hasmany' properties are not supported in the response format of Lime Query API
85
+ const properties = Object.fromEntries(
86
+ coworker.properties
87
+ .filter((prop) => prop.type !== 'hasmany')
88
+ .map((prop) => [prop.name, ''])
89
+ );
90
+
91
+ const userProperty = coworker.properties.find(
92
+ (prop) => prop.type === 'user'
93
+ );
94
+ if (!userProperty) {
95
+ throw new NodeOperationError(
96
+ nodeContext.getNode(),
97
+ `No property of type 'user' found in ${coworker.name} limetype`
98
+ );
99
+ }
100
+
101
+ const responseFormat = {
102
+ object: properties,
103
+ };
104
+ const filter = {
105
+ key: userProperty.name,
106
+ op: '=',
107
+ exp: userId,
108
+ };
109
+ const q = JSON.stringify({
110
+ limetype: coworker.name,
111
+ responseFormat: responseFormat,
112
+ filter: filter,
113
+ });
114
+
115
+ return await queryLimeobjects(nodeContext, q);
116
+ }
117
+
118
+ /**
119
+ * Fetch the Lime CRM users with given parameters.
120
+ *
121
+ * @param nodeContext - The n8n execution context
122
+ * @param active - flag used to filtering by active or inactive users
123
+ * @param userType - a type of a user defined in the {@link UserType} class
124
+ * @param limit - max number of users returned by the API call, default is 50
125
+ * @param withCoworker - whether to include coworker data linked to the user
126
+ *
127
+ * @returns List of {@link User} objects
128
+ * @public
129
+ * @group Transport
130
+ */
131
+
132
+ export async function fetchManyUsers(
133
+ nodeContext: IAllExecuteFunctions,
134
+ active: boolean | NullOptionType = '',
135
+ userType: UserType | NullOptionType = '',
136
+ limit: number = DEFAULT_API_OBJECT_LIMIT,
137
+ withCoworker: boolean = false
138
+ ): Promise<User[]> {
139
+ const queryParams: UserQueryParameters = {
140
+ _limit: limit,
141
+ };
142
+ if (active !== '') {
143
+ queryParams.active = active;
144
+ }
145
+ if (userType !== '') {
146
+ queryParams.user_type = userType;
147
+ }
148
+
149
+ const response = await callLimeApi<User[]>(nodeContext, {
150
+ method: 'GET',
151
+ url: USERS_URL,
152
+ requestOptions: {
153
+ qs: queryParams,
154
+ },
155
+ });
156
+
157
+ if (!withCoworker) return response;
158
+ const coworker = await findCoworker(nodeContext);
159
+
160
+ const usersWithCoworkers: User[] = [];
161
+ for (const user of response) {
162
+ const coworkerResponse = await getCoworker(
163
+ nodeContext,
164
+ coworker,
165
+ user.id
166
+ );
167
+ usersWithCoworkers.push({
168
+ ...user,
169
+ [coworker.name]: coworkerResponse.objects[0] || null,
170
+ });
171
+ }
172
+
173
+ return usersWithCoworkers;
174
+ }
175
+
176
+ /**
177
+ * Fetch the single Lime CRM User by ID.
178
+ *
179
+ * @param nodeContext - The n8n execution context
180
+ * @param id - Lime CRM user's ID
181
+ * @param withCoworker - whether to include coworker data linked to the user
182
+ *
183
+ * @returns A {@link User} object
184
+ * @public
185
+ * @group Transport
186
+ */
187
+
188
+ export async function fetchSingleUserById(
189
+ nodeContext: IAllExecuteFunctions,
190
+ id: string,
191
+ withCoworker: boolean = false
192
+ ): Promise<User> {
193
+ const url = `${USERS_URL}${id}`;
194
+ const userResponse = await callLimeApi<User>(nodeContext, {
195
+ method: 'GET',
196
+ url: url,
197
+ errorMetadata: {
198
+ user_id: id,
199
+ },
200
+ });
201
+
202
+ if (!withCoworker) return userResponse;
203
+ const coworker = await findCoworker(nodeContext);
204
+ const coworkerResponse = await getCoworker(nodeContext, coworker, id);
205
+
206
+ return {
207
+ ...userResponse,
208
+ [coworker.name]: coworkerResponse.objects[0] || null,
209
+ };
210
+ }
211
+
212
+ /**
213
+ * Fetch a single Lime CRM User by the related limeobject ID.
214
+ *
215
+ * This function retrieves a user based on the ID of a related limeobject.
216
+ * It could be only one object related to the user in the system, most often it is the
217
+ * 'coworker' limetype. The corresponding limetype is determined automatically.
218
+ *
219
+ * @param nodeContext - The n8n execution context
220
+ * @param id - The ID of the coworker limeobject
221
+ * @param withCoworker - Whether to include coworker data linked to the user (default: false)
222
+ *
223
+ * @returns A {@link User} object, optionally with coworker data
224
+ * @public
225
+ * @group Transport
226
+ */
227
+ export async function fetchSingleUserByLimeobjectId(
228
+ nodeContext: IAllExecuteFunctions,
229
+ id: string,
230
+ withCoworker: boolean = false
231
+ ): Promise<User> {
232
+ const coworker = await findCoworker(nodeContext);
233
+ const coworkerResponse = await getLimeobject(
234
+ nodeContext,
235
+ coworker.name,
236
+ id
237
+ );
238
+
239
+ const userProperty = coworker.properties.find(
240
+ (prop) => prop.type === 'user'
241
+ );
242
+ if (!userProperty) {
243
+ throw new NodeOperationError(
244
+ nodeContext.getNode(),
245
+ `No property of type 'user' found in ${coworker.name} limetype`
246
+ );
247
+ }
248
+
249
+ const url = `${USERS_URL}${coworkerResponse[userProperty.name]}`;
250
+ const userResponse = await callLimeApi<User>(nodeContext, {
251
+ method: 'GET',
252
+ url: url,
253
+ errorMetadata: {
254
+ user_id: id,
255
+ },
256
+ });
257
+
258
+ if (!withCoworker) return userResponse;
259
+
260
+ return {
261
+ ...userResponse,
262
+ [coworker.name]: coworkerResponse || null,
263
+ };
264
+ }
@@ -1,12 +1,28 @@
1
- import { Webhook } from '../commons';
2
1
  import { callLimeApi } from '.';
3
2
  import { IAllExecuteFunctions } from 'n8n-workflow';
4
- import { NodeResponse } from '../../nodeResponse';
5
- import { CreateWebhook } from '../commons/webhook';
3
+ import { CreateWebhook, Webhook } from '../models';
6
4
 
5
+ /**
6
+ * Endpoint path for Lime CRM Subscription API.
7
+ *
8
+ * @internal
9
+ * @group Transport
10
+ */
7
11
  const SUBSCRIPTION_URL = 'api/v1/subscription/';
8
12
 
9
- interface ApiResponseWebhook {
13
+ /**
14
+ * Representation of response format for a Lime CRM webhook subscription.
15
+ *
16
+ * @property {string} id - Unique identifier of the subscription
17
+ * @property {string} name - Name of the subscription
18
+ * @property {boolean} enabled - Whether the subscription is currently enabled
19
+ * @property {string[]} events - List of events the subscription is listening for
20
+ * @property {string} target_url - Target URL for the webhook
21
+ *
22
+ * @public
23
+ * @group Transport
24
+ */
25
+ export interface ApiResponseWebhook {
10
26
  id: string;
11
27
  name: string;
12
28
  enabled: boolean;
@@ -14,61 +30,104 @@ interface ApiResponseWebhook {
14
30
  target_url: string;
15
31
  }
16
32
 
33
+ /**
34
+ * Retrieve details of a specific subscription from Lime CRM.
35
+ *
36
+ * @param nodeContext - The n8n node execution context
37
+ * @param webhook - The webhook object containing subscription details
38
+ *
39
+ * @returns The subscription information from Lime CRM.
40
+ *
41
+ * @public
42
+ * @group Transport
43
+ */
17
44
  export async function getSubscription(
18
45
  nodeContext: IAllExecuteFunctions,
19
46
  webhook: Webhook
20
- ): Promise<NodeResponse<ApiResponseWebhook>> {
21
- return await callLimeApi(
22
- nodeContext,
23
- 'GET',
24
- `${SUBSCRIPTION_URL}${webhook.data.webhookId}`
25
- );
47
+ ): Promise<ApiResponseWebhook> {
48
+ return await callLimeApi(nodeContext, {
49
+ method: 'GET',
50
+ url: `${SUBSCRIPTION_URL}${webhook.data.webhookId}`,
51
+ });
26
52
  }
27
53
 
54
+ /**
55
+ * List all active subscriptions that match the given webhook events and target URL.
56
+ *
57
+ * @param nodeContext - The n8n node execution context
58
+ * @param webhook - The webhook instance containing event and URL information
59
+ *
60
+ * @returns Array of subscription objects from Lime CRM.
61
+ *
62
+ * @public
63
+ * @group Transport
64
+ */
28
65
  export async function listSubscriptionsWithExistingData(
29
66
  nodeContext: IAllExecuteFunctions,
30
67
  webhook: Webhook
31
- ): Promise<NodeResponse<ApiResponseWebhook[]>> {
32
- return await callLimeApi(nodeContext, 'GET', SUBSCRIPTION_URL, {
33
- qs: {
34
- events: webhook.events.join(','),
35
- target_url: webhook.url,
36
- enabled: true,
68
+ ): Promise<ApiResponseWebhook[]> {
69
+ return await callLimeApi(nodeContext, {
70
+ method: 'GET',
71
+ url: SUBSCRIPTION_URL,
72
+ requestOptions: {
73
+ qs: {
74
+ events: webhook.events.join(','),
75
+ target_url: webhook.url,
76
+ enabled: true,
77
+ },
37
78
  },
38
79
  });
39
80
  }
40
81
 
82
+ /**
83
+ * Creates a new webhook subscription in Lime CRM.
84
+ *
85
+ * @param nodeContext - The n8n node execution context.
86
+ * @param webhook - The webhook configuration to create.
87
+ *
88
+ * @returns The newly created subscription object.
89
+ *
90
+ * @public
91
+ * @group Transport
92
+ */
41
93
  export async function createSubscription(
42
94
  nodeContext: IAllExecuteFunctions,
43
95
  webhook: CreateWebhook
44
- ): Promise<NodeResponse<ApiResponseWebhook>> {
45
- return await callLimeApi(nodeContext, 'POST', SUBSCRIPTION_URL, {
46
- body: {
47
- events: webhook.events,
48
- target_url: webhook.url,
49
- name: webhook.name,
50
- secret: webhook.secret,
96
+ ): Promise<ApiResponseWebhook> {
97
+ return await callLimeApi(nodeContext, {
98
+ method: 'POST',
99
+ url: SUBSCRIPTION_URL,
100
+ requestOptions: {
101
+ body: {
102
+ events: webhook.events,
103
+ target_url: webhook.url,
104
+ name: webhook.name,
105
+ secret: webhook.secret,
106
+ },
51
107
  },
52
108
  });
53
109
  }
54
110
 
111
+ /**
112
+ * Delete a webhook subscription from Lime CRM.
113
+ *
114
+ * @param nodeContext - The n8n node execution context
115
+ * @param webhook - The webhook object identifying the subscription to delete
116
+ *
117
+ * @returns Response indicating success or failure of the deletion.
118
+ *
119
+ * @public
120
+ * @group Transport
121
+ */
55
122
  export async function deleteSubscription(
56
123
  nodeContext: IAllExecuteFunctions,
57
124
  webhook: Webhook
58
- ): Promise<NodeResponse<void>> {
59
- const response: NodeResponse<void> = await callLimeApi(
60
- nodeContext,
61
- 'DELETE',
62
- `${SUBSCRIPTION_URL}${webhook.data.webhookId}/`
63
- );
64
-
65
- if (response.success) return response;
66
-
67
- return {
68
- ...response,
69
- metadata: {
70
- ...response.metadata,
125
+ ): Promise<void> {
126
+ return await callLimeApi(nodeContext, {
127
+ method: 'DELETE',
128
+ url: `${SUBSCRIPTION_URL}${webhook.data.webhookId}/`,
129
+ errorMetadata: {
71
130
  id: webhook.data.webhookId,
72
131
  },
73
- };
132
+ });
74
133
  }
@@ -0,0 +1,198 @@
1
+ import {
2
+ IBinaryData,
3
+ IDataObject,
4
+ IExecuteFunctions,
5
+ LoggerProxy as Logger,
6
+ } from 'n8n-workflow';
7
+ import { createFile, getFileContent, getFileMetadata } from '../transport';
8
+ import { FileResponse } from '../../response';
9
+ import { LimetypeProperty } from '../models';
10
+
11
+ /**
12
+ * Set a default file name if missing.
13
+ *
14
+ * @param preparedBinaryData - The binary data object
15
+ * @param responseFileName -The fallback file name to assign if the binary data has no name
16
+ *
17
+ * @returns Set filename
18
+ * @public
19
+ * @group Utils
20
+ */
21
+ export const setFilename = (
22
+ preparedBinaryData: IBinaryData,
23
+ responseFileName: string
24
+ ) => {
25
+ if (!preparedBinaryData.fileName && preparedBinaryData.fileExtension) {
26
+ return responseFileName;
27
+ }
28
+
29
+ return preparedBinaryData.fileName;
30
+ };
31
+
32
+ /**
33
+ * Extract a filename from the `Content-Disposition` HTTP header.
34
+ *
35
+ * @param headers - An object containing HTTP headers, where the key may be either
36
+ * `'content-disposition'` or `'Content-Disposition'`
37
+ *
38
+ * @returns Filename or `null` if the header does not contain one
39
+ * @public
40
+ * @group Utils
41
+ */
42
+ export function getFilenameFromHeader(
43
+ headers: Record<string, string | string[] | undefined>
44
+ ): string | null {
45
+ let contentDisposition =
46
+ headers['content-disposition'] || headers['Content-Disposition'];
47
+ if (!contentDisposition) return null;
48
+
49
+ if (Array.isArray(contentDisposition)) {
50
+ contentDisposition = contentDisposition[0];
51
+ }
52
+
53
+ // Try RFC 5987 filename* format
54
+ const filenameStarMatch = /filename\*\s*=\s*UTF-8''([^;]+)/i.exec(
55
+ contentDisposition
56
+ );
57
+ if (filenameStarMatch) {
58
+ try {
59
+ return decodeURIComponent(filenameStarMatch[1]);
60
+ } catch {
61
+ return filenameStarMatch[1];
62
+ }
63
+ }
64
+
65
+ // Try regular filename="..." or filename=...
66
+ const filenameMatch =
67
+ /filename\s*=\s*"([^"]+)"|filename\s*=\s*([^;]+)/i.exec(
68
+ contentDisposition
69
+ );
70
+ if (filenameMatch) {
71
+ return filenameMatch[1] || filenameMatch[2];
72
+ }
73
+
74
+ return null;
75
+ }
76
+
77
+ /**
78
+ * Retrieve all file properties names for a given Limetype
79
+ * and optionally filter by a set of allowed property names.
80
+ *
81
+ * @param properties - the {@link LimeTypeProperty} object array fetched from Lime CRM
82
+ * @param allowedProperties - An optional set of property names to include in the result
83
+ *
84
+ * @returns A set containing the names of all matching file-type properties.
85
+ * @public
86
+ * @group Utils
87
+ */
88
+ export function getFilePropertiesNames(
89
+ properties: LimetypeProperty[],
90
+ allowedProperties?: Set<string>
91
+ ): Set<string> {
92
+ return new Set(
93
+ properties
94
+ .filter(
95
+ (property) =>
96
+ property.type === 'file' &&
97
+ (!allowedProperties || allowedProperties.has(property.name))
98
+ )
99
+ .map((property) => property.name)
100
+ );
101
+ }
102
+
103
+ /**
104
+ * Iterate through all file properties, checks whether
105
+ * the corresponding values represent valid binary data, and uploads them.
106
+ * When a file is successfully uploaded, its property value is replaced with the returned file ID.
107
+ *
108
+ * @param context - The n8n node execution context
109
+ * @param i - The index of the current item being processed
110
+ * @param fileProperties - A set of Limeobject property names that are of type `'file'`
111
+ * @param definedProperties - An object containing property values
112
+ *
113
+ * @returns A response object indicating whether the operation succeeded and containing
114
+ * the updated properties.
115
+ *
116
+ * @public
117
+ * @group Utils
118
+ */
119
+ export async function setFileProperties(
120
+ context: IExecuteFunctions,
121
+ i: number,
122
+ fileProperties: Set<string>,
123
+ definedProperties: IDataObject
124
+ ): Promise<IDataObject> {
125
+ for (const fileProperty of fileProperties) {
126
+ if (!(fileProperty in definedProperties)) continue;
127
+ let binaryData: IBinaryData;
128
+ try {
129
+ Logger.info(
130
+ `Checking whether "${definedProperties[fileProperty]}" is a valid binary object for property "${fileProperty}"...`
131
+ );
132
+ binaryData = context.helpers.assertBinaryData(
133
+ i,
134
+ definedProperties[fileProperty] as string
135
+ );
136
+ } catch {
137
+ Logger.info(
138
+ `Invalid or missing binary data for "${fileProperty}". Using original value instead.`
139
+ );
140
+ continue;
141
+ }
142
+
143
+ const response = await createFile(
144
+ context,
145
+ binaryData,
146
+ definedProperties[fileProperty] as string
147
+ );
148
+
149
+ definedProperties[fileProperty] = response.id;
150
+ }
151
+ return definedProperties;
152
+ }
153
+
154
+ /**
155
+ * Update file properties with a file metadata and optionally retrieves file content.
156
+ *
157
+ * @param nodeContext - The n8n node execution context
158
+ * @param fileProperties - A set of file property names to process
159
+ * @param data - The record data containing property values to process
160
+ * @param includeFileContent - Whether to include the actual file content in the response. Defaults to `false`
161
+ *
162
+ * @returns A {@link FileResponse} object containing updated JSON data and, if requested, the associated binary files.
163
+ *
164
+ * @public
165
+ * @group Utils
166
+ */
167
+ export async function processFileResponse<T extends Record<string, unknown>>(
168
+ nodeContext: IExecuteFunctions,
169
+ fileProperties: Set<string>,
170
+ data: T,
171
+ includeFileContent: boolean = false
172
+ ): Promise<FileResponse<T>> {
173
+ let updatedData = { ...data };
174
+ const binaryData: Record<string, IBinaryData> = {};
175
+ for (const fileProperty of fileProperties) {
176
+ if (!data[fileProperty]) continue;
177
+ const fileMetadataResponse = await getFileMetadata(
178
+ nodeContext,
179
+ data[fileProperty] as string
180
+ );
181
+
182
+ updatedData = {
183
+ ...updatedData,
184
+ [fileProperty]: fileMetadataResponse,
185
+ };
186
+
187
+ if (includeFileContent) {
188
+ binaryData[fileProperty] = await getFileContent(
189
+ nodeContext,
190
+ fileMetadataResponse.id
191
+ );
192
+ }
193
+ }
194
+ return {
195
+ json: updatedData,
196
+ binary: binaryData,
197
+ };
198
+ }
@@ -0,0 +1,35 @@
1
+ import { createHmac } from 'node:crypto';
2
+
3
+ /**
4
+ * Generate an HMAC SHA-256 hash for the given data using the provided key.
5
+ *
6
+ * @param key - The secret key used to generate the HMAC
7
+ * @param data - The data to hash
8
+ * @returns The generated HMAC string in the format `sha256=<digest>`.
9
+ *
10
+ * @internal
11
+ * @group Utils
12
+ */
13
+ function generateHmac(key: string, data: Buffer): string {
14
+ return 'sha256=' + createHmac('sha256', key).update(data).digest('hex');
15
+ }
16
+
17
+ /**
18
+ * Verify that a given HMAC matches the expected value for the provided data and key.
19
+ *
20
+ * @param key - The secret key used to generate the HMAC
21
+ * @param data - The data to verify against
22
+ * @param comparedHmac - The HMAC value to compare with
23
+ *
24
+ * @returns `true` if the HMAC matches, otherwise `false`.
25
+ *
26
+ * @public
27
+ * @group Utils
28
+ */
29
+ export function verifyHmac(
30
+ key: string,
31
+ data: Buffer,
32
+ comparedHmac: string
33
+ ): boolean {
34
+ return generateHmac(key, data) === comparedHmac;
35
+ }
@@ -0,0 +1,10 @@
1
+ export {
2
+ setFilename,
3
+ getFilenameFromHeader,
4
+ getFilePropertiesNames,
5
+ processFileResponse,
6
+ setFileProperties,
7
+ } from './files';
8
+ export { verifyHmac } from './hmac';
9
+ export { getWebhook } from './webhook';
10
+ export { adaptProperty, getPropertyType } from './propertyAdapters';