@nest-batch/core 0.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/LICENSE +21 -0
- package/README.md +368 -0
- package/dist/src/adapters/in-process.adapter.d.ts +140 -0
- package/dist/src/adapters/in-process.adapter.d.ts.map +1 -0
- package/dist/src/adapters/in-process.adapter.js +86 -0
- package/dist/src/adapters/in-process.adapter.js.map +1 -0
- package/dist/src/adapters/index.d.ts +18 -0
- package/dist/src/adapters/index.d.ts.map +1 -0
- package/dist/src/adapters/index.js +35 -0
- package/dist/src/adapters/index.js.map +1 -0
- package/dist/src/builder/batch-builder.d.ts +26 -0
- package/dist/src/builder/batch-builder.d.ts.map +1 -0
- package/dist/src/builder/batch-builder.js +25 -0
- package/dist/src/builder/batch-builder.js.map +1 -0
- package/dist/src/builder/flow-builder.d.ts +59 -0
- package/dist/src/builder/flow-builder.d.ts.map +1 -0
- package/dist/src/builder/flow-builder.js +115 -0
- package/dist/src/builder/flow-builder.js.map +1 -0
- package/dist/src/builder/index.d.ts +5 -0
- package/dist/src/builder/index.d.ts.map +1 -0
- package/dist/src/builder/index.js +23 -0
- package/dist/src/builder/index.js.map +1 -0
- package/dist/src/builder/job-builder.d.ts +76 -0
- package/dist/src/builder/job-builder.d.ts.map +1 -0
- package/dist/src/builder/job-builder.js +166 -0
- package/dist/src/builder/job-builder.js.map +1 -0
- package/dist/src/builder/step-builder.d.ts +74 -0
- package/dist/src/builder/step-builder.d.ts.map +1 -0
- package/dist/src/builder/step-builder.js +144 -0
- package/dist/src/builder/step-builder.js.map +1 -0
- package/dist/src/compiler/builder-types.d.ts +20 -0
- package/dist/src/compiler/builder-types.d.ts.map +1 -0
- package/dist/src/compiler/builder-types.js +6 -0
- package/dist/src/compiler/builder-types.js.map +1 -0
- package/dist/src/compiler/definition-compiler.d.ts +99 -0
- package/dist/src/compiler/definition-compiler.d.ts.map +1 -0
- package/dist/src/compiler/definition-compiler.js +257 -0
- package/dist/src/compiler/definition-compiler.js.map +1 -0
- package/dist/src/compiler/index.d.ts +3 -0
- package/dist/src/compiler/index.d.ts.map +1 -0
- package/dist/src/compiler/index.js +21 -0
- package/dist/src/compiler/index.js.map +1 -0
- package/dist/src/core/errors.d.ts +77 -0
- package/dist/src/core/errors.d.ts.map +1 -0
- package/dist/src/core/errors.js +170 -0
- package/dist/src/core/errors.js.map +1 -0
- package/dist/src/core/execution-context/index.d.ts +4 -0
- package/dist/src/core/execution-context/index.d.ts.map +1 -0
- package/dist/src/core/execution-context/index.js +22 -0
- package/dist/src/core/execution-context/index.js.map +1 -0
- package/dist/src/core/execution-context/json-value.d.ts +5 -0
- package/dist/src/core/execution-context/json-value.d.ts.map +1 -0
- package/dist/src/core/execution-context/json-value.js +6 -0
- package/dist/src/core/execution-context/json-value.js.map +1 -0
- package/dist/src/core/execution-context/serializer.d.ts +4 -0
- package/dist/src/core/execution-context/serializer.d.ts.map +1 -0
- package/dist/src/core/execution-context/serializer.js +34 -0
- package/dist/src/core/execution-context/serializer.js.map +1 -0
- package/dist/src/core/execution-context/validator.d.ts +18 -0
- package/dist/src/core/execution-context/validator.d.ts.map +1 -0
- package/dist/src/core/execution-context/validator.js +90 -0
- package/dist/src/core/execution-context/validator.js.map +1 -0
- package/dist/src/core/index.d.ts +8 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/index.js +26 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/ir/decider-definition.d.ts +20 -0
- package/dist/src/core/ir/decider-definition.d.ts.map +1 -0
- package/dist/src/core/ir/decider-definition.js +6 -0
- package/dist/src/core/ir/decider-definition.js.map +1 -0
- package/dist/src/core/ir/index.d.ts +8 -0
- package/dist/src/core/ir/index.d.ts.map +1 -0
- package/dist/src/core/ir/index.js +26 -0
- package/dist/src/core/ir/index.js.map +1 -0
- package/dist/src/core/ir/job-definition.d.ts +15 -0
- package/dist/src/core/ir/job-definition.d.ts.map +1 -0
- package/dist/src/core/ir/job-definition.js +6 -0
- package/dist/src/core/ir/job-definition.js.map +1 -0
- package/dist/src/core/ir/listener-definition.d.ts +10 -0
- package/dist/src/core/ir/listener-definition.d.ts.map +1 -0
- package/dist/src/core/ir/listener-definition.js +6 -0
- package/dist/src/core/ir/listener-definition.js.map +1 -0
- package/dist/src/core/ir/policy-config.d.ts +24 -0
- package/dist/src/core/ir/policy-config.d.ts.map +1 -0
- package/dist/src/core/ir/policy-config.js +6 -0
- package/dist/src/core/ir/policy-config.js.map +1 -0
- package/dist/src/core/ir/refs.d.ts +42 -0
- package/dist/src/core/ir/refs.d.ts.map +1 -0
- package/dist/src/core/ir/refs.js +18 -0
- package/dist/src/core/ir/refs.js.map +1 -0
- package/dist/src/core/ir/step-definition.d.ts +59 -0
- package/dist/src/core/ir/step-definition.d.ts.map +1 -0
- package/dist/src/core/ir/step-definition.js +6 -0
- package/dist/src/core/ir/step-definition.js.map +1 -0
- package/dist/src/core/ir/transition-definition.d.ts +8 -0
- package/dist/src/core/ir/transition-definition.d.ts.map +1 -0
- package/dist/src/core/ir/transition-definition.js +6 -0
- package/dist/src/core/ir/transition-definition.js.map +1 -0
- package/dist/src/core/item/index.d.ts +2 -0
- package/dist/src/core/item/index.d.ts.map +1 -0
- package/dist/src/core/item/index.js +20 -0
- package/dist/src/core/item/index.js.map +1 -0
- package/dist/src/core/item/interfaces.d.ts +64 -0
- package/dist/src/core/item/interfaces.d.ts.map +1 -0
- package/dist/src/core/item/interfaces.js +6 -0
- package/dist/src/core/item/interfaces.js.map +1 -0
- package/dist/src/core/repository/index.d.ts +3 -0
- package/dist/src/core/repository/index.d.ts.map +1 -0
- package/dist/src/core/repository/index.js +21 -0
- package/dist/src/core/repository/index.js.map +1 -0
- package/dist/src/core/repository/job-repository.d.ts +60 -0
- package/dist/src/core/repository/job-repository.d.ts.map +1 -0
- package/dist/src/core/repository/job-repository.js +27 -0
- package/dist/src/core/repository/job-repository.js.map +1 -0
- package/dist/src/core/repository/types.d.ts +84 -0
- package/dist/src/core/repository/types.d.ts.map +1 -0
- package/dist/src/core/repository/types.js +6 -0
- package/dist/src/core/repository/types.js.map +1 -0
- package/dist/src/core/status.d.ts +29 -0
- package/dist/src/core/status.d.ts.map +1 -0
- package/dist/src/core/status.js +58 -0
- package/dist/src/core/status.js.map +1 -0
- package/dist/src/core/transaction/index.d.ts +2 -0
- package/dist/src/core/transaction/index.d.ts.map +1 -0
- package/dist/src/core/transaction/index.js +20 -0
- package/dist/src/core/transaction/index.js.map +1 -0
- package/dist/src/core/transaction/transaction-manager.d.ts +8 -0
- package/dist/src/core/transaction/transaction-manager.d.ts.map +1 -0
- package/dist/src/core/transaction/transaction-manager.js +14 -0
- package/dist/src/core/transaction/transaction-manager.js.map +1 -0
- package/dist/src/core/validation/definition-validator.d.ts +46 -0
- package/dist/src/core/validation/definition-validator.d.ts.map +1 -0
- package/dist/src/core/validation/definition-validator.js +177 -0
- package/dist/src/core/validation/definition-validator.js.map +1 -0
- package/dist/src/core/validation/index.d.ts +2 -0
- package/dist/src/core/validation/index.d.ts.map +1 -0
- package/dist/src/core/validation/index.js +20 -0
- package/dist/src/core/validation/index.js.map +1 -0
- package/dist/src/decorators/constants.d.ts +10 -0
- package/dist/src/decorators/constants.d.ts.map +1 -0
- package/dist/src/decorators/constants.js +50 -0
- package/dist/src/decorators/constants.js.map +1 -0
- package/dist/src/decorators/flow.decorator.d.ts +25 -0
- package/dist/src/decorators/flow.decorator.d.ts.map +1 -0
- package/dist/src/decorators/flow.decorator.js +19 -0
- package/dist/src/decorators/flow.decorator.js.map +1 -0
- package/dist/src/decorators/index.d.ts +8 -0
- package/dist/src/decorators/index.d.ts.map +1 -0
- package/dist/src/decorators/index.js +26 -0
- package/dist/src/decorators/index.js.map +1 -0
- package/dist/src/decorators/item.decorators.d.ts +32 -0
- package/dist/src/decorators/item.decorators.d.ts.map +1 -0
- package/dist/src/decorators/item.decorators.js +40 -0
- package/dist/src/decorators/item.decorators.js.map +1 -0
- package/dist/src/decorators/job.decorator.d.ts +11 -0
- package/dist/src/decorators/job.decorator.d.ts.map +1 -0
- package/dist/src/decorators/job.decorator.js +17 -0
- package/dist/src/decorators/job.decorator.js.map +1 -0
- package/dist/src/decorators/listener.decorators.d.ts +56 -0
- package/dist/src/decorators/listener.decorators.d.ts.map +1 -0
- package/dist/src/decorators/listener.decorators.js +157 -0
- package/dist/src/decorators/listener.decorators.js.map +1 -0
- package/dist/src/decorators/step.decorator.d.ts +25 -0
- package/dist/src/decorators/step.decorator.d.ts.map +1 -0
- package/dist/src/decorators/step.decorator.js +21 -0
- package/dist/src/decorators/step.decorator.js.map +1 -0
- package/dist/src/decorators/tasklet.decorator.d.ts +7 -0
- package/dist/src/decorators/tasklet.decorator.d.ts.map +1 -0
- package/dist/src/decorators/tasklet.decorator.js +21 -0
- package/dist/src/decorators/tasklet.decorator.js.map +1 -0
- package/dist/src/execution/batch-worker-runner.d.ts +27 -0
- package/dist/src/execution/batch-worker-runner.d.ts.map +1 -0
- package/dist/src/execution/batch-worker-runner.js +147 -0
- package/dist/src/execution/batch-worker-runner.js.map +1 -0
- package/dist/src/execution/chunk-step-executor.d.ts +86 -0
- package/dist/src/execution/chunk-step-executor.d.ts.map +1 -0
- package/dist/src/execution/chunk-step-executor.js +482 -0
- package/dist/src/execution/chunk-step-executor.js.map +1 -0
- package/dist/src/execution/execution-strategy.d.ts +110 -0
- package/dist/src/execution/execution-strategy.d.ts.map +1 -0
- package/dist/src/execution/execution-strategy.js +13 -0
- package/dist/src/execution/execution-strategy.js.map +1 -0
- package/dist/src/execution/external-task-execution-strategy.d.ts +36 -0
- package/dist/src/execution/external-task-execution-strategy.d.ts.map +1 -0
- package/dist/src/execution/external-task-execution-strategy.js +97 -0
- package/dist/src/execution/external-task-execution-strategy.js.map +1 -0
- package/dist/src/execution/in-process-execution-strategy.d.ts +129 -0
- package/dist/src/execution/in-process-execution-strategy.d.ts.map +1 -0
- package/dist/src/execution/in-process-execution-strategy.js +141 -0
- package/dist/src/execution/in-process-execution-strategy.js.map +1 -0
- package/dist/src/execution/index.d.ts +14 -0
- package/dist/src/execution/index.d.ts.map +1 -0
- package/dist/src/execution/index.js +32 -0
- package/dist/src/execution/index.js.map +1 -0
- package/dist/src/execution/job-executor.d.ts +145 -0
- package/dist/src/execution/job-executor.d.ts.map +1 -0
- package/dist/src/execution/job-executor.js +475 -0
- package/dist/src/execution/job-executor.js.map +1 -0
- package/dist/src/execution/job-explorer.d.ts +15 -0
- package/dist/src/execution/job-explorer.d.ts.map +1 -0
- package/dist/src/execution/job-explorer.js +84 -0
- package/dist/src/execution/job-explorer.js.map +1 -0
- package/dist/src/execution/job-key.d.ts +3 -0
- package/dist/src/execution/job-key.d.ts.map +1 -0
- package/dist/src/execution/job-key.js +43 -0
- package/dist/src/execution/job-key.js.map +1 -0
- package/dist/src/execution/job-launcher.d.ts +75 -0
- package/dist/src/execution/job-launcher.d.ts.map +1 -0
- package/dist/src/execution/job-launcher.js +112 -0
- package/dist/src/execution/job-launcher.js.map +1 -0
- package/dist/src/execution/job-operator.d.ts +22 -0
- package/dist/src/execution/job-operator.d.ts.map +1 -0
- package/dist/src/execution/job-operator.js +125 -0
- package/dist/src/execution/job-operator.js.map +1 -0
- package/dist/src/execution/listener-invoker.d.ts +164 -0
- package/dist/src/execution/listener-invoker.d.ts.map +1 -0
- package/dist/src/execution/listener-invoker.js +246 -0
- package/dist/src/execution/listener-invoker.js.map +1 -0
- package/dist/src/execution/ref-resolver.d.ts +40 -0
- package/dist/src/execution/ref-resolver.d.ts.map +1 -0
- package/dist/src/execution/ref-resolver.js +41 -0
- package/dist/src/execution/ref-resolver.js.map +1 -0
- package/dist/src/execution/tasklet-step-executor.d.ts +79 -0
- package/dist/src/execution/tasklet-step-executor.d.ts.map +1 -0
- package/dist/src/execution/tasklet-step-executor.js +138 -0
- package/dist/src/execution/tasklet-step-executor.js.map +1 -0
- package/dist/src/explorer/batch-explorer.d.ts +138 -0
- package/dist/src/explorer/batch-explorer.d.ts.map +1 -0
- package/dist/src/explorer/batch-explorer.js +167 -0
- package/dist/src/explorer/batch-explorer.js.map +1 -0
- package/dist/src/explorer/index.d.ts +2 -0
- package/dist/src/explorer/index.d.ts.map +1 -0
- package/dist/src/explorer/index.js +20 -0
- package/dist/src/explorer/index.js.map +1 -0
- package/dist/src/flow/flow-evaluator.d.ts +30 -0
- package/dist/src/flow/flow-evaluator.d.ts.map +1 -0
- package/dist/src/flow/flow-evaluator.js +80 -0
- package/dist/src/flow/flow-evaluator.js.map +1 -0
- package/dist/src/flow/index.d.ts +2 -0
- package/dist/src/flow/index.d.ts.map +1 -0
- package/dist/src/flow/index.js +20 -0
- package/dist/src/flow/index.js.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +90 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/io/checkpoint.d.ts +7 -0
- package/dist/src/io/checkpoint.d.ts.map +1 -0
- package/dist/src/io/checkpoint.js +56 -0
- package/dist/src/io/checkpoint.js.map +1 -0
- package/dist/src/io/database.d.ts +50 -0
- package/dist/src/io/database.d.ts.map +1 -0
- package/dist/src/io/database.js +108 -0
- package/dist/src/io/database.js.map +1 -0
- package/dist/src/io/file-readers.d.ts +54 -0
- package/dist/src/io/file-readers.d.ts.map +1 -0
- package/dist/src/io/file-readers.js +167 -0
- package/dist/src/io/file-readers.js.map +1 -0
- package/dist/src/io/file-writers.d.ts +31 -0
- package/dist/src/io/file-writers.d.ts.map +1 -0
- package/dist/src/io/file-writers.js +80 -0
- package/dist/src/io/file-writers.js.map +1 -0
- package/dist/src/io/index.d.ts +6 -0
- package/dist/src/io/index.d.ts.map +1 -0
- package/dist/src/io/index.js +24 -0
- package/dist/src/io/index.js.map +1 -0
- package/dist/src/io/s3.d.ts +50 -0
- package/dist/src/io/s3.d.ts.map +1 -0
- package/dist/src/io/s3.js +96 -0
- package/dist/src/io/s3.js.map +1 -0
- package/dist/src/listeners/builtin-listeners.d.ts +77 -0
- package/dist/src/listeners/builtin-listeners.d.ts.map +1 -0
- package/dist/src/listeners/builtin-listeners.js +108 -0
- package/dist/src/listeners/builtin-listeners.js.map +1 -0
- package/dist/src/listeners/index.d.ts +8 -0
- package/dist/src/listeners/index.d.ts.map +1 -0
- package/dist/src/listeners/index.js +25 -0
- package/dist/src/listeners/index.js.map +1 -0
- package/dist/src/module/adapter-options.d.ts +39 -0
- package/dist/src/module/adapter-options.d.ts.map +1 -0
- package/dist/src/module/adapter-options.js +34 -0
- package/dist/src/module/adapter-options.js.map +1 -0
- package/dist/src/module/adapter.d.ts +157 -0
- package/dist/src/module/adapter.d.ts.map +1 -0
- package/dist/src/module/adapter.js +80 -0
- package/dist/src/module/adapter.js.map +1 -0
- package/dist/src/module/batch-schedule-registry.d.ts +110 -0
- package/dist/src/module/batch-schedule-registry.d.ts.map +1 -0
- package/dist/src/module/batch-schedule-registry.js +0 -0
- package/dist/src/module/batch-schedule-registry.js.map +1 -0
- package/dist/src/module/index.d.ts +14 -0
- package/dist/src/module/index.d.ts.map +1 -0
- package/dist/src/module/index.js +31 -0
- package/dist/src/module/index.js.map +1 -0
- package/dist/src/module/nest-batch.module.d.ts +236 -0
- package/dist/src/module/nest-batch.module.d.ts.map +1 -0
- package/dist/src/module/nest-batch.module.js +475 -0
- package/dist/src/module/nest-batch.module.js.map +1 -0
- package/dist/src/module/tokens.d.ts +83 -0
- package/dist/src/module/tokens.d.ts.map +1 -0
- package/dist/src/module/tokens.js +58 -0
- package/dist/src/module/tokens.js.map +1 -0
- package/dist/src/observability/event-types.d.ts +55 -0
- package/dist/src/observability/event-types.d.ts.map +1 -0
- package/dist/src/observability/event-types.js +36 -0
- package/dist/src/observability/event-types.js.map +1 -0
- package/dist/src/observability/exporters.d.ts +35 -0
- package/dist/src/observability/exporters.d.ts.map +1 -0
- package/dist/src/observability/exporters.js +93 -0
- package/dist/src/observability/exporters.js.map +1 -0
- package/dist/src/observability/index.d.ts +3 -0
- package/dist/src/observability/index.d.ts.map +1 -0
- package/dist/src/observability/index.js +21 -0
- package/dist/src/observability/index.js.map +1 -0
- package/dist/src/partition-helpers.d.ts +127 -0
- package/dist/src/partition-helpers.d.ts.map +1 -0
- package/dist/src/partition-helpers.js +136 -0
- package/dist/src/partition-helpers.js.map +1 -0
- package/dist/src/policies/backoff.d.ts +3 -0
- package/dist/src/policies/backoff.d.ts.map +1 -0
- package/dist/src/policies/backoff.js +34 -0
- package/dist/src/policies/backoff.js.map +1 -0
- package/dist/src/policies/index.d.ts +4 -0
- package/dist/src/policies/index.d.ts.map +1 -0
- package/dist/src/policies/index.js +22 -0
- package/dist/src/policies/index.js.map +1 -0
- package/dist/src/policies/retry-policy.d.ts +13 -0
- package/dist/src/policies/retry-policy.d.ts.map +1 -0
- package/dist/src/policies/retry-policy.js +55 -0
- package/dist/src/policies/retry-policy.js.map +1 -0
- package/dist/src/policies/skip-policy.d.ts +12 -0
- package/dist/src/policies/skip-policy.d.ts.map +1 -0
- package/dist/src/policies/skip-policy.js +44 -0
- package/dist/src/policies/skip-policy.js.map +1 -0
- package/dist/src/registry/index.d.ts +2 -0
- package/dist/src/registry/index.d.ts.map +1 -0
- package/dist/src/registry/index.js +20 -0
- package/dist/src/registry/index.js.map +1 -0
- package/dist/src/registry/job-registry.d.ts +16 -0
- package/dist/src/registry/job-registry.d.ts.map +1 -0
- package/dist/src/registry/job-registry.js +50 -0
- package/dist/src/registry/job-registry.js.map +1 -0
- package/dist/src/repository/id-generator.d.ts +18 -0
- package/dist/src/repository/id-generator.d.ts.map +1 -0
- package/dist/src/repository/id-generator.js +37 -0
- package/dist/src/repository/id-generator.js.map +1 -0
- package/dist/src/repository/in-memory/in-memory-job-repository.d.ts +49 -0
- package/dist/src/repository/in-memory/in-memory-job-repository.d.ts.map +1 -0
- package/dist/src/repository/in-memory/in-memory-job-repository.js +291 -0
- package/dist/src/repository/in-memory/in-memory-job-repository.js.map +1 -0
- package/dist/src/repository/in-memory/index.d.ts +2 -0
- package/dist/src/repository/in-memory/index.d.ts.map +1 -0
- package/dist/src/repository/in-memory/index.js +20 -0
- package/dist/src/repository/in-memory/index.js.map +1 -0
- package/dist/src/repository/index.d.ts +4 -0
- package/dist/src/repository/index.d.ts.map +1 -0
- package/dist/src/repository/index.js +22 -0
- package/dist/src/repository/index.js.map +1 -0
- package/dist/src/repository/uuid-v7.d.ts +20 -0
- package/dist/src/repository/uuid-v7.d.ts.map +1 -0
- package/dist/src/repository/uuid-v7.js +31 -0
- package/dist/src/repository/uuid-v7.js.map +1 -0
- package/dist/src/scheduling/batch-scheduled.d.ts +87 -0
- package/dist/src/scheduling/batch-scheduled.d.ts.map +1 -0
- package/dist/src/scheduling/batch-scheduled.js +170 -0
- package/dist/src/scheduling/batch-scheduled.js.map +1 -0
- package/dist/src/transaction/in-memory-transaction-manager.d.ts +16 -0
- package/dist/src/transaction/in-memory-transaction-manager.d.ts.map +1 -0
- package/dist/src/transaction/in-memory-transaction-manager.js +33 -0
- package/dist/src/transaction/in-memory-transaction-manager.js.map +1 -0
- package/dist/src/transaction/index.d.ts +2 -0
- package/dist/src/transaction/index.d.ts.map +1 -0
- package/dist/src/transaction/index.js +20 -0
- package/dist/src/transaction/index.js.map +1 -0
- package/dist/tests/contracts/index.d.ts +26 -0
- package/dist/tests/contracts/index.d.ts.map +1 -0
- package/dist/tests/contracts/index.js +37 -0
- package/dist/tests/contracts/index.js.map +1 -0
- package/dist/tests/contracts/job-repository.contract.d.ts +46 -0
- package/dist/tests/contracts/job-repository.contract.d.ts.map +1 -0
- package/dist/tests/contracts/job-repository.contract.js +644 -0
- package/dist/tests/contracts/job-repository.contract.js.map +1 -0
- package/package.json +80 -0
- package/src/adapters/in-process.adapter.ts +182 -0
- package/src/adapters/index.ts +17 -0
- package/src/builder/batch-builder.ts +32 -0
- package/src/builder/flow-builder.ts +141 -0
- package/src/builder/index.ts +4 -0
- package/src/builder/job-builder.ts +206 -0
- package/src/builder/step-builder.ts +190 -0
- package/src/compiler/builder-types.ts +27 -0
- package/src/compiler/definition-compiler.ts +325 -0
- package/src/compiler/index.ts +2 -0
- package/src/core/errors.ts +125 -0
- package/src/core/execution-context/index.ts +3 -0
- package/src/core/execution-context/json-value.ts +3 -0
- package/src/core/execution-context/serializer.ts +21 -0
- package/src/core/execution-context/validator.ts +103 -0
- package/src/core/index.ts +7 -0
- package/src/core/ir/decider-definition.ts +25 -0
- package/src/core/ir/index.ts +7 -0
- package/src/core/ir/job-definition.ts +15 -0
- package/src/core/ir/listener-definition.ts +19 -0
- package/src/core/ir/policy-config.ts +19 -0
- package/src/core/ir/refs.ts +42 -0
- package/src/core/ir/step-definition.ts +62 -0
- package/src/core/ir/transition-definition.ts +9 -0
- package/src/core/item/index.ts +1 -0
- package/src/core/item/interfaces.ts +70 -0
- package/src/core/repository/index.ts +2 -0
- package/src/core/repository/job-repository.ts +100 -0
- package/src/core/repository/types.ts +91 -0
- package/src/core/status.ts +31 -0
- package/src/core/transaction/index.ts +1 -0
- package/src/core/transaction/transaction-manager.ts +8 -0
- package/src/core/validation/definition-validator.ts +215 -0
- package/src/core/validation/index.ts +1 -0
- package/src/decorators/constants.ts +9 -0
- package/src/decorators/flow.decorator.ts +31 -0
- package/src/decorators/index.ts +7 -0
- package/src/decorators/item.decorators.ts +51 -0
- package/src/decorators/job.decorator.ts +16 -0
- package/src/decorators/listener.decorators.ts +142 -0
- package/src/decorators/step.decorator.ts +33 -0
- package/src/decorators/tasklet.decorator.ts +14 -0
- package/src/execution/batch-worker-runner.ts +142 -0
- package/src/execution/chunk-step-executor.ts +594 -0
- package/src/execution/execution-strategy.ts +115 -0
- package/src/execution/external-task-execution-strategy.ts +104 -0
- package/src/execution/in-process-execution-strategy.ts +207 -0
- package/src/execution/index.ts +13 -0
- package/src/execution/job-executor.ts +553 -0
- package/src/execution/job-explorer.ts +73 -0
- package/src/execution/job-key.ts +35 -0
- package/src/execution/job-launcher.ts +132 -0
- package/src/execution/job-operator.ts +127 -0
- package/src/execution/listener-invoker.ts +389 -0
- package/src/execution/ref-resolver.ts +64 -0
- package/src/execution/tasklet-step-executor.ts +182 -0
- package/src/explorer/batch-explorer.ts +251 -0
- package/src/explorer/index.ts +1 -0
- package/src/flow/flow-evaluator.ts +89 -0
- package/src/flow/index.ts +1 -0
- package/src/index.ts +24 -0
- package/src/io/checkpoint.ts +47 -0
- package/src/io/database.ts +114 -0
- package/src/io/file-readers.ts +191 -0
- package/src/io/file-writers.ts +99 -0
- package/src/io/index.ts +5 -0
- package/src/io/s3.ts +117 -0
- package/src/listeners/builtin-listeners.ts +151 -0
- package/src/listeners/index.ts +7 -0
- package/src/module/adapter-options.ts +38 -0
- package/src/module/adapter.ts +160 -0
- package/src/module/batch-schedule-registry.ts +0 -0
- package/src/module/index.ts +13 -0
- package/src/module/nest-batch.module.ts +674 -0
- package/src/module/tokens.ts +95 -0
- package/src/observability/event-types.ts +61 -0
- package/src/observability/exporters.ts +96 -0
- package/src/observability/index.ts +2 -0
- package/src/partition-helpers.ts +204 -0
- package/src/policies/backoff.ts +22 -0
- package/src/policies/index.ts +3 -0
- package/src/policies/retry-policy.ts +57 -0
- package/src/policies/skip-policy.ts +51 -0
- package/src/registry/index.ts +1 -0
- package/src/registry/job-registry.ts +42 -0
- package/src/repository/id-generator.ts +25 -0
- package/src/repository/in-memory/in-memory-job-repository.ts +334 -0
- package/src/repository/in-memory/index.ts +1 -0
- package/src/repository/index.ts +3 -0
- package/src/repository/uuid-v7.ts +40 -0
- package/src/scheduling/batch-scheduled.ts +257 -0
- package/src/transaction/in-memory-transaction-manager.ts +23 -0
- package/src/transaction/index.ts +1 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get BatchWorkerRunner () {
|
|
13
|
+
return BatchWorkerRunner;
|
|
14
|
+
},
|
|
15
|
+
get parseBatchWorkerArgs () {
|
|
16
|
+
return parseBatchWorkerArgs;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _nodecrypto = require("node:crypto");
|
|
20
|
+
const _common = require("@nestjs/common");
|
|
21
|
+
const _errors = require("../core/errors");
|
|
22
|
+
const _repository = require("../core/repository");
|
|
23
|
+
const _status = require("../core/status");
|
|
24
|
+
const _jobregistry = require("../registry/job-registry");
|
|
25
|
+
const _jobexecutor = require("./job-executor");
|
|
26
|
+
const _jobkey = require("./job-key");
|
|
27
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
28
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30
|
+
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;
|
|
31
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32
|
+
}
|
|
33
|
+
function _ts_metadata(k, v) {
|
|
34
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
|
+
}
|
|
36
|
+
let BatchWorkerRunner = class BatchWorkerRunner {
|
|
37
|
+
registry;
|
|
38
|
+
repository;
|
|
39
|
+
jobExecutor;
|
|
40
|
+
constructor(registry, repository, jobExecutor){
|
|
41
|
+
this.registry = registry;
|
|
42
|
+
this.repository = repository;
|
|
43
|
+
this.jobExecutor = jobExecutor;
|
|
44
|
+
}
|
|
45
|
+
async run(options) {
|
|
46
|
+
const executionId = options.jobExecutionId ?? options.executionId;
|
|
47
|
+
const params = options.params ?? {};
|
|
48
|
+
let jobId = options.jobId;
|
|
49
|
+
let execution;
|
|
50
|
+
if (executionId !== undefined) {
|
|
51
|
+
const existing = await this.repository.getJobExecution(executionId);
|
|
52
|
+
if (existing === null) {
|
|
53
|
+
throw new _errors.JobExecutionNotFoundError(executionId);
|
|
54
|
+
}
|
|
55
|
+
execution = existing;
|
|
56
|
+
if (jobId === undefined) {
|
|
57
|
+
const instance = await this.repository.getJobInstance(existing.jobInstanceId);
|
|
58
|
+
if (instance === null) {
|
|
59
|
+
throw new _errors.JobInstanceNotFoundError(existing.jobInstanceId);
|
|
60
|
+
}
|
|
61
|
+
jobId = instance.jobName;
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
if (jobId === undefined) {
|
|
65
|
+
throw new _errors.InvalidJobOperationError('worker-run', 'BatchWorkerRunner requires either jobExecutionId or jobId');
|
|
66
|
+
}
|
|
67
|
+
const jobDef = this.registry.get(jobId);
|
|
68
|
+
const canonical = (0, _jobkey.canonicalJobKey)(params);
|
|
69
|
+
const jobKey = jobDef.allowDuplicateInstances ? `${canonical}::${(0, _nodecrypto.randomUUID)()}` : canonical;
|
|
70
|
+
execution = await this.repository.createExecutionAtomic(jobId, jobKey, params);
|
|
71
|
+
}
|
|
72
|
+
const jobDef = this.registry.get(jobId);
|
|
73
|
+
const jobExecution = await this.jobExecutor.execute(execution, jobDef, {
|
|
74
|
+
...options.partitionIndex !== undefined ? {
|
|
75
|
+
partitionIndex: options.partitionIndex
|
|
76
|
+
} : {},
|
|
77
|
+
...options.partitionCount !== undefined ? {
|
|
78
|
+
partitionCount: options.partitionCount
|
|
79
|
+
} : {}
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
jobExecution,
|
|
83
|
+
status: jobExecution.status,
|
|
84
|
+
processExitCode: jobExecution.status === _status.JobStatus.COMPLETED ? 0 : 1
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
BatchWorkerRunner = _ts_decorate([
|
|
89
|
+
(0, _common.Injectable)(),
|
|
90
|
+
_ts_metadata("design:type", Function),
|
|
91
|
+
_ts_metadata("design:paramtypes", [
|
|
92
|
+
typeof _jobregistry.JobRegistry === "undefined" ? Object : _jobregistry.JobRegistry,
|
|
93
|
+
typeof _repository.JobRepository === "undefined" ? Object : _repository.JobRepository,
|
|
94
|
+
typeof _jobexecutor.JobExecutor === "undefined" ? Object : _jobexecutor.JobExecutor
|
|
95
|
+
])
|
|
96
|
+
], BatchWorkerRunner);
|
|
97
|
+
function parseBatchWorkerArgs(argv) {
|
|
98
|
+
const args = argv[0] === 'batch-worker' ? argv.slice(1) : argv;
|
|
99
|
+
const out = {};
|
|
100
|
+
for(let i = 0; i < args.length; i += 1){
|
|
101
|
+
const arg = args[i];
|
|
102
|
+
if (!arg.startsWith('--')) continue;
|
|
103
|
+
const eq = arg.indexOf('=');
|
|
104
|
+
if (eq >= 0) {
|
|
105
|
+
out[arg.slice(2, eq)] = arg.slice(eq + 1);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const key = arg.slice(2);
|
|
109
|
+
const next = args[i + 1];
|
|
110
|
+
if (next === undefined || next.startsWith('--')) {
|
|
111
|
+
out[key] = 'true';
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
out[key] = next;
|
|
115
|
+
i += 1;
|
|
116
|
+
}
|
|
117
|
+
let params;
|
|
118
|
+
if (out['params-json'] !== undefined) {
|
|
119
|
+
const parsed = JSON.parse(out['params-json']);
|
|
120
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
121
|
+
throw new _errors.InvalidJobOperationError('worker-args', '--params-json must be a JSON object');
|
|
122
|
+
}
|
|
123
|
+
params = parsed;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
...out['execution-id'] !== undefined ? {
|
|
127
|
+
jobExecutionId: out['execution-id']
|
|
128
|
+
} : {},
|
|
129
|
+
...out['job-execution-id'] !== undefined ? {
|
|
130
|
+
jobExecutionId: out['job-execution-id']
|
|
131
|
+
} : {},
|
|
132
|
+
...out['job-id'] !== undefined ? {
|
|
133
|
+
jobId: out['job-id']
|
|
134
|
+
} : {},
|
|
135
|
+
...params !== undefined ? {
|
|
136
|
+
params
|
|
137
|
+
} : {},
|
|
138
|
+
...out['partition-index'] !== undefined ? {
|
|
139
|
+
partitionIndex: Number(out['partition-index'])
|
|
140
|
+
} : {},
|
|
141
|
+
...out['partition-count'] !== undefined ? {
|
|
142
|
+
partitionCount: Number(out['partition-count'])
|
|
143
|
+
} : {}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
//# sourceMappingURL=batch-worker-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/execution/batch-worker-runner.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport { Injectable } from '@nestjs/common';\n\nimport {\n InvalidJobOperationError,\n JobExecutionNotFoundError,\n JobInstanceNotFoundError,\n} from '../core/errors';\nimport type { JobParameters, JobExecution } from '../core/repository';\nimport { JobRepository } from '../core/repository';\nimport { JobStatus } from '../core/status';\nimport { JobRegistry } from '../registry/job-registry';\n\nimport { JobExecutor } from './job-executor';\nimport { canonicalJobKey } from './job-key';\n\nexport interface BatchWorkerRunOptions {\n readonly jobExecutionId?: string;\n readonly executionId?: string;\n readonly jobId?: string;\n readonly params?: JobParameters;\n readonly partitionIndex?: number;\n readonly partitionCount?: number;\n}\n\nexport interface BatchWorkerRunResult {\n readonly jobExecution: JobExecution;\n readonly status: JobStatus;\n readonly processExitCode: number;\n}\n\n@Injectable()\nexport class BatchWorkerRunner {\n constructor(\n private readonly registry: JobRegistry,\n private readonly repository: JobRepository,\n private readonly jobExecutor: JobExecutor,\n ) {}\n\n async run(options: BatchWorkerRunOptions): Promise<BatchWorkerRunResult> {\n const executionId = options.jobExecutionId ?? options.executionId;\n const params = options.params ?? {};\n\n let jobId = options.jobId;\n let execution: JobExecution;\n\n if (executionId !== undefined) {\n const existing = await this.repository.getJobExecution(executionId);\n if (existing === null) {\n throw new JobExecutionNotFoundError(executionId);\n }\n execution = existing;\n if (jobId === undefined) {\n const instance = await this.repository.getJobInstance(existing.jobInstanceId);\n if (instance === null) {\n throw new JobInstanceNotFoundError(existing.jobInstanceId);\n }\n jobId = instance.jobName;\n }\n } else {\n if (jobId === undefined) {\n throw new InvalidJobOperationError(\n 'worker-run',\n 'BatchWorkerRunner requires either jobExecutionId or jobId',\n );\n }\n const jobDef = this.registry.get(jobId);\n const canonical = canonicalJobKey(params);\n const jobKey = jobDef.allowDuplicateInstances\n ? `${canonical}::${randomUUID()}`\n : canonical;\n execution = await this.repository.createExecutionAtomic(jobId, jobKey, params);\n }\n\n const jobDef = this.registry.get(jobId);\n const jobExecution = await this.jobExecutor.execute(execution, jobDef, {\n ...(options.partitionIndex !== undefined\n ? { partitionIndex: options.partitionIndex }\n : {}),\n ...(options.partitionCount !== undefined\n ? { partitionCount: options.partitionCount }\n : {}),\n });\n\n return {\n jobExecution,\n status: jobExecution.status,\n processExitCode: jobExecution.status === JobStatus.COMPLETED ? 0 : 1,\n };\n }\n}\n\nexport function parseBatchWorkerArgs(argv: readonly string[]): BatchWorkerRunOptions {\n const args = argv[0] === 'batch-worker' ? argv.slice(1) : argv;\n const out: Record<string, string> = {};\n\n for (let i = 0; i < args.length; i += 1) {\n const arg = args[i]!;\n if (!arg.startsWith('--')) continue;\n const eq = arg.indexOf('=');\n if (eq >= 0) {\n out[arg.slice(2, eq)] = arg.slice(eq + 1);\n continue;\n }\n const key = arg.slice(2);\n const next = args[i + 1];\n if (next === undefined || next.startsWith('--')) {\n out[key] = 'true';\n continue;\n }\n out[key] = next;\n i += 1;\n }\n\n let params: JobParameters | undefined;\n if (out['params-json'] !== undefined) {\n const parsed = JSON.parse(out['params-json']) as unknown;\n if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new InvalidJobOperationError(\n 'worker-args',\n '--params-json must be a JSON object',\n );\n }\n params = parsed as JobParameters;\n }\n\n return {\n ...(out['execution-id'] !== undefined ? { jobExecutionId: out['execution-id'] } : {}),\n ...(out['job-execution-id'] !== undefined\n ? { jobExecutionId: out['job-execution-id'] }\n : {}),\n ...(out['job-id'] !== undefined ? { jobId: out['job-id'] } : {}),\n ...(params !== undefined ? { params } : {}),\n ...(out['partition-index'] !== undefined\n ? { partitionIndex: Number(out['partition-index']) }\n : {}),\n ...(out['partition-count'] !== undefined\n ? { partitionCount: Number(out['partition-count']) }\n : {}),\n };\n}\n"],"names":["BatchWorkerRunner","parseBatchWorkerArgs","registry","repository","jobExecutor","run","options","executionId","jobExecutionId","params","jobId","execution","undefined","existing","getJobExecution","JobExecutionNotFoundError","instance","getJobInstance","jobInstanceId","JobInstanceNotFoundError","jobName","InvalidJobOperationError","jobDef","get","canonical","canonicalJobKey","jobKey","allowDuplicateInstances","randomUUID","createExecutionAtomic","jobExecution","execute","partitionIndex","partitionCount","status","processExitCode","JobStatus","COMPLETED","argv","args","slice","out","i","length","arg","startsWith","eq","indexOf","key","next","parsed","JSON","parse","Array","isArray","Number"],"mappings":";;;;;;;;;;;QAiCaA;eAAAA;;QA4DGC;eAAAA;;;4BA7FW;wBAEA;wBAMpB;4BAEuB;wBACJ;6BACE;6BAEA;wBACI;;;;;;;;;;AAkBzB,IAAA,AAAMD,oBAAN,MAAMA;;;;IACX,YACE,AAAiBE,QAAqB,EACtC,AAAiBC,UAAyB,EAC1C,AAAiBC,WAAwB,CACzC;aAHiBF,WAAAA;aACAC,aAAAA;aACAC,cAAAA;IAChB;IAEH,MAAMC,IAAIC,OAA8B,EAAiC;QACvE,MAAMC,cAAcD,QAAQE,cAAc,IAAIF,QAAQC,WAAW;QACjE,MAAME,SAASH,QAAQG,MAAM,IAAI,CAAC;QAElC,IAAIC,QAAQJ,QAAQI,KAAK;QACzB,IAAIC;QAEJ,IAAIJ,gBAAgBK,WAAW;YAC7B,MAAMC,WAAW,MAAM,IAAI,CAACV,UAAU,CAACW,eAAe,CAACP;YACvD,IAAI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EH;QAAO,IAAI,CAAC,CAAC;QAC1C,GAAIgC,GAAG,CAAC,kBAAkB,KAAK7B,YAC3B;YAAEoB,gBAAgBuB,OAAOd,GAAG,CAAC,kBAAkB;QAAE,IACjD,CAAC,CAAC;QACN,GAAIA,GAAG,CAAC,kBAAkB,KAAK7B,YAC3B;YAAEqB,gBAAgBsB,OAAOd,GAAG,CAAC,kBAAkB;QAAE,IACjD,CAAC,CAAC;IACR;AACF"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ChunkStepDefinition } from '../core/ir';
|
|
2
|
+
import type { JobRepository } from '../core/repository';
|
|
3
|
+
import type { TransactionManager } from '../core/transaction';
|
|
4
|
+
import { StepStatus } from '../core/status';
|
|
5
|
+
import type { ResolverMap } from './listener-invoker';
|
|
6
|
+
import { ListenerInvoker } from './listener-invoker';
|
|
7
|
+
import { type ProviderResolvers } from './ref-resolver';
|
|
8
|
+
export interface ChunkExecutionContext {
|
|
9
|
+
jobExecutionId: string;
|
|
10
|
+
/** Step execution id, used to scope the chunk-progress checkpoint in the
|
|
11
|
+
* step's ExecutionContext (saved as `{ lastChunkIndex }`). */
|
|
12
|
+
stepExecutionId: string;
|
|
13
|
+
jobRepository: JobRepository;
|
|
14
|
+
transactionManager: TransactionManager;
|
|
15
|
+
listenerInvoker: ListenerInvoker;
|
|
16
|
+
/** Map of resolved reader/processor/writer functions by name. */
|
|
17
|
+
resolvers: Map<string, (...args: unknown[]) => unknown | Promise<unknown>>;
|
|
18
|
+
jobExecutionId2: string;
|
|
19
|
+
/** Optional skip listener resolver map. Keys follow the `on-skip:<kind>:<name>` shape. */
|
|
20
|
+
skipListenerResolvers?: ResolverMap;
|
|
21
|
+
/**
|
|
22
|
+
* Optional map of provider-token id → already-resolved provider instance.
|
|
23
|
+
* Populated by the JobExecutor (or test fixtures) so that
|
|
24
|
+
* `RefKind.ProviderToken` refs on the reader/processor/writer slots can
|
|
25
|
+
* be looked up without coupling the executor to the Nest DI container.
|
|
26
|
+
*/
|
|
27
|
+
providerResolvers?: ProviderResolvers;
|
|
28
|
+
/**
|
|
29
|
+
* When set, the executor skips any chunk whose 0-based index is less
|
|
30
|
+
* than or equal to this value. The reader is still advanced by
|
|
31
|
+
* `chunkSize` calls per skipped chunk (so the data stream position
|
|
32
|
+
* stays correct), but no read/process/write happens and `commitCount`
|
|
33
|
+
* is not incremented. The checkpoint value is loaded from the prior
|
|
34
|
+
* FAILED step execution's ExecutionContext by `JobExecutor`.
|
|
35
|
+
*/
|
|
36
|
+
resumeFromChunkIndex?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Partition ordinal for this chunk execution. Set by the transport
|
|
39
|
+
* (BullMQ / Kafka) when the step declares `partitions.count >= 2`;
|
|
40
|
+
* `undefined` means "non-partitioned" (the 0.1.0 path). The executor
|
|
41
|
+
* uses this together with `partitionCount` and the step's
|
|
42
|
+
* `partitions.range` to bound the read loop to the partition's
|
|
43
|
+
* `[from, to)` range — see `packages/core/src/partition-helpers.ts`
|
|
44
|
+
* and `docs/RELEASE-0.2.0.md §6`.
|
|
45
|
+
*/
|
|
46
|
+
partitionIndex?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Mirror of the step's `partitions.count`. Carried on the context
|
|
49
|
+
* (rather than read from the step) so the executor does not have to
|
|
50
|
+
* reason about which step is being executed when it consults the
|
|
51
|
+
* partition range.
|
|
52
|
+
*/
|
|
53
|
+
partitionCount?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface ChunkExecutionResult {
|
|
56
|
+
status: StepStatus;
|
|
57
|
+
exitCode: string;
|
|
58
|
+
exitMessage: string;
|
|
59
|
+
readCount: number;
|
|
60
|
+
writeCount: number;
|
|
61
|
+
skipCount: number;
|
|
62
|
+
commitCount: number;
|
|
63
|
+
}
|
|
64
|
+
export declare class ChunkStepExecutor {
|
|
65
|
+
execute(step: ChunkStepDefinition, context: ChunkExecutionContext): Promise<ChunkExecutionResult>;
|
|
66
|
+
private updateStreams;
|
|
67
|
+
private closeStreams;
|
|
68
|
+
/**
|
|
69
|
+
* Run a single per-phase operation (one read, one process, or one write) with
|
|
70
|
+
* skip/retry policy consultation. Throws when the operation cannot be
|
|
71
|
+
* skipped (either non-skippable error or skip-limit exceeded) or when
|
|
72
|
+
* retries are exhausted.
|
|
73
|
+
*
|
|
74
|
+
* The contract on budget accounting:
|
|
75
|
+
* - The caller's `skipCount` accumulator is consulted *before* a skip is
|
|
76
|
+
* honored. If the post-skip count would exceed the limit, the error
|
|
77
|
+
* becomes a `SkipLimitExceededError` instead of a skip.
|
|
78
|
+
* - The caller's `onSkip` callback is responsible for incrementing the
|
|
79
|
+
* skipCount; it runs only when a skip is actually honored.
|
|
80
|
+
*/
|
|
81
|
+
private runPhase;
|
|
82
|
+
private resolveReader;
|
|
83
|
+
private resolveProcessor;
|
|
84
|
+
private resolveWriter;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=chunk-step-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-step-executor.d.ts","sourceRoot":"","sources":["../../../src/execution/chunk-step-executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAsC,MAAM,YAAY,CAAC;AAG1F,OAAO,KAAK,EAAoB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB;mEAC+D;IAC/D,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,k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