@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 easdkr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# `@nest-batch/core`
|
|
2
|
+
|
|
3
|
+
A lightweight, NestJS-coupled batch processing core modelled after Spring
|
|
4
|
+
Batch. `@nest-batch/core` owns the **batch engine**: Job/Step/Chunk/Tasklet
|
|
5
|
+
semantics, checkpoint, restart, skip, chunk transaction, and business retry.
|
|
6
|
+
It does not own persistence, transport, or scheduling. Those live in
|
|
7
|
+
[sibling packages](#what-is-not-in-core).
|
|
8
|
+
|
|
9
|
+
The package is dependency-light on purpose. It only pulls in
|
|
10
|
+
`@nestjs/common`, `@nestjs/core`, and `reflect-metadata`. Anything
|
|
11
|
+
specific to a database, a queue, or a scheduler is injected through
|
|
12
|
+
tokens at the DI boundary, so a host app can swap persistence and
|
|
13
|
+
transport without touching the core.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @nest-batch/core
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Peer dependencies are pulled in by the host app:
|
|
24
|
+
|
|
25
|
+
| Package | Range |
|
|
26
|
+
| ------------------ | --------- |
|
|
27
|
+
| `@nestjs/common` | `^11.0.0` |
|
|
28
|
+
| `@nestjs/core` | `^11.0.0` |
|
|
29
|
+
| `reflect-metadata` | `^0.2.2` |
|
|
30
|
+
|
|
31
|
+
Core supports Nest 10 and 11.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Conceptual model
|
|
36
|
+
|
|
37
|
+
The model is a direct port of Spring Batch's mental model. If you've
|
|
38
|
+
written a Spring Batch job, you already know 80% of this.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Job
|
|
42
|
+
└── Step (one or more)
|
|
43
|
+
├── Chunk step (read → process → write in fixed-size chunks)
|
|
44
|
+
│ ├── ItemReader<T>
|
|
45
|
+
│ ├── ItemProcessor<T, R>
|
|
46
|
+
│ └── ItemWriter<R>
|
|
47
|
+
└── Tasklet (single-method work unit, no chunking)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Job
|
|
51
|
+
|
|
52
|
+
A named unit of work. The host app declares one with the `@Jobable`
|
|
53
|
+
decorator or the `BatchBuilder` fluent API. A job has:
|
|
54
|
+
|
|
55
|
+
- a unique `id`
|
|
56
|
+
- an ordered list of `Step`s
|
|
57
|
+
- a `JobParameters` shape (the params that pin a `JobInstance`)
|
|
58
|
+
|
|
59
|
+
### Step
|
|
60
|
+
|
|
61
|
+
A step is either a **chunk step** or a **tasklet step**. The compiler
|
|
62
|
+
decides which one based on which handler method you provide. Each step
|
|
63
|
+
runs inside a `StepExecution` row in the batch meta schema, and the
|
|
64
|
+
`StepExecution.id` is the unit of restart/checkpoint.
|
|
65
|
+
|
|
66
|
+
### Chunk step
|
|
67
|
+
|
|
68
|
+
A chunk step reads `chunkSize` items, processes them, writes them, and
|
|
69
|
+
repeats until the reader is exhausted. The chunk is the unit of
|
|
70
|
+
transaction: if any item in the chunk fails, the whole chunk rolls
|
|
71
|
+
back. This is the model Spring Batch uses, and we keep it.
|
|
72
|
+
|
|
73
|
+
The reader, processor, and writer are plain Nest providers. You can
|
|
74
|
+
declare them with `@ItemReader`, `@ItemProcessor`, `@ItemWriter` (under
|
|
75
|
+
the `BatchDecorators` namespace) or with method references on the job
|
|
76
|
+
class itself. Three reference kinds are accepted:
|
|
77
|
+
|
|
78
|
+
- `BuilderLambda` — a function value captured by the builder.
|
|
79
|
+
- `Method` — a method on the job class.
|
|
80
|
+
- `ProviderToken` — a Nest DI token resolved at runtime.
|
|
81
|
+
|
|
82
|
+
### Tasklet step
|
|
83
|
+
|
|
84
|
+
A single method that runs to completion. Useful for one-off work that
|
|
85
|
+
doesn't fit the read/process/write shape (e.g. "run this SQL and
|
|
86
|
+
move on"). A tasklet is the right answer when you don't need chunking,
|
|
87
|
+
skip, or restart.
|
|
88
|
+
|
|
89
|
+
### Listeners
|
|
90
|
+
|
|
91
|
+
Listeners fire around every transition in the engine. You tag a method
|
|
92
|
+
on your provider with one of the listener decorators, and the engine
|
|
93
|
+
calls it at the right moment. The full set:
|
|
94
|
+
|
|
95
|
+
| Decorator | Fires |
|
|
96
|
+
| ----------------- | --------------------------------------------- |
|
|
97
|
+
| `@BeforeJob` | Before a job execution starts. |
|
|
98
|
+
| `@AfterJob` | After a job execution finishes (any status). |
|
|
99
|
+
| `@BeforeStep` | Before a step execution starts. |
|
|
100
|
+
| `@AfterStep` | After a step execution finishes (any status). |
|
|
101
|
+
| `@BeforeChunk` | Before each chunk (read-process-write cycle). |
|
|
102
|
+
| `@AfterChunk` | After each chunk finishes successfully. |
|
|
103
|
+
| `@OnChunkError` | When a chunk throws. |
|
|
104
|
+
| `@BeforeRead` | Before each item is read. |
|
|
105
|
+
| `@AfterRead` | After each item is read. |
|
|
106
|
+
| `@OnReadError` | When the reader throws. |
|
|
107
|
+
| `@BeforeProcess` | Before each item is processed. |
|
|
108
|
+
| `@AfterProcess` | After each item is processed. |
|
|
109
|
+
| `@OnProcessError` | When the processor throws. |
|
|
110
|
+
| `@BeforeWrite` | Before the writer receives a chunk. |
|
|
111
|
+
| `@AfterWrite` | After the writer finishes a chunk. |
|
|
112
|
+
| `@OnWriteError` | When the writer throws. |
|
|
113
|
+
| `@OnSkipRead` | When a read is skipped by the skip policy. |
|
|
114
|
+
| `@OnSkipProcess` | When a processed item is skipped. |
|
|
115
|
+
| `@OnSkipWrite` | When a write is skipped. |
|
|
116
|
+
|
|
117
|
+
You can mark a listener as `nonCritical: true` via
|
|
118
|
+
`@BeforeJob({ nonCritical: true })` if the engine should swallow
|
|
119
|
+
exceptions from it. A critical listener that throws fails the
|
|
120
|
+
execution.
|
|
121
|
+
|
|
122
|
+
### Skip and retry policies
|
|
123
|
+
|
|
124
|
+
Skip and retry are Batch Core concerns, not transport concerns. The
|
|
125
|
+
default policy is "fail on first error", and you can swap in:
|
|
126
|
+
|
|
127
|
+
- `LimitSkipPolicy` — skip up to N items of a given kind
|
|
128
|
+
(read/process/write), then fail.
|
|
129
|
+
- `ClassifySkipPolicy` — skip based on the exception class.
|
|
130
|
+
- `ExponentialBackoffRetryPolicy` — retry with exponential backoff.
|
|
131
|
+
- `FixedDelayRetryPolicy` — retry with a fixed delay.
|
|
132
|
+
|
|
133
|
+
The BullMQ package reuses these policies. It does **not** reimplement
|
|
134
|
+
them. See "what is NOT in core" below.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Polymorphic `JobLauncher`
|
|
139
|
+
|
|
140
|
+
`JobLauncher` is the public entry point for starting a job. Its
|
|
141
|
+
signature is:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
launch(jobId: string, params: JobParameters = {}): Promise<JobExecution>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The launcher does:
|
|
148
|
+
|
|
149
|
+
1. Look up the `JobDefinition` from the registry. Missing → `JobNotFoundError`.
|
|
150
|
+
2. Canonicalize `params` into a stable `jobKey` hash. Object key
|
|
151
|
+
order, `null/undefined` omission, `Date → ISO` are all normalized
|
|
152
|
+
so semantically-identical params yield the same key.
|
|
153
|
+
3. `createExecutionAtomic(jobId, jobKey, params)` — atomic
|
|
154
|
+
get-or-create instance + `SELECT ... FOR UPDATE SKIP LOCKED` to
|
|
155
|
+
serialize concurrent launches + running-execution check + insert.
|
|
156
|
+
4. Delegate to whatever `IExecutionStrategy` is bound to the
|
|
157
|
+
`EXECUTION_STRATEGY` token. The default is the in-process strategy;
|
|
158
|
+
`@nest-batch/bullmq` overrides it with a transport strategy.
|
|
159
|
+
|
|
160
|
+
`IExecutionStrategy` is the polymorphism seam:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
export interface IExecutionStrategy {
|
|
164
|
+
readonly name: string;
|
|
165
|
+
launch(
|
|
166
|
+
job: JobDefinition,
|
|
167
|
+
params: JobParameters,
|
|
168
|
+
ctx: ExecutionStrategyContext,
|
|
169
|
+
): Promise<LaunchResult>;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`LaunchResult` is a discriminated union:
|
|
174
|
+
|
|
175
|
+
- `{ kind: 'completed', status }` — the strategy ran to a terminal
|
|
176
|
+
state in-process. The launcher resolves the persisted
|
|
177
|
+
`JobExecution` and returns it.
|
|
178
|
+
- `{ kind: 'enqueued', queueJobId }` — the strategy handed off to a
|
|
179
|
+
transport. The launcher still resolves the latest persisted
|
|
180
|
+
`JobExecution` (which is in `STARTING` / `STARTED` because the
|
|
181
|
+
executor has not run yet on the launcher process).
|
|
182
|
+
|
|
183
|
+
The `JobLauncher.launch` API is intentionally stable. Strategies
|
|
184
|
+
change; the public surface does not.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Module wiring
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
import { Module } from '@nestjs/common';
|
|
192
|
+
import {
|
|
193
|
+
NestBatchModule,
|
|
194
|
+
JobRepository,
|
|
195
|
+
TransactionManager,
|
|
196
|
+
InProcessExecutionStrategy,
|
|
197
|
+
IN_PROCESS_EXECUTION_STRATEGY_PROVIDER,
|
|
198
|
+
} from '@nest-batch/core';
|
|
199
|
+
import { MikroORMJobRepository, MikroORMTransactionManager } from '@nest-batch/mikro-orm';
|
|
200
|
+
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
|
201
|
+
import { BATCH_META_ENTITIES } from '@nest-batch/mikro-orm';
|
|
202
|
+
import { ProductEntity } from './entities/product.entity';
|
|
203
|
+
|
|
204
|
+
@Module({
|
|
205
|
+
imports: [
|
|
206
|
+
MikroOrmModule.forRoot({
|
|
207
|
+
entities: [ProductEntity, ...BATCH_META_ENTITIES],
|
|
208
|
+
// ...
|
|
209
|
+
}),
|
|
210
|
+
NestBatchModule.forRoot(),
|
|
211
|
+
],
|
|
212
|
+
providers: [
|
|
213
|
+
{ provide: JobRepository, useClass: MikroORMJobRepository },
|
|
214
|
+
{ provide: TransactionManager, useClass: MikroORMTransactionManager },
|
|
215
|
+
InProcessExecutionStrategy,
|
|
216
|
+
IN_PROCESS_EXECUTION_STRATEGY_PROVIDER,
|
|
217
|
+
],
|
|
218
|
+
})
|
|
219
|
+
export class AppModule {}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`NestBatchModule` is `global: true`, so sub-modules don't have to
|
|
223
|
+
import it again. The module exports `JobRegistry`, `DefinitionCompiler`,
|
|
224
|
+
`BatchExplorer`, `FlowEvaluator`, and `BatchScheduleRegistry` so
|
|
225
|
+
consumers can inject them from outside.
|
|
226
|
+
|
|
227
|
+
`forRootAsync` is also available when the repository/strategy bindings
|
|
228
|
+
need to come from a config service or another async source:
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
NestBatchModule.forRootAsync({
|
|
232
|
+
imports: [ConfigModule],
|
|
233
|
+
inject: [ConfigService],
|
|
234
|
+
useFactory: (cfg: ConfigService) => ({
|
|
235
|
+
repository: {
|
|
236
|
+
provide: JOB_REPOSITORY_TOKEN,
|
|
237
|
+
useClass: cfg.get<Type<JobRepository>>('BATCH_REPOSITORY'),
|
|
238
|
+
},
|
|
239
|
+
}),
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Listener resolver
|
|
246
|
+
|
|
247
|
+
Listeners are discovered by walking every `@Jobable` class the
|
|
248
|
+
`BatchExplorer` finds, reading the `BATCH_LISTENER_METADATA` slot from
|
|
249
|
+
each method, and building a per-job, per-step resolver map. The map
|
|
250
|
+
is populated once at `OnApplicationBootstrap` (see
|
|
251
|
+
`BatchBootstrapper`) and is read on every transition.
|
|
252
|
+
|
|
253
|
+
Critical vs non-critical semantics:
|
|
254
|
+
|
|
255
|
+
- A **critical** listener that throws fails the execution. The
|
|
256
|
+
executor records the failure and the listener exception is part of
|
|
257
|
+
the failure context.
|
|
258
|
+
- A **non-critical** listener that throws is logged and contained. The
|
|
259
|
+
execution continues.
|
|
260
|
+
|
|
261
|
+
The two paths are separated on purpose. Critical listener failures
|
|
262
|
+
should be loud, non-critical ones should not poison the run.
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Contract suite
|
|
267
|
+
|
|
268
|
+
`@nest-batch/core` ships a contract suite that the adapter packages
|
|
269
|
+
use to prove they implement the repository and transaction
|
|
270
|
+
contracts correctly. It is exposed at
|
|
271
|
+
`@nest-batch/core/test-contracts`:
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
import {
|
|
275
|
+
runJobRepositoryContract,
|
|
276
|
+
runTransactionManagerContract,
|
|
277
|
+
} from '@nest-batch/core/test-contracts';
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
The contract covers:
|
|
281
|
+
|
|
282
|
+
- `getOrCreateJobInstance` — idempotency, concurrent creation.
|
|
283
|
+
- `createExecutionAtomic` — atomicity, lock semantics, running-execution guard.
|
|
284
|
+
- `updateJobExecution` / `getJobExecution` — round-trip integrity.
|
|
285
|
+
- `createStepExecution` / `updateStepExecution` / `getStepExecution` — same for step rows.
|
|
286
|
+
- `getExecutionContext` / `saveExecutionContext` — versioning, optimistic concurrency.
|
|
287
|
+
- `findLatestStepExecution` — restart/checkpoint lookup; must return
|
|
288
|
+
the most recent `StepExecution` for `(jobExecutionId, stepName)`.
|
|
289
|
+
- `TransactionManager` — wrap / commit / rollback / nested.
|
|
290
|
+
|
|
291
|
+
`@nest-batch/mikro-orm` and `@nest-batch/typeorm` both run this suite
|
|
292
|
+
against their implementations. The in-memory reference implementation
|
|
293
|
+
in core also passes it. If you write a custom adapter, the suite is
|
|
294
|
+
how you prove it satisfies the contract.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Public API surface
|
|
299
|
+
|
|
300
|
+
Everything in `@nest-batch/core` is reachable from the package root.
|
|
301
|
+
The barrel re-exports:
|
|
302
|
+
|
|
303
|
+
- `./core` — IR (`JobDefinition`, `StepDefinition`, ...), errors, status, execution context, item interfaces, repository/transaction contracts.
|
|
304
|
+
- `./compiler` — turns discovered jobs into compiled IR.
|
|
305
|
+
- `./registry` — `JobRegistry` and friends.
|
|
306
|
+
- `./execution` — `JobLauncher`, `JobExecutor`, `InProcessExecutionStrategy`, `IExecutionStrategy`, `EXECUTION_STRATEGY`, `ChunkStepExecutor`, `TaskletStepExecutor`, `ListenerInvoker`, `RefResolver`.
|
|
307
|
+
- `./transaction` — `TransactionManager` token and contract.
|
|
308
|
+
- `./repository` — `JobRepository` token, contract, in-memory reference, ID generators.
|
|
309
|
+
- `./decorators` — under the `BatchDecorators` namespace (`@Jobable`, `@ItemReader`, `@ItemProcessor`, `@ItemWriter`, `@Tasklet`, listener decorators, `@BatchScheduled`).
|
|
310
|
+
- `./module` — `NestBatchModule`, tokens, options.
|
|
311
|
+
- `./builder` — fluent `BatchBuilder`, `JobBuilder`, `StepBuilder`, `FlowBuilder`.
|
|
312
|
+
- `./explorer` — `BatchExplorer` (the metadata scanner).
|
|
313
|
+
- `./listeners` — built-in `LoggingListener`, `MetricsListener`, `TimingListener` reference implementations.
|
|
314
|
+
- `./policies` — `LimitSkipPolicy`, `ClassifySkipPolicy`, retry policies, backoff helpers.
|
|
315
|
+
- `./flow` — `FlowEvaluator` for the `on` / `from` / `end` flow DSL.
|
|
316
|
+
- `./observability` — `BatchObserver` contract, `BATCH_EVENT` constants, `NoopBatchObserver` default.
|
|
317
|
+
|
|
318
|
+
Decorator names collide with interface names (e.g. `Tasklet` is both a
|
|
319
|
+
decorator and an interface). Decorators are re-exported under
|
|
320
|
+
`BatchDecorators`; interfaces are reachable as bare names from
|
|
321
|
+
`./core/item`. This is intentional.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## What is NOT in core
|
|
326
|
+
|
|
327
|
+
Core is the engine. The following live in sibling packages and are
|
|
328
|
+
injected at the DI boundary:
|
|
329
|
+
|
|
330
|
+
| Concern | Package | Why |
|
|
331
|
+
| ----------------------------- | ----------------------- | ----------------------------------------------------------------- |
|
|
332
|
+
| **Persistence (PostgreSQL)** | `@nest-batch/mikro-orm` | Ships the 6 batch meta tables, entities, and migrations. |
|
|
333
|
+
| **Persistence (TypeORM 1.0)** | `@nest-batch/typeorm` | Ships the same 6 tables as TypeORM 1.0.0 entities + migration. |
|
|
334
|
+
| **Transport (BullMQ)** | `@nest-batch/bullmq` | The Redis-backed execution strategy. Owns Queue/Worker lifecycle. |
|
|
335
|
+
| **Drizzle** | _not in this release_ | Explicitly excluded and deferred. See `MIGRATION.md`. |
|
|
336
|
+
|
|
337
|
+
Core itself does **not** ship:
|
|
338
|
+
|
|
339
|
+
- A default `JobRepository` (the choice of DB is the host's).
|
|
340
|
+
- A default `TransactionManager` (same).
|
|
341
|
+
- A default transport (in-process is the default; siblings override).
|
|
342
|
+
- An admin UI.
|
|
343
|
+
- A metrics backend (Prometheus, OpenTelemetry, ...).
|
|
344
|
+
- A tracing backend.
|
|
345
|
+
- A webhook or notification system.
|
|
346
|
+
- A job visualization dashboard.
|
|
347
|
+
- Multi-tenant routing.
|
|
348
|
+
|
|
349
|
+
These are out of scope by design. If you need one, write a
|
|
350
|
+
`BatchObserver` adapter that hooks into the event stream, or open an
|
|
351
|
+
issue if you think it belongs in core.
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Scripts
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
pnpm --filter @nest-batch/core build # SWC transpile + tsc declarations
|
|
359
|
+
pnpm --filter @nest-batch/core test # vitest run
|
|
360
|
+
pnpm --filter @nest-batch/core test:watch # vitest watch
|
|
361
|
+
pnpm --filter @nest-batch/core test:e2e # vitest e2e (requires Postgres/Redis)
|
|
362
|
+
pnpm --filter @nest-batch/core typecheck # tsc --noEmit
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
The boundary test (`tests/core/boundary/no-forbidden-imports.test.ts`)
|
|
366
|
+
guards core's dependency-light promise. It fails the build if any
|
|
367
|
+
forbidden package (`bullmq`, `mikro-orm`, `typeorm`, `drizzle-orm`,
|
|
368
|
+
`cron`) shows up as a core import.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { BatchAdapter } from '../module/adapter';
|
|
2
|
+
/**
|
|
3
|
+
* Empty Nest module class that owns the in-process execution-strategy
|
|
4
|
+
* providers.
|
|
5
|
+
*
|
|
6
|
+
* The class has no body on purpose: it is purely a `DynamicModule`
|
|
7
|
+
* carrier for the `forRoot()` factory below. Nest's module system
|
|
8
|
+
* requires *some* class to identify the module — the empty class is
|
|
9
|
+
* the minimum possible surface and keeps the runtime allocation at
|
|
10
|
+
* one class (no decorators, no lifecycle hooks, no metadata).
|
|
11
|
+
*/
|
|
12
|
+
export declare class InProcessModule {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `InProcessAdapter` — the default transport adapter for
|
|
16
|
+
* `@nest-batch/core`.
|
|
17
|
+
*
|
|
18
|
+
* This is the **no-Redis** transport: jobs run synchronously inside
|
|
19
|
+
* the launching process via `JobExecutor.execute(...)`, on the same
|
|
20
|
+
* event loop that called `JobLauncher.launch(...)`. There is no
|
|
21
|
+
* queue, no worker, no Redis connection, no AOF / Lua scripts /
|
|
22
|
+
* stream events. The whole point of this adapter is to be the
|
|
23
|
+
* "no transport runtime at all" option.
|
|
24
|
+
*
|
|
25
|
+
* Use it when:
|
|
26
|
+
*
|
|
27
|
+
* - You do not need horizontal scale-out (one process, one
|
|
28
|
+
* launcher, jobs run inline).
|
|
29
|
+
* - You want the cheapest possible deployment — no extra
|
|
30
|
+
* infrastructure, no extra process to supervise.
|
|
31
|
+
* - You are building a library / dev-time harness and the queue
|
|
32
|
+
* runtime would be in the way.
|
|
33
|
+
* - You are migrating an existing batch app and want to validate
|
|
34
|
+
* the engine end-to-end before turning on a real transport.
|
|
35
|
+
*
|
|
36
|
+
* Switch to `@nest-batch/bullmq` (or a future transport) when you
|
|
37
|
+
* need cross-process work distribution, technical retry at the
|
|
38
|
+
* transport layer, or a queue-backed backpressure model. The
|
|
39
|
+
* `IExecutionStrategy` polymorphism means the application code does
|
|
40
|
+
* not change — only the `transport` slot in `adapters: { ... }` does.
|
|
41
|
+
*
|
|
42
|
+
* ## Why a dedicated adapter (and not a built-in default)?
|
|
43
|
+
*
|
|
44
|
+
* The new factory-pattern API takes `adapters: { persistence,
|
|
45
|
+
* transport }` and both slots are *required* (see
|
|
46
|
+
* `BatchAdaptersConfig`). Shipping the in-process transport as a
|
|
47
|
+
* dedicated `BatchAdapter` rather than a hidden implicit default
|
|
48
|
+
* keeps the `AppModule` wiring explicit at the call site — you can
|
|
49
|
+
* read the host's `imports` array and see exactly which transport is
|
|
50
|
+
* active. That pays off the first time you debug a "why is this
|
|
51
|
+
* running inline?" question and need to grep for the transport.
|
|
52
|
+
*
|
|
53
|
+
* ## Wiring
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { Module } from '@nestjs/common';
|
|
57
|
+
* import { NestBatchModule, InProcessAdapter } from '@nest-batch/core';
|
|
58
|
+
* import { MikroOrmAdapter } from '@nest-batch/mikro-orm';
|
|
59
|
+
*
|
|
60
|
+
* @Module({
|
|
61
|
+
* imports: [
|
|
62
|
+
* NestBatchModule.forRoot({
|
|
63
|
+
* adapters: {
|
|
64
|
+
* persistence: MikroOrmAdapter,
|
|
65
|
+
* transport: InProcessAdapter,
|
|
66
|
+
* },
|
|
67
|
+
* }),
|
|
68
|
+
* ],
|
|
69
|
+
* })
|
|
70
|
+
* class AppModule {}
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* `InProcessAdapter.forRoot()` takes no options — the in-process
|
|
74
|
+
* transport has no connection params, no credentials, no knobs to
|
|
75
|
+
* tune. If you find yourself reaching for a `useFactory` to plumb
|
|
76
|
+
* some "config" into it, you almost certainly want a real transport
|
|
77
|
+
* adapter instead.
|
|
78
|
+
*
|
|
79
|
+
* ## DI scope
|
|
80
|
+
*
|
|
81
|
+
* The module is `global: true` and exports both the strategy class
|
|
82
|
+
* and the `EXECUTION_STRATEGY` token. Three reasons for the `global`
|
|
83
|
+
* flag:
|
|
84
|
+
*
|
|
85
|
+
* 1. `JobLauncher` (registered by `NestBatchModule`) is `@Inject(
|
|
86
|
+
* EXECUTION_STRATEGY )` — it needs the token visible at the
|
|
87
|
+
* application level, not just inside the adapter's own module.
|
|
88
|
+
* 2. The host application is the only place that may want to
|
|
89
|
+
* inspect the strategy at runtime (e.g. for a `/healthz`
|
|
90
|
+
* endpoint reporting which transport is active). The `global`
|
|
91
|
+
* flag makes that work without forcing the host to re-import
|
|
92
|
+
* this module from every sub-module.
|
|
93
|
+
* 3. Mirroring `NestBatchModule`'s own `global: true` keeps the
|
|
94
|
+
* pattern uniform across the engine and its adapters — the host
|
|
95
|
+
* author only needs to learn one module-visibility model.
|
|
96
|
+
*
|
|
97
|
+
* ## Why `globalProviders` is omitted
|
|
98
|
+
*
|
|
99
|
+
* The `BatchAdapter` interface allows a `globalProviders` field for
|
|
100
|
+
* runtime classes (e.g. `JobExecutor`, `InProcessExecutionStrategy`)
|
|
101
|
+
* that the adapter's *own* module needs to inject but that the host
|
|
102
|
+
* should also be able to inject. The recommended path is to list
|
|
103
|
+
* them in the adapter's own `DynamicModule.exports` — which is what
|
|
104
|
+
* this adapter does. `JobLauncher` (registered by `NestBatchModule`,
|
|
105
|
+
* not by this adapter) injects the strategy by the `EXECUTION_STRATEGY`
|
|
106
|
+
* token, which is exported here, so the runtime resolution chain
|
|
107
|
+
* works without the core module having to know which adapter is
|
|
108
|
+
* active.
|
|
109
|
+
*
|
|
110
|
+
* If a future in-process feature needs to expose a new provider to
|
|
111
|
+
* the host (e.g. an inline scheduler), prefer adding it to
|
|
112
|
+
* `exports` and updating the `BatchAdapter.globalProviders` decision
|
|
113
|
+
* — do not push it onto the host app's `providers` array.
|
|
114
|
+
*
|
|
115
|
+
* ## Concurrency
|
|
116
|
+
*
|
|
117
|
+
* The default in-process strategy runs jobs on the caller's event
|
|
118
|
+
* loop. A long-running step will block the launching process. This
|
|
119
|
+
* is the contract: no concurrency, no parallelism, no out-of-band
|
|
120
|
+
* execution. If you need concurrency, switch transports.
|
|
121
|
+
*/
|
|
122
|
+
export declare class InProcessAdapter {
|
|
123
|
+
/**
|
|
124
|
+
* Build the `BatchAdapter` value the new factory-pattern
|
|
125
|
+
* `NestBatchModule.forRoot({ adapters: { transport, ... } })`
|
|
126
|
+
* expects.
|
|
127
|
+
*
|
|
128
|
+
* No options are accepted on purpose — the in-process transport
|
|
129
|
+
* has nothing to configure. The method is static so the adapter
|
|
130
|
+
* can be referenced as a value (`adapters: { transport:
|
|
131
|
+
* InProcessAdapter }`) without needing an instance, mirroring
|
|
132
|
+
* the shape of the sibling adapter packages' own factories.
|
|
133
|
+
*
|
|
134
|
+
* @returns A `BatchAdapter` whose `module` is a `global: true`
|
|
135
|
+
* `DynamicModule` exposing `InProcessExecutionStrategy` and the
|
|
136
|
+
* `EXECUTION_STRATEGY` token to the host application.
|
|
137
|
+
*/
|
|
138
|
+
static forRoot(): BatchAdapter;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=in-process.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-process.adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/in-process.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD;;;;;;;;;GASG;AACH,qBACa,eAAe;CAAG;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,OAAO,IAAI,YAAY;CAU/B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get InProcessAdapter () {
|
|
13
|
+
return InProcessAdapter;
|
|
14
|
+
},
|
|
15
|
+
get InProcessModule () {
|
|
16
|
+
return InProcessModule;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _common = require("@nestjs/common");
|
|
20
|
+
const _inprocessexecutionstrategy = require("../execution/in-process-execution-strategy");
|
|
21
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
22
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
24
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
25
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
|
+
}
|
|
27
|
+
let InProcessModule = class InProcessModule {
|
|
28
|
+
};
|
|
29
|
+
InProcessModule = _ts_decorate([
|
|
30
|
+
(0, _common.Module)({})
|
|
31
|
+
], InProcessModule);
|
|
32
|
+
let InProcessAdapter = class InProcessAdapter {
|
|
33
|
+
/**
|
|
34
|
+
* Build the `BatchAdapter` value the new factory-pattern
|
|
35
|
+
* `NestBatchModule.forRoot({ adapters: { transport, ... } })`
|
|
36
|
+
* expects.
|
|
37
|
+
*
|
|
38
|
+
* No options are accepted on purpose — the in-process transport
|
|
39
|
+
* has nothing to configure. The method is static so the adapter
|
|
40
|
+
* can be referenced as a value (`adapters: { transport:
|
|
41
|
+
* InProcessAdapter }`) without needing an instance, mirroring
|
|
42
|
+
* the shape of the sibling adapter packages' own factories.
|
|
43
|
+
*
|
|
44
|
+
* @returns A `BatchAdapter` whose `module` is a `global: true`
|
|
45
|
+
* `DynamicModule` exposing `InProcessExecutionStrategy` and the
|
|
46
|
+
* `EXECUTION_STRATEGY` token to the host application.
|
|
47
|
+
*/ static forRoot() {
|
|
48
|
+
return {
|
|
49
|
+
name: 'in-process',
|
|
50
|
+
module: buildInProcessDynamicModule(),
|
|
51
|
+
globalProviders: [
|
|
52
|
+
_inprocessexecutionstrategy.InProcessExecutionStrategy,
|
|
53
|
+
_inprocessexecutionstrategy.IN_PROCESS_EXECUTION_STRATEGY_PROVIDER
|
|
54
|
+
]
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Build the `DynamicModule` payload for the in-process transport.
|
|
60
|
+
*
|
|
61
|
+
* Extracted from `InProcessAdapter.forRoot()` so the provider /
|
|
62
|
+
* export list lives in one place — easier to read, easier to keep
|
|
63
|
+
* the two arrays in sync if a new provider is ever added.
|
|
64
|
+
*
|
|
65
|
+
* The `EXECUTION_STRATEGY` token is exported (not just listed in
|
|
66
|
+
* `providers`) so that host code can resolve the strategy directly
|
|
67
|
+
* via `moduleRef.get(EXECUTION_STRATEGY)` — useful for `/healthz`
|
|
68
|
+
* endpoints that need to report which transport is wired up.
|
|
69
|
+
*
|
|
70
|
+
* `InProcessExecutionStrategy` is also exported so host code can
|
|
71
|
+
* inject the concrete class (not just the token) when type-strict
|
|
72
|
+
* consumers prefer the class form.
|
|
73
|
+
*/ function buildInProcessDynamicModule() {
|
|
74
|
+
return {
|
|
75
|
+
module: InProcessModule,
|
|
76
|
+
global: true,
|
|
77
|
+
providers: [
|
|
78
|
+
_inprocessexecutionstrategy.IN_PROCESS_EXECUTION_STRATEGY_PROVIDER
|
|
79
|
+
],
|
|
80
|
+
exports: [
|
|
81
|
+
_inprocessexecutionstrategy.IN_PROCESS_EXECUTION_STRATEGY_PROVIDER
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=in-process.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/in-process.adapter.ts"],"sourcesContent":["import { Module, type DynamicModule } from '@nestjs/common';\n\nimport type { BatchAdapter } from '../module/adapter';\nimport { EXECUTION_STRATEGY } from '../execution/execution-strategy';\nimport {\n IN_PROCESS_EXECUTION_STRATEGY_PROVIDER,\n InProcessExecutionStrategy,\n} from '../execution/in-process-execution-strategy';\n\n/**\n * Empty Nest module class that owns the in-process execution-strategy\n * providers.\n *\n * The class has no body on purpose: it is purely a `DynamicModule`\n * carrier for the `forRoot()` factory below. Nest's module system\n * requires *some* class to identify the module — the empty class is\n * the minimum possible surface and keeps the runtime allocation at\n * one class (no decorators, no lifecycle hooks, no metadata).\n */\n@Module({})\nexport class InProcessModule {}\n\n/**\n * `InProcessAdapter` — the default transport adapter for\n * `@nest-batch/core`.\n *\n * This is the **no-Redis** transport: jobs run synchronously inside\n * the launching process via `JobExecutor.execute(...)`, on the same\n * event loop that called `JobLauncher.launch(...)`. There is no\n * queue, no worker, no Redis connection, no AOF / Lua scripts /\n * stream events. The whole point of this adapter is to be the\n * \"no transport runtime at all\" option.\n *\n * Use it when:\n *\n * - You do not need horizontal scale-out (one process, one\n * launcher, jobs run inline).\n * - You want the cheapest possible deployment — no extra\n * infrastructure, no extra process to supervise.\n * - You are building a library / dev-time harness and the queue\n * runtime would be in the way.\n * - You are migrating an existing batch app and want to validate\n * the engine end-to-end before turning on a real transport.\n *\n * Switch to `@nest-batch/bullmq` (or a future transport) when you\n * need cross-process work distribution, technical retry at the\n * transport layer, or a queue-backed backpressure model. The\n * `IExecutionStrategy` polymorphism means the application code does\n * not change — only the `transport` slot in `adapters: { ... }` does.\n *\n * ## Why a dedicated adapter (and not a built-in default)?\n *\n * The new factory-pattern API takes `adapters: { persistence,\n * transport }` and both slots are *required* (see\n * `BatchAdaptersConfig`). Shipping the in-process transport as a\n * dedicated `BatchAdapter` rather than a hidden implicit default\n * keeps the `AppModule` wiring explicit at the call site — you can\n * read the host's `imports` array and see exactly which transport is\n * active. That pays off the first time you debug a \"why is this\n * running inline?\" question and need to grep for the transport.\n *\n * ## Wiring\n *\n * ```ts\n * import { Module } from '@nestjs/common';\n * import { NestBatchModule, InProcessAdapter } from '@nest-batch/core';\n * import { MikroOrmAdapter } from '@nest-batch/mikro-orm';\n *\n * @Module({\n * imports: [\n * NestBatchModule.forRoot({\n * adapters: {\n * persistence: MikroOrmAdapter,\n * transport: InProcessAdapter,\n * },\n * }),\n * ],\n * })\n * class AppModule {}\n * ```\n *\n * `InProcessAdapter.forRoot()` takes no options — the in-process\n * transport has no connection params, no credentials, no knobs to\n * tune. If you find yourself reaching for a `useFactory` to plumb\n * some \"config\" into it, you almost certainly want a real transport\n * adapter instead.\n *\n * ## DI scope\n *\n * The module is `global: true` and exports both the strategy class\n * and the `EXECUTION_STRATEGY` token. Three reasons for the `global`\n * flag:\n *\n * 1. `JobLauncher` (registered by `NestBatchModule`) is `@Inject(\n * EXECUTION_STRATEGY )` — it needs the token visible at the\n * application level, not just inside the adapter's own module.\n * 2. The host application is the only place that may want to\n * inspect the strategy at runtime (e.g. for a `/healthz`\n * endpoint reporting which transport is active). The `global`\n * flag makes that work without forcing the host to re-import\n * this module from every sub-module.\n * 3. Mirroring `NestBatchModule`'s own `global: true` keeps the\n * pattern uniform across the engine and its adapters — the host\n * author only needs to learn one module-visibility model.\n *\n * ## Why `globalProviders` is omitted\n *\n * The `BatchAdapter` interface allows a `globalProviders` field for\n * runtime classes (e.g. `JobExecutor`, `InProcessExecutionStrategy`)\n * that the adapter's *own* module needs to inject but that the host\n * should also be able to inject. The recommended path is to list\n * them in the adapter's own `DynamicModule.exports` — which is what\n * this adapter does. `JobLauncher` (registered by `NestBatchModule`,\n * not by this adapter) injects the strategy by the `EXECUTION_STRATEGY`\n * token, which is exported here, so the runtime resolution chain\n * works without the core module having to know which adapter is\n * active.\n *\n * If a future in-process feature needs to expose a new provider to\n * the host (e.g. an inline scheduler), prefer adding it to\n * `exports` and updating the `BatchAdapter.globalProviders` decision\n * — do not push it onto the host app's `providers` array.\n *\n * ## Concurrency\n *\n * The default in-process strategy runs jobs on the caller's event\n * loop. A long-running step will block the launching process. This\n * is the contract: no concurrency, no parallelism, no out-of-band\n * execution. If you need concurrency, switch transports.\n */\nexport class InProcessAdapter {\n /**\n * Build the `BatchAdapter` value the new factory-pattern\n * `NestBatchModule.forRoot({ adapters: { transport, ... } })`\n * expects.\n *\n * No options are accepted on purpose — the in-process transport\n * has nothing to configure. The method is static so the adapter\n * can be referenced as a value (`adapters: { transport:\n * InProcessAdapter }`) without needing an instance, mirroring\n * the shape of the sibling adapter packages' own factories.\n *\n * @returns A `BatchAdapter` whose `module` is a `global: true`\n * `DynamicModule` exposing `InProcessExecutionStrategy` and the\n * `EXECUTION_STRATEGY` token to the host application.\n */\n static forRoot(): BatchAdapter {\n return {\n name: 'in-process',\n module: buildInProcessDynamicModule(),\n globalProviders: [\n InProcessExecutionStrategy,\n IN_PROCESS_EXECUTION_STRATEGY_PROVIDER,\n ],\n };\n }\n}\n\n/**\n * Build the `DynamicModule` payload for the in-process transport.\n *\n * Extracted from `InProcessAdapter.forRoot()` so the provider /\n * export list lives in one place — easier to read, easier to keep\n * the two arrays in sync if a new provider is ever added.\n *\n * The `EXECUTION_STRATEGY` token is exported (not just listed in\n * `providers`) so that host code can resolve the strategy directly\n * via `moduleRef.get(EXECUTION_STRATEGY)` — useful for `/healthz`\n * endpoints that need to report which transport is wired up.\n *\n * `InProcessExecutionStrategy` is also exported so host code can\n * inject the concrete class (not just the token) when type-strict\n * consumers prefer the class form.\n */\nfunction buildInProcessDynamicModule(): DynamicModule {\n return {\n module: InProcessModule,\n global: true,\n providers: [IN_PROCESS_EXECUTION_STRATEGY_PROVIDER],\n exports: [IN_PROCESS_EXECUTION_STRATEGY_PROVIDER],\n };\n}\n"],"names":["InProcessAdapter","InProcessModule","forRoot","name","module","buildInProcessDynamicModule","globalProviders","InProcessExecutionStrategy","IN_PROCESS_EXECUTION_STRATEGY_PROVIDER","global","providers","exports"],"mappings":";;;;;;;;;;;QAkIaA;eAAAA;;QA9GAC;eAAAA;;;wBApB8B;4CAOpC;;;;;;;AAaA,IAAA,AAAMA,kBAAN,MAAMA;AAAiB;;;;AA8GvB,IAAA,AAAMD,mBAAN,MAAMA;IACX;;;;;;;;;;;;;;GAcC,GACD,OAAOE,UAAwB;QAC7B,OAAO;YACLC,MAAM;YACNC,QAAQC;YACRC,iBAAiB;gBACfC,sDAA0B;gBAC1BC,kEAAsC;aACvC;QACH;IACF;AACF;AAEA;;;;;;;;;;;;;;;CAeC,GACD,SAASH;IACP,OAAO;QACLD,QAAQH;QACRQ,QAAQ;QACRC,WAAW;YAACF,kEAAsC;SAAC;QACnDG,SAAS;YAACH,kEAAsC;SAAC;IACnD;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface for the `adapters/` package directory.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the in-process transport adapter so consumers can
|
|
5
|
+
* import it via `@nest-batch/core` (the root barrel pulls this file
|
|
6
|
+
* in) without having to know the internal directory layout.
|
|
7
|
+
*
|
|
8
|
+
* Future sibling adapters that *live inside* core (none are planned
|
|
9
|
+
* at the moment) would be re-exported from here too. The persistence
|
|
10
|
+
* and remote-transport adapters live in their own sibling packages
|
|
11
|
+
* (`@nest-batch/mikro-orm`, `@nest-batch/typeorm`, `@nest-batch/bullmq`,
|
|
12
|
+
* ...) — those are not re-exported from this barrel because the
|
|
13
|
+
* whole point of splitting the engine into sibling packages is to
|
|
14
|
+
* keep the dependency graph one-way (core never depends on an
|
|
15
|
+
* adapter package).
|
|
16
|
+
*/
|
|
17
|
+
export * from './in-process.adapter';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,sBAAsB,CAAC"}
|