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