@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
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
import { IncludedProperties, queryLimeobjects } from '../../../transport';
|
|
4
|
+
import { DATA_RESOURCE, DEFAULT_API_OBJECT_LIMIT } from '../../../models';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Description and metadata for the "Get Many Objects" operation in Lime CRM.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const description = {
|
|
12
|
+
name: 'Get Many Objects',
|
|
13
|
+
value: 'getManyObjects',
|
|
14
|
+
description: 'Get a list of many objects',
|
|
15
|
+
action: 'Get many objects',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of objects to fetch in a single API request.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
const BATCHSIZE = 200;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Structure of the response format when querying Lime CRM objects.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* This is used to define which properties are included in the API response.
|
|
29
|
+
* The keys of the `object` correspond to property names of the entity,
|
|
30
|
+
* and the values are initialized as empty strings.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* {
|
|
34
|
+
* object: {
|
|
35
|
+
* _id: '',
|
|
36
|
+
* name: '',
|
|
37
|
+
* phone: ''
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
interface ResponseFormat {
|
|
44
|
+
object: {
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Defines a collection of properties to order query results by.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Each entry specifies a property name and the direction in which the results
|
|
54
|
+
* should be sorted. Multiple fields can be provided to perform multi-level sorting.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* {
|
|
58
|
+
* orderByFields: [
|
|
59
|
+
* { propertyName: 'name', sortDirection: 'ASC' },
|
|
60
|
+
* { propertyName: 'createdAt', sortDirection: 'DESC' }
|
|
61
|
+
* ]
|
|
62
|
+
* }
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
interface OrderByCollection {
|
|
67
|
+
orderByFields: {
|
|
68
|
+
propertyName: string;
|
|
69
|
+
sortDirection: 'ASC' | 'DESC';
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Node properties for the "Get Many Objects" operation.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} limetype - The type of entity to query. Loaded from available Limetypes
|
|
77
|
+
* @param {'fields' | 'json'} responseFormatInputMethod - How to format the response
|
|
78
|
+
* @param {Array<{ name: string }>} responseFormatProperties - The properties to include if using 'fields'
|
|
79
|
+
* @param {string} responseFormatJson - JSON defining the response structure if using 'json'
|
|
80
|
+
* @param {string} filter - JSON defining filtering conditions
|
|
81
|
+
* @param {number} limit - Maximum number of objects to return
|
|
82
|
+
* @param {'fields' | 'json'} orderByInputMethod - How to specify ordering
|
|
83
|
+
* @param {OrderByCollection} orderByProperties - Order by fields if using 'fields'
|
|
84
|
+
* @param {string} orderByJson - JSON defining ordering if using 'json'
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export const properties: INodeProperties[] = [
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Limetype',
|
|
91
|
+
name: 'limetype',
|
|
92
|
+
type: 'options',
|
|
93
|
+
typeOptions: {
|
|
94
|
+
loadOptionsMethod: 'getLimetypes',
|
|
95
|
+
},
|
|
96
|
+
required: true,
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'The type of entity to query',
|
|
99
|
+
displayOptions: {
|
|
100
|
+
show: {
|
|
101
|
+
resource: [DATA_RESOURCE],
|
|
102
|
+
operation: ['getManyObjects'],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Response Format',
|
|
108
|
+
name: 'responseFormatInputMethod',
|
|
109
|
+
type: 'options',
|
|
110
|
+
required: true,
|
|
111
|
+
default: 'fields',
|
|
112
|
+
description: 'Select how the response should be formatted',
|
|
113
|
+
displayOptions: {
|
|
114
|
+
show: {
|
|
115
|
+
resource: [DATA_RESOURCE],
|
|
116
|
+
operation: ['getManyObjects'],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
options: [
|
|
120
|
+
{
|
|
121
|
+
name: 'Properties',
|
|
122
|
+
value: 'fields',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'JSON',
|
|
126
|
+
value: 'json',
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
displayName: 'Response Format (Form Fields)',
|
|
132
|
+
name: 'responseFormatProperties',
|
|
133
|
+
type: 'fixedCollection',
|
|
134
|
+
placeholder: 'Add Property',
|
|
135
|
+
typeOptions: {
|
|
136
|
+
multipleValues: true,
|
|
137
|
+
},
|
|
138
|
+
default: {},
|
|
139
|
+
displayOptions: {
|
|
140
|
+
show: {
|
|
141
|
+
resource: [DATA_RESOURCE],
|
|
142
|
+
operation: ['getManyObjects'],
|
|
143
|
+
responseFormatInputMethod: ['fields'],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
options: [
|
|
147
|
+
{
|
|
148
|
+
displayName: 'Property',
|
|
149
|
+
name: 'property',
|
|
150
|
+
values: [
|
|
151
|
+
{
|
|
152
|
+
displayName: 'Property Name',
|
|
153
|
+
name: 'name',
|
|
154
|
+
type: 'options',
|
|
155
|
+
typeOptions: {
|
|
156
|
+
sortable: true,
|
|
157
|
+
loadOptionsMethod: 'getNoHasManyProperties',
|
|
158
|
+
loadOptionsDependsOn: ['limetype'],
|
|
159
|
+
},
|
|
160
|
+
default: '',
|
|
161
|
+
description: 'Name of the property',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
displayName: 'Response Format (JSON)',
|
|
169
|
+
name: 'responseFormatJson',
|
|
170
|
+
type: 'json',
|
|
171
|
+
required: true,
|
|
172
|
+
default: '{\n\t"object": {\n\t\t"_id": ""\n\t}\n}',
|
|
173
|
+
description:
|
|
174
|
+
'Information included in the response when using JSON format',
|
|
175
|
+
displayOptions: {
|
|
176
|
+
show: {
|
|
177
|
+
resource: [DATA_RESOURCE],
|
|
178
|
+
operation: ['getManyObjects'],
|
|
179
|
+
responseFormatInputMethod: ['json'],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'Filter (JSON)',
|
|
185
|
+
name: 'filter',
|
|
186
|
+
type: 'json',
|
|
187
|
+
default: '{}',
|
|
188
|
+
description: "The filter DSL defining the query's conditions",
|
|
189
|
+
displayOptions: {
|
|
190
|
+
show: {
|
|
191
|
+
resource: [DATA_RESOURCE],
|
|
192
|
+
operation: ['getManyObjects'],
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
displayName: 'Limit',
|
|
198
|
+
name: 'limit',
|
|
199
|
+
type: 'number',
|
|
200
|
+
default: DEFAULT_API_OBJECT_LIMIT,
|
|
201
|
+
description: 'The maximum number of records to return',
|
|
202
|
+
displayOptions: {
|
|
203
|
+
show: {
|
|
204
|
+
resource: [DATA_RESOURCE],
|
|
205
|
+
operation: ['getManyObjects'],
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
displayName: 'Order By',
|
|
211
|
+
name: 'orderByInputMethod',
|
|
212
|
+
type: 'options',
|
|
213
|
+
required: true,
|
|
214
|
+
default: 'fields',
|
|
215
|
+
description: 'Select how the response should be ordered',
|
|
216
|
+
displayOptions: {
|
|
217
|
+
show: {
|
|
218
|
+
resource: [DATA_RESOURCE],
|
|
219
|
+
operation: ['getManyObjects'],
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
options: [
|
|
223
|
+
{
|
|
224
|
+
name: 'Form Fields',
|
|
225
|
+
value: 'fields',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'JSON',
|
|
229
|
+
value: 'json',
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
displayName: 'Order By (Form Fields)',
|
|
235
|
+
name: 'orderByProperties',
|
|
236
|
+
type: 'fixedCollection',
|
|
237
|
+
placeholder: 'Add Property',
|
|
238
|
+
typeOptions: {
|
|
239
|
+
multipleValues: true,
|
|
240
|
+
},
|
|
241
|
+
default: {},
|
|
242
|
+
description:
|
|
243
|
+
'The list of properties by which to order the query results',
|
|
244
|
+
displayOptions: {
|
|
245
|
+
show: {
|
|
246
|
+
resource: [DATA_RESOURCE],
|
|
247
|
+
operation: ['getManyObjects'],
|
|
248
|
+
orderByInputMethod: ['fields'],
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
options: [
|
|
252
|
+
{
|
|
253
|
+
name: 'orderByFields',
|
|
254
|
+
displayName: 'Order By Fields',
|
|
255
|
+
values: [
|
|
256
|
+
{
|
|
257
|
+
displayName: 'Property Name',
|
|
258
|
+
name: 'propertyName',
|
|
259
|
+
type: 'options',
|
|
260
|
+
required: true,
|
|
261
|
+
typeOptions: {
|
|
262
|
+
sortable: true,
|
|
263
|
+
loadOptionsMethod: 'getNoHasManyProperties',
|
|
264
|
+
loadOptionsDependsOn: ['limetype'],
|
|
265
|
+
},
|
|
266
|
+
default: '',
|
|
267
|
+
description: 'Name of the property to order by',
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
displayName: 'Sort Direction',
|
|
271
|
+
name: 'sortDirection',
|
|
272
|
+
type: 'options',
|
|
273
|
+
default: 'ASC',
|
|
274
|
+
description: 'Ordering direction',
|
|
275
|
+
options: [
|
|
276
|
+
{ name: 'Ascending', value: 'ASC' },
|
|
277
|
+
{ name: 'Descending', value: 'DESC' },
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
displayName: 'Order By (JSON)',
|
|
286
|
+
name: 'orderByJson',
|
|
287
|
+
type: 'json',
|
|
288
|
+
required: true,
|
|
289
|
+
default: '[\n\t{\n\t\t"_id": "ASC"\n\t}\n]',
|
|
290
|
+
description: 'Provide ordering in JSON',
|
|
291
|
+
displayOptions: {
|
|
292
|
+
show: {
|
|
293
|
+
resource: [DATA_RESOURCE],
|
|
294
|
+
operation: ['getManyObjects'],
|
|
295
|
+
orderByInputMethod: ['json'],
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
];
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Create the response format object when using 'fields' mode.
|
|
303
|
+
*
|
|
304
|
+
* @remarks
|
|
305
|
+
* This function takes an array of property descriptors (each with a `name` field)
|
|
306
|
+
* and constructs a response object suitable for Lime CRM queries. It initializes
|
|
307
|
+
* each property with an empty string, ensuring that all requested fields are
|
|
308
|
+
* included in the response, even if the values are not yet set.
|
|
309
|
+
*
|
|
310
|
+
* Additionally, it always includes a default `_id` field in the response object,
|
|
311
|
+
* which is typically required by Lime CRM for object identification.
|
|
312
|
+
*
|
|
313
|
+
* Example:
|
|
314
|
+
* ```ts
|
|
315
|
+
* createResponseFormatObject([{ name: 'name' }, { name: 'email' }]);
|
|
316
|
+
* // Returns: { object: { _id: '', name: '', email: '' } }
|
|
317
|
+
* ```
|
|
318
|
+
*
|
|
319
|
+
* @param properties - Array of property descriptors.
|
|
320
|
+
* @returns The ResponseFormat object.
|
|
321
|
+
*
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
function createResponseFormatObject(
|
|
325
|
+
properties: { name: string }[] = []
|
|
326
|
+
): ResponseFormat {
|
|
327
|
+
const object: Record<string, string> = { _id: '' };
|
|
328
|
+
for (const { name } of properties) {
|
|
329
|
+
if (name) object[name] = '';
|
|
330
|
+
}
|
|
331
|
+
return { object };
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Generate the ordering array for Lime CRM queries.
|
|
336
|
+
*
|
|
337
|
+
* @remarks
|
|
338
|
+
* This function transforms a user-provided `OrderByCollection` object into the
|
|
339
|
+
* format required by the Lime CRM API. Each property in `orderByFields` is
|
|
340
|
+
* converted into a key-value pair where the key is the property name and the
|
|
341
|
+
* value is the sort direction ('ASC' or 'DESC').
|
|
342
|
+
*
|
|
343
|
+
* If no `orderByFields` are provided, it defaults to ordering by `_id` ascending.
|
|
344
|
+
*
|
|
345
|
+
* Example:
|
|
346
|
+
* ```ts
|
|
347
|
+
* getOrderBy({
|
|
348
|
+
* orderByFields: [
|
|
349
|
+
* { propertyName: 'name', sortDirection: 'ASC' },
|
|
350
|
+
* { propertyName: 'createdAt', sortDirection: 'DESC' },
|
|
351
|
+
* ]
|
|
352
|
+
* });
|
|
353
|
+
* // Returns: [{ name: 'ASC' }, { createdAt: 'DESC' }]
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* @param orderByCollection - Collection of order-by fields provided by the user.
|
|
357
|
+
* @returns An array of objects representing the order-by configuration for Lime CRM.
|
|
358
|
+
*
|
|
359
|
+
* @internal
|
|
360
|
+
*/
|
|
361
|
+
function getOrderBy(orderByCollection: OrderByCollection) {
|
|
362
|
+
const orderBy =
|
|
363
|
+
orderByCollection.orderByFields &&
|
|
364
|
+
orderByCollection.orderByFields.map((field) => ({
|
|
365
|
+
[field.propertyName]: field.sortDirection,
|
|
366
|
+
}));
|
|
367
|
+
return orderBy || [{ _id: 'ASC' }];
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Fetch Lime CRM objects in batches to handle large result sets or unlimited queries.
|
|
372
|
+
*
|
|
373
|
+
* @remarks
|
|
374
|
+
* This function retrieves objects from Lime CRM for a given limetype by performing
|
|
375
|
+
* multiple sequential API calls, each fetching up to BATCHSIZE records.
|
|
376
|
+
*
|
|
377
|
+
* @param limetype - The type of Lime CRM entity to fetch
|
|
378
|
+
* @param responseFormat - The format in which objects should be returned, defining which properties are included
|
|
379
|
+
* @param filter - JSON string representing the filter conditions for the query
|
|
380
|
+
* @param limit - Maximum number of objects to fetch in this request
|
|
381
|
+
* @param orderBy - Array of objects defining the sorting of the results
|
|
382
|
+
*
|
|
383
|
+
* @returns Array of fetched objects or an error response as an array.
|
|
384
|
+
*/
|
|
385
|
+
async function fetchLimeObjects(
|
|
386
|
+
this: IExecuteFunctions,
|
|
387
|
+
limetype: string,
|
|
388
|
+
responseFormat: ResponseFormat,
|
|
389
|
+
filter: string,
|
|
390
|
+
limit: number | null,
|
|
391
|
+
orderBy: Record<string, 'ASC' | 'DESC'>[]
|
|
392
|
+
): Promise<IncludedProperties[]> {
|
|
393
|
+
const allResults: IncludedProperties[] = [];
|
|
394
|
+
const parsedFilter = JSON.parse(filter);
|
|
395
|
+
const unlimited = limit === null || limit === 0;
|
|
396
|
+
const targetLimit = unlimited ? Infinity : limit;
|
|
397
|
+
|
|
398
|
+
let fetched = 0;
|
|
399
|
+
let currentOffset = 0;
|
|
400
|
+
|
|
401
|
+
while (fetched < targetLimit) {
|
|
402
|
+
const currentLimit =
|
|
403
|
+
targetLimit === Infinity
|
|
404
|
+
? BATCHSIZE
|
|
405
|
+
: Math.min(BATCHSIZE, targetLimit - fetched);
|
|
406
|
+
|
|
407
|
+
const q = JSON.stringify({
|
|
408
|
+
limetype,
|
|
409
|
+
responseFormat: responseFormat,
|
|
410
|
+
filter: parsedFilter,
|
|
411
|
+
limit: currentLimit,
|
|
412
|
+
offset: currentOffset,
|
|
413
|
+
orderBy: orderBy,
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
const batch = await queryLimeobjects(this, q);
|
|
417
|
+
|
|
418
|
+
const collected = batch.objects.length;
|
|
419
|
+
if (collected === 0) break;
|
|
420
|
+
|
|
421
|
+
allResults.push(...batch.objects);
|
|
422
|
+
|
|
423
|
+
fetched += collected;
|
|
424
|
+
currentOffset += collected;
|
|
425
|
+
|
|
426
|
+
if (collected < currentLimit) break;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return allResults;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Execute the "Get Many Objects" operation for Lime CRM.
|
|
434
|
+
*
|
|
435
|
+
* @remarks
|
|
436
|
+
* Retrieves multiple Lime CRM objects of the selected limetype with optional filtering, ordering, and response formatting.
|
|
437
|
+
* The method supports batch fetching if the requested limit exceeds 50 records.
|
|
438
|
+
*
|
|
439
|
+
* Steps performed by the method:
|
|
440
|
+
* 1. Determine the limetype and response format (fields or JSON) from {@link properties}.
|
|
441
|
+
* 2. Determine ordering (fields or JSON) from {@link properties}.
|
|
442
|
+
* 3. Fetch data from Lime CRM, handling batching if necessary.
|
|
443
|
+
*
|
|
444
|
+
* @param i - The index of the current item in the workflow execution
|
|
445
|
+
*
|
|
446
|
+
* @returns The fetched Lime objects as per the requested response format.
|
|
447
|
+
*
|
|
448
|
+
* @public
|
|
449
|
+
*/
|
|
450
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
451
|
+
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
452
|
+
const responseFormatInputMethod = this.getNodeParameter(
|
|
453
|
+
'responseFormatInputMethod',
|
|
454
|
+
i
|
|
455
|
+
) as string;
|
|
456
|
+
const orderByInputMethod = this.getNodeParameter(
|
|
457
|
+
'orderByInputMethod',
|
|
458
|
+
i
|
|
459
|
+
) as string;
|
|
460
|
+
const filter = this.getNodeParameter('filter', i) as string;
|
|
461
|
+
const limit = this.getNodeParameter(
|
|
462
|
+
'limit',
|
|
463
|
+
i,
|
|
464
|
+
DEFAULT_API_OBJECT_LIMIT
|
|
465
|
+
) as number;
|
|
466
|
+
|
|
467
|
+
let response;
|
|
468
|
+
if (responseFormatInputMethod === 'fields') {
|
|
469
|
+
const properties = this.getNodeParameter(
|
|
470
|
+
'responseFormatProperties',
|
|
471
|
+
i
|
|
472
|
+
) as { property: [{ name: string }] };
|
|
473
|
+
response = createResponseFormatObject(properties.property);
|
|
474
|
+
} else if (responseFormatInputMethod === 'json') {
|
|
475
|
+
response = this.getNodeParameter('responseFormatJson', i) as string;
|
|
476
|
+
response = JSON.parse(response);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
let orderBy;
|
|
480
|
+
if (orderByInputMethod === 'fields') {
|
|
481
|
+
const orderByCollection = this.getNodeParameter(
|
|
482
|
+
'orderByProperties',
|
|
483
|
+
i
|
|
484
|
+
) as OrderByCollection;
|
|
485
|
+
orderBy = getOrderBy(orderByCollection);
|
|
486
|
+
} else if (orderByInputMethod === 'json') {
|
|
487
|
+
orderBy = this.getNodeParameter('orderByJson', i) as string;
|
|
488
|
+
orderBy = JSON.parse(orderBy);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return await fetchLimeObjects.call(
|
|
492
|
+
this,
|
|
493
|
+
limetype,
|
|
494
|
+
response,
|
|
495
|
+
filter,
|
|
496
|
+
limit,
|
|
497
|
+
orderBy
|
|
498
|
+
);
|
|
499
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
NodeOperationError,
|
|
5
|
+
} from 'n8n-workflow';
|
|
6
|
+
import { getFileContent, getFileContentByLimetype } from '../../../transport';
|
|
7
|
+
import { DATA_RESOURCE } from '../../../models';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Description and metadata for the "Get Single File" operation in Lime CRM.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export const description = {
|
|
15
|
+
name: 'Get Single File',
|
|
16
|
+
value: 'getSingleFile',
|
|
17
|
+
description: 'Get the file data for one specific file',
|
|
18
|
+
action: 'Get single file',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Node properties for the "Get Single File" operation.
|
|
23
|
+
*
|
|
24
|
+
* @param {('byFile' | 'byLimeobject')} source - Determines if the file should be fetched by its file ID or by its associated Limeobject ID
|
|
25
|
+
* @param {string} limetype - Required if fetching by Limeobject. Specifies the type of Lime CRM entity associated with the file
|
|
26
|
+
* @param {string} identifier - The ID of the file or the associated Limeobject to retrieve
|
|
27
|
+
* @param {string} property - Required if fetching by Limeobject. Specifies the file type property to fetch
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export const properties: INodeProperties[] = [
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Get by',
|
|
34
|
+
name: 'source',
|
|
35
|
+
type: 'options',
|
|
36
|
+
required: true,
|
|
37
|
+
placeholder: 'Add Source',
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
resource: [DATA_RESOURCE],
|
|
41
|
+
operation: ['getSingleFile'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
name: 'File ID',
|
|
47
|
+
value: 'byFile',
|
|
48
|
+
description: 'Get file by its ID',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Limeobject ID',
|
|
52
|
+
value: 'byLimeobject',
|
|
53
|
+
description: "Get file by it's associated Limeobject ID",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
default: 'byFile',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Limetype',
|
|
60
|
+
name: 'limetype',
|
|
61
|
+
type: 'options',
|
|
62
|
+
typeOptions: {
|
|
63
|
+
loadOptionsMethod: 'getLimetypes',
|
|
64
|
+
},
|
|
65
|
+
required: true,
|
|
66
|
+
default: '',
|
|
67
|
+
description: 'The type of entity associated with the file',
|
|
68
|
+
displayOptions: {
|
|
69
|
+
show: {
|
|
70
|
+
resource: [DATA_RESOURCE],
|
|
71
|
+
operation: ['getSingleFile'],
|
|
72
|
+
source: ['byLimeobject'],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Identifier',
|
|
78
|
+
name: 'identifier',
|
|
79
|
+
type: 'string',
|
|
80
|
+
required: true,
|
|
81
|
+
default: '',
|
|
82
|
+
description: 'The ID of the file or Limeobject to retrieve',
|
|
83
|
+
displayOptions: {
|
|
84
|
+
show: {
|
|
85
|
+
resource: [DATA_RESOURCE],
|
|
86
|
+
operation: ['getSingleFile'],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
placeholder: 'e.g., 12345',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'File type property',
|
|
93
|
+
name: 'property',
|
|
94
|
+
type: 'options',
|
|
95
|
+
typeOptions: {
|
|
96
|
+
loadOptionsMethod: 'getFileProperties',
|
|
97
|
+
loadOptionsDependsOn: ['limetype'],
|
|
98
|
+
},
|
|
99
|
+
required: true,
|
|
100
|
+
default: '',
|
|
101
|
+
description: 'The type of entity associated with the file',
|
|
102
|
+
displayOptions: {
|
|
103
|
+
show: {
|
|
104
|
+
resource: [DATA_RESOURCE],
|
|
105
|
+
operation: ['getSingleFile'],
|
|
106
|
+
source: ['byLimeobject'],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Execute the "Get Single File" operation for Lime CRM.
|
|
114
|
+
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* This method retrieves file data from Lime CRM based on the selected source:
|
|
117
|
+
* - 'byFile': Fetches the file using its unique file ID.
|
|
118
|
+
* - 'byLimeobject': Fetches the file using an associated Limeobject ID and the specified file type property.
|
|
119
|
+
*
|
|
120
|
+
* The method returns an object containing the JSON response and the file's binary data.
|
|
121
|
+
*
|
|
122
|
+
* @param i - The index of the current item in the workflow execution
|
|
123
|
+
*
|
|
124
|
+
* @returns An object containing `json` and `binary` fields with the file data.
|
|
125
|
+
*
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
129
|
+
const source = this.getNodeParameter('source', i) as string;
|
|
130
|
+
const id = this.getNodeParameter('identifier', i) as string;
|
|
131
|
+
|
|
132
|
+
if (source == 'byFile') {
|
|
133
|
+
const fileResponse = await getFileContent(this, id);
|
|
134
|
+
return {
|
|
135
|
+
json: {},
|
|
136
|
+
binary: { data: fileResponse },
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (source == 'byLimeobject') {
|
|
140
|
+
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
141
|
+
const property = this.getNodeParameter('property', i) as string;
|
|
142
|
+
|
|
143
|
+
const fileResponse = await getFileContentByLimetype(
|
|
144
|
+
this,
|
|
145
|
+
limetype,
|
|
146
|
+
id,
|
|
147
|
+
property
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
json: {},
|
|
152
|
+
binary: {
|
|
153
|
+
data: fileResponse,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
throw new NodeOperationError(
|
|
159
|
+
this.getNode(),
|
|
160
|
+
`The source "${source}" is not supported!`
|
|
161
|
+
);
|
|
162
|
+
}
|