@atom8n/n8n-core 2.2.0
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/README.md +13 -0
- package/bin/common.js +19 -0
- package/bin/copy-static-files +24 -0
- package/bin/generate-metadata +75 -0
- package/bin/generate-translations +99 -0
- package/dist/binary-data/binary-data.config.d.ts +15 -0
- package/dist/binary-data/binary-data.config.js +62 -0
- package/dist/binary-data/binary-data.config.js.map +1 -0
- package/dist/binary-data/binary-data.service.d.ts +32 -0
- package/dist/binary-data/binary-data.service.js +243 -0
- package/dist/binary-data/binary-data.service.js.map +1 -0
- package/dist/binary-data/file-system.manager.d.ts +31 -0
- package/dist/binary-data/file-system.manager.js +154 -0
- package/dist/binary-data/file-system.manager.js.map +1 -0
- package/dist/binary-data/index.d.ts +5 -0
- package/dist/binary-data/index.js +27 -0
- package/dist/binary-data/index.js.map +1 -0
- package/dist/binary-data/object-store/object-store.config.d.ts +19 -0
- package/dist/binary-data/object-store/object-store.config.js +83 -0
- package/dist/binary-data/object-store/object-store.config.js.map +1 -0
- package/dist/binary-data/object-store/object-store.service.ee.d.ts +46 -0
- package/dist/binary-data/object-store/object-store.service.ee.js +235 -0
- package/dist/binary-data/object-store/object-store.service.ee.js.map +1 -0
- package/dist/binary-data/object-store/types.d.ts +8 -0
- package/dist/binary-data/object-store/types.js +3 -0
- package/dist/binary-data/object-store/types.js.map +1 -0
- package/dist/binary-data/object-store.manager.d.ts +23 -0
- package/dist/binary-data/object-store.manager.js +86 -0
- package/dist/binary-data/object-store.manager.js.map +1 -0
- package/dist/binary-data/types.d.ts +46 -0
- package/dist/binary-data/types.js +3 -0
- package/dist/binary-data/types.js.map +1 -0
- package/dist/binary-data/utils.d.ts +15 -0
- package/dist/binary-data/utils.js +66 -0
- package/dist/binary-data/utils.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -0
- package/dist/constants.d.ts +19 -0
- package/dist/constants.js +23 -0
- package/dist/constants.js.map +1 -0
- package/dist/credentials.d.ts +12 -0
- package/dist/credentials.js +99 -0
- package/dist/credentials.js.map +1 -0
- package/dist/data-deduplication-service.d.ts +16 -0
- package/dist/data-deduplication-service.js +95 -0
- package/dist/data-deduplication-service.js.map +1 -0
- package/dist/encryption/cipher.d.ts +8 -0
- package/dist/encryption/cipher.js +57 -0
- package/dist/encryption/cipher.js.map +1 -0
- package/dist/encryption/index.d.ts +1 -0
- package/dist/encryption/index.js +6 -0
- package/dist/encryption/index.js.map +1 -0
- package/dist/errors/abstract/binary-data.error.d.ts +3 -0
- package/dist/errors/abstract/binary-data.error.js +8 -0
- package/dist/errors/abstract/binary-data.error.js.map +1 -0
- package/dist/errors/abstract/filesystem.error.d.ts +4 -0
- package/dist/errors/abstract/filesystem.error.js +11 -0
- package/dist/errors/abstract/filesystem.error.js.map +1 -0
- package/dist/errors/binary-data-file-not-found.error.d.ts +4 -0
- package/dist/errors/binary-data-file-not-found.error.js +11 -0
- package/dist/errors/binary-data-file-not-found.error.js.map +1 -0
- package/dist/errors/disallowed-filepath.error.d.ts +4 -0
- package/dist/errors/disallowed-filepath.error.js +11 -0
- package/dist/errors/disallowed-filepath.error.js.map +1 -0
- package/dist/errors/error-reporter.d.ts +35 -0
- package/dist/errors/error-reporter.js +256 -0
- package/dist/errors/error-reporter.js.map +1 -0
- package/dist/errors/file-not-found.error.d.ts +4 -0
- package/dist/errors/file-not-found.error.js +11 -0
- package/dist/errors/file-not-found.error.js.map +1 -0
- package/dist/errors/file-too-large.error.d.ts +9 -0
- package/dist/errors/file-too-large.error.js +13 -0
- package/dist/errors/file-too-large.error.js.map +1 -0
- package/dist/errors/index.d.ts +11 -0
- package/dist/errors/index.js +26 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/invalid-execution-metadata.error.d.ts +5 -0
- package/dist/errors/invalid-execution-metadata.error.js +12 -0
- package/dist/errors/invalid-execution-metadata.error.js.map +1 -0
- package/dist/errors/invalid-manager.error.d.ts +4 -0
- package/dist/errors/invalid-manager.error.js +11 -0
- package/dist/errors/invalid-manager.error.js.map +1 -0
- package/dist/errors/invalid-source-type.error.d.ts +4 -0
- package/dist/errors/invalid-source-type.error.js +11 -0
- package/dist/errors/invalid-source-type.error.js.map +1 -0
- package/dist/errors/missing-source-id.error.d.ts +4 -0
- package/dist/errors/missing-source-id.error.js +11 -0
- package/dist/errors/missing-source-id.error.js.map +1 -0
- package/dist/errors/unrecognized-credential-type.error.d.ts +4 -0
- package/dist/errors/unrecognized-credential-type.error.js +11 -0
- package/dist/errors/unrecognized-credential-type.error.js.map +1 -0
- package/dist/errors/unrecognized-node-type.error.d.ts +4 -0
- package/dist/errors/unrecognized-node-type.error.js +11 -0
- package/dist/errors/unrecognized-node-type.error.js.map +1 -0
- package/dist/errors/workflow-has-issues.error.d.ts +4 -0
- package/dist/errors/workflow-has-issues.error.js +11 -0
- package/dist/errors/workflow-has-issues.error.js.map +1 -0
- package/dist/execution-engine/active-workflows.d.ts +23 -0
- package/dist/execution-engine/active-workflows.js +153 -0
- package/dist/execution-engine/active-workflows.js.map +1 -0
- package/dist/execution-engine/execution-context-hook-registry.service.d.ts +12 -0
- package/dist/execution-engine/execution-context-hook-registry.service.js +69 -0
- package/dist/execution-engine/execution-context-hook-registry.service.js.map +1 -0
- package/dist/execution-engine/execution-context.d.ts +2 -0
- package/dist/execution-engine/execution-context.js +56 -0
- package/dist/execution-engine/execution-context.js.map +1 -0
- package/dist/execution-engine/execution-context.service.d.ts +17 -0
- package/dist/execution-engine/execution-context.service.js +108 -0
- package/dist/execution-engine/execution-context.service.js.map +1 -0
- package/dist/execution-engine/execution-lifecycle-hooks.d.ts +20 -0
- package/dist/execution-engine/execution-lifecycle-hooks.js +31 -0
- package/dist/execution-engine/execution-lifecycle-hooks.js.map +1 -0
- package/dist/execution-engine/external-secrets-proxy.d.ts +18 -0
- package/dist/execution-engine/external-secrets-proxy.js +38 -0
- package/dist/execution-engine/external-secrets-proxy.js.map +1 -0
- package/dist/execution-engine/index.d.ts +26 -0
- package/dist/execution-engine/index.js +31 -0
- package/dist/execution-engine/index.js.map +1 -0
- package/dist/execution-engine/interfaces.d.ts +7 -0
- package/dist/execution-engine/interfaces.js +3 -0
- package/dist/execution-engine/interfaces.js.map +1 -0
- package/dist/execution-engine/node-execution-context/base-execute-context.d.ts +47 -0
- package/dist/execution-engine/node-execution-context/base-execute-context.js +150 -0
- package/dist/execution-engine/node-execution-context/base-execute-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/credentials-test-context.d.ts +7 -0
- package/dist/execution-engine/node-execution-context/credentials-test-context.js +37 -0
- package/dist/execution-engine/node-execution-context/credentials-test-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/execute-context.d.ts +24 -0
- package/dist/execution-engine/node-execution-context/execute-context.js +108 -0
- package/dist/execution-engine/node-execution-context/execute-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/execute-single-context.d.ts +15 -0
- package/dist/execution-engine/node-execution-context/execute-single-context.js +53 -0
- package/dist/execution-engine/node-execution-context/execute-single-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/hook-context.d.ts +13 -0
- package/dist/execution-engine/node-execution-context/hook-context.js +35 -0
- package/dist/execution-engine/node-execution-context/hook-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/index.d.ts +17 -0
- package/dist/execution-engine/node-execution-context/index.js +51 -0
- package/dist/execution-engine/node-execution-context/index.js.map +1 -0
- package/dist/execution-engine/node-execution-context/load-options-context.d.ts +10 -0
- package/dist/execution-engine/node-execution-context/load-options-context.js +43 -0
- package/dist/execution-engine/node-execution-context/load-options-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/local-load-options-context.d.ts +10 -0
- package/dist/execution-engine/node-execution-context/local-load-options-context.js +51 -0
- package/dist/execution-engine/node-execution-context/local-load-options-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/node-execution-context.d.ts +68 -0
- package/dist/execution-engine/node-execution-context/node-execution-context.js +324 -0
- package/dist/execution-engine/node-execution-context/node-execution-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/poll-context.d.ts +11 -0
- package/dist/execution-engine/node-execution-context/poll-context.js +38 -0
- package/dist/execution-engine/node-execution-context/poll-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/supply-data-context.d.ts +26 -0
- package/dist/execution-engine/node-execution-context/supply-data-context.js +181 -0
- package/dist/execution-engine/node-execution-context/supply-data-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/trigger-context.d.ts +11 -0
- package/dist/execution-engine/node-execution-context/trigger-context.js +40 -0
- package/dist/execution-engine/node-execution-context/trigger-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/binary-helper-functions.d.ts +10 -0
- package/dist/execution-engine/node-execution-context/utils/binary-helper-functions.js +213 -0
- package/dist/execution-engine/node-execution-context/utils/binary-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/cleanup-parameter-data.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/cleanup-parameter-data.js +27 -0
- package/dist/execution-engine/node-execution-context/utils/cleanup-parameter-data.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/construct-execution-metadata.d.ts +4 -0
- package/dist/execution-engine/node-execution-context/utils/construct-execution-metadata.js +11 -0
- package/dist/execution-engine/node-execution-context/utils/construct-execution-metadata.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/copy-input-items.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/copy-input-items.js +19 -0
- package/dist/execution-engine/node-execution-context/utils/copy-input-items.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/create-node-as-tool.d.ts +21 -0
- package/dist/execution-engine/node-execution-context/utils/create-node-as-tool.js +65 -0
- package/dist/execution-engine/node-execution-context/utils/create-node-as-tool.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/data-table-helper-functions.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/data-table-helper-functions.js +13 -0
- package/dist/execution-engine/node-execution-context/utils/data-table-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/deduplication-helper-functions.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/deduplication-helper-functions.js +38 -0
- package/dist/execution-engine/node-execution-context/utils/deduplication-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/ensure-type.d.ts +6 -0
- package/dist/execution-engine/node-execution-context/utils/ensure-type.js +75 -0
- package/dist/execution-engine/node-execution-context/utils/ensure-type.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/execution-metadata.d.ts +6 -0
- package/dist/execution-engine/node-execution-context/utils/execution-metadata.js +57 -0
- package/dist/execution-engine/node-execution-context/utils/execution-metadata.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/extract-value.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/extract-value.js +135 -0
- package/dist/execution-engine/node-execution-context/utils/extract-value.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/file-system-helper-functions.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/file-system-helper-functions.js +144 -0
- package/dist/execution-engine/node-execution-context/utils/file-system-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/get-additional-keys.d.ts +4 -0
- package/dist/execution-engine/node-execution-context/utils/get-additional-keys.js +57 -0
- package/dist/execution-engine/node-execution-context/utils/get-additional-keys.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.d.ts +5 -0
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.js +211 -0
- package/dist/execution-engine/node-execution-context/utils/get-input-connection-data.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/get-secrets-proxy.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/get-secrets-proxy.js +68 -0
- package/dist/execution-engine/node-execution-context/utils/get-secrets-proxy.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/normalize-items.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/normalize-items.js +36 -0
- package/dist/execution-engine/node-execution-context/utils/normalize-items.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/parse-incoming-message.d.ts +16 -0
- package/dist/execution-engine/node-execution-context/utils/parse-incoming-message.js +57 -0
- package/dist/execution-engine/node-execution-context/utils/parse-incoming-message.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/request-helper-functions.d.ts +18 -0
- package/dist/execution-engine/node-execution-context/utils/request-helper-functions.js +1213 -0
- package/dist/execution-engine/node-execution-context/utils/request-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/return-json-array.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/return-json-array.js +19 -0
- package/dist/execution-engine/node-execution-context/utils/return-json-array.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/scheduling-helper-functions.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/scheduling-helper-functions.js +22 -0
- package/dist/execution-engine/node-execution-context/utils/scheduling-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/ssh-tunnel-helper-functions.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/ssh-tunnel-helper-functions.js +14 -0
- package/dist/execution-engine/node-execution-context/utils/ssh-tunnel-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/validate-value-against-schema.d.ts +2 -0
- package/dist/execution-engine/node-execution-context/utils/validate-value-against-schema.js +132 -0
- package/dist/execution-engine/node-execution-context/utils/validate-value-against-schema.js.map +1 -0
- package/dist/execution-engine/node-execution-context/utils/webhook-helper-functions.d.ts +3 -0
- package/dist/execution-engine/node-execution-context/utils/webhook-helper-functions.js +31 -0
- package/dist/execution-engine/node-execution-context/utils/webhook-helper-functions.js.map +1 -0
- package/dist/execution-engine/node-execution-context/webhook-context.d.ts +21 -0
- package/dist/execution-engine/node-execution-context/webhook-context.js +87 -0
- package/dist/execution-engine/node-execution-context/webhook-context.js.map +1 -0
- package/dist/execution-engine/node-execution-context/workflow-node-context.d.ts +6 -0
- package/dist/execution-engine/node-execution-context/workflow-node-context.js +14 -0
- package/dist/execution-engine/node-execution-context/workflow-node-context.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/clean-run-data.d.ts +3 -0
- package/dist/execution-engine/partial-execution-utils/clean-run-data.js +28 -0
- package/dist/execution-engine/partial-execution-utils/clean-run-data.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/directed-graph.d.ts +65 -0
- package/dist/execution-engine/partial-execution-utils/directed-graph.js +370 -0
- package/dist/execution-engine/partial-execution-utils/directed-graph.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/filter-disabled-nodes.d.ts +2 -0
- package/dist/execution-engine/partial-execution-utils/filter-disabled-nodes.js +17 -0
- package/dist/execution-engine/partial-execution-utils/filter-disabled-nodes.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/find-start-nodes.d.ts +10 -0
- package/dist/execution-engine/partial-execution-utils/find-start-nodes.js +74 -0
- package/dist/execution-engine/partial-execution-utils/find-start-nodes.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/find-subgraph.d.ts +7 -0
- package/dist/execution-engine/partial-execution-utils/find-subgraph.js +59 -0
- package/dist/execution-engine/partial-execution-utils/find-subgraph.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/find-trigger-for-partial-execution.d.ts +4 -0
- package/dist/execution-engine/partial-execution-utils/find-trigger-for-partial-execution.js +102 -0
- package/dist/execution-engine/partial-execution-utils/find-trigger-for-partial-execution.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/get-incoming-data.d.ts +6 -0
- package/dist/execution-engine/partial-execution-utils/get-incoming-data.js +21 -0
- package/dist/execution-engine/partial-execution-utils/get-incoming-data.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/get-source-data-groups.d.ts +8 -0
- package/dist/execution-engine/partial-execution-utils/get-source-data-groups.js +65 -0
- package/dist/execution-engine/partial-execution-utils/get-source-data-groups.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/handle-cycles.d.ts +3 -0
- package/dist/execution-engine/partial-execution-utils/handle-cycles.js +60 -0
- package/dist/execution-engine/partial-execution-utils/handle-cycles.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/index.d.ts +10 -0
- package/dist/execution-engine/partial-execution-utils/index.js +25 -0
- package/dist/execution-engine/partial-execution-utils/index.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/recreate-node-execution-stack.d.ts +9 -0
- package/dist/execution-engine/partial-execution-utils/recreate-node-execution-stack.js +146 -0
- package/dist/execution-engine/partial-execution-utils/recreate-node-execution-stack.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/rewire-graph.d.ts +3 -0
- package/dist/execution-engine/partial-execution-utils/rewire-graph.js +72 -0
- package/dist/execution-engine/partial-execution-utils/rewire-graph.js.map +1 -0
- package/dist/execution-engine/partial-execution-utils/run-data-utils.d.ts +2 -0
- package/dist/execution-engine/partial-execution-utils/run-data-utils.js +15 -0
- package/dist/execution-engine/partial-execution-utils/run-data-utils.js.map +1 -0
- package/dist/execution-engine/requests-response.d.ts +23 -0
- package/dist/execution-engine/requests-response.js +128 -0
- package/dist/execution-engine/requests-response.js.map +1 -0
- package/dist/execution-engine/routing-node.d.ts +17 -0
- package/dist/execution-engine/routing-node.js +571 -0
- package/dist/execution-engine/routing-node.js.map +1 -0
- package/dist/execution-engine/scheduled-task-manager.d.ts +27 -0
- package/dist/execution-engine/scheduled-task-manager.js +140 -0
- package/dist/execution-engine/scheduled-task-manager.js.map +1 -0
- package/dist/execution-engine/ssh-clients-manager.d.ts +27 -0
- package/dist/execution-engine/ssh-clients-manager.js +170 -0
- package/dist/execution-engine/ssh-clients-manager.js.map +1 -0
- package/dist/execution-engine/triggers-and-pollers.d.ts +6 -0
- package/dist/execution-engine/triggers-and-pollers.js +66 -0
- package/dist/execution-engine/triggers-and-pollers.js.map +1 -0
- package/dist/execution-engine/workflow-execute.d.ts +46 -0
- package/dist/execution-engine/workflow-execute.js +1490 -0
- package/dist/execution-engine/workflow-execute.js.map +1 -0
- package/dist/html-sandbox.d.ts +3 -0
- package/dist/html-sandbox.js +19 -0
- package/dist/html-sandbox.js.map +1 -0
- package/dist/http-proxy.d.ts +6 -0
- package/dist/http-proxy.js +109 -0
- package/dist/http-proxy.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/instance-settings/index.d.ts +1 -0
- package/dist/instance-settings/index.js +6 -0
- package/dist/instance-settings/index.js.map +1 -0
- package/dist/instance-settings/instance-settings.d.ts +49 -0
- package/dist/instance-settings/instance-settings.js +210 -0
- package/dist/instance-settings/instance-settings.js.map +1 -0
- package/dist/instance-settings/worker-missing-encryption-key.error.d.ts +4 -0
- package/dist/instance-settings/worker-missing-encryption-key.error.js +15 -0
- package/dist/instance-settings/worker-missing-encryption-key.error.js.map +1 -0
- package/dist/interfaces.d.ts +16 -0
- package/dist/interfaces.js +3 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/node-execute-functions.d.ts +3 -0
- package/dist/node-execute-functions.js +12 -0
- package/dist/node-execute-functions.js.map +1 -0
- package/dist/nodes-loader/constants.d.ts +5 -0
- package/dist/nodes-loader/constants.js +106 -0
- package/dist/nodes-loader/constants.js.map +1 -0
- package/dist/nodes-loader/custom-directory-loader.d.ts +6 -0
- package/dist/nodes-loader/custom-directory-loader.js +34 -0
- package/dist/nodes-loader/custom-directory-loader.js.map +1 -0
- package/dist/nodes-loader/directory-loader.d.ts +41 -0
- package/dist/nodes-loader/directory-loader.js +371 -0
- package/dist/nodes-loader/directory-loader.js.map +1 -0
- package/dist/nodes-loader/index.d.ts +5 -0
- package/dist/nodes-loader/index.js +12 -0
- package/dist/nodes-loader/index.js.map +1 -0
- package/dist/nodes-loader/lazy-package-directory-loader.d.ts +4 -0
- package/dist/nodes-loader/lazy-package-directory-loader.js +42 -0
- package/dist/nodes-loader/lazy-package-directory-loader.js.map +1 -0
- package/dist/nodes-loader/load-class-in-isolation.d.ts +1 -0
- package/dist/nodes-loader/load-class-in-isolation.js +20 -0
- package/dist/nodes-loader/load-class-in-isolation.js.map +1 -0
- package/dist/nodes-loader/package-directory-loader.d.ts +12 -0
- package/dist/nodes-loader/package-directory-loader.js +86 -0
- package/dist/nodes-loader/package-directory-loader.js.map +1 -0
- package/dist/nodes-loader/types.d.ts +14 -0
- package/dist/nodes-loader/types.js +3 -0
- package/dist/nodes-loader/types.js.map +1 -0
- package/dist/utils/assertions.d.ts +2 -0
- package/dist/utils/assertions.js +16 -0
- package/dist/utils/assertions.js.map +1 -0
- package/dist/utils/deep-merge.d.ts +1 -0
- package/dist/utils/deep-merge.js +33 -0
- package/dist/utils/deep-merge.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/is-json-compatible.d.ts +7 -0
- package/dist/utils/is-json-compatible.js +81 -0
- package/dist/utils/is-json-compatible.js.map +1 -0
- package/dist/utils/serialized-buffer.d.ts +6 -0
- package/dist/utils/serialized-buffer.js +16 -0
- package/dist/utils/serialized-buffer.js.map +1 -0
- package/dist/utils/signature-helpers.d.ts +2 -0
- package/dist/utils/signature-helpers.js +16 -0
- package/dist/utils/signature-helpers.js.map +1 -0
- package/package.json +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# n8n-core
|
|
4
|
+
|
|
5
|
+
Core components for n8n
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install n8n-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## License
|
|
12
|
+
|
|
13
|
+
You can find the license information [here](https://github.com/n8n-io/n8n/blob/master/README.md#license)
|
package/bin/common.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { mkdir, writeFile } = require('fs/promises');
|
|
3
|
+
|
|
4
|
+
const packageDir = process.cwd();
|
|
5
|
+
const distDir = path.join(packageDir, 'dist');
|
|
6
|
+
|
|
7
|
+
const writeJSON = async (file, data) => {
|
|
8
|
+
const filePath = path.resolve(distDir, file);
|
|
9
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
10
|
+
const payload = Array.isArray(data)
|
|
11
|
+
? `[\n${data.map((entry) => JSON.stringify(entry)).join(',\n')}\n]`
|
|
12
|
+
: JSON.stringify(data, null, 2);
|
|
13
|
+
await writeFile(filePath, payload, { encoding: 'utf-8' });
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
packageDir,
|
|
18
|
+
writeJSON,
|
|
19
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const glob = require('fast-glob');
|
|
4
|
+
const pLimit = require('p-limit');
|
|
5
|
+
const { cp } = require('fs/promises');
|
|
6
|
+
const { packageDir } = require('./common');
|
|
7
|
+
|
|
8
|
+
const limiter = pLimit(20);
|
|
9
|
+
const staticFiles = glob.sync(
|
|
10
|
+
['{nodes,credentials}/**/*.{png,svg}', 'nodes/**/__schema__/**/*.json'],
|
|
11
|
+
{
|
|
12
|
+
cwd: packageDir,
|
|
13
|
+
},
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
(async () => {
|
|
17
|
+
await Promise.all(
|
|
18
|
+
staticFiles.map((path) =>
|
|
19
|
+
limiter(() => {
|
|
20
|
+
return cp(path, `dist/${path}`, { recursive: true });
|
|
21
|
+
}),
|
|
22
|
+
),
|
|
23
|
+
);
|
|
24
|
+
})();
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { LoggerProxy } = require('n8n-workflow');
|
|
4
|
+
const { PackageDirectoryLoader } = require('../dist/nodes-loader/package-directory-loader');
|
|
5
|
+
const { packageDir, writeJSON } = require('./common');
|
|
6
|
+
|
|
7
|
+
LoggerProxy.init(console);
|
|
8
|
+
|
|
9
|
+
function findReferencedMethods(obj, refs = {}, latestName = '') {
|
|
10
|
+
for (const key in obj) {
|
|
11
|
+
if (key === 'name' && 'group' in obj) {
|
|
12
|
+
latestName = obj[key];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (typeof obj[key] === 'object') {
|
|
16
|
+
findReferencedMethods(obj[key], refs, latestName);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (key === 'loadOptionsMethod') {
|
|
20
|
+
refs[latestName] = refs[latestName]
|
|
21
|
+
? [...new Set([...refs[latestName], obj[key]])]
|
|
22
|
+
: [obj[key]];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return refs;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
(async () => {
|
|
30
|
+
const loader = new PackageDirectoryLoader(packageDir);
|
|
31
|
+
await loader.loadAll();
|
|
32
|
+
|
|
33
|
+
const loaderNodeTypes = Object.values(loader.nodeTypes);
|
|
34
|
+
|
|
35
|
+
const definedMethods = loaderNodeTypes.reduce((acc, cur) => {
|
|
36
|
+
loader.getVersionedNodeTypeAll(cur.type).forEach((type) => {
|
|
37
|
+
const methods = type.description?.__loadOptionsMethods;
|
|
38
|
+
|
|
39
|
+
if (!methods) return;
|
|
40
|
+
|
|
41
|
+
const { name } = type.description;
|
|
42
|
+
|
|
43
|
+
if (acc[name]) {
|
|
44
|
+
acc[name] = [...new Set([...acc[name], ...methods])];
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
acc[name] = methods;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return acc;
|
|
52
|
+
}, {});
|
|
53
|
+
|
|
54
|
+
const nodeTypes = loaderNodeTypes
|
|
55
|
+
.map(({ type }) => type)
|
|
56
|
+
.flatMap((nodeType) =>
|
|
57
|
+
loader.getVersionedNodeTypeAll(nodeType).map((item) => {
|
|
58
|
+
const { __loadOptionsMethods, ...rest } = item.description;
|
|
59
|
+
return rest;
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const knownCredentials = loader.known.credentials;
|
|
64
|
+
const credentialTypes = Object.values(loader.credentialTypes).map(({ type }) => type);
|
|
65
|
+
const referencedMethods = findReferencedMethods(nodeTypes);
|
|
66
|
+
|
|
67
|
+
await Promise.all([
|
|
68
|
+
writeJSON('known/nodes.json', loader.known.nodes),
|
|
69
|
+
writeJSON('known/credentials.json', loader.known.credentials),
|
|
70
|
+
writeJSON('types/credentials.json', credentialTypes),
|
|
71
|
+
writeJSON('types/nodes.json', nodeTypes),
|
|
72
|
+
writeJSON('methods/defined.json', definedMethods),
|
|
73
|
+
writeJSON('methods/referenced.json', referencedMethods),
|
|
74
|
+
]);
|
|
75
|
+
})();
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
existsSync,
|
|
5
|
+
promises: { writeFile },
|
|
6
|
+
} = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { packageDir } = require('./common');
|
|
9
|
+
|
|
10
|
+
const ALLOWED_HEADER_KEYS = ['displayName', 'description'];
|
|
11
|
+
const PURPLE_ANSI_COLOR_CODE = 35;
|
|
12
|
+
|
|
13
|
+
function getNodeTranslationPaths() {
|
|
14
|
+
const nodeDistPaths = require(`${packageDir}/package.json`).n8n.nodes;
|
|
15
|
+
const { N8N_DEFAULT_LOCALE: locale } = process.env;
|
|
16
|
+
|
|
17
|
+
return nodeDistPaths.reduce((acc, cur) => {
|
|
18
|
+
const nodeTranslationPath = path.join(
|
|
19
|
+
packageDir,
|
|
20
|
+
cur.split('/').slice(1, -1).join('/'),
|
|
21
|
+
'translations',
|
|
22
|
+
locale,
|
|
23
|
+
toTranslationFile(cur),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (existsSync(nodeTranslationPath)) {
|
|
27
|
+
acc.push(nodeTranslationPath);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return acc;
|
|
31
|
+
}, []);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getHeaders(nodeTranslationPaths) {
|
|
35
|
+
return nodeTranslationPaths.reduce((acc, cur) => {
|
|
36
|
+
const { header } = require(cur);
|
|
37
|
+
const nodeType = cur.split('/').pop().replace('.json', '');
|
|
38
|
+
|
|
39
|
+
if (isValidHeader(header, ALLOWED_HEADER_KEYS)) {
|
|
40
|
+
acc[nodeType] = header;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ----------------------------------
|
|
48
|
+
// helpers
|
|
49
|
+
// ----------------------------------
|
|
50
|
+
|
|
51
|
+
function toTranslationFile(distPath) {
|
|
52
|
+
const raw = distPath.split('/').pop().replace('.node', '') + 'on';
|
|
53
|
+
return raw.charAt(0).toLowerCase() + raw.slice(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function isValidHeader(header, allowedHeaderKeys) {
|
|
57
|
+
if (!header) return false;
|
|
58
|
+
|
|
59
|
+
const headerKeys = Object.keys(header);
|
|
60
|
+
|
|
61
|
+
return headerKeys.length > 0 && headerKeys.every((key) => allowedHeaderKeys.includes(key));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function writeDistFile(data, distPath) {
|
|
65
|
+
writeFile(distPath, `module.exports = ${JSON.stringify(data, null, 2)}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const log = (string, { bulletPoint } = { bulletPoint: false }) => {
|
|
69
|
+
if (bulletPoint) {
|
|
70
|
+
process.stdout.write(colorize(PURPLE_ANSI_COLOR_CODE, `- ${string}\n`));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
process.stdout.write(`${string}\n`);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const colorize = (ansiColorCode, string) =>
|
|
78
|
+
['\033[', ansiColorCode, 'm', string, '\033[0m'].join('');
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Write node translation headers to single file at `/dist/nodes/headers.js`.
|
|
82
|
+
*/
|
|
83
|
+
const { N8N_DEFAULT_LOCALE: locale } = process.env;
|
|
84
|
+
|
|
85
|
+
log(`Default locale set to: ${colorize(PURPLE_ANSI_COLOR_CODE, locale || 'en')}`);
|
|
86
|
+
|
|
87
|
+
if (!locale || locale === 'en') {
|
|
88
|
+
log('No translation required - Skipping translations build...');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const nodeTranslationPaths = getNodeTranslationPaths();
|
|
93
|
+
const headers = getHeaders(nodeTranslationPaths);
|
|
94
|
+
const headersDistPath = path.join(packageDir, 'dist', 'nodes', 'headers.js');
|
|
95
|
+
|
|
96
|
+
writeDistFile(headers, headersDistPath);
|
|
97
|
+
|
|
98
|
+
log('Headers file written to:');
|
|
99
|
+
log(headersDistPath, { bulletPoint: true });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ExecutionsConfig } from '@n8n/config';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { InstanceSettings } from '../instance-settings';
|
|
4
|
+
export declare const BINARY_DATA_MODES: readonly ["default", "filesystem", "s3", "database"];
|
|
5
|
+
declare const binaryDataModesSchema: z.ZodEnum<["default", "filesystem", "s3", "database"]>;
|
|
6
|
+
declare const availableModesSchema: z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodEnum<["default", "filesystem", "s3", "database"]>, "many">>;
|
|
7
|
+
export declare class BinaryDataConfig {
|
|
8
|
+
availableModes: z.infer<typeof availableModesSchema>;
|
|
9
|
+
mode: z.infer<typeof binaryDataModesSchema>;
|
|
10
|
+
localStoragePath: string;
|
|
11
|
+
signingSecret: string;
|
|
12
|
+
dbMaxFileSize: number;
|
|
13
|
+
constructor({ encryptionKey, n8nFolder }: InstanceSettings, executionsConfig: ExecutionsConfig);
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BinaryDataConfig = exports.BINARY_DATA_MODES = void 0;
|
|
16
|
+
const config_1 = require("@n8n/config");
|
|
17
|
+
const node_crypto_1 = require("node:crypto");
|
|
18
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
19
|
+
const zod_1 = require("zod");
|
|
20
|
+
const instance_settings_1 = require("../instance-settings");
|
|
21
|
+
exports.BINARY_DATA_MODES = ['default', 'filesystem', 's3', 'database'];
|
|
22
|
+
const binaryDataModesSchema = zod_1.z.enum(exports.BINARY_DATA_MODES);
|
|
23
|
+
const availableModesSchema = zod_1.z
|
|
24
|
+
.string()
|
|
25
|
+
.transform((value) => value.split(','))
|
|
26
|
+
.pipe(binaryDataModesSchema.array());
|
|
27
|
+
const dbMaxFileSizeSchema = zod_1.z
|
|
28
|
+
.number()
|
|
29
|
+
.max(1024, 'Binary data max file size in `database` mode cannot exceed 1024 MiB');
|
|
30
|
+
let BinaryDataConfig = class BinaryDataConfig {
|
|
31
|
+
constructor({ encryptionKey, n8nFolder }, executionsConfig) {
|
|
32
|
+
this.availableModes = ['filesystem', 's3', 'database'];
|
|
33
|
+
this.dbMaxFileSize = 512;
|
|
34
|
+
this.localStoragePath = node_path_1.default.join(n8nFolder, 'binaryData');
|
|
35
|
+
this.signingSecret = (0, node_crypto_1.createHash)('sha256')
|
|
36
|
+
.update(`url-signing:${encryptionKey}`)
|
|
37
|
+
.digest('base64');
|
|
38
|
+
this.mode ??= executionsConfig.mode === 'queue' ? 'database' : 'filesystem';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.BinaryDataConfig = BinaryDataConfig;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, config_1.Env)('N8N_DEFAULT_BINARY_DATA_MODE', binaryDataModesSchema),
|
|
44
|
+
__metadata("design:type", void 0)
|
|
45
|
+
], BinaryDataConfig.prototype, "mode", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, config_1.Env)('N8N_BINARY_DATA_STORAGE_PATH'),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], BinaryDataConfig.prototype, "localStoragePath", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, config_1.Env)('N8N_BINARY_DATA_SIGNING_SECRET'),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], BinaryDataConfig.prototype, "signingSecret", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, config_1.Env)('N8N_BINARY_DATA_DATABASE_MAX_FILE_SIZE', dbMaxFileSizeSchema),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], BinaryDataConfig.prototype, "dbMaxFileSize", void 0);
|
|
58
|
+
exports.BinaryDataConfig = BinaryDataConfig = __decorate([
|
|
59
|
+
config_1.Config,
|
|
60
|
+
__metadata("design:paramtypes", [instance_settings_1.InstanceSettings, config_1.ExecutionsConfig])
|
|
61
|
+
], BinaryDataConfig);
|
|
62
|
+
//# sourceMappingURL=binary-data.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-data.config.js","sourceRoot":"","sources":["../../src/binary-data/binary-data.config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wCAA4D;AAC5D,6CAAyC;AACzC,0DAA6B;AAC7B,6BAAwB;AAExB,2DAAuD;AAE1C,QAAA,iBAAiB,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,CAAU,CAAC;AAEtF,MAAM,qBAAqB,GAAG,OAAC,CAAC,IAAI,CAAC,yBAAiB,CAAC,CAAC;AAExD,MAAM,oBAAoB,GAAG,OAAC;KAC5B,MAAM,EAAE;KACR,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACtC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC,CAAC;AAEtC,MAAM,mBAAmB,GAAG,OAAC;KAC3B,MAAM,EAAE;KACR,GAAG,CAAC,IAAI,EAAE,qEAAqE,CAAC,CAAC;AAG5E,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAuB5B,YAAY,EAAE,aAAa,EAAE,SAAS,EAAoB,EAAE,gBAAkC;QArB9F,mBAAc,GAAyC,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QAmBxF,kBAAa,GAAW,GAAG,CAAC;QAG3B,IAAI,CAAC,gBAAgB,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;aACvC,MAAM,CAAC,eAAe,aAAa,EAAE,CAAC;aACtC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEnB,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;IAC7E,CAAC;CACD,CAAA;AA/BY,4CAAgB;AAM5B;IADC,IAAA,YAAG,EAAC,8BAA8B,EAAE,qBAAqB,CAAC;;8CACd;AAI7C;IADC,IAAA,YAAG,EAAC,8BAA8B,CAAC;;0DACX;AAOzB;IADC,IAAA,YAAG,EAAC,gCAAgC,CAAC;;uDAChB;AAItB;IADC,IAAA,YAAG,EAAC,wCAAwC,EAAE,mBAAmB,CAAC;;uDACvC;2BArBhB,gBAAgB;IAD5B,eAAM;qCAwBoC,oCAAgB,EAAoB,yBAAgB;GAvBlF,gBAAgB,CA+B5B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Logger } from '@n8n/backend-common';
|
|
2
|
+
import type { StringValue as TimeUnitValue } from 'ms';
|
|
3
|
+
import type { INodeExecutionData, IBinaryData } from 'n8n-workflow';
|
|
4
|
+
import type { Readable } from 'stream';
|
|
5
|
+
import { ErrorReporter } from '../errors';
|
|
6
|
+
import { BinaryDataConfig } from './binary-data.config';
|
|
7
|
+
import type { BinaryData } from './types';
|
|
8
|
+
export declare class BinaryDataService {
|
|
9
|
+
private readonly config;
|
|
10
|
+
private readonly errorReporter;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private mode;
|
|
13
|
+
private managers;
|
|
14
|
+
constructor(config: BinaryDataConfig, errorReporter: ErrorReporter, logger: Logger);
|
|
15
|
+
setManager(mode: BinaryData.ServiceMode, manager: BinaryData.Manager): void;
|
|
16
|
+
init(): Promise<void>;
|
|
17
|
+
createSignedToken(binaryData: IBinaryData, expiresIn?: TimeUnitValue): string;
|
|
18
|
+
validateSignedToken(token: string): string;
|
|
19
|
+
copyBinaryFile(location: BinaryData.FileLocation, binaryData: IBinaryData, filePath: string): Promise<IBinaryData>;
|
|
20
|
+
store(location: BinaryData.FileLocation, bufferOrStream: Buffer | Readable, binaryData: IBinaryData): Promise<IBinaryData>;
|
|
21
|
+
getAsStream(binaryDataId: string, chunkSize?: number): Promise<Readable>;
|
|
22
|
+
getAsBuffer(binaryData: IBinaryData): Promise<Buffer<ArrayBufferLike>>;
|
|
23
|
+
getPath(binaryDataId: string): string;
|
|
24
|
+
getMetadata(binaryDataId: string): Promise<BinaryData.Metadata>;
|
|
25
|
+
deleteMany(locations: BinaryData.FileLocation[]): Promise<void>;
|
|
26
|
+
deleteManyByBinaryDataId(ids: string[]): Promise<void>;
|
|
27
|
+
duplicateBinaryData(location: BinaryData.FileLocation, inputData: Array<INodeExecutionData[] | null>): Promise<INodeExecutionData[][]>;
|
|
28
|
+
rename(oldFileId: string, newFileId: string): Promise<void>;
|
|
29
|
+
private createBinaryDataId;
|
|
30
|
+
private duplicateBinaryDataInExecData;
|
|
31
|
+
private getManager;
|
|
32
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.BinaryDataService = void 0;
|
|
49
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
50
|
+
const di_1 = require("@n8n/di");
|
|
51
|
+
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
52
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
53
|
+
const promises_1 = require("node:fs/promises");
|
|
54
|
+
const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
|
|
55
|
+
const errors_1 = require("../errors");
|
|
56
|
+
const binary_data_config_1 = require("./binary-data.config");
|
|
57
|
+
const utils_1 = require("./utils");
|
|
58
|
+
const invalid_manager_error_1 = require("../errors/invalid-manager.error");
|
|
59
|
+
let BinaryDataService = class BinaryDataService {
|
|
60
|
+
constructor(config, errorReporter, logger) {
|
|
61
|
+
this.config = config;
|
|
62
|
+
this.errorReporter = errorReporter;
|
|
63
|
+
this.logger = logger;
|
|
64
|
+
this.mode = 'filesystem-v2';
|
|
65
|
+
this.managers = {};
|
|
66
|
+
}
|
|
67
|
+
setManager(mode, manager) {
|
|
68
|
+
this.managers[mode] = manager;
|
|
69
|
+
}
|
|
70
|
+
async init() {
|
|
71
|
+
const { config } = this;
|
|
72
|
+
this.mode = config.mode === 'filesystem' ? 'filesystem-v2' : config.mode;
|
|
73
|
+
const { FileSystemManager } = await Promise.resolve().then(() => __importStar(require('./file-system.manager')));
|
|
74
|
+
this.managers.filesystem = new FileSystemManager(config.localStoragePath, this.errorReporter);
|
|
75
|
+
this.managers['filesystem-v2'] = this.managers.filesystem;
|
|
76
|
+
await this.managers.filesystem.init();
|
|
77
|
+
}
|
|
78
|
+
createSignedToken(binaryData, expiresIn = '1 day') {
|
|
79
|
+
if (!binaryData.id) {
|
|
80
|
+
throw new n8n_workflow_1.UnexpectedError('URL signing is not available in memory mode');
|
|
81
|
+
}
|
|
82
|
+
const signingPayload = {
|
|
83
|
+
id: binaryData.id,
|
|
84
|
+
};
|
|
85
|
+
const { signingSecret } = this.config;
|
|
86
|
+
return jsonwebtoken_1.default.sign(signingPayload, signingSecret, { expiresIn });
|
|
87
|
+
}
|
|
88
|
+
validateSignedToken(token) {
|
|
89
|
+
const { signingSecret } = this.config;
|
|
90
|
+
const signedPayload = jsonwebtoken_1.default.verify(token, signingSecret);
|
|
91
|
+
return signedPayload.id;
|
|
92
|
+
}
|
|
93
|
+
async copyBinaryFile(location, binaryData, filePath) {
|
|
94
|
+
const manager = this.managers[this.mode];
|
|
95
|
+
if (!manager) {
|
|
96
|
+
const { size } = await (0, promises_1.stat)(filePath);
|
|
97
|
+
binaryData.fileSize = (0, pretty_bytes_1.default)(size);
|
|
98
|
+
binaryData.data = await (0, promises_1.readFile)(filePath, { encoding: n8n_workflow_1.BINARY_ENCODING });
|
|
99
|
+
return binaryData;
|
|
100
|
+
}
|
|
101
|
+
const metadata = {
|
|
102
|
+
fileName: binaryData.fileName,
|
|
103
|
+
mimeType: binaryData.mimeType,
|
|
104
|
+
};
|
|
105
|
+
const { fileId, fileSize } = await manager.copyByFilePath(location, filePath, metadata);
|
|
106
|
+
binaryData.id = this.createBinaryDataId(fileId);
|
|
107
|
+
binaryData.fileSize = (0, pretty_bytes_1.default)(fileSize);
|
|
108
|
+
binaryData.data = this.mode;
|
|
109
|
+
return binaryData;
|
|
110
|
+
}
|
|
111
|
+
async store(location, bufferOrStream, binaryData) {
|
|
112
|
+
const manager = this.managers[this.mode];
|
|
113
|
+
if (!manager) {
|
|
114
|
+
const buffer = await (0, utils_1.binaryToBuffer)(bufferOrStream);
|
|
115
|
+
binaryData.data = buffer.toString(n8n_workflow_1.BINARY_ENCODING);
|
|
116
|
+
binaryData.fileSize = (0, pretty_bytes_1.default)(buffer.length);
|
|
117
|
+
return binaryData;
|
|
118
|
+
}
|
|
119
|
+
const metadata = {
|
|
120
|
+
fileName: binaryData.fileName,
|
|
121
|
+
mimeType: binaryData.mimeType,
|
|
122
|
+
};
|
|
123
|
+
const { fileId, fileSize } = await manager.store(location, bufferOrStream, metadata);
|
|
124
|
+
binaryData.id = this.createBinaryDataId(fileId);
|
|
125
|
+
binaryData.fileSize = (0, pretty_bytes_1.default)(fileSize);
|
|
126
|
+
binaryData.data = this.mode;
|
|
127
|
+
return binaryData;
|
|
128
|
+
}
|
|
129
|
+
async getAsStream(binaryDataId, chunkSize) {
|
|
130
|
+
const [mode, fileId] = binaryDataId.split(':');
|
|
131
|
+
return await this.getManager(mode).getAsStream(fileId, chunkSize);
|
|
132
|
+
}
|
|
133
|
+
async getAsBuffer(binaryData) {
|
|
134
|
+
if (binaryData.id) {
|
|
135
|
+
const [mode, fileId] = binaryData.id.split(':');
|
|
136
|
+
return await this.getManager(mode).getAsBuffer(fileId);
|
|
137
|
+
}
|
|
138
|
+
return Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
|
|
139
|
+
}
|
|
140
|
+
getPath(binaryDataId) {
|
|
141
|
+
const [mode, fileId] = binaryDataId.split(':');
|
|
142
|
+
return this.getManager(mode).getPath(fileId);
|
|
143
|
+
}
|
|
144
|
+
async getMetadata(binaryDataId) {
|
|
145
|
+
const [mode, fileId] = binaryDataId.split(':');
|
|
146
|
+
return await this.getManager(mode).getMetadata(fileId);
|
|
147
|
+
}
|
|
148
|
+
async deleteMany(locations) {
|
|
149
|
+
const manager = this.managers[this.mode];
|
|
150
|
+
if (!manager)
|
|
151
|
+
return;
|
|
152
|
+
if (manager.deleteMany)
|
|
153
|
+
await manager.deleteMany(locations);
|
|
154
|
+
}
|
|
155
|
+
async deleteManyByBinaryDataId(ids) {
|
|
156
|
+
const fileIdsByMode = new Map();
|
|
157
|
+
for (const attachmentId of ids) {
|
|
158
|
+
const [mode, fileId] = attachmentId.split(':');
|
|
159
|
+
if (!fileId) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const entry = fileIdsByMode.get(mode) ?? [];
|
|
163
|
+
fileIdsByMode.set(mode, entry.concat([fileId]));
|
|
164
|
+
}
|
|
165
|
+
for (const [mode, fileIds] of fileIdsByMode) {
|
|
166
|
+
const manager = this.managers[mode];
|
|
167
|
+
if (!manager) {
|
|
168
|
+
this.logger.info(`File manager of mode ${mode} is missing. Skip deleting these files: ${fileIds.join(', ')}`);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
await manager.deleteManyByFileId?.(fileIds);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
async duplicateBinaryData(location, inputData) {
|
|
175
|
+
if (inputData && this.managers[this.mode]) {
|
|
176
|
+
const returnInputData = inputData.map(async (executionDataArray) => {
|
|
177
|
+
if (executionDataArray) {
|
|
178
|
+
return await Promise.all(executionDataArray.map(async (executionData) => {
|
|
179
|
+
if (executionData.binary) {
|
|
180
|
+
return await this.duplicateBinaryDataInExecData(location, executionData);
|
|
181
|
+
}
|
|
182
|
+
return executionData;
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
return executionDataArray;
|
|
186
|
+
});
|
|
187
|
+
return await Promise.all(returnInputData);
|
|
188
|
+
}
|
|
189
|
+
return inputData;
|
|
190
|
+
}
|
|
191
|
+
async rename(oldFileId, newFileId) {
|
|
192
|
+
const manager = this.getManager(this.mode);
|
|
193
|
+
if (!manager)
|
|
194
|
+
return;
|
|
195
|
+
await manager.rename(oldFileId, newFileId);
|
|
196
|
+
}
|
|
197
|
+
createBinaryDataId(fileId) {
|
|
198
|
+
return `${this.mode}:${fileId}`;
|
|
199
|
+
}
|
|
200
|
+
async duplicateBinaryDataInExecData(location, executionData) {
|
|
201
|
+
const manager = this.managers[this.mode];
|
|
202
|
+
if (executionData.binary) {
|
|
203
|
+
const binaryDataKeys = Object.keys(executionData.binary);
|
|
204
|
+
const bdPromises = binaryDataKeys.map(async (key) => {
|
|
205
|
+
if (!executionData.binary) {
|
|
206
|
+
return { key, newId: undefined };
|
|
207
|
+
}
|
|
208
|
+
const binaryDataId = executionData.binary[key].id;
|
|
209
|
+
if (!binaryDataId) {
|
|
210
|
+
return { key, newId: undefined };
|
|
211
|
+
}
|
|
212
|
+
const [_mode, fileId] = binaryDataId.split(':');
|
|
213
|
+
return await manager?.copyByFileId(location, fileId).then((newFileId) => ({
|
|
214
|
+
newId: this.createBinaryDataId(newFileId),
|
|
215
|
+
key,
|
|
216
|
+
}));
|
|
217
|
+
});
|
|
218
|
+
return await Promise.all(bdPromises).then((b) => {
|
|
219
|
+
return b.reduce((acc, curr) => {
|
|
220
|
+
if (acc.binary && curr) {
|
|
221
|
+
acc.binary[curr.key].id = curr.newId;
|
|
222
|
+
}
|
|
223
|
+
return acc;
|
|
224
|
+
}, executionData);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return executionData;
|
|
228
|
+
}
|
|
229
|
+
getManager(mode) {
|
|
230
|
+
const manager = this.managers[mode];
|
|
231
|
+
if (manager)
|
|
232
|
+
return manager;
|
|
233
|
+
throw new invalid_manager_error_1.InvalidManagerError(mode);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
exports.BinaryDataService = BinaryDataService;
|
|
237
|
+
exports.BinaryDataService = BinaryDataService = __decorate([
|
|
238
|
+
(0, di_1.Service)(),
|
|
239
|
+
__metadata("design:paramtypes", [binary_data_config_1.BinaryDataConfig,
|
|
240
|
+
errors_1.ErrorReporter,
|
|
241
|
+
backend_common_1.Logger])
|
|
242
|
+
], BinaryDataService);
|
|
243
|
+
//# sourceMappingURL=binary-data.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-data.service.js","sourceRoot":"","sources":["../../src/binary-data/binary-data.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA6C;AAC7C,gCAAkC;AAClC,gEAA+B;AAE/B,+CAAgE;AAEhE,+CAAkD;AAClD,gEAAuC;AAGvC,qCAAyC;AAEzC,6DAAwD;AAExD,mCAAyC;AACzC,2EAAsE;AAG/D,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAK7B,YACkB,MAAwB,EACxB,aAA4B,EAC5B,MAAc;QAFd,WAAM,GAAN,MAAM,CAAkB;QACxB,kBAAa,GAAb,aAAa,CAAe;QAC5B,WAAM,GAAN,MAAM,CAAQ;QAPxB,SAAI,GAA2B,eAAe,CAAC;QAE/C,aAAQ,GAAuC,EAAE,CAAC;IAMvD,CAAC;IAEJ,UAAU,CAAC,IAA4B,EAAE,OAA2B;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C,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC/C,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;oBAC7B,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;wBACxB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;oBACtC,CAAC;oBAED,OAAO,GAAG,CAAC;gBACZ,CAAC,EAAE,aAAa,CAAC,CAAC;YACnB,CAAC,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,aAAa,CAAC;IACtB,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEpC,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;QAE5B,MAAM,IAAI,2CAAmB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACD,CAAA;AAtQY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,YAAO,GAAE;qCAOiB,qCAAgB;QACT,sBAAa;QACpB,uBAAM;GARpB,iBAAiB,CAsQ7B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Readable } from 'stream';
|
|
2
|
+
import type { ErrorReporter } from '../errors';
|
|
3
|
+
import type { BinaryData } from './types';
|
|
4
|
+
export declare class FileSystemManager implements BinaryData.Manager {
|
|
5
|
+
private storagePath;
|
|
6
|
+
private readonly errorReporter;
|
|
7
|
+
constructor(storagePath: string, errorReporter: ErrorReporter);
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
store(location: BinaryData.FileLocation, bufferOrStream: Buffer | Readable, { mimeType, fileName }: BinaryData.PreWriteMetadata): Promise<{
|
|
10
|
+
fileId: string;
|
|
11
|
+
fileSize: number;
|
|
12
|
+
}>;
|
|
13
|
+
getPath(fileId: string): string;
|
|
14
|
+
getAsStream(fileId: string, chunkSize?: number): Promise<import("fs").ReadStream>;
|
|
15
|
+
getAsBuffer(fileId: string): Promise<Buffer<ArrayBufferLike>>;
|
|
16
|
+
getMetadata(fileId: string): Promise<BinaryData.Metadata>;
|
|
17
|
+
deleteMany(locations: BinaryData.FileLocation[]): Promise<void>;
|
|
18
|
+
copyByFilePath(targetLocation: BinaryData.FileLocation, sourcePath: string, { mimeType, fileName }: BinaryData.PreWriteMetadata): Promise<{
|
|
19
|
+
fileId: string;
|
|
20
|
+
fileSize: number;
|
|
21
|
+
}>;
|
|
22
|
+
copyByFileId(targetLocation: BinaryData.FileLocation, sourceFileId: string): Promise<string>;
|
|
23
|
+
rename(oldFileId: string, newFileId: string): Promise<void>;
|
|
24
|
+
deleteManyByFileId(ids: string[]): Promise<void>;
|
|
25
|
+
private toFileId;
|
|
26
|
+
private toRelativePath;
|
|
27
|
+
private parseFileId;
|
|
28
|
+
private resolvePath;
|
|
29
|
+
private storeMetadata;
|
|
30
|
+
private getSize;
|
|
31
|
+
}
|