@limetech/n8n-nodes-lime 0.4.0 → 2.3.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/lint.yml +3 -1
- package/.github/workflows/release.yml +2 -49
- package/.github/workflows/test-and-build.yml +1 -1
- package/.prettierignore +3 -1
- package/.releaserc.json +2 -1
- package/CHANGELOG.md +215 -0
- package/README.md +2 -9
- package/credentials/LimeCrmApi.credentials.ts +44 -7
- package/credentials/index.ts +2 -0
- package/eslint.config.mjs +2 -1
- package/knip.json +9 -0
- package/nodes/fortnox/Fortnox.node.ts +3 -3
- package/nodes/fortnox/FortnoxTrigger.node.ts +2 -2
- package/nodes/fortnox/index.ts +6 -0
- package/nodes/fortnox/resources/customers/index.ts +18 -22
- package/nodes/fortnox/resources/customers/operations/create.operation.ts +12 -8
- package/nodes/fortnox/resources/customers/operations/delete.operation.ts +10 -15
- package/nodes/fortnox/resources/customers/operations/get.operation.ts +10 -15
- package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +1 -2
- package/nodes/fortnox/resources/customers/operations/index.ts +5 -0
- package/nodes/fortnox/resources/customers/operations/update.operation.ts +30 -30
- package/nodes/fortnox/resources/invoice/index.ts +16 -18
- package/nodes/fortnox/resources/invoice/model.ts +0 -4
- package/nodes/fortnox/resources/invoice/operations/create.operation.ts +1 -2
- package/nodes/fortnox/resources/invoice/operations/get.operation.ts +10 -15
- package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +1 -2
- package/nodes/fortnox/resources/invoice/operations/index.ts +4 -0
- package/nodes/fortnox/resources/invoice/operations/update.operation.ts +11 -16
- package/nodes/fortnox/transport/index.ts +14 -11
- package/nodes/index.ts +4 -0
- package/nodes/lime-crm/LimeCrmNode.node.ts +126 -69
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +86 -53
- package/nodes/lime-crm/index.ts +9 -0
- package/nodes/lime-crm/methods/getLimetypeProperties.ts +110 -0
- package/nodes/lime-crm/methods/getLimetypes.ts +26 -0
- package/nodes/lime-crm/methods/index.ts +7 -3
- package/nodes/lime-crm/models/constants.ts +73 -0
- package/nodes/lime-crm/models/index.ts +21 -0
- package/nodes/lime-crm/models/limeobject.ts +13 -0
- package/nodes/lime-crm/models/limetype.ts +47 -0
- package/nodes/lime-crm/models/propertyTypes.ts +13 -0
- package/nodes/lime-crm/models/users.ts +46 -0
- package/nodes/lime-crm/models/webhook.ts +61 -0
- package/nodes/lime-crm/resources/admin/index.ts +89 -0
- package/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.ts +166 -0
- package/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.ts +113 -0
- package/nodes/lime-crm/resources/admin/operations/index.ts +8 -0
- package/nodes/lime-crm/resources/data/index.ts +117 -0
- package/nodes/lime-crm/resources/data/operations/createSingleObject.operation.ts +231 -0
- package/nodes/lime-crm/resources/data/operations/deleteSingleObject.operation.ts +83 -0
- package/nodes/lime-crm/resources/data/operations/getManyObjects.operation.ts +499 -0
- package/nodes/lime-crm/resources/data/operations/getSingleFile.operation.ts +162 -0
- package/nodes/lime-crm/resources/data/operations/getSingleObject.operation.ts +116 -0
- package/nodes/lime-crm/resources/data/operations/index.ts +24 -0
- package/nodes/lime-crm/resources/{limeObject/operations/update.operation.ts → data/operations/updateSingleObject.operation.ts} +91 -25
- package/nodes/lime-crm/resources/metadata/index.ts +97 -0
- package/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.ts +28 -0
- package/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.operation.ts +147 -0
- package/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.operation.ts +58 -0
- package/nodes/lime-crm/resources/metadata/operations/index.ts +12 -0
- package/nodes/lime-crm/transport/commons.ts +97 -27
- package/nodes/lime-crm/transport/files.ts +220 -0
- package/nodes/lime-crm/transport/index.ts +38 -13
- package/nodes/lime-crm/transport/limeQuery.ts +44 -10
- package/nodes/lime-crm/transport/limeobjects.ts +126 -168
- package/nodes/lime-crm/transport/limetypes.ts +169 -57
- package/nodes/lime-crm/transport/users.ts +264 -0
- package/nodes/lime-crm/transport/webhooks.ts +96 -37
- package/nodes/lime-crm/utils/files.ts +198 -0
- package/nodes/lime-crm/utils/hmac.ts +35 -0
- package/nodes/lime-crm/utils/index.ts +10 -0
- package/nodes/lime-crm/utils/propertyAdapters.ts +75 -0
- package/nodes/lime-crm/utils/webhook.ts +81 -0
- package/nodes/modules.ts +44 -0
- package/nodes/response.ts +16 -0
- package/package.json +21 -29
- package/restore_script/README +42 -0
- package/restore_script/api_key_download.txt +0 -0
- package/restore_script/api_key_upload.txt +0 -0
- package/restore_script/cli.py +73 -0
- package/restore_script/download.py +73 -0
- package/restore_script/main.py +19 -0
- package/restore_script/poetry.lock +162 -0
- package/restore_script/pyproject.toml +15 -0
- package/restore_script/transfer.py +41 -0
- package/restore_script/upload.py +66 -0
- package/restore_script/utils.py +42 -0
- package/tests/nodes/lime-crm/utils.spec.ts +238 -0
- package/typedoc.css +9 -0
- package/typedoc.json +19 -0
- package/.dockerignore +0 -1
- package/Dockerfile +0 -21
- package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
- package/dist/credentials/FortnoxApi.credentials.js +0 -57
- package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
- package/dist/credentials/LimeCrmApi.credentials.d.ts +0 -9
- package/dist/credentials/LimeCrmApi.credentials.js +0 -66
- package/dist/credentials/LimeCrmApi.credentials.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
- package/dist/nodes/fortnox/Fortnox.node.js +0 -95
- package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.json +0 -18
- package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
- package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
- package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
- package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
- package/dist/nodes/fortnox/commons.d.ts +0 -25
- package/dist/nodes/fortnox/commons.js +0 -44
- package/dist/nodes/fortnox/commons.js.map +0 -1
- package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
- package/dist/nodes/fortnox/model.d.ts +0 -20
- package/dist/nodes/fortnox/model.js +0 -3
- package/dist/nodes/fortnox/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
- package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -20
- package/dist/nodes/fortnox/resources/customers/index.js +0 -87
- package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
- package/dist/nodes/fortnox/resources/customers/model.js +0 -3
- package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -12
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -283
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -45
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -11
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -45
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -11
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -12
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -276
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
- package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -20
- package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
- package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -150
- package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
- package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -11
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -11
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -44
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -11
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -11
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -71
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
- package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
- package/dist/nodes/fortnox/transport/index.d.ts +0 -4
- package/dist/nodes/fortnox/transport/index.js +0 -77
- package/dist/nodes/fortnox/transport/index.js.map +0 -1
- package/dist/nodes/lime-crm/LimeCrm.node.json +0 -18
- package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +0 -14
- package/dist/nodes/lime-crm/LimeCrmNode.node.js +0 -126
- package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +0 -1
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.d.ts +0 -18
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +0 -215
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +0 -1
- package/dist/nodes/lime-crm/assets/lime-crm.svg +0 -1
- package/dist/nodes/lime-crm/commons/constants.d.ts +0 -5
- package/dist/nodes/lime-crm/commons/constants.js +0 -9
- package/dist/nodes/lime-crm/commons/constants.js.map +0 -1
- package/dist/nodes/lime-crm/commons/hmac.d.ts +0 -1
- package/dist/nodes/lime-crm/commons/hmac.js +0 -11
- package/dist/nodes/lime-crm/commons/hmac.js.map +0 -1
- package/dist/nodes/lime-crm/commons/index.d.ts +0 -3
- package/dist/nodes/lime-crm/commons/index.js +0 -12
- package/dist/nodes/lime-crm/commons/index.js.map +0 -1
- package/dist/nodes/lime-crm/commons/limetype.d.ts +0 -10
- package/dist/nodes/lime-crm/commons/limetype.js +0 -3
- package/dist/nodes/lime-crm/commons/limetype.js.map +0 -1
- package/dist/nodes/lime-crm/commons/task.d.ts +0 -14
- package/dist/nodes/lime-crm/commons/task.js +0 -48
- package/dist/nodes/lime-crm/commons/task.js.map +0 -1
- package/dist/nodes/lime-crm/commons/webhook.d.ts +0 -20
- package/dist/nodes/lime-crm/commons/webhook.js +0 -30
- package/dist/nodes/lime-crm/commons/webhook.js.map +0 -1
- package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.d.ts +0 -5
- package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.js +0 -11
- package/dist/nodes/lime-crm/methods/getEntitiesForErpSystem.js.map +0 -1
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.d.ts +0 -2
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js +0 -20
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js.map +0 -1
- package/dist/nodes/lime-crm/methods/getLimeTypes.d.ts +0 -2
- package/dist/nodes/lime-crm/methods/getLimeTypes.js +0 -20
- package/dist/nodes/lime-crm/methods/getLimeTypes.js.map +0 -1
- package/dist/nodes/lime-crm/methods/index.d.ts +0 -3
- package/dist/nodes/lime-crm/methods/index.js +0 -10
- package/dist/nodes/lime-crm/methods/index.js.map +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/index.d.ts +0 -23
- package/dist/nodes/lime-crm/resources/erpConnector/index.js +0 -67
- package/dist/nodes/lime-crm/resources/erpConnector/index.js.map +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.d.ts +0 -26
- package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.js +0 -65
- package/dist/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.js +0 -220
- package/dist/nodes/lime-crm/resources/erpConnector/operations/transform.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/transform.d.ts +0 -15
- package/dist/nodes/lime-crm/resources/erpConnector/transform.js +0 -11
- package/dist/nodes/lime-crm/resources/erpConnector/transform.js.map +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.d.ts +0 -4
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.js +0 -7
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.js.map +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.d.ts +0 -37
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.js +0 -124
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/fortnox.js.map +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.d.ts +0 -1
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.js +0 -6
- package/dist/nodes/lime-crm/resources/erpConnector/transformers/index.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeObject/index.d.ts +0 -14
- package/dist/nodes/lime-crm/resources/limeObject/index.js +0 -88
- package/dist/nodes/lime-crm/resources/limeObject/index.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js +0 -139
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js +0 -51
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.js +0 -103
- package/dist/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js +0 -51
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js +0 -103
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js +0 -149
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeQuery/index.d.ts +0 -6
- package/dist/nodes/lime-crm/resources/limeQuery/index.js +0 -66
- package/dist/nodes/lime-crm/resources/limeQuery/index.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js +0 -191
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeType/index.d.ts +0 -20
- package/dist/nodes/lime-crm/resources/limeType/index.js +0 -81
- package/dist/nodes/lime-crm/resources/limeType/index.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.d.ts +0 -11
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js +0 -36
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js +0 -36
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.d.ts +0 -10
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js +0 -15
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js.map +0 -1
- package/dist/nodes/lime-crm/transport/commons.d.ts +0 -5
- package/dist/nodes/lime-crm/transport/commons.js +0 -33
- package/dist/nodes/lime-crm/transport/commons.js.map +0 -1
- package/dist/nodes/lime-crm/transport/erpConnector.d.ts +0 -9
- package/dist/nodes/lime-crm/transport/erpConnector.js +0 -11
- package/dist/nodes/lime-crm/transport/erpConnector.js.map +0 -1
- package/dist/nodes/lime-crm/transport/index.d.ts +0 -6
- package/dist/nodes/lime-crm/transport/index.js +0 -24
- package/dist/nodes/lime-crm/transport/index.js.map +0 -1
- package/dist/nodes/lime-crm/transport/limeQuery.d.ts +0 -10
- package/dist/nodes/lime-crm/transport/limeQuery.js +0 -15
- package/dist/nodes/lime-crm/transport/limeQuery.js.map +0 -1
- package/dist/nodes/lime-crm/transport/limeobjects.d.ts +0 -7
- package/dist/nodes/lime-crm/transport/limeobjects.js +0 -134
- package/dist/nodes/lime-crm/transport/limeobjects.js.map +0 -1
- package/dist/nodes/lime-crm/transport/limetypes.d.ts +0 -6
- package/dist/nodes/lime-crm/transport/limetypes.js +0 -54
- package/dist/nodes/lime-crm/transport/limetypes.js.map +0 -1
- package/dist/nodes/lime-crm/transport/task.d.ts +0 -13
- package/dist/nodes/lime-crm/transport/task.js +0 -13
- package/dist/nodes/lime-crm/transport/task.js.map +0 -1
- package/dist/nodes/lime-crm/transport/webhooks.d.ts +0 -16
- package/dist/nodes/lime-crm/transport/webhooks.js +0 -43
- package/dist/nodes/lime-crm/transport/webhooks.js.map +0 -1
- package/dist/nodes/nodeResponse.d.ts +0 -12
- package/dist/nodes/nodeResponse.js +0 -3
- package/dist/nodes/nodeResponse.js.map +0 -1
- package/dist/package.json +0 -75
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/docker-compose.yml +0 -46
- package/nodes/lime-crm/commons/constants.ts +0 -10
- package/nodes/lime-crm/commons/hmac.ts +0 -13
- package/nodes/lime-crm/commons/index.ts +0 -10
- package/nodes/lime-crm/commons/limetype.ts +0 -11
- package/nodes/lime-crm/commons/task.ts +0 -55
- package/nodes/lime-crm/commons/webhook.ts +0 -56
- package/nodes/lime-crm/methods/getEntitiesForErpSystem.ts +0 -11
- package/nodes/lime-crm/methods/getLimeTypeProperties.ts +0 -27
- package/nodes/lime-crm/methods/getLimeTypes.ts +0 -23
- package/nodes/lime-crm/resources/erpConnector/index.ts +0 -43
- package/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.ts +0 -69
- package/nodes/lime-crm/resources/erpConnector/operations/transform.operation.ts +0 -274
- package/nodes/lime-crm/resources/erpConnector/transform.ts +0 -49
- package/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.ts +0 -18
- package/nodes/lime-crm/resources/erpConnector/transformers/fortnox.ts +0 -201
- package/nodes/lime-crm/resources/erpConnector/transformers/index.ts +0 -1
- package/nodes/lime-crm/resources/limeObject/index.ts +0 -64
- package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +0 -152
- package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +0 -55
- package/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.ts +0 -112
- package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +0 -54
- package/nodes/lime-crm/resources/limeQuery/index.ts +0 -40
- package/nodes/lime-crm/resources/limeQuery/operations/query.operation.ts +0 -222
- package/nodes/lime-crm/resources/limeType/index.ts +0 -58
- package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +0 -42
- package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +0 -36
- package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +0 -18
- package/nodes/lime-crm/transport/erpConnector.ts +0 -21
- package/nodes/lime-crm/transport/task.ts +0 -32
- package/nodes/nodeResponse.ts +0 -13
- package/tests/fixtures/fortnox.ts +0 -182
- package/tests/transform.spec.ts +0 -187
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IExecuteFunctions,
|
|
3
|
-
INodeProperties,
|
|
4
|
-
NodePropertyTypes,
|
|
5
|
-
} from 'n8n-workflow';
|
|
6
|
-
|
|
7
|
-
import * as createOrUpdateObjects from './operations/createOrUpdateObjects.operation';
|
|
8
|
-
import * as transform from './operations/transform.operation';
|
|
9
|
-
|
|
10
|
-
import { ERP_CONNECTOR_RESOURCE } from '../../commons';
|
|
11
|
-
|
|
12
|
-
export const erpConnectorFields: INodeProperties[] = [
|
|
13
|
-
{
|
|
14
|
-
displayName: 'Operation',
|
|
15
|
-
name: 'operation',
|
|
16
|
-
type: 'options' as NodePropertyTypes,
|
|
17
|
-
noDataExpression: true,
|
|
18
|
-
displayOptions: {
|
|
19
|
-
show: {
|
|
20
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
options: [createOrUpdateObjects.description, transform.description],
|
|
24
|
-
default: 'transformErpData',
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
...createOrUpdateObjects.properties,
|
|
28
|
-
...transform.properties,
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
export async function erpConnectorOperations(
|
|
32
|
-
this: IExecuteFunctions,
|
|
33
|
-
{ operation, i }: { operation: string; i: number }
|
|
34
|
-
) {
|
|
35
|
-
if (operation === 'createOrUpdateObjects') {
|
|
36
|
-
return await createOrUpdateObjects.execute.call(this, i);
|
|
37
|
-
}
|
|
38
|
-
if (operation === 'transformErpData') {
|
|
39
|
-
return await transform.execute.call(this, i);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
|
|
3
|
-
import { startCreateOrUpdateObjectsTask } from '../../../transport';
|
|
4
|
-
import { ERP_CONNECTOR_RESOURCE } from '../../../commons';
|
|
5
|
-
import { LimeCrmData } from '../transform';
|
|
6
|
-
import { waitForTaskCompletion } from '../../../commons/task';
|
|
7
|
-
|
|
8
|
-
export const description = {
|
|
9
|
-
name: 'Create Or Update Objects Task',
|
|
10
|
-
value: 'createOrUpdateObjects',
|
|
11
|
-
description: 'Sync data between ERP and Lime CRM',
|
|
12
|
-
action: 'Create or Update Objects',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const properties: INodeProperties[] = [
|
|
16
|
-
{
|
|
17
|
-
displayName: 'Data',
|
|
18
|
-
name: 'data',
|
|
19
|
-
type: 'json',
|
|
20
|
-
default: '',
|
|
21
|
-
description: 'Provide payload',
|
|
22
|
-
displayOptions: {
|
|
23
|
-
show: {
|
|
24
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
25
|
-
operation: ['createOrUpdateObjects'],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
displayName: 'Poll Interval',
|
|
31
|
-
name: 'pollInterval',
|
|
32
|
-
type: 'number',
|
|
33
|
-
default: 2,
|
|
34
|
-
description: 'Seconds between polls',
|
|
35
|
-
displayOptions: {
|
|
36
|
-
show: {
|
|
37
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
38
|
-
operation: ['createOrUpdateObjects'],
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
displayName: 'Timeout',
|
|
44
|
-
name: 'timeout',
|
|
45
|
-
type: 'number',
|
|
46
|
-
default: 60,
|
|
47
|
-
description: 'Max total wait time in seconds',
|
|
48
|
-
displayOptions: {
|
|
49
|
-
show: {
|
|
50
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
51
|
-
operation: ['createOrUpdateObjects'],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
export async function execute(this: IExecuteFunctions, i: number) {
|
|
58
|
-
const data = this.getNodeParameter('data', i) as LimeCrmData;
|
|
59
|
-
const pollInterval =
|
|
60
|
-
(this.getNodeParameter('pollInterval', i) as number) * 1000;
|
|
61
|
-
const timeout = (this.getNodeParameter('timeout', i) as number) * 1000;
|
|
62
|
-
|
|
63
|
-
const response = await startCreateOrUpdateObjectsTask(this, data);
|
|
64
|
-
|
|
65
|
-
if (!response.success) return response;
|
|
66
|
-
|
|
67
|
-
const taskId = response.data.id;
|
|
68
|
-
return await waitForTaskCompletion(this, taskId, pollInterval, timeout);
|
|
69
|
-
}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IExecuteFunctions,
|
|
3
|
-
INodeProperties,
|
|
4
|
-
INodePropertyCollection,
|
|
5
|
-
} from 'n8n-workflow';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
CustomLimeTypeNames,
|
|
9
|
-
Entity,
|
|
10
|
-
ErpData,
|
|
11
|
-
ErpSystem,
|
|
12
|
-
SearchParameters,
|
|
13
|
-
transform,
|
|
14
|
-
} from '../transform';
|
|
15
|
-
import { ERP_CONNECTOR_RESOURCE } from '../../../commons';
|
|
16
|
-
|
|
17
|
-
export const description = {
|
|
18
|
-
name: 'Transform ERP Data',
|
|
19
|
-
value: 'transformErpData',
|
|
20
|
-
description:
|
|
21
|
-
'Transform and map ERP data into the structure required by Lime CRM',
|
|
22
|
-
action: 'Transform',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
type PropertyMappingItem = {
|
|
26
|
-
defaultPropertyName: string;
|
|
27
|
-
customPropertyName: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
type Properties = {
|
|
31
|
-
properties: PropertyMappingItem[];
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
type CustomPropertiesMapping = {
|
|
35
|
-
[key in Entity]: Properties;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const defaults: { [key in Entity]: string[] } = {
|
|
39
|
-
invoice: [
|
|
40
|
-
'invoice_number',
|
|
41
|
-
'company',
|
|
42
|
-
'customerid',
|
|
43
|
-
'customer_reference',
|
|
44
|
-
'coworker',
|
|
45
|
-
'invoice_type',
|
|
46
|
-
'invoice_date',
|
|
47
|
-
'invoice_expires',
|
|
48
|
-
'currency',
|
|
49
|
-
'conversionrate',
|
|
50
|
-
'invoice_sum',
|
|
51
|
-
'invoice_vat',
|
|
52
|
-
'invoice_total_sum',
|
|
53
|
-
'invoice_balance',
|
|
54
|
-
'paid',
|
|
55
|
-
'paid_date',
|
|
56
|
-
'invoice_shredded',
|
|
57
|
-
],
|
|
58
|
-
invoicerow: [
|
|
59
|
-
'company',
|
|
60
|
-
'invoice',
|
|
61
|
-
'item',
|
|
62
|
-
'description',
|
|
63
|
-
'units',
|
|
64
|
-
'row_margin',
|
|
65
|
-
'row_value',
|
|
66
|
-
'rowid',
|
|
67
|
-
],
|
|
68
|
-
company: ['erp_id'],
|
|
69
|
-
coworker: ['name'],
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
function getLimeTypesPropertiesMapping(): INodeProperties[] {
|
|
73
|
-
return Object.keys(defaults).map((key) => ({
|
|
74
|
-
displayName: key,
|
|
75
|
-
name: key,
|
|
76
|
-
type: 'fixedCollection',
|
|
77
|
-
typeOptions: {
|
|
78
|
-
multipleValues: true,
|
|
79
|
-
},
|
|
80
|
-
default: {},
|
|
81
|
-
options: getPropertiesMapping(key as Entity),
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function getPropertiesMapping(limeType: Entity): INodePropertyCollection[] {
|
|
86
|
-
return [
|
|
87
|
-
{
|
|
88
|
-
displayName: 'Properties',
|
|
89
|
-
name: 'properties',
|
|
90
|
-
values: [
|
|
91
|
-
{
|
|
92
|
-
displayName: 'Property',
|
|
93
|
-
name: 'defaultPropertyName',
|
|
94
|
-
type: 'options',
|
|
95
|
-
default: '',
|
|
96
|
-
description: 'Name of the property',
|
|
97
|
-
options: defaults[limeType]?.map((property) => ({
|
|
98
|
-
name: property,
|
|
99
|
-
value: property,
|
|
100
|
-
})),
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
displayName: 'Custom Property Name',
|
|
104
|
-
name: 'customPropertyName',
|
|
105
|
-
type: 'string',
|
|
106
|
-
default: '',
|
|
107
|
-
description: 'Custom name of the property in your Lime CRM',
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export const properties: INodeProperties[] = [
|
|
115
|
-
{
|
|
116
|
-
displayName: 'ERP System',
|
|
117
|
-
name: 'erpSystem',
|
|
118
|
-
type: 'options',
|
|
119
|
-
options: [
|
|
120
|
-
{
|
|
121
|
-
name: 'Fortnox',
|
|
122
|
-
value: 'fortnox',
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
required: true,
|
|
126
|
-
default: '',
|
|
127
|
-
description: '',
|
|
128
|
-
displayOptions: {
|
|
129
|
-
show: {
|
|
130
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
131
|
-
operation: ['transformErpData'],
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
displayName: 'Entity',
|
|
137
|
-
name: 'entity',
|
|
138
|
-
type: 'options',
|
|
139
|
-
typeOptions: {
|
|
140
|
-
loadOptionsMethod: 'getEntitiesForErpSystem',
|
|
141
|
-
loadOptionsDependsOn: ['erpSystem'],
|
|
142
|
-
},
|
|
143
|
-
required: true,
|
|
144
|
-
default: '',
|
|
145
|
-
description: 'Type of entity to sync',
|
|
146
|
-
displayOptions: {
|
|
147
|
-
show: {
|
|
148
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
149
|
-
operation: ['transformErpData'],
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
displayName: 'Search Parameters',
|
|
155
|
-
name: 'searchParameters',
|
|
156
|
-
type: 'collection',
|
|
157
|
-
placeholder: 'Add search criteria',
|
|
158
|
-
default: {},
|
|
159
|
-
options: [
|
|
160
|
-
{
|
|
161
|
-
displayName: 'Search Property',
|
|
162
|
-
name: 'property',
|
|
163
|
-
type: 'string',
|
|
164
|
-
default: '',
|
|
165
|
-
description: 'Property to search the object by',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
displayName: 'Search Value',
|
|
169
|
-
name: 'value',
|
|
170
|
-
type: 'string',
|
|
171
|
-
default: '',
|
|
172
|
-
description: 'Value of the search property',
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
displayName: 'Create',
|
|
176
|
-
name: 'create',
|
|
177
|
-
type: 'boolean',
|
|
178
|
-
default: true,
|
|
179
|
-
description: 'Whether to create a new object',
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
displayOptions: {
|
|
183
|
-
show: {
|
|
184
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
185
|
-
operation: ['transformErpData'],
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
displayName: 'Custom Lime Type Name',
|
|
191
|
-
name: 'customLimeTypeNames',
|
|
192
|
-
type: 'collection',
|
|
193
|
-
default: {},
|
|
194
|
-
description: 'Optional custom name for the Lime CRM types.',
|
|
195
|
-
displayOptions: {
|
|
196
|
-
show: {
|
|
197
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
198
|
-
operation: ['transformErpData'],
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
options: [
|
|
202
|
-
{
|
|
203
|
-
displayName: 'Invoice',
|
|
204
|
-
name: 'invoice',
|
|
205
|
-
type: 'string',
|
|
206
|
-
default: 'invoice',
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
displayName: 'Invoice Row',
|
|
210
|
-
name: 'invoicerow',
|
|
211
|
-
type: 'string',
|
|
212
|
-
default: 'invoicerow',
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
displayName: 'Custom Properties Mapping',
|
|
218
|
-
name: 'customPropertiesMapping',
|
|
219
|
-
type: 'collection',
|
|
220
|
-
default: {},
|
|
221
|
-
displayOptions: {
|
|
222
|
-
show: {
|
|
223
|
-
resource: [ERP_CONNECTOR_RESOURCE],
|
|
224
|
-
operation: ['transformErpData'],
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
description: 'Select Lime Type',
|
|
228
|
-
options: getLimeTypesPropertiesMapping(),
|
|
229
|
-
},
|
|
230
|
-
];
|
|
231
|
-
|
|
232
|
-
export async function execute(this: IExecuteFunctions, i: number) {
|
|
233
|
-
const data = this.getInputData(i);
|
|
234
|
-
|
|
235
|
-
const erpSystem = this.getNodeParameter('erpSystem', i) as ErpSystem;
|
|
236
|
-
const entity = this.getNodeParameter('entity', i) as Entity;
|
|
237
|
-
const searchParameters = this.getNodeParameter(
|
|
238
|
-
'searchParameters',
|
|
239
|
-
i
|
|
240
|
-
) as SearchParameters;
|
|
241
|
-
const customLimeTypeNames = this.getNodeParameter(
|
|
242
|
-
'customLimeTypeNames',
|
|
243
|
-
i
|
|
244
|
-
) as CustomLimeTypeNames;
|
|
245
|
-
const customPropertiesMapping = this.getNodeParameter(
|
|
246
|
-
'customPropertiesMapping',
|
|
247
|
-
i
|
|
248
|
-
) as CustomPropertiesMapping;
|
|
249
|
-
|
|
250
|
-
const customPropertiesNames = Object.fromEntries(
|
|
251
|
-
Object.entries(customPropertiesMapping).map(
|
|
252
|
-
([limeType, { properties }]) => [
|
|
253
|
-
limeType,
|
|
254
|
-
Object.fromEntries(
|
|
255
|
-
properties.map(
|
|
256
|
-
({ defaultPropertyName, customPropertyName }) => [
|
|
257
|
-
defaultPropertyName,
|
|
258
|
-
customPropertyName,
|
|
259
|
-
]
|
|
260
|
-
)
|
|
261
|
-
),
|
|
262
|
-
]
|
|
263
|
-
)
|
|
264
|
-
);
|
|
265
|
-
|
|
266
|
-
return transform(
|
|
267
|
-
erpSystem,
|
|
268
|
-
entity,
|
|
269
|
-
data[0].json as ErpData,
|
|
270
|
-
searchParameters,
|
|
271
|
-
customLimeTypeNames,
|
|
272
|
-
customPropertiesNames
|
|
273
|
-
);
|
|
274
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { FortnoxTransformer } from './transformers';
|
|
2
|
-
|
|
3
|
-
export type Entity = 'invoice' | 'invoicerow' | 'company' | 'coworker';
|
|
4
|
-
export type ErpSystem = 'fortnox';
|
|
5
|
-
export type ErpData = Record<string, unknown>;
|
|
6
|
-
|
|
7
|
-
export type CustomLimeTypeNames = Partial<Record<Entity, string>>;
|
|
8
|
-
|
|
9
|
-
export type CustomPropertiesNames = Partial<
|
|
10
|
-
Record<Entity, Record<string, string>>
|
|
11
|
-
>;
|
|
12
|
-
|
|
13
|
-
export type SearchParameters = {
|
|
14
|
-
property?: string;
|
|
15
|
-
value?: string | number | boolean;
|
|
16
|
-
create?: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type LimeCrmObjectData = {
|
|
20
|
-
[key: string]:
|
|
21
|
-
| LimeCrmData
|
|
22
|
-
| SearchParameters
|
|
23
|
-
| string
|
|
24
|
-
| number
|
|
25
|
-
| boolean
|
|
26
|
-
| null;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type LimeCrmData = LimeCrmObjectData[];
|
|
30
|
-
|
|
31
|
-
export function transform(
|
|
32
|
-
erpSystem: ErpSystem,
|
|
33
|
-
entity: Entity,
|
|
34
|
-
data: ErpData,
|
|
35
|
-
searchParameters: SearchParameters,
|
|
36
|
-
customLimeTypeNames?: CustomLimeTypeNames,
|
|
37
|
-
customPropertiesNames?: CustomPropertiesNames
|
|
38
|
-
): LimeCrmData {
|
|
39
|
-
if (erpSystem === 'fortnox') {
|
|
40
|
-
return new FortnoxTransformer().transform(
|
|
41
|
-
entity,
|
|
42
|
-
data,
|
|
43
|
-
searchParameters,
|
|
44
|
-
customLimeTypeNames,
|
|
45
|
-
customPropertiesNames
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
throw new Error(`Unsupported ERP system: ${erpSystem}`);
|
|
49
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CustomLimeTypeNames,
|
|
3
|
-
CustomPropertiesNames,
|
|
4
|
-
Entity,
|
|
5
|
-
ErpData,
|
|
6
|
-
LimeCrmData,
|
|
7
|
-
SearchParameters,
|
|
8
|
-
} from '../transform';
|
|
9
|
-
|
|
10
|
-
export abstract class BaseTransformer {
|
|
11
|
-
abstract transform(
|
|
12
|
-
entity: Entity,
|
|
13
|
-
data: ErpData,
|
|
14
|
-
searchParameters: SearchParameters,
|
|
15
|
-
customLimeTypeNames?: CustomLimeTypeNames,
|
|
16
|
-
customPropertiesNames?: CustomPropertiesNames
|
|
17
|
-
): LimeCrmData;
|
|
18
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { BaseTransformer } from './baseTransformer';
|
|
2
|
-
import {
|
|
3
|
-
CustomLimeTypeNames,
|
|
4
|
-
CustomPropertiesNames,
|
|
5
|
-
Entity,
|
|
6
|
-
ErpData,
|
|
7
|
-
LimeCrmData,
|
|
8
|
-
LimeCrmObjectData,
|
|
9
|
-
SearchParameters,
|
|
10
|
-
} from '../transform';
|
|
11
|
-
|
|
12
|
-
export interface FortnoxInvoiceRowData extends ErpData {
|
|
13
|
-
ArticleNumber: string;
|
|
14
|
-
Description: string;
|
|
15
|
-
DeliveredQuantity: string;
|
|
16
|
-
ContributionPercent: string;
|
|
17
|
-
Total: number;
|
|
18
|
-
RowId: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface FortnoxInvoiceData extends ErpData {
|
|
22
|
-
DocumentNumber: string;
|
|
23
|
-
InvoiceType: string;
|
|
24
|
-
InvoiceDate: string;
|
|
25
|
-
DueDate: string;
|
|
26
|
-
Currency: string;
|
|
27
|
-
Net: number;
|
|
28
|
-
TotalVAT: number;
|
|
29
|
-
Total: number;
|
|
30
|
-
Balance: number;
|
|
31
|
-
FinalPayDate: string | null;
|
|
32
|
-
CustomerNumber: string;
|
|
33
|
-
YourReference: string;
|
|
34
|
-
OurReference: string;
|
|
35
|
-
InvoiceRows: FortnoxInvoiceRowData[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class FortnoxTransformer extends BaseTransformer {
|
|
39
|
-
readonly INVOICE_MAPPING: {
|
|
40
|
-
[key: string]: (
|
|
41
|
-
_data: FortnoxInvoiceData,
|
|
42
|
-
_customPropertiesNames?: CustomPropertiesNames
|
|
43
|
-
) => string | number | boolean | object | null;
|
|
44
|
-
} = {
|
|
45
|
-
invoice_number: (_data, _customPropertiesNames) =>
|
|
46
|
-
_data['DocumentNumber'],
|
|
47
|
-
invoice_type: (_data, _customPropertiesNames) => _data['InvoiceType'],
|
|
48
|
-
invoice_date: (_data, _customPropertiesNames) => _data['InvoiceDate'],
|
|
49
|
-
invoice_expires: (_data, _customPropertiesNames) => _data['DueDate'],
|
|
50
|
-
currency: (_data, _customPropertiesNames) => _data['Currency'],
|
|
51
|
-
invoice_sum: (_data, _customPropertiesNames) => _data['Net'],
|
|
52
|
-
invoice_vat: (_data, _customPropertiesNames) => _data['TotalVAT'],
|
|
53
|
-
invoice_total_sum: (_data, _customPropertiesNames) => _data['Total'],
|
|
54
|
-
invoice_balance: (_data, _customPropertiesNames) => _data['Balance'],
|
|
55
|
-
paid: (_data, _customPropertiesNames) => _data['Balance'] === 0,
|
|
56
|
-
paid_date: (_data, _customPropertiesNames) => _data['FinalPayDate'],
|
|
57
|
-
invoice_shredded: (_data, _customPropertiesNames) => false,
|
|
58
|
-
customerid: (_data, _customPropertiesNames) => _data['CustomerNumber'],
|
|
59
|
-
customer_reference: (_data, _customPropertiesNames) =>
|
|
60
|
-
_data['YourReference'],
|
|
61
|
-
company: (_data, _customPropertiesNames) => ({
|
|
62
|
-
_search: {
|
|
63
|
-
property:
|
|
64
|
-
_customPropertiesNames?.company?.['erp_id'] || 'erp_id',
|
|
65
|
-
value: _data['CustomerNumber'],
|
|
66
|
-
create: false,
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
coworker: (_data, _customPropertiesNames) => ({
|
|
70
|
-
_search: {
|
|
71
|
-
property: _customPropertiesNames?.coworker?.['name'] || 'name',
|
|
72
|
-
value: _data['OurReference'],
|
|
73
|
-
create: false,
|
|
74
|
-
},
|
|
75
|
-
}),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
readonly INVOICE_ROW_MAPPING: {
|
|
79
|
-
[key: string]: (
|
|
80
|
-
_data: FortnoxInvoiceRowData,
|
|
81
|
-
_customPropertiesNames?: CustomPropertiesNames
|
|
82
|
-
) => string | number | boolean | object;
|
|
83
|
-
} = {
|
|
84
|
-
company: (_data, _customPropertiesNames) => ({
|
|
85
|
-
_search: {
|
|
86
|
-
property:
|
|
87
|
-
_customPropertiesNames?.company?.['erp_id'] || 'erp_id',
|
|
88
|
-
value: _data['CustomerNumber'],
|
|
89
|
-
create: false,
|
|
90
|
-
},
|
|
91
|
-
}),
|
|
92
|
-
invoice: (_data, _customPropertiesNames) => ({
|
|
93
|
-
_search: {
|
|
94
|
-
property:
|
|
95
|
-
_customPropertiesNames?.invoice?.['invoice_number'] ||
|
|
96
|
-
'invoice_number',
|
|
97
|
-
value: _data['DocumentNumber'],
|
|
98
|
-
create: false,
|
|
99
|
-
},
|
|
100
|
-
}),
|
|
101
|
-
item: (_data, _customPropertiesNames) => _data['ArticleNumber'],
|
|
102
|
-
description: (_data, _customPropertiesNames) => _data['Description'],
|
|
103
|
-
units: (_data, _customPropertiesNames) => +_data['DeliveredQuantity'],
|
|
104
|
-
row_margin: (_data, _customPropertiesNames) =>
|
|
105
|
-
+_data['ContributionPercent'],
|
|
106
|
-
row_value: (_data, _customPropertiesNames) => +_data['Total'],
|
|
107
|
-
rowid: (_data, _customPropertiesNames) => _data['RowId'],
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
transform(
|
|
111
|
-
entity: Entity,
|
|
112
|
-
data: ErpData,
|
|
113
|
-
searchParameters: SearchParameters,
|
|
114
|
-
customLimeTypeNames?: CustomLimeTypeNames,
|
|
115
|
-
customPropertiesNames?: CustomPropertiesNames
|
|
116
|
-
): LimeCrmData {
|
|
117
|
-
if (entity === 'invoice') {
|
|
118
|
-
{
|
|
119
|
-
return this._transformInvoice(
|
|
120
|
-
data as FortnoxInvoiceData,
|
|
121
|
-
searchParameters,
|
|
122
|
-
customLimeTypeNames,
|
|
123
|
-
customPropertiesNames
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
} else {
|
|
127
|
-
{
|
|
128
|
-
throw new Error(`Unsupported entity type: ${entity}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
protected _transformInvoice(
|
|
134
|
-
data: FortnoxInvoiceData,
|
|
135
|
-
searchParameters: SearchParameters,
|
|
136
|
-
customLimeTypeNames?: CustomLimeTypeNames,
|
|
137
|
-
customPropertiesNames?: CustomPropertiesNames
|
|
138
|
-
): LimeCrmData {
|
|
139
|
-
const limeCrmData: LimeCrmData = [];
|
|
140
|
-
|
|
141
|
-
const invoice: LimeCrmObjectData = {
|
|
142
|
-
_limetype: customLimeTypeNames?.invoice || 'invoice',
|
|
143
|
-
_search: searchParameters,
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
for (const [limeCrmKey, getLimeCrmValue] of Object.entries(
|
|
147
|
-
this.INVOICE_MAPPING
|
|
148
|
-
)) {
|
|
149
|
-
invoice[
|
|
150
|
-
customPropertiesNames?.invoice?.[limeCrmKey] || limeCrmKey
|
|
151
|
-
] = getLimeCrmValue(data, customPropertiesNames);
|
|
152
|
-
}
|
|
153
|
-
limeCrmData.push(invoice);
|
|
154
|
-
|
|
155
|
-
for (const invoiceRow of data['InvoiceRows']) {
|
|
156
|
-
invoiceRow['DocumentNumber'] = data['DocumentNumber'];
|
|
157
|
-
invoiceRow['CustomerNumber'] = data['CustomerNumber'];
|
|
158
|
-
limeCrmData.push(
|
|
159
|
-
...this._transformInvoiceRow(
|
|
160
|
-
invoiceRow,
|
|
161
|
-
{
|
|
162
|
-
property:
|
|
163
|
-
customPropertiesNames?.invoicerow?.['rowid'] ||
|
|
164
|
-
'rowid',
|
|
165
|
-
value: invoiceRow['RowId'],
|
|
166
|
-
create: true,
|
|
167
|
-
},
|
|
168
|
-
customLimeTypeNames,
|
|
169
|
-
customPropertiesNames
|
|
170
|
-
)
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return limeCrmData;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
protected _transformInvoiceRow(
|
|
178
|
-
data: FortnoxInvoiceRowData,
|
|
179
|
-
searchParameters: SearchParameters,
|
|
180
|
-
customLimeTypeNames?: CustomLimeTypeNames,
|
|
181
|
-
customPropertiesNames?: CustomPropertiesNames
|
|
182
|
-
): LimeCrmData {
|
|
183
|
-
const limeCrmData: LimeCrmData = [];
|
|
184
|
-
|
|
185
|
-
const invoiceRow: LimeCrmObjectData = {
|
|
186
|
-
_limetype: customLimeTypeNames?.invoicerow || 'invoicerow',
|
|
187
|
-
_search: searchParameters,
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
for (const [limeCrmKey, getLimeCrmValue] of Object.entries(
|
|
191
|
-
this.INVOICE_ROW_MAPPING
|
|
192
|
-
)) {
|
|
193
|
-
invoiceRow[
|
|
194
|
-
customPropertiesNames?.invoicerow?.[limeCrmKey] || limeCrmKey
|
|
195
|
-
] = getLimeCrmValue(data, customPropertiesNames);
|
|
196
|
-
}
|
|
197
|
-
limeCrmData.push(invoiceRow);
|
|
198
|
-
|
|
199
|
-
return limeCrmData;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { FortnoxTransformer } from './fortnox';
|