@limetech/n8n-nodes-lime 0.2.8 → 0.3.0

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 (88) 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/nodes/LimeCrm/resources/limeObject/operations/update.operation.js +1 -1
  14. package/dist/nodes/LimeCrm/resources/limeObject/operations/update.operation.js.map +1 -1
  15. package/dist/package.json +1 -1
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/docker-compose.yml +46 -0
  18. package/eslint.config.mjs +27 -0
  19. package/jest.config.js +11 -0
  20. package/nodes/fortnox/Fortnox.node.json +18 -0
  21. package/nodes/fortnox/Fortnox.node.ts +102 -0
  22. package/nodes/fortnox/FortnoxTrigger.node.json +18 -0
  23. package/nodes/fortnox/FortnoxTrigger.node.ts +196 -0
  24. package/nodes/fortnox/commons.ts +94 -0
  25. package/nodes/fortnox/fortnoxLogo.svg +15 -0
  26. package/nodes/fortnox/model.ts +25 -0
  27. package/nodes/fortnox/resources/customers/filterParameters.ts +47 -0
  28. package/nodes/fortnox/resources/customers/index.ts +57 -0
  29. package/nodes/fortnox/resources/customers/model.ts +107 -0
  30. package/nodes/fortnox/resources/customers/operations/create.operation.ts +303 -0
  31. package/nodes/fortnox/resources/customers/operations/delete.operation.ts +44 -0
  32. package/nodes/fortnox/resources/customers/operations/get.operation.ts +45 -0
  33. package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +80 -0
  34. package/nodes/fortnox/resources/customers/operations/update.operation.ts +278 -0
  35. package/nodes/fortnox/resources/customers/sortParameters.ts +32 -0
  36. package/nodes/fortnox/resources/invoice/filterParameters.ts +88 -0
  37. package/nodes/fortnox/resources/invoice/index.ts +51 -0
  38. package/nodes/fortnox/resources/invoice/invoiceParameters.ts +214 -0
  39. package/nodes/fortnox/resources/invoice/model.ts +160 -0
  40. package/nodes/fortnox/resources/invoice/operations/create.operation.ts +72 -0
  41. package/nodes/fortnox/resources/invoice/operations/get.operation.ts +45 -0
  42. package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +101 -0
  43. package/nodes/fortnox/resources/invoice/operations/update.operation.ts +74 -0
  44. package/nodes/fortnox/transport/errorCodes.ts +62 -0
  45. package/nodes/fortnox/transport/index.ts +98 -0
  46. package/nodes/lime-crm/LimeCrm.node.json +18 -0
  47. package/nodes/lime-crm/LimeCrmNode.node.ts +135 -0
  48. package/nodes/lime-crm/LimeCrmTrigger.node.ts +263 -0
  49. package/nodes/lime-crm/assets/lime-crm.svg +1 -0
  50. package/nodes/lime-crm/commons/constants.ts +9 -0
  51. package/nodes/lime-crm/commons/index.ts +9 -0
  52. package/nodes/lime-crm/commons/limetype.ts +11 -0
  53. package/nodes/lime-crm/commons/task.ts +55 -0
  54. package/nodes/lime-crm/commons/webhook.ts +50 -0
  55. package/nodes/lime-crm/methods/getEntitiesForErpSystem.ts +11 -0
  56. package/nodes/lime-crm/methods/getLimeTypeProperties.ts +27 -0
  57. package/nodes/lime-crm/methods/getLimeTypes.ts +23 -0
  58. package/nodes/lime-crm/methods/index.ts +3 -0
  59. package/nodes/lime-crm/resources/erpConnector/index.ts +43 -0
  60. package/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.ts +69 -0
  61. package/nodes/lime-crm/resources/erpConnector/operations/transform.operation.ts +274 -0
  62. package/nodes/lime-crm/resources/erpConnector/transform.ts +49 -0
  63. package/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.ts +18 -0
  64. package/nodes/lime-crm/resources/erpConnector/transformers/fortnox.ts +201 -0
  65. package/nodes/lime-crm/resources/erpConnector/transformers/index.ts +1 -0
  66. package/nodes/lime-crm/resources/limeObject/index.ts +64 -0
  67. package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +152 -0
  68. package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +55 -0
  69. package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +54 -0
  70. package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +99 -0
  71. package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +157 -0
  72. package/nodes/lime-crm/resources/limeType/index.ts +58 -0
  73. package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +42 -0
  74. package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +36 -0
  75. package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +18 -0
  76. package/nodes/lime-crm/transport/commons.ts +44 -0
  77. package/nodes/lime-crm/transport/erpConnector.ts +21 -0
  78. package/nodes/lime-crm/transport/index.ts +17 -0
  79. package/nodes/lime-crm/transport/limeobjects.ts +83 -0
  80. package/nodes/lime-crm/transport/limetypes.ts +68 -0
  81. package/nodes/lime-crm/transport/task.ts +32 -0
  82. package/nodes/lime-crm/transport/webhooks.ts +61 -0
  83. package/nodes/nodeResponse.ts +13 -0
  84. package/package.json +36 -16
  85. package/tests/fixtures/fortnox.ts +182 -0
  86. package/tests/transform.spec.ts +187 -0
  87. package/tsconfig.json +30 -0
  88. package/index.js +0 -3
@@ -0,0 +1,187 @@
1
+ import {
2
+ CustomLimeTypeNames,
3
+ CustomPropertiesNames,
4
+ SearchParameters,
5
+ transform,
6
+ } from '../nodes/lime-crm/resources/erpConnector/transform';
7
+
8
+ import { invoice } from './fixtures/fortnox';
9
+
10
+ describe('Fortnox transformer tests', () => {
11
+ it('should transform invoice for Fortnox', () => {
12
+ const searchParameters: SearchParameters = {};
13
+ const customLimeTipeNames: CustomLimeTypeNames = {};
14
+ const customPropertiesNames: CustomPropertiesNames = {};
15
+
16
+ const result = transform(
17
+ 'fortnox',
18
+ 'invoice',
19
+ invoice,
20
+ searchParameters,
21
+ customLimeTipeNames,
22
+ customPropertiesNames
23
+ );
24
+
25
+ expect(result).toStrictEqual([
26
+ {
27
+ _limetype: 'invoice',
28
+ _search: {},
29
+ company: {
30
+ _search: { create: false, property: 'erp_id', value: '3' },
31
+ },
32
+ coworker: {
33
+ _search: {
34
+ create: false,
35
+ property: 'name',
36
+ value: 'Aspen The Dog',
37
+ },
38
+ },
39
+ currency: 'SEK',
40
+ customer_reference: 'Miki',
41
+ customerid: '3',
42
+ invoice_balance: 1589,
43
+ invoice_date: '2025-08-13',
44
+ invoice_expires: '2025-09-12',
45
+ invoice_number: '1',
46
+ invoice_shredded: false,
47
+ invoice_sum: 1271,
48
+ invoice_total_sum: 1589,
49
+ invoice_type: 'INVOICE',
50
+ invoice_vat: 317.75,
51
+ paid: false,
52
+ paid_date: null,
53
+ },
54
+ {
55
+ _limetype: 'invoicerow',
56
+ _search: { create: true, property: 'rowid', value: 395 },
57
+ company: {
58
+ _search: { create: false, property: 'erp_id', value: '3' },
59
+ },
60
+ description: 'First article',
61
+ invoice: {
62
+ _search: {
63
+ create: false,
64
+ property: 'invoice_number',
65
+ value: '1',
66
+ },
67
+ },
68
+ item: '107',
69
+ row_margin: 100,
70
+ row_value: 500,
71
+ rowid: 395,
72
+ units: 5,
73
+ },
74
+ {
75
+ _limetype: 'invoicerow',
76
+ _search: { create: true, property: 'rowid', value: 396 },
77
+ company: {
78
+ _search: { create: false, property: 'erp_id', value: '3' },
79
+ },
80
+ description: 'Second article',
81
+ invoice: {
82
+ _search: {
83
+ create: false,
84
+ property: 'invoice_number',
85
+ value: '1',
86
+ },
87
+ },
88
+ item: '108',
89
+ row_margin: 100,
90
+ row_value: 738,
91
+ rowid: 396,
92
+ units: 6,
93
+ },
94
+ {
95
+ _limetype: 'invoicerow',
96
+ _search: { create: true, property: 'rowid', value: 397 },
97
+ company: {
98
+ _search: { create: false, property: 'erp_id', value: '3' },
99
+ },
100
+ description: 'Third article',
101
+ invoice: {
102
+ _search: {
103
+ create: false,
104
+ property: 'invoice_number',
105
+ value: '1',
106
+ },
107
+ },
108
+ item: '109',
109
+ row_margin: 100,
110
+ row_value: 33,
111
+ rowid: 397,
112
+ units: 3,
113
+ },
114
+ ]);
115
+ });
116
+
117
+ it('should transform invoice for Fortnox with search parameters', () => {
118
+ const searchParameters: SearchParameters = {
119
+ create: false,
120
+ property: 'invoice_number',
121
+ value: '2137',
122
+ };
123
+ const customLimeTipeNames: CustomLimeTypeNames = {};
124
+ const customPropertiesNames: CustomPropertiesNames = {};
125
+
126
+ const result = transform(
127
+ 'fortnox',
128
+ 'invoice',
129
+ invoice,
130
+ searchParameters,
131
+ customLimeTipeNames,
132
+ customPropertiesNames
133
+ );
134
+
135
+ expect(result[0]['_search']).toStrictEqual({
136
+ create: false,
137
+ property: 'invoice_number',
138
+ value: '2137',
139
+ });
140
+ });
141
+
142
+ it('should transform invoice for Fortnox with custom limeType names', () => {
143
+ const searchParameters: SearchParameters = {};
144
+ const customLimeTipeNames: CustomLimeTypeNames = {
145
+ invoice: 'document',
146
+ invoicerow: 'documentrow',
147
+ };
148
+ const customPropertiesNames: CustomPropertiesNames = {};
149
+
150
+ const result = transform(
151
+ 'fortnox',
152
+ 'invoice',
153
+ invoice,
154
+ searchParameters,
155
+ customLimeTipeNames,
156
+ customPropertiesNames
157
+ );
158
+
159
+ expect(result[0]['_limetype']).toEqual('document');
160
+ expect(result[1]['_limetype']).toEqual('documentrow');
161
+ expect(result[2]['_limetype']).toEqual('documentrow');
162
+ expect(result[3]['_limetype']).toEqual('documentrow');
163
+ });
164
+
165
+ it('should transform invoice for Fortnox with custom properties names', () => {
166
+ const searchParameters: SearchParameters = {};
167
+ const customLimeTipeNames: CustomLimeTypeNames = {};
168
+ const customPropertiesNames: CustomPropertiesNames = {
169
+ invoice: { paid: 'is_paid' },
170
+ invoicerow: { row_value: 'value' },
171
+ };
172
+
173
+ const result = transform(
174
+ 'fortnox',
175
+ 'invoice',
176
+ invoice,
177
+ searchParameters,
178
+ customLimeTipeNames,
179
+ customPropertiesNames
180
+ );
181
+
182
+ expect(result[0]).toHaveProperty('is_paid');
183
+ expect(result[1]).toHaveProperty('value');
184
+ expect(result[2]).toHaveProperty('value');
185
+ expect(result[3]).toHaveProperty('value');
186
+ });
187
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "target": "es2019",
7
+ "lib": ["es2019", "es2020", "es2022"],
8
+ "removeComments": true,
9
+ "useUnknownInCatchVariables": false,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "noImplicitAny": true,
12
+ "noImplicitReturns": true,
13
+ "noUnusedLocals": true,
14
+ "strictNullChecks": true,
15
+ "preserveConstEnums": true,
16
+ "esModuleInterop": true,
17
+ "resolveJsonModule": true,
18
+ "incremental": true,
19
+ "declaration": true,
20
+ "sourceMap": true,
21
+ "skipLibCheck": true,
22
+ "outDir": "./dist/"
23
+ },
24
+ "include": [
25
+ "credentials/**/*",
26
+ "nodes/**/*",
27
+ "nodes/**/*.json",
28
+ "package.json"
29
+ ]
30
+ }
package/index.js DELETED
@@ -1,3 +0,0 @@
1
- // This file should be removed as it's not used in the n8n example and may be causing issues
2
- // with the module loading mechanism of n8n.
3
- // Please delete this file.