@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,167 @@
|
|
|
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 CsvFileItemReader () {
|
|
13
|
+
return CsvFileItemReader;
|
|
14
|
+
},
|
|
15
|
+
get JsonlFileItemReader () {
|
|
16
|
+
return JsonlFileItemReader;
|
|
17
|
+
},
|
|
18
|
+
get RestartableFileLineReader () {
|
|
19
|
+
return RestartableFileLineReader;
|
|
20
|
+
},
|
|
21
|
+
get parseDelimitedLine () {
|
|
22
|
+
return parseDelimitedLine;
|
|
23
|
+
},
|
|
24
|
+
get splitLines () {
|
|
25
|
+
return splitLines;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const _promises = require("node:fs/promises");
|
|
29
|
+
const _checkpoint = require("./checkpoint");
|
|
30
|
+
let RestartableFileLineReader = class RestartableFileLineReader {
|
|
31
|
+
options;
|
|
32
|
+
lines = [];
|
|
33
|
+
index = 0;
|
|
34
|
+
constructor(options){
|
|
35
|
+
this.options = options;
|
|
36
|
+
}
|
|
37
|
+
async open(context) {
|
|
38
|
+
const raw = await (0, _promises.readFile)(this.options.path, this.options.encoding ?? 'utf8');
|
|
39
|
+
this.lines = splitLines(raw);
|
|
40
|
+
this.index = (0, _checkpoint.readCheckpointNumber)(context, this.checkpointKey, 'index', this.options.skipLines ?? 0);
|
|
41
|
+
}
|
|
42
|
+
async read() {
|
|
43
|
+
while(this.index < this.lines.length){
|
|
44
|
+
const lineIndex = this.index;
|
|
45
|
+
const line = this.lines[this.index];
|
|
46
|
+
this.index += 1;
|
|
47
|
+
if (this.options.skipBlankLines === true && line.trim().length === 0) continue;
|
|
48
|
+
if (this.options.mapLine !== undefined) {
|
|
49
|
+
const mapped = await this.options.mapLine(line, lineIndex);
|
|
50
|
+
if (mapped === null) continue;
|
|
51
|
+
return mapped;
|
|
52
|
+
}
|
|
53
|
+
return line;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
update(context) {
|
|
58
|
+
return (0, _checkpoint.writeCheckpoint)(context, this.checkpointKey, {
|
|
59
|
+
index: this.index
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
close() {
|
|
63
|
+
this.lines = [];
|
|
64
|
+
}
|
|
65
|
+
get checkpointKey() {
|
|
66
|
+
return this.options.checkpointKey ?? `file-line:${this.options.path}`;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
let CsvFileItemReader = class CsvFileItemReader {
|
|
70
|
+
options;
|
|
71
|
+
lines = [];
|
|
72
|
+
headers = [];
|
|
73
|
+
index = 0;
|
|
74
|
+
constructor(options){
|
|
75
|
+
this.options = options;
|
|
76
|
+
}
|
|
77
|
+
async open(context) {
|
|
78
|
+
const raw = await (0, _promises.readFile)(this.options.path, this.options.encoding ?? 'utf8');
|
|
79
|
+
this.lines = splitLines(raw);
|
|
80
|
+
const hasHeader = this.options.hasHeader ?? this.options.headers === undefined;
|
|
81
|
+
this.headers = this.options.headers ?? (this.lines.length > 0 ? parseDelimitedLine(this.lines[0], this.delimiter) : []);
|
|
82
|
+
const firstDataLine = hasHeader ? 1 : 0;
|
|
83
|
+
this.index = (0, _checkpoint.readCheckpointNumber)(context, this.checkpointKey, 'index', firstDataLine);
|
|
84
|
+
}
|
|
85
|
+
async read() {
|
|
86
|
+
while(this.index < this.lines.length){
|
|
87
|
+
const lineIndex = this.index;
|
|
88
|
+
const line = this.lines[this.index];
|
|
89
|
+
this.index += 1;
|
|
90
|
+
if (this.options.skipBlankLines !== false && line.trim().length === 0) continue;
|
|
91
|
+
const fields = parseDelimitedLine(line, this.delimiter);
|
|
92
|
+
const row = {};
|
|
93
|
+
for(let i = 0; i < this.headers.length; i += 1){
|
|
94
|
+
row[this.headers[i]] = fields[i] ?? '';
|
|
95
|
+
}
|
|
96
|
+
if (this.options.mapRow !== undefined) {
|
|
97
|
+
const mapped = await this.options.mapRow(row, lineIndex);
|
|
98
|
+
if (mapped === null) continue;
|
|
99
|
+
return mapped;
|
|
100
|
+
}
|
|
101
|
+
return row;
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
update(context) {
|
|
106
|
+
return (0, _checkpoint.writeCheckpoint)(context, this.checkpointKey, {
|
|
107
|
+
index: this.index
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
close() {
|
|
111
|
+
this.lines = [];
|
|
112
|
+
this.headers = [];
|
|
113
|
+
}
|
|
114
|
+
get checkpointKey() {
|
|
115
|
+
return this.options.checkpointKey ?? `csv:${this.options.path}`;
|
|
116
|
+
}
|
|
117
|
+
get delimiter() {
|
|
118
|
+
return this.options.delimiter ?? ',';
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
let JsonlFileItemReader = class JsonlFileItemReader extends RestartableFileLineReader {
|
|
122
|
+
constructor(options){
|
|
123
|
+
super({
|
|
124
|
+
...options,
|
|
125
|
+
skipBlankLines: true,
|
|
126
|
+
mapLine: (line)=>JSON.parse(line)
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
function splitLines(raw) {
|
|
131
|
+
const text = typeof raw === 'string' ? raw : raw.toString('utf8');
|
|
132
|
+
const withoutBom = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;
|
|
133
|
+
return withoutBom.replace(/\r\n/g, '\n').replace(/\r/g, '\n').split('\n');
|
|
134
|
+
}
|
|
135
|
+
function parseDelimitedLine(line, delimiter = ',') {
|
|
136
|
+
const out = [];
|
|
137
|
+
let field = '';
|
|
138
|
+
let quoted = false;
|
|
139
|
+
for(let i = 0; i < line.length; i += 1){
|
|
140
|
+
const ch = line[i];
|
|
141
|
+
if (quoted) {
|
|
142
|
+
if (ch === '"' && line[i + 1] === '"') {
|
|
143
|
+
field += '"';
|
|
144
|
+
i += 1;
|
|
145
|
+
} else if (ch === '"') {
|
|
146
|
+
quoted = false;
|
|
147
|
+
} else {
|
|
148
|
+
field += ch;
|
|
149
|
+
}
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (ch === '"') {
|
|
153
|
+
quoted = true;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (ch === delimiter) {
|
|
157
|
+
out.push(field);
|
|
158
|
+
field = '';
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
field += ch;
|
|
162
|
+
}
|
|
163
|
+
out.push(field);
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=file-readers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/io/file-readers.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\n\nimport type { ExecutionContext, ItemReader, ItemStream } from '../core';\n\nimport { readCheckpointNumber, writeCheckpoint } from './checkpoint';\n\nexport interface RestartableFileLineReaderOptions<T = string> {\n readonly path: string;\n readonly encoding?: BufferEncoding;\n readonly checkpointKey?: string;\n readonly skipLines?: number;\n readonly skipBlankLines?: boolean;\n readonly mapLine?: (line: string, lineIndex: number) => T | null | Promise<T | null>;\n}\n\nexport class RestartableFileLineReader<T = string>\n implements ItemReader<T>, ItemStream\n{\n private lines: string[] = [];\n private index = 0;\n\n constructor(private readonly options: RestartableFileLineReaderOptions<T>) {}\n\n async open(context: ExecutionContext): Promise<void> {\n const raw = await readFile(this.options.path, this.options.encoding ?? 'utf8');\n this.lines = splitLines(raw);\n this.index = readCheckpointNumber(\n context,\n this.checkpointKey,\n 'index',\n this.options.skipLines ?? 0,\n );\n }\n\n async read(): Promise<T | null> {\n while (this.index < this.lines.length) {\n const lineIndex = this.index;\n const line = this.lines[this.index]!;\n this.index += 1;\n if (this.options.skipBlankLines === true && line.trim().length === 0) continue;\n if (this.options.mapLine !== undefined) {\n const mapped = await this.options.mapLine(line, lineIndex);\n if (mapped === null) continue;\n return mapped;\n }\n return line as T;\n }\n return null;\n }\n\n update(context: ExecutionContext): ExecutionContext {\n return writeCheckpoint(context, this.checkpointKey, { index: this.index });\n }\n\n close(): void {\n this.lines = [];\n }\n\n private get checkpointKey(): string {\n return this.options.checkpointKey ?? `file-line:${this.options.path}`;\n }\n}\n\nexport interface CsvFileItemReaderOptions<T extends Record<string, unknown>> {\n readonly path: string;\n readonly encoding?: BufferEncoding;\n readonly checkpointKey?: string;\n readonly delimiter?: string;\n readonly headers?: readonly string[];\n readonly hasHeader?: boolean;\n readonly skipBlankLines?: boolean;\n readonly mapRow?: (\n row: Record<string, string>,\n lineIndex: number,\n ) => T | null | Promise<T | null>;\n}\n\nexport class CsvFileItemReader<T extends Record<string, unknown> = Record<string, string>>\n implements ItemReader<T>, ItemStream\n{\n private lines: string[] = [];\n private headers: readonly string[] = [];\n private index = 0;\n\n constructor(private readonly options: CsvFileItemReaderOptions<T>) {}\n\n async open(context: ExecutionContext): Promise<void> {\n const raw = await readFile(this.options.path, this.options.encoding ?? 'utf8');\n this.lines = splitLines(raw);\n const hasHeader = this.options.hasHeader ?? this.options.headers === undefined;\n this.headers =\n this.options.headers ??\n (this.lines.length > 0\n ? parseDelimitedLine(this.lines[0]!, this.delimiter)\n : []);\n const firstDataLine = hasHeader ? 1 : 0;\n this.index = readCheckpointNumber(context, this.checkpointKey, 'index', firstDataLine);\n }\n\n async read(): Promise<T | null> {\n while (this.index < this.lines.length) {\n const lineIndex = this.index;\n const line = this.lines[this.index]!;\n this.index += 1;\n if (this.options.skipBlankLines !== false && line.trim().length === 0) continue;\n const fields = parseDelimitedLine(line, this.delimiter);\n const row: Record<string, string> = {};\n for (let i = 0; i < this.headers.length; i += 1) {\n row[this.headers[i]!] = fields[i] ?? '';\n }\n if (this.options.mapRow !== undefined) {\n const mapped = await this.options.mapRow(row, lineIndex);\n if (mapped === null) continue;\n return mapped;\n }\n return row as T;\n }\n return null;\n }\n\n update(context: ExecutionContext): ExecutionContext {\n return writeCheckpoint(context, this.checkpointKey, { index: this.index });\n }\n\n close(): void {\n this.lines = [];\n this.headers = [];\n }\n\n private get checkpointKey(): string {\n return this.options.checkpointKey ?? `csv:${this.options.path}`;\n }\n\n private get delimiter(): string {\n return this.options.delimiter ?? ',';\n }\n}\n\nexport interface JsonlFileItemReaderOptions<T> {\n readonly path: string;\n readonly encoding?: BufferEncoding;\n readonly checkpointKey?: string;\n}\n\nexport class JsonlFileItemReader<T = unknown> extends RestartableFileLineReader<T> {\n constructor(options: JsonlFileItemReaderOptions<T>) {\n super({\n ...options,\n skipBlankLines: true,\n mapLine: (line) => JSON.parse(line) as T,\n });\n }\n}\n\nexport function splitLines(raw: string | Buffer): string[] {\n const text = typeof raw === 'string' ? raw : raw.toString('utf8');\n const withoutBom = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n return withoutBom.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n').split('\\n');\n}\n\nexport function parseDelimitedLine(line: string, delimiter = ','): string[] {\n const out: string[] = [];\n let field = '';\n let quoted = false;\n for (let i = 0; i < line.length; i += 1) {\n const ch = line[i]!;\n if (quoted) {\n if (ch === '\"' && line[i + 1] === '\"') {\n field += '\"';\n i += 1;\n } else if (ch === '\"') {\n quoted = false;\n } else {\n field += ch;\n }\n continue;\n }\n if (ch === '\"') {\n quoted = true;\n continue;\n }\n if (ch === delimiter) {\n out.push(field);\n field = '';\n continue;\n }\n field += ch;\n }\n out.push(field);\n return out;\n}\n"],"names":["CsvFileItemReader","JsonlFileItemReader","RestartableFileLineReader","parseDelimitedLine","splitLines","lines","index","options","open","context","raw","readFile","path","encoding","readCheckpointNumber","checkpointKey","skipLines","read","length","lineIndex","line","skipBlankLines","trim","mapLine","undefined","mapped","update","writeCheckpoint","close","headers","hasHeader","delimiter","firstDataLine","fields","row","i","mapRow","JSON","parse","text","toString","withoutBom","charCodeAt","slice","replace","split","out","field","quoted","ch","push"],"mappings":";;;;;;;;;;;QA6EaA;eAAAA;;QAmEAC;eAAAA;;QAjIAC;eAAAA;;QAiJGC;eAAAA;;QANAC;eAAAA;;;0BA1JS;4BAI6B;AAW/C,IAAA,AAAMF,4BAAN,MAAMA;;IAGHG,QAAkB,EAAE,CAAC;IACrBC,QAAQ,EAAE;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,CAAC,SAAS,MAAMA,OAAO,CAAC,OAAO,MAAMC,KAAK,CAAC;AACtE;AAEO,SAAS1C,mBAAmBiB,IAAY,EAAEW,YAAY,GAAG;IAC9D,MAAMe,MAAgB,EAAE;IACxB,IAAIC,QAAQ;IACZ,IAAIC,SAAS;IACb,IAAK,IAAIb,IAAI,GAAGA,IAAIf,KAAKF,MAAM,EAAEiB,KAAK,EAAG;QACvC,MAAMc,KAAK7B,IAAI,CAACe,EAAE;QAClB,IAAIa,QAAQ;YACV,IAAIC,OAAO,OAAO7B,IAAI,CAACe,IAAI,EAAE,KAAK,KAAK;gBACrCY,SAAS;gBACTZ,KAAK;YACP,OAAO,IAAIc,OAAO,KAAK;gBACrBD,SAAS;YACX,OAAO;gBACLD,SAASE;YACX;YACA;QACF;QACA,IAAIA,OAAO,KAAK;YACdD,SAAS;YACT;QACF;QACA,IAAIC,OAAOlB,WAAW;YACpBe,IAAII,IAAI,CAACH;YACTA,QAAQ;YACR;QACF;QACAA,SAASE;IACX;IACAH,IAAII,IAAI,CAACH;IACT,OAAOD;AACT"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ExecutionContext, ItemStream, ItemWriter, WriterResult } from '../core';
|
|
2
|
+
export interface JsonlFileItemWriterOptions {
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly encoding?: BufferEncoding;
|
|
5
|
+
}
|
|
6
|
+
export declare class JsonlFileItemWriter<T = unknown> implements ItemWriter<T> {
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(options: JsonlFileItemWriterOptions);
|
|
9
|
+
write(items: T[]): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface CsvFileItemWriterOptions<T extends Record<string, unknown>> {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly headers: readonly (keyof T & string)[];
|
|
14
|
+
readonly encoding?: BufferEncoding;
|
|
15
|
+
readonly delimiter?: string;
|
|
16
|
+
readonly checkpointKey?: string;
|
|
17
|
+
readonly writeHeader?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class CsvFileItemWriter<T extends Record<string, unknown>> implements ItemWriter<T>, ItemStream {
|
|
20
|
+
private readonly options;
|
|
21
|
+
private headerWritten;
|
|
22
|
+
constructor(options: CsvFileItemWriterOptions<T>);
|
|
23
|
+
open(context: ExecutionContext): void;
|
|
24
|
+
write(items: T[]): Promise<WriterResult | void>;
|
|
25
|
+
update(context: ExecutionContext): ExecutionContext;
|
|
26
|
+
close(): void;
|
|
27
|
+
private get checkpointKey();
|
|
28
|
+
private get delimiter();
|
|
29
|
+
}
|
|
30
|
+
export declare function escapeCsvValue(value: unknown, delimiter?: string): string;
|
|
31
|
+
//# sourceMappingURL=file-writers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writers.d.ts","sourceRoot":"","sources":["../../../src/io/file-writers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKtF,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;CACpC;AAED,qBAAa,mBAAmB,CAAC,CAAC,GAAG,OAAO,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,0BAA0B;IAE1D,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvC;AAED,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,qBAAa,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC9D,YAAW,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU;IAIxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,aAAa,CAAS;gBAED,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC;IAEjE,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAS/B,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAqBrD,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB;IAMnD,KAAK,IAAI,IAAI;IAIb,OAAO,KAAK,aAAa,GAExB;IAED,OAAO,KAAK,SAAS,GAEpB;CACF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,SAAM,GAAG,MAAM,CAWtE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 CsvFileItemWriter () {
|
|
13
|
+
return CsvFileItemWriter;
|
|
14
|
+
},
|
|
15
|
+
get JsonlFileItemWriter () {
|
|
16
|
+
return JsonlFileItemWriter;
|
|
17
|
+
},
|
|
18
|
+
get escapeCsvValue () {
|
|
19
|
+
return escapeCsvValue;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _promises = require("node:fs/promises");
|
|
23
|
+
const _checkpoint = require("./checkpoint");
|
|
24
|
+
const _filereaders = require("./file-readers");
|
|
25
|
+
let JsonlFileItemWriter = class JsonlFileItemWriter {
|
|
26
|
+
options;
|
|
27
|
+
constructor(options){
|
|
28
|
+
this.options = options;
|
|
29
|
+
}
|
|
30
|
+
async write(items) {
|
|
31
|
+
if (items.length === 0) return;
|
|
32
|
+
const body = `${items.map((item)=>JSON.stringify(item)).join('\n')}\n`;
|
|
33
|
+
await (0, _promises.appendFile)(this.options.path, body, this.options.encoding ?? 'utf8');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
let CsvFileItemWriter = class CsvFileItemWriter {
|
|
37
|
+
options;
|
|
38
|
+
headerWritten = false;
|
|
39
|
+
constructor(options){
|
|
40
|
+
this.options = options;
|
|
41
|
+
}
|
|
42
|
+
open(context) {
|
|
43
|
+
this.headerWritten = (0, _checkpoint.readCheckpointValue)(context, this.checkpointKey, 'headerWritten', false);
|
|
44
|
+
}
|
|
45
|
+
async write(items) {
|
|
46
|
+
if (items.length === 0) return;
|
|
47
|
+
const lines = [];
|
|
48
|
+
if ((this.options.writeHeader ?? true) && !this.headerWritten) {
|
|
49
|
+
lines.push(this.options.headers.map((h)=>escapeCsvValue(h, this.delimiter)).join(this.delimiter));
|
|
50
|
+
this.headerWritten = true;
|
|
51
|
+
}
|
|
52
|
+
for (const item of items){
|
|
53
|
+
lines.push(this.options.headers.map((h)=>escapeCsvValue(item[h], this.delimiter)).join(this.delimiter));
|
|
54
|
+
}
|
|
55
|
+
await (0, _promises.appendFile)(this.options.path, `${lines.join('\n')}\n`, this.options.encoding ?? 'utf8');
|
|
56
|
+
}
|
|
57
|
+
update(context) {
|
|
58
|
+
return (0, _checkpoint.writeCheckpoint)(context, this.checkpointKey, {
|
|
59
|
+
headerWritten: this.headerWritten
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
close() {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
get checkpointKey() {
|
|
66
|
+
return this.options.checkpointKey ?? `csv-writer:${this.options.path}`;
|
|
67
|
+
}
|
|
68
|
+
get delimiter() {
|
|
69
|
+
return this.options.delimiter ?? ',';
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function escapeCsvValue(value, delimiter = ',') {
|
|
73
|
+
const text = value === null || value === undefined ? '' : String(value);
|
|
74
|
+
if (text.includes('"') || text.includes('\n') || text.includes('\r') || (0, _filereaders.parseDelimitedLine)(text, delimiter).length > 1) {
|
|
75
|
+
return `"${text.replace(/"/g, '""')}"`;
|
|
76
|
+
}
|
|
77
|
+
return text;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=file-writers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/io/file-writers.ts"],"sourcesContent":["import { appendFile } from 'node:fs/promises';\n\nimport type { ExecutionContext, ItemStream, ItemWriter, WriterResult } from '../core';\n\nimport { readCheckpointValue, writeCheckpoint } from './checkpoint';\nimport { parseDelimitedLine } from './file-readers';\n\nexport interface JsonlFileItemWriterOptions {\n readonly path: string;\n readonly encoding?: BufferEncoding;\n}\n\nexport class JsonlFileItemWriter<T = unknown> implements ItemWriter<T> {\n constructor(private readonly options: JsonlFileItemWriterOptions) {}\n\n async write(items: T[]): Promise<void> {\n if (items.length === 0) return;\n const body = `${items.map((item) => JSON.stringify(item)).join('\\n')}\\n`;\n await appendFile(this.options.path, body, this.options.encoding ?? 'utf8');\n }\n}\n\nexport interface CsvFileItemWriterOptions<T extends Record<string, unknown>> {\n readonly path: string;\n readonly headers: readonly (keyof T & string)[];\n readonly encoding?: BufferEncoding;\n readonly delimiter?: string;\n readonly checkpointKey?: string;\n readonly writeHeader?: boolean;\n}\n\nexport class CsvFileItemWriter<T extends Record<string, unknown>>\n implements ItemWriter<T>, ItemStream\n{\n private headerWritten = false;\n\n constructor(private readonly options: CsvFileItemWriterOptions<T>) {}\n\n open(context: ExecutionContext): void {\n this.headerWritten = readCheckpointValue(\n context,\n this.checkpointKey,\n 'headerWritten',\n false,\n );\n }\n\n async write(items: T[]): Promise<WriterResult | void> {\n if (items.length === 0) return;\n const lines: string[] = [];\n if ((this.options.writeHeader ?? true) && !this.headerWritten) {\n lines.push(this.options.headers.map((h) => escapeCsvValue(h, this.delimiter)).join(this.delimiter));\n this.headerWritten = true;\n }\n for (const item of items) {\n lines.push(\n this.options.headers\n .map((h) => escapeCsvValue(item[h], this.delimiter))\n .join(this.delimiter),\n );\n }\n await appendFile(\n this.options.path,\n `${lines.join('\\n')}\\n`,\n this.options.encoding ?? 'utf8',\n );\n }\n\n update(context: ExecutionContext): ExecutionContext {\n return writeCheckpoint(context, this.checkpointKey, {\n headerWritten: this.headerWritten,\n });\n }\n\n close(): void {\n return undefined;\n }\n\n private get checkpointKey(): string {\n return this.options.checkpointKey ?? `csv-writer:${this.options.path}`;\n }\n\n private get delimiter(): string {\n return this.options.delimiter ?? ',';\n }\n}\n\nexport function escapeCsvValue(value: unknown, delimiter = ','): string {\n const text = value === null || value === undefined ? '' : String(value);\n if (\n text.includes('\"') ||\n text.includes('\\n') ||\n text.includes('\\r') ||\n parseDelimitedLine(text, delimiter).length > 1\n ) {\n return `\"${text.replace(/\"/g, '\"\"')}\"`;\n }\n return text;\n}\n"],"names":["CsvFileItemWriter","JsonlFileItemWriter","escapeCsvValue","options","write","items","length","body","map","item","JSON","stringify","join","appendFile","path","encoding","headerWritten","open","context","readCheckpointValue","checkpointKey","lines","writeHeader","push","headers","h","delimiter","update","writeCheckpoint","close","undefined","value","text","String","includes","parseDelimitedLine","replace"],"mappings":";;;;;;;;;;;QA+BaA;eAAAA;;QAnBAC;eAAAA;;QA2EGC;eAAAA;;;0BAvFW;4BAI0B;6BAClB;AAO5B,IAAA,AAAMD,sBAAN,MAAMA;;IACX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;QACA,MAAMb,IAAAA,oBAAU,EACd,IAAI,CAACV,OAAO,CAACW,IAAI,EACjB,GAAGO,MAAMT,IAAI,CAAC,MAAM,EAAE,CAAC,EACvB,IAAI,CAACT,OAAO,CAACY,QAAQ,IAAI;IAE7B;IAEAY,OAAOT,OAAyB,EAAoB;QAClD,OAAOU,IAAAA,2BAAe,EAACV,SAAS,IAAI,CAACE,aAAa,EAAE;YAClDJ,eAAe,IAAI,CAACA,aAAa;QACnC;IACF;IAEAa,QAAc;QACZ,OAAOC;IACT;IAEA,IAAYV,gBAAwB;QAClC,OAAO,IAAI,CAACjB,OAAO,CAACiB,aAAa,IAAI,CAAC,WAAW,EAAE,IAAI,CAACjB,OAAO,CAACW,IAAI,EAAE;IACxE;IAEA,IAAYY,YAAoB;QAC9B,OAAO,IAAI,CAACvB,OAAO,CAACuB,SAAS,IAAI;IACnC;AACF;AAEO,SAASxB,eAAe6B,KAAc,EAAEL,YAAY,GAAG;IAC5D,MAAMM,OAAOD,UAAU,QAAQA,UAAUD,YAAY,KAAKG,OAAOF;IACjE,IACEC,KAAKE,QAAQ,CAAC,QACdF,KAAKE,QAAQ,CAAC,SACdF,KAAKE,QAAQ,CAAC,SACdC,IAAAA,+BAAkB,EAACH,MAAMN,WAAWpB,MAAM,GAAG,GAC7C;QACA,OAAO,CAAC,CAAC,EAAE0B,KAAKI,OAAO,CAAC,MAAM,MAAM,CAAC,CAAC;IACxC;IACA,OAAOJ;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/io/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./checkpoint"), exports);
|
|
6
|
+
_export_star(require("./file-readers"), exports);
|
|
7
|
+
_export_star(require("./file-writers"), exports);
|
|
8
|
+
_export_star(require("./s3"), exports);
|
|
9
|
+
_export_star(require("./database"), exports);
|
|
10
|
+
function _export_star(from, to) {
|
|
11
|
+
Object.keys(from).forEach(function(k) {
|
|
12
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
13
|
+
Object.defineProperty(to, k, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return from[k];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return from;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/io/index.ts"],"sourcesContent":["export * from './checkpoint';\nexport * from './file-readers';\nexport * from './file-writers';\nexport * from './s3';\nexport * from './database';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ExecutionContext, ItemReader, ItemStream, ItemWriter } from '../core';
|
|
2
|
+
export interface S3ObjectLocation {
|
|
3
|
+
readonly bucket: string;
|
|
4
|
+
readonly key: string;
|
|
5
|
+
}
|
|
6
|
+
export interface S3GetObjectInput extends S3ObjectLocation {
|
|
7
|
+
}
|
|
8
|
+
export interface S3PutObjectInput extends S3ObjectLocation {
|
|
9
|
+
readonly body: string | Uint8Array;
|
|
10
|
+
readonly contentType?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface S3ObjectClient {
|
|
13
|
+
getObject(input: S3GetObjectInput): Promise<{
|
|
14
|
+
readonly body: string | Uint8Array;
|
|
15
|
+
}>;
|
|
16
|
+
putObject(input: S3PutObjectInput): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export interface S3JsonlItemReaderOptions<T> extends S3ObjectLocation {
|
|
19
|
+
readonly client: S3ObjectClient;
|
|
20
|
+
readonly checkpointKey?: string;
|
|
21
|
+
readonly mapItem?: (item: unknown, lineIndex: number) => T | Promise<T>;
|
|
22
|
+
}
|
|
23
|
+
export declare class S3JsonlItemReader<T = unknown> implements ItemReader<T>, ItemStream {
|
|
24
|
+
private readonly options;
|
|
25
|
+
private lines;
|
|
26
|
+
private index;
|
|
27
|
+
constructor(options: S3JsonlItemReaderOptions<T>);
|
|
28
|
+
open(context: ExecutionContext): Promise<void>;
|
|
29
|
+
read(): Promise<T | null>;
|
|
30
|
+
update(context: ExecutionContext): ExecutionContext;
|
|
31
|
+
close(): void;
|
|
32
|
+
private get checkpointKey();
|
|
33
|
+
}
|
|
34
|
+
export interface S3ChunkJsonlItemWriterOptions {
|
|
35
|
+
readonly client: S3ObjectClient;
|
|
36
|
+
readonly bucket: string;
|
|
37
|
+
readonly keyPrefix: string;
|
|
38
|
+
readonly checkpointKey?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class S3ChunkJsonlItemWriter<T = unknown> implements ItemWriter<T>, ItemStream {
|
|
41
|
+
private readonly options;
|
|
42
|
+
private chunkIndex;
|
|
43
|
+
constructor(options: S3ChunkJsonlItemWriterOptions);
|
|
44
|
+
open(context: ExecutionContext): void;
|
|
45
|
+
write(items: T[]): Promise<void>;
|
|
46
|
+
update(context: ExecutionContext): ExecutionContext;
|
|
47
|
+
close(): void;
|
|
48
|
+
private get checkpointKey();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=s3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../src/io/s3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKpF,MAAM,WAAW,gBAAgB;IAC/B,QAA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AInD,KAAK,IAAI,IAAI;IAIb,OAAO,KAAK,aAAa,GAExB;CACF;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,qBAAa,sBAAsB,CAAC,CAAC,GAAG,OAAO,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU;IAGvE,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,UAAU,CAAK;gBAEM,OAAO,EAAE,6BAA6B;IAEnE,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAI/B,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAatC,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB;IAMnD,KAAK,IAAI,IAAI;IAIb,OAAO,KAAK,aAAa,GAExB;CACF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
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 S3ChunkJsonlItemWriter () {
|
|
13
|
+
return S3ChunkJsonlItemWriter;
|
|
14
|
+
},
|
|
15
|
+
get S3JsonlItemReader () {
|
|
16
|
+
return S3JsonlItemReader;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _checkpoint = require("./checkpoint");
|
|
20
|
+
const _filereaders = require("./file-readers");
|
|
21
|
+
let S3JsonlItemReader = class S3JsonlItemReader {
|
|
22
|
+
options;
|
|
23
|
+
lines = [];
|
|
24
|
+
index = 0;
|
|
25
|
+
constructor(options){
|
|
26
|
+
this.options = options;
|
|
27
|
+
}
|
|
28
|
+
async open(context) {
|
|
29
|
+
const object = await this.options.client.getObject({
|
|
30
|
+
bucket: this.options.bucket,
|
|
31
|
+
key: this.options.key
|
|
32
|
+
});
|
|
33
|
+
this.lines = (0, _filereaders.splitLines)(bodyToString(object.body));
|
|
34
|
+
this.index = (0, _checkpoint.readCheckpointNumber)(context, this.checkpointKey, 'index', 0);
|
|
35
|
+
}
|
|
36
|
+
async read() {
|
|
37
|
+
while(this.index < this.lines.length){
|
|
38
|
+
const lineIndex = this.index;
|
|
39
|
+
const line = this.lines[this.index];
|
|
40
|
+
this.index += 1;
|
|
41
|
+
if (line.trim().length === 0) continue;
|
|
42
|
+
const parsed = JSON.parse(line);
|
|
43
|
+
return this.options.mapItem !== undefined ? this.options.mapItem(parsed, lineIndex) : parsed;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
update(context) {
|
|
48
|
+
return (0, _checkpoint.writeCheckpoint)(context, this.checkpointKey, {
|
|
49
|
+
index: this.index
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
close() {
|
|
53
|
+
this.lines = [];
|
|
54
|
+
}
|
|
55
|
+
get checkpointKey() {
|
|
56
|
+
return this.options.checkpointKey ?? `s3-jsonl:${this.options.bucket}/${this.options.key}`;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
let S3ChunkJsonlItemWriter = class S3ChunkJsonlItemWriter {
|
|
60
|
+
options;
|
|
61
|
+
chunkIndex = 0;
|
|
62
|
+
constructor(options){
|
|
63
|
+
this.options = options;
|
|
64
|
+
}
|
|
65
|
+
open(context) {
|
|
66
|
+
this.chunkIndex = (0, _checkpoint.readCheckpointNumber)(context, this.checkpointKey, 'chunkIndex', 0);
|
|
67
|
+
}
|
|
68
|
+
async write(items) {
|
|
69
|
+
if (items.length === 0) return;
|
|
70
|
+
const key = `${this.options.keyPrefix.replace(/\/+$/g, '')}/chunk-${String(this.chunkIndex).padStart(6, '0')}.jsonl`;
|
|
71
|
+
const body = `${items.map((item)=>JSON.stringify(item)).join('\n')}\n`;
|
|
72
|
+
await this.options.client.putObject({
|
|
73
|
+
bucket: this.options.bucket,
|
|
74
|
+
key,
|
|
75
|
+
body,
|
|
76
|
+
contentType: 'application/x-ndjson'
|
|
77
|
+
});
|
|
78
|
+
this.chunkIndex += 1;
|
|
79
|
+
}
|
|
80
|
+
update(context) {
|
|
81
|
+
return (0, _checkpoint.writeCheckpoint)(context, this.checkpointKey, {
|
|
82
|
+
chunkIndex: this.chunkIndex
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
close() {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
get checkpointKey() {
|
|
89
|
+
return this.options.checkpointKey ?? `s3-jsonl-writer:${this.options.bucket}/${this.options.keyPrefix}`;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
function bodyToString(body) {
|
|
93
|
+
return typeof body === 'string' ? body : Buffer.from(body).toString('utf8');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=s3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/io/s3.ts"],"sourcesContent":["import type { ExecutionContext, ItemReader, ItemStream, ItemWriter } from '../core';\n\nimport { readCheckpointNumber, writeCheckpoint } from './checkpoint';\nimport { splitLines } from './file-readers';\n\nexport interface S3ObjectLocation {\n readonly bucket: string;\n readonly key: string;\n}\n\nexport interface S3GetObjectInput extends S3ObjectLocation {}\n\nexport interface S3PutObjectInput extends S3ObjectLocation {\n readonly body: string | Uint8Array;\n readonly contentType?: string;\n}\n\nexport interface S3ObjectClient {\n getObject(input: S3GetObjectInput): Promise<{ readonly body: string | Uint8Array }>;\n putObject(input: S3PutObjectInput): Promise<void>;\n}\n\nexport interface S3JsonlItemReaderOptions<T> extends S3ObjectLocation {\n readonly client: S3ObjectClient;\n readonly checkpointKey?: string;\n readonly mapItem?: (item: unknown, lineIndex: number) => T | Promise<T>;\n}\n\nexport class S3JsonlItemReader<T = unknown> implements ItemReader<T>, ItemStream {\n private lines: string[] = [];\n private index = 0;\n\n constructor(private readonly options: S3JsonlItemReaderOptions<T>) {}\n\n async open(context: ExecutionContext): Promise<void> {\n const object = await this.options.client.getObject({\n bucket: this.options.bucket,\n key: this.options.key,\n });\n this.lines = splitLines(bodyToString(object.body));\n this.index = readCheckpointNumber(context, this.checkpointKey, 'index', 0);\n }\n\n async read(): Promise<T | null> {\n while (this.index < this.lines.length) {\n const lineIndex = this.index;\n const line = this.lines[this.index]!;\n this.index += 1;\n if (line.trim().length === 0) continue;\n const parsed = JSON.parse(line) as unknown;\n return this.options.mapItem !== undefined\n ? this.options.mapItem(parsed, lineIndex)\n : (parsed as T);\n }\n return null;\n }\n\n update(context: ExecutionContext): ExecutionContext {\n return writeCheckpoint(context, this.checkpointKey, { index: this.index });\n }\n\n close(): void {\n this.lines = [];\n }\n\n private get checkpointKey(): string {\n return this.options.checkpointKey ?? `s3-jsonl:${this.options.bucket}/${this.options.key}`;\n }\n}\n\nexport interface S3ChunkJsonlItemWriterOptions {\n readonly client: S3ObjectClient;\n readonly bucket: string;\n readonly keyPrefix: string;\n readonly checkpointKey?: string;\n}\n\nexport class S3ChunkJsonlItemWriter<T = unknown> implements ItemWriter<T>, ItemStream {\n private chunkIndex = 0;\n\n constructor(private readonly options: S3ChunkJsonlItemWriterOptions) {}\n\n open(context: ExecutionContext): void {\n this.chunkIndex = readCheckpointNumber(context, this.checkpointKey, 'chunkIndex', 0);\n }\n\n async write(items: T[]): Promise<void> {\n if (items.length === 0) return;\n const key = `${this.options.keyPrefix.replace(/\\/+$/g, '')}/chunk-${String(this.chunkIndex).padStart(6, '0')}.jsonl`;\n const body = `${items.map((item) => JSON.stringify(item)).join('\\n')}\\n`;\n await this.options.client.putObject({\n bucket: this.options.bucket,\n key,\n body,\n contentType: 'application/x-ndjson',\n });\n this.chunkIndex += 1;\n }\n\n update(context: ExecutionContext): ExecutionContext {\n return writeCheckpoint(context, this.checkpointKey, {\n chunkIndex: this.chunkIndex,\n });\n }\n\n close(): void {\n return undefined;\n }\n\n private get checkpointKey(): string {\n return this.options.checkpointKey ?? `s3-jsonl-writer:${this.options.bucket}/${this.options.keyPrefix}`;\n }\n}\n\nfunction bodyToString(body: string | Uint8Array): string {\n return typeof body === 'string' ? body : Buffer.from(body).toString('utf8');\n}\n"],"names":["S3ChunkJsonlItemWriter","S3JsonlItemReader","lines","index","options","open","context","object","client","getObject","bucket","key","splitLines","bodyToString","body","readCheckpointNumber","checkpointKey","read","length","lineIndex","line","trim","parsed","JSON","parse","mapItem","undefined","update","writeCheckpoint","close","chunkIndex","write","items","keyPrefix","replace","String","padStart","map","item","stringify","join","putObject","contentType","Buffer","from","toString"],"mappings":";;;;;;;;;;;QA6EaA;eAAAA;;QAjDAC;eAAAA;;;4BA1ByC;6BAC3B;AAyBpB,IAAA,AAAMA,oBAAN,MAAMA;;IACHC,QAAkB,EAAE,CAAC;IACrBC,QAAQ,EAAE;IAElB,YAAY,AAAiBC,OAAoC,CAAE;aAAtCA,UAAAA;IAAuC;IAEpE,MAAMC,KAAKC,OAAyB,EAAiB;QACnD,MAAMC,SAAS,MAAM,IAAI,CAACH,OAAO,CAACI,MAAM,CAACC,SAAS,CAAC;YACjDC,QAAQ,IAAI,CAACN,OAAO,CAACM,MAAM;YAC3BC,KAAK,IAAI,CAACP,OAAO,CAACO,GAAG;QACvB;QACA,IAAI,CAACT,KAAK,GAAGU,IAAAA,uBAAU,EAACC,aAAaN,OAAOO,IAAI;QAChD,IAAI,CAACX,KAAK,GAAGY,IAAAA,gCAAoB,EAACT,SAAS,IAAI,CAACU,aAAa,EAAE,SAAS;IAC1E;IAEA,MAAMC,OAA0B;QAC9B,MAAO,IAAI,CA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ACL,UAAU,EAAEM,QAAQ,CAAC,GAAG,KAAK,MAAM,CAAC;QACpH,MAAMtB,OAAO,GAAGkB,MAAMK,GAAG,CAAC,CAACC,OAASf,KAAKgB,SAAS,CAACD,OAAOE,IAAI,CAAC,MAAM,EAAE,CAAC;QACxE,MAAM,IAAI,CAACpC,OAAO,CAACI,MAAM,CAACiC,SAAS,CAAC;YAClC/B,QAAQ,IAAI,CAACN,OAAO,CAACM,MAAM;YAC3BC;YACAG;YACA4B,aAAa;QACf;QACA,IAAI,CAACZ,UAAU,IAAI;IACrB;IAEAH,OAAOrB,OAAyB,EAAoB;QAClD,OAAOsB,IAAAA,2BAAe,EAACtB,SAAS,IAAI,CAACU,aAAa,EAAE;YAClDc,YAAY,IAAI,CAACA,UAAU;QAC7B;IACF;IAEAD,QAAc;QACZ,OAAOH;IACT;IAEA,IAAYV,gBAAwB;QAClC,OAAO,IAAI,CAACZ,OAAO,CAACY,aAAa,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAACZ,OAAO,CAACM,MAAM,CAAC,CAAC,EAAE,IAAI,CAACN,OAAO,CAAC6B,SAAS,EAAE;IACzG;AACF;AAEA,SAASpB,aAAaC,IAAyB;IAC7C,OAAO,OAAOA,SAAS,WAAWA,OAAO6B,OAAOC,IAAI,CAAC9B,MAAM+B,QAAQ,CAAC;AACtE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emits a one-line `log` / `warn` entry for every lifecycle event. The method
|
|
3
|
+
* names match the 7 `LifecyclePhaseKind` values plus the 3 `SkipSubKind`
|
|
4
|
+
* variants, so callers can register any of them under a `ResolverMap` key
|
|
5
|
+
* like `before:step:LoggingListener` and the invoker will dispatch correctly.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LoggingListener {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
beforeJob(ctx: {
|
|
10
|
+
jobExecutionId: string;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
afterJob(ctx: {
|
|
13
|
+
jobExecutionId: string;
|
|
14
|
+
}, result: {
|
|
15
|
+
status: string;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
beforeStep(ctx: {
|
|
18
|
+
jobExecutionId: string;
|
|
19
|
+
stepExecutionId: string;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
afterStep(ctx: {
|
|
22
|
+
jobExecutionId: string;
|
|
23
|
+
stepExecutionId: string;
|
|
24
|
+
}, result: {
|
|
25
|
+
status: string;
|
|
26
|
+
exitCode: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
onSkipInRead(err: unknown, item: unknown): Promise<void>;
|
|
29
|
+
onSkipInProcess(item: unknown, err: unknown): Promise<void>;
|
|
30
|
+
onSkipInWrite(items: unknown[], err: unknown): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Per-step read / write / skip counters. The counts are keyed by
|
|
34
|
+
* `stepExecutionId`, so multiple step executions within the same job are
|
|
35
|
+
* tracked independently. Callers can read the latest counts via
|
|
36
|
+
* `getCounts(stepExecutionId)`.
|
|
37
|
+
*/
|
|
38
|
+
export declare class MetricsListener {
|
|
39
|
+
private readonly stepCounts;
|
|
40
|
+
/**
|
|
41
|
+
* Store the counts reported by the step result. Missing fields default to 0
|
|
42
|
+
* so a partial result (e.g. a tasklet step that has no read/write/skip
|
|
43
|
+
* counts) does not pollute the metric with `NaN`/`undefined`.
|
|
44
|
+
*/
|
|
45
|
+
afterStep(ctx: {
|
|
46
|
+
stepExecutionId: string;
|
|
47
|
+
}, result: {
|
|
48
|
+
readCount?: number;
|
|
49
|
+
writeCount?: number;
|
|
50
|
+
skipCount?: number;
|
|
51
|
+
status: string;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
/** Returns the latest recorded counts for the given step, or `undefined` if
|
|
54
|
+
* the step has not been observed yet. */
|
|
55
|
+
getCounts(stepExecutionId: string): {
|
|
56
|
+
read: number;
|
|
57
|
+
write: number;
|
|
58
|
+
skip: number;
|
|
59
|
+
} | undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Records the wall-clock duration of each step. `beforeStep` captures
|
|
63
|
+
* `Date.now()`; `afterStep` returns the elapsed milliseconds (or 0 if no
|
|
64
|
+
* matching `beforeStep` was observed — this keeps the listener idempotent
|
|
65
|
+
* even when invoked out of order, e.g. after a process restart that replayed
|
|
66
|
+
* a partial log).
|
|
67
|
+
*/
|
|
68
|
+
export declare class TimingListener {
|
|
69
|
+
private readonly startTimes;
|
|
70
|
+
beforeStep(ctx: {
|
|
71
|
+
stepExecutionId: string;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
afterStep(ctx: {
|
|
74
|
+
stepExecutionId: string;
|
|
75
|
+
}): Promise<number>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=builtin-listeners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-listeners.d.ts","sourceRoot":"","sources":["../../../src/listeners/builtin-listeners.ts"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,qBACa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAGrD,SAAS,CAAC,GAAG,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD,QAAQ,CACZ,GAAG,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,EAC/B,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GACzB,OAAO,CAAC,IAAI,CAAC;IAKV,UAAU,CAAC,GAAG,EAAE;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIX,SAAS,CACb,GAAG,EAAE;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,EACxD,MAAM,EAAE;QAAE,MAAM,EAAE,MA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