@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
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FileSystemManager = void 0;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const uuid_1 = require("uuid");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
const disallowed_filepath_error_1 = require("../errors/disallowed-filepath.error");
|
|
14
|
+
const file_not_found_error_1 = require("../errors/file-not-found.error");
|
|
15
|
+
const EXECUTION_PATH_MATCHER = /^workflows\/([^/]+)\/executions\/([^/]+)\//;
|
|
16
|
+
class FileSystemManager {
|
|
17
|
+
constructor(storagePath, errorReporter) {
|
|
18
|
+
this.storagePath = storagePath;
|
|
19
|
+
this.errorReporter = errorReporter;
|
|
20
|
+
}
|
|
21
|
+
async init() {
|
|
22
|
+
await (0, utils_1.assertDir)(this.storagePath);
|
|
23
|
+
}
|
|
24
|
+
async store(location, bufferOrStream, { mimeType, fileName }) {
|
|
25
|
+
const fileId = this.toFileId(location);
|
|
26
|
+
const filePath = this.resolvePath(fileId);
|
|
27
|
+
await (0, utils_1.assertDir)(node_path_1.default.dirname(filePath));
|
|
28
|
+
await promises_1.default.writeFile(filePath, bufferOrStream);
|
|
29
|
+
const fileSize = await this.getSize(fileId);
|
|
30
|
+
await this.storeMetadata(fileId, { mimeType, fileName, fileSize });
|
|
31
|
+
return { fileId, fileSize };
|
|
32
|
+
}
|
|
33
|
+
getPath(fileId) {
|
|
34
|
+
return this.resolvePath(fileId);
|
|
35
|
+
}
|
|
36
|
+
async getAsStream(fileId, chunkSize) {
|
|
37
|
+
const filePath = this.resolvePath(fileId);
|
|
38
|
+
if (await (0, utils_1.doesNotExist)(filePath)) {
|
|
39
|
+
throw new file_not_found_error_1.FileNotFoundError(filePath);
|
|
40
|
+
}
|
|
41
|
+
return (0, node_fs_1.createReadStream)(filePath, { highWaterMark: chunkSize });
|
|
42
|
+
}
|
|
43
|
+
async getAsBuffer(fileId) {
|
|
44
|
+
const filePath = this.resolvePath(fileId);
|
|
45
|
+
if (await (0, utils_1.doesNotExist)(filePath)) {
|
|
46
|
+
throw new file_not_found_error_1.FileNotFoundError(filePath);
|
|
47
|
+
}
|
|
48
|
+
return await promises_1.default.readFile(filePath);
|
|
49
|
+
}
|
|
50
|
+
async getMetadata(fileId) {
|
|
51
|
+
const filePath = this.resolvePath(`${fileId}.metadata`);
|
|
52
|
+
return await (0, n8n_workflow_1.jsonParse)(await promises_1.default.readFile(filePath, { encoding: 'utf-8' }));
|
|
53
|
+
}
|
|
54
|
+
async deleteMany(locations) {
|
|
55
|
+
if (locations.length === 0)
|
|
56
|
+
return;
|
|
57
|
+
const binaryDataDirs = locations.map((location) => this.resolvePath(this.toRelativePath(location)));
|
|
58
|
+
await Promise.all(binaryDataDirs.map(async (dir) => {
|
|
59
|
+
await promises_1.default.rm(dir, { recursive: true, force: true });
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
async copyByFilePath(targetLocation, sourcePath, { mimeType, fileName }) {
|
|
63
|
+
const targetFileId = this.toFileId(targetLocation);
|
|
64
|
+
const targetPath = this.resolvePath(targetFileId);
|
|
65
|
+
await (0, utils_1.assertDir)(node_path_1.default.dirname(targetPath));
|
|
66
|
+
await promises_1.default.cp(sourcePath, targetPath);
|
|
67
|
+
const fileSize = await this.getSize(targetFileId);
|
|
68
|
+
await this.storeMetadata(targetFileId, { mimeType, fileName, fileSize });
|
|
69
|
+
return { fileId: targetFileId, fileSize };
|
|
70
|
+
}
|
|
71
|
+
async copyByFileId(targetLocation, sourceFileId) {
|
|
72
|
+
const targetFileId = this.toFileId(targetLocation);
|
|
73
|
+
const sourcePath = this.resolvePath(sourceFileId);
|
|
74
|
+
const targetPath = this.resolvePath(targetFileId);
|
|
75
|
+
const sourceMetadata = await this.getMetadata(sourceFileId);
|
|
76
|
+
await (0, utils_1.assertDir)(node_path_1.default.dirname(targetPath));
|
|
77
|
+
await promises_1.default.copyFile(sourcePath, targetPath);
|
|
78
|
+
await this.storeMetadata(targetFileId, sourceMetadata);
|
|
79
|
+
return targetFileId;
|
|
80
|
+
}
|
|
81
|
+
async rename(oldFileId, newFileId) {
|
|
82
|
+
const oldPath = this.resolvePath(oldFileId);
|
|
83
|
+
const newPath = this.resolvePath(newFileId);
|
|
84
|
+
await (0, utils_1.assertDir)(node_path_1.default.dirname(newPath));
|
|
85
|
+
await Promise.all([
|
|
86
|
+
promises_1.default.rename(oldPath, newPath),
|
|
87
|
+
promises_1.default.rename(`${oldPath}.metadata`, `${newPath}.metadata`),
|
|
88
|
+
]);
|
|
89
|
+
const [tempDirParent] = oldPath.split('/temp/');
|
|
90
|
+
const tempDir = node_path_1.default.join(tempDirParent, 'temp');
|
|
91
|
+
await promises_1.default.rm(tempDir, { recursive: true });
|
|
92
|
+
}
|
|
93
|
+
async deleteManyByFileId(ids) {
|
|
94
|
+
const parsedIds = ids.flatMap((id) => {
|
|
95
|
+
try {
|
|
96
|
+
const parsed = this.parseFileId(id);
|
|
97
|
+
return [parsed];
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
this.errorReporter.warn(`Could not parse file ID ${id}. Skip deletion`);
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
await this.deleteMany(parsedIds);
|
|
105
|
+
}
|
|
106
|
+
toFileId(location) {
|
|
107
|
+
return `${this.toRelativePath(location)}/binary_data/${(0, uuid_1.v4)()}`;
|
|
108
|
+
}
|
|
109
|
+
toRelativePath(location) {
|
|
110
|
+
switch (location.type) {
|
|
111
|
+
case 'execution': {
|
|
112
|
+
const executionId = location.executionId || 'temp';
|
|
113
|
+
return `workflows/${location.workflowId}/executions/${executionId}`;
|
|
114
|
+
}
|
|
115
|
+
case 'custom':
|
|
116
|
+
return location.pathSegments.join('/');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
parseFileId(fileId) {
|
|
120
|
+
const executionMatch = fileId.match(EXECUTION_PATH_MATCHER);
|
|
121
|
+
if (executionMatch) {
|
|
122
|
+
return utils_1.FileLocation.ofExecution(executionMatch[1], executionMatch[2]);
|
|
123
|
+
}
|
|
124
|
+
const binaryDataIndex = fileId.indexOf('/binary_data/');
|
|
125
|
+
if (binaryDataIndex !== -1) {
|
|
126
|
+
const pathSegments = fileId.substring(0, binaryDataIndex).split('/');
|
|
127
|
+
return utils_1.FileLocation.ofCustom({ pathSegments });
|
|
128
|
+
}
|
|
129
|
+
throw new n8n_workflow_1.UnexpectedError(`File ID ${fileId} has invalid format.`);
|
|
130
|
+
}
|
|
131
|
+
resolvePath(...args) {
|
|
132
|
+
const returnPath = node_path_1.default.join(this.storagePath, ...args);
|
|
133
|
+
if (node_path_1.default.relative(this.storagePath, returnPath).startsWith('..')) {
|
|
134
|
+
throw new disallowed_filepath_error_1.DisallowedFilepathError(returnPath);
|
|
135
|
+
}
|
|
136
|
+
return returnPath;
|
|
137
|
+
}
|
|
138
|
+
async storeMetadata(fileId, metadata) {
|
|
139
|
+
const filePath = this.resolvePath(`${fileId}.metadata`);
|
|
140
|
+
await promises_1.default.writeFile(filePath, JSON.stringify(metadata), { encoding: 'utf-8' });
|
|
141
|
+
}
|
|
142
|
+
async getSize(fileId) {
|
|
143
|
+
const filePath = this.resolvePath(fileId);
|
|
144
|
+
try {
|
|
145
|
+
const stats = await promises_1.default.stat(filePath);
|
|
146
|
+
return stats.size;
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
throw new file_not_found_error_1.FileNotFoundError(filePath);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.FileSystemManager = FileSystemManager;
|
|
154
|
+
//# sourceMappingURL=file-system.manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-system.manager.js","sourceRoot":"","sources":["../../src/binary-data/file-system.manager.ts"],"names":[],"mappings":";;;;;;AAAA,+CAA0D;AAC1D,qCAA2C;AAC3C,gEAAkC;AAClC,0DAA6B;AAE7B,+BAAkC;AAKlC,mCAAgE;AAChE,mFAA8E;AAC9E,yEAAmE;AAEnE,MAAM,sBAAsB,GAAG,4CAA4C,CAAC;AAE5E,MAAa,iBAAiB;IAC7B,YACS,WAAmB,EACV,aAA4B;QADrC,gBAAW,GAAX,WAAW,CAAQ;QACV,kBAAa,GAAb,aAAa,CAAe;IAC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C,WAAW,CAAC,GAAG,MAAM,WAAW,CAAC,CAAC;QAExD,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,MAAc;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC;YACJ,MAAM,KAAK,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC,IAAI,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,wCAAiB,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;CACD;AAxMD,8CAwMC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './binary-data.service';
|
|
2
|
+
export { BinaryDataConfig } from './binary-data.config';
|
|
3
|
+
export type * from './types';
|
|
4
|
+
export { ObjectStoreService } from './object-store/object-store.service.ee';
|
|
5
|
+
export { isStoredMode as isValidNonDefaultMode, FileLocation, binaryToBuffer } from './utils';
|
|
@@ -0,0 +1,27 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.binaryToBuffer = exports.FileLocation = exports.isValidNonDefaultMode = exports.ObjectStoreService = exports.BinaryDataConfig = void 0;
|
|
18
|
+
__exportStar(require("./binary-data.service"), exports);
|
|
19
|
+
var binary_data_config_1 = require("./binary-data.config");
|
|
20
|
+
Object.defineProperty(exports, "BinaryDataConfig", { enumerable: true, get: function () { return binary_data_config_1.BinaryDataConfig; } });
|
|
21
|
+
var object_store_service_ee_1 = require("./object-store/object-store.service.ee");
|
|
22
|
+
Object.defineProperty(exports, "ObjectStoreService", { enumerable: true, get: function () { return object_store_service_ee_1.ObjectStoreService; } });
|
|
23
|
+
var utils_1 = require("./utils");
|
|
24
|
+
Object.defineProperty(exports, "isValidNonDefaultMode", { enumerable: true, get: function () { return utils_1.isStoredMode; } });
|
|
25
|
+
Object.defineProperty(exports, "FileLocation", { enumerable: true, get: function () { return utils_1.FileLocation; } });
|
|
26
|
+
Object.defineProperty(exports, "binaryToBuffer", { enumerable: true, get: function () { return utils_1.binaryToBuffer; } });
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/binary-data/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AAEzB,kFAA4E;AAAnE,6HAAA,kBAAkB,OAAA;AAC3B,iCAA8F;AAArF,8GAAA,YAAY,OAAyB;AAAE,qGAAA,YAAY,OAAA;AAAE,uGAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const protocolSchema: z.ZodEnum<["http", "https"]>;
|
|
3
|
+
export type Protocol = z.infer<typeof protocolSchema>;
|
|
4
|
+
declare class ObjectStoreBucketConfig {
|
|
5
|
+
name: string;
|
|
6
|
+
region: string;
|
|
7
|
+
}
|
|
8
|
+
declare class ObjectStoreCredentialsConfig {
|
|
9
|
+
accessKey: string;
|
|
10
|
+
accessSecret: string;
|
|
11
|
+
authAutoDetect: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class ObjectStoreConfig {
|
|
14
|
+
host: string;
|
|
15
|
+
protocol: Protocol;
|
|
16
|
+
bucket: ObjectStoreBucketConfig;
|
|
17
|
+
credentials: ObjectStoreCredentialsConfig;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ObjectStoreConfig = void 0;
|
|
13
|
+
const config_1 = require("@n8n/config");
|
|
14
|
+
const zod_1 = require("zod");
|
|
15
|
+
const protocolSchema = zod_1.z.enum(['http', 'https']);
|
|
16
|
+
let ObjectStoreBucketConfig = class ObjectStoreBucketConfig {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.name = '';
|
|
19
|
+
this.region = '';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, config_1.Env)('N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME'),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], ObjectStoreBucketConfig.prototype, "name", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, config_1.Env)('N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION'),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], ObjectStoreBucketConfig.prototype, "region", void 0);
|
|
30
|
+
ObjectStoreBucketConfig = __decorate([
|
|
31
|
+
config_1.Config
|
|
32
|
+
], ObjectStoreBucketConfig);
|
|
33
|
+
let ObjectStoreCredentialsConfig = class ObjectStoreCredentialsConfig {
|
|
34
|
+
constructor() {
|
|
35
|
+
this.accessKey = '';
|
|
36
|
+
this.accessSecret = '';
|
|
37
|
+
this.authAutoDetect = false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, config_1.Env)('N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY'),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], ObjectStoreCredentialsConfig.prototype, "accessKey", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, config_1.Env)('N8N_EXTERNAL_STORAGE_S3_ACCESS_SECRET'),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], ObjectStoreCredentialsConfig.prototype, "accessSecret", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, config_1.Env)('N8N_EXTERNAL_STORAGE_S3_AUTH_AUTO_DETECT'),
|
|
50
|
+
__metadata("design:type", Boolean)
|
|
51
|
+
], ObjectStoreCredentialsConfig.prototype, "authAutoDetect", void 0);
|
|
52
|
+
ObjectStoreCredentialsConfig = __decorate([
|
|
53
|
+
config_1.Config
|
|
54
|
+
], ObjectStoreCredentialsConfig);
|
|
55
|
+
let ObjectStoreConfig = class ObjectStoreConfig {
|
|
56
|
+
constructor() {
|
|
57
|
+
this.host = '';
|
|
58
|
+
this.protocol = 'https';
|
|
59
|
+
this.bucket = {};
|
|
60
|
+
this.credentials = {};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.ObjectStoreConfig = ObjectStoreConfig;
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, config_1.Env)('N8N_EXTERNAL_STORAGE_S3_HOST'),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], ObjectStoreConfig.prototype, "host", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, config_1.Env)('N8N_EXTERNAL_STORAGE_S3_PROTOCOL', protocolSchema),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], ObjectStoreConfig.prototype, "protocol", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
config_1.Nested,
|
|
74
|
+
__metadata("design:type", ObjectStoreBucketConfig)
|
|
75
|
+
], ObjectStoreConfig.prototype, "bucket", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
config_1.Nested,
|
|
78
|
+
__metadata("design:type", ObjectStoreCredentialsConfig)
|
|
79
|
+
], ObjectStoreConfig.prototype, "credentials", void 0);
|
|
80
|
+
exports.ObjectStoreConfig = ObjectStoreConfig = __decorate([
|
|
81
|
+
config_1.Config
|
|
82
|
+
], ObjectStoreConfig);
|
|
83
|
+
//# sourceMappingURL=object-store.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-store.config.js","sourceRoot":"","sources":["../../../src/binary-data/object-store/object-store.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAkD;AAClD,6BAAwB;AAExB,MAAM,cAAc,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAKjD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QAGC,SAAI,GAAW,EAAE,CAAC;QAIlB,WAAM,GAAW,EAAE,CAAC;IACrB,CAAC;CAAA,CAAA;AALA;IADC,IAAA,YAAG,EAAC,qCAAqC,CAAC;;qDACzB;AAIlB;IADC,IAAA,YAAG,EAAC,uCAAuC,CAAC;;uDACzB;AAPf,uBAAuB;IAD5B,eAAM;GACD,uBAAuB,CAQ5B;AAGD,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAAlC;QAGC,cAAS,GAAW,EAAE,CAAC;QAIvB,iBAAY,GAAW,EAAE,CAAC;QAQ1B,mBAAc,GAAY,KAAK,CAAC;IACjC,CAAC;CAAA,CAAA;AAbA;IADC,IAAA,YAAG,EAAC,oCAAoC,CAAC;;+DACnB;AAIvB;IADC,IAAA,YAAG,EAAC,uCAAuC,CAAC;;kEACnB;AAQ1B;IADC,IAAA,YAAG,EAAC,0CAA0C,CAAC;;oEAChB;AAf3B,4BAA4B;IADjC,eAAM;GACD,4BAA4B,CAgBjC;AAGM,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QAMN,SAAI,GAAW,EAAE,CAAC;QAGlB,aAAQ,GAAa,OAAO,CAAC;QAG7B,WAAM,GAA4B,EAA6B,CAAC;QAGhE,gBAAW,GAAiC,EAAkC,CAAC;IAChF,CAAC;CAAA,CAAA;AAhBY,8CAAiB;AAM7B;IADC,IAAA,YAAG,EAAC,8BAA8B,CAAC;;+CAClB;AAGlB;IADC,IAAA,YAAG,EAAC,kCAAkC,EAAE,cAAc,CAAC;;mDAC3B;AAG7B;IADC,eAAM;8BACC,uBAAuB;iDAAiC;AAGhE;IADC,eAAM;8BACM,4BAA4B;sDAAsC;4BAfnE,iBAAiB;IAD7B,eAAM;GACM,iBAAiB,CAgB7B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { S3ClientConfig } from '@aws-sdk/client-s3';
|
|
2
|
+
import { Logger } from '@n8n/backend-common';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
4
|
+
import { ObjectStoreConfig } from './object-store.config';
|
|
5
|
+
import type { MetadataResponseHeaders } from './types';
|
|
6
|
+
import type { BinaryData } from '../types';
|
|
7
|
+
export declare class ObjectStoreService {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly s3Config;
|
|
10
|
+
private s3Client;
|
|
11
|
+
private isReady;
|
|
12
|
+
private bucket;
|
|
13
|
+
constructor(logger: Logger, s3Config: ObjectStoreConfig);
|
|
14
|
+
getClientConfig(): S3ClientConfig;
|
|
15
|
+
init(): Promise<void>;
|
|
16
|
+
setReady(newState: boolean): void;
|
|
17
|
+
checkConnection(): Promise<void>;
|
|
18
|
+
put(filename: string, buffer: Buffer, metadata?: BinaryData.PreWriteMetadata): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
|
|
19
|
+
get(fileId: string, { mode }: {
|
|
20
|
+
mode: 'buffer';
|
|
21
|
+
}): Promise<Buffer>;
|
|
22
|
+
get(fileId: string, { mode }: {
|
|
23
|
+
mode: 'stream';
|
|
24
|
+
}): Promise<Readable>;
|
|
25
|
+
getMetadata(fileId: string): Promise<MetadataResponseHeaders>;
|
|
26
|
+
deleteOne(fileId: string): Promise<import("@aws-sdk/client-s3").DeleteObjectCommandOutput>;
|
|
27
|
+
deleteMany(prefix: string): Promise<import("@aws-sdk/client-s3").DeleteObjectsCommandOutput | undefined>;
|
|
28
|
+
list(prefix: string): Promise<{
|
|
29
|
+
key: string;
|
|
30
|
+
lastModified: string;
|
|
31
|
+
eTag: string;
|
|
32
|
+
size: number;
|
|
33
|
+
storageClass: string;
|
|
34
|
+
}[]>;
|
|
35
|
+
getListPage(prefix: string, continuationToken?: string): Promise<{
|
|
36
|
+
contents: {
|
|
37
|
+
key: string;
|
|
38
|
+
lastModified: string;
|
|
39
|
+
eTag: string;
|
|
40
|
+
size: number;
|
|
41
|
+
storageClass: string;
|
|
42
|
+
}[];
|
|
43
|
+
isTruncated: boolean;
|
|
44
|
+
nextContinuationToken: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ObjectStoreService = void 0;
|
|
13
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
14
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
15
|
+
const di_1 = require("@n8n/di");
|
|
16
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
17
|
+
const node_crypto_1 = require("node:crypto");
|
|
18
|
+
const node_stream_1 = require("node:stream");
|
|
19
|
+
const object_store_config_1 = require("./object-store.config");
|
|
20
|
+
const utils_1 = require("../utils");
|
|
21
|
+
let ObjectStoreService = class ObjectStoreService {
|
|
22
|
+
constructor(logger, s3Config) {
|
|
23
|
+
this.logger = logger;
|
|
24
|
+
this.s3Config = s3Config;
|
|
25
|
+
this.isReady = false;
|
|
26
|
+
const { bucket } = s3Config;
|
|
27
|
+
if (bucket.name === '') {
|
|
28
|
+
throw new n8n_workflow_1.UnexpectedError('External storage bucket name not configured. Please set `N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME`.');
|
|
29
|
+
}
|
|
30
|
+
this.bucket = bucket.name;
|
|
31
|
+
this.s3Client = new client_s3_1.S3Client(this.getClientConfig());
|
|
32
|
+
}
|
|
33
|
+
getClientConfig() {
|
|
34
|
+
const { host, bucket, protocol, credentials } = this.s3Config;
|
|
35
|
+
const clientConfig = {};
|
|
36
|
+
const endpoint = host ? `${protocol}://${host}` : undefined;
|
|
37
|
+
if (endpoint) {
|
|
38
|
+
clientConfig.endpoint = endpoint;
|
|
39
|
+
clientConfig.forcePathStyle = true;
|
|
40
|
+
}
|
|
41
|
+
if (bucket.region.length) {
|
|
42
|
+
clientConfig.region = bucket.region;
|
|
43
|
+
}
|
|
44
|
+
if (!credentials.authAutoDetect) {
|
|
45
|
+
clientConfig.credentials = {
|
|
46
|
+
accessKeyId: credentials.accessKey,
|
|
47
|
+
secretAccessKey: credentials.accessSecret,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return clientConfig;
|
|
51
|
+
}
|
|
52
|
+
async init() {
|
|
53
|
+
await this.checkConnection();
|
|
54
|
+
this.setReady(true);
|
|
55
|
+
}
|
|
56
|
+
setReady(newState) {
|
|
57
|
+
this.isReady = newState;
|
|
58
|
+
}
|
|
59
|
+
async checkConnection() {
|
|
60
|
+
if (this.isReady)
|
|
61
|
+
return;
|
|
62
|
+
try {
|
|
63
|
+
this.logger.debug('Checking connection to S3 bucket', { bucket: this.bucket });
|
|
64
|
+
const command = new client_s3_1.HeadBucketCommand({ Bucket: this.bucket });
|
|
65
|
+
await this.s3Client.send(command);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async put(filename, buffer, metadata = {}) {
|
|
72
|
+
try {
|
|
73
|
+
const params = {
|
|
74
|
+
Bucket: this.bucket,
|
|
75
|
+
Key: filename,
|
|
76
|
+
Body: buffer,
|
|
77
|
+
ContentLength: buffer.length,
|
|
78
|
+
ContentMD5: (0, node_crypto_1.createHash)('md5').update(buffer).digest('base64'),
|
|
79
|
+
};
|
|
80
|
+
if (metadata.fileName) {
|
|
81
|
+
params.Metadata = { filename: encodeURIComponent(metadata.fileName) };
|
|
82
|
+
}
|
|
83
|
+
if (metadata.mimeType) {
|
|
84
|
+
params.ContentType = metadata.mimeType;
|
|
85
|
+
}
|
|
86
|
+
const { Body: _body, ...logParams } = params;
|
|
87
|
+
this.logger.debug('Sending PUT request to S3', { params: logParams });
|
|
88
|
+
const command = new client_s3_1.PutObjectCommand(params);
|
|
89
|
+
return await this.s3Client.send(command);
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async get(fileId, { mode }) {
|
|
96
|
+
this.logger.debug('Sending GET request to S3', { bucket: this.bucket, key: fileId });
|
|
97
|
+
const command = new client_s3_1.GetObjectCommand({
|
|
98
|
+
Bucket: this.bucket,
|
|
99
|
+
Key: fileId,
|
|
100
|
+
});
|
|
101
|
+
try {
|
|
102
|
+
const { Body: body } = await this.s3Client.send(command);
|
|
103
|
+
if (!body)
|
|
104
|
+
throw new n8n_workflow_1.UnexpectedError('Received empty response body');
|
|
105
|
+
if (mode === 'stream') {
|
|
106
|
+
if (body instanceof node_stream_1.Readable)
|
|
107
|
+
return body;
|
|
108
|
+
throw new n8n_workflow_1.UnexpectedError(`Expected stream but received ${typeof body}.`);
|
|
109
|
+
}
|
|
110
|
+
return await (0, utils_1.streamToBuffer)(body);
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async getMetadata(fileId) {
|
|
117
|
+
try {
|
|
118
|
+
const command = new client_s3_1.HeadObjectCommand({
|
|
119
|
+
Bucket: this.bucket,
|
|
120
|
+
Key: fileId,
|
|
121
|
+
});
|
|
122
|
+
this.logger.debug('Sending HEAD request to S3', { bucket: this.bucket, key: fileId });
|
|
123
|
+
const response = await this.s3Client.send(command);
|
|
124
|
+
const headers = {};
|
|
125
|
+
if (response.ContentType)
|
|
126
|
+
headers['content-type'] = response.ContentType;
|
|
127
|
+
if (response.ContentLength)
|
|
128
|
+
headers['content-length'] = String(response.ContentLength);
|
|
129
|
+
if (response.ETag)
|
|
130
|
+
headers.etag = response.ETag;
|
|
131
|
+
if (response.LastModified)
|
|
132
|
+
headers['last-modified'] = response.LastModified.toUTCString();
|
|
133
|
+
if (response.Metadata) {
|
|
134
|
+
Object.entries(response.Metadata).forEach(([key, value]) => {
|
|
135
|
+
headers[`x-amz-meta-${key.toLowerCase()}`] =
|
|
136
|
+
key === 'filename' ? decodeURIComponent(value) : value;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return headers;
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async deleteOne(fileId) {
|
|
146
|
+
try {
|
|
147
|
+
const command = new client_s3_1.DeleteObjectCommand({
|
|
148
|
+
Bucket: this.bucket,
|
|
149
|
+
Key: fileId,
|
|
150
|
+
});
|
|
151
|
+
this.logger.debug('Sending DELETE request to S3', { bucket: this.bucket, key: fileId });
|
|
152
|
+
return await this.s3Client.send(command);
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async deleteMany(prefix) {
|
|
159
|
+
try {
|
|
160
|
+
const objects = await this.list(prefix);
|
|
161
|
+
if (objects.length === 0)
|
|
162
|
+
return;
|
|
163
|
+
const params = {
|
|
164
|
+
Bucket: this.bucket,
|
|
165
|
+
Delete: {
|
|
166
|
+
Objects: objects.map(({ key }) => ({ Key: key })),
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
this.logger.debug('Sending DELETE MANY request to S3', {
|
|
170
|
+
bucket: this.bucket,
|
|
171
|
+
objectCount: objects.length,
|
|
172
|
+
});
|
|
173
|
+
const command = new client_s3_1.DeleteObjectsCommand(params);
|
|
174
|
+
return await this.s3Client.send(command);
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async list(prefix) {
|
|
181
|
+
const items = [];
|
|
182
|
+
let isTruncated = true;
|
|
183
|
+
let continuationToken;
|
|
184
|
+
try {
|
|
185
|
+
while (isTruncated) {
|
|
186
|
+
const listPage = await this.getListPage(prefix, continuationToken);
|
|
187
|
+
if (listPage.contents?.length > 0) {
|
|
188
|
+
items.push(...listPage.contents);
|
|
189
|
+
}
|
|
190
|
+
isTruncated = listPage.isTruncated;
|
|
191
|
+
continuationToken = listPage.nextContinuationToken;
|
|
192
|
+
}
|
|
193
|
+
return items;
|
|
194
|
+
}
|
|
195
|
+
catch (e) {
|
|
196
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async getListPage(prefix, continuationToken) {
|
|
200
|
+
try {
|
|
201
|
+
const params = {
|
|
202
|
+
Bucket: this.bucket,
|
|
203
|
+
Prefix: prefix,
|
|
204
|
+
};
|
|
205
|
+
if (continuationToken) {
|
|
206
|
+
params.ContinuationToken = continuationToken;
|
|
207
|
+
}
|
|
208
|
+
this.logger.debug('Sending list request to S3', { bucket: this.bucket, prefix });
|
|
209
|
+
const command = new client_s3_1.ListObjectsV2Command(params);
|
|
210
|
+
const response = await this.s3Client.send(command);
|
|
211
|
+
const contents = response.Contents?.map((item) => ({
|
|
212
|
+
key: item.Key ?? '',
|
|
213
|
+
lastModified: item.LastModified?.toISOString() ?? '',
|
|
214
|
+
eTag: item.ETag ?? '',
|
|
215
|
+
size: item.Size ?? 0,
|
|
216
|
+
storageClass: item.StorageClass ?? '',
|
|
217
|
+
})) ?? [];
|
|
218
|
+
return {
|
|
219
|
+
contents,
|
|
220
|
+
isTruncated: response.IsTruncated ?? false,
|
|
221
|
+
nextContinuationToken: response.NextContinuationToken,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
catch (e) {
|
|
225
|
+
throw new n8n_workflow_1.UnexpectedError('Request to S3 failed', { cause: e });
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
exports.ObjectStoreService = ObjectStoreService;
|
|
230
|
+
exports.ObjectStoreService = ObjectStoreService = __decorate([
|
|
231
|
+
(0, di_1.Service)(),
|
|
232
|
+
__metadata("design:paramtypes", [backend_common_1.Logger,
|
|
233
|
+
object_store_config_1.ObjectStoreConfig])
|
|
234
|
+
], ObjectStoreService);
|
|
235
|
+
//# sourceMappingURL=object-store.service.ee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-store.service.ee.js","sourceRoot":"","sources":["../../../src/binary-data/object-store/object-store.service.ee.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,kDAS4B;AAC5B,wDAA6C;AAC7C,gCAAkC;AAClC,+CAA+C;AAC/C,6CAAyC;AACzC,6CAAuC;AAEvC,+DAA0D;AAG1D,oCAA0C;AAGnC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAO9B,YACkB,MAAc,EACd,QAA2B;QAD3B,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAmB;QANrC,YAAO,GAAG,KAAK,CAAC;QAQvB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;QAC5B,IAAI,MAAM,CAAC,IAAI,KAAK,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,8BAAe,CACxB,gGAAgG,CAChG,CAAC;QACH,CAAC;QAED,IAAI,C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,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACjF,MAAM,OAAO,GAAG,IAAI,gCAAoB,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAGnD,MAAM,QAAQ,GACb,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACjC,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;gBACnB,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE;gBACpD,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;gBACrB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;gBACpB,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE;aACrC,CAAC,CAAC,IAAI,EAAE,CAAC;YAEX,OAAO;gBACN,QAAQ;gBACR,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,KAAK;gBAC1C,qBAAqB,EAAE,QAAQ,CAAC,qBAAqB;aACrD,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,MAAM,IAAI,8BAAe,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QACjE,CAAC;IACF,CAAC;CACD,CAAA;AA5QY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,YAAO,GAAE;qCASiB,uBAAM;QACJ,uCAAiB;GATjC,kBAAkB,CA4Q9B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BinaryData } from '../types';
|
|
2
|
+
export type MetadataResponseHeaders = Record<string, string> & {
|
|
3
|
+
'content-length'?: string;
|
|
4
|
+
'content-type'?: string;
|
|
5
|
+
'x-amz-meta-filename'?: string;
|
|
6
|
+
etag?: string;
|
|
7
|
+
'last-modified'?: string;
|
|
8
|
+
} & BinaryData.PreWriteMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/binary-data/object-store/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import { ObjectStoreService } from './object-store/object-store.service.ee';
|
|
3
|
+
import type { BinaryData } from './types';
|
|
4
|
+
export declare class ObjectStoreManager implements BinaryData.Manager {
|
|
5
|
+
private readonly objectStoreService;
|
|
6
|
+
constructor(objectStoreService: ObjectStoreService);
|
|
7
|
+
init(): Promise<void>;
|
|
8
|
+
store(location: BinaryData.FileLocation, bufferOrStream: Buffer | Readable, metadata: BinaryData.PreWriteMetadata): Promise<{
|
|
9
|
+
fileId: string;
|
|
10
|
+
fileSize: number;
|
|
11
|
+
}>;
|
|
12
|
+
getPath(fileId: string): string;
|
|
13
|
+
getAsBuffer(fileId: string): Promise<Buffer<ArrayBufferLike>>;
|
|
14
|
+
getAsStream(fileId: string): Promise<Readable>;
|
|
15
|
+
getMetadata(fileId: string): Promise<BinaryData.Metadata>;
|
|
16
|
+
copyByFileId(targetLocation: BinaryData.FileLocation, sourceFileId: string): Promise<string>;
|
|
17
|
+
copyByFilePath(targetLocation: BinaryData.FileLocation, sourcePath: string, metadata: BinaryData.PreWriteMetadata): Promise<{
|
|
18
|
+
fileId: string;
|
|
19
|
+
fileSize: number;
|
|
20
|
+
}>;
|
|
21
|
+
rename(oldFileId: string, newFileId: string): Promise<void>;
|
|
22
|
+
private toFileId;
|
|
23
|
+
}
|