@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,206 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
StepDefinition,
|
|
3
|
+
FlowTransitionPattern,
|
|
4
|
+
TransitionDefinition,
|
|
5
|
+
ListenerDefinition,
|
|
6
|
+
DeciderDefinition,
|
|
7
|
+
JobExecutionDecider,
|
|
8
|
+
ReusableFlowDefinition,
|
|
9
|
+
} from '../core/ir';
|
|
10
|
+
import type { JobBuilderConfig } from '../compiler/builder-types';
|
|
11
|
+
import { StepBuilder } from './step-builder';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Fluent builder for a single batch job.
|
|
15
|
+
*
|
|
16
|
+
* Responsibilities:
|
|
17
|
+
* - Configure job-level flags (id, restartable, allowDuplicateInstances).
|
|
18
|
+
* - Accumulate step definitions (as literals or via `StepBuilder` callback).
|
|
19
|
+
* - Build a transition graph with a small state machine driven by
|
|
20
|
+
* `.from(stepId).on(status).to(stepId)` / `.end()`.
|
|
21
|
+
* - Collect job-level `ListenerDefinition`s.
|
|
22
|
+
* - Emit a plain-data `JobBuilderConfig` from `.build()`.
|
|
23
|
+
*
|
|
24
|
+
* No execution, no DI, no Nest container — the produced config is
|
|
25
|
+
* consumed downstream by `DefinitionCompiler.compileFromBuilderConfig`.
|
|
26
|
+
*/
|
|
27
|
+
export class JobBuilder {
|
|
28
|
+
// Field names use a `_` prefix to avoid colliding with the same-named
|
|
29
|
+
// setter methods (`restartable` / `allowDuplicateInstances`). With
|
|
30
|
+
// `useDefineForClassFields: false` (project tsconfig), a class field
|
|
31
|
+
// shadows any prototype method of the same name — which would make the
|
|
32
|
+
// fluent setters unreachable on instances.
|
|
33
|
+
private _restartable = false;
|
|
34
|
+
private _allowDuplicateInstances = false;
|
|
35
|
+
private readonly steps: Record<string, StepDefinition> = {};
|
|
36
|
+
private readonly stepOrder: string[] = [];
|
|
37
|
+
private readonly transitions: TransitionDefinition[] = [];
|
|
38
|
+
private readonly deciders: DeciderDefinition[] = [];
|
|
39
|
+
private readonly listeners: ListenerDefinition[] = [];
|
|
40
|
+
private currentTransition: {
|
|
41
|
+
fromStepId?: string;
|
|
42
|
+
onStatus?: FlowTransitionPattern;
|
|
43
|
+
toStepId?: string | null;
|
|
44
|
+
} | null = null;
|
|
45
|
+
|
|
46
|
+
private constructor(private readonly id: string) {}
|
|
47
|
+
|
|
48
|
+
static create(id: string): JobBuilder {
|
|
49
|
+
return new JobBuilder(id);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// --- job-level flags -------------------------------------------------
|
|
53
|
+
|
|
54
|
+
restartable(value: boolean): this {
|
|
55
|
+
this._restartable = value;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
allowDuplicateInstances(value: boolean): this {
|
|
60
|
+
this._allowDuplicateInstances = value;
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// --- steps -----------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Add a step. Accepts either a `StepDefinition` literal or a callback
|
|
68
|
+
* that receives a `StepBuilder` and returns a configured builder.
|
|
69
|
+
*
|
|
70
|
+
* .addStep({ kind: 'tasklet', id: 's1', tasklet, listeners: [] })
|
|
71
|
+
* .addStep((b) => b.tasklet('s2', taskletRef))
|
|
72
|
+
* .addStep((b) => b.chunk('c1', 50, { reader, writer }))
|
|
73
|
+
*/
|
|
74
|
+
addStep(step: StepDefinition | ((b: StepBuilder) => StepBuilder)): this {
|
|
75
|
+
let stepDef: StepDefinition;
|
|
76
|
+
if (typeof step === 'function') {
|
|
77
|
+
const sb = new StepBuilder();
|
|
78
|
+
const result = step(sb);
|
|
79
|
+
stepDef = result.build();
|
|
80
|
+
} else {
|
|
81
|
+
stepDef = step;
|
|
82
|
+
}
|
|
83
|
+
this.steps[stepDef.id] = stepDef;
|
|
84
|
+
this.stepOrder.push(stepDef.id);
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// --- transitions -----------------------------------------------------
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Set the source step of the current transition.
|
|
92
|
+
*
|
|
93
|
+
* If a previous transition was fully specified (from + on + to), it is
|
|
94
|
+
* committed first — so callers can chain `.from('a').on(X).to('b')`
|
|
95
|
+
* and immediately start a new `.from('c')…` chain on the same builder.
|
|
96
|
+
*/
|
|
97
|
+
from(stepId: string): this {
|
|
98
|
+
if (
|
|
99
|
+
this.currentTransition &&
|
|
100
|
+
this.currentTransition.onStatus !== undefined &&
|
|
101
|
+
this.currentTransition.toStepId !== undefined
|
|
102
|
+
) {
|
|
103
|
+
this.commitTransition();
|
|
104
|
+
}
|
|
105
|
+
this.currentTransition = { fromStepId: stepId };
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Set the status that triggers the current transition.
|
|
111
|
+
* Must be called after `.from(stepId)`.
|
|
112
|
+
*/
|
|
113
|
+
on(status: FlowTransitionPattern): this {
|
|
114
|
+
if (!this.currentTransition?.fromStepId) {
|
|
115
|
+
throw new Error('Transition must start with .from(stepId)');
|
|
116
|
+
}
|
|
117
|
+
this.currentTransition.onStatus = status;
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Set the target step of the current transition and commit it.
|
|
123
|
+
*/
|
|
124
|
+
to(stepId: string): this {
|
|
125
|
+
if (!this.currentTransition) {
|
|
126
|
+
throw new Error('Use .from(stepId) before .to(stepId)');
|
|
127
|
+
}
|
|
128
|
+
this.currentTransition.toStepId = stepId;
|
|
129
|
+
this.commitTransition();
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* End the current transition with `toStepId: null` (END of flow) and commit it.
|
|
135
|
+
*/
|
|
136
|
+
end(): this {
|
|
137
|
+
if (!this.currentTransition) {
|
|
138
|
+
throw new Error('Use .from(stepId) before .end()');
|
|
139
|
+
}
|
|
140
|
+
this.currentTransition.toStepId = null;
|
|
141
|
+
this.commitTransition();
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
addDecider(afterStepId: string, decide: JobExecutionDecider): this {
|
|
146
|
+
this.deciders.push({ afterStepId, decide });
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
useFlow(flow: ReusableFlowDefinition): this {
|
|
151
|
+
this.transitions.push(...flow.transitions);
|
|
152
|
+
if (flow.deciders !== undefined) {
|
|
153
|
+
this.deciders.push(...flow.deciders);
|
|
154
|
+
}
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// --- listeners -------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
/** Add a job-level listener definition. */
|
|
161
|
+
addListener(listener: ListenerDefinition): this {
|
|
162
|
+
this.listeners.push(listener);
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// --- build -----------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Produce the `JobBuilderConfig` that `DefinitionCompiler.compileFromBuilderConfig`
|
|
170
|
+
* consumes. Commits any pending in-progress transition.
|
|
171
|
+
*
|
|
172
|
+
* Throws if the job has no steps (the validator would also catch this
|
|
173
|
+
* downstream, but failing here gives a clearer error at build site).
|
|
174
|
+
*/
|
|
175
|
+
build(): JobBuilderConfig {
|
|
176
|
+
if (this.currentTransition) this.commitTransition();
|
|
177
|
+
if (this.stepOrder.length === 0) {
|
|
178
|
+
throw new Error(`JobBuilder: job "${this.id}" has no steps`);
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
id: this.id,
|
|
182
|
+
restartable: this._restartable,
|
|
183
|
+
allowDuplicateInstances: this._allowDuplicateInstances,
|
|
184
|
+
steps: this.stepOrder.map((id) => this.steps[id]!),
|
|
185
|
+
startStepId: this.stepOrder[0]!,
|
|
186
|
+
transitions: this.transitions,
|
|
187
|
+
deciders: this.deciders,
|
|
188
|
+
listeners: this.listeners,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// --- internal --------------------------------------------------------
|
|
193
|
+
|
|
194
|
+
private commitTransition(): void {
|
|
195
|
+
if (!this.currentTransition) return;
|
|
196
|
+
const t = this.currentTransition;
|
|
197
|
+
if (t.fromStepId && t.onStatus !== undefined && t.toStepId !== undefined) {
|
|
198
|
+
this.transitions.push({
|
|
199
|
+
fromStepId: t.fromStepId,
|
|
200
|
+
onStatus: t.onStatus,
|
|
201
|
+
toStepId: t.toStepId,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
this.currentTransition = null;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
StepDefinition,
|
|
3
|
+
ChunkStepDefinition,
|
|
4
|
+
TaskletStepDefinition,
|
|
5
|
+
ReaderRef,
|
|
6
|
+
ProcessorRef,
|
|
7
|
+
WriterRef,
|
|
8
|
+
TaskletRef,
|
|
9
|
+
ListenerRef,
|
|
10
|
+
ItemListenerRef,
|
|
11
|
+
SkipPolicyConfig,
|
|
12
|
+
RetryPolicyConfig,
|
|
13
|
+
ListenerDefinition,
|
|
14
|
+
ListenerKind,
|
|
15
|
+
ListenerPhase,
|
|
16
|
+
} from '../core/ir';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Fluent builder for a single step (`chunk` or `tasklet`).
|
|
20
|
+
*
|
|
21
|
+
* Typical usage via `JobBuilder.addStep` callback:
|
|
22
|
+
*
|
|
23
|
+
* .addStep((b) => b
|
|
24
|
+
* .chunk('read-csv', 100, {
|
|
25
|
+
* reader: { kind: BuilderLambda, fn: readCsv },
|
|
26
|
+
* processor: { kind: BuilderLambda, fn: transform },
|
|
27
|
+
* writer: { kind: BuilderLambda, fn: writeRows },
|
|
28
|
+
* }))
|
|
29
|
+
*
|
|
30
|
+
* .addStep((b) => b
|
|
31
|
+
* .tasklet('cleanup', { kind: BuilderLambda, fn: cleanup }))
|
|
32
|
+
*
|
|
33
|
+
* The builder is single-use: call `.build()` once to produce the
|
|
34
|
+
* `StepDefinition` IR.
|
|
35
|
+
*/
|
|
36
|
+
export class StepBuilder {
|
|
37
|
+
// Field names use a `_` prefix to avoid colliding with the same-named
|
|
38
|
+
// setter methods (`reader` / `processor` / `writer` / `tasklet` /
|
|
39
|
+
// `skipPolicy` / `retryPolicy`). With `useDefineForClassFields: false`
|
|
40
|
+
// (project tsconfig), a class field shadows any prototype method of
|
|
41
|
+
// the same name — which would make the fluent setters unreachable and
|
|
42
|
+
// (more subtly) make `if (this.tasklet)` in `build()` accidentally
|
|
43
|
+
// find the method via the prototype chain.
|
|
44
|
+
private _chunkSize?: number;
|
|
45
|
+
private _reader?: ReaderRef;
|
|
46
|
+
private _processor?: ProcessorRef;
|
|
47
|
+
private _writer?: WriterRef;
|
|
48
|
+
private _tasklet?: TaskletRef;
|
|
49
|
+
private _id?: string;
|
|
50
|
+
private _skipPolicy?: SkipPolicyConfig;
|
|
51
|
+
private _retryPolicy?: RetryPolicyConfig;
|
|
52
|
+
private readonly itemListeners: ItemListenerRef[] = [];
|
|
53
|
+
private readonly listenerDefs: ListenerDefinition[] = [];
|
|
54
|
+
|
|
55
|
+
// --- step-kind entry points ------------------------------------------
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Start a chunk step. Sets the step id and chunk size; optionally
|
|
59
|
+
* accepts reader/processor/writer/policies in a single call.
|
|
60
|
+
*
|
|
61
|
+
* .chunk('s1', 100, { reader, processor, writer })
|
|
62
|
+
* .chunk('s2', 50, { reader, writer, skipPolicy })
|
|
63
|
+
*
|
|
64
|
+
* Throws if `size` is not a positive integer.
|
|
65
|
+
*/
|
|
66
|
+
chunk(
|
|
67
|
+
id: string,
|
|
68
|
+
size: number,
|
|
69
|
+
config?: {
|
|
70
|
+
reader: ReaderRef;
|
|
71
|
+
processor?: ProcessorRef;
|
|
72
|
+
writer: WriterRef;
|
|
73
|
+
skipPolicy?: SkipPolicyConfig;
|
|
74
|
+
retryPolicy?: RetryPolicyConfig;
|
|
75
|
+
},
|
|
76
|
+
): this {
|
|
77
|
+
if (!Number.isInteger(size) || size <= 0) {
|
|
78
|
+
throw new Error('chunkSize must be a positive integer');
|
|
79
|
+
}
|
|
80
|
+
this._id = id;
|
|
81
|
+
this._chunkSize = size;
|
|
82
|
+
if (config) {
|
|
83
|
+
this._reader = config.reader;
|
|
84
|
+
this._processor = config.processor;
|
|
85
|
+
this._writer = config.writer;
|
|
86
|
+
this._skipPolicy = config.skipPolicy;
|
|
87
|
+
this._retryPolicy = config.retryPolicy;
|
|
88
|
+
}
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Start a tasklet step. Sets the step id and the tasklet ref.
|
|
94
|
+
*
|
|
95
|
+
* .tasklet('cleanup', { kind: BuilderLambda, fn: cleanup })
|
|
96
|
+
*/
|
|
97
|
+
tasklet(id: string, ref: TaskletRef): this {
|
|
98
|
+
this._id = id;
|
|
99
|
+
this._tasklet = ref;
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// --- fine-grained setters (used after `.chunk(id, size)`) -----------
|
|
104
|
+
|
|
105
|
+
reader(ref: ReaderRef): this {
|
|
106
|
+
this._reader = ref;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
processor(ref: ProcessorRef): this {
|
|
111
|
+
this._processor = ref;
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
writer(ref: WriterRef): this {
|
|
116
|
+
this._writer = ref;
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
skipPolicy(p: SkipPolicyConfig): this {
|
|
121
|
+
this._skipPolicy = p;
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
retryPolicy(p: RetryPolicyConfig): this {
|
|
126
|
+
this._retryPolicy = p;
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Attach an item-level listener ref to this step. Listener metadata
|
|
132
|
+
* is also recorded internally so it can be re-emitted via `.build()`.
|
|
133
|
+
*
|
|
134
|
+
* (The step IR's `listeners: ItemListenerRef[]` field is the source of
|
|
135
|
+
* truth at runtime; the `ListenerDefinition[]` aggregate lives on the
|
|
136
|
+
* job. We keep both in sync here for downstream consumer convenience.)
|
|
137
|
+
*/
|
|
138
|
+
addListener(
|
|
139
|
+
ref: ListenerRef,
|
|
140
|
+
kind: ListenerKind,
|
|
141
|
+
phase: ListenerPhase,
|
|
142
|
+
nonCritical?: boolean,
|
|
143
|
+
): this {
|
|
144
|
+
this.itemListeners.push(ref);
|
|
145
|
+
this.listenerDefs.push({
|
|
146
|
+
ref,
|
|
147
|
+
kind,
|
|
148
|
+
phase,
|
|
149
|
+
...(nonCritical !== undefined ? { nonCritical } : {}),
|
|
150
|
+
});
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// --- build -----------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Produce the `StepDefinition` IR. Throws if the step is missing an
|
|
158
|
+
* id, or is neither a configured tasklet nor a configured chunk
|
|
159
|
+
* (chunk requires both `reader` and `writer`).
|
|
160
|
+
*/
|
|
161
|
+
build(): StepDefinition {
|
|
162
|
+
if (!this._id) {
|
|
163
|
+
throw new Error('Step must have an id (call .chunk() or .tasklet() first)');
|
|
164
|
+
}
|
|
165
|
+
if (this._tasklet) {
|
|
166
|
+
const def: TaskletStepDefinition = {
|
|
167
|
+
kind: 'tasklet',
|
|
168
|
+
id: this._id,
|
|
169
|
+
tasklet: this._tasklet,
|
|
170
|
+
listeners: this.itemListeners,
|
|
171
|
+
};
|
|
172
|
+
return def;
|
|
173
|
+
}
|
|
174
|
+
if (this._chunkSize !== undefined && this._reader && this._writer) {
|
|
175
|
+
const def: ChunkStepDefinition = {
|
|
176
|
+
kind: 'chunk',
|
|
177
|
+
id: this._id,
|
|
178
|
+
chunkSize: this._chunkSize,
|
|
179
|
+
reader: this._reader,
|
|
180
|
+
writer: this._writer,
|
|
181
|
+
listeners: this.itemListeners,
|
|
182
|
+
...(this._processor ? { processor: this._processor } : {}),
|
|
183
|
+
...(this._skipPolicy ? { skipPolicy: this._skipPolicy } : {}),
|
|
184
|
+
...(this._retryPolicy ? { retryPolicy: this._retryPolicy } : {}),
|
|
185
|
+
};
|
|
186
|
+
return def;
|
|
187
|
+
}
|
|
188
|
+
throw new Error('Step must be either tasklet or chunk with reader+writer');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
JobDefinition,
|
|
3
|
+
StepDefinition,
|
|
4
|
+
ListenerDefinition,
|
|
5
|
+
TransitionDefinition,
|
|
6
|
+
DeciderDefinition,
|
|
7
|
+
} from '../core/ir';
|
|
8
|
+
import type { FlowExecutionStatus } from '../core/status';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Configuration shape for the Builder API. The builder returns this from `build()`.
|
|
12
|
+
* `DefinitionCompiler.compileFromBuilderConfig` consumes it and produces a
|
|
13
|
+
* fully-validated `JobDefinition` IR.
|
|
14
|
+
*
|
|
15
|
+
* This is a *plain-data* shape — no methods, no Nest DI references — so a builder
|
|
16
|
+
* can be assembled in unit tests without booting a Nest container.
|
|
17
|
+
*/
|
|
18
|
+
export interface JobBuilderConfig {
|
|
19
|
+
id: string;
|
|
20
|
+
restartable: boolean;
|
|
21
|
+
allowDuplicateInstances: boolean;
|
|
22
|
+
steps: StepDefinition[];
|
|
23
|
+
startStepId: string;
|
|
24
|
+
transitions: TransitionDefinition[];
|
|
25
|
+
deciders?: DeciderDefinition[];
|
|
26
|
+
listeners: ListenerDefinition[];
|
|
27
|
+
}
|