@limetech/n8n-nodes-lime 2.5.2 → 2.5.4
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.
- package/.releaserc.json +1 -0
- package/CHANGELOG.md +14 -0
- package/dist/credentials/FortnoxApi.credentials.d.ts +9 -0
- package/dist/credentials/FortnoxApi.credentials.js +57 -0
- package/dist/credentials/FortnoxApi.credentials.js.map +1 -0
- package/dist/credentials/LimeCrmApi.credentials.d.ts +9 -0
- package/dist/credentials/LimeCrmApi.credentials.js +70 -0
- package/dist/credentials/LimeCrmApi.credentials.js.map +1 -0
- package/dist/credentials/index.d.ts +2 -0
- package/dist/credentials/index.js +19 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/nodes/errorHandling.d.ts +11 -0
- package/dist/nodes/errorHandling.js +20 -0
- package/dist/nodes/errorHandling.js.map +1 -0
- package/dist/nodes/fortnox/Fortnox.node.d.ts +5 -0
- package/dist/nodes/fortnox/Fortnox.node.js +95 -0
- package/dist/nodes/fortnox/Fortnox.node.js.map +1 -0
- package/dist/nodes/fortnox/Fortnox.node.json +18 -0
- package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +5 -0
- package/dist/nodes/fortnox/FortnoxTrigger.node.js +155 -0
- package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +1 -0
- package/dist/nodes/fortnox/FortnoxTrigger.node.json +18 -0
- package/dist/nodes/fortnox/commons.d.ts +25 -0
- package/dist/nodes/fortnox/commons.js +44 -0
- package/dist/nodes/fortnox/commons.js.map +1 -0
- package/dist/nodes/fortnox/fortnoxLogo.svg +15 -0
- package/dist/nodes/fortnox/index.d.ts +6 -0
- package/dist/nodes/fortnox/index.js +23 -0
- package/dist/nodes/fortnox/index.js.map +1 -0
- package/dist/nodes/fortnox/model.d.ts +20 -0
- package/dist/nodes/fortnox/model.js +3 -0
- package/dist/nodes/fortnox/model.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +2 -0
- package/dist/nodes/fortnox/resources/customers/filterParameters.js +31 -0
- package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/index.d.ts +7 -0
- package/dist/nodes/fortnox/resources/customers/index.js +85 -0
- package/dist/nodes/fortnox/resources/customers/index.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/model.d.ts +99 -0
- package/dist/nodes/fortnox/resources/customers/model.js +3 -0
- package/dist/nodes/fortnox/resources/customers/model.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +281 -0
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +9 -0
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +38 -0
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +38 -0
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +68 -0
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +5 -0
- package/dist/nodes/fortnox/resources/customers/operations/index.js +42 -0
- package/dist/nodes/fortnox/resources/customers/operations/index.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +261 -0
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +2 -0
- package/dist/nodes/fortnox/resources/customers/sortParameters.js +30 -0
- package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +2 -0
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js +72 -0
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/index.d.ts +7 -0
- package/dist/nodes/fortnox/resources/invoice/index.js +81 -0
- package/dist/nodes/fortnox/resources/invoice/index.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +2 -0
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +193 -0
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/model.d.ts +147 -0
- package/dist/nodes/fortnox/resources/invoice/model.js +3 -0
- package/dist/nodes/fortnox/resources/invoice/model.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +64 -0
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +37 -0
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +92 -0
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +4 -0
- package/dist/nodes/fortnox/resources/invoice/operations/index.js +41 -0
- package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +1 -0
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +10 -0
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +64 -0
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +1 -0
- package/dist/nodes/fortnox/transport/errorCodes.d.ts +1 -0
- package/dist/nodes/fortnox/transport/errorCodes.js +50 -0
- package/dist/nodes/fortnox/transport/errorCodes.js.map +1 -0
- package/dist/nodes/fortnox/transport/index.d.ts +3 -0
- package/dist/nodes/fortnox/transport/index.js +76 -0
- package/dist/nodes/fortnox/transport/index.js.map +1 -0
- package/dist/nodes/index.d.ts +4 -0
- package/dist/nodes/index.js +21 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrm.node.json +18 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +19 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js +122 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.d.ts +18 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +215 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +1 -0
- package/dist/nodes/lime-crm/assets/lime-crm.svg +1 -0
- package/dist/nodes/lime-crm/index.d.ts +9 -0
- package/dist/nodes/lime-crm/index.js +26 -0
- package/dist/nodes/lime-crm/index.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimetypeProperties.d.ts +5 -0
- package/dist/nodes/lime-crm/methods/getLimetypeProperties.js +47 -0
- package/dist/nodes/lime-crm/methods/getLimetypeProperties.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimetypes.d.ts +2 -0
- package/dist/nodes/lime-crm/methods/getLimetypes.js +20 -0
- package/dist/nodes/lime-crm/methods/getLimetypes.js.map +1 -0
- package/dist/nodes/lime-crm/methods/index.d.ts +3 -0
- package/dist/nodes/lime-crm/methods/index.js +15 -0
- package/dist/nodes/lime-crm/methods/index.js.map +1 -0
- package/dist/nodes/lime-crm/methods/resourceMapping.d.ts +4 -0
- package/dist/nodes/lime-crm/methods/resourceMapping.js +71 -0
- package/dist/nodes/lime-crm/methods/resourceMapping.js.map +1 -0
- package/dist/nodes/lime-crm/models/constants.d.ts +9 -0
- package/dist/nodes/lime-crm/models/constants.js +10 -0
- package/dist/nodes/lime-crm/models/constants.js.map +1 -0
- package/dist/nodes/lime-crm/models/index.d.ts +6 -0
- package/dist/nodes/lime-crm/models/index.js +13 -0
- package/dist/nodes/lime-crm/models/index.js.map +1 -0
- package/dist/nodes/lime-crm/models/limeobject.d.ts +4 -0
- package/dist/nodes/lime-crm/models/limeobject.js +3 -0
- package/dist/nodes/lime-crm/models/limeobject.js.map +1 -0
- package/dist/nodes/lime-crm/models/limetype.d.ts +24 -0
- package/dist/nodes/lime-crm/models/limetype.js +3 -0
- package/dist/nodes/lime-crm/models/limetype.js.map +1 -0
- package/dist/nodes/lime-crm/models/propertyTypes.d.ts +4 -0
- package/dist/nodes/lime-crm/models/propertyTypes.js +5 -0
- package/dist/nodes/lime-crm/models/propertyTypes.js.map +1 -0
- package/dist/nodes/lime-crm/models/users.d.ts +13 -0
- package/dist/nodes/lime-crm/models/users.js +3 -0
- package/dist/nodes/lime-crm/models/users.js.map +1 -0
- package/dist/nodes/lime-crm/models/webhook.d.ts +18 -0
- package/dist/nodes/lime-crm/models/webhook.js +3 -0
- package/dist/nodes/lime-crm/models/webhook.js.map +1 -0
- package/dist/nodes/lime-crm/resources/admin/index.d.ts +7 -0
- package/dist/nodes/lime-crm/resources/admin/index.js +89 -0
- package/dist/nodes/lime-crm/resources/admin/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.js +123 -0
- package/dist/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.js +87 -0
- package/dist/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/admin/operations/index.d.ts +2 -0
- package/dist/nodes/lime-crm/resources/admin/operations/index.js +39 -0
- package/dist/nodes/lime-crm/resources/admin/operations/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/index.d.ts +7 -0
- package/dist/nodes/lime-crm/resources/data/index.js +108 -0
- package/dist/nodes/lime-crm/resources/data/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/operations/createSingleObject.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/data/operations/createSingleObject.operation.js +124 -0
- package/dist/nodes/lime-crm/resources/data/operations/createSingleObject.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.d.ts +10 -0
- package/dist/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.js +52 -0
- package/dist/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/operations/getManyObjects.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/data/operations/getManyObjects.operation.js +299 -0
- package/dist/nodes/lime-crm/resources/data/operations/getManyObjects.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/operations/getSingleFile.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/data/operations/getSingleFile.operation.js +125 -0
- package/dist/nodes/lime-crm/resources/data/operations/getSingleFile.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/operations/getSingleObject.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/data/operations/getSingleObject.operation.js +79 -0
- package/dist/nodes/lime-crm/resources/data/operations/getSingleObject.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/operations/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/data/operations/index.js +43 -0
- package/dist/nodes/lime-crm/resources/data/operations/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.js +146 -0
- package/dist/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/metadata/index.d.ts +7 -0
- package/dist/nodes/lime-crm/resources/metadata/index.js +93 -0
- package/dist/nodes/lime-crm/resources/metadata/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.d.ts +10 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.js +16 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.js +113 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.d.ts +11 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.js +37 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/index.d.ts +3 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/index.js +40 -0
- package/dist/nodes/lime-crm/resources/metadata/operations/index.js.map +1 -0
- package/dist/nodes/lime-crm/transport/commons.d.ts +14 -0
- package/dist/nodes/lime-crm/transport/commons.js +52 -0
- package/dist/nodes/lime-crm/transport/commons.js.map +1 -0
- package/dist/nodes/lime-crm/transport/files.d.ts +26 -0
- package/dist/nodes/lime-crm/transport/files.js +96 -0
- package/dist/nodes/lime-crm/transport/files.js.map +1 -0
- package/dist/nodes/lime-crm/transport/index.d.ts +7 -0
- package/dist/nodes/lime-crm/transport/index.js +32 -0
- package/dist/nodes/lime-crm/transport/index.js.map +1 -0
- package/dist/nodes/lime-crm/transport/limeQuery.d.ts +10 -0
- package/dist/nodes/lime-crm/transport/limeQuery.js +18 -0
- package/dist/nodes/lime-crm/transport/limeQuery.js.map +1 -0
- package/dist/nodes/lime-crm/transport/limeobjects.d.ts +16 -0
- package/dist/nodes/lime-crm/transport/limeobjects.js +76 -0
- package/dist/nodes/lime-crm/transport/limeobjects.js.map +1 -0
- package/dist/nodes/lime-crm/transport/limetypes.d.ts +33 -0
- package/dist/nodes/lime-crm/transport/limetypes.js +85 -0
- package/dist/nodes/lime-crm/transport/limetypes.js.map +1 -0
- package/dist/nodes/lime-crm/transport/users.d.ts +6 -0
- package/dist/nodes/lime-crm/transport/users.js +159 -0
- package/dist/nodes/lime-crm/transport/users.js.map +1 -0
- package/dist/nodes/lime-crm/transport/webhooks.d.ts +14 -0
- package/dist/nodes/lime-crm/transport/webhooks.js +51 -0
- package/dist/nodes/lime-crm/transport/webhooks.js.map +1 -0
- package/dist/nodes/lime-crm/utils/files.d.ts +8 -0
- package/dist/nodes/lime-crm/utils/files.js +103 -0
- package/dist/nodes/lime-crm/utils/files.js.map +1 -0
- package/dist/nodes/lime-crm/utils/hmac.d.ts +1 -0
- package/dist/nodes/lime-crm/utils/hmac.js +11 -0
- package/dist/nodes/lime-crm/utils/hmac.js.map +1 -0
- package/dist/nodes/lime-crm/utils/index.d.ts +4 -0
- package/dist/nodes/lime-crm/utils/index.js +16 -0
- package/dist/nodes/lime-crm/utils/index.js.map +1 -0
- package/dist/nodes/lime-crm/utils/webhook.d.ts +2 -0
- package/dist/nodes/lime-crm/utils/webhook.js +34 -0
- package/dist/nodes/lime-crm/utils/webhook.js.map +1 -0
- package/dist/nodes/modules.d.ts +12 -0
- package/dist/nodes/modules.js +16 -0
- package/dist/nodes/modules.js.map +1 -0
- package/dist/nodes/response.d.ts +18 -0
- package/dist/nodes/response.js +3 -0
- package/dist/nodes/response.js.map +1 -0
- package/dist/package.json +70 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -2
package/.releaserc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.5.4](https://github.com/Lundalogik/lime-n8n/compare/v2.5.3...v2.5.4) (2026-01-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* release script ([03ffcb3](https://github.com/Lundalogik/lime-n8n/commit/03ffcb3dbf8f15c4399724a3a8621a8b56558636))
|
|
7
|
+
|
|
8
|
+
## [2.5.3](https://github.com/Lundalogik/lime-n8n/compare/v2.5.2...v2.5.3) (2026-01-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* change licence ([e5cc048](https://github.com/Lundalogik/lime-n8n/commit/e5cc048c5a0e78b17d01a4cf3ec8b94461f00519))
|
|
14
|
+
|
|
1
15
|
## [2.5.2](https://github.com/Lundalogik/lime-n8n/compare/v2.5.1...v2.5.2) (2026-01-08)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICredentialType, INodeProperties, IAuthenticate, ICredentialTestRequest } from 'n8n-workflow';
|
|
2
|
+
export declare class FortnoxApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticate;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FortnoxApi = void 0;
|
|
4
|
+
const commons_1 = require("../nodes/fortnox/commons");
|
|
5
|
+
const transport_1 = require("../nodes/fortnox/transport");
|
|
6
|
+
class FortnoxApi {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.name = commons_1.FORTNOX_API_CREDENTIAL_KEY;
|
|
9
|
+
this.displayName = 'Fortnox API';
|
|
10
|
+
this.documentationUrl = 'https://www.fortnox.se/developer';
|
|
11
|
+
this.properties = [
|
|
12
|
+
{
|
|
13
|
+
displayName: 'Token',
|
|
14
|
+
name: 'token',
|
|
15
|
+
type: 'string',
|
|
16
|
+
typeOptions: {
|
|
17
|
+
password: true,
|
|
18
|
+
},
|
|
19
|
+
default: '',
|
|
20
|
+
required: true,
|
|
21
|
+
description: 'Token for authentication with the Fortnox API',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
displayName: 'Client Secret',
|
|
25
|
+
name: 'clientSecret',
|
|
26
|
+
type: 'string',
|
|
27
|
+
typeOptions: {
|
|
28
|
+
password: true,
|
|
29
|
+
},
|
|
30
|
+
default: '',
|
|
31
|
+
description: 'Unique key provided when you register your Fortnox integration',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
this.authenticate = {
|
|
35
|
+
type: 'generic',
|
|
36
|
+
properties: {
|
|
37
|
+
headers: {
|
|
38
|
+
Authorization: '=Bearer {{$credentials.token}}',
|
|
39
|
+
Accept: 'application/json',
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
this.test = {
|
|
45
|
+
request: {
|
|
46
|
+
baseURL: transport_1.FORTNOX_BASE_URL,
|
|
47
|
+
url: 'invoices',
|
|
48
|
+
method: 'GET',
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: '=Bearer {{$credentials.token}}',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.FortnoxApi = FortnoxApi;
|
|
57
|
+
//# sourceMappingURL=FortnoxApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FortnoxApi.credentials.js","sourceRoot":"","sources":["../../credentials/FortnoxApi.credentials.ts"],"names":[],"mappings":";;;AAOA,sDAAsE;AACtE,0DAA8D;AAE9D,MAAa,UAAU;IAAvB;QACI,SAAI,GAAG,oCAA0B,CAAC;QAClC,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,kCAAkC,CAAC;QACtD,eAAU,GAAsB;YAC5B;gBACI,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACT,QAAQ,EAAE,IAAI;iBACjB;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,+CAA+C;aAC/D;YACD;gBACI,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACT,QAAQ,EAAE,IAAI;iBACjB;gBACD,OAAO,EAAE,EAAE;gBACX,WAAW,EACP,gEAAgE;aACvE;SACJ,CAAC;QAEF,iBAAY,GAAkB;YAC1B,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACR,OAAO,EAAE;oBACL,aAAa,EAAE,gCAAgC;oBAC/C,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,kBAAkB;iBACrC;aACJ;SACJ,CAAC;QAEF,SAAI,GAA2B;YAC3B,OAAO,EAAE;gBACL,OAAO,EAAE,4BAAgB;gBACzB,GAAG,EAAE,UAAU;gBACf,MAAM,EAAE,KAA4B;gBACpC,OAAO,EAAE;oBACL,aAAa,EAAE,gCAAgC;iBAClD;aACJ;SACJ,CAAC;IACN,CAAC;CAAA;AAlDD,gCAkDC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICredentialType, INodeProperties, IAuthenticate, ICredentialTestRequest } from 'n8n-workflow';
|
|
2
|
+
export declare class LimeCrmApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticate;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.LimeCrmApi = void 0;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const nodes_1 = require("../nodes");
|
|
9
|
+
class LimeCrmApi {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.name = nodes_1.LIME_CRM_API_CREDENTIAL_KEY;
|
|
12
|
+
this.displayName = 'Lime CRM API';
|
|
13
|
+
this.documentationUrl = 'https://lime-crm.com/api-docs/';
|
|
14
|
+
this.properties = [
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Server URL',
|
|
17
|
+
name: 'url',
|
|
18
|
+
type: 'string',
|
|
19
|
+
default: '',
|
|
20
|
+
placeholder: 'https://instance.lime-crm.com/instance-name',
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'The URL of your Lime CRM instance',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
displayName: 'API Key',
|
|
26
|
+
name: 'apiKey',
|
|
27
|
+
type: 'string',
|
|
28
|
+
typeOptions: {
|
|
29
|
+
password: true,
|
|
30
|
+
},
|
|
31
|
+
default: '',
|
|
32
|
+
required: true,
|
|
33
|
+
description: 'The API key obtained from Lime CRM',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Webhook secret',
|
|
37
|
+
name: 'webhookSecret',
|
|
38
|
+
type: 'hidden',
|
|
39
|
+
typeOptions: {
|
|
40
|
+
password: true,
|
|
41
|
+
},
|
|
42
|
+
default: node_crypto_1.default.randomBytes(32).toString('hex'),
|
|
43
|
+
required: false,
|
|
44
|
+
description: 'A secret to authenticate webhook used in communication' +
|
|
45
|
+
'with Lime CRM',
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
this.authenticate = {
|
|
49
|
+
type: 'generic',
|
|
50
|
+
properties: {
|
|
51
|
+
headers: {
|
|
52
|
+
'X-API-Key': '={{$credentials.apiKey}}',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
this.test = {
|
|
57
|
+
request: {
|
|
58
|
+
baseURL: '={{$credentials.url}}'.replace('/+$', ''),
|
|
59
|
+
url: '/api/v1/',
|
|
60
|
+
method: 'GET',
|
|
61
|
+
headers: {
|
|
62
|
+
'X-API-Key': '={{$credentials.apiKey}}',
|
|
63
|
+
Accept: 'application/json',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.LimeCrmApi = LimeCrmApi;
|
|
70
|
+
//# sourceMappingURL=LimeCrmApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimeCrmApi.credentials.js","sourceRoot":"","sources":["../../credentials/LimeCrmApi.credentials.ts"],"names":[],"mappings":";;;;;;AAOA,8DAAiC;AAEjC,oCAAuD;AAuCvD,MAAa,UAAU;IAAvB;QACI,SAAI,GAAG,mCAA2B,CAAC;QACnC,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,gCAAgC,CAAC;QACpD,eAAU,GAAsB;YAC5B;gBACI,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,6CAA6C;gBAC1D,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,mCAAmC;aACnD;YACD;gBACI,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACT,QAAQ,EAAE,IAAI;iBACjB;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;aACpD;YACD;gBACI,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACT,QAAQ,EAAE,IAAI;iBACjB;gBACD,OAAO,EAAE,qBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAC/C,QAAQ,EAAE,KAAK;gBACf,WAAW,EACP,wDAAwD;oBACxD,eAAe;aACtB;SACJ,CAAC;QAEF,iBAAY,GAAkB;YAC1B,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACR,OAAO,EAAE;oBAEL,WAAW,EAAE,0BAA0B;iBAC1C;aACJ;SACJ,CAAC;QAEF,SAAI,GAA2B;YAC3B,OAAO,EAAE;gBACL,OAAO,EAAE,uBAAuB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;gBACnD,GAAG,EAAE,UAAU;gBACf,MAAM,EAAE,KAA4B;gBACpC,OAAO,EAAE;oBACL,WAAW,EAAE,0BAA0B;oBACvC,MAAM,EAAE,kBAAkB;iBAC7B;aACJ;SACJ,CAAC;IACN,CAAC;CAAA;AA7DD,gCA6DC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./LimeCrmApi.credentials"), exports);
|
|
18
|
+
__exportStar(require("./FortnoxApi.credentials"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../credentials/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,2DAAyC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IAllExecuteFunctions, JsonObject } from 'n8n-workflow';
|
|
2
|
+
export type WorkflowErrorContext = {
|
|
3
|
+
message: string;
|
|
4
|
+
} & JsonObject;
|
|
5
|
+
export type ErrorResponse = {
|
|
6
|
+
success: false;
|
|
7
|
+
data: {
|
|
8
|
+
error: WorkflowErrorContext;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function handleWorkflowError(nodeContext: IAllExecuteFunctions, errorContext: WorkflowErrorContext, isApiError?: boolean): ErrorResponse;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleWorkflowError = handleWorkflowError;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
function isIExecuteFunctions(nodeContext) {
|
|
6
|
+
return nodeContext.continueOnFail !== undefined;
|
|
7
|
+
}
|
|
8
|
+
function handleWorkflowError(nodeContext, errorContext, isApiError = false) {
|
|
9
|
+
if (isIExecuteFunctions(nodeContext) && nodeContext.continueOnFail()) {
|
|
10
|
+
return {
|
|
11
|
+
success: false,
|
|
12
|
+
data: { error: errorContext },
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
else if (isApiError) {
|
|
16
|
+
throw new n8n_workflow_1.NodeApiError(nodeContext.getNode(), errorContext);
|
|
17
|
+
}
|
|
18
|
+
throw new n8n_workflow_1.NodeOperationError(nodeContext.getNode(), errorContext.message);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=errorHandling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../nodes/errorHandling.ts"],"names":[],"mappings":";;AA6CA,kDAcC;AA3DD,+CAMsB;AAOtB,SAAS,mBAAmB,CACxB,WAAiC;IAEjC,OAAQ,WAAiC,CAAC,cAAc,KAAK,SAAS,CAAC;AAC3E,CAAC;AA4BD,SAAgB,mBAAmB,CAC/B,WAAiC,EACjC,YAAkC,EAClC,aAAsB,KAAK;IAE3B,IAAI,mBAAmB,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,cAAc,EAAE,EAAE,CAAC;QACnE,OAAO;YACH,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE;SAChC,CAAC;IACN,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACpB,MAAM,IAAI,2BAAY,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,IAAI,iCAAkB,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fortnox = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const invoice_1 = require("./resources/invoice");
|
|
6
|
+
const commons_1 = require("./commons");
|
|
7
|
+
const customers_1 = require("./resources/customers");
|
|
8
|
+
class Fortnox {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.description = {
|
|
11
|
+
displayName: 'Fortnox',
|
|
12
|
+
name: 'fortnox',
|
|
13
|
+
icon: 'file:fortnoxLogo.svg',
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: 1,
|
|
16
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
17
|
+
description: 'Consume the Fortnox API',
|
|
18
|
+
defaults: {
|
|
19
|
+
name: 'Fortnox',
|
|
20
|
+
},
|
|
21
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
22
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
23
|
+
credentials: [
|
|
24
|
+
{
|
|
25
|
+
name: commons_1.FORTNOX_API_CREDENTIAL_KEY,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
properties: [
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Resource',
|
|
32
|
+
name: 'resource',
|
|
33
|
+
type: 'options',
|
|
34
|
+
noDataExpression: true,
|
|
35
|
+
options: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Customer',
|
|
38
|
+
value: 'customer',
|
|
39
|
+
description: 'Work with customers',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Invoice',
|
|
43
|
+
value: 'invoice',
|
|
44
|
+
description: 'Work with invoices',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
default: 'customer',
|
|
48
|
+
},
|
|
49
|
+
...customers_1.customerProperties,
|
|
50
|
+
...invoice_1.invoiceProperties,
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async execute() {
|
|
55
|
+
const items = this.getInputData();
|
|
56
|
+
const returnData = [];
|
|
57
|
+
let responseData;
|
|
58
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
59
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
60
|
+
for (let i = 0; i < items.length; i++) {
|
|
61
|
+
if (resource === 'customer') {
|
|
62
|
+
responseData = await customers_1.customerOperations.call(this, {
|
|
63
|
+
operation,
|
|
64
|
+
i,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else if (resource === 'invoice') {
|
|
68
|
+
responseData = await invoice_1.invoiceOperations.call(this, {
|
|
69
|
+
operation,
|
|
70
|
+
i,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const errorLog = `The resource "${resource}" is not supported!`;
|
|
75
|
+
if (this.continueOnFail()) {
|
|
76
|
+
returnData.push({
|
|
77
|
+
error: errorLog,
|
|
78
|
+
json: { error: errorLog },
|
|
79
|
+
});
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), errorLog);
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(responseData)) {
|
|
85
|
+
returnData.push(...responseData);
|
|
86
|
+
}
|
|
87
|
+
else if (responseData !== undefined && responseData !== null) {
|
|
88
|
+
returnData.push(responseData);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return [this.helpers.returnJsonArray(returnData)];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.Fortnox = Fortnox;
|
|
95
|
+
//# sourceMappingURL=Fortnox.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fortnox.node.js","sourceRoot":"","sources":["../../../nodes/fortnox/Fortnox.node.ts"],"names":[],"mappings":";;;AAAA,+CAUsB;AAEtB,iDAA2E;AAC3E,uCAAuD;AACvD,qDAA+E;AAE/E,MAAa,OAAO;IAApB;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EACJ,8DAA8D;YAClE,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE;gBACN,IAAI,EAAE,SAAS;aAClB;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE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I,EAAE;oBAC9C,SAAS;oBACT,CAAC;iBACJ,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,MAAM,QAAQ,GAAG,iBAAiB,QAAQ,qBAAqB,CAAC;gBAChE,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBACxB,UAAU,CAAC,IAAI,CAAC;wBACZ,KAAK,EAAE,QAAQ;wBACf,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;qBAC5B,CAAC,CAAC;oBACH,SAAS;gBACb,CAAC;gBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC3D,CAAC;YAED,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC9B,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;YACrC,CAAC;iBAAM,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;gBAC7D,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAClC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAA2B,CAAC,CAAC,CAAC;IACvE,CAAC;CACJ;AArFD,0BAqFC"}
|
|
@@ -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,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: [n8n_workflow_1.NodeConnectionTypes.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":";;;;;;AAAA,+CAOsB;AACtB,4CAA2B;AAC3B,uCAAuD;AAWvD,MAAa,cAAc;IAA3B;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EACP,wFAAwF;gBACxF,gDAAgD;YACpD,QAAQ,EAAE;gBACN,IAAI,EAAE,iBAAiB;aAC1B;YACD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACT;oBACI,IAAI,EAAE,oCAA0B;oBAChC,QAAQ,EAAE,IAAI;iBACjB;aACJ;YACD,UAAU,EAAE;gBACR;oBACI,WAAW,EAAE,uBAAuB;oBACpC,IAAI,EAAE,qBAAqB;oBAC3B,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,KAAK;iBACjB;gBACD;oBACI,WAAW,EAAE,QAAQ;oBACrB,IAAI,EAAE,iBAAiB;oBACvB,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE;wBACT,cAAc,EAAE,IAAI;qBACvB;oBACD,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,YAAY;oBACzB,WAAW,EAAE,wBAAwB;oBACrC,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,QAAQ;4BACd,WAAW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C;gBACvD,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;gBAChC,IAAI,CAAC,SAAS,CACV,IAAI,iCAAkB,CAClB,IAAI,CAAC,OAAO,EAAE,EACd,mBAAmB,GAAG,KAAK,CAAC,OAAO,CACtC,CACJ,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAEF,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;YAC7B,MAAM,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC9B,KAAK,UAAU,qBAAqB;gBAChC,MAAM,WAAW,EAAE,CAAC;YACxB,CAAC;YACD,OAAO;gBACH,aAAa;gBACb,qBAAqB;aACxB,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,MAAM,WAAW,EAAE,CAAC;YACpB,OAAO,EAAE,aAAa,EAAE,CAAC;QAC7B,CAAC;IACL,CAAC;CACJ;AA/KD,wCA+KC"}
|
|
@@ -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.createParameter = exports.FORTNOX_API_CREDENTIAL_KEY = void 0;
|
|
4
|
+
exports.createOptionParameter = createOptionParameter;
|
|
5
|
+
exports.createCollectionParameter = createCollectionParameter;
|
|
6
|
+
exports.FORTNOX_API_CREDENTIAL_KEY = 'fortnoxApi';
|
|
7
|
+
const createParameter = (displayName, name, parameterType, defaultValue, typeOptions) => ({
|
|
8
|
+
displayName: displayName,
|
|
9
|
+
name: name,
|
|
10
|
+
type: parameterType,
|
|
11
|
+
default: defaultValue,
|
|
12
|
+
typeOptions: typeOptions,
|
|
13
|
+
});
|
|
14
|
+
exports.createParameter = createParameter;
|
|
15
|
+
function createOptionParameter(option) {
|
|
16
|
+
const parameters = option.parameters.map(([parameterName, parameterValue]) => {
|
|
17
|
+
return {
|
|
18
|
+
name: parameterName,
|
|
19
|
+
value: parameterValue,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
displayName: option.displayName,
|
|
24
|
+
name: option.name,
|
|
25
|
+
type: 'options',
|
|
26
|
+
noDataExpression: true,
|
|
27
|
+
options: parameters,
|
|
28
|
+
default: parameters[0].value,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function createCollectionParameter(collection) {
|
|
32
|
+
const parameters = collection.parameters.map(([displayName, name, parameterType, defaultValue, typeOptions]) => (0, exports.createParameter)(displayName, name, parameterType, defaultValue, typeOptions));
|
|
33
|
+
return {
|
|
34
|
+
displayName: collection.displayName,
|
|
35
|
+
typeOptions: {
|
|
36
|
+
multipleValues: collection.multipleValues,
|
|
37
|
+
},
|
|
38
|
+
name: collection.name,
|
|
39
|
+
default: {},
|
|
40
|
+
type: 'collection',
|
|
41
|
+
options: parameters,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=commons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commons.js","sourceRoot":"","sources":["../../../nodes/fortnox/commons.ts"],"names":[],"mappings":";;;AA+CA,sDAoBC;AAED,8DAwBC;AAvFY,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,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