@limetech/n8n-nodes-lime 0.5.0 → 2.5.0-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 +4 -2
- package/.github/workflows/release.yml +8 -41
- package/.github/workflows/test-and-build.yml +1 -16
- package/.releaserc.json +2 -1
- package/CHANGELOG.md +155 -0
- package/Dockerfile +0 -21
- package/README.md +1 -1
- package/credentials/LimeCrmApi.credentials.ts +38 -1
- package/credentials/index.ts +2 -0
- package/eslint.config.mjs +2 -1
- package/knip.json +9 -0
- package/nodes/errorHandling.ts +60 -0
- 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 +89 -11
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +75 -21
- package/nodes/lime-crm/index.ts +9 -0
- package/nodes/lime-crm/methods/getLimetypeProperties.ts +53 -8
- package/nodes/lime-crm/methods/getLimetypes.ts +15 -9
- package/nodes/lime-crm/methods/index.ts +6 -1
- package/nodes/lime-crm/methods/resourceMapping.ts +141 -0
- 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 +65 -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 +94 -0
- package/nodes/lime-crm/resources/admin/operations/getManyUsers.operation.ts +174 -0
- package/nodes/lime-crm/resources/admin/operations/getSingleUser.operation.ts +112 -0
- package/nodes/lime-crm/resources/admin/operations/index.ts +8 -0
- package/nodes/lime-crm/resources/data/index.ts +77 -31
- package/nodes/lime-crm/resources/data/operations/{createSingleObject.ts → createSingleObject.operation.ts} +64 -54
- package/nodes/lime-crm/resources/data/operations/{deleteSingleObject.ts → deleteSingleObject.operation.ts} +39 -6
- package/nodes/lime-crm/resources/data/operations/{getManyObjects.ts → getManyObjects.operation.ts} +195 -48
- package/nodes/lime-crm/resources/data/operations/{getSingleFile.ts → getSingleFile.operation.ts} +47 -11
- package/nodes/lime-crm/resources/data/operations/{getSingleObject.ts → getSingleObject.operation.ts} +50 -8
- package/nodes/lime-crm/resources/data/operations/index.ts +24 -0
- package/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.ts +83 -61
- package/nodes/lime-crm/resources/metadata/index.ts +60 -16
- package/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.ts +18 -4
- package/nodes/lime-crm/resources/metadata/operations/{getSingleFileMetadata.ts → getSingleFileMetadata.operation.ts} +46 -26
- package/nodes/lime-crm/resources/metadata/operations/{getSingleLimetype.ts → getSingleLimetype.operation.ts} +30 -3
- package/nodes/lime-crm/resources/metadata/operations/index.ts +12 -0
- package/nodes/lime-crm/transport/commons.ts +90 -18
- package/nodes/lime-crm/transport/files.ts +161 -71
- package/nodes/lime-crm/transport/index.ts +35 -17
- package/nodes/lime-crm/transport/limeQuery.ts +43 -7
- package/nodes/lime-crm/transport/limeobjects.ts +113 -178
- package/nodes/lime-crm/transport/limetypes.ts +125 -48
- package/nodes/lime-crm/transport/users.ts +300 -0
- package/nodes/lime-crm/transport/webhooks.ts +97 -37
- package/nodes/lime-crm/{commons → utils}/files.ts +79 -26
- package/nodes/lime-crm/utils/hmac.ts +35 -0
- package/nodes/lime-crm/utils/index.ts +10 -0
- package/nodes/lime-crm/utils/webhook.ts +81 -0
- package/nodes/modules.ts +44 -0
- package/nodes/response.ts +54 -0
- package/package.json +21 -28
- package/tests/nodes/lime-crm/methods.spec.ts +91 -0
- package/tests/nodes/lime-crm/utils.spec.ts +273 -0
- package/typedoc.css +9 -0
- package/typedoc.json +19 -0
- package/.dockerignore +0 -1
- 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 -52
- package/nodes/lime-crm/commons/constants.ts +0 -9
- package/nodes/lime-crm/commons/hmac.ts +0 -13
- package/nodes/lime-crm/commons/index.ts +0 -10
- package/nodes/lime-crm/commons/task.ts +0 -55
- package/nodes/lime-crm/commons/webhook.ts +0 -68
- package/nodes/lime-crm/methods/getEntitiesForErpSystem.ts +0 -11
- package/nodes/lime-crm/model.ts +0 -22
- 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/transport/erpConnector.ts +0 -21
- package/nodes/lime-crm/transport/task.ts +0 -32
- package/nodes/nodeResponse.ts +0 -13
- package/restore_script/README +0 -42
- package/restore_script/api_key_download.txt +0 -0
- package/restore_script/api_key_upload.txt +0 -0
- package/restore_script/cli.py +0 -73
- package/restore_script/download.py +0 -73
- package/restore_script/main.py +0 -19
- package/restore_script/poetry.lock +0 -162
- package/restore_script/pyproject.toml +0 -15
- package/restore_script/transfer.py +0 -41
- package/restore_script/upload.py +0 -66
- package/restore_script/utils.py +0 -42
- package/tests/fixtures/fortnox.ts +0 -182
- package/tests/transform.spec.ts +0 -187
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
|
|
3
|
-
import { createLimeobject } from '../../../transport';
|
|
4
|
-
import { DATA_RESOURCE } from '../../../
|
|
3
|
+
import { createLimeobject, getProperties } from '../../../transport';
|
|
4
|
+
import { DATA_RESOURCE } from '../../../models';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
getFilePropertiesNames,
|
|
7
7
|
processFileResponse,
|
|
8
8
|
setFileProperties,
|
|
9
|
-
} from '../../../
|
|
9
|
+
} from '../../../utils';
|
|
10
10
|
|
|
11
|
+
import { parseResourceMapperFields } from '../../../methods';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Description and metadata for the "Create Single Object" operation in Lime CRM.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
11
18
|
export const description = {
|
|
12
19
|
name: 'Create Single Object',
|
|
13
20
|
value: 'createSingleObject',
|
|
@@ -15,6 +22,16 @@ export const description = {
|
|
|
15
22
|
action: 'Create single object',
|
|
16
23
|
};
|
|
17
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Node properties for the "Create Single Object" operation.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} limetype - The type of entity to create
|
|
29
|
+
* @param {'fields' | 'json'} inputMethod - How the user provides object data: 'fields' for form inputs, 'json' for raw JSON
|
|
30
|
+
* @param {Array<{ name: string; value: string }>} properties - Used if inputMethod is 'fields'. List of property name/value pairs to set on the object
|
|
31
|
+
* @param {string} objectJson - Used if inputMethod is 'json'. The full object data in JSON format
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
18
35
|
export const properties: INodeProperties[] = [
|
|
19
36
|
{
|
|
20
37
|
displayName: 'Limetype',
|
|
@@ -59,12 +76,20 @@ export const properties: INodeProperties[] = [
|
|
|
59
76
|
{
|
|
60
77
|
displayName: 'Properties',
|
|
61
78
|
name: 'properties',
|
|
62
|
-
type: '
|
|
79
|
+
type: 'resourceMapper',
|
|
63
80
|
placeholder: 'Add Property',
|
|
64
81
|
typeOptions: {
|
|
65
|
-
|
|
82
|
+
resourceMapper: {
|
|
83
|
+
resourceMapperMethod: 'getCreateMappingColumns',
|
|
84
|
+
mode: 'add',
|
|
85
|
+
addAllFields: false,
|
|
86
|
+
supportAutoMap: false,
|
|
87
|
+
},
|
|
88
|
+
loadOptionsDependsOn: ['limetype'],
|
|
89
|
+
},
|
|
90
|
+
default: {
|
|
91
|
+
value: null,
|
|
66
92
|
},
|
|
67
|
-
default: {},
|
|
68
93
|
displayOptions: {
|
|
69
94
|
show: {
|
|
70
95
|
resource: [DATA_RESOURCE],
|
|
@@ -72,33 +97,6 @@ export const properties: INodeProperties[] = [
|
|
|
72
97
|
inputMethod: ['fields'],
|
|
73
98
|
},
|
|
74
99
|
},
|
|
75
|
-
options: [
|
|
76
|
-
{
|
|
77
|
-
displayName: 'Property',
|
|
78
|
-
name: 'property',
|
|
79
|
-
values: [
|
|
80
|
-
{
|
|
81
|
-
displayName: 'Property Name',
|
|
82
|
-
name: 'name',
|
|
83
|
-
type: 'options',
|
|
84
|
-
typeOptions: {
|
|
85
|
-
sortable: true,
|
|
86
|
-
loadOptionsMethod: 'getLimetypeProperties',
|
|
87
|
-
loadOptionsDependsOn: ['limetype'],
|
|
88
|
-
},
|
|
89
|
-
default: '',
|
|
90
|
-
description: 'Name of the property',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
displayName: 'Property Value',
|
|
94
|
-
name: 'value',
|
|
95
|
-
type: 'string',
|
|
96
|
-
default: '',
|
|
97
|
-
description: 'Value of the property',
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
100
|
},
|
|
103
101
|
{
|
|
104
102
|
displayName: 'Object (JSON)',
|
|
@@ -119,35 +117,46 @@ export const properties: INodeProperties[] = [
|
|
|
119
117
|
},
|
|
120
118
|
];
|
|
121
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Execute the "Create Single Object" operation for Lime CRM.
|
|
122
|
+
*
|
|
123
|
+
* @param i - The index of the current item in the workflow execution
|
|
124
|
+
* @remarks
|
|
125
|
+
* This method handles creating a single Lime CRM object. It supports two input methods:
|
|
126
|
+
* - `fields`: where the user provides property values via form fields.
|
|
127
|
+
* - `json`: where the user provides a full JSON object representing the entity.
|
|
128
|
+
*
|
|
129
|
+
* The method performs the following steps:
|
|
130
|
+
* 1. Reads the limetype and input method from node parameters.
|
|
131
|
+
* 2. Parses input data according to the selected input method.
|
|
132
|
+
* 3. Resolves any file properties present in the object and sets the file properties on the object.
|
|
133
|
+
* 4. Sends a request to the Lime API to create the object.
|
|
134
|
+
* 5. Processes any returned file data and formats the response.
|
|
135
|
+
*
|
|
136
|
+
* @returns The newly created Lime object.
|
|
137
|
+
*
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
122
140
|
export async function execute(this: IExecuteFunctions, i: number) {
|
|
123
141
|
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
124
142
|
const inputMethod = this.getNodeParameter('inputMethod', i) as string;
|
|
125
143
|
|
|
126
144
|
let objectData: IDataObject;
|
|
127
145
|
|
|
146
|
+
const propertiesResponse = await getProperties(this, limetype);
|
|
147
|
+
if (!propertiesResponse.success) return propertiesResponse.data;
|
|
148
|
+
|
|
149
|
+
const properties = propertiesResponse.data;
|
|
150
|
+
|
|
128
151
|
if (inputMethod === 'json') {
|
|
129
152
|
const jsonInput = this.getNodeParameter('objectJson', i) as string;
|
|
130
153
|
objectData = JSON.parse(jsonInput);
|
|
131
154
|
} else {
|
|
132
|
-
objectData =
|
|
133
|
-
const propertiesInput = this.getNodeParameter(
|
|
134
|
-
'properties.property',
|
|
135
|
-
i,
|
|
136
|
-
[]
|
|
137
|
-
) as IDataObject[];
|
|
138
|
-
|
|
139
|
-
if (propertiesInput && propertiesInput.length > 0) {
|
|
140
|
-
for (const prop of propertiesInput) {
|
|
141
|
-
if (prop.name && prop.value !== undefined) {
|
|
142
|
-
objectData[prop.name as string] = prop.value;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
155
|
+
objectData = parseResourceMapperFields(this, i, 'properties');
|
|
146
156
|
}
|
|
147
157
|
|
|
148
|
-
const fileProperties =
|
|
149
|
-
|
|
150
|
-
limetype,
|
|
158
|
+
const fileProperties = getFilePropertiesNames(
|
|
159
|
+
properties,
|
|
151
160
|
new Set(Object.keys(objectData))
|
|
152
161
|
);
|
|
153
162
|
|
|
@@ -157,19 +166,20 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
157
166
|
fileProperties,
|
|
158
167
|
objectData
|
|
159
168
|
);
|
|
160
|
-
if (!setFilePropertiesResponse.success)
|
|
169
|
+
if (!setFilePropertiesResponse.success)
|
|
170
|
+
return setFilePropertiesResponse.data;
|
|
161
171
|
|
|
162
172
|
const createLimeobjectResponse = await createLimeobject(
|
|
163
173
|
this,
|
|
164
174
|
limetype,
|
|
165
175
|
setFilePropertiesResponse.data
|
|
166
176
|
);
|
|
167
|
-
if (!createLimeobjectResponse.success) return createLimeobjectResponse;
|
|
177
|
+
if (!createLimeobjectResponse.success) return createLimeobjectResponse.data;
|
|
168
178
|
|
|
169
179
|
const response = await processFileResponse(
|
|
170
180
|
this,
|
|
171
181
|
fileProperties,
|
|
172
182
|
createLimeobjectResponse.data
|
|
173
183
|
);
|
|
174
|
-
return response.json;
|
|
184
|
+
return response.json.data;
|
|
175
185
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
|
|
3
3
|
import { deleteLimeobject } from '../../../transport';
|
|
4
|
-
import { DATA_RESOURCE } from '../../../
|
|
4
|
+
import { DATA_RESOURCE } from '../../../models';
|
|
5
|
+
import { WorkflowResponse } from '../../../../response';
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Description and metadata for the "Delete Single Object" operation in Lime CRM.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
6
12
|
export const description = {
|
|
7
13
|
name: 'Delete Single Object',
|
|
8
14
|
value: 'deleteSingleObject',
|
|
@@ -10,8 +16,16 @@ export const description = {
|
|
|
10
16
|
action: 'Delete single object',
|
|
11
17
|
};
|
|
12
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Node properties for the "Delete Single Object" operation.
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* @param {string} limetype - The type of entity to delete. Loaded from available Limetypes
|
|
24
|
+
* @param {string} objectId - The ID of the object to delete
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
13
28
|
export const properties: INodeProperties[] = [
|
|
14
|
-
// Limetype selection
|
|
15
29
|
{
|
|
16
30
|
displayName: 'Limetype',
|
|
17
31
|
name: 'limetype',
|
|
@@ -29,8 +43,6 @@ export const properties: INodeProperties[] = [
|
|
|
29
43
|
},
|
|
30
44
|
},
|
|
31
45
|
},
|
|
32
|
-
|
|
33
|
-
// Object ID
|
|
34
46
|
{
|
|
35
47
|
displayName: 'Object ID',
|
|
36
48
|
name: 'objectId',
|
|
@@ -47,9 +59,30 @@ export const properties: INodeProperties[] = [
|
|
|
47
59
|
},
|
|
48
60
|
];
|
|
49
61
|
|
|
50
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Execute the "Delete Single Object" operation for Lime CRM.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* This operation deletes a single Lime CRM object identified by its object ID.
|
|
67
|
+
* The object type is determined by the selected limetype.
|
|
68
|
+
*
|
|
69
|
+
* The method performs the following steps:
|
|
70
|
+
* 1. Retrieves the `limetype` and `objectId` from {@link properties}.
|
|
71
|
+
* 2. Calls the {@link deleteLimeobject} function to delete the object from Lime CRM.
|
|
72
|
+
*
|
|
73
|
+
* @param i - The index of the current item in the workflow execution
|
|
74
|
+
*
|
|
75
|
+
* @returns The response from the Lime API after attempting deletion.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export async function execute(
|
|
80
|
+
this: IExecuteFunctions,
|
|
81
|
+
i: number
|
|
82
|
+
): Promise<WorkflowResponse<Record<string, never>>> {
|
|
51
83
|
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
52
84
|
const objectId = this.getNodeParameter('objectId', i) as string;
|
|
53
85
|
|
|
54
|
-
|
|
86
|
+
const response = await deleteLimeobject(this, limetype, objectId);
|
|
87
|
+
return response.data;
|
|
55
88
|
}
|
package/nodes/lime-crm/resources/data/operations/{getManyObjects.ts → getManyObjects.operation.ts}
RENAMED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
|
|
3
|
-
import { queryLimeobjects } from '../../../transport';
|
|
4
|
-
import { DATA_RESOURCE } from '../../../
|
|
3
|
+
import { IncludedProperties, queryLimeobjects } from '../../../transport';
|
|
4
|
+
import { DATA_RESOURCE, DEFAULT_API_OBJECT_LIMIT } from '../../../models';
|
|
5
|
+
import { WorkflowResponse } from '../../../../response';
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Description and metadata for the "Get Many Objects" operation in Lime CRM.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
6
12
|
export const description = {
|
|
7
13
|
name: 'Get Many Objects',
|
|
8
14
|
value: 'getManyObjects',
|
|
@@ -10,14 +16,54 @@ export const description = {
|
|
|
10
16
|
action: 'Get many objects',
|
|
11
17
|
};
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Maximum number of objects to fetch in a single API request.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
const BATCHSIZE = 200;
|
|
14
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Structure of the response format when querying Lime CRM objects.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This is used to define which properties are included in the API response.
|
|
30
|
+
* The keys of the `object` correspond to property names of the entity,
|
|
31
|
+
* and the values are initialized as empty strings.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* {
|
|
35
|
+
* object: {
|
|
36
|
+
* _id: '',
|
|
37
|
+
* name: '',
|
|
38
|
+
* phone: ''
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
15
44
|
interface ResponseFormat {
|
|
16
45
|
object: {
|
|
17
46
|
[key: string]: string;
|
|
18
47
|
};
|
|
19
48
|
}
|
|
20
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Defines a collection of properties to order query results by.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Each entry specifies a property name and the direction in which the results
|
|
55
|
+
* should be sorted. Multiple fields can be provided to perform multi-level sorting.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* {
|
|
59
|
+
* orderByFields: [
|
|
60
|
+
* { propertyName: 'name', sortDirection: 'ASC' },
|
|
61
|
+
* { propertyName: 'createdAt', sortDirection: 'DESC' }
|
|
62
|
+
* ]
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
21
67
|
interface OrderByCollection {
|
|
22
68
|
orderByFields: {
|
|
23
69
|
propertyName: string;
|
|
@@ -25,6 +71,21 @@ interface OrderByCollection {
|
|
|
25
71
|
}[];
|
|
26
72
|
}
|
|
27
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Node properties for the "Get Many Objects" operation.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} limetype - The type of entity to query. Loaded from available Limetypes
|
|
78
|
+
* @param {'fields' | 'json'} responseFormatInputMethod - How to format the response
|
|
79
|
+
* @param {Array<{ name: string }>} responseFormatProperties - The properties to include if using 'fields'
|
|
80
|
+
* @param {string} responseFormatJson - JSON defining the response structure if using 'json'
|
|
81
|
+
* @param {string} filter - JSON defining filtering conditions
|
|
82
|
+
* @param {number} limit - Maximum number of objects to return
|
|
83
|
+
* @param {'fields' | 'json'} orderByInputMethod - How to specify ordering
|
|
84
|
+
* @param {OrderByCollection} orderByProperties - Order by fields if using 'fields'
|
|
85
|
+
* @param {string} orderByJson - JSON defining ordering if using 'json'
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
28
89
|
export const properties: INodeProperties[] = [
|
|
29
90
|
{
|
|
30
91
|
displayName: 'Limetype',
|
|
@@ -137,7 +198,7 @@ export const properties: INodeProperties[] = [
|
|
|
137
198
|
displayName: 'Limit',
|
|
138
199
|
name: 'limit',
|
|
139
200
|
type: 'number',
|
|
140
|
-
default:
|
|
201
|
+
default: DEFAULT_API_OBJECT_LIMIT,
|
|
141
202
|
description: 'The maximum number of records to return',
|
|
142
203
|
displayOptions: {
|
|
143
204
|
show: {
|
|
@@ -238,7 +299,30 @@ export const properties: INodeProperties[] = [
|
|
|
238
299
|
},
|
|
239
300
|
];
|
|
240
301
|
|
|
241
|
-
|
|
302
|
+
/**
|
|
303
|
+
* Create the response format object when using 'fields' mode.
|
|
304
|
+
*
|
|
305
|
+
* @remarks
|
|
306
|
+
* This function takes an array of property descriptors (each with a `name` field)
|
|
307
|
+
* and constructs a response object suitable for Lime CRM queries. It initializes
|
|
308
|
+
* each property with an empty string, ensuring that all requested fields are
|
|
309
|
+
* included in the response, even if the values are not yet set.
|
|
310
|
+
*
|
|
311
|
+
* Additionally, it always includes a default `_id` field in the response object,
|
|
312
|
+
* which is typically required by Lime CRM for object identification.
|
|
313
|
+
*
|
|
314
|
+
* Example:
|
|
315
|
+
* ```ts
|
|
316
|
+
* createResponseFormatObject([{ name: 'name' }, { name: 'email' }]);
|
|
317
|
+
* // Returns: { object: { _id: '', name: '', email: '' } }
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* @param properties - Array of property descriptors.
|
|
321
|
+
* @returns The ResponseFormat object.
|
|
322
|
+
*
|
|
323
|
+
* @internal
|
|
324
|
+
*/
|
|
325
|
+
function createResponseFormatObject(
|
|
242
326
|
properties: { name: string }[] = []
|
|
243
327
|
): ResponseFormat {
|
|
244
328
|
const object: Record<string, string> = { _id: '' };
|
|
@@ -248,7 +332,34 @@ function _createResponseFormatObject(
|
|
|
248
332
|
return { object };
|
|
249
333
|
}
|
|
250
334
|
|
|
251
|
-
|
|
335
|
+
/**
|
|
336
|
+
* Generate the ordering array for Lime CRM queries.
|
|
337
|
+
*
|
|
338
|
+
* @remarks
|
|
339
|
+
* This function transforms a user-provided `OrderByCollection` object into the
|
|
340
|
+
* format required by the Lime CRM API. Each property in `orderByFields` is
|
|
341
|
+
* converted into a key-value pair where the key is the property name and the
|
|
342
|
+
* value is the sort direction ('ASC' or 'DESC').
|
|
343
|
+
*
|
|
344
|
+
* If no `orderByFields` are provided, it defaults to ordering by `_id` ascending.
|
|
345
|
+
*
|
|
346
|
+
* Example:
|
|
347
|
+
* ```ts
|
|
348
|
+
* getOrderBy({
|
|
349
|
+
* orderByFields: [
|
|
350
|
+
* { propertyName: 'name', sortDirection: 'ASC' },
|
|
351
|
+
* { propertyName: 'createdAt', sortDirection: 'DESC' },
|
|
352
|
+
* ]
|
|
353
|
+
* });
|
|
354
|
+
* // Returns: [{ name: 'ASC' }, { createdAt: 'DESC' }]
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* @param orderByCollection - Collection of order-by fields provided by the user.
|
|
358
|
+
* @returns An array of objects representing the order-by configuration for Lime CRM.
|
|
359
|
+
*
|
|
360
|
+
* @internal
|
|
361
|
+
*/
|
|
362
|
+
function getOrderBy(orderByCollection: OrderByCollection) {
|
|
252
363
|
const orderBy =
|
|
253
364
|
orderByCollection.orderByFields &&
|
|
254
365
|
orderByCollection.orderByFields.map((field) => ({
|
|
@@ -257,57 +368,89 @@ function _getOrderBy(orderByCollection: OrderByCollection) {
|
|
|
257
368
|
return orderBy || [{ _id: 'ASC' }];
|
|
258
369
|
}
|
|
259
370
|
|
|
260
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Fetch Lime CRM objects in batches to handle large result sets or unlimited queries.
|
|
373
|
+
*
|
|
374
|
+
* @remarks
|
|
375
|
+
* This function retrieves objects from Lime CRM for a given limetype by performing
|
|
376
|
+
* multiple sequential API calls, each fetching up to BATCHSIZE records.
|
|
377
|
+
*
|
|
378
|
+
* @param limetype - The type of Lime CRM entity to fetch
|
|
379
|
+
* @param responseFormat - The format in which objects should be returned, defining which properties are included
|
|
380
|
+
* @param filter - JSON string representing the filter conditions for the query
|
|
381
|
+
* @param limit - Maximum number of objects to fetch in this request
|
|
382
|
+
* @param orderBy - Array of objects defining the sorting of the results
|
|
383
|
+
*
|
|
384
|
+
* @returns Array of fetched objects or an error response as an array.
|
|
385
|
+
*/
|
|
386
|
+
async function fetchLimeObjects(
|
|
261
387
|
this: IExecuteFunctions,
|
|
262
388
|
limetype: string,
|
|
263
389
|
responseFormat: ResponseFormat,
|
|
264
390
|
filter: string,
|
|
265
|
-
limit: number,
|
|
266
|
-
orderBy:
|
|
267
|
-
) {
|
|
268
|
-
|
|
391
|
+
limit: number | null,
|
|
392
|
+
orderBy: Record<string, 'ASC' | 'DESC'>[]
|
|
393
|
+
): Promise<WorkflowResponse<IncludedProperties[]>> {
|
|
394
|
+
const allResults: IncludedProperties[] = [];
|
|
395
|
+
const parsedFilter = JSON.parse(filter);
|
|
396
|
+
const unlimited = limit === null || limit === 0;
|
|
397
|
+
const targetLimit = unlimited ? Infinity : limit;
|
|
398
|
+
|
|
399
|
+
let fetched = 0;
|
|
400
|
+
let currentOffset = 0;
|
|
401
|
+
|
|
402
|
+
while (fetched < targetLimit) {
|
|
403
|
+
const currentLimit =
|
|
404
|
+
targetLimit === Infinity
|
|
405
|
+
? BATCHSIZE
|
|
406
|
+
: Math.min(BATCHSIZE, targetLimit - fetched);
|
|
407
|
+
|
|
269
408
|
const q = JSON.stringify({
|
|
270
409
|
limetype,
|
|
271
410
|
responseFormat: responseFormat,
|
|
272
|
-
filter:
|
|
273
|
-
limit:
|
|
274
|
-
offset:
|
|
411
|
+
filter: parsedFilter,
|
|
412
|
+
limit: currentLimit,
|
|
413
|
+
offset: currentOffset,
|
|
275
414
|
orderBy: orderBy,
|
|
276
415
|
});
|
|
277
|
-
return queryLimeobjects(this, q);
|
|
278
|
-
} else {
|
|
279
|
-
let allResults: unknown[] = [];
|
|
280
|
-
let fetched = 0;
|
|
281
|
-
let currentOffset = 0;
|
|
282
|
-
while (fetched < limit) {
|
|
283
|
-
const currentLimit = Math.min(BATCHSIZE, limit - fetched);
|
|
284
|
-
const q = JSON.stringify({
|
|
285
|
-
limetype,
|
|
286
|
-
responseFormat: responseFormat,
|
|
287
|
-
filter: JSON.parse(filter),
|
|
288
|
-
limit: currentLimit,
|
|
289
|
-
offset: currentOffset,
|
|
290
|
-
orderBy,
|
|
291
|
-
});
|
|
292
|
-
const batch = await queryLimeobjects(this, q);
|
|
293
|
-
if (!batch.success) {
|
|
294
|
-
return batch;
|
|
295
|
-
}
|
|
296
|
-
const collected = batch.data.objects.length;
|
|
297
|
-
if (!batch || collected === 0) break;
|
|
298
|
-
allResults = [...allResults, ...batch.data.objects];
|
|
299
|
-
fetched += collected;
|
|
300
|
-
currentOffset += collected;
|
|
301
416
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
417
|
+
const batchResponse = await queryLimeobjects(this, q);
|
|
418
|
+
if (!batchResponse.success) return batchResponse.data;
|
|
419
|
+
|
|
420
|
+
const batch = batchResponse.data;
|
|
421
|
+
|
|
422
|
+
const collected = batch.objects.length;
|
|
423
|
+
if (collected === 0) break;
|
|
424
|
+
|
|
425
|
+
allResults.push(...batch.objects);
|
|
426
|
+
|
|
427
|
+
fetched += collected;
|
|
428
|
+
currentOffset += collected;
|
|
429
|
+
|
|
430
|
+
if (collected < currentLimit) break;
|
|
308
431
|
}
|
|
432
|
+
|
|
433
|
+
return allResults;
|
|
309
434
|
}
|
|
310
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Execute the "Get Many Objects" operation for Lime CRM.
|
|
438
|
+
*
|
|
439
|
+
* @remarks
|
|
440
|
+
* Retrieves multiple Lime CRM objects of the selected limetype with optional filtering, ordering, and response formatting.
|
|
441
|
+
* The method supports batch fetching if the requested limit exceeds 50 records.
|
|
442
|
+
*
|
|
443
|
+
* Steps performed by the method:
|
|
444
|
+
* 1. Determine the limetype and response format (fields or JSON) from {@link properties}.
|
|
445
|
+
* 2. Determine ordering (fields or JSON) from {@link properties}.
|
|
446
|
+
* 3. Fetch data from Lime CRM, handling batching if necessary.
|
|
447
|
+
*
|
|
448
|
+
* @param i - The index of the current item in the workflow execution
|
|
449
|
+
*
|
|
450
|
+
* @returns The fetched Lime objects as per the requested response format.
|
|
451
|
+
*
|
|
452
|
+
* @public
|
|
453
|
+
*/
|
|
311
454
|
export async function execute(this: IExecuteFunctions, i: number) {
|
|
312
455
|
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
313
456
|
const responseFormatInputMethod = this.getNodeParameter(
|
|
@@ -319,7 +462,11 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
319
462
|
i
|
|
320
463
|
) as string;
|
|
321
464
|
const filter = this.getNodeParameter('filter', i) as string;
|
|
322
|
-
const limit = this.getNodeParameter(
|
|
465
|
+
const limit = this.getNodeParameter(
|
|
466
|
+
'limit',
|
|
467
|
+
i,
|
|
468
|
+
DEFAULT_API_OBJECT_LIMIT
|
|
469
|
+
) as number;
|
|
323
470
|
|
|
324
471
|
let response;
|
|
325
472
|
if (responseFormatInputMethod === 'fields') {
|
|
@@ -327,7 +474,7 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
327
474
|
'responseFormatProperties',
|
|
328
475
|
i
|
|
329
476
|
) as { property: [{ name: string }] };
|
|
330
|
-
response =
|
|
477
|
+
response = createResponseFormatObject(properties.property);
|
|
331
478
|
} else if (responseFormatInputMethod === 'json') {
|
|
332
479
|
response = this.getNodeParameter('responseFormatJson', i) as string;
|
|
333
480
|
response = JSON.parse(response);
|
|
@@ -339,13 +486,13 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
339
486
|
'orderByProperties',
|
|
340
487
|
i
|
|
341
488
|
) as OrderByCollection;
|
|
342
|
-
orderBy =
|
|
489
|
+
orderBy = getOrderBy(orderByCollection);
|
|
343
490
|
} else if (orderByInputMethod === 'json') {
|
|
344
491
|
orderBy = this.getNodeParameter('orderByJson', i) as string;
|
|
345
492
|
orderBy = JSON.parse(orderBy);
|
|
346
493
|
}
|
|
347
494
|
|
|
348
|
-
return await
|
|
495
|
+
return await fetchLimeObjects.call(
|
|
349
496
|
this,
|
|
350
497
|
limetype,
|
|
351
498
|
response,
|
package/nodes/lime-crm/resources/data/operations/{getSingleFile.ts → getSingleFile.operation.ts}
RENAMED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IExecuteFunctions,
|
|
3
|
+
INodeExecutionData,
|
|
3
4
|
INodeProperties,
|
|
4
5
|
NodeOperationError,
|
|
5
6
|
} from 'n8n-workflow';
|
|
6
7
|
import { getFileContent, getFileContentByLimetype } from '../../../transport';
|
|
7
|
-
import { DATA_RESOURCE } from '../../../
|
|
8
|
+
import { DATA_RESOURCE } from '../../../models';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Description and metadata for the "Get Single File" operation in Lime CRM.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
9
15
|
export const description = {
|
|
10
16
|
name: 'Get Single File',
|
|
11
17
|
value: 'getSingleFile',
|
|
@@ -13,6 +19,16 @@ export const description = {
|
|
|
13
19
|
action: 'Get single file',
|
|
14
20
|
};
|
|
15
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Node properties for the "Get Single File" operation.
|
|
24
|
+
*
|
|
25
|
+
* @param {('byFile' | 'byLimeobject')} source - Determines if the file should be fetched by its file ID or by its associated Limeobject ID
|
|
26
|
+
* @param {string} limetype - Required if fetching by Limeobject. Specifies the type of Lime CRM entity associated with the file
|
|
27
|
+
* @param {string} identifier - The ID of the file or the associated Limeobject to retrieve
|
|
28
|
+
* @param {string} property - Required if fetching by Limeobject. Specifies the file type property to fetch
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
16
32
|
export const properties: INodeProperties[] = [
|
|
17
33
|
{
|
|
18
34
|
displayName: 'Get by',
|
|
@@ -94,18 +110,37 @@ export const properties: INodeProperties[] = [
|
|
|
94
110
|
},
|
|
95
111
|
];
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Execute the "Get Single File" operation for Lime CRM.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* This method retrieves file data from Lime CRM based on the selected source:
|
|
118
|
+
* - 'byFile': Fetches the file using its unique file ID.
|
|
119
|
+
* - 'byLimeobject': Fetches the file using an associated Limeobject ID and the specified file type property.
|
|
120
|
+
*
|
|
121
|
+
* The method returns an object containing the JSON response and the file's binary data.
|
|
122
|
+
*
|
|
123
|
+
* @param i - The index of the current item in the workflow execution
|
|
124
|
+
*
|
|
125
|
+
* @returns An object containing `json` and `binary` fields with the file data.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export async function execute(
|
|
130
|
+
this: IExecuteFunctions,
|
|
131
|
+
i: number
|
|
132
|
+
): Promise<INodeExecutionData> {
|
|
98
133
|
const source = this.getNodeParameter('source', i) as string;
|
|
99
134
|
const id = this.getNodeParameter('identifier', i) as string;
|
|
100
135
|
|
|
101
136
|
if (source == 'byFile') {
|
|
102
137
|
const fileResponse = await getFileContent(this, id);
|
|
103
|
-
if (!fileResponse.success)
|
|
104
|
-
return {
|
|
105
|
-
|
|
106
|
-
|
|
138
|
+
if (!fileResponse.success)
|
|
139
|
+
return {
|
|
140
|
+
json: fileResponse.data,
|
|
141
|
+
};
|
|
107
142
|
return {
|
|
108
|
-
json: {
|
|
143
|
+
json: {},
|
|
109
144
|
binary: { data: fileResponse.data },
|
|
110
145
|
};
|
|
111
146
|
}
|
|
@@ -119,12 +154,13 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
119
154
|
id,
|
|
120
155
|
property
|
|
121
156
|
);
|
|
122
|
-
if (!fileResponse.success)
|
|
123
|
-
return {
|
|
124
|
-
|
|
157
|
+
if (!fileResponse.success)
|
|
158
|
+
return {
|
|
159
|
+
json: fileResponse.data,
|
|
160
|
+
};
|
|
125
161
|
|
|
126
162
|
return {
|
|
127
|
-
json: {
|
|
163
|
+
json: {},
|
|
128
164
|
binary: {
|
|
129
165
|
data: fileResponse.data,
|
|
130
166
|
},
|