@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,20 @@
|
|
|
1
|
+
import type { JobExecution } from '../repository/types';
|
|
2
|
+
import type { StepStatus } from '../status';
|
|
3
|
+
export interface JobExecutionDeciderContext {
|
|
4
|
+
readonly jobExecution: JobExecution;
|
|
5
|
+
readonly stepId: string;
|
|
6
|
+
readonly stepExecutionId: string;
|
|
7
|
+
readonly stepStatus: StepStatus;
|
|
8
|
+
readonly exitCode: string;
|
|
9
|
+
readonly exitMessage: string;
|
|
10
|
+
}
|
|
11
|
+
export type JobExecutionDecider = (context: JobExecutionDeciderContext) => string | Promise<string>;
|
|
12
|
+
export interface DeciderDefinition {
|
|
13
|
+
readonly afterStepId: string;
|
|
14
|
+
readonly decide: JobExecutionDecider;
|
|
15
|
+
}
|
|
16
|
+
export interface ReusableFlowDefinition {
|
|
17
|
+
readonly transitions: readonly import('./transition-definition').TransitionDefinition[];
|
|
18
|
+
readonly deciders?: readonly DeciderDefinition[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=decider-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decider-definition.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/decider-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,0BAA0B,KAChC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,SAAS,OAAO,yBAAyB,EAAE,oBAAoB,EAAE,CAAC;IACxF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/decider-definition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './job-definition';
|
|
2
|
+
export * from './step-definition';
|
|
3
|
+
export * from './transition-definition';
|
|
4
|
+
export * from './decider-definition';
|
|
5
|
+
export * from './listener-definition';
|
|
6
|
+
export * from './policy-config';
|
|
7
|
+
export * from './refs';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./job-definition"), exports);
|
|
6
|
+
_export_star(require("./step-definition"), exports);
|
|
7
|
+
_export_star(require("./transition-definition"), exports);
|
|
8
|
+
_export_star(require("./decider-definition"), exports);
|
|
9
|
+
_export_star(require("./listener-definition"), exports);
|
|
10
|
+
_export_star(require("./policy-config"), exports);
|
|
11
|
+
_export_star(require("./refs"), exports);
|
|
12
|
+
function _export_star(from, to) {
|
|
13
|
+
Object.keys(from).forEach(function(k) {
|
|
14
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
15
|
+
Object.defineProperty(to, k, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function() {
|
|
18
|
+
return from[k];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return from;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/index.ts"],"sourcesContent":["export * from './job-definition';\nexport * from './step-definition';\nexport * from './transition-definition';\nexport * from './decider-definition';\nexport * from './listener-definition';\nexport * from './policy-config';\nexport * from './refs';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StepDefinition } from './step-definition';
|
|
2
|
+
import type { TransitionDefinition } from './transition-definition';
|
|
3
|
+
import type { ListenerDefinition } from './listener-definition';
|
|
4
|
+
import type { DeciderDefinition } from './decider-definition';
|
|
5
|
+
export interface JobDefinition {
|
|
6
|
+
id: string;
|
|
7
|
+
steps: Record<string, StepDefinition>;
|
|
8
|
+
startStepId: string;
|
|
9
|
+
transitions: TransitionDefinition[];
|
|
10
|
+
deciders?: DeciderDefinition[];
|
|
11
|
+
listeners: ListenerDefinition[];
|
|
12
|
+
restartable: boolean;
|
|
13
|
+
allowDuplicateInstances: boolean;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=job-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-definition.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/job-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,oBAAoB,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC/B,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,uBAAuB,EAAE,OAAO,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/job-definition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ListenerRef } from './refs';
|
|
2
|
+
export type ListenerKind = 'job' | 'step' | 'chunk' | 'item-read' | 'item-process' | 'item-write' | 'skip' | 'transition';
|
|
3
|
+
export type ListenerPhase = 'before' | 'after' | 'on-error';
|
|
4
|
+
export interface ListenerDefinition {
|
|
5
|
+
kind: ListenerKind;
|
|
6
|
+
ref: ListenerRef;
|
|
7
|
+
phase: ListenerPhase;
|
|
8
|
+
nonCritical?: boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=listener-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listener-definition.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/listener-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C,MAAM,MAAM,YAAY,GACpB,KAAK,GACL,MAAM,GACN,OAAO,GACP,WAAW,GACX,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,CAAC;AACjB,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,WAAW,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/listener-definition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ErrorClass = new (...args: any[]) => Error;
|
|
2
|
+
export type ErrorPredicate = (err: unknown) => boolean;
|
|
3
|
+
export type Skippable = ErrorClass | ErrorPredicate;
|
|
4
|
+
export interface SkipPolicyConfig {
|
|
5
|
+
limit: number;
|
|
6
|
+
skippable: Skippable[];
|
|
7
|
+
}
|
|
8
|
+
export type BackoffConfig = {
|
|
9
|
+
type: 'fixed';
|
|
10
|
+
ms: number;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'exponential';
|
|
13
|
+
initialMs: number;
|
|
14
|
+
maxMs?: number;
|
|
15
|
+
factor?: number;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'none';
|
|
18
|
+
};
|
|
19
|
+
export interface RetryPolicyConfig {
|
|
20
|
+
limit: number;
|
|
21
|
+
retryable: Skippable[];
|
|
22
|
+
backoff: BackoffConfig;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=policy-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-config.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/policy-config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;AACvD,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,cAAc,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,EAAE,CAAC;CACxB;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,OAAO,EAAE,aAAa,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/policy-config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare enum RefKind {
|
|
2
|
+
ProviderToken = "provider-token",
|
|
3
|
+
BuilderLambda = "builder-lambda",
|
|
4
|
+
Method = "method"
|
|
5
|
+
}
|
|
6
|
+
export interface ReaderRef {
|
|
7
|
+
kind: RefKind;
|
|
8
|
+
token?: string;
|
|
9
|
+
fn?: (...args: any[]) => unknown;
|
|
10
|
+
classToken?: string;
|
|
11
|
+
methodName?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ProcessorRef {
|
|
14
|
+
kind: RefKind;
|
|
15
|
+
token?: string;
|
|
16
|
+
fn?: (...args: any[]) => unknown;
|
|
17
|
+
classToken?: string;
|
|
18
|
+
methodName?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface WriterRef {
|
|
21
|
+
kind: RefKind;
|
|
22
|
+
token?: string;
|
|
23
|
+
fn?: (...args: any[]) => unknown;
|
|
24
|
+
classToken?: string;
|
|
25
|
+
methodName?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TaskletRef {
|
|
28
|
+
kind: RefKind;
|
|
29
|
+
token?: string;
|
|
30
|
+
fn?: (...args: any[]) => unknown;
|
|
31
|
+
classToken?: string;
|
|
32
|
+
methodName?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ListenerRef {
|
|
35
|
+
kind: RefKind;
|
|
36
|
+
token?: string;
|
|
37
|
+
fn?: (...args: any[]) => unknown;
|
|
38
|
+
classToken?: string;
|
|
39
|
+
methodName?: string;
|
|
40
|
+
}
|
|
41
|
+
export type ItemListenerRef = ListenerRef;
|
|
42
|
+
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/refs.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,aAAa,mBAAmB;IAChC,aAAa,mBAAmB;IAChC,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "RefKind", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return RefKind;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var RefKind = /*#__PURE__*/ function(RefKind) {
|
|
12
|
+
RefKind["ProviderToken"] = "provider-token";
|
|
13
|
+
RefKind["BuilderLambda"] = "builder-lambda";
|
|
14
|
+
RefKind["Method"] = "method";
|
|
15
|
+
return RefKind;
|
|
16
|
+
}({});
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/refs.ts"],"sourcesContent":["export enum RefKind {\n ProviderToken = 'provider-token',\n BuilderLambda = 'builder-lambda',\n Method = 'method',\n}\n\nexport interface ReaderRef {\n kind: RefKind;\n token?: string;\n fn?: (...args: any[]) => unknown;\n classToken?: string;\n methodName?: string;\n}\nexport interface ProcessorRef {\n kind: RefKind;\n token?: string;\n fn?: (...args: any[]) => unknown;\n classToken?: string;\n methodName?: string;\n}\nexport interface WriterRef {\n kind: RefKind;\n token?: string;\n fn?: (...args: any[]) => unknown;\n classToken?: string;\n methodName?: string;\n}\nexport interface TaskletRef {\n kind: RefKind;\n token?: string;\n fn?: (...args: any[]) => unknown;\n classToken?: string;\n methodName?: string;\n}\nexport interface ListenerRef {\n kind: RefKind;\n token?: string;\n fn?: (...args: any[]) => unknown;\n classToken?: string;\n methodName?: string;\n}\nexport type ItemListenerRef = ListenerRef;\n"],"names":["RefKind"],"mappings":";;;;+BAAYA;;;eAAAA;;;AAAL,IAAA,AAAKA,iCAAAA;;;;WAAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReaderRef, ProcessorRef, WriterRef, TaskletRef, ItemListenerRef } from './refs';
|
|
2
|
+
import type { SkipPolicyConfig, RetryPolicyConfig } from './policy-config';
|
|
3
|
+
export type StepDefinition = ChunkStepDefinition | TaskletStepDefinition;
|
|
4
|
+
/**
|
|
5
|
+
* v1 partition configuration for a chunk step. Pinned by
|
|
6
|
+
* `docs/RELEASE-0.2.0.md §6.1` and the T-AC-3 acceptance test.
|
|
7
|
+
*
|
|
8
|
+
* - `count` is the number of partitions. `count === 1` (or the
|
|
9
|
+
* field being absent) preserves the 0.1.0 "one job per step"
|
|
10
|
+
* behaviour. `count >= 2` activates the partition-aware runtime:
|
|
11
|
+
* the transport enqueues `count` jobs, each with a distinct
|
|
12
|
+
* `partitionIndex`, and the worker body offsets the chunk loop
|
|
13
|
+
* by the partition's range.
|
|
14
|
+
* - `range` is an optional half-open `[from, to]` resolver. When
|
|
15
|
+
* omitted, the runtime treats each partition as "reads from the
|
|
16
|
+
* start" (the host's reader is responsible for not
|
|
17
|
+
* double-processing). When provided, the chunk executor bounds
|
|
18
|
+
* its read loop to `to - from` items.
|
|
19
|
+
*/
|
|
20
|
+
export interface ChunkPartitionConfig {
|
|
21
|
+
/** Number of partitions; must be a positive integer. */
|
|
22
|
+
readonly count: number;
|
|
23
|
+
/**
|
|
24
|
+
* Optional partition-range resolver. Given the partition index
|
|
25
|
+
* `i` and the total `n`, return a half-open `[from, to]` range
|
|
26
|
+
* that the partition consumes. The default behaviour (when
|
|
27
|
+
* omitted) is to read until EOF on every partition; hosts that
|
|
28
|
+
* want an even split should provide a closure that captures the
|
|
29
|
+
* total item count (the runtime has no generic "even split"
|
|
30
|
+
* because the total is host-known).
|
|
31
|
+
*/
|
|
32
|
+
readonly range?: (i: number, n: number) => readonly [from: number, to: number];
|
|
33
|
+
}
|
|
34
|
+
export interface ChunkStepDefinition {
|
|
35
|
+
kind: 'chunk';
|
|
36
|
+
id: string;
|
|
37
|
+
chunkSize: number;
|
|
38
|
+
reader: ReaderRef;
|
|
39
|
+
processor?: ProcessorRef;
|
|
40
|
+
writer: WriterRef;
|
|
41
|
+
skipPolicy?: SkipPolicyConfig;
|
|
42
|
+
retryPolicy?: RetryPolicyConfig;
|
|
43
|
+
listeners: ItemListenerRef[];
|
|
44
|
+
/**
|
|
45
|
+
* Optional partition configuration. When absent, the step
|
|
46
|
+
* runs as a single non-partitioned unit (the 0.1.0 behaviour).
|
|
47
|
+
* When present with `count >= 2`, the transport activates
|
|
48
|
+
* partition orchestration — see `docs/RELEASE-0.2.0.md §6` and
|
|
49
|
+
* `packages/core/src/partition-helpers.ts` for the contract.
|
|
50
|
+
*/
|
|
51
|
+
readonly partitions?: ChunkPartitionConfig;
|
|
52
|
+
}
|
|
53
|
+
export interface TaskletStepDefinition {
|
|
54
|
+
kind: 'tasklet';
|
|
55
|
+
id: string;
|
|
56
|
+
tasklet: TaskletRef;
|
|
57
|
+
listeners: ItemListenerRef[];
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=step-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-definition.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/step-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9F,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;CAChF;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC;CAC5C;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/step-definition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FlowExecutionStatus } from '../status';
|
|
2
|
+
export type FlowTransitionPattern = FlowExecutionStatus | string;
|
|
3
|
+
export interface TransitionDefinition {
|
|
4
|
+
fromStepId: string;
|
|
5
|
+
onStatus: FlowTransitionPattern;
|
|
6
|
+
toStepId: string | null;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=transition-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition-definition.d.ts","sourceRoot":"","sources":["../../../../src/core/ir/transition-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/ir/transition-definition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/item/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./interfaces"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/item/index.ts"],"sourcesContent":["export * from './interfaces';\n"],"names":[],"mappings":";;;;qBAAc"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ExecutionContext } from '../repository/types';
|
|
2
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
3
|
+
/**
|
|
4
|
+
* Reads one item at a time. Returns `null` to signal EOF.
|
|
5
|
+
* For async iteration, use `AsyncIterable.read()` (not yet supported in MVP).
|
|
6
|
+
*/
|
|
7
|
+
export interface ItemReader<T = unknown> {
|
|
8
|
+
read(): Promise<T | null>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Processes one item. Returns `null`/`undefined` to filter the item out of the chunk.
|
|
12
|
+
* Throws to indicate the item should be skipped (via SkipPolicy) or retried (via RetryPolicy).
|
|
13
|
+
*/
|
|
14
|
+
export interface ItemProcessor<I = unknown, O = unknown> {
|
|
15
|
+
process(item: I): Promise<O | null | undefined>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Writes a batch of items. Called once per chunk (after processing).
|
|
19
|
+
*
|
|
20
|
+
* May return a `WriterResult` to report partial success — e.g. a
|
|
21
|
+
* `ProductWriter` that drops duplicate-SKU rows internally. Returning
|
|
22
|
+
* `void` (or `undefined`) means the writer assumed all `items` were
|
|
23
|
+
* persisted; the chunk executor then uses `items.length` as the write
|
|
24
|
+
* count and assumes no per-item skips.
|
|
25
|
+
*/
|
|
26
|
+
export interface ItemWriter<T = unknown> {
|
|
27
|
+
write(items: T[]): Promise<WriterResult | void>;
|
|
28
|
+
}
|
|
29
|
+
export interface WriterResult {
|
|
30
|
+
written: number;
|
|
31
|
+
skipped: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Optional lifecycle contract for stateful chunk components.
|
|
35
|
+
*
|
|
36
|
+
* The chunk executor passes the step-scoped ExecutionContext to
|
|
37
|
+
* `open()` before the first read, calls `update()` after every committed
|
|
38
|
+
* chunk, persists the returned or mutated context, and calls `close()`
|
|
39
|
+
* before the step returns. Errors from any hook fail the step.
|
|
40
|
+
*/
|
|
41
|
+
export interface ItemStream {
|
|
42
|
+
open(context: ExecutionContext): MaybePromise<void>;
|
|
43
|
+
update(context: ExecutionContext): MaybePromise<ExecutionContext | void>;
|
|
44
|
+
close(): MaybePromise<void>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Tasklet context: lets the tasklet access the execution context for
|
|
48
|
+
* cross-chunk state.
|
|
49
|
+
*/
|
|
50
|
+
export interface TaskletContext {
|
|
51
|
+
readonly jobExecutionId: string;
|
|
52
|
+
readonly stepExecutionId: string;
|
|
53
|
+
getExecutionContext(): Promise<ExecutionContext>;
|
|
54
|
+
saveExecutionContext(ctx: ExecutionContext): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Tasklet: a single-execution step (no chunk loop).
|
|
58
|
+
* Return value is informational; throws signal failure.
|
|
59
|
+
*/
|
|
60
|
+
export interface Tasklet {
|
|
61
|
+
execute(ctx: TaskletContext): Promise<unknown>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/core/item/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,qBAAqB,CAAC;AAE5E,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACrD,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACjD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACzE,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjD,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/item/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/repository/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./types"), exports);
|
|
6
|
+
_export_star(require("./job-repository"), exports);
|
|
7
|
+
function _export_star(from, to) {
|
|
8
|
+
Object.keys(from).forEach(function(k) {
|
|
9
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
+
Object.defineProperty(to, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return from[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return from;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/repository/index.ts"],"sourcesContent":["export * from './types';\nexport * from './job-repository';\n"],"names":[],"mappings":";;;;qBAAc;qBACA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { JobInstance, JobExecution, JobExecutionPatch, JobParameters, StepExecution, StepExecutionPatch, ExecutionContext, ExecutionScope, JobInstanceFilter, JobExecutionFilter } from './types';
|
|
2
|
+
export interface IJobRepository {
|
|
3
|
+
getOrCreateJobInstance(name: string, jobKey: string): Promise<JobInstance>;
|
|
4
|
+
createJobExecution(jobInstanceId: string, params: JobParameters): Promise<JobExecution>;
|
|
5
|
+
/**
|
|
6
|
+
* Atomically: ensure a `JobInstance` for `(name, jobKey)` exists, lock
|
|
7
|
+
* the instance row (skipping if another concurrent launch already
|
|
8
|
+
* holds the lock), verify no running execution, and create a new
|
|
9
|
+
* execution in STARTING state. The PostgreSQL implementation uses
|
|
10
|
+
* `INSERT ... ON CONFLICT DO NOTHING` + `SELECT ... FOR UPDATE SKIP
|
|
11
|
+
* LOCKED` inside a single transaction. The in-memory implementation
|
|
12
|
+
* uses an in-process mutex (Node is single-threaded so the lock is
|
|
13
|
+
* effectively a serialization point rather than a true blocker).
|
|
14
|
+
*
|
|
15
|
+
* Throws `JobExecutionAlreadyRunningError` if another launch is in
|
|
16
|
+
* progress (FOR UPDATE returned no row) or if an execution is already
|
|
17
|
+
* STARTING/STARTED for this instance.
|
|
18
|
+
*/
|
|
19
|
+
createExecutionAtomic(name: string, jobKey: string, params: JobParameters): Promise<JobExecution>;
|
|
20
|
+
updateJobExecution(executionId: string, patch: JobExecutionPatch): Promise<void>;
|
|
21
|
+
getJobExecution(executionId: string): Promise<JobExecution | null>;
|
|
22
|
+
getJobInstance(jobInstanceId: string): Promise<JobInstance | null>;
|
|
23
|
+
findJobInstances(filter?: JobInstanceFilter): Promise<JobInstance[]>;
|
|
24
|
+
findJobExecutions(filter?: JobExecutionFilter): Promise<JobExecution[]>;
|
|
25
|
+
getRunningJobExecution(jobInstanceId: string): Promise<JobExecution | null>;
|
|
26
|
+
createStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution>;
|
|
27
|
+
updateStepExecution(stepExecutionId: string, patch: StepExecutionPatch): Promise<void>;
|
|
28
|
+
getStepExecution(stepExecutionId: string): Promise<StepExecution | null>;
|
|
29
|
+
findStepExecutions(jobExecutionId: string): Promise<StepExecution[]>;
|
|
30
|
+
getExecutionContext(scope: ExecutionScope): Promise<ExecutionContext>;
|
|
31
|
+
saveExecutionContext(scope: ExecutionScope, ctx: ExecutionContext, version?: number): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Find the most recently created StepExecution for a given
|
|
34
|
+
* (jobExecutionId, stepName) pair regardless of status. Returns `null`
|
|
35
|
+
* if no matching step execution exists. Used by the restart path to
|
|
36
|
+
* locate the prior (typically FAILED) step execution so its execution
|
|
37
|
+
* context — which holds the last-committed-chunk checkpoint — can be
|
|
38
|
+
* loaded.
|
|
39
|
+
*/
|
|
40
|
+
findLatestStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution | null>;
|
|
41
|
+
}
|
|
42
|
+
export declare abstract class JobRepository implements IJobRepository {
|
|
43
|
+
abstract getOrCreateJobInstance(name: string, jobKey: string): Promise<JobInstance>;
|
|
44
|
+
abstract createJobExecution(jobInstanceId: string, params: JobParameters): Promise<JobExecution>;
|
|
45
|
+
abstract createExecutionAtomic(name: string, jobKey: string, params: JobParameters): Promise<JobExecution>;
|
|
46
|
+
abstract updateJobExecution(executionId: string, patch: JobExecutionPatch): Promise<void>;
|
|
47
|
+
abstract getJobExecution(executionId: string): Promise<JobExecution | null>;
|
|
48
|
+
getJobInstance(_jobInstanceId: string): Promise<JobInstance | null>;
|
|
49
|
+
findJobInstances(_filter?: JobInstanceFilter): Promise<JobInstance[]>;
|
|
50
|
+
findJobExecutions(_filter?: JobExecutionFilter): Promise<JobExecution[]>;
|
|
51
|
+
abstract getRunningJobExecution(jobInstanceId: string): Promise<JobExecution | null>;
|
|
52
|
+
abstract createStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution>;
|
|
53
|
+
abstract updateStepExecution(stepExecutionId: string, patch: StepExecutionPatch): Promise<void>;
|
|
54
|
+
abstract getStepExecution(stepExecutionId: string): Promise<StepExecution | null>;
|
|
55
|
+
findStepExecutions(_jobExecutionId: string): Promise<StepExecution[]>;
|
|
56
|
+
abstract getExecutionContext(scope: ExecutionScope): Promise<ExecutionContext>;
|
|
57
|
+
abstract saveExecutionContext(scope: ExecutionScope, ctx: ExecutionContext, version?: number): Promise<void>;
|
|
58
|
+
abstract findLatestStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution | null>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=job-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-repository.d.ts","sourceRoot":"","sources":["../../../../src/core/repository/job-repository.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "JobRepository", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return JobRepository;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _errors = require("../errors");
|
|
12
|
+
let JobRepository = class JobRepository {
|
|
13
|
+
getJobInstance(_jobInstanceId) {
|
|
14
|
+
throw new _errors.UnsupportedJobRepositoryOperationError('getJobInstance');
|
|
15
|
+
}
|
|
16
|
+
findJobInstances(_filter = {}) {
|
|
17
|
+
throw new _errors.UnsupportedJobRepositoryOperationError('findJobInstances');
|
|
18
|
+
}
|
|
19
|
+
findJobExecutions(_filter = {}) {
|
|
20
|
+
throw new _errors.UnsupportedJobRepositoryOperationError('findJobExecutions');
|
|
21
|
+
}
|
|
22
|
+
findStepExecutions(_jobExecutionId) {
|
|
23
|
+
throw new _errors.UnsupportedJobRepositoryOperationError('findStepExecutions');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=job-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/repository/job-repository.ts"],"sourcesContent":["import type {\n JobInstance,\n JobExecution,\n JobExecutionPatch,\n JobParameters,\n StepExecution,\n StepExecutionPatch,\n ExecutionContext,\n ExecutionScope,\n JobInstanceFilter,\n JobExecutionFilter,\n} from './types';\nimport { UnsupportedJobRepositoryOperationError } from '../errors';\n\nexport interface IJobRepository {\n getOrCreateJobInstance(name: string, jobKey: string): Promise<JobInstance>;\n createJobExecution(jobInstanceId: string, params: JobParameters): Promise<JobExecution>;\n /**\n * Atomically: ensure a `JobInstance` for `(name, jobKey)` exists, lock\n * the instance row (skipping if another concurrent launch already\n * holds the lock), verify no running execution, and create a new\n * execution in STARTING state. The PostgreSQL implementation uses\n * `INSERT ... ON CONFLICT DO NOTHING` + `SELECT ... FOR UPDATE SKIP\n * LOCKED` inside a single transaction. The in-memory implementation\n * uses an in-process mutex (Node is single-threaded so the lock is\n * effectively a serialization point rather than a true blocker).\n *\n * Throws `JobExecutionAlreadyRunningError` if another launch is in\n * progress (FOR UPDATE returned no row) or if an execution is already\n * STARTING/STARTED for this instance.\n */\n createExecutionAtomic(\n name: string,\n jobKey: string,\n params: JobParameters,\n ): Promise<JobExecution>;\n updateJobExecution(executionId: string, patch: JobExecutionPatch): Promise<void>;\n getJobExecution(executionId: string): Promise<JobExecution | null>;\n getJobInstance(jobInstanceId: string): Promise<JobInstance | null>;\n findJobInstances(filter?: JobInstanceFilter): Promise<JobInstance[]>;\n findJobExecutions(filter?: JobExecutionFilter): Promise<JobExecution[]>;\n getRunningJobExecution(jobInstanceId: string): Promise<JobExecution | null>;\n createStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution>;\n updateStepExecution(stepExecutionId: string, patch: StepExecutionPatch): Promise<void>;\n getStepExecution(stepExecutionId: string): Promise<StepExecution | null>;\n findStepExecutions(jobExecutionId: string): Promise<StepExecution[]>;\n getExecutionContext(scope: ExecutionScope): Promise<ExecutionContext>;\n saveExecutionContext(\n scope: ExecutionScope,\n ctx: ExecutionContext,\n version?: number,\n ): Promise<void>;\n /**\n * Find the most recently created StepExecution for a given\n * (jobExecutionId, stepName) pair regardless of status. Returns `null`\n * if no matching step execution exists. Used by the restart path to\n * locate the prior (typically FAILED) step execution so its execution\n * context — which holds the last-committed-chunk checkpoint — can be\n * loaded.\n */\n findLatestStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution | null>;\n}\n\nexport abstract class JobRepository implements IJobRepository {\n abstract getOrCreateJobInstance(name: string, jobKey: string): Promise<JobInstance>;\n abstract createJobExecution(jobInstanceId: string, params: JobParameters): Promise<JobExecution>;\n abstract createExecutionAtomic(\n name: string,\n jobKey: string,\n params: JobParameters,\n ): Promise<JobExecution>;\n abstract updateJobExecution(executionId: string, patch: JobExecutionPatch): Promise<void>;\n abstract getJobExecution(executionId: string): Promise<JobExecution | null>;\n getJobInstance(_jobInstanceId: string): Promise<JobInstance | null> {\n throw new UnsupportedJobRepositoryOperationError('getJobInstance');\n }\n findJobInstances(_filter: JobInstanceFilter = {}): Promise<JobInstance[]> {\n throw new UnsupportedJobRepositoryOperationError('findJobInstances');\n }\n findJobExecutions(_filter: JobExecutionFilter = {}): Promise<JobExecution[]> {\n throw new UnsupportedJobRepositoryOperationError('findJobExecutions');\n }\n abstract getRunningJobExecution(jobInstanceId: string): Promise<JobExecution | null>;\n abstract createStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution>;\n abstract updateStepExecution(stepExecutionId: string, patch: StepExecutionPatch): Promise<void>;\n abstract getStepExecution(stepExecutionId: string): Promise<StepExecution | null>;\n findStepExecutions(_jobExecutionId: string): Promise<StepExecution[]> {\n throw new UnsupportedJobRepositoryOperationError('findStepExecutions');\n }\n abstract getExecutionContext(scope: ExecutionScope): Promise<ExecutionContext>;\n abstract saveExecutionContext(\n scope: ExecutionScope,\n ctx: ExecutionContext,\n version?: number,\n ): Promise<void>;\n abstract findLatestStepExecution(\n jobExecutionId: string,\n stepName: string,\n ): Promise<StepExecution | null>;\n}\n"],"names":["JobRepository","getJobInstance","_jobInstanceId","UnsupportedJobRepositoryOperationError","findJobInstances","_filter","findJobExecutions","findStepExecutions","_jobExecutionId"],"mappings":";;;;+BA+DsBA;;;eAAAA;;;wBAnDiC;AAmDhD,IAAA,AAAeA,gBAAf,MAAeA;IAUpBC,eAAeC,cAAsB,EAA+B;QAClE,MAAM,IAAIC,8CAAsC,CAAC;IACnD;IACAC,iBAAiBC,UAA6B,CAAC,CAAC,EAA0B;QACxE,MAAM,IAAIF,8CAAsC,CAAC;IACnD;IACAG,kBAAkBD,UAA8B,CAAC,CAAC,EAA2B;QAC3E,MAAM,IAAIF,8CAAsC,CAAC;IACnD;IAKAI,mBAAmBC,eAAuB,EAA4B;QACpE,MAAM,IAAIL,8CAAsC,CAAC;IACnD;AAWF"}
|