@limetech/n8n-nodes-lime 0.2.9 → 0.3.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 (271) hide show
  1. package/.dockerignore +1 -0
  2. package/.github/workflows/lint.yml +21 -0
  3. package/.github/workflows/release.yml +82 -0
  4. package/.github/workflows/test-and-build.yml +47 -0
  5. package/.prettierignore +4 -0
  6. package/.prettierrc.mjs +1 -0
  7. package/.releaserc.json +34 -0
  8. package/CHANGELOG.md +74 -0
  9. package/Dockerfile +21 -0
  10. package/README.md +4 -0
  11. package/credentials/FortnoxApi.credentials.ts +61 -0
  12. package/credentials/LimeCrmApi.credentials.ts +60 -0
  13. package/dist/credentials/FortnoxApi.credentials.d.ts +9 -0
  14. package/dist/credentials/FortnoxApi.credentials.js +57 -0
  15. package/dist/credentials/FortnoxApi.credentials.js.map +1 -0
  16. package/dist/credentials/LimeCrmApi.credentials.js +3 -2
  17. package/dist/credentials/LimeCrmApi.credentials.js.map +1 -1
  18. package/dist/nodes/fortnox/Fortnox.node.d.ts +5 -0
  19. package/dist/nodes/fortnox/Fortnox.node.js +95 -0
  20. package/dist/nodes/fortnox/Fortnox.node.js.map +1 -0
  21. package/dist/nodes/fortnox/Fortnox.node.json +18 -0
  22. package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +5 -0
  23. package/dist/nodes/fortnox/FortnoxTrigger.node.js +155 -0
  24. package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +1 -0
  25. package/dist/nodes/fortnox/FortnoxTrigger.node.json +18 -0
  26. package/dist/nodes/fortnox/commons.d.ts +25 -0
  27. package/dist/nodes/fortnox/commons.js +44 -0
  28. package/dist/nodes/fortnox/commons.js.map +1 -0
  29. package/dist/nodes/fortnox/model.d.ts +20 -0
  30. package/dist/nodes/fortnox/model.js +3 -0
  31. package/dist/nodes/fortnox/model.js.map +1 -0
  32. package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +2 -0
  33. package/dist/nodes/fortnox/resources/customers/filterParameters.js +31 -0
  34. package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +1 -0
  35. package/dist/nodes/fortnox/resources/customers/index.d.ts +20 -0
  36. package/dist/nodes/fortnox/resources/customers/index.js +77 -0
  37. package/dist/nodes/fortnox/resources/customers/index.js.map +1 -0
  38. package/dist/nodes/fortnox/resources/customers/model.d.ts +99 -0
  39. package/dist/nodes/fortnox/resources/customers/model.js +3 -0
  40. package/dist/nodes/fortnox/resources/customers/model.js.map +1 -0
  41. package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +12 -0
  42. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +283 -0
  43. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +1 -0
  44. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +10 -0
  45. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +36 -0
  46. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +1 -0
  47. package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +11 -0
  48. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +36 -0
  49. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +1 -0
  50. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +11 -0
  51. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +68 -0
  52. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +1 -0
  53. package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +12 -0
  54. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +267 -0
  55. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +1 -0
  56. package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +2 -0
  57. package/dist/nodes/fortnox/resources/customers/sortParameters.js +30 -0
  58. package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +1 -0
  59. package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +2 -0
  60. package/dist/nodes/fortnox/resources/invoice/filterParameters.js +72 -0
  61. package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +1 -0
  62. package/dist/nodes/fortnox/resources/invoice/index.d.ts +20 -0
  63. package/dist/nodes/fortnox/resources/invoice/index.js +71 -0
  64. package/dist/nodes/fortnox/resources/invoice/index.js.map +1 -0
  65. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +2 -0
  66. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +193 -0
  67. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +1 -0
  68. package/dist/nodes/fortnox/resources/invoice/model.d.ts +150 -0
  69. package/dist/nodes/fortnox/resources/invoice/model.js +3 -0
  70. package/dist/nodes/fortnox/resources/invoice/model.js.map +1 -0
  71. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +11 -0
  72. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +64 -0
  73. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +1 -0
  74. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +11 -0
  75. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +35 -0
  76. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +1 -0
  77. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +11 -0
  78. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +92 -0
  79. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +1 -0
  80. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +11 -0
  81. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +62 -0
  82. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +1 -0
  83. package/dist/nodes/fortnox/transport/errorCodes.d.ts +1 -0
  84. package/dist/nodes/fortnox/transport/errorCodes.js +51 -0
  85. package/dist/nodes/fortnox/transport/errorCodes.js.map +1 -0
  86. package/dist/nodes/fortnox/transport/index.d.ts +4 -0
  87. package/dist/nodes/fortnox/transport/index.js +72 -0
  88. package/dist/nodes/fortnox/transport/index.js.map +1 -0
  89. package/dist/nodes/lime-crm/LimeCrm.node.json +18 -0
  90. package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +14 -0
  91. package/dist/nodes/lime-crm/LimeCrmNode.node.js +113 -0
  92. package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -0
  93. package/dist/nodes/lime-crm/LimeCrmTrigger.node.d.ts +18 -0
  94. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +200 -0
  95. package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +1 -0
  96. package/dist/nodes/lime-crm/commons/constants.d.ts +4 -0
  97. package/dist/nodes/lime-crm/commons/constants.js +8 -0
  98. package/dist/nodes/lime-crm/commons/constants.js.map +1 -0
  99. package/dist/nodes/lime-crm/commons/index.d.ts +3 -0
  100. package/dist/nodes/lime-crm/commons/index.js +11 -0
  101. package/dist/nodes/lime-crm/commons/index.js.map +1 -0
  102. package/dist/nodes/lime-crm/commons/limetype.d.ts +10 -0
  103. package/dist/nodes/lime-crm/commons/limetype.js +3 -0
  104. package/dist/nodes/lime-crm/commons/limetype.js.map +1 -0
  105. package/dist/nodes/lime-crm/commons/task.d.ts +14 -0
  106. package/dist/nodes/lime-crm/commons/task.js +49 -0
  107. package/dist/nodes/lime-crm/commons/task.js.map +1 -0
  108. package/dist/nodes/lime-crm/commons/webhook.d.ts +16 -0
  109. package/dist/nodes/lime-crm/commons/webhook.js +30 -0
  110. package/dist/nodes/lime-crm/commons/webhook.js.map +1 -0
  111. package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.d.ts +5 -0
  112. package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.js +12 -0
  113. package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.js.map +1 -0
  114. package/dist/nodes/lime-crm/methods/getLimeTypeProperties.d.ts +2 -0
  115. package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js +21 -0
  116. package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js.map +1 -0
  117. package/dist/nodes/lime-crm/methods/getLimeTypes.d.ts +2 -0
  118. package/dist/nodes/lime-crm/methods/getLimeTypes.js +21 -0
  119. package/dist/nodes/lime-crm/methods/getLimeTypes.js.map +1 -0
  120. package/dist/nodes/lime-crm/methods/index.d.ts +3 -0
  121. package/dist/nodes/lime-crm/methods/index.js +10 -0
  122. package/dist/nodes/lime-crm/methods/index.js.map +1 -0
  123. package/dist/nodes/lime-crm/resources/erpConnector/index.d.ts +23 -0
  124. package/dist/nodes/lime-crm/resources/erpConnector/index.js +57 -0
  125. package/dist/nodes/lime-crm/resources/erpConnector/index.js.map +1 -0
  126. package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.d.ts +26 -0
  127. package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.js +65 -0
  128. package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.js.map +1 -0
  129. package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.d.ts +9 -0
  130. package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.js +220 -0
  131. package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.js.map +1 -0
  132. package/dist/nodes/lime-crm/resources/erpConnector/transform.d.ts +15 -0
  133. package/dist/nodes/lime-crm/resources/erpConnector/transform.js +12 -0
  134. package/dist/nodes/lime-crm/resources/erpConnector/transform.js.map +1 -0
  135. package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.d.ts +4 -0
  136. package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.js +7 -0
  137. package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.js.map +1 -0
  138. package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.d.ts +37 -0
  139. package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.js +124 -0
  140. package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.js.map +1 -0
  141. package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.d.ts +1 -0
  142. package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.js +6 -0
  143. package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.js.map +1 -0
  144. package/dist/nodes/lime-crm/resources/limeObject/index.d.ts +14 -0
  145. package/dist/nodes/lime-crm/resources/limeObject/index.js +78 -0
  146. package/dist/nodes/lime-crm/resources/limeObject/index.js.map +1 -0
  147. package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.d.ts +9 -0
  148. package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js +139 -0
  149. package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js.map +1 -0
  150. package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.d.ts +9 -0
  151. package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js +51 -0
  152. package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js.map +1 -0
  153. package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.d.ts +9 -0
  154. package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js +51 -0
  155. package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js.map +1 -0
  156. package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.d.ts +9 -0
  157. package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js +86 -0
  158. package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js.map +1 -0
  159. package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.d.ts +9 -0
  160. package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js +149 -0
  161. package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js.map +1 -0
  162. package/dist/nodes/lime-crm/resources/limeType/index.d.ts +20 -0
  163. package/dist/nodes/lime-crm/resources/limeType/index.js +71 -0
  164. package/dist/nodes/lime-crm/resources/limeType/index.js.map +1 -0
  165. package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.d.ts +11 -0
  166. package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js +36 -0
  167. package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js.map +1 -0
  168. package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.d.ts +9 -0
  169. package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js +36 -0
  170. package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js.map +1 -0
  171. package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.d.ts +10 -0
  172. package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js +15 -0
  173. package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js.map +1 -0
  174. package/dist/nodes/lime-crm/transport/commons.d.ts +5 -0
  175. package/dist/nodes/lime-crm/transport/commons.js +33 -0
  176. package/dist/nodes/lime-crm/transport/commons.js.map +1 -0
  177. package/dist/nodes/lime-crm/transport/erpConnector.d.ts +9 -0
  178. package/dist/nodes/lime-crm/transport/erpConnector.js +12 -0
  179. package/dist/nodes/lime-crm/transport/erpConnector.js.map +1 -0
  180. package/dist/nodes/lime-crm/transport/index.d.ts +5 -0
  181. package/dist/nodes/lime-crm/transport/index.js +22 -0
  182. package/dist/nodes/lime-crm/transport/index.js.map +1 -0
  183. package/dist/nodes/lime-crm/transport/limeobjects.d.ts +7 -0
  184. package/dist/nodes/lime-crm/transport/limeobjects.js +49 -0
  185. package/dist/nodes/lime-crm/transport/limeobjects.js.map +1 -0
  186. package/dist/nodes/lime-crm/transport/limetypes.d.ts +6 -0
  187. package/dist/nodes/lime-crm/transport/limetypes.js +40 -0
  188. package/dist/nodes/lime-crm/transport/limetypes.js.map +1 -0
  189. package/dist/nodes/lime-crm/transport/task.d.ts +13 -0
  190. package/dist/nodes/lime-crm/transport/task.js +14 -0
  191. package/dist/nodes/lime-crm/transport/task.js.map +1 -0
  192. package/dist/nodes/lime-crm/transport/webhooks.d.ts +15 -0
  193. package/dist/nodes/lime-crm/transport/webhooks.js +33 -0
  194. package/dist/nodes/lime-crm/transport/webhooks.js.map +1 -0
  195. package/dist/nodes/nodeResponse.d.ts +12 -0
  196. package/dist/nodes/nodeResponse.js +3 -0
  197. package/dist/nodes/nodeResponse.js.map +1 -0
  198. package/dist/package.json +36 -16
  199. package/dist/tsconfig.tsbuildinfo +1 -1
  200. package/docker-compose.yml +46 -0
  201. package/eslint.config.mjs +27 -0
  202. package/jest.config.js +11 -0
  203. package/nodes/fortnox/Fortnox.node.json +18 -0
  204. package/nodes/fortnox/Fortnox.node.ts +102 -0
  205. package/nodes/fortnox/FortnoxTrigger.node.json +18 -0
  206. package/nodes/fortnox/FortnoxTrigger.node.ts +196 -0
  207. package/nodes/fortnox/commons.ts +94 -0
  208. package/nodes/fortnox/fortnoxLogo.svg +15 -0
  209. package/nodes/fortnox/model.ts +25 -0
  210. package/nodes/fortnox/resources/customers/filterParameters.ts +47 -0
  211. package/nodes/fortnox/resources/customers/index.ts +57 -0
  212. package/nodes/fortnox/resources/customers/model.ts +107 -0
  213. package/nodes/fortnox/resources/customers/operations/create.operation.ts +303 -0
  214. package/nodes/fortnox/resources/customers/operations/delete.operation.ts +44 -0
  215. package/nodes/fortnox/resources/customers/operations/get.operation.ts +45 -0
  216. package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +80 -0
  217. package/nodes/fortnox/resources/customers/operations/update.operation.ts +278 -0
  218. package/nodes/fortnox/resources/customers/sortParameters.ts +32 -0
  219. package/nodes/fortnox/resources/invoice/filterParameters.ts +88 -0
  220. package/nodes/fortnox/resources/invoice/index.ts +51 -0
  221. package/nodes/fortnox/resources/invoice/invoiceParameters.ts +214 -0
  222. package/nodes/fortnox/resources/invoice/model.ts +160 -0
  223. package/nodes/fortnox/resources/invoice/operations/create.operation.ts +72 -0
  224. package/nodes/fortnox/resources/invoice/operations/get.operation.ts +45 -0
  225. package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +101 -0
  226. package/nodes/fortnox/resources/invoice/operations/update.operation.ts +74 -0
  227. package/nodes/fortnox/transport/errorCodes.ts +62 -0
  228. package/nodes/fortnox/transport/index.ts +98 -0
  229. package/nodes/lime-crm/LimeCrm.node.json +18 -0
  230. package/nodes/lime-crm/LimeCrmNode.node.ts +135 -0
  231. package/nodes/lime-crm/LimeCrmTrigger.node.ts +263 -0
  232. package/nodes/lime-crm/assets/lime-crm.svg +1 -0
  233. package/nodes/lime-crm/commons/constants.ts +9 -0
  234. package/nodes/lime-crm/commons/index.ts +9 -0
  235. package/nodes/lime-crm/commons/limetype.ts +11 -0
  236. package/nodes/lime-crm/commons/task.ts +55 -0
  237. package/nodes/lime-crm/commons/webhook.ts +50 -0
  238. package/nodes/lime-crm/methods/getEntitiesForErpSystem.ts +11 -0
  239. package/nodes/lime-crm/methods/getLimeTypeProperties.ts +27 -0
  240. package/nodes/lime-crm/methods/getLimeTypes.ts +23 -0
  241. package/nodes/lime-crm/methods/index.ts +3 -0
  242. package/nodes/lime-crm/resources/erpConnector/index.ts +43 -0
  243. package/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.ts +69 -0
  244. package/nodes/lime-crm/resources/erpConnector/operations/transform.operation.ts +274 -0
  245. package/nodes/lime-crm/resources/erpConnector/transform.ts +49 -0
  246. package/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.ts +18 -0
  247. package/nodes/lime-crm/resources/erpConnector/transformers/fortnox.ts +201 -0
  248. package/nodes/lime-crm/resources/erpConnector/transformers/index.ts +1 -0
  249. package/nodes/lime-crm/resources/limeObject/index.ts +64 -0
  250. package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +152 -0
  251. package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +55 -0
  252. package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +54 -0
  253. package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +99 -0
  254. package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +157 -0
  255. package/nodes/lime-crm/resources/limeType/index.ts +58 -0
  256. package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +42 -0
  257. package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +36 -0
  258. package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +18 -0
  259. package/nodes/lime-crm/transport/commons.ts +44 -0
  260. package/nodes/lime-crm/transport/erpConnector.ts +21 -0
  261. package/nodes/lime-crm/transport/index.ts +17 -0
  262. package/nodes/lime-crm/transport/limeobjects.ts +83 -0
  263. package/nodes/lime-crm/transport/limetypes.ts +68 -0
  264. package/nodes/lime-crm/transport/task.ts +32 -0
  265. package/nodes/lime-crm/transport/webhooks.ts +61 -0
  266. package/nodes/nodeResponse.ts +13 -0
  267. package/package.json +36 -16
  268. package/tests/fixtures/fortnox.ts +182 -0
  269. package/tests/transform.spec.ts +187 -0
  270. package/tsconfig.json +30 -0
  271. package/index.js +0 -3
@@ -0,0 +1,18 @@
1
+ {
2
+ "node": "n8n-nodes-base.fortnox",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Finance & Accounting"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://api.fortnox.se/developer/authorization"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://api.fortnox.se/apidocs"
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,5 @@
1
+ import { INodeType, INodeTypeDescription, ITriggerFunctions, ITriggerResponse } from 'n8n-workflow';
2
+ export declare class FortnoxTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ trigger(this: ITriggerFunctions): Promise<ITriggerResponse>;
5
+ }
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FortnoxTrigger = void 0;
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const ws_1 = __importDefault(require("ws"));
9
+ const commons_1 = require("./commons");
10
+ class FortnoxTrigger {
11
+ constructor() {
12
+ this.description = {
13
+ displayName: 'Fortnox Trigger',
14
+ name: 'fortnoxTrigger',
15
+ icon: 'file:fortnoxLogo.svg',
16
+ group: ['trigger'],
17
+ version: 1,
18
+ description: "Triggers workflows in real time by subscribing to Fortnox's WebSocket API for updates " +
19
+ 'on selected topics like invoices or customers.',
20
+ defaults: {
21
+ name: 'Fortnox Trigger',
22
+ },
23
+ inputs: [],
24
+ outputs: ["main"],
25
+ credentials: [
26
+ {
27
+ name: commons_1.FORTNOX_API_CREDENTIAL_KEY,
28
+ required: true,
29
+ },
30
+ ],
31
+ properties: [
32
+ {
33
+ displayName: 'Include Child Tenants',
34
+ name: 'includeChildTenants',
35
+ type: 'boolean',
36
+ required: true,
37
+ default: false,
38
+ },
39
+ {
40
+ displayName: 'Topics',
41
+ name: 'topicCollection',
42
+ required: true,
43
+ type: 'fixedCollection',
44
+ typeOptions: {
45
+ multipleValues: true,
46
+ },
47
+ default: {},
48
+ placeholder: 'Add Topics',
49
+ description: 'Topics to subscribe to',
50
+ options: [
51
+ {
52
+ name: 'topics',
53
+ displayName: 'Topics',
54
+ values: [
55
+ {
56
+ displayName: 'Topic',
57
+ name: 'topic',
58
+ type: 'options',
59
+ required: true,
60
+ default: 'customers',
61
+ options: [
62
+ {
63
+ name: 'Customers',
64
+ value: 'customers',
65
+ },
66
+ {
67
+ name: 'Invoices',
68
+ value: 'invoices',
69
+ },
70
+ {
71
+ name: 'Orders',
72
+ value: 'orders',
73
+ },
74
+ ],
75
+ description: 'Topic to subscribe to',
76
+ },
77
+ {
78
+ displayName: 'Offset',
79
+ name: 'offset',
80
+ type: 'string',
81
+ default: '',
82
+ description: 'Offset to supply in order to get events replayed up to 14 days back',
83
+ },
84
+ ],
85
+ },
86
+ ],
87
+ },
88
+ ],
89
+ };
90
+ }
91
+ async trigger() {
92
+ const includeChildTenants = this.getNodeParameter('includeChildTenants');
93
+ const topicCollection = this.getNodeParameter('topicCollection', {});
94
+ const credentials = await this.getCredentials('fortnoxApi');
95
+ if (!credentials.clientSecret) {
96
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Credential 'Client Secret' must be provided for the node to work properly");
97
+ }
98
+ const socket = new ws_1.default('wss://ws.fortnox.se/topics-v1');
99
+ const startSocket = async () => {
100
+ const commands = {
101
+ 'Add Tenants': 'add-tenants-v1',
102
+ 'Add Topics': 'add-topics-v1',
103
+ Subscribe: 'subscribe-v1',
104
+ };
105
+ socket.on('open', () => {
106
+ socket.send(JSON.stringify({
107
+ command: commands['Add Tenants'],
108
+ includeChildTenants: includeChildTenants,
109
+ clientSecret: credentials.clientSecret,
110
+ accessTokens: [`Bearer ${credentials.token}`],
111
+ }));
112
+ const data = JSON.stringify({
113
+ command: commands['Add Topics'],
114
+ topics: topicCollection.topics,
115
+ });
116
+ socket.send(data);
117
+ socket.send(JSON.stringify({
118
+ command: commands['Subscribe'],
119
+ }));
120
+ });
121
+ socket.on('message', (data) => {
122
+ const message = JSON.parse(data);
123
+ if (Object.values(commands).includes(message.response)) {
124
+ if (message.result != 'ok') {
125
+ this.emitError(new n8n_workflow_1.NodeOperationError(this.getNode(), `Unexpected response from Fortnox: ${JSON.stringify(message)}`));
126
+ }
127
+ }
128
+ else {
129
+ this.emit([this.helpers.returnJsonArray(message)]);
130
+ }
131
+ });
132
+ socket.on('error', (error) => {
133
+ this.emitError(new n8n_workflow_1.NodeOperationError(this.getNode(), 'Websocket Error: ' + error.message));
134
+ });
135
+ };
136
+ const closeFunction = async () => {
137
+ socket.close();
138
+ };
139
+ if (this.getMode() === 'manual') {
140
+ async function manualTriggerFunction() {
141
+ await startSocket();
142
+ }
143
+ return {
144
+ closeFunction,
145
+ manualTriggerFunction,
146
+ };
147
+ }
148
+ else {
149
+ await startSocket();
150
+ return { closeFunction };
151
+ }
152
+ }
153
+ }
154
+ exports.FortnoxTrigger = FortnoxTrigger;
155
+ //# sourceMappingURL=FortnoxTrigger.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FortnoxTrigger.node.js","sourceRoot":"","sources":["../../../nodes/fortnox/FortnoxTrigger.node.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ {
2
+ "node": "n8n-nodes-base.fortnoxTrigger",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Finance & Accounting"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://api.fortnox.se/developer/authorization"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://www.fortnox.se/developer/guides-and-good-to-know/websockets"
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,25 @@
1
+ import { INodeProperties, INodePropertyTypeOptions } from 'n8n-workflow';
2
+ export declare const FORTNOX_API_CREDENTIAL_KEY = "fortnoxApi";
3
+ export type ParameterTypes = 'string' | 'boolean' | 'number';
4
+ export type ParameterDefaultValueTypes = string | boolean | number;
5
+ export type ParameterDefinition = [
6
+ displayName: string,
7
+ name: string,
8
+ parameterType: ParameterTypes,
9
+ defaultValue: ParameterDefaultValueTypes,
10
+ typeOptions: INodePropertyTypeOptions
11
+ ];
12
+ export type OptionParameterDefinition = {
13
+ displayName: string;
14
+ name: string;
15
+ parameters: Array<[string, string]>;
16
+ };
17
+ export type CollectionParameterDefinition = {
18
+ displayName: string;
19
+ name: string;
20
+ parameters: ParameterDefinition[];
21
+ multipleValues: boolean;
22
+ };
23
+ export declare const createParameter: (displayName: string, name: string, parameterType: ParameterTypes, defaultValue: ParameterDefaultValueTypes, typeOptions: INodePropertyTypeOptions) => INodeProperties;
24
+ export declare function createOptionParameter(option: OptionParameterDefinition): INodeProperties;
25
+ export declare function createCollectionParameter(collection: CollectionParameterDefinition): INodeProperties;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCollectionParameter = exports.createOptionParameter = exports.createParameter = exports.FORTNOX_API_CREDENTIAL_KEY = void 0;
4
+ exports.FORTNOX_API_CREDENTIAL_KEY = 'fortnoxApi';
5
+ const createParameter = (displayName, name, parameterType, defaultValue, typeOptions) => ({
6
+ displayName: displayName,
7
+ name: name,
8
+ type: parameterType,
9
+ default: defaultValue,
10
+ typeOptions: typeOptions,
11
+ });
12
+ exports.createParameter = createParameter;
13
+ function createOptionParameter(option) {
14
+ const parameters = option.parameters.map(([parameterName, parameterValue]) => {
15
+ return {
16
+ name: parameterName,
17
+ value: parameterValue,
18
+ };
19
+ });
20
+ return {
21
+ displayName: option.displayName,
22
+ name: option.name,
23
+ type: 'options',
24
+ noDataExpression: true,
25
+ options: parameters,
26
+ default: parameters[0].value,
27
+ };
28
+ }
29
+ exports.createOptionParameter = createOptionParameter;
30
+ function createCollectionParameter(collection) {
31
+ const parameters = collection.parameters.map(([displayName, name, parameterType, defaultValue, typeOptions]) => (0, exports.createParameter)(displayName, name, parameterType, defaultValue, typeOptions));
32
+ return {
33
+ displayName: collection.displayName,
34
+ typeOptions: {
35
+ multipleValues: collection.multipleValues,
36
+ },
37
+ name: collection.name,
38
+ default: {},
39
+ type: 'collection',
40
+ options: parameters,
41
+ };
42
+ }
43
+ exports.createCollectionParameter = createCollectionParameter;
44
+ //# sourceMappingURL=commons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commons.js","sourceRoot":"","sources":["../../../nodes/fortnox/commons.ts"],"names":[],"mappings":";;;AAMa,QAAA,0BAA0B,GAAG,YAAY,CAAC;AA2BhD,MAAM,eAAe,GAAG,CAC3B,WAAmB,EACnB,IAAY,EACZ,aAA6B,EAC7B,YAAwC,EACxC,WAAqC,EACtB,EAAE,CAAC,CAAC;IACnB,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,YAAY;IACrB,WAAW,EAAE,WAAW;CAC3B,CAAC,CAAC;AAZU,QAAA,eAAe,mBAYzB;AAEH,SAAgB,qBAAqB,CACjC,MAAiC;IAEjC,MAAM,UAAU,GAA2B,MAAM,CAAC,UAAU,CAAC,GAAG,CAC5D,CAAC,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,EAAE;QAChC,OAAO;YACH,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,cAAc;SACxB,CAAC;IACN,CAAC,CACJ,CAAC;IAEF,OAAO;QACH,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK;KAC/B,CAAC;AACN,CAAC;AApBD,sDAoBC;AAED,SAAgB,yBAAyB,CACrC,UAAyC;IAEzC,MAAM,UAAU,GAAsB,UAAU,CAAC,UAAU,CAAC,GAAG,CAC3D,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,CAAC,EAAE,EAAE,CAC9D,IAAA,uBAAe,EACX,WAAW,EACX,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,WAAW,CACd,CACR,CAAC;IAEF,OAAO;QACH,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,WAAW,EAAE;YACT,cAAc,EAAE,UAAU,CAAC,cAAc;SAC5C;QACD,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,UAAU;KACtB,CAAC;AACN,CAAC;AAxBD,8DAwBC"}
@@ -0,0 +1,20 @@
1
+ import { IDataObject } from 'n8n-workflow';
2
+ export interface ErrorInformationModel {
3
+ code?: number;
4
+ Code?: number;
5
+ error?: number;
6
+ Error?: number;
7
+ message?: string;
8
+ Message?: string;
9
+ }
10
+ export interface ErrorResponseModel extends IDataObject {
11
+ ErrorInformation: ErrorInformationModel;
12
+ }
13
+ export interface MetaInformationModel {
14
+ '@TotalResources': number;
15
+ '@TotalPages': number;
16
+ '@CurrentPage': number;
17
+ }
18
+ export interface ResponseModel extends IDataObject {
19
+ MetaInformation: MetaInformationModel;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../nodes/fortnox/model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { INodeProperties } from 'n8n-workflow';
2
+ export declare const filterParameters: INodeProperties[];
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterParameters = void 0;
4
+ const commons_1 = require("../../commons");
5
+ const optionParametersDefinitions = [
6
+ {
7
+ displayName: 'Activity',
8
+ name: 'filter',
9
+ parameters: [
10
+ ['Active', 'active'],
11
+ ['Inactive', 'inactive'],
12
+ ],
13
+ },
14
+ ];
15
+ const parametersDefinitions = [
16
+ ['Customer Number', 'customernumber', 'string', '', {}],
17
+ ['Name', 'name', 'string', '', {}],
18
+ ['ZIP Code', 'zipcode', 'string', '', {}],
19
+ ['City', 'city', 'string', '', {}],
20
+ ['Email', 'email', 'string', '', {}],
21
+ ['Phone', 'phone', 'string', '', {}],
22
+ ['Organisation Number', 'organisationnumber', 'string', '', {}],
23
+ ['GLN', 'gln', 'string', '', {}],
24
+ ['GLN Delivery', 'glndelivery', 'string', '', {}],
25
+ ['Last Modified', 'lastmodified', 'string', '', {}],
26
+ ];
27
+ exports.filterParameters = [
28
+ ...optionParametersDefinitions.map((option) => (0, commons_1.createOptionParameter)(option)),
29
+ ...parametersDefinitions.map(([displayName, name, filterType, defaultValue, typeOptions]) => (0, commons_1.createParameter)(displayName, name, filterType, defaultValue, typeOptions)),
30
+ ];
31
+ //# sourceMappingURL=filterParameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterParameters.js","sourceRoot":"","sources":["../../../../../nodes/fortnox/resources/customers/filterParameters.ts"],"names":[],"mappings":";;;AACA,2CAKuB;AAEvB,MAAM,2BAA2B,GAAgC;IAC7D;QACI,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,CAAC,QAAQ,EAAE,QAAQ,CAAC;YACpB,CAAC,UAAU,EAAE,UAAU,CAAC;SAC3B;KACJ;CACJ,CAAC;AAEF,MAAM,qBAAqB,GAA0B;IACjD,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IACvD,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IAClC,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IAClC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IACpC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IACpC,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IAC/D,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IAChC,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IACjD,CAAC,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;CACtD,CAAC;AAEW,QAAA,gBAAgB,GAAsB;IAC/C,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1C,IAAA,+BAAqB,EAAC,MAAM,CAAC,CAChC;IACD,GAAG,qBAAqB,CAAC,GAAG,CACxB,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,CAAC,EAAE,EAAE,CAC3D,IAAA,yBAAe,EACX,WAAW,EACX,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,WAAW,CACd,CACR;CACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare const customerProperties: INodeProperties[];
3
+ export declare function customerOperations(this: IExecuteFunctions, { operation, i }: {
4
+ operation: string;
5
+ i: number;
6
+ }): Promise<{
7
+ success: false;
8
+ error: string;
9
+ status?: number | undefined;
10
+ metadata?: Record<string, unknown> | undefined;
11
+ } | {
12
+ success: true;
13
+ data: import("./model").CustomerResponse;
14
+ } | {
15
+ success: true;
16
+ data: import("./model").CustomersResponse;
17
+ } | {
18
+ success: true;
19
+ data: null;
20
+ } | null>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.customerOperations = exports.customerProperties = void 0;
27
+ const get = __importStar(require("./operations/get.operation"));
28
+ const getAll = __importStar(require("./operations/getAll.operation"));
29
+ const create = __importStar(require("./operations/create.operation"));
30
+ const update = __importStar(require("./operations/update.operation"));
31
+ const delete_ = __importStar(require("./operations/delete.operation"));
32
+ exports.customerProperties = [
33
+ {
34
+ displayName: 'Operation',
35
+ name: 'operation',
36
+ type: 'options',
37
+ noDataExpression: true,
38
+ displayOptions: {
39
+ show: {
40
+ resource: ['customer'],
41
+ },
42
+ },
43
+ options: [
44
+ get.description,
45
+ getAll.description,
46
+ create.description,
47
+ update.description,
48
+ delete_.description,
49
+ ],
50
+ default: 'getAll',
51
+ },
52
+ ...get.properties,
53
+ ...getAll.properties,
54
+ ...create.properties,
55
+ ...update.properties,
56
+ ...delete_.properties,
57
+ ];
58
+ async function customerOperations({ operation, i }) {
59
+ if (operation === 'get') {
60
+ return await get.execute.call(this, i);
61
+ }
62
+ else if (operation === 'getAll') {
63
+ return await getAll.execute.call(this, i);
64
+ }
65
+ else if (operation === 'create') {
66
+ return await create.execute.call(this, i);
67
+ }
68
+ else if (operation === 'update') {
69
+ return await update.execute.call(this, i);
70
+ }
71
+ else if (operation === 'delete') {
72
+ return await delete_.execute.call(this, i);
73
+ }
74
+ return null;
75
+ }
76
+ exports.customerOperations = customerOperations;
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/fortnox/resources/customers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,gEAAkD;AAClD,sEAAwD;AACxD,sEAAwD;AACxD,sEAAwD;AACxD,uEAAyD;AAE5C,QAAA,kBAAkB,GAAsB;IACjD;QACI,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAA8B;QACpC,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,QAAQ,EAAE,CAAC,UAAU,CAAC;aACzB;SACJ;QACD,OAAO,EAAE;YACL,GAAG,CAAC,WAAW;YACf,MAAM,CAAC,WAAW;YAClB,MAAM,CAAC,WAAW;YAClB,MAAM,CAAC,WAAW;YAClB,OAAO,CAAC,WAAW;SACtB;QACD,OAAO,EAAE,QAAQ;KACpB;IACD,GAAG,GAAG,CAAC,UAAU;IACjB,GAAG,MAAM,CAAC,UAAU;IACpB,GAAG,MAAM,CAAC,UAAU;IACpB,GAAG,MAAM,CAAC,UAAU;IACpB,GAAG,OAAO,CAAC,UAAU;CACxB,CAAC;AAEK,KAAK,UAAU,kBAAkB,CAEpC,EAAE,SAAS,EAAE,CAAC,EAAoC;IAElD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACtB,OAAO,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;SAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAjBD,gDAiBC"}
@@ -0,0 +1,99 @@
1
+ import { ResponseModel } from '../../model';
2
+ export interface CustomerBase {
3
+ '@url': string;
4
+ Address1: string | null;
5
+ Address2: string | null;
6
+ City: string | null;
7
+ CustomerNumber: number;
8
+ Email: string | null;
9
+ Name: string;
10
+ OrganisationNumber: string;
11
+ Phone: string | null;
12
+ ZipCode: number | string | null;
13
+ }
14
+ export type DeliveryType = 'PRINT' | 'EMAIL' | 'PRINTSERVICE';
15
+ export interface DefaultDeliveryTypes {
16
+ Invoice: DeliveryType;
17
+ Order: DeliveryType;
18
+ Offer: DeliveryType;
19
+ }
20
+ export interface DefaultTemplates {
21
+ Order: string | null;
22
+ Offer: string | null;
23
+ Invoice: string | null;
24
+ CashInvoice: string | null;
25
+ }
26
+ export interface CustomerDetails {
27
+ Address1: string | null;
28
+ Address2: string | null;
29
+ City: string | null;
30
+ Country: string | null;
31
+ Comments: string | null;
32
+ Currency: string;
33
+ CostCenter: string | null;
34
+ CountryCode: string | null;
35
+ Active: boolean;
36
+ CustomerNumber: string;
37
+ DefaultDeliveryTypes: DefaultDeliveryTypes;
38
+ DefaultTemplates: DefaultTemplates;
39
+ DeliveryAddress1: string | null;
40
+ DeliveryAddress2: string | null;
41
+ DeliveryCity: string | null;
42
+ DeliveryCountry: string | null;
43
+ DeliveryCountryCode: string | null;
44
+ DeliveryFax: string | null;
45
+ DeliveryName: string | null;
46
+ DeliveryPhone1: string | null;
47
+ DeliveryPhone2: string | null;
48
+ DeliveryZipCode: string | null;
49
+ Email: string | null;
50
+ EmailInvoice: string | null;
51
+ EmailInvoiceBCC: string | null;
52
+ EmailInvoiceCC: string | null;
53
+ EmailOffer: string | null;
54
+ EmailOfferBCC: string | null;
55
+ EmailOfferCC: string | null;
56
+ EmailOrder: string | null;
57
+ EmailOrderBCC: string | null;
58
+ EmailOrderCC: string | null;
59
+ ExternalReference: string | null;
60
+ Fax: string | null;
61
+ GLN: string | null;
62
+ GLNDelivery: string | null;
63
+ InvoiceAdministrationFee: number | null;
64
+ InvoiceDiscount: number | null;
65
+ InvoiceFreight: number | null;
66
+ InvoiceRemark: string | null;
67
+ Name: string;
68
+ OrganisationNumber: string;
69
+ OurReference: string | null;
70
+ Phone1: string | null;
71
+ Phone2: string | null;
72
+ PriceList: string | null;
73
+ Project: string | null;
74
+ SalesAccount: string | null;
75
+ ShowPriceVATIncluded: boolean;
76
+ TermsOfDelivery: string | null;
77
+ TermsOfPayment: string | null;
78
+ Type: 'PRIVATE' | 'COMPANY';
79
+ VATNumber: string | null;
80
+ VATType: 'SEVAT' | 'SEREVERSEDVAT' | 'EUREVERSEDVAT' | 'EUVAT' | 'EXPORT';
81
+ VisitingAddress: string | null;
82
+ VisitingCity: string | null;
83
+ VisitingCountry: string | null;
84
+ VisitingCountryCode: string | null;
85
+ VisitingZipCode: string | null;
86
+ WayOfDelivery: string | null;
87
+ WWW: string | null;
88
+ YourReference: string | null;
89
+ ZipCode: string | null;
90
+ }
91
+ export interface Customer extends CustomerDetails {
92
+ '@url': string;
93
+ }
94
+ export interface CustomersResponse extends ResponseModel {
95
+ Customers: CustomerBase[];
96
+ }
97
+ export interface CustomerResponse {
98
+ Customer: Customer;
99
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../../nodes/fortnox/resources/customers/model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ import { CustomerResponse } from '../model';
3
+ import { NodeResponse } from '../../../../nodeResponse';
4
+ export declare const description: {
5
+ name: string;
6
+ value: string;
7
+ description: string;
8
+ action: string;
9
+ };
10
+ export declare const createProperties: INodeProperties[];
11
+ export declare const properties: INodeProperties[];
12
+ export declare function execute(this: IExecuteFunctions, i: number): Promise<NodeResponse<CustomerResponse>>;