@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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Webhook, WebhookContext, WebhookFunctions } from '../models';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extract and format event identifiers from the node parameters.
|
|
5
|
+
*
|
|
6
|
+
* Builds an array of event strings in the format `<limetype>.<eventType>`
|
|
7
|
+
* based on the selected events.
|
|
8
|
+
*
|
|
9
|
+
* @param hookData - The n8n hook context
|
|
10
|
+
* @returns An array of formatted event strings.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
* @group Utils
|
|
14
|
+
*/
|
|
15
|
+
function getEvents(hookData: WebhookFunctions): string[] {
|
|
16
|
+
const eventData = hookData.getNodeParameter('events', []) as {
|
|
17
|
+
event: Array<{
|
|
18
|
+
limetype: string;
|
|
19
|
+
eventType: string;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
const eventItems = eventData.event;
|
|
23
|
+
const events: string[] = [];
|
|
24
|
+
for (const eventItem of eventItems) {
|
|
25
|
+
events.push(`${eventItem.limetype}.${eventItem.eventType}`);
|
|
26
|
+
}
|
|
27
|
+
return events;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Generate a unique webhook name based on the selected Lime type and event.
|
|
32
|
+
*
|
|
33
|
+
* The name is constructed using the format:
|
|
34
|
+
* `<limetype>-<eventType>-<timestamp>`, ensuring uniqueness for each webhook.
|
|
35
|
+
*
|
|
36
|
+
* @param hookData - The n8n hook context used to access node parameters
|
|
37
|
+
* @returns A unique webhook name string.
|
|
38
|
+
*
|
|
39
|
+
* @internal
|
|
40
|
+
* @group Utils
|
|
41
|
+
*/
|
|
42
|
+
function createWebhookName(hookData: WebhookFunctions): string {
|
|
43
|
+
interface Events {
|
|
44
|
+
event: Array<{
|
|
45
|
+
limetype: string;
|
|
46
|
+
eventType: string;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const events = hookData.getNodeParameter('events') as Events;
|
|
51
|
+
return `${events.event[0].limetype}-${events.event[0].eventType}-${Date.now()}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Retrieve a fully constructed webhook object from the given node context.
|
|
56
|
+
*
|
|
57
|
+
* @param hookData - The n8n node context
|
|
58
|
+
*
|
|
59
|
+
* @returns A {@link Webhook} object with a generated name
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
* @group Utils
|
|
63
|
+
*/
|
|
64
|
+
export function getWebhook(hookData: WebhookFunctions): Webhook {
|
|
65
|
+
const node = hookData.getNode();
|
|
66
|
+
const workflow = hookData.getWorkflow();
|
|
67
|
+
const context: WebhookContext = {
|
|
68
|
+
nodeId: node.id,
|
|
69
|
+
nodeName: node.name,
|
|
70
|
+
workflowId: workflow.id,
|
|
71
|
+
workflowName: workflow.name,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
data: hookData.getWorkflowStaticData('node'),
|
|
76
|
+
events: getEvents(hookData),
|
|
77
|
+
url: hookData.getNodeWebhookUrl('default'),
|
|
78
|
+
context: context,
|
|
79
|
+
name: createWebhookName(hookData),
|
|
80
|
+
};
|
|
81
|
+
}
|
package/nodes/modules.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { INodeProperties, INodePropertyOptions } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper class describing a typical module for .operation.ts files
|
|
5
|
+
*/
|
|
6
|
+
interface N8NOperationModule {
|
|
7
|
+
description: INodePropertyOptions;
|
|
8
|
+
properties?: INodeProperties[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Utility class used to simplify handling modules in N8N classes and
|
|
13
|
+
* show them in a standardized way
|
|
14
|
+
*/
|
|
15
|
+
export class N8NOperationModuleHandler {
|
|
16
|
+
modules: N8NOperationModule[];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Constructor class
|
|
20
|
+
* @param modules - list of modules for a given resource
|
|
21
|
+
*/
|
|
22
|
+
constructor(modules: N8NOperationModule[]) {
|
|
23
|
+
this.modules = modules.sort((operation1, operation2) =>
|
|
24
|
+
operation1.description.name.localeCompare(
|
|
25
|
+
operation2.description.name,
|
|
26
|
+
'en'
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Return descriptions for all the modules for a given resource
|
|
33
|
+
*/
|
|
34
|
+
getDescriptions(): INodePropertyOptions[] {
|
|
35
|
+
return this.modules.map((operation) => operation.description);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns flatten properties for all modules for a given resource
|
|
40
|
+
*/
|
|
41
|
+
getProperties(): INodeProperties[] {
|
|
42
|
+
return this.modules.flatMap((operation) => operation.properties || []);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { IBinaryData } from 'n8n-workflow';
|
|
2
|
+
import { ErrorResponse, WorkflowErrorContext } from './errorHandling';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper for successful response
|
|
6
|
+
*/
|
|
7
|
+
export type SuccessResponse<T> = {
|
|
8
|
+
success: true;
|
|
9
|
+
data: T;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Generic wrapper used for describing the data we are returning from workflow
|
|
14
|
+
* execution for the user
|
|
15
|
+
*/
|
|
16
|
+
export type WorkflowResponse<T> = T | { error: WorkflowErrorContext };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Generic wrapper used for describing the data we are getting from the
|
|
20
|
+
* external API layer
|
|
21
|
+
*/
|
|
22
|
+
export type APIResponse<T> = SuccessResponse<T> | ErrorResponse;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Response object that includes both JSON data and optional binary file content.
|
|
26
|
+
* Works in communication layer
|
|
27
|
+
*
|
|
28
|
+
* @typeParam T - The shape of the JSON data returned in the response
|
|
29
|
+
* @property json - The {@link APIResponse} object, containing structured JSON data.
|
|
30
|
+
* @property binary - An optional record of binary file data
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* @group Response
|
|
34
|
+
*/
|
|
35
|
+
export type FileAPIResponse<T> = {
|
|
36
|
+
json: APIResponse<T>;
|
|
37
|
+
binary?: Record<string, IBinaryData>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Response object that includes both JSON data and optional binary file content.
|
|
42
|
+
* Works in user interface layer
|
|
43
|
+
*
|
|
44
|
+
* @typeParam T - The shape of the JSON data returned in the response
|
|
45
|
+
* @property json - The {@link WorflowResponse} object, containing structured JSON data.
|
|
46
|
+
* @property binary - An optional record of binary file data
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
* @group Response
|
|
50
|
+
*/
|
|
51
|
+
export type WorkflowFileResponse<T> = {
|
|
52
|
+
json: WorkflowResponse<T>;
|
|
53
|
+
binary?: Record<string, IBinaryData>;
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/n8n-nodes-lime",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.5.0-dev.1",
|
|
4
4
|
"description": "n8n node to connect to Lime CRM",
|
|
5
|
-
"
|
|
6
|
-
"main": "index.js",
|
|
5
|
+
"main": "nodes/index.ts",
|
|
7
6
|
"scripts": {
|
|
8
7
|
"build": "tsc && copyfiles \"nodes/**/*.svg\" dist",
|
|
9
8
|
"dev": "tsc --watch",
|
|
@@ -13,7 +12,9 @@
|
|
|
13
12
|
"lint:fix": "eslint --max-warnings=0 . --fix",
|
|
14
13
|
"format": "prettier -c .",
|
|
15
14
|
"format:fix": "prettier --write .",
|
|
16
|
-
"test": "jest"
|
|
15
|
+
"test": "jest",
|
|
16
|
+
"docs": "npx typedoc",
|
|
17
|
+
"knip": "knip"
|
|
17
18
|
},
|
|
18
19
|
"keywords": [
|
|
19
20
|
"n8n",
|
|
@@ -36,41 +37,33 @@
|
|
|
36
37
|
]
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
40
|
+
"@limetech/eslint-config": "^4.0.0",
|
|
39
41
|
"@semantic-release/changelog": "^6.0.3",
|
|
40
|
-
"@semantic-release/
|
|
42
|
+
"@semantic-release/exec": "^7.1.0",
|
|
41
43
|
"@semantic-release/git": "^10.0.1",
|
|
42
|
-
"@semantic-release/github": "^11.0.4",
|
|
43
|
-
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
44
44
|
"@types/jest": "^30.0.0",
|
|
45
|
-
"@types/node": "^
|
|
46
|
-
"@types/request-promise-native": "^1.0.18",
|
|
45
|
+
"@types/node": "^24.10.1",
|
|
47
46
|
"@types/ws": "^8.18.1",
|
|
48
|
-
"
|
|
49
|
-
"@typescript-eslint/parser": "^8.38.0",
|
|
50
|
-
"concurrently": "^7.0.0",
|
|
47
|
+
"concurrently": "^9.2.1",
|
|
51
48
|
"copyfiles": "^2.4.1",
|
|
52
|
-
"eslint": "^9.
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"install": "^0.13.0",
|
|
57
|
-
"jest": "^30.0.5",
|
|
58
|
-
"nodemon": "^2.0.15",
|
|
59
|
-
"npm": "^11.5.2",
|
|
49
|
+
"eslint": "^9.39.1",
|
|
50
|
+
"jest": "^30.2.0",
|
|
51
|
+
"knip": "^5.69.0",
|
|
52
|
+
"nodemon": "^3.1.11",
|
|
60
53
|
"prettier": "^3.6.2",
|
|
61
|
-
"semantic-release": "^
|
|
62
|
-
"ts-jest": "^29.4.
|
|
63
|
-
"
|
|
54
|
+
"semantic-release": "^25.0.2",
|
|
55
|
+
"ts-jest": "^29.4.5",
|
|
56
|
+
"typedoc": "^0.28.14",
|
|
57
|
+
"typescript": "^5.9.3"
|
|
64
58
|
},
|
|
65
59
|
"dependencies": {
|
|
66
|
-
"@limetech/eslint-config": "^3.0.2",
|
|
67
|
-
"@semantic-release/exec": "^7.1.0",
|
|
68
60
|
"currency-codes": "^2.2.0",
|
|
69
|
-
"request": "^2.88.2",
|
|
70
|
-
"request-promise-native": "^1.0.9",
|
|
71
61
|
"ws": "^8.18.3"
|
|
72
62
|
},
|
|
73
63
|
"peerDependencies": {
|
|
74
64
|
"n8n-workflow": "^1.109.0"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
75
68
|
}
|
|
76
|
-
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCreateMappingColumns,
|
|
3
|
+
getUpdateMappingColumns,
|
|
4
|
+
LimetypeProperty,
|
|
5
|
+
SuccessResponse,
|
|
6
|
+
} from '../../../nodes';
|
|
7
|
+
import { ILoadOptionsFunctions } from 'n8n-workflow';
|
|
8
|
+
import * as transport from '../../../nodes/lime-crm/transport';
|
|
9
|
+
|
|
10
|
+
const mockILoadOptionFunctions = {
|
|
11
|
+
getNodeParameter: jest.fn().mockReturnValue('company'),
|
|
12
|
+
} as unknown as ILoadOptionsFunctions;
|
|
13
|
+
|
|
14
|
+
const propertiesResponseMock = {
|
|
15
|
+
success: true,
|
|
16
|
+
data: [
|
|
17
|
+
{ name: 'p1', localname: 'Property 1', type: 'yesno', required: true },
|
|
18
|
+
{
|
|
19
|
+
name: 'p2',
|
|
20
|
+
localname: 'Property 2',
|
|
21
|
+
type: 'string',
|
|
22
|
+
required: false,
|
|
23
|
+
length: 2137,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'p3',
|
|
27
|
+
localname: 'Property 3',
|
|
28
|
+
type: 'option',
|
|
29
|
+
required: true,
|
|
30
|
+
options: [
|
|
31
|
+
{ key: 'op1', text: 'Option 1', inactive: false },
|
|
32
|
+
{ key: 'op2', text: 'Option 2', inactive: false },
|
|
33
|
+
{ key: 'op3', text: 'Option 3', inactive: true },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
} as SuccessResponse<LimetypeProperty[]>;
|
|
38
|
+
|
|
39
|
+
describe('resourceMapping', () => {
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
jest.spyOn(transport, 'getProperties').mockResolvedValue(
|
|
42
|
+
propertiesResponseMock
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
it('gets valid resource mapping for create', async () => {
|
|
46
|
+
const columns = await getCreateMappingColumns.call(
|
|
47
|
+
mockILoadOptionFunctions
|
|
48
|
+
);
|
|
49
|
+
const property1 = columns.fields.find((p) => p.id == 'p1')!;
|
|
50
|
+
|
|
51
|
+
expect(property1.displayName).toBe('Property 1 [yesno]');
|
|
52
|
+
expect(property1.required).toBe(true);
|
|
53
|
+
expect(property1.defaultMatch).toBe(false);
|
|
54
|
+
expect(property1.display).toBe(true);
|
|
55
|
+
expect(property1.type).toBe('boolean');
|
|
56
|
+
expect(property1.options).toBe(undefined);
|
|
57
|
+
|
|
58
|
+
const property2 = columns.fields.find((p) => p.id == 'p2')!;
|
|
59
|
+
expect(property2.displayName).toBe('Property 2 [string(2137)]');
|
|
60
|
+
expect(property2.required).toBe(false);
|
|
61
|
+
expect(property2.defaultMatch).toBe(false);
|
|
62
|
+
expect(property2.display).toBe(true);
|
|
63
|
+
expect(property2.type).toBe('string');
|
|
64
|
+
expect(property2.options).toBe(undefined);
|
|
65
|
+
|
|
66
|
+
const property3 = columns.fields.find((p) => p.id == 'p3')!;
|
|
67
|
+
expect(property3.displayName).toBe('Property 3 [option]');
|
|
68
|
+
expect(property3.required).toBe(true);
|
|
69
|
+
expect(property3.defaultMatch).toBe(false);
|
|
70
|
+
expect(property3.display).toBe(true);
|
|
71
|
+
expect(property3.type).toBe('options');
|
|
72
|
+
|
|
73
|
+
const options = property3.options!;
|
|
74
|
+
expect(options).toContainEqual({
|
|
75
|
+
value: 'op1',
|
|
76
|
+
name: 'Option 1',
|
|
77
|
+
});
|
|
78
|
+
expect(options).toContainEqual({
|
|
79
|
+
value: 'op2',
|
|
80
|
+
name: 'Option 2',
|
|
81
|
+
});
|
|
82
|
+
expect(options.length).toBe(2);
|
|
83
|
+
});
|
|
84
|
+
it('gets proper required values for update', async () => {
|
|
85
|
+
const columns = await getUpdateMappingColumns.call(
|
|
86
|
+
mockILoadOptionFunctions
|
|
87
|
+
);
|
|
88
|
+
const requiredValues = columns.fields.map((p) => p.required);
|
|
89
|
+
expect(requiredValues).toEqual([false, false, false]);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
jest.mock('../../../nodes/lime-crm/transport', () => ({
|
|
2
|
+
createFile: jest.fn().mockResolvedValue({
|
|
3
|
+
success: true,
|
|
4
|
+
data: { id: 1 },
|
|
5
|
+
}),
|
|
6
|
+
getFileMetadata: jest.fn().mockResolvedValue({
|
|
7
|
+
success: true,
|
|
8
|
+
data: {
|
|
9
|
+
id: '123',
|
|
10
|
+
name: 'file.txt',
|
|
11
|
+
},
|
|
12
|
+
}),
|
|
13
|
+
getFileContent: jest.fn().mockResolvedValue({
|
|
14
|
+
success: true,
|
|
15
|
+
data: 'some binary data',
|
|
16
|
+
}),
|
|
17
|
+
getTasks: jest.fn(),
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
createFile,
|
|
22
|
+
getFileContent,
|
|
23
|
+
getFileMetadata,
|
|
24
|
+
getFilenameFromHeader,
|
|
25
|
+
getFilePropertiesNames,
|
|
26
|
+
getWebhook,
|
|
27
|
+
processFileResponse,
|
|
28
|
+
setFilename,
|
|
29
|
+
setFileProperties,
|
|
30
|
+
verifyHmac,
|
|
31
|
+
WebhookFunctions,
|
|
32
|
+
} from '../../../nodes';
|
|
33
|
+
|
|
34
|
+
describe('files', () => {
|
|
35
|
+
describe('setFilename', () => {
|
|
36
|
+
it('returns responseFileName if fileName is missing', () => {
|
|
37
|
+
expect(
|
|
38
|
+
setFilename({ fileExtension: 'jpg' } as any, 'default.jpg')
|
|
39
|
+
).toBe('default.jpg');
|
|
40
|
+
});
|
|
41
|
+
it('returns existing fileName if present', () => {
|
|
42
|
+
expect(
|
|
43
|
+
setFilename({ fileName: 'aspen.jpg' } as any, 'default.jpg')
|
|
44
|
+
).toBe('aspen.jpg');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('getFilenameFromHeader', () => {
|
|
49
|
+
it('returns null if header is missing', () => {
|
|
50
|
+
expect(getFilenameFromHeader({})).toBeNull();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('parses standard filename', () => {
|
|
54
|
+
expect(
|
|
55
|
+
getFilenameFromHeader({
|
|
56
|
+
'content-disposition': 'attachment; filename="test.txt"',
|
|
57
|
+
})
|
|
58
|
+
).toBe('test.txt');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('parses RFC 5987 filename*', () => {
|
|
62
|
+
expect(
|
|
63
|
+
getFilenameFromHeader({
|
|
64
|
+
'content-disposition':
|
|
65
|
+
"attachment; filename*=UTF-8''test%20file.txt",
|
|
66
|
+
})
|
|
67
|
+
).toBe('test file.txt');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('getFilePropertiesNames', () => {
|
|
72
|
+
const limetypes = [
|
|
73
|
+
{
|
|
74
|
+
name: 'company',
|
|
75
|
+
type: 'belongsto',
|
|
76
|
+
localname: 'company',
|
|
77
|
+
required: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'name',
|
|
81
|
+
type: 'string',
|
|
82
|
+
localname: 'name',
|
|
83
|
+
required: false,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'document',
|
|
87
|
+
type: 'file',
|
|
88
|
+
localname: 'document',
|
|
89
|
+
required: false,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'photo',
|
|
93
|
+
type: 'file',
|
|
94
|
+
localname: 'photo',
|
|
95
|
+
required: false,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
it('returns all file property names', async () => {
|
|
99
|
+
const result = getFilePropertiesNames(limetypes);
|
|
100
|
+
expect(result.has('document')).toBe(true);
|
|
101
|
+
expect(result.has('photo')).toBe(true);
|
|
102
|
+
expect(result.has('name')).toBe(false);
|
|
103
|
+
expect(result.has('company')).toBe(false);
|
|
104
|
+
});
|
|
105
|
+
it('returns allowed file property names', async () => {
|
|
106
|
+
const result = getFilePropertiesNames(
|
|
107
|
+
limetypes,
|
|
108
|
+
new Set(['document'])
|
|
109
|
+
);
|
|
110
|
+
expect(result.has('document')).toBe(true);
|
|
111
|
+
expect(result.has('photo')).toBe(false);
|
|
112
|
+
expect(result.has('name')).toBe(false);
|
|
113
|
+
expect(result.has('company')).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('setFileProperties', () => {
|
|
118
|
+
const mockContext: any = {
|
|
119
|
+
helpers: {
|
|
120
|
+
assertBinaryData: jest.fn(),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
const mockBinaryData = { data: 'some binary data' };
|
|
124
|
+
|
|
125
|
+
beforeEach(() => {
|
|
126
|
+
(createFile as jest.Mock).mockClear();
|
|
127
|
+
mockContext.helpers.assertBinaryData.mockClear();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('sets file properties successfully', async () => {
|
|
131
|
+
mockContext.helpers.assertBinaryData.mockReturnValue(
|
|
132
|
+
mockBinaryData
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const definedProperties = { document: 'some binary data' };
|
|
136
|
+
const result = await setFileProperties(
|
|
137
|
+
mockContext,
|
|
138
|
+
0,
|
|
139
|
+
new Set(['document']),
|
|
140
|
+
definedProperties
|
|
141
|
+
);
|
|
142
|
+
expect(result.success).toBe(true);
|
|
143
|
+
if (result.success) {
|
|
144
|
+
expect(result.data.document).toBe(1);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('sets file ID if assertBinaryData throws an error', async () => {
|
|
149
|
+
mockContext.helpers.assertBinaryData.mockImplementation(() => {
|
|
150
|
+
throw new Error('Invalid binary data');
|
|
151
|
+
});
|
|
152
|
+
const definedProperties = { document: 2 };
|
|
153
|
+
const result = await setFileProperties(
|
|
154
|
+
mockContext,
|
|
155
|
+
0,
|
|
156
|
+
new Set(['document']),
|
|
157
|
+
definedProperties
|
|
158
|
+
);
|
|
159
|
+
expect(result.success).toBe(true);
|
|
160
|
+
if (result.success) {
|
|
161
|
+
expect(result.data.document).toBe(2);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('processFileResponse', () => {
|
|
167
|
+
const mockNodeContext = {};
|
|
168
|
+
|
|
169
|
+
beforeEach(() => {
|
|
170
|
+
(getFileMetadata as jest.Mock).mockClear();
|
|
171
|
+
(getFileContent as jest.Mock).mockClear();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('returns file metadata without file content', async () => {
|
|
175
|
+
const data = { document: 1 };
|
|
176
|
+
const result = await processFileResponse<{ document: number }>(
|
|
177
|
+
mockNodeContext as any,
|
|
178
|
+
new Set(['document']),
|
|
179
|
+
data
|
|
180
|
+
);
|
|
181
|
+
expect(result.json.success).toBe(true);
|
|
182
|
+
if (result.json.success) {
|
|
183
|
+
expect(result.json.data.document).toEqual({
|
|
184
|
+
id: '123',
|
|
185
|
+
name: 'file.txt',
|
|
186
|
+
});
|
|
187
|
+
expect(result.binary).toEqual({});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('returns file metadata with file content', async () => {
|
|
192
|
+
const data = { document: 1 };
|
|
193
|
+
const result = await processFileResponse<{ document: number }>(
|
|
194
|
+
mockNodeContext as any,
|
|
195
|
+
new Set(['document']),
|
|
196
|
+
data,
|
|
197
|
+
true
|
|
198
|
+
);
|
|
199
|
+
if (result.json.success) {
|
|
200
|
+
expect(result.json.data.document).toEqual({
|
|
201
|
+
id: '123',
|
|
202
|
+
name: 'file.txt',
|
|
203
|
+
});
|
|
204
|
+
expect(result.binary?.document).toEqual('some binary data');
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe('hmac', () => {
|
|
211
|
+
describe('verifyHmac', () => {
|
|
212
|
+
const key = 'my-secret-key';
|
|
213
|
+
const data = Buffer.from('hello world');
|
|
214
|
+
const correctHmac =
|
|
215
|
+
'sha256=90eb182d8396f16d4341d582047f45c0a97d73388c5377d9ced478a2212295ad';
|
|
216
|
+
|
|
217
|
+
it('returns true when the HMAC matches', () => {
|
|
218
|
+
expect(verifyHmac(key, data, correctHmac)).toBe(true);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('returns false when the HMAC does not match', () => {
|
|
222
|
+
expect(verifyHmac(key, data, 'wrongHmac')).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
describe('webhook', () => {
|
|
228
|
+
describe('getWebhhok', () => {
|
|
229
|
+
let mockHookData: jest.Mocked<WebhookFunctions>;
|
|
230
|
+
|
|
231
|
+
beforeEach(() => {
|
|
232
|
+
jest.useFakeTimers().setSystemTime(
|
|
233
|
+
new Date('2025-11-12T12:00:00Z')
|
|
234
|
+
);
|
|
235
|
+
mockHookData = {
|
|
236
|
+
getNode: jest.fn().mockReturnValue({ id: '1', name: 'MyNode' }),
|
|
237
|
+
getWorkflow: jest
|
|
238
|
+
.fn()
|
|
239
|
+
.mockReturnValue({ id: '2', name: 'MyWorkflow' }),
|
|
240
|
+
getWorkflowStaticData: jest
|
|
241
|
+
.fn()
|
|
242
|
+
.mockReturnValue({ key: 'value' }),
|
|
243
|
+
getNodeWebhookUrl: jest
|
|
244
|
+
.fn()
|
|
245
|
+
.mockReturnValue('https://example.com/hook'),
|
|
246
|
+
getNodeParameter: jest.fn().mockReturnValue({
|
|
247
|
+
event: [{ limetype: 'company', eventType: 'new' }],
|
|
248
|
+
}),
|
|
249
|
+
} as unknown as jest.Mocked<WebhookFunctions>;
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
afterEach(() => {
|
|
253
|
+
jest.useRealTimers();
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('constructs a full webhook object correctly', () => {
|
|
257
|
+
const result = getWebhook(mockHookData);
|
|
258
|
+
|
|
259
|
+
expect(result).toEqual({
|
|
260
|
+
data: { key: 'value' },
|
|
261
|
+
events: ['company.new'],
|
|
262
|
+
url: 'https://example.com/hook',
|
|
263
|
+
context: {
|
|
264
|
+
nodeId: '1',
|
|
265
|
+
nodeName: 'MyNode',
|
|
266
|
+
workflowId: '2',
|
|
267
|
+
workflowName: 'MyWorkflow',
|
|
268
|
+
},
|
|
269
|
+
name: 'company-new-1762948800000',
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
});
|
package/typedoc.css
ADDED
package/typedoc.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://typedoc.org/schema.json",
|
|
3
|
+
"entryPoints": [
|
|
4
|
+
"./nodes/lime-crm/index.ts",
|
|
5
|
+
"./nodes/response.ts",
|
|
6
|
+
"./credentials/index.ts"
|
|
7
|
+
],
|
|
8
|
+
"entryPointStrategy": "expand",
|
|
9
|
+
"name": "Lime N8N Documentation",
|
|
10
|
+
"customCss": "typedoc.css",
|
|
11
|
+
"out": "docs",
|
|
12
|
+
"includeVersion": true,
|
|
13
|
+
"readme": "README.md",
|
|
14
|
+
"tsconfig": "tsconfig.json",
|
|
15
|
+
"disableSources": true,
|
|
16
|
+
"hideGenerator": true,
|
|
17
|
+
"categorizeByGroup": true,
|
|
18
|
+
"cleanOutputDir": true
|
|
19
|
+
}
|
package/.dockerignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.git
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ICredentialType, INodeProperties, IAuthenticate, ICredentialTestRequest } from 'n8n-workflow';
|
|
2
|
-
export declare class FortnoxApi implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
documentationUrl: string;
|
|
6
|
-
properties: INodeProperties[];
|
|
7
|
-
authenticate: IAuthenticate;
|
|
8
|
-
test: ICredentialTestRequest;
|
|
9
|
-
}
|