@limetech/n8n-nodes-lime 0.2.9 → 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.
- package/.dockerignore +1 -0
- package/.github/workflows/lint.yml +21 -0
- package/.github/workflows/release.yml +82 -0
- package/.github/workflows/test-and-build.yml +47 -0
- package/.prettierignore +4 -0
- package/.prettierrc.mjs +1 -0
- package/.releaserc.json +34 -0
- package/CHANGELOG.md +74 -0
- package/Dockerfile +21 -0
- package/README.md +4 -0
- package/credentials/FortnoxApi.credentials.ts +61 -0
- package/credentials/LimeCrmApi.credentials.ts +60 -0
- package/docker-compose.yml +46 -0
- package/eslint.config.mjs +27 -0
- package/jest.config.js +11 -0
- package/nodes/fortnox/Fortnox.node.json +18 -0
- package/nodes/fortnox/Fortnox.node.ts +102 -0
- package/nodes/fortnox/FortnoxTrigger.node.json +18 -0
- package/nodes/fortnox/FortnoxTrigger.node.ts +196 -0
- package/nodes/fortnox/commons.ts +94 -0
- package/nodes/fortnox/fortnoxLogo.svg +15 -0
- package/nodes/fortnox/model.ts +25 -0
- package/nodes/fortnox/resources/customers/filterParameters.ts +47 -0
- package/nodes/fortnox/resources/customers/index.ts +57 -0
- package/nodes/fortnox/resources/customers/model.ts +107 -0
- package/nodes/fortnox/resources/customers/operations/create.operation.ts +303 -0
- package/nodes/fortnox/resources/customers/operations/delete.operation.ts +44 -0
- package/nodes/fortnox/resources/customers/operations/get.operation.ts +45 -0
- package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +80 -0
- package/nodes/fortnox/resources/customers/operations/update.operation.ts +278 -0
- package/nodes/fortnox/resources/customers/sortParameters.ts +32 -0
- package/nodes/fortnox/resources/invoice/filterParameters.ts +88 -0
- package/nodes/fortnox/resources/invoice/index.ts +51 -0
- package/nodes/fortnox/resources/invoice/invoiceParameters.ts +214 -0
- package/nodes/fortnox/resources/invoice/model.ts +160 -0
- package/nodes/fortnox/resources/invoice/operations/create.operation.ts +72 -0
- package/nodes/fortnox/resources/invoice/operations/get.operation.ts +45 -0
- package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +101 -0
- package/nodes/fortnox/resources/invoice/operations/update.operation.ts +74 -0
- package/nodes/fortnox/transport/errorCodes.ts +62 -0
- package/nodes/fortnox/transport/index.ts +98 -0
- package/nodes/lime-crm/LimeCrm.node.json +18 -0
- package/nodes/lime-crm/LimeCrmNode.node.ts +135 -0
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +263 -0
- package/nodes/lime-crm/assets/lime-crm.svg +1 -0
- package/nodes/lime-crm/commons/constants.ts +9 -0
- package/nodes/lime-crm/commons/index.ts +9 -0
- package/nodes/lime-crm/commons/limetype.ts +11 -0
- package/nodes/lime-crm/commons/task.ts +55 -0
- package/nodes/lime-crm/commons/webhook.ts +50 -0
- package/nodes/lime-crm/methods/getEntitiesForErpSystem.ts +11 -0
- package/nodes/lime-crm/methods/getLimeTypeProperties.ts +27 -0
- package/nodes/lime-crm/methods/getLimeTypes.ts +23 -0
- package/nodes/lime-crm/methods/index.ts +3 -0
- package/nodes/lime-crm/resources/erpConnector/index.ts +43 -0
- package/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.ts +69 -0
- package/nodes/lime-crm/resources/erpConnector/operations/transform.operation.ts +274 -0
- package/nodes/lime-crm/resources/erpConnector/transform.ts +49 -0
- package/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.ts +18 -0
- package/nodes/lime-crm/resources/erpConnector/transformers/fortnox.ts +201 -0
- package/nodes/lime-crm/resources/erpConnector/transformers/index.ts +1 -0
- package/nodes/lime-crm/resources/limeObject/index.ts +64 -0
- package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +152 -0
- package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +55 -0
- package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +54 -0
- package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +99 -0
- package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +157 -0
- package/nodes/lime-crm/resources/limeType/index.ts +58 -0
- package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +42 -0
- package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +36 -0
- package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +18 -0
- package/nodes/lime-crm/transport/commons.ts +44 -0
- package/nodes/lime-crm/transport/erpConnector.ts +21 -0
- package/nodes/lime-crm/transport/index.ts +17 -0
- package/nodes/lime-crm/transport/limeobjects.ts +83 -0
- package/nodes/lime-crm/transport/limetypes.ts +68 -0
- package/nodes/lime-crm/transport/task.ts +32 -0
- package/nodes/lime-crm/transport/webhooks.ts +61 -0
- package/nodes/nodeResponse.ts +13 -0
- package/package.json +36 -16
- package/tests/fixtures/fortnox.ts +182 -0
- package/tests/transform.spec.ts +187 -0
- package/tsconfig.json +30 -0
- package/index.js +0 -3
package/.dockerignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.git
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
|
+
with:
|
|
16
|
+
node-version: 21
|
|
17
|
+
- run: npm ci
|
|
18
|
+
- name: Run eslint
|
|
19
|
+
run: npm run lint
|
|
20
|
+
- name: Run prettier
|
|
21
|
+
run: npm run format
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Release and Push to ECR
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- dev
|
|
8
|
+
- '*[0-9].*[0-9].x'
|
|
9
|
+
- '*[0-9].x.x'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
name: Lime N8N Semantic Release
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
outputs:
|
|
16
|
+
version: ${{ steps.semantic_release.outputs.version }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v3
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: 21
|
|
23
|
+
|
|
24
|
+
- run: npm ci
|
|
25
|
+
|
|
26
|
+
- name: Semantic release
|
|
27
|
+
id: semantic_release
|
|
28
|
+
run: |
|
|
29
|
+
npx semantic-release
|
|
30
|
+
VERSION=$(cat VERSION)
|
|
31
|
+
echo "Successfully released version: $VERSION"
|
|
32
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
33
|
+
env:
|
|
34
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
35
|
+
|
|
36
|
+
push-to-ecr:
|
|
37
|
+
name: Push images to ECR
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
needs: release
|
|
40
|
+
permissions:
|
|
41
|
+
id-token: write
|
|
42
|
+
contents: read
|
|
43
|
+
steps:
|
|
44
|
+
- name: Checkout repository
|
|
45
|
+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
|
|
46
|
+
|
|
47
|
+
- name: Set up Docker Buildx
|
|
48
|
+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 #v3.11.1
|
|
49
|
+
|
|
50
|
+
- name: Configure AWS credentials
|
|
51
|
+
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a #v4.3.1
|
|
52
|
+
with:
|
|
53
|
+
role-to-assume: ${{ secrets.AWS_ECR_PUSH_ROLE_SHARED_ACCOUNT_ARN }}
|
|
54
|
+
role-session-name: GitHubActions-ECR-Push
|
|
55
|
+
aws-region: ${{ secrets.AWS_REGION_SHARED }}
|
|
56
|
+
|
|
57
|
+
- name: Login to Amazon ECR
|
|
58
|
+
id: login-ecr
|
|
59
|
+
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 #v2.0.1
|
|
60
|
+
|
|
61
|
+
- name: Create ECR repository if it does not exist
|
|
62
|
+
shell: bash
|
|
63
|
+
run: |
|
|
64
|
+
if [ -z "$(aws ecr describe-repositories --repository-names lime-cloud-n8n)" ]; then
|
|
65
|
+
aws ecr create-repository --repository-name lime-cloud-n8n
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
- name: Set environment variables
|
|
69
|
+
id: vars
|
|
70
|
+
run: |
|
|
71
|
+
echo "ECR_REPO=lime-cloud-n8n" >> $GITHUB_ENV
|
|
72
|
+
echo "ECR_URI=${{ steps.login-ecr.outputs.registry }}/lime-cloud-n8n" >> $GITHUB_ENV
|
|
73
|
+
echo "IMAGE_TAG=${{ needs.release.outputs.version }}" >> $GITHUB_ENV
|
|
74
|
+
|
|
75
|
+
- name: Build Docker image
|
|
76
|
+
run: |
|
|
77
|
+
docker build -t $ECR_URI:$IMAGE_TAG .
|
|
78
|
+
|
|
79
|
+
- name: Push Docker image to ECR
|
|
80
|
+
run: |
|
|
81
|
+
echo "Pushing image to: $ECR_URI:$IMAGE_TAG"
|
|
82
|
+
docker push $ECR_URI:$IMAGE_TAG
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Test and build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
name: Test build
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v3
|
|
19
|
+
|
|
20
|
+
- name: Set up Node.js
|
|
21
|
+
uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: 21
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm install
|
|
27
|
+
|
|
28
|
+
- name: Build the package
|
|
29
|
+
run: npm run build
|
|
30
|
+
|
|
31
|
+
- name: Run tests
|
|
32
|
+
run: npm run test
|
|
33
|
+
|
|
34
|
+
docker-build:
|
|
35
|
+
name: Build docker image
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
|
|
38
|
+
steps:
|
|
39
|
+
- name: Checkout code
|
|
40
|
+
uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- name: Set up Docker Buildx
|
|
43
|
+
uses: docker/setup-buildx-action@v3
|
|
44
|
+
|
|
45
|
+
- name: Test Docker build
|
|
46
|
+
run: |
|
|
47
|
+
docker build .
|
package/.prettierignore
ADDED
package/.prettierrc.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@limetech/eslint-config/prettier.config.js';
|
package/.releaserc.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": [
|
|
3
|
+
"main",
|
|
4
|
+
{
|
|
5
|
+
"name": "dev",
|
|
6
|
+
"prerelease": true
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"plugins": [
|
|
10
|
+
"@semantic-release/commit-analyzer",
|
|
11
|
+
"@semantic-release/release-notes-generator",
|
|
12
|
+
[
|
|
13
|
+
"@semantic-release/changelog",
|
|
14
|
+
{
|
|
15
|
+
"changelogFile": "CHANGELOG.md"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"@semantic-release/git",
|
|
20
|
+
{
|
|
21
|
+
"assets": ["package.json", "CHANGELOG.md"],
|
|
22
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
"@semantic-release/exec",
|
|
27
|
+
{
|
|
28
|
+
"successCmd": "echo v${nextRelease.version} > VERSION",
|
|
29
|
+
"__note": "DO NOT CHANGE - this command is used in Release action"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"@semantic-release/github"
|
|
33
|
+
]
|
|
34
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# [1.2.0](https://github.com/Lundalogik/lime-n8n/compare/v1.1.1...v1.2.0) (2025-09-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add missing trailing slash to the endpoint ([4a169af](https://github.com/Lundalogik/lime-n8n/commit/4a169afc5e65c28d972db1311906e61ed03a7bc6))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* implement error handling on node side ([e464ee3](https://github.com/Lundalogik/lime-n8n/commit/e464ee33de151ae795c34ea979c4fe4edb15129d))
|
|
12
|
+
|
|
13
|
+
## [1.1.1](https://github.com/Lundalogik/lime-n8n/compare/v1.1.0...v1.1.1) (2025-09-05)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* make push to ECR work ([7fd0194](https://github.com/Lundalogik/lime-n8n/commit/7fd0194ad4516a51df5c96b2eba626948fa3c48d))
|
|
19
|
+
|
|
20
|
+
# [1.1.0](https://github.com/Lundalogik/lime-n8n/compare/v1.0.0...v1.1.0) (2025-09-03)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* add Changelog.MD to prettierignore ([b8fe38d](https://github.com/Lundalogik/lime-n8n/commit/b8fe38d71d5f1232ac1fe3f1755c97abbf99490a))
|
|
26
|
+
* set up node version in lint action ([2a282c7](https://github.com/Lundalogik/lime-n8n/commit/2a282c765d0cd6af764d85fe18b71ac35f388664))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* add on-release action to push images to ECR ([a04f9f9](https://github.com/Lundalogik/lime-n8n/commit/a04f9f9ddc9b11d435c6366f03593183f4cde554))
|
|
32
|
+
* add on-release action to push images to ECR ([52d87ae](https://github.com/Lundalogik/lime-n8n/commit/52d87ae6b94ddea331c3d8f64776b1eeaf29b9fd))
|
|
33
|
+
|
|
34
|
+
# 1.0.0 (2025-09-02)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* added org name ([e8bacbd](https://github.com/Lundalogik/lime-n8n/commit/e8bacbd7fd1637590391d6b5626d5b2e66e90a8c))
|
|
40
|
+
* enhance docker setup ([5b273d3](https://github.com/Lundalogik/lime-n8n/commit/5b273d3e882c259925d8965ef025ba04d87f0483))
|
|
41
|
+
* fix a bug in search ([f9e0d97](https://github.com/Lundalogik/lime-n8n/commit/f9e0d970f5da41bd5e00c25c926a91a131b93c84))
|
|
42
|
+
* **fortnox:** change icon name ([a7174f0](https://github.com/Lundalogik/lime-n8n/commit/a7174f09009905be7f3a352f3d7c6ce0c414dff4))
|
|
43
|
+
* **fortnox:** change InvoiceType field to enum ([abe3e81](https://github.com/Lundalogik/lime-n8n/commit/abe3e81bab6401cdbc95b8efd39cd1d112c0355a))
|
|
44
|
+
* **fortnox:** emit event related messages only ([0844541](https://github.com/Lundalogik/lime-n8n/commit/0844541b88dd1785bac4c7e6ad4c64b8eb8a48e9))
|
|
45
|
+
* **fortnox:** handle Websocket messages correctly ([8538ad5](https://github.com/Lundalogik/lime-n8n/commit/8538ad5e92251ce25ba1cfa193ba1ba60546d2ea))
|
|
46
|
+
* paths ([fcd9929](https://github.com/Lundalogik/lime-n8n/commit/fcd99298682693f5cd014ddb852797ca99f4aae0))
|
|
47
|
+
* remove console.logs ([f11af06](https://github.com/Lundalogik/lime-n8n/commit/f11af06f1eb90f817177c106a66c2d8ad817722d))
|
|
48
|
+
* remove redundant lint step in CI ([876e3ea](https://github.com/Lundalogik/lime-n8n/commit/876e3ea825e1c83ad1a117dfca131230b0351302))
|
|
49
|
+
* token ([d9d6c82](https://github.com/Lundalogik/lime-n8n/commit/d9d6c82bea9a4a840eb37f203c684b491fb15b62))
|
|
50
|
+
* trailing slash... ([305b739](https://github.com/Lundalogik/lime-n8n/commit/305b7392138dae2f3f86935fed22de7467b55521))
|
|
51
|
+
* **transport:** add missing slash to the endpoint ([cd24688](https://github.com/Lundalogik/lime-n8n/commit/cd2468800192d5baf00373b3e698db7d970d7f45))
|
|
52
|
+
* **transport:** add missing trailing slash ([55b1582](https://github.com/Lundalogik/lime-n8n/commit/55b15825ef4bac0f9665b847c4c00214d31dde6d))
|
|
53
|
+
* **transport:** remove additional slash in limeobject search url ([35b2dd8](https://github.com/Lundalogik/lime-n8n/commit/35b2dd8b9eb59c15fb9eb696b152caec648bf114))
|
|
54
|
+
* typo ([bf74c1e](https://github.com/Lundalogik/lime-n8n/commit/bf74c1ecc4d22ab9f4780a8558cc81c828d516da))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* add `CreateOrUpdateObjects` node ([796aba5](https://github.com/Lundalogik/lime-n8n/commit/796aba5a389178d5aa61c44a718a05a57da04cd5))
|
|
60
|
+
* add data transformation layer between ERP and Lime CRM ([368ad79](https://github.com/Lundalogik/lime-n8n/commit/368ad792867b868d3617fa8573f58b332f2d0334))
|
|
61
|
+
* add Fortnox trigger ([492f515](https://github.com/Lundalogik/lime-n8n/commit/492f515787eee6db5ff8bc0517c8d805a906f657))
|
|
62
|
+
* add jest ([8583608](https://github.com/Lundalogik/lime-n8n/commit/85836086f28dbd75db44b6d6f129c5b959e4e500))
|
|
63
|
+
* add release action ([a56ed4f](https://github.com/Lundalogik/lime-n8n/commit/a56ed4f6455f385bbbb041b5cea1e3dbcd199878))
|
|
64
|
+
* add tsc watcher container ([9ec5c70](https://github.com/Lundalogik/lime-n8n/commit/9ec5c70f2bdbb9ebc662e676cc8d867bb5d9fb48))
|
|
65
|
+
* enable publishing ([ba2f45a](https://github.com/Lundalogik/lime-n8n/commit/ba2f45a7299985d77aecc687aedf908b9f149548))
|
|
66
|
+
* **fortnox:** add fortnox node and customer operations ([3a9316b](https://github.com/Lundalogik/lime-n8n/commit/3a9316b291cb63f36149db8b29160c979aceac25))
|
|
67
|
+
* **fortnox:** add invoice nodes for Fortnox ([df58077](https://github.com/Lundalogik/lime-n8n/commit/df58077472ea5634283af75c3217d7308a327a89))
|
|
68
|
+
* handle nested objects transformation ([5cf450f](https://github.com/Lundalogik/lime-n8n/commit/5cf450f0884fc4745d7c10dc3e19a0af609f85d3))
|
|
69
|
+
* **lime-crm:** add LimeCrm and LimeCrmTrigger node configurations ([b655f59](https://github.com/Lundalogik/lime-n8n/commit/b655f591b97bfab135a09c1923b389330bac6688))
|
|
70
|
+
* **lime-crm:** enhance Lime type properties and types retrieval with embedded API data ([da5d57a](https://github.com/Lundalogik/lime-n8n/commit/da5d57ad8766098a382b2fbebed48e15fa95aefb))
|
|
71
|
+
* **lime-crm:** implement Lime CRM object operations and API request handling ([c2ae9cb](https://github.com/Lundalogik/lime-n8n/commit/c2ae9cb49f5c50f9b80ba232ea715c9266b5cf2f))
|
|
72
|
+
* **lime-crm:** remove LimeCrmApi.credentials and update node structure ([4c85a87](https://github.com/Lundalogik/lime-n8n/commit/4c85a8711e508a74316b3e36415034f2e87debb8))
|
|
73
|
+
* **lime-go:** add Lime Go API integration and remove unused Lime CRM files ([cb6292c](https://github.com/Lundalogik/lime-n8n/commit/cb6292c4651b25330c85495ffde53760f99fa480))
|
|
74
|
+
* prevent webhook duplication ([2f7241e](https://github.com/Lundalogik/lime-n8n/commit/2f7241e1781065a2d1ff00f0224e4da95dccaac5))
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ----------- Stage 1: Build -----------
|
|
2
|
+
FROM node:18 AS builder
|
|
3
|
+
|
|
4
|
+
RUN mkdir /source
|
|
5
|
+
WORKDIR /source
|
|
6
|
+
COPY . .
|
|
7
|
+
RUN npm install -g typescript@5.3.2
|
|
8
|
+
RUN npm install --include=dev
|
|
9
|
+
RUN npm run build
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# ----------- Stage 2: Production -----------
|
|
13
|
+
FROM n8nio/n8n
|
|
14
|
+
|
|
15
|
+
ENV N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom
|
|
16
|
+
|
|
17
|
+
USER root
|
|
18
|
+
COPY --from=builder /source/dist ${N8N_CUSTOM_EXTENSIONS}
|
|
19
|
+
|
|
20
|
+
USER node
|
|
21
|
+
WORKDIR /home/node
|
package/README.md
CHANGED
|
@@ -8,16 +8,20 @@ This repository contains configuration to run n8n locally using Docker.
|
|
|
8
8
|
- Docker Compose
|
|
9
9
|
|
|
10
10
|
## Getting Started
|
|
11
|
+
|
|
11
12
|
1. Build nodes
|
|
13
|
+
|
|
12
14
|
```bash
|
|
13
15
|
npm i
|
|
14
16
|
npm run build
|
|
15
17
|
```
|
|
18
|
+
|
|
16
19
|
2. Start n8n and PostgreSQL:
|
|
17
20
|
|
|
18
21
|
```bash
|
|
19
22
|
docker-compose up -d
|
|
20
23
|
```
|
|
24
|
+
|
|
21
25
|
3. Access n8n in your browser at: http://localhost:5678
|
|
22
26
|
|
|
23
27
|
4. To stop the containers:
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ICredentialType,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
IHttpRequestMethods,
|
|
5
|
+
IAuthenticate,
|
|
6
|
+
ICredentialTestRequest,
|
|
7
|
+
} from 'n8n-workflow';
|
|
8
|
+
import { FORTNOX_API_CREDENTIAL_KEY } from '../nodes/fortnox/commons';
|
|
9
|
+
import { FORTNOX_BASE_URL } from '../nodes/fortnox/transport';
|
|
10
|
+
|
|
11
|
+
export class FortnoxApi implements ICredentialType {
|
|
12
|
+
name = FORTNOX_API_CREDENTIAL_KEY;
|
|
13
|
+
displayName = 'Fortnox API';
|
|
14
|
+
documentationUrl = 'https://www.fortnox.se/developer';
|
|
15
|
+
properties: INodeProperties[] = [
|
|
16
|
+
{
|
|
17
|
+
displayName: 'Token',
|
|
18
|
+
name: 'token',
|
|
19
|
+
type: 'string',
|
|
20
|
+
typeOptions: {
|
|
21
|
+
password: true,
|
|
22
|
+
},
|
|
23
|
+
default: '',
|
|
24
|
+
required: true,
|
|
25
|
+
description: 'Token for authentication with the Fortnox API',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Client Secret',
|
|
29
|
+
name: 'clientSecret',
|
|
30
|
+
type: 'string',
|
|
31
|
+
typeOptions: {
|
|
32
|
+
password: true,
|
|
33
|
+
},
|
|
34
|
+
default: '',
|
|
35
|
+
description:
|
|
36
|
+
'Unique key provided when you register your Fortnox integration',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
authenticate: IAuthenticate = {
|
|
41
|
+
type: 'generic',
|
|
42
|
+
properties: {
|
|
43
|
+
headers: {
|
|
44
|
+
Authorization: '=Bearer {{$credentials.token}}',
|
|
45
|
+
Accept: 'application/json',
|
|
46
|
+
'Content-Type': 'application/json',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
test: ICredentialTestRequest = {
|
|
52
|
+
request: {
|
|
53
|
+
baseURL: FORTNOX_BASE_URL,
|
|
54
|
+
url: 'invoices',
|
|
55
|
+
method: 'GET' as IHttpRequestMethods,
|
|
56
|
+
headers: {
|
|
57
|
+
Authorization: '=Bearer {{$credentials.token}}',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ICredentialType,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
IHttpRequestMethods,
|
|
5
|
+
IAuthenticate,
|
|
6
|
+
ICredentialTestRequest,
|
|
7
|
+
} from 'n8n-workflow';
|
|
8
|
+
|
|
9
|
+
import { LIME_CRM_API_CREDENTIAL_KEY } from '../nodes/lime-crm/commons';
|
|
10
|
+
|
|
11
|
+
export class LimeCrmApi implements ICredentialType {
|
|
12
|
+
name = LIME_CRM_API_CREDENTIAL_KEY;
|
|
13
|
+
displayName = 'Lime CRM API';
|
|
14
|
+
documentationUrl = 'https://lime-crm.com/api-docs/';
|
|
15
|
+
properties: INodeProperties[] = [
|
|
16
|
+
{
|
|
17
|
+
displayName: 'Server URL',
|
|
18
|
+
name: 'url',
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: '',
|
|
21
|
+
placeholder: 'https://instance.lime-crm.com',
|
|
22
|
+
required: true,
|
|
23
|
+
description:
|
|
24
|
+
'The URL of your Lime CRM instance (without trailing slash)',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'API Key',
|
|
28
|
+
name: 'apiKey',
|
|
29
|
+
type: 'string',
|
|
30
|
+
typeOptions: {
|
|
31
|
+
password: true,
|
|
32
|
+
},
|
|
33
|
+
default: '',
|
|
34
|
+
required: true,
|
|
35
|
+
description: 'The API key obtained from Lime CRM',
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
authenticate: IAuthenticate = {
|
|
40
|
+
type: 'generic',
|
|
41
|
+
properties: {
|
|
42
|
+
headers: {
|
|
43
|
+
// Ensure the header name matches exactly what the Lime CRM API expects
|
|
44
|
+
'X-API-Key': '={{$credentials.apiKey}}',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
test: ICredentialTestRequest = {
|
|
50
|
+
request: {
|
|
51
|
+
baseURL: '={{$credentials.url}}',
|
|
52
|
+
url: '/api/v1/',
|
|
53
|
+
method: 'GET' as IHttpRequestMethods,
|
|
54
|
+
headers: {
|
|
55
|
+
'X-API-Key': '={{$credentials.apiKey}}',
|
|
56
|
+
Accept: 'application/json',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
services:
|
|
2
|
+
n8n:
|
|
3
|
+
build: .
|
|
4
|
+
ports:
|
|
5
|
+
- '5678:5678'
|
|
6
|
+
environment:
|
|
7
|
+
- N8N_HOST=localhost
|
|
8
|
+
- N8N_PORT=5678
|
|
9
|
+
- N8N_PROTOCOL=http
|
|
10
|
+
- NODE_ENV=development
|
|
11
|
+
- DB_TYPE=postgresdb
|
|
12
|
+
- DB_POSTGRESDB_HOST=postgres
|
|
13
|
+
- DB_POSTGRESDB_PORT=5432
|
|
14
|
+
- DB_POSTGRESDB_DATABASE=n8n
|
|
15
|
+
- DB_POSTGRESDB_USER=n8n
|
|
16
|
+
- DB_POSTGRESDB_PASSWORD=n8n
|
|
17
|
+
- N8N_SECURE_COOKIE=false
|
|
18
|
+
- N8N_LOG_LEVEL=debug
|
|
19
|
+
volumes:
|
|
20
|
+
- ./dist:/home/node/.n8n/custom
|
|
21
|
+
depends_on:
|
|
22
|
+
- postgres
|
|
23
|
+
|
|
24
|
+
watcher:
|
|
25
|
+
build:
|
|
26
|
+
context: .
|
|
27
|
+
target: builder
|
|
28
|
+
command: -c "cd /source && tsc --watch"
|
|
29
|
+
entrypoint: /bin/sh
|
|
30
|
+
volumes:
|
|
31
|
+
- .:/source
|
|
32
|
+
- ./dist:/source/dist
|
|
33
|
+
|
|
34
|
+
postgres:
|
|
35
|
+
image: postgres:14
|
|
36
|
+
ports:
|
|
37
|
+
- '5432:5432'
|
|
38
|
+
environment:
|
|
39
|
+
- POSTGRES_USER=n8n
|
|
40
|
+
- POSTGRES_PASSWORD=n8n
|
|
41
|
+
- POSTGRES_DB=n8n
|
|
42
|
+
volumes:
|
|
43
|
+
- postgres_data:/var/lib/postgresql/data
|
|
44
|
+
|
|
45
|
+
volumes:
|
|
46
|
+
postgres_data:
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import config from '@limetech/eslint-config';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...config,
|
|
5
|
+
{
|
|
6
|
+
files: ['**/*.{ts,tsx}'],
|
|
7
|
+
rules: {
|
|
8
|
+
'jsdoc/require-returns': 'off',
|
|
9
|
+
'jsdoc/require-param-description': 'off',
|
|
10
|
+
'jsdoc/require-jsdoc': 'off',
|
|
11
|
+
// N8N prefers the upper camel case for file names
|
|
12
|
+
'unicorn/filename-case': 'off',
|
|
13
|
+
'no-unused-vars': 'off',
|
|
14
|
+
'@typescript-eslint/no-unused-vars': [
|
|
15
|
+
'warn',
|
|
16
|
+
{
|
|
17
|
+
argsIgnorePattern: '^_',
|
|
18
|
+
varsIgnorePattern: '^_',
|
|
19
|
+
caughtErrorsIgnorePattern: '^_',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
ignores: ['jest.config.js'],
|
|
26
|
+
},
|
|
27
|
+
];
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'node',
|
|
3
|
+
transform: {
|
|
4
|
+
'^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: 'tsconfig.json' }],
|
|
5
|
+
},
|
|
6
|
+
testMatch: ['**/tests/**/*.spec.ts'],
|
|
7
|
+
verbose: true,
|
|
8
|
+
testTimeout: 20_000,
|
|
9
|
+
testPathIgnorePatterns: ['<rootDir>/dist/'],
|
|
10
|
+
modulePathIgnorePatterns: ['<rootDir>/dist/'],
|
|
11
|
+
};
|
|
@@ -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,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IDataObject,
|
|
3
|
+
IExecuteFunctions,
|
|
4
|
+
INodeExecutionData,
|
|
5
|
+
INodeProperties,
|
|
6
|
+
INodeType,
|
|
7
|
+
INodeTypeDescription,
|
|
8
|
+
NodeConnectionType,
|
|
9
|
+
NodeOperationError,
|
|
10
|
+
NodePropertyTypes,
|
|
11
|
+
} from 'n8n-workflow';
|
|
12
|
+
|
|
13
|
+
import { invoiceProperties, invoiceOperations } from './resources/invoice';
|
|
14
|
+
import { FORTNOX_API_CREDENTIAL_KEY } from './commons';
|
|
15
|
+
import { customerProperties, customerOperations } from './resources/customers';
|
|
16
|
+
|
|
17
|
+
export class Fortnox implements INodeType {
|
|
18
|
+
description: INodeTypeDescription = {
|
|
19
|
+
displayName: 'Fortnox',
|
|
20
|
+
name: 'fortnox',
|
|
21
|
+
icon: 'file:fortnoxLogo.svg',
|
|
22
|
+
group: ['transform'],
|
|
23
|
+
version: 1,
|
|
24
|
+
subtitle:
|
|
25
|
+
'={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
26
|
+
description: 'Consume the Fortnox API',
|
|
27
|
+
defaults: {
|
|
28
|
+
name: 'Fortnox',
|
|
29
|
+
},
|
|
30
|
+
inputs: [NodeConnectionType.Main],
|
|
31
|
+
outputs: [NodeConnectionType.Main],
|
|
32
|
+
credentials: [
|
|
33
|
+
{
|
|
34
|
+
name: FORTNOX_API_CREDENTIAL_KEY,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
properties: [
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Resource',
|
|
41
|
+
name: 'resource',
|
|
42
|
+
type: 'options' as NodePropertyTypes,
|
|
43
|
+
noDataExpression: true,
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
name: 'Customer',
|
|
47
|
+
value: 'customer',
|
|
48
|
+
description: 'Work with customers',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Invoice',
|
|
52
|
+
value: 'invoice',
|
|
53
|
+
description: 'Work with invoices',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
default: 'customer',
|
|
57
|
+
},
|
|
58
|
+
...(customerProperties as INodeProperties[]),
|
|
59
|
+
...(invoiceProperties as INodeProperties[]),
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
64
|
+
const items = this.getInputData();
|
|
65
|
+
const returnData = [];
|
|
66
|
+
let responseData;
|
|
67
|
+
|
|
68
|
+
const resource = this.getNodeParameter('resource', 0) as string;
|
|
69
|
+
const operation = this.getNodeParameter('operation', 0) as string;
|
|
70
|
+
|
|
71
|
+
for (let i = 0; i < items.length; i++) {
|
|
72
|
+
if (resource === 'customer') {
|
|
73
|
+
responseData = await customerOperations.call(this, {
|
|
74
|
+
operation,
|
|
75
|
+
i,
|
|
76
|
+
});
|
|
77
|
+
} else if (resource === 'invoice') {
|
|
78
|
+
responseData = await invoiceOperations.call(this, {
|
|
79
|
+
operation,
|
|
80
|
+
i,
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
const errorLog = `The resource "${resource}" is not supported!`;
|
|
84
|
+
if (this.continueOnFail()) {
|
|
85
|
+
returnData.push({
|
|
86
|
+
error: errorLog,
|
|
87
|
+
json: { error: errorLog },
|
|
88
|
+
});
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
throw new NodeOperationError(this.getNode(), errorLog);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (Array.isArray(responseData)) {
|
|
95
|
+
returnData.push(...responseData);
|
|
96
|
+
} else if (responseData !== undefined && responseData !== null) {
|
|
97
|
+
returnData.push(responseData);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return [this.helpers.returnJsonArray(returnData as IDataObject[])];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -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
|
+
}
|