@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,232 +1,167 @@
|
|
|
1
|
-
import { callLimeApi,
|
|
2
|
-
import { IAllExecuteFunctions
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { callLimeApi, prepareResponseWithoutKeys } from './commons';
|
|
2
|
+
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
3
|
+
import { Limeobject } from '../models';
|
|
4
|
+
import { APIResponse } from '../../response';
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint path for Lime CRM Limeobject API.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
* @group Transport
|
|
10
|
+
*/
|
|
6
11
|
const LIMEOBJECT_URL = '/api/v1/limeobject/';
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Single Limeobject representation returned by the CRM API.
|
|
15
|
+
*
|
|
16
|
+
* @property id_ - The unique ID of the Limeobject
|
|
17
|
+
* @property _links - Links metadata returned by the API (not used in processing)
|
|
18
|
+
* @public
|
|
19
|
+
* @group Transport
|
|
20
|
+
*/
|
|
21
|
+
export interface LimeobjectCrmApiResponse {
|
|
9
22
|
id_: number;
|
|
10
23
|
_links: object;
|
|
11
24
|
}
|
|
12
25
|
|
|
13
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Representation of the response from the CRM API when fetching multiple Limeobjects.
|
|
28
|
+
*
|
|
29
|
+
* @property _embedded - The embedded resources
|
|
30
|
+
* @property _embedded.limeobjects - An array of Limeobjects returned by the API. {@link LimeobjectCrmApiResponse}
|
|
31
|
+
* @public
|
|
32
|
+
* @group Transport
|
|
33
|
+
*/
|
|
34
|
+
export interface FetchManyLimeobjectsApiResponse {
|
|
14
35
|
_embedded: {
|
|
15
36
|
limeobjects: LimeobjectCrmApiResponse[];
|
|
16
37
|
};
|
|
17
38
|
}
|
|
18
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Create a new Limeobject for the specified Limetype.
|
|
42
|
+
*
|
|
43
|
+
* @param nodeContext - The n8n execution context
|
|
44
|
+
* @param limetype - The Limetype of the object to create
|
|
45
|
+
* @param data - The data object to send to the API
|
|
46
|
+
* @returns The created Limeobject
|
|
47
|
+
* @public
|
|
48
|
+
* @group Transport
|
|
49
|
+
*/
|
|
19
50
|
export async function createLimeobject(
|
|
20
51
|
nodeContext: IAllExecuteFunctions,
|
|
21
52
|
limetype: string,
|
|
22
53
|
data: object
|
|
23
|
-
): Promise<
|
|
54
|
+
): Promise<APIResponse<Limeobject>> {
|
|
24
55
|
const url = `${LIMEOBJECT_URL}${limetype}/`;
|
|
25
|
-
const response = await callLimeApi<LimeobjectCrmApiResponse>(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
56
|
+
const response = await callLimeApi<LimeobjectCrmApiResponse>(nodeContext, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
url: url,
|
|
59
|
+
requestOptions: {
|
|
30
60
|
body: data,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (response.success)
|
|
34
|
-
return {
|
|
35
|
-
success: true,
|
|
36
|
-
data: removeKeys(response.data, ['_links']),
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
...response,
|
|
41
|
-
metadata: {
|
|
42
|
-
...response.metadata,
|
|
61
|
+
},
|
|
62
|
+
errorMetadata: {
|
|
43
63
|
limetype: limetype,
|
|
44
64
|
},
|
|
45
|
-
};
|
|
65
|
+
});
|
|
66
|
+
if (response.success) {
|
|
67
|
+
return prepareResponseWithoutKeys(response, ['_links']);
|
|
68
|
+
} else {
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
46
71
|
}
|
|
47
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Delete a Limeobject.
|
|
75
|
+
*
|
|
76
|
+
* @param nodeContext - The n8n execution context
|
|
77
|
+
* @param limetype - The Limetype of the object to delete
|
|
78
|
+
* @param id - The ID of the Limeobject
|
|
79
|
+
* @returns empty response
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
* @group Transport
|
|
83
|
+
*/
|
|
48
84
|
export async function deleteLimeobject(
|
|
49
85
|
nodeContext: IAllExecuteFunctions,
|
|
50
86
|
limetype: string,
|
|
51
87
|
id: string
|
|
52
|
-
): Promise<
|
|
88
|
+
): Promise<APIResponse<Record<string, never>>> {
|
|
53
89
|
const url = `${LIMEOBJECT_URL}${limetype}/${id}/`;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
if (response.success) return response;
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
...response,
|
|
64
|
-
metadata: {
|
|
65
|
-
...response.metadata,
|
|
90
|
+
return await callLimeApi<Record<string, never>>(nodeContext, {
|
|
91
|
+
method: 'DELETE',
|
|
92
|
+
url: url,
|
|
93
|
+
errorMetadata: {
|
|
66
94
|
limetype: limetype,
|
|
67
95
|
id: id,
|
|
68
96
|
},
|
|
69
|
-
};
|
|
97
|
+
});
|
|
70
98
|
}
|
|
71
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Retrieve a Limeobject.
|
|
102
|
+
*
|
|
103
|
+
* @param nodeContext - The n8n execution context
|
|
104
|
+
* @param limetype - The Limetype of the object to retrieve
|
|
105
|
+
* @param id - The ID of the Limeobject
|
|
106
|
+
* @returns The Limeobject.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
* @group Transport
|
|
110
|
+
*/
|
|
72
111
|
export async function getLimeobject(
|
|
73
112
|
nodeContext: IAllExecuteFunctions,
|
|
74
113
|
limetype: string,
|
|
75
114
|
id: string
|
|
76
|
-
): Promise<
|
|
115
|
+
): Promise<APIResponse<Limeobject>> {
|
|
77
116
|
const url = `${LIMEOBJECT_URL}${limetype}/${id}/`;
|
|
78
|
-
const response = await callLimeApi<LimeobjectCrmApiResponse>(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
if (response.success)
|
|
85
|
-
return {
|
|
86
|
-
success: true,
|
|
87
|
-
data: removeKeys(response.data, ['_links']),
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
...response,
|
|
92
|
-
metadata: {
|
|
93
|
-
...response.metadata,
|
|
117
|
+
const response = await callLimeApi<LimeobjectCrmApiResponse>(nodeContext, {
|
|
118
|
+
method: 'GET',
|
|
119
|
+
url: url,
|
|
120
|
+
errorMetadata: {
|
|
94
121
|
limetype: limetype,
|
|
95
122
|
id: id,
|
|
96
123
|
},
|
|
97
|
-
};
|
|
124
|
+
});
|
|
125
|
+
if (response.success) {
|
|
126
|
+
return prepareResponseWithoutKeys(response, ['_links']);
|
|
127
|
+
} else {
|
|
128
|
+
return response;
|
|
129
|
+
}
|
|
98
130
|
}
|
|
99
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Update a Limeobject.
|
|
134
|
+
*
|
|
135
|
+
* @param nodeContext - The n8n execution context
|
|
136
|
+
* @param limetype - The Limetype of the object to update
|
|
137
|
+
* @param id - The ID of the Limeobject
|
|
138
|
+
* @param data - The updated data to send
|
|
139
|
+
* @returns The updated Limeobject.
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
* @group Transport
|
|
143
|
+
*/
|
|
100
144
|
export async function updateLimeobject(
|
|
101
145
|
nodeContext: IAllExecuteFunctions,
|
|
102
146
|
limetype: string,
|
|
103
147
|
id: string,
|
|
104
148
|
data: object
|
|
105
|
-
): Promise<
|
|
149
|
+
): Promise<APIResponse<Limeobject>> {
|
|
106
150
|
const url = `${LIMEOBJECT_URL}${limetype}/${id}/`;
|
|
107
|
-
const response = await callLimeApi<LimeobjectCrmApiResponse>(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
{
|
|
151
|
+
const response = await callLimeApi<LimeobjectCrmApiResponse>(nodeContext, {
|
|
152
|
+
method: 'PUT',
|
|
153
|
+
url: url,
|
|
154
|
+
requestOptions: {
|
|
112
155
|
body: data,
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (response.success)
|
|
117
|
-
return {
|
|
118
|
-
success: true,
|
|
119
|
-
data: removeKeys(response.data, ['_links']),
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
...response,
|
|
124
|
-
metadata: {
|
|
125
|
-
...response.metadata,
|
|
156
|
+
},
|
|
157
|
+
errorMetadata: {
|
|
126
158
|
limetype: limetype,
|
|
127
159
|
id: id,
|
|
128
160
|
},
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
async function _searchLimeobjectWithLimit(
|
|
133
|
-
nodeContext: IAllExecuteFunctions,
|
|
134
|
-
url: string,
|
|
135
|
-
limit: number,
|
|
136
|
-
offset: number,
|
|
137
|
-
qs: IDataObject
|
|
138
|
-
): Promise<NodeResponse<FetchManyLimeobjectsApiResponse>> {
|
|
139
|
-
const returnData: LimeobjectCrmApiResponse[] = [];
|
|
140
|
-
let hasMoreData = true;
|
|
141
|
-
let currentOffset = Math.max(0, offset);
|
|
142
|
-
const pageLimit = 50;
|
|
143
|
-
|
|
144
|
-
while (hasMoreData) {
|
|
145
|
-
qs._limit = Math.min(limit, pageLimit);
|
|
146
|
-
qs._offset = currentOffset;
|
|
147
|
-
|
|
148
|
-
const response = await callLimeApi<FetchManyLimeobjectsApiResponse>(
|
|
149
|
-
nodeContext,
|
|
150
|
-
'GET',
|
|
151
|
-
url,
|
|
152
|
-
{
|
|
153
|
-
qs: qs,
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
if (!response.success) return response;
|
|
157
|
-
|
|
158
|
-
const items = response.data._embedded?.limeobjects || [];
|
|
159
|
-
|
|
160
|
-
if (items.length === 0) {
|
|
161
|
-
hasMoreData = false;
|
|
162
|
-
} else {
|
|
163
|
-
returnData.push(...items);
|
|
164
|
-
currentOffset += items.length;
|
|
165
|
-
limit -= items.length;
|
|
166
|
-
|
|
167
|
-
if (limit <= 0) {
|
|
168
|
-
hasMoreData = false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
success: true,
|
|
174
|
-
data: { _embedded: { limeobjects: returnData } },
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export async function fetchManyLimeobjects(
|
|
179
|
-
nodeContext: IAllExecuteFunctions,
|
|
180
|
-
limetype: string,
|
|
181
|
-
searchField: string,
|
|
182
|
-
searchTerm: string,
|
|
183
|
-
limit: number,
|
|
184
|
-
offset: number,
|
|
185
|
-
sortField: string | null
|
|
186
|
-
): Promise<NodeResponse<Limeobject[]>> {
|
|
187
|
-
const url = `${LIMEOBJECT_URL}${limetype}/`;
|
|
188
|
-
const qs: IDataObject = {
|
|
189
|
-
...(searchField && searchTerm && { [searchField]: searchTerm }),
|
|
190
|
-
...(offset != null && offset > 0 && { _offset: offset }),
|
|
191
|
-
...(sortField != null && { _sort: sortField }),
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
let response;
|
|
195
|
-
if (limit) {
|
|
196
|
-
response = await _searchLimeobjectWithLimit(
|
|
197
|
-
nodeContext,
|
|
198
|
-
url,
|
|
199
|
-
limit,
|
|
200
|
-
offset,
|
|
201
|
-
qs
|
|
202
|
-
);
|
|
203
|
-
} else {
|
|
204
|
-
response = await callLimeApi<FetchManyLimeobjectsApiResponse>(
|
|
205
|
-
nodeContext,
|
|
206
|
-
'GET',
|
|
207
|
-
url,
|
|
208
|
-
{
|
|
209
|
-
qs: qs,
|
|
210
|
-
}
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
161
|
+
});
|
|
214
162
|
if (response.success) {
|
|
215
|
-
return
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
response.data?._embedded.limeobjects.map((limeobject) =>
|
|
219
|
-
removeKeys(limeobject, ['_links'])
|
|
220
|
-
) ?? [],
|
|
221
|
-
};
|
|
163
|
+
return prepareResponseWithoutKeys(response, ['_links']);
|
|
164
|
+
} else {
|
|
165
|
+
return response;
|
|
222
166
|
}
|
|
223
|
-
return {
|
|
224
|
-
success: response.success,
|
|
225
|
-
error: response.error,
|
|
226
|
-
status: response.status,
|
|
227
|
-
metadata: {
|
|
228
|
-
...response.metadata,
|
|
229
|
-
limetype: limetype,
|
|
230
|
-
},
|
|
231
|
-
};
|
|
232
167
|
}
|
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
import { callLimeApi } from '.';
|
|
2
2
|
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
3
|
-
import { Limetype, LimetypeProperty } from '../model';
|
|
4
|
-
import { NodeResponse } from '../../nodeResponse';
|
|
5
3
|
import { removeKeys } from './commons';
|
|
4
|
+
import { Limetype, LimetypeProperty } from '../models';
|
|
5
|
+
import { APIResponse } from '../../response';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Endpoint path for Lime CRM Limetype API.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
* @group Transport
|
|
12
|
+
*/
|
|
7
13
|
const LIMETYPE_URL = '/api/v1/limetype/';
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Lime CRM Limetype API response structure.
|
|
17
|
+
*
|
|
18
|
+
* @property name - The internal name of the property
|
|
19
|
+
* @property _links - Optional API link metadata
|
|
20
|
+
* @property _embedded - Optional embedded resources
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* @group Transport
|
|
24
|
+
*/
|
|
25
|
+
export interface LimetypePropertyApiResponse {
|
|
10
26
|
name: string;
|
|
11
27
|
_links?: object;
|
|
12
28
|
_embedded?: object;
|
|
13
29
|
}
|
|
14
30
|
|
|
15
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Representation of a single Limetype object returned by the Lime CRM API.
|
|
33
|
+
*
|
|
34
|
+
* @property name - The internal name of the Limetype
|
|
35
|
+
* @property localname - Optional local name for singular and plural forms
|
|
36
|
+
* @property _embedded - Contains the Limetype's properties
|
|
37
|
+
* @property _links - API link metadata.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
* @group Transport
|
|
41
|
+
*/
|
|
42
|
+
export interface LimetypeCrmApiResponse {
|
|
16
43
|
name: string;
|
|
17
44
|
localname?: {
|
|
18
45
|
singular?: string;
|
|
@@ -24,19 +51,49 @@ interface LimetypeCrmApiResponse {
|
|
|
24
51
|
_links: object;
|
|
25
52
|
}
|
|
26
53
|
|
|
27
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Response structure for the `/limetype/` endpoint.
|
|
56
|
+
*
|
|
57
|
+
* @property _embedded - The embedded resources
|
|
58
|
+
* @property _embedded.limetypes - The list of Limetype definitions
|
|
59
|
+
* @property _embedded._links - API link metadata
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
* @group Transport
|
|
63
|
+
*/
|
|
64
|
+
export interface LimetypesCrmApiResponse {
|
|
28
65
|
_embedded: {
|
|
29
66
|
limetypes: LimetypeCrmApiResponse[];
|
|
30
67
|
_links: object;
|
|
31
68
|
};
|
|
32
69
|
}
|
|
33
70
|
|
|
34
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Response structure for the Limetype properties API.
|
|
73
|
+
*
|
|
74
|
+
* @property _embedded - The embedded resources
|
|
75
|
+
* @property _embedded.properties - The list of Limetype properties
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
* @group Transport
|
|
79
|
+
*/
|
|
80
|
+
export interface LimetypePropertiesApiResponse {
|
|
35
81
|
_embedded: {
|
|
36
82
|
properties: LimetypeCrmApiResponse[];
|
|
37
83
|
};
|
|
38
84
|
}
|
|
39
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Transform a Lime CRM API Limetype response into an internal {@link Limetype} model.
|
|
88
|
+
*
|
|
89
|
+
* Removes `_links` and `_embedded` metadata while preserving property data.
|
|
90
|
+
*
|
|
91
|
+
* @param limetype - The raw Limetype API response.
|
|
92
|
+
* @returns A deserialized {@link Limetype} object.
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
* @group Transport
|
|
96
|
+
*/
|
|
40
97
|
function deserializeLimetype(limetype: LimetypeCrmApiResponse): Limetype {
|
|
41
98
|
return {
|
|
42
99
|
...removeKeys(limetype, ['_links', '_embedded']),
|
|
@@ -46,19 +103,27 @@ function deserializeLimetype(limetype: LimetypeCrmApiResponse): Limetype {
|
|
|
46
103
|
} as Limetype;
|
|
47
104
|
}
|
|
48
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Fetch all available Limetypes from the Lime CRM API, including their properties.
|
|
108
|
+
*
|
|
109
|
+
* @param nodeContext - The n8n execution context
|
|
110
|
+
* @returns A list of {@link Limetype} objects
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
113
|
+
* @group Transport
|
|
114
|
+
*/
|
|
49
115
|
export async function getLimetypesFromApi(
|
|
50
116
|
nodeContext: IAllExecuteFunctions
|
|
51
|
-
): Promise<
|
|
52
|
-
const response = await callLimeApi<LimetypesCrmApiResponse>(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
117
|
+
): Promise<APIResponse<Limetype[]>> {
|
|
118
|
+
const response = await callLimeApi<LimetypesCrmApiResponse>(nodeContext, {
|
|
119
|
+
method: 'GET',
|
|
120
|
+
url: LIMETYPE_URL,
|
|
121
|
+
requestOptions: {
|
|
57
122
|
qs: {
|
|
58
123
|
_embed: 'limetypes.properties',
|
|
59
124
|
},
|
|
60
|
-
}
|
|
61
|
-
);
|
|
125
|
+
},
|
|
126
|
+
});
|
|
62
127
|
if (response.success) {
|
|
63
128
|
return {
|
|
64
129
|
success: true,
|
|
@@ -66,62 +131,80 @@ export async function getLimetypesFromApi(
|
|
|
66
131
|
response.data._embedded?.limetypes.map(deserializeLimetype) ||
|
|
67
132
|
[],
|
|
68
133
|
};
|
|
134
|
+
} else {
|
|
135
|
+
return response;
|
|
69
136
|
}
|
|
70
|
-
return response;
|
|
71
137
|
}
|
|
72
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Fetch a specific Limetype definition from the Lime CRM API.
|
|
141
|
+
*
|
|
142
|
+
* @param nodeContext - The n8n execution context
|
|
143
|
+
* @param limetype - The internal name of the Limetype to fetch
|
|
144
|
+
* @returns A {@link Limetype} object
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
* @group Transport
|
|
148
|
+
*/
|
|
73
149
|
export async function getLimetype(
|
|
74
150
|
nodeContext: IAllExecuteFunctions,
|
|
75
151
|
limetype: string
|
|
76
|
-
): Promise<
|
|
152
|
+
): Promise<APIResponse<Limetype>> {
|
|
77
153
|
const url = `${LIMETYPE_URL}${limetype}/`;
|
|
78
|
-
const response = await callLimeApi<LimetypeCrmApiResponse>(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{
|
|
154
|
+
const response = await callLimeApi<LimetypeCrmApiResponse>(nodeContext, {
|
|
155
|
+
method: 'GET',
|
|
156
|
+
url: url,
|
|
157
|
+
requestOptions: {
|
|
83
158
|
qs: {
|
|
84
159
|
_embed: 'properties',
|
|
85
160
|
},
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
if (response.success)
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
if (response.success) {
|
|
90
164
|
return {
|
|
91
165
|
success: true,
|
|
92
166
|
data: deserializeLimetype(response.data),
|
|
93
167
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
metadata: {
|
|
98
|
-
...response.metadata,
|
|
99
|
-
limetype: limetype,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
168
|
+
} else {
|
|
169
|
+
return response;
|
|
170
|
+
}
|
|
102
171
|
}
|
|
103
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Fetch the property definitions of a specific Limetype.
|
|
175
|
+
*
|
|
176
|
+
* @param nodeContext - The n8n execution context
|
|
177
|
+
* @param limetype - The internal name of the Limetype to fetch properties for
|
|
178
|
+
* @returns An array of {@link LimetypeProperty} objects.
|
|
179
|
+
*
|
|
180
|
+
* @public
|
|
181
|
+
* @group Transport
|
|
182
|
+
*/
|
|
104
183
|
export async function getProperties(
|
|
105
184
|
nodeContext: IAllExecuteFunctions,
|
|
106
185
|
limetype: string
|
|
107
|
-
): Promise<
|
|
186
|
+
): Promise<APIResponse<LimetypeProperty[]>> {
|
|
108
187
|
const url = `${LIMETYPE_URL}${limetype}/`;
|
|
109
188
|
const response = await callLimeApi<LimetypePropertiesApiResponse>(
|
|
110
189
|
nodeContext,
|
|
111
|
-
'GET',
|
|
112
|
-
url,
|
|
113
190
|
{
|
|
114
|
-
|
|
115
|
-
|
|
191
|
+
method: 'GET',
|
|
192
|
+
url: url,
|
|
193
|
+
requestOptions: {
|
|
194
|
+
qs: {
|
|
195
|
+
_embed: 'properties',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
errorMetadata: {
|
|
199
|
+
limetype: limetype,
|
|
116
200
|
},
|
|
117
201
|
}
|
|
118
202
|
);
|
|
119
|
-
|
|
120
203
|
if (response.success) {
|
|
121
204
|
return {
|
|
122
205
|
success: true,
|
|
123
206
|
data:
|
|
124
|
-
response.data
|
|
207
|
+
response.data._embedded.properties.map(
|
|
125
208
|
(property) =>
|
|
126
209
|
removeKeys(property, [
|
|
127
210
|
'_links',
|
|
@@ -129,13 +212,7 @@ export async function getProperties(
|
|
|
129
212
|
]) as LimetypeProperty
|
|
130
213
|
) || [],
|
|
131
214
|
};
|
|
215
|
+
} else {
|
|
216
|
+
return response;
|
|
132
217
|
}
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
...response,
|
|
136
|
-
metadata: {
|
|
137
|
-
...response.metadata,
|
|
138
|
-
limetype: limetype,
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
218
|
}
|