@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
|
@@ -4,33 +4,74 @@ import {
|
|
|
4
4
|
INodeProperties,
|
|
5
5
|
INodeType,
|
|
6
6
|
INodeTypeDescription,
|
|
7
|
-
|
|
7
|
+
NodeConnectionTypes,
|
|
8
8
|
NodePropertyTypes,
|
|
9
9
|
} from 'n8n-workflow';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from './resources/erpConnector';
|
|
15
|
-
import { limeTypeFields, limeTypeOperations } from './resources/limeType';
|
|
16
|
-
import { limeObjectFields, limeObjectOperations } from './resources/limeObject';
|
|
17
|
-
import { queryFields, queryOperations } from './resources/limeQuery';
|
|
11
|
+
import { metadataFields, metadataOperations } from './resources/metadata';
|
|
12
|
+
import { adminFields, adminOperations } from './resources/admin';
|
|
13
|
+
import { dataFields, dataOperations } from './resources/data';
|
|
18
14
|
|
|
19
15
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
ADMIN_RESOURCE,
|
|
17
|
+
DATA_RESOURCE,
|
|
18
|
+
METADATA_RESOURCE,
|
|
22
19
|
LIME_CRM_API_CREDENTIAL_KEY,
|
|
23
|
-
|
|
24
|
-
LIME_QUERY_RESOURCE,
|
|
25
|
-
} from './commons';
|
|
20
|
+
} from './models';
|
|
26
21
|
|
|
27
22
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
getFileProperties,
|
|
24
|
+
getLimetypeProperties,
|
|
25
|
+
getLimetypes,
|
|
26
|
+
getNoHasManyProperties,
|
|
31
27
|
} from './methods';
|
|
32
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Representation of a function that executes a specific Lime CRM operation.
|
|
31
|
+
*
|
|
32
|
+
* This function type is used by the Lime CRM node to dynamically invoke
|
|
33
|
+
* the appropriate handler (e.g., metadata or data operations) during node execution.
|
|
34
|
+
*
|
|
35
|
+
* @param this - The n8n {@link IExecuteFunctions} context, providing access to
|
|
36
|
+
* node parameters, credentials, and helper methods.
|
|
37
|
+
* @param args - The arguments used for the operation.
|
|
38
|
+
* @param args.operation - The name of the operation to execute (e.g., "getAll", "create").
|
|
39
|
+
* @param args.i - The index of the current item being processed in the n8n execution loop.
|
|
40
|
+
*
|
|
41
|
+
* @returns A promise that resolves with the result of the operation.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
* @group Node Definition
|
|
45
|
+
*/
|
|
46
|
+
type OperationFn = (
|
|
47
|
+
this: IExecuteFunctions,
|
|
48
|
+
args: { operation: string; i: number }
|
|
49
|
+
) => Promise<unknown>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The main n8n node for interacting with the Lime CRM API.
|
|
53
|
+
*
|
|
54
|
+
* Provides two resource groups:
|
|
55
|
+
* - **Metadata**: Allows interaction with the structure of available Limetypes and their properties.
|
|
56
|
+
* - **Data**: Enables operations on Lime CRM data objects.
|
|
57
|
+
*
|
|
58
|
+
* The node dynamically loads available Lime CRM resources and properties and routes
|
|
59
|
+
* executions to the appropriate operation handlers.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* This node uses {@link metadataOperations} and {@link dataOperations} to process workflow executions
|
|
63
|
+
* based on the selected resource and operation.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
* @group Node Definition
|
|
67
|
+
*/
|
|
33
68
|
export class LimeCrmNode implements INodeType {
|
|
69
|
+
/**
|
|
70
|
+
* Node configuration and metadata, defining available resources, operations, and credentials.
|
|
71
|
+
* Describes how the Lime CRM node appears and behaves in the n8n editor.
|
|
72
|
+
*
|
|
73
|
+
* @see {@link https://docs.n8n.io/integrations/creating-nodes/#node-description}
|
|
74
|
+
*/
|
|
34
75
|
description: INodeTypeDescription = {
|
|
35
76
|
displayName: 'Lime CRM',
|
|
36
77
|
name: 'limeCrm',
|
|
@@ -43,14 +84,15 @@ export class LimeCrmNode implements INodeType {
|
|
|
43
84
|
defaults: {
|
|
44
85
|
name: 'Lime CRM',
|
|
45
86
|
},
|
|
46
|
-
inputs: [
|
|
47
|
-
outputs: [
|
|
87
|
+
inputs: [NodeConnectionTypes.Main],
|
|
88
|
+
outputs: [NodeConnectionTypes.Main],
|
|
48
89
|
credentials: [
|
|
49
90
|
{
|
|
50
91
|
name: LIME_CRM_API_CREDENTIAL_KEY,
|
|
51
92
|
required: true,
|
|
52
93
|
},
|
|
53
94
|
],
|
|
95
|
+
usableAsTool: true,
|
|
54
96
|
properties: [
|
|
55
97
|
{
|
|
56
98
|
displayName: 'Resource',
|
|
@@ -59,89 +101,104 @@ export class LimeCrmNode implements INodeType {
|
|
|
59
101
|
noDataExpression: true,
|
|
60
102
|
options: [
|
|
61
103
|
{
|
|
62
|
-
name: '
|
|
63
|
-
value:
|
|
64
|
-
description:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
name: 'Lime Object',
|
|
68
|
-
value: LIMEOBJECT_RESOURCE,
|
|
69
|
-
description: 'Work with actual data records',
|
|
104
|
+
name: 'Metadata',
|
|
105
|
+
value: METADATA_RESOURCE,
|
|
106
|
+
description:
|
|
107
|
+
'Work with the structure of available ' +
|
|
108
|
+
'Limetypes and their properties',
|
|
70
109
|
},
|
|
71
110
|
{
|
|
72
|
-
name: '
|
|
73
|
-
value:
|
|
74
|
-
description: '
|
|
111
|
+
name: 'Data',
|
|
112
|
+
value: DATA_RESOURCE,
|
|
113
|
+
description: 'Work with CRM data',
|
|
75
114
|
},
|
|
76
115
|
{
|
|
77
|
-
name: '
|
|
78
|
-
value:
|
|
79
|
-
description:
|
|
80
|
-
'Easily gather a particular set of limeobjects',
|
|
116
|
+
name: 'Admin',
|
|
117
|
+
value: ADMIN_RESOURCE,
|
|
118
|
+
description: 'Work with administrative data',
|
|
81
119
|
},
|
|
82
120
|
],
|
|
83
|
-
default:
|
|
121
|
+
default: DATA_RESOURCE,
|
|
84
122
|
},
|
|
85
123
|
|
|
86
|
-
...(
|
|
87
|
-
...(
|
|
88
|
-
...(
|
|
89
|
-
...(queryFields as INodeProperties[]),
|
|
124
|
+
...(metadataFields as INodeProperties[]),
|
|
125
|
+
...(dataFields as INodeProperties[]),
|
|
126
|
+
...(adminFields as INodeProperties[]),
|
|
90
127
|
],
|
|
91
128
|
};
|
|
92
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Methods used by the Lime CRM node to load dynamic options in the n8n UI.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* These functions are used to populate dropdowns and lists in the node's
|
|
135
|
+
* parameter editor. For details, see:
|
|
136
|
+
* - {@link getLimetypes}
|
|
137
|
+
* - {@link getFileProperties}
|
|
138
|
+
* - {@link getLimetypeProperties}
|
|
139
|
+
* - {@link getNoHasManyProperties}
|
|
140
|
+
*/
|
|
93
141
|
methods = {
|
|
94
142
|
loadOptions: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
143
|
+
getLimetypes,
|
|
144
|
+
getLimetypeProperties,
|
|
145
|
+
getFileProperties,
|
|
146
|
+
getNoHasManyProperties,
|
|
98
147
|
},
|
|
99
148
|
};
|
|
100
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Execute the selected operation for the configured resource.
|
|
152
|
+
*
|
|
153
|
+
* Routes the execution to either {@link metadataOperations} or {@link dataOperations},
|
|
154
|
+
* based on the user’s selection in the n8n UI.
|
|
155
|
+
*
|
|
156
|
+
* @returns A two-dimensional array of execution data for downstream nodes.
|
|
157
|
+
*
|
|
158
|
+
* @throws Error - Will throw an error if execution fails and `continueOnFail` is not enabled
|
|
159
|
+
*/
|
|
101
160
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
102
161
|
const items = this.getInputData();
|
|
103
|
-
|
|
162
|
+
let returnData: INodeExecutionData[] = [];
|
|
104
163
|
|
|
105
164
|
const resource = this.getNodeParameter('resource', 0) as string;
|
|
106
165
|
const operation = this.getNodeParameter('operation', 0) as string;
|
|
107
166
|
|
|
167
|
+
let operationFn: OperationFn | undefined;
|
|
168
|
+
switch (resource) {
|
|
169
|
+
case METADATA_RESOURCE: {
|
|
170
|
+
operationFn = metadataOperations;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
case DATA_RESOURCE: {
|
|
174
|
+
operationFn = dataOperations;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case ADMIN_RESOURCE: {
|
|
178
|
+
operationFn = adminOperations;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
108
183
|
for (let i = 0; i < items.length; i++) {
|
|
109
|
-
|
|
184
|
+
if (!operationFn) continue;
|
|
110
185
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
responseData = await limeObjectOperations.call(this, {
|
|
118
|
-
operation,
|
|
119
|
-
i,
|
|
120
|
-
});
|
|
121
|
-
} else if (resource === ERP_CONNECTOR_RESOURCE) {
|
|
122
|
-
responseData = await erpConnectorOperations.call(this, {
|
|
123
|
-
operation,
|
|
124
|
-
i,
|
|
125
|
-
});
|
|
126
|
-
} else if (resource === LIME_QUERY_RESOURCE) {
|
|
127
|
-
responseData = await queryOperations.call(this, {
|
|
128
|
-
operation,
|
|
129
|
-
i,
|
|
130
|
-
});
|
|
186
|
+
const responseData = (await operationFn.call(this, {
|
|
187
|
+
operation,
|
|
188
|
+
i,
|
|
189
|
+
})) as INodeExecutionData | INodeExecutionData[] | undefined;
|
|
190
|
+
if (responseData !== undefined) {
|
|
191
|
+
returnData = returnData.concat(responseData);
|
|
131
192
|
}
|
|
132
|
-
|
|
133
|
-
returnData.push({ json: responseData });
|
|
134
193
|
} catch (error) {
|
|
135
194
|
if (this.continueOnFail()) {
|
|
136
|
-
returnData.push({
|
|
137
|
-
error: error.message,
|
|
138
|
-
json: { error: error.message },
|
|
139
|
-
});
|
|
195
|
+
returnData.push({ json: {}, error: error.message });
|
|
140
196
|
continue;
|
|
141
197
|
}
|
|
142
198
|
throw error;
|
|
143
199
|
}
|
|
144
200
|
}
|
|
201
|
+
|
|
145
202
|
return [this.helpers.returnJsonArray(returnData)];
|
|
146
203
|
}
|
|
147
204
|
}
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
IWebhookResponseData,
|
|
8
8
|
NodeOperationError,
|
|
9
9
|
LoggerProxy as Logger,
|
|
10
|
-
|
|
10
|
+
NodeConnectionTypes,
|
|
11
11
|
} from 'n8n-workflow';
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { LIME_CRM_API_CREDENTIAL_KEY } from './models';
|
|
14
|
+
import { getLimetypes } from './methods';
|
|
15
15
|
import {
|
|
16
16
|
createSubscription,
|
|
17
17
|
deleteSubscription,
|
|
@@ -19,9 +19,32 @@ import {
|
|
|
19
19
|
listSubscriptionsWithExistingData,
|
|
20
20
|
} from './transport';
|
|
21
21
|
|
|
22
|
-
import { verifyHmac } from './
|
|
22
|
+
import { getWebhook, verifyHmac } from './utils';
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Trigger node for handling incoming webhooks from **Lime CRM**.
|
|
26
|
+
*
|
|
27
|
+
* This node subscribes to events in Lime (such as record creation, update, or deletion)
|
|
28
|
+
* and triggers workflows in n8n when those events occur.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* - Automatically manages webhook subscriptions in Lime CRM (create, check, delete).
|
|
32
|
+
* - Verifies incoming webhook authenticity using HMAC signatures.
|
|
33
|
+
* - Returns the received payload as JSON to connected nodes.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
* @group Node Definition
|
|
37
|
+
*
|
|
38
|
+
* @see {@link getSubscription} - Fetches an existing webhook subscription
|
|
39
|
+
* @see {@link listSubscriptionsWithExistingData} - Checks for existing subscriptions matching the same target URL and events
|
|
40
|
+
* @see {@link createSubscription} - Creates a new webhook subscription in Lime
|
|
41
|
+
* @see {@link deleteSubscription} - Removes an existing webhook subscription
|
|
42
|
+
*/
|
|
24
43
|
export class LimeCrmTrigger implements INodeType {
|
|
44
|
+
/**
|
|
45
|
+
* Definition of the node’s metadata, input/output configuration,
|
|
46
|
+
* authentication requirements, and event subscription options.
|
|
47
|
+
*/
|
|
25
48
|
description: INodeTypeDescription = {
|
|
26
49
|
displayName: 'Lime CRM Trigger',
|
|
27
50
|
name: 'limeCrmTrigger',
|
|
@@ -30,12 +53,12 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
30
53
|
version: 1,
|
|
31
54
|
description:
|
|
32
55
|
'Trigger which handles webhooks coming from Lime, e.g when ' +
|
|
33
|
-
'
|
|
56
|
+
'an object is updated',
|
|
34
57
|
defaults: {
|
|
35
58
|
name: 'Lime CRM Trigger',
|
|
36
59
|
},
|
|
37
60
|
inputs: [],
|
|
38
|
-
outputs: [
|
|
61
|
+
outputs: [NodeConnectionTypes.Main],
|
|
39
62
|
credentials: [
|
|
40
63
|
{
|
|
41
64
|
name: LIME_CRM_API_CREDENTIAL_KEY,
|
|
@@ -68,18 +91,18 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
68
91
|
displayName: 'Event',
|
|
69
92
|
values: [
|
|
70
93
|
{
|
|
71
|
-
displayName: '
|
|
72
|
-
name: '
|
|
94
|
+
displayName: 'Limetype',
|
|
95
|
+
name: 'limetype',
|
|
73
96
|
type: 'options',
|
|
74
97
|
typeOptions: {
|
|
75
|
-
loadOptionsMethod: '
|
|
98
|
+
loadOptionsMethod: 'getLimetypes',
|
|
76
99
|
},
|
|
77
100
|
default: '',
|
|
78
101
|
description:
|
|
79
|
-
'
|
|
102
|
+
'Limetype to subscribe to events for',
|
|
80
103
|
},
|
|
81
104
|
{
|
|
82
|
-
displayName: 'Event
|
|
105
|
+
displayName: 'Event',
|
|
83
106
|
name: 'eventType',
|
|
84
107
|
type: 'options',
|
|
85
108
|
options: [
|
|
@@ -87,44 +110,49 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
87
110
|
name: 'New',
|
|
88
111
|
value: 'new',
|
|
89
112
|
description:
|
|
90
|
-
'When a new
|
|
113
|
+
'When a new object is created',
|
|
91
114
|
},
|
|
92
115
|
{
|
|
93
116
|
name: 'Update',
|
|
94
117
|
value: 'update',
|
|
95
|
-
description:
|
|
118
|
+
description:
|
|
119
|
+
'When an object is updated',
|
|
96
120
|
},
|
|
97
121
|
{
|
|
98
122
|
name: 'Delete',
|
|
99
123
|
value: 'delete',
|
|
100
|
-
description:
|
|
124
|
+
description:
|
|
125
|
+
'When an object is deleted',
|
|
101
126
|
},
|
|
102
127
|
],
|
|
103
128
|
default: 'new',
|
|
104
|
-
description: '
|
|
129
|
+
description: 'Event to subscribe to',
|
|
105
130
|
},
|
|
106
131
|
],
|
|
107
132
|
},
|
|
108
133
|
],
|
|
109
134
|
},
|
|
110
|
-
{
|
|
111
|
-
displayName: 'Name',
|
|
112
|
-
name: 'name',
|
|
113
|
-
type: 'string',
|
|
114
|
-
default: '',
|
|
115
|
-
placeholder: 'my-lime-webhook',
|
|
116
|
-
required: true,
|
|
117
|
-
description: 'Name for this webhook subscription',
|
|
118
|
-
},
|
|
119
135
|
],
|
|
120
136
|
};
|
|
121
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Methods used to dynamically load options in the node UI. For details, see:
|
|
140
|
+
*
|
|
141
|
+
* - {@link getLimetypes}
|
|
142
|
+
*/
|
|
122
143
|
methods = {
|
|
123
144
|
loadOptions: {
|
|
124
|
-
|
|
145
|
+
getLimetypes,
|
|
125
146
|
},
|
|
126
147
|
};
|
|
127
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Webhook lifecycle management methods:
|
|
151
|
+
*
|
|
152
|
+
* - checkExists - Verifies whether the webhook already exists in Lime CRM
|
|
153
|
+
* - create - Creates a new webhook subscription in Lime CRM if one does not exist
|
|
154
|
+
* - delete - Deletes the existing webhook subscription in Lime CRM
|
|
155
|
+
*/
|
|
128
156
|
webhookMethods = {
|
|
129
157
|
default: {
|
|
130
158
|
async checkExists(this: IHookFunctions): Promise<boolean> {
|
|
@@ -134,20 +162,18 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
134
162
|
return false;
|
|
135
163
|
}
|
|
136
164
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
165
|
+
try {
|
|
166
|
+
await getSubscription(this, webhook);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
if (error.cause?.status === 404) {
|
|
140
169
|
delete webhook.data.webhookId;
|
|
141
170
|
delete webhook.data.webhookEvents;
|
|
142
171
|
return false;
|
|
143
172
|
}
|
|
144
173
|
Logger.warn(
|
|
145
|
-
`There was en error while getting a webhook from Lime CRM: ${
|
|
146
|
-
);
|
|
147
|
-
throw new NodeOperationError(
|
|
148
|
-
this.getNode(),
|
|
149
|
-
response.error
|
|
174
|
+
`There was en error while getting a webhook from Lime CRM: ${error}`
|
|
150
175
|
);
|
|
176
|
+
throw new NodeOperationError(this.getNode(), error);
|
|
151
177
|
}
|
|
152
178
|
return true;
|
|
153
179
|
},
|
|
@@ -165,17 +191,10 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
165
191
|
// Check if a webhook already exists in order to not duplicate it in Lime
|
|
166
192
|
// This is a different check then 'checkExists' which only takes an ID,
|
|
167
193
|
// but it's only suited for production environment
|
|
168
|
-
|
|
169
194
|
const existingSubscriptionResponse =
|
|
170
195
|
await listSubscriptionsWithExistingData(this, webhook);
|
|
171
|
-
if (!existingSubscriptionResponse.success) {
|
|
172
|
-
throw new NodeOperationError(
|
|
173
|
-
this.getNode(),
|
|
174
|
-
existingSubscriptionResponse.error
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
196
|
|
|
178
|
-
if (existingSubscriptionResponse.
|
|
197
|
+
if (existingSubscriptionResponse.length === 0) {
|
|
179
198
|
const credentials = await this.getCredentials(
|
|
180
199
|
LIME_CRM_API_CREDENTIAL_KEY
|
|
181
200
|
);
|
|
@@ -189,15 +208,8 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
189
208
|
webhookCreateData
|
|
190
209
|
);
|
|
191
210
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
this.getNode(),
|
|
195
|
-
createSubscriptionResponse.error
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const subscriptionId = createSubscriptionResponse.data.id;
|
|
200
|
-
const events = createSubscriptionResponse.data.events;
|
|
211
|
+
const subscriptionId = createSubscriptionResponse.id;
|
|
212
|
+
const events = createSubscriptionResponse.events;
|
|
201
213
|
|
|
202
214
|
webhook.data.webhookId = subscriptionId;
|
|
203
215
|
webhook.data.webhookEvents = events;
|
|
@@ -206,7 +218,7 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
206
218
|
);
|
|
207
219
|
return true;
|
|
208
220
|
} else {
|
|
209
|
-
const limeWebhook = existingSubscriptionResponse
|
|
221
|
+
const limeWebhook = existingSubscriptionResponse[0];
|
|
210
222
|
webhook.data.webhookId = limeWebhook.id;
|
|
211
223
|
webhook.data.webhookEvents = limeWebhook.events;
|
|
212
224
|
Logger.info(
|
|
@@ -224,8 +236,9 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
224
236
|
{ ...webhook }
|
|
225
237
|
);
|
|
226
238
|
if (webhook.data.webhookId !== undefined) {
|
|
227
|
-
|
|
228
|
-
|
|
239
|
+
try {
|
|
240
|
+
await deleteSubscription(this, webhook);
|
|
241
|
+
} catch {
|
|
229
242
|
Logger.error(
|
|
230
243
|
`Failed to delete webhook with ID: ${webhook.data.webhookId}`,
|
|
231
244
|
{
|
|
@@ -243,6 +256,26 @@ export class LimeCrmTrigger implements INodeType {
|
|
|
243
256
|
},
|
|
244
257
|
};
|
|
245
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Main webhook handler — called when Lime CRM sends an event to this node.
|
|
261
|
+
*
|
|
262
|
+
* @returns The formatted webhook response data ready for n8n workflow processing.
|
|
263
|
+
*
|
|
264
|
+
* @throws NodeOperationError if authentication fails or webhook data is invalid.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* // Example webhook body:
|
|
269
|
+
* {
|
|
270
|
+
* "event": "deal.new",
|
|
271
|
+
* "body": {
|
|
272
|
+
* "id": 1001,
|
|
273
|
+
* "limetype": "deal",
|
|
274
|
+
* "values": { "company": 1001, "coworker": 1001, "probability": 0, ... }
|
|
275
|
+
* }
|
|
276
|
+
* }
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
246
279
|
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
|
247
280
|
const webhook = getWebhook(this);
|
|
248
281
|
Logger.info('Webhook received. Starting webhook processing...', {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './utils';
|
|
2
|
+
export * from './methods';
|
|
3
|
+
export * from './models';
|
|
4
|
+
export * from './resources/data';
|
|
5
|
+
export * from './resources/metadata';
|
|
6
|
+
export * from './resources/admin';
|
|
7
|
+
export * from './transport';
|
|
8
|
+
export * from './LimeCrmNode.node';
|
|
9
|
+
export * from './LimeCrmTrigger.node';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ILoadOptionsFunctions,
|
|
3
|
+
INodePropertyOptions,
|
|
4
|
+
LoggerProxy as Logger,
|
|
5
|
+
} from 'n8n-workflow';
|
|
6
|
+
import { getProperties } from '../transport/';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Fetch all properties for a specific Lime type.
|
|
10
|
+
*
|
|
11
|
+
* This is an internal helper function used by other load-options methods.
|
|
12
|
+
* It calls the Lime API to retrieve properties for the selected Limetype.
|
|
13
|
+
*
|
|
14
|
+
* @param nodeContext - The n8n load options context
|
|
15
|
+
* @returns An array of properties if successful, or an empty array otherwise.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
* @group Load Options Methods
|
|
19
|
+
*/
|
|
20
|
+
async function fetchAllProperties(nodeContext: ILoadOptionsFunctions) {
|
|
21
|
+
const limetype = nodeContext.getNodeParameter('limetype', '') as string;
|
|
22
|
+
Logger.info(`Fetching file properties for Lime type: ${limetype}`);
|
|
23
|
+
if (!limetype) return [];
|
|
24
|
+
try {
|
|
25
|
+
return await getProperties(nodeContext, limetype);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
Logger.warn(`There was a problem with fetching properties: ${error}`);
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Gets property options from a specific Limetype
|
|
34
|
+
*
|
|
35
|
+
* It's not meant to be used directly in 'loadOptionsMethod'
|
|
36
|
+
*
|
|
37
|
+
* This function fetches properties for the specified Limetype and optionally filters them
|
|
38
|
+
* based on allowed types.
|
|
39
|
+
*
|
|
40
|
+
* @param [loader] - The n8n load options context
|
|
41
|
+
* @param [allowedTypes] - Optional set of property types to filter by
|
|
42
|
+
* @param [forbiddenType] - Optional set of property types to exclude
|
|
43
|
+
* @returns Array of formatted property options
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
* @group Load Options Methods
|
|
47
|
+
*/
|
|
48
|
+
export async function getFilteredLimetypeProperties(
|
|
49
|
+
loader: ILoadOptionsFunctions,
|
|
50
|
+
allowedTypes?: Set<string>,
|
|
51
|
+
forbiddenType?: Set<string>
|
|
52
|
+
): Promise<INodePropertyOptions[]> {
|
|
53
|
+
const properties = await fetchAllProperties(loader);
|
|
54
|
+
|
|
55
|
+
return properties
|
|
56
|
+
.filter(
|
|
57
|
+
(property) =>
|
|
58
|
+
(!allowedTypes || allowedTypes.has(property.type)) &&
|
|
59
|
+
(!forbiddenType || !forbiddenType.has(property.type))
|
|
60
|
+
)
|
|
61
|
+
.map((property) => ({
|
|
62
|
+
name: (property.localname as string) || (property.name as string),
|
|
63
|
+
value: property.name as string,
|
|
64
|
+
description: `Type: ${property.type as string} | Name: ${property.name as string}${(property.required as boolean) ? ' (Required)' : ''}`,
|
|
65
|
+
type: property.type,
|
|
66
|
+
}))
|
|
67
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get all property options for the current Limetype.
|
|
72
|
+
*
|
|
73
|
+
* @returns Array of property options for the current Limetype.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
* @group Load Options Methods
|
|
77
|
+
*/
|
|
78
|
+
export async function getLimetypeProperties(
|
|
79
|
+
this: ILoadOptionsFunctions
|
|
80
|
+
): Promise<INodePropertyOptions[]> {
|
|
81
|
+
return getFilteredLimetypeProperties(this);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get only file property options for the current Limetype.
|
|
86
|
+
*
|
|
87
|
+
* @returns Array of file property options
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
* @group Load Options Methods
|
|
91
|
+
*/
|
|
92
|
+
export async function getFileProperties(
|
|
93
|
+
this: ILoadOptionsFunctions
|
|
94
|
+
): Promise<INodePropertyOptions[]> {
|
|
95
|
+
return getFilteredLimetypeProperties(this, new Set(['file']));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get property options excluding those of type 'hasmany'.
|
|
100
|
+
*
|
|
101
|
+
* @returns Array of property options excluding 'hasmany' types
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
* @group Load Options Methods
|
|
105
|
+
*/
|
|
106
|
+
export async function getNoHasManyProperties(
|
|
107
|
+
this: ILoadOptionsFunctions
|
|
108
|
+
): Promise<INodePropertyOptions[]> {
|
|
109
|
+
return getFilteredLimetypeProperties(this, undefined, new Set(['hasmany']));
|
|
110
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
2
|
+
import { getLimetypesFromApi } from '../transport';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Load available Limetypes from the API
|
|
6
|
+
*
|
|
7
|
+
* @returns Array of Limetypes options
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @group Load Options Methods
|
|
11
|
+
*/
|
|
12
|
+
export async function getLimetypes(
|
|
13
|
+
this: ILoadOptionsFunctions
|
|
14
|
+
): Promise<INodePropertyOptions[]> {
|
|
15
|
+
const data: INodePropertyOptions[] = [];
|
|
16
|
+
const response = await getLimetypesFromApi(this);
|
|
17
|
+
|
|
18
|
+
for (const limetype of response) {
|
|
19
|
+
data.push({
|
|
20
|
+
name: limetype.localname?.singular || limetype.name,
|
|
21
|
+
value: limetype.name,
|
|
22
|
+
description: limetype.name,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return data.sort((a, b) => a.name.localeCompare(b.name));
|
|
26
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
export { getLimetypes } from './getLimetypes';
|
|
2
|
+
export {
|
|
3
|
+
getFileProperties,
|
|
4
|
+
getFilteredLimetypeProperties,
|
|
5
|
+
getLimetypeProperties,
|
|
6
|
+
getNoHasManyProperties,
|
|
7
|
+
} from './getLimetypeProperties';
|