@limetech/n8n-nodes-lime 0.5.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/.releaserc.json +2 -1
- package/CHANGELOG.md +122 -0
- 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/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 +81 -11
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +70 -30
- package/nodes/lime-crm/index.ts +9 -0
- package/nodes/lime-crm/methods/getLimetypeProperties.ts +51 -8
- package/nodes/lime-crm/methods/getLimetypes.ts +14 -9
- package/nodes/lime-crm/methods/index.ts +1 -1
- 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 +68 -31
- package/nodes/lime-crm/resources/data/operations/{createSingleObject.ts → createSingleObject.operation.ts} +82 -26
- package/nodes/lime-crm/resources/data/operations/{deleteSingleObject.ts → deleteSingleObject.operation.ts} +32 -4
- package/nodes/lime-crm/resources/data/operations/{getManyObjects.ts → getManyObjects.operation.ts} +191 -48
- package/nodes/lime-crm/resources/data/operations/{getSingleFile.ts → getSingleFile.operation.ts} +36 -12
- package/nodes/lime-crm/resources/data/operations/{getSingleObject.ts → getSingleObject.operation.ts} +39 -6
- package/nodes/lime-crm/resources/data/operations/index.ts +24 -0
- package/nodes/lime-crm/resources/data/operations/updateSingleObject.operation.ts +55 -17
- package/nodes/lime-crm/resources/metadata/index.ts +56 -16
- package/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.ts +15 -5
- package/nodes/lime-crm/resources/metadata/operations/{getSingleFileMetadata.ts → getSingleFileMetadata.operation.ts} +31 -14
- package/nodes/lime-crm/resources/metadata/operations/{getSingleLimetype.ts → getSingleLimetype.operation.ts} +23 -1
- package/nodes/lime-crm/resources/metadata/operations/index.ts +12 -0
- package/nodes/lime-crm/transport/commons.ts +86 -28
- package/nodes/lime-crm/transport/files.ts +149 -84
- package/nodes/lime-crm/transport/index.ts +35 -17
- package/nodes/lime-crm/transport/limeQuery.ts +42 -6
- package/nodes/lime-crm/transport/limeobjects.ts +102 -179
- package/nodes/lime-crm/transport/limetypes.ts +126 -70
- package/nodes/lime-crm/transport/users.ts +264 -0
- package/nodes/lime-crm/transport/webhooks.ts +96 -37
- package/nodes/lime-crm/{commons → utils}/files.ts +75 -39
- 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 +18 -27
- 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 -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/tests/fixtures/fortnox.ts +0 -182
- package/tests/transform.spec.ts +0 -187
package/nodes/lime-crm/resources/data/operations/{getManyObjects.ts → getManyObjects.operation.ts}
RENAMED
|
@@ -1,8 +1,13 @@
|
|
|
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
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Description and metadata for the "Get Many Objects" operation in Lime CRM.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
6
11
|
export const description = {
|
|
7
12
|
name: 'Get Many Objects',
|
|
8
13
|
value: 'getManyObjects',
|
|
@@ -10,14 +15,54 @@ export const description = {
|
|
|
10
15
|
action: 'Get many objects',
|
|
11
16
|
};
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of objects to fetch in a single API request.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
const BATCHSIZE = 200;
|
|
14
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
|
+
*/
|
|
15
43
|
interface ResponseFormat {
|
|
16
44
|
object: {
|
|
17
45
|
[key: string]: string;
|
|
18
46
|
};
|
|
19
47
|
}
|
|
20
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
|
+
*/
|
|
21
66
|
interface OrderByCollection {
|
|
22
67
|
orderByFields: {
|
|
23
68
|
propertyName: string;
|
|
@@ -25,6 +70,21 @@ interface OrderByCollection {
|
|
|
25
70
|
}[];
|
|
26
71
|
}
|
|
27
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
|
+
*/
|
|
28
88
|
export const properties: INodeProperties[] = [
|
|
29
89
|
{
|
|
30
90
|
displayName: 'Limetype',
|
|
@@ -137,7 +197,7 @@ export const properties: INodeProperties[] = [
|
|
|
137
197
|
displayName: 'Limit',
|
|
138
198
|
name: 'limit',
|
|
139
199
|
type: 'number',
|
|
140
|
-
default:
|
|
200
|
+
default: DEFAULT_API_OBJECT_LIMIT,
|
|
141
201
|
description: 'The maximum number of records to return',
|
|
142
202
|
displayOptions: {
|
|
143
203
|
show: {
|
|
@@ -238,7 +298,30 @@ export const properties: INodeProperties[] = [
|
|
|
238
298
|
},
|
|
239
299
|
];
|
|
240
300
|
|
|
241
|
-
|
|
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(
|
|
242
325
|
properties: { name: string }[] = []
|
|
243
326
|
): ResponseFormat {
|
|
244
327
|
const object: Record<string, string> = { _id: '' };
|
|
@@ -248,7 +331,34 @@ function _createResponseFormatObject(
|
|
|
248
331
|
return { object };
|
|
249
332
|
}
|
|
250
333
|
|
|
251
|
-
|
|
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) {
|
|
252
362
|
const orderBy =
|
|
253
363
|
orderByCollection.orderByFields &&
|
|
254
364
|
orderByCollection.orderByFields.map((field) => ({
|
|
@@ -257,57 +367,86 @@ function _getOrderBy(orderByCollection: OrderByCollection) {
|
|
|
257
367
|
return orderBy || [{ _id: 'ASC' }];
|
|
258
368
|
}
|
|
259
369
|
|
|
260
|
-
|
|
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(
|
|
261
386
|
this: IExecuteFunctions,
|
|
262
387
|
limetype: string,
|
|
263
388
|
responseFormat: ResponseFormat,
|
|
264
389
|
filter: string,
|
|
265
|
-
limit: number,
|
|
266
|
-
orderBy:
|
|
267
|
-
) {
|
|
268
|
-
|
|
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
|
+
|
|
269
407
|
const q = JSON.stringify({
|
|
270
408
|
limetype,
|
|
271
409
|
responseFormat: responseFormat,
|
|
272
|
-
filter:
|
|
273
|
-
limit:
|
|
274
|
-
offset:
|
|
410
|
+
filter: parsedFilter,
|
|
411
|
+
limit: currentLimit,
|
|
412
|
+
offset: currentOffset,
|
|
275
413
|
orderBy: orderBy,
|
|
276
414
|
});
|
|
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
415
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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;
|
|
308
427
|
}
|
|
428
|
+
|
|
429
|
+
return allResults;
|
|
309
430
|
}
|
|
310
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
|
+
*/
|
|
311
450
|
export async function execute(this: IExecuteFunctions, i: number) {
|
|
312
451
|
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
313
452
|
const responseFormatInputMethod = this.getNodeParameter(
|
|
@@ -319,7 +458,11 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
319
458
|
i
|
|
320
459
|
) as string;
|
|
321
460
|
const filter = this.getNodeParameter('filter', i) as string;
|
|
322
|
-
const limit = this.getNodeParameter(
|
|
461
|
+
const limit = this.getNodeParameter(
|
|
462
|
+
'limit',
|
|
463
|
+
i,
|
|
464
|
+
DEFAULT_API_OBJECT_LIMIT
|
|
465
|
+
) as number;
|
|
323
466
|
|
|
324
467
|
let response;
|
|
325
468
|
if (responseFormatInputMethod === 'fields') {
|
|
@@ -327,7 +470,7 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
327
470
|
'responseFormatProperties',
|
|
328
471
|
i
|
|
329
472
|
) as { property: [{ name: string }] };
|
|
330
|
-
response =
|
|
473
|
+
response = createResponseFormatObject(properties.property);
|
|
331
474
|
} else if (responseFormatInputMethod === 'json') {
|
|
332
475
|
response = this.getNodeParameter('responseFormatJson', i) as string;
|
|
333
476
|
response = JSON.parse(response);
|
|
@@ -339,13 +482,13 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
339
482
|
'orderByProperties',
|
|
340
483
|
i
|
|
341
484
|
) as OrderByCollection;
|
|
342
|
-
orderBy =
|
|
485
|
+
orderBy = getOrderBy(orderByCollection);
|
|
343
486
|
} else if (orderByInputMethod === 'json') {
|
|
344
487
|
orderBy = this.getNodeParameter('orderByJson', i) as string;
|
|
345
488
|
orderBy = JSON.parse(orderBy);
|
|
346
489
|
}
|
|
347
490
|
|
|
348
|
-
return await
|
|
491
|
+
return await fetchLimeObjects.call(
|
|
349
492
|
this,
|
|
350
493
|
limetype,
|
|
351
494
|
response,
|
package/nodes/lime-crm/resources/data/operations/{getSingleFile.ts → getSingleFile.operation.ts}
RENAMED
|
@@ -4,8 +4,13 @@ import {
|
|
|
4
4
|
NodeOperationError,
|
|
5
5
|
} from 'n8n-workflow';
|
|
6
6
|
import { getFileContent, getFileContentByLimetype } from '../../../transport';
|
|
7
|
-
import { DATA_RESOURCE } from '../../../
|
|
7
|
+
import { DATA_RESOURCE } from '../../../models';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Description and metadata for the "Get Single File" operation in Lime CRM.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
9
14
|
export const description = {
|
|
10
15
|
name: 'Get Single File',
|
|
11
16
|
value: 'getSingleFile',
|
|
@@ -13,6 +18,16 @@ export const description = {
|
|
|
13
18
|
action: 'Get single file',
|
|
14
19
|
};
|
|
15
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
|
+
*/
|
|
16
31
|
export const properties: INodeProperties[] = [
|
|
17
32
|
{
|
|
18
33
|
displayName: 'Get by',
|
|
@@ -94,19 +109,31 @@ export const properties: INodeProperties[] = [
|
|
|
94
109
|
},
|
|
95
110
|
];
|
|
96
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
|
+
*/
|
|
97
128
|
export async function execute(this: IExecuteFunctions, i: number) {
|
|
98
129
|
const source = this.getNodeParameter('source', i) as string;
|
|
99
130
|
const id = this.getNodeParameter('identifier', i) as string;
|
|
100
131
|
|
|
101
132
|
if (source == 'byFile') {
|
|
102
133
|
const fileResponse = await getFileContent(this, id);
|
|
103
|
-
if (!fileResponse.success) {
|
|
104
|
-
return { json: fileResponse };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
134
|
return {
|
|
108
|
-
json: {
|
|
109
|
-
binary: { data: fileResponse
|
|
135
|
+
json: {},
|
|
136
|
+
binary: { data: fileResponse },
|
|
110
137
|
};
|
|
111
138
|
}
|
|
112
139
|
if (source == 'byLimeobject') {
|
|
@@ -119,14 +146,11 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
119
146
|
id,
|
|
120
147
|
property
|
|
121
148
|
);
|
|
122
|
-
if (!fileResponse.success) {
|
|
123
|
-
return { json: fileResponse };
|
|
124
|
-
}
|
|
125
149
|
|
|
126
150
|
return {
|
|
127
|
-
json: {
|
|
151
|
+
json: {},
|
|
128
152
|
binary: {
|
|
129
|
-
data: fileResponse
|
|
153
|
+
data: fileResponse,
|
|
130
154
|
},
|
|
131
155
|
};
|
|
132
156
|
}
|
package/nodes/lime-crm/resources/data/operations/{getSingleObject.ts → getSingleObject.operation.ts}
RENAMED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
|
|
3
|
-
import { getLimeobject } from '../../../transport';
|
|
4
|
-
import { DATA_RESOURCE } from '../../../
|
|
5
|
-
import {
|
|
3
|
+
import { getLimeobject, getProperties } from '../../../transport';
|
|
4
|
+
import { DATA_RESOURCE } from '../../../models';
|
|
5
|
+
import { getFilePropertiesNames, processFileResponse } from '../../../utils';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Description and metadata for the "Get Single Object" operation in Lime CRM.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
7
12
|
export const description = {
|
|
8
13
|
name: 'Get Single Object',
|
|
9
14
|
value: 'getSingleObject',
|
|
@@ -11,6 +16,15 @@ export const description = {
|
|
|
11
16
|
action: 'Get single object',
|
|
12
17
|
};
|
|
13
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Node properties for the "Get Single Object" operation.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} limetype - The type of entity to retrieve. Loaded from available Limetypes
|
|
23
|
+
* @param {string} objectId - The ID of the object to retrieve
|
|
24
|
+
* @param {boolean} includeFileContent - Whether to include file binary data for Limetypes that have file properties. Ignored for Limetypes without file properties
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
14
28
|
export const properties: INodeProperties[] = [
|
|
15
29
|
{
|
|
16
30
|
displayName: 'Limetype',
|
|
@@ -62,6 +76,24 @@ export const properties: INodeProperties[] = [
|
|
|
62
76
|
},
|
|
63
77
|
];
|
|
64
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Execute the "Get Single Object" operation for Lime CRM.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* This method retrieves a single Lime CRM object identified by its object ID and Limetype.
|
|
84
|
+
* If `includeFileContent` is true, it also retrieves binary data for any file properties of the object.
|
|
85
|
+
*
|
|
86
|
+
* The method performs the following steps:
|
|
87
|
+
* 1. Retrieves the `limetype`, `objectId`, and `includeFileContent` from {@link properties}.
|
|
88
|
+
* 2. Calls {@link getLimeobject} to fetch the object from Lime CRM.
|
|
89
|
+
* 3. If the object has file properties and `includeFileContent` is true, it retrieves file data using {@link getFilePropertiesNames} and {@link processFileResponse}.
|
|
90
|
+
*
|
|
91
|
+
* @param i - The index of the current item in the workflow execution
|
|
92
|
+
*
|
|
93
|
+
* @returns The Lime object data, optionally including file binary content.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
65
97
|
export async function execute(this: IExecuteFunctions, i: number) {
|
|
66
98
|
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
67
99
|
const objectId = this.getNodeParameter('objectId', i) as string;
|
|
@@ -71,13 +103,14 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
71
103
|
) as boolean;
|
|
72
104
|
|
|
73
105
|
const limeObjectResponse = await getLimeobject(this, limetype, objectId);
|
|
74
|
-
if (!limeObjectResponse.success) return { json: limeObjectResponse };
|
|
75
106
|
|
|
76
|
-
const
|
|
107
|
+
const propertiesResponse = await getProperties(this, limetype);
|
|
108
|
+
|
|
109
|
+
const fileProperties = getFilePropertiesNames(propertiesResponse);
|
|
77
110
|
return processFileResponse(
|
|
78
111
|
this,
|
|
79
112
|
fileProperties,
|
|
80
|
-
limeObjectResponse
|
|
113
|
+
limeObjectResponse,
|
|
81
114
|
includeFileContent
|
|
82
115
|
);
|
|
83
116
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @group Resources
|
|
3
|
+
*/
|
|
4
|
+
export * as createSingleObject from './createSingleObject.operation';
|
|
5
|
+
/**
|
|
6
|
+
* @group Resources
|
|
7
|
+
*/
|
|
8
|
+
export * as getSingleObject from './getSingleObject.operation';
|
|
9
|
+
/**
|
|
10
|
+
* @group Resources
|
|
11
|
+
*/
|
|
12
|
+
export * as updateSingleObject from './updateSingleObject.operation';
|
|
13
|
+
/**
|
|
14
|
+
* @group Resources
|
|
15
|
+
*/
|
|
16
|
+
export * as deleteSingleObject from './deleteSingleObject.operation';
|
|
17
|
+
/**
|
|
18
|
+
* @group Resources
|
|
19
|
+
*/
|
|
20
|
+
export * as getManyObjects from './getManyObjects.operation';
|
|
21
|
+
/**
|
|
22
|
+
* @group Resources
|
|
23
|
+
*/
|
|
24
|
+
export * as getSingleFile from './getSingleFile.operation';
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import { updateLimeobject } from '../../../transport';
|
|
3
|
-
import { DATA_RESOURCE } from '../../../
|
|
2
|
+
import { getProperties, updateLimeobject } from '../../../transport';
|
|
3
|
+
import { DATA_RESOURCE } from '../../../models';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
adaptProperty,
|
|
6
|
+
getFilePropertiesNames,
|
|
7
|
+
getPropertyType,
|
|
6
8
|
processFileResponse,
|
|
7
9
|
setFileProperties,
|
|
8
|
-
} from '../../../
|
|
10
|
+
} from '../../../utils';
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Description and metadata for the "Update Single Object" operation in Lime CRM.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
11
17
|
export const description = {
|
|
12
18
|
name: 'Update Single Object',
|
|
13
19
|
value: 'updateSingleObject',
|
|
@@ -15,6 +21,17 @@ export const description = {
|
|
|
15
21
|
action: 'Update single object',
|
|
16
22
|
};
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Node properties for the "Update Single Object" operation.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} limetype - The type of entity to update. Loaded from available Limetypes
|
|
28
|
+
* @param {string} id - The ID of the object to update
|
|
29
|
+
* @param {'simple' | 'json'} inputType - How the object data is provided: 'simple' for form inputs, 'json' for raw JSON
|
|
30
|
+
* @param {IDataObject} simpleFields - Used if `inputType` is 'simple'. List of field name/value pairs to update
|
|
31
|
+
* @param {string} jsonData - Used if `inputType` is 'json'. Full object data in JSON format
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
18
35
|
export const properties: INodeProperties[] = [
|
|
19
36
|
{
|
|
20
37
|
displayName: 'Limetype',
|
|
@@ -118,7 +135,7 @@ export const properties: INodeProperties[] = [
|
|
|
118
135
|
name: 'fieldName',
|
|
119
136
|
type: 'options',
|
|
120
137
|
typeOptions: {
|
|
121
|
-
loadOptionsMethod: '
|
|
138
|
+
loadOptionsMethod: 'getNoHasManyProperties',
|
|
122
139
|
loadOptionsDependsOn: ['limetype'],
|
|
123
140
|
},
|
|
124
141
|
default: '',
|
|
@@ -137,6 +154,27 @@ export const properties: INodeProperties[] = [
|
|
|
137
154
|
},
|
|
138
155
|
];
|
|
139
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Execute the "Update Single Object" operation for Lime CRM.
|
|
159
|
+
*
|
|
160
|
+
* @remarks
|
|
161
|
+
* This method updates a single Lime CRM object identified by its ID and Limetype.
|
|
162
|
+
* It supports two input methods:
|
|
163
|
+
* - 'simple': key-value pairs provided via the UI
|
|
164
|
+
* - 'json': full object data in JSON format
|
|
165
|
+
*
|
|
166
|
+
* The method performs the following steps:
|
|
167
|
+
* 1. Retrieves the `limetype`, `id`, and input data from {@link properties}.
|
|
168
|
+
* 2. Collects and prepares any file properties using {@link getFilePropertiesNames} and {@link setFileProperties}.
|
|
169
|
+
* 3. Calls {@link updateLimeobject} to update the object in Lime CRM.
|
|
170
|
+
* 4. Processes the response, including file properties, using {@link processFileResponse}.
|
|
171
|
+
*
|
|
172
|
+
* @param i - The index of the current item in the workflow execution
|
|
173
|
+
*
|
|
174
|
+
* @returns The updated Lime object data, optionally including file binary content.
|
|
175
|
+
*
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
140
178
|
export async function execute(this: IExecuteFunctions, i: number) {
|
|
141
179
|
const limetype = this.getNodeParameter('limetype', i) as string;
|
|
142
180
|
const id = this.getNodeParameter('id', i) as string;
|
|
@@ -144,6 +182,8 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
144
182
|
|
|
145
183
|
let body: IDataObject = {};
|
|
146
184
|
|
|
185
|
+
const properties = await getProperties(this, limetype);
|
|
186
|
+
|
|
147
187
|
if (inputType === 'json') {
|
|
148
188
|
const jsonData = this.getNodeParameter('jsonData', i) as string;
|
|
149
189
|
body = JSON.parse(jsonData);
|
|
@@ -154,19 +194,18 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
154
194
|
[]
|
|
155
195
|
) as IDataObject[];
|
|
156
196
|
for (const field of simpleFields) {
|
|
157
|
-
|
|
197
|
+
const fieldName = field.fieldName as string;
|
|
198
|
+
const fieldValue = field.fieldValue as string;
|
|
199
|
+
body[fieldName] = adaptProperty(
|
|
200
|
+
fieldValue,
|
|
201
|
+
getPropertyType(fieldName, properties)
|
|
202
|
+
);
|
|
158
203
|
}
|
|
159
204
|
}
|
|
160
205
|
|
|
161
|
-
const fileProperties =
|
|
206
|
+
const fileProperties = getFilePropertiesNames(properties);
|
|
162
207
|
|
|
163
|
-
|
|
164
|
-
this,
|
|
165
|
-
i,
|
|
166
|
-
fileProperties,
|
|
167
|
-
body
|
|
168
|
-
);
|
|
169
|
-
if (!setFilePropertiesResponse.success) return setFilePropertiesResponse;
|
|
208
|
+
await setFileProperties(this, i, fileProperties, body);
|
|
170
209
|
|
|
171
210
|
const updateLimeobjectResponse = await updateLimeobject(
|
|
172
211
|
this,
|
|
@@ -174,12 +213,11 @@ export async function execute(this: IExecuteFunctions, i: number) {
|
|
|
174
213
|
id,
|
|
175
214
|
body
|
|
176
215
|
);
|
|
177
|
-
if (!updateLimeobjectResponse.success) return updateLimeobjectResponse;
|
|
178
216
|
|
|
179
217
|
const response = await processFileResponse(
|
|
180
218
|
this,
|
|
181
219
|
fileProperties,
|
|
182
|
-
updateLimeobjectResponse
|
|
220
|
+
updateLimeobjectResponse
|
|
183
221
|
);
|
|
184
222
|
return response.json;
|
|
185
223
|
}
|