@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.
Files changed (476) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +368 -0
  3. package/dist/src/adapters/in-process.adapter.d.ts +140 -0
  4. package/dist/src/adapters/in-process.adapter.d.ts.map +1 -0
  5. package/dist/src/adapters/in-process.adapter.js +86 -0
  6. package/dist/src/adapters/in-process.adapter.js.map +1 -0
  7. package/dist/src/adapters/index.d.ts +18 -0
  8. package/dist/src/adapters/index.d.ts.map +1 -0
  9. package/dist/src/adapters/index.js +35 -0
  10. package/dist/src/adapters/index.js.map +1 -0
  11. package/dist/src/builder/batch-builder.d.ts +26 -0
  12. package/dist/src/builder/batch-builder.d.ts.map +1 -0
  13. package/dist/src/builder/batch-builder.js +25 -0
  14. package/dist/src/builder/batch-builder.js.map +1 -0
  15. package/dist/src/builder/flow-builder.d.ts +59 -0
  16. package/dist/src/builder/flow-builder.d.ts.map +1 -0
  17. package/dist/src/builder/flow-builder.js +115 -0
  18. package/dist/src/builder/flow-builder.js.map +1 -0
  19. package/dist/src/builder/index.d.ts +5 -0
  20. package/dist/src/builder/index.d.ts.map +1 -0
  21. package/dist/src/builder/index.js +23 -0
  22. package/dist/src/builder/index.js.map +1 -0
  23. package/dist/src/builder/job-builder.d.ts +76 -0
  24. package/dist/src/builder/job-builder.d.ts.map +1 -0
  25. package/dist/src/builder/job-builder.js +166 -0
  26. package/dist/src/builder/job-builder.js.map +1 -0
  27. package/dist/src/builder/step-builder.d.ts +74 -0
  28. package/dist/src/builder/step-builder.d.ts.map +1 -0
  29. package/dist/src/builder/step-builder.js +144 -0
  30. package/dist/src/builder/step-builder.js.map +1 -0
  31. package/dist/src/compiler/builder-types.d.ts +20 -0
  32. package/dist/src/compiler/builder-types.d.ts.map +1 -0
  33. package/dist/src/compiler/builder-types.js +6 -0
  34. package/dist/src/compiler/builder-types.js.map +1 -0
  35. package/dist/src/compiler/definition-compiler.d.ts +99 -0
  36. package/dist/src/compiler/definition-compiler.d.ts.map +1 -0
  37. package/dist/src/compiler/definition-compiler.js +257 -0
  38. package/dist/src/compiler/definition-compiler.js.map +1 -0
  39. package/dist/src/compiler/index.d.ts +3 -0
  40. package/dist/src/compiler/index.d.ts.map +1 -0
  41. package/dist/src/compiler/index.js +21 -0
  42. package/dist/src/compiler/index.js.map +1 -0
  43. package/dist/src/core/errors.d.ts +77 -0
  44. package/dist/src/core/errors.d.ts.map +1 -0
  45. package/dist/src/core/errors.js +170 -0
  46. package/dist/src/core/errors.js.map +1 -0
  47. package/dist/src/core/execution-context/index.d.ts +4 -0
  48. package/dist/src/core/execution-context/index.d.ts.map +1 -0
  49. package/dist/src/core/execution-context/index.js +22 -0
  50. package/dist/src/core/execution-context/index.js.map +1 -0
  51. package/dist/src/core/execution-context/json-value.d.ts +5 -0
  52. package/dist/src/core/execution-context/json-value.d.ts.map +1 -0
  53. package/dist/src/core/execution-context/json-value.js +6 -0
  54. package/dist/src/core/execution-context/json-value.js.map +1 -0
  55. package/dist/src/core/execution-context/serializer.d.ts +4 -0
  56. package/dist/src/core/execution-context/serializer.d.ts.map +1 -0
  57. package/dist/src/core/execution-context/serializer.js +34 -0
  58. package/dist/src/core/execution-context/serializer.js.map +1 -0
  59. package/dist/src/core/execution-context/validator.d.ts +18 -0
  60. package/dist/src/core/execution-context/validator.d.ts.map +1 -0
  61. package/dist/src/core/execution-context/validator.js +90 -0
  62. package/dist/src/core/execution-context/validator.js.map +1 -0
  63. package/dist/src/core/index.d.ts +8 -0
  64. package/dist/src/core/index.d.ts.map +1 -0
  65. package/dist/src/core/index.js +26 -0
  66. package/dist/src/core/index.js.map +1 -0
  67. package/dist/src/core/ir/decider-definition.d.ts +20 -0
  68. package/dist/src/core/ir/decider-definition.d.ts.map +1 -0
  69. package/dist/src/core/ir/decider-definition.js +6 -0
  70. package/dist/src/core/ir/decider-definition.js.map +1 -0
  71. package/dist/src/core/ir/index.d.ts +8 -0
  72. package/dist/src/core/ir/index.d.ts.map +1 -0
  73. package/dist/src/core/ir/index.js +26 -0
  74. package/dist/src/core/ir/index.js.map +1 -0
  75. package/dist/src/core/ir/job-definition.d.ts +15 -0
  76. package/dist/src/core/ir/job-definition.d.ts.map +1 -0
  77. package/dist/src/core/ir/job-definition.js +6 -0
  78. package/dist/src/core/ir/job-definition.js.map +1 -0
  79. package/dist/src/core/ir/listener-definition.d.ts +10 -0
  80. package/dist/src/core/ir/listener-definition.d.ts.map +1 -0
  81. package/dist/src/core/ir/listener-definition.js +6 -0
  82. package/dist/src/core/ir/listener-definition.js.map +1 -0
  83. package/dist/src/core/ir/policy-config.d.ts +24 -0
  84. package/dist/src/core/ir/policy-config.d.ts.map +1 -0
  85. package/dist/src/core/ir/policy-config.js +6 -0
  86. package/dist/src/core/ir/policy-config.js.map +1 -0
  87. package/dist/src/core/ir/refs.d.ts +42 -0
  88. package/dist/src/core/ir/refs.d.ts.map +1 -0
  89. package/dist/src/core/ir/refs.js +18 -0
  90. package/dist/src/core/ir/refs.js.map +1 -0
  91. package/dist/src/core/ir/step-definition.d.ts +59 -0
  92. package/dist/src/core/ir/step-definition.d.ts.map +1 -0
  93. package/dist/src/core/ir/step-definition.js +6 -0
  94. package/dist/src/core/ir/step-definition.js.map +1 -0
  95. package/dist/src/core/ir/transition-definition.d.ts +8 -0
  96. package/dist/src/core/ir/transition-definition.d.ts.map +1 -0
  97. package/dist/src/core/ir/transition-definition.js +6 -0
  98. package/dist/src/core/ir/transition-definition.js.map +1 -0
  99. package/dist/src/core/item/index.d.ts +2 -0
  100. package/dist/src/core/item/index.d.ts.map +1 -0
  101. package/dist/src/core/item/index.js +20 -0
  102. package/dist/src/core/item/index.js.map +1 -0
  103. package/dist/src/core/item/interfaces.d.ts +64 -0
  104. package/dist/src/core/item/interfaces.d.ts.map +1 -0
  105. package/dist/src/core/item/interfaces.js +6 -0
  106. package/dist/src/core/item/interfaces.js.map +1 -0
  107. package/dist/src/core/repository/index.d.ts +3 -0
  108. package/dist/src/core/repository/index.d.ts.map +1 -0
  109. package/dist/src/core/repository/index.js +21 -0
  110. package/dist/src/core/repository/index.js.map +1 -0
  111. package/dist/src/core/repository/job-repository.d.ts +60 -0
  112. package/dist/src/core/repository/job-repository.d.ts.map +1 -0
  113. package/dist/src/core/repository/job-repository.js +27 -0
  114. package/dist/src/core/repository/job-repository.js.map +1 -0
  115. package/dist/src/core/repository/types.d.ts +84 -0
  116. package/dist/src/core/repository/types.d.ts.map +1 -0
  117. package/dist/src/core/repository/types.js +6 -0
  118. package/dist/src/core/repository/types.js.map +1 -0
  119. package/dist/src/core/status.d.ts +29 -0
  120. package/dist/src/core/status.d.ts.map +1 -0
  121. package/dist/src/core/status.js +58 -0
  122. package/dist/src/core/status.js.map +1 -0
  123. package/dist/src/core/transaction/index.d.ts +2 -0
  124. package/dist/src/core/transaction/index.d.ts.map +1 -0
  125. package/dist/src/core/transaction/index.js +20 -0
  126. package/dist/src/core/transaction/index.js.map +1 -0
  127. package/dist/src/core/transaction/transaction-manager.d.ts +8 -0
  128. package/dist/src/core/transaction/transaction-manager.d.ts.map +1 -0
  129. package/dist/src/core/transaction/transaction-manager.js +14 -0
  130. package/dist/src/core/transaction/transaction-manager.js.map +1 -0
  131. package/dist/src/core/validation/definition-validator.d.ts +46 -0
  132. package/dist/src/core/validation/definition-validator.d.ts.map +1 -0
  133. package/dist/src/core/validation/definition-validator.js +177 -0
  134. package/dist/src/core/validation/definition-validator.js.map +1 -0
  135. package/dist/src/core/validation/index.d.ts +2 -0
  136. package/dist/src/core/validation/index.d.ts.map +1 -0
  137. package/dist/src/core/validation/index.js +20 -0
  138. package/dist/src/core/validation/index.js.map +1 -0
  139. package/dist/src/decorators/constants.d.ts +10 -0
  140. package/dist/src/decorators/constants.d.ts.map +1 -0
  141. package/dist/src/decorators/constants.js +50 -0
  142. package/dist/src/decorators/constants.js.map +1 -0
  143. package/dist/src/decorators/flow.decorator.d.ts +25 -0
  144. package/dist/src/decorators/flow.decorator.d.ts.map +1 -0
  145. package/dist/src/decorators/flow.decorator.js +19 -0
  146. package/dist/src/decorators/flow.decorator.js.map +1 -0
  147. package/dist/src/decorators/index.d.ts +8 -0
  148. package/dist/src/decorators/index.d.ts.map +1 -0
  149. package/dist/src/decorators/index.js +26 -0
  150. package/dist/src/decorators/index.js.map +1 -0
  151. package/dist/src/decorators/item.decorators.d.ts +32 -0
  152. package/dist/src/decorators/item.decorators.d.ts.map +1 -0
  153. package/dist/src/decorators/item.decorators.js +40 -0
  154. package/dist/src/decorators/item.decorators.js.map +1 -0
  155. package/dist/src/decorators/job.decorator.d.ts +11 -0
  156. package/dist/src/decorators/job.decorator.d.ts.map +1 -0
  157. package/dist/src/decorators/job.decorator.js +17 -0
  158. package/dist/src/decorators/job.decorator.js.map +1 -0
  159. package/dist/src/decorators/listener.decorators.d.ts +56 -0
  160. package/dist/src/decorators/listener.decorators.d.ts.map +1 -0
  161. package/dist/src/decorators/listener.decorators.js +157 -0
  162. package/dist/src/decorators/listener.decorators.js.map +1 -0
  163. package/dist/src/decorators/step.decorator.d.ts +25 -0
  164. package/dist/src/decorators/step.decorator.d.ts.map +1 -0
  165. package/dist/src/decorators/step.decorator.js +21 -0
  166. package/dist/src/decorators/step.decorator.js.map +1 -0
  167. package/dist/src/decorators/tasklet.decorator.d.ts +7 -0
  168. package/dist/src/decorators/tasklet.decorator.d.ts.map +1 -0
  169. package/dist/src/decorators/tasklet.decorator.js +21 -0
  170. package/dist/src/decorators/tasklet.decorator.js.map +1 -0
  171. package/dist/src/execution/batch-worker-runner.d.ts +27 -0
  172. package/dist/src/execution/batch-worker-runner.d.ts.map +1 -0
  173. package/dist/src/execution/batch-worker-runner.js +147 -0
  174. package/dist/src/execution/batch-worker-runner.js.map +1 -0
  175. package/dist/src/execution/chunk-step-executor.d.ts +86 -0
  176. package/dist/src/execution/chunk-step-executor.d.ts.map +1 -0
  177. package/dist/src/execution/chunk-step-executor.js +482 -0
  178. package/dist/src/execution/chunk-step-executor.js.map +1 -0
  179. package/dist/src/execution/execution-strategy.d.ts +110 -0
  180. package/dist/src/execution/execution-strategy.d.ts.map +1 -0
  181. package/dist/src/execution/execution-strategy.js +13 -0
  182. package/dist/src/execution/execution-strategy.js.map +1 -0
  183. package/dist/src/execution/external-task-execution-strategy.d.ts +36 -0
  184. package/dist/src/execution/external-task-execution-strategy.d.ts.map +1 -0
  185. package/dist/src/execution/external-task-execution-strategy.js +97 -0
  186. package/dist/src/execution/external-task-execution-strategy.js.map +1 -0
  187. package/dist/src/execution/in-process-execution-strategy.d.ts +129 -0
  188. package/dist/src/execution/in-process-execution-strategy.d.ts.map +1 -0
  189. package/dist/src/execution/in-process-execution-strategy.js +141 -0
  190. package/dist/src/execution/in-process-execution-strategy.js.map +1 -0
  191. package/dist/src/execution/index.d.ts +14 -0
  192. package/dist/src/execution/index.d.ts.map +1 -0
  193. package/dist/src/execution/index.js +32 -0
  194. package/dist/src/execution/index.js.map +1 -0
  195. package/dist/src/execution/job-executor.d.ts +145 -0
  196. package/dist/src/execution/job-executor.d.ts.map +1 -0
  197. package/dist/src/execution/job-executor.js +475 -0
  198. package/dist/src/execution/job-executor.js.map +1 -0
  199. package/dist/src/execution/job-explorer.d.ts +15 -0
  200. package/dist/src/execution/job-explorer.d.ts.map +1 -0
  201. package/dist/src/execution/job-explorer.js +84 -0
  202. package/dist/src/execution/job-explorer.js.map +1 -0
  203. package/dist/src/execution/job-key.d.ts +3 -0
  204. package/dist/src/execution/job-key.d.ts.map +1 -0
  205. package/dist/src/execution/job-key.js +43 -0
  206. package/dist/src/execution/job-key.js.map +1 -0
  207. package/dist/src/execution/job-launcher.d.ts +75 -0
  208. package/dist/src/execution/job-launcher.d.ts.map +1 -0
  209. package/dist/src/execution/job-launcher.js +112 -0
  210. package/dist/src/execution/job-launcher.js.map +1 -0
  211. package/dist/src/execution/job-operator.d.ts +22 -0
  212. package/dist/src/execution/job-operator.d.ts.map +1 -0
  213. package/dist/src/execution/job-operator.js +125 -0
  214. package/dist/src/execution/job-operator.js.map +1 -0
  215. package/dist/src/execution/listener-invoker.d.ts +164 -0
  216. package/dist/src/execution/listener-invoker.d.ts.map +1 -0
  217. package/dist/src/execution/listener-invoker.js +246 -0
  218. package/dist/src/execution/listener-invoker.js.map +1 -0
  219. package/dist/src/execution/ref-resolver.d.ts +40 -0
  220. package/dist/src/execution/ref-resolver.d.ts.map +1 -0
  221. package/dist/src/execution/ref-resolver.js +41 -0
  222. package/dist/src/execution/ref-resolver.js.map +1 -0
  223. package/dist/src/execution/tasklet-step-executor.d.ts +79 -0
  224. package/dist/src/execution/tasklet-step-executor.d.ts.map +1 -0
  225. package/dist/src/execution/tasklet-step-executor.js +138 -0
  226. package/dist/src/execution/tasklet-step-executor.js.map +1 -0
  227. package/dist/src/explorer/batch-explorer.d.ts +138 -0
  228. package/dist/src/explorer/batch-explorer.d.ts.map +1 -0
  229. package/dist/src/explorer/batch-explorer.js +167 -0
  230. package/dist/src/explorer/batch-explorer.js.map +1 -0
  231. package/dist/src/explorer/index.d.ts +2 -0
  232. package/dist/src/explorer/index.d.ts.map +1 -0
  233. package/dist/src/explorer/index.js +20 -0
  234. package/dist/src/explorer/index.js.map +1 -0
  235. package/dist/src/flow/flow-evaluator.d.ts +30 -0
  236. package/dist/src/flow/flow-evaluator.d.ts.map +1 -0
  237. package/dist/src/flow/flow-evaluator.js +80 -0
  238. package/dist/src/flow/flow-evaluator.js.map +1 -0
  239. package/dist/src/flow/index.d.ts +2 -0
  240. package/dist/src/flow/index.d.ts.map +1 -0
  241. package/dist/src/flow/index.js +20 -0
  242. package/dist/src/flow/index.js.map +1 -0
  243. package/dist/src/index.d.ts +18 -0
  244. package/dist/src/index.d.ts.map +1 -0
  245. package/dist/src/index.js +90 -0
  246. package/dist/src/index.js.map +1 -0
  247. package/dist/src/io/checkpoint.d.ts +7 -0
  248. package/dist/src/io/checkpoint.d.ts.map +1 -0
  249. package/dist/src/io/checkpoint.js +56 -0
  250. package/dist/src/io/checkpoint.js.map +1 -0
  251. package/dist/src/io/database.d.ts +50 -0
  252. package/dist/src/io/database.d.ts.map +1 -0
  253. package/dist/src/io/database.js +108 -0
  254. package/dist/src/io/database.js.map +1 -0
  255. package/dist/src/io/file-readers.d.ts +54 -0
  256. package/dist/src/io/file-readers.d.ts.map +1 -0
  257. package/dist/src/io/file-readers.js +167 -0
  258. package/dist/src/io/file-readers.js.map +1 -0
  259. package/dist/src/io/file-writers.d.ts +31 -0
  260. package/dist/src/io/file-writers.d.ts.map +1 -0
  261. package/dist/src/io/file-writers.js +80 -0
  262. package/dist/src/io/file-writers.js.map +1 -0
  263. package/dist/src/io/index.d.ts +6 -0
  264. package/dist/src/io/index.d.ts.map +1 -0
  265. package/dist/src/io/index.js +24 -0
  266. package/dist/src/io/index.js.map +1 -0
  267. package/dist/src/io/s3.d.ts +50 -0
  268. package/dist/src/io/s3.d.ts.map +1 -0
  269. package/dist/src/io/s3.js +96 -0
  270. package/dist/src/io/s3.js.map +1 -0
  271. package/dist/src/listeners/builtin-listeners.d.ts +77 -0
  272. package/dist/src/listeners/builtin-listeners.d.ts.map +1 -0
  273. package/dist/src/listeners/builtin-listeners.js +108 -0
  274. package/dist/src/listeners/builtin-listeners.js.map +1 -0
  275. package/dist/src/listeners/index.d.ts +8 -0
  276. package/dist/src/listeners/index.d.ts.map +1 -0
  277. package/dist/src/listeners/index.js +25 -0
  278. package/dist/src/listeners/index.js.map +1 -0
  279. package/dist/src/module/adapter-options.d.ts +39 -0
  280. package/dist/src/module/adapter-options.d.ts.map +1 -0
  281. package/dist/src/module/adapter-options.js +34 -0
  282. package/dist/src/module/adapter-options.js.map +1 -0
  283. package/dist/src/module/adapter.d.ts +157 -0
  284. package/dist/src/module/adapter.d.ts.map +1 -0
  285. package/dist/src/module/adapter.js +80 -0
  286. package/dist/src/module/adapter.js.map +1 -0
  287. package/dist/src/module/batch-schedule-registry.d.ts +110 -0
  288. package/dist/src/module/batch-schedule-registry.d.ts.map +1 -0
  289. package/dist/src/module/batch-schedule-registry.js +0 -0
  290. package/dist/src/module/batch-schedule-registry.js.map +1 -0
  291. package/dist/src/module/index.d.ts +14 -0
  292. package/dist/src/module/index.d.ts.map +1 -0
  293. package/dist/src/module/index.js +31 -0
  294. package/dist/src/module/index.js.map +1 -0
  295. package/dist/src/module/nest-batch.module.d.ts +236 -0
  296. package/dist/src/module/nest-batch.module.d.ts.map +1 -0
  297. package/dist/src/module/nest-batch.module.js +475 -0
  298. package/dist/src/module/nest-batch.module.js.map +1 -0
  299. package/dist/src/module/tokens.d.ts +83 -0
  300. package/dist/src/module/tokens.d.ts.map +1 -0
  301. package/dist/src/module/tokens.js +58 -0
  302. package/dist/src/module/tokens.js.map +1 -0
  303. package/dist/src/observability/event-types.d.ts +55 -0
  304. package/dist/src/observability/event-types.d.ts.map +1 -0
  305. package/dist/src/observability/event-types.js +36 -0
  306. package/dist/src/observability/event-types.js.map +1 -0
  307. package/dist/src/observability/exporters.d.ts +35 -0
  308. package/dist/src/observability/exporters.d.ts.map +1 -0
  309. package/dist/src/observability/exporters.js +93 -0
  310. package/dist/src/observability/exporters.js.map +1 -0
  311. package/dist/src/observability/index.d.ts +3 -0
  312. package/dist/src/observability/index.d.ts.map +1 -0
  313. package/dist/src/observability/index.js +21 -0
  314. package/dist/src/observability/index.js.map +1 -0
  315. package/dist/src/partition-helpers.d.ts +127 -0
  316. package/dist/src/partition-helpers.d.ts.map +1 -0
  317. package/dist/src/partition-helpers.js +136 -0
  318. package/dist/src/partition-helpers.js.map +1 -0
  319. package/dist/src/policies/backoff.d.ts +3 -0
  320. package/dist/src/policies/backoff.d.ts.map +1 -0
  321. package/dist/src/policies/backoff.js +34 -0
  322. package/dist/src/policies/backoff.js.map +1 -0
  323. package/dist/src/policies/index.d.ts +4 -0
  324. package/dist/src/policies/index.d.ts.map +1 -0
  325. package/dist/src/policies/index.js +22 -0
  326. package/dist/src/policies/index.js.map +1 -0
  327. package/dist/src/policies/retry-policy.d.ts +13 -0
  328. package/dist/src/policies/retry-policy.d.ts.map +1 -0
  329. package/dist/src/policies/retry-policy.js +55 -0
  330. package/dist/src/policies/retry-policy.js.map +1 -0
  331. package/dist/src/policies/skip-policy.d.ts +12 -0
  332. package/dist/src/policies/skip-policy.d.ts.map +1 -0
  333. package/dist/src/policies/skip-policy.js +44 -0
  334. package/dist/src/policies/skip-policy.js.map +1 -0
  335. package/dist/src/registry/index.d.ts +2 -0
  336. package/dist/src/registry/index.d.ts.map +1 -0
  337. package/dist/src/registry/index.js +20 -0
  338. package/dist/src/registry/index.js.map +1 -0
  339. package/dist/src/registry/job-registry.d.ts +16 -0
  340. package/dist/src/registry/job-registry.d.ts.map +1 -0
  341. package/dist/src/registry/job-registry.js +50 -0
  342. package/dist/src/registry/job-registry.js.map +1 -0
  343. package/dist/src/repository/id-generator.d.ts +18 -0
  344. package/dist/src/repository/id-generator.d.ts.map +1 -0
  345. package/dist/src/repository/id-generator.js +37 -0
  346. package/dist/src/repository/id-generator.js.map +1 -0
  347. package/dist/src/repository/in-memory/in-memory-job-repository.d.ts +49 -0
  348. package/dist/src/repository/in-memory/in-memory-job-repository.d.ts.map +1 -0
  349. package/dist/src/repository/in-memory/in-memory-job-repository.js +291 -0
  350. package/dist/src/repository/in-memory/in-memory-job-repository.js.map +1 -0
  351. package/dist/src/repository/in-memory/index.d.ts +2 -0
  352. package/dist/src/repository/in-memory/index.d.ts.map +1 -0
  353. package/dist/src/repository/in-memory/index.js +20 -0
  354. package/dist/src/repository/in-memory/index.js.map +1 -0
  355. package/dist/src/repository/index.d.ts +4 -0
  356. package/dist/src/repository/index.d.ts.map +1 -0
  357. package/dist/src/repository/index.js +22 -0
  358. package/dist/src/repository/index.js.map +1 -0
  359. package/dist/src/repository/uuid-v7.d.ts +20 -0
  360. package/dist/src/repository/uuid-v7.d.ts.map +1 -0
  361. package/dist/src/repository/uuid-v7.js +31 -0
  362. package/dist/src/repository/uuid-v7.js.map +1 -0
  363. package/dist/src/scheduling/batch-scheduled.d.ts +87 -0
  364. package/dist/src/scheduling/batch-scheduled.d.ts.map +1 -0
  365. package/dist/src/scheduling/batch-scheduled.js +170 -0
  366. package/dist/src/scheduling/batch-scheduled.js.map +1 -0
  367. package/dist/src/transaction/in-memory-transaction-manager.d.ts +16 -0
  368. package/dist/src/transaction/in-memory-transaction-manager.d.ts.map +1 -0
  369. package/dist/src/transaction/in-memory-transaction-manager.js +33 -0
  370. package/dist/src/transaction/in-memory-transaction-manager.js.map +1 -0
  371. package/dist/src/transaction/index.d.ts +2 -0
  372. package/dist/src/transaction/index.d.ts.map +1 -0
  373. package/dist/src/transaction/index.js +20 -0
  374. package/dist/src/transaction/index.js.map +1 -0
  375. package/dist/tests/contracts/index.d.ts +26 -0
  376. package/dist/tests/contracts/index.d.ts.map +1 -0
  377. package/dist/tests/contracts/index.js +37 -0
  378. package/dist/tests/contracts/index.js.map +1 -0
  379. package/dist/tests/contracts/job-repository.contract.d.ts +46 -0
  380. package/dist/tests/contracts/job-repository.contract.d.ts.map +1 -0
  381. package/dist/tests/contracts/job-repository.contract.js +644 -0
  382. package/dist/tests/contracts/job-repository.contract.js.map +1 -0
  383. package/package.json +80 -0
  384. package/src/adapters/in-process.adapter.ts +182 -0
  385. package/src/adapters/index.ts +17 -0
  386. package/src/builder/batch-builder.ts +32 -0
  387. package/src/builder/flow-builder.ts +141 -0
  388. package/src/builder/index.ts +4 -0
  389. package/src/builder/job-builder.ts +206 -0
  390. package/src/builder/step-builder.ts +190 -0
  391. package/src/compiler/builder-types.ts +27 -0
  392. package/src/compiler/definition-compiler.ts +325 -0
  393. package/src/compiler/index.ts +2 -0
  394. package/src/core/errors.ts +125 -0
  395. package/src/core/execution-context/index.ts +3 -0
  396. package/src/core/execution-context/json-value.ts +3 -0
  397. package/src/core/execution-context/serializer.ts +21 -0
  398. package/src/core/execution-context/validator.ts +103 -0
  399. package/src/core/index.ts +7 -0
  400. package/src/core/ir/decider-definition.ts +25 -0
  401. package/src/core/ir/index.ts +7 -0
  402. package/src/core/ir/job-definition.ts +15 -0
  403. package/src/core/ir/listener-definition.ts +19 -0
  404. package/src/core/ir/policy-config.ts +19 -0
  405. package/src/core/ir/refs.ts +42 -0
  406. package/src/core/ir/step-definition.ts +62 -0
  407. package/src/core/ir/transition-definition.ts +9 -0
  408. package/src/core/item/index.ts +1 -0
  409. package/src/core/item/interfaces.ts +70 -0
  410. package/src/core/repository/index.ts +2 -0
  411. package/src/core/repository/job-repository.ts +100 -0
  412. package/src/core/repository/types.ts +91 -0
  413. package/src/core/status.ts +31 -0
  414. package/src/core/transaction/index.ts +1 -0
  415. package/src/core/transaction/transaction-manager.ts +8 -0
  416. package/src/core/validation/definition-validator.ts +215 -0
  417. package/src/core/validation/index.ts +1 -0
  418. package/src/decorators/constants.ts +9 -0
  419. package/src/decorators/flow.decorator.ts +31 -0
  420. package/src/decorators/index.ts +7 -0
  421. package/src/decorators/item.decorators.ts +51 -0
  422. package/src/decorators/job.decorator.ts +16 -0
  423. package/src/decorators/listener.decorators.ts +142 -0
  424. package/src/decorators/step.decorator.ts +33 -0
  425. package/src/decorators/tasklet.decorator.ts +14 -0
  426. package/src/execution/batch-worker-runner.ts +142 -0
  427. package/src/execution/chunk-step-executor.ts +594 -0
  428. package/src/execution/execution-strategy.ts +115 -0
  429. package/src/execution/external-task-execution-strategy.ts +104 -0
  430. package/src/execution/in-process-execution-strategy.ts +207 -0
  431. package/src/execution/index.ts +13 -0
  432. package/src/execution/job-executor.ts +553 -0
  433. package/src/execution/job-explorer.ts +73 -0
  434. package/src/execution/job-key.ts +35 -0
  435. package/src/execution/job-launcher.ts +132 -0
  436. package/src/execution/job-operator.ts +127 -0
  437. package/src/execution/listener-invoker.ts +389 -0
  438. package/src/execution/ref-resolver.ts +64 -0
  439. package/src/execution/tasklet-step-executor.ts +182 -0
  440. package/src/explorer/batch-explorer.ts +251 -0
  441. package/src/explorer/index.ts +1 -0
  442. package/src/flow/flow-evaluator.ts +89 -0
  443. package/src/flow/index.ts +1 -0
  444. package/src/index.ts +24 -0
  445. package/src/io/checkpoint.ts +47 -0
  446. package/src/io/database.ts +114 -0
  447. package/src/io/file-readers.ts +191 -0
  448. package/src/io/file-writers.ts +99 -0
  449. package/src/io/index.ts +5 -0
  450. package/src/io/s3.ts +117 -0
  451. package/src/listeners/builtin-listeners.ts +151 -0
  452. package/src/listeners/index.ts +7 -0
  453. package/src/module/adapter-options.ts +38 -0
  454. package/src/module/adapter.ts +160 -0
  455. package/src/module/batch-schedule-registry.ts +0 -0
  456. package/src/module/index.ts +13 -0
  457. package/src/module/nest-batch.module.ts +674 -0
  458. package/src/module/tokens.ts +95 -0
  459. package/src/observability/event-types.ts +61 -0
  460. package/src/observability/exporters.ts +96 -0
  461. package/src/observability/index.ts +2 -0
  462. package/src/partition-helpers.ts +204 -0
  463. package/src/policies/backoff.ts +22 -0
  464. package/src/policies/index.ts +3 -0
  465. package/src/policies/retry-policy.ts +57 -0
  466. package/src/policies/skip-policy.ts +51 -0
  467. package/src/registry/index.ts +1 -0
  468. package/src/registry/job-registry.ts +42 -0
  469. package/src/repository/id-generator.ts +25 -0
  470. package/src/repository/in-memory/in-memory-job-repository.ts +334 -0
  471. package/src/repository/in-memory/index.ts +1 -0
  472. package/src/repository/index.ts +3 -0
  473. package/src/repository/uuid-v7.ts +40 -0
  474. package/src/scheduling/batch-scheduled.ts +257 -0
  475. package/src/transaction/in-memory-transaction-manager.ts +23 -0
  476. package/src/transaction/index.ts +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-evaluator.d.ts","sourceRoot":"","sources":["../../../src/flow/flow-evaluator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA8BvD;;;;;;;;;GASG;AACH,qBACa,aAAa;IACxB;;;;;;;;;;;;;OAaG;IACG,QAAQ,CACZ,WAAW,EAAE,oBAAoB,EAAE,EACnC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAqBzB,OAAO,CAAC,UAAU,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;CAMvF"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowEvaluator", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowEvaluator;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _errors = require("../core/errors");
13
+ function _ts_decorate(decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ 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;
17
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ }
19
+ function escapeRegex(value) {
20
+ return value.replace(/[|\\{}()[\]^$+.:]/g, '\\$&');
21
+ }
22
+ function matchesPattern(pattern, status) {
23
+ if (!pattern.includes('*') && !pattern.includes('?')) {
24
+ return pattern === status;
25
+ }
26
+ const source = pattern.split('').map((ch)=>{
27
+ if (ch === '*') return '.*';
28
+ if (ch === '?') return '.';
29
+ return escapeRegex(ch);
30
+ }).join('');
31
+ return new RegExp(`^${source}$`).test(status);
32
+ }
33
+ function patternSpecificity(pattern) {
34
+ let score = 0;
35
+ for (const ch of pattern){
36
+ if (ch !== '*' && ch !== '?') score += 1;
37
+ }
38
+ return pattern.includes('*') || pattern.includes('?') ? score : score + 1000;
39
+ }
40
+ let FlowEvaluator = class FlowEvaluator {
41
+ /**
42
+ * Evaluate the next step ID given the current step and exit status.
43
+ *
44
+ * - Returns `null` if the job should END — either no transition matches
45
+ * the (fromStepId, onStatus) pair, or the matching transition's
46
+ * `toStepId` is `null` (explicit END).
47
+ * - Supports `*` and `?` wildcards in `onStatus`. Exact matches win
48
+ * over wildcard matches. If multiple matches have the same
49
+ * specificity, the graph is ambiguous and the caller must fix it.
50
+ *
51
+ * @param transitions All transitions in the job's flow graph.
52
+ * @param fromStepId The current step's ID.
53
+ * @param status The current step's exit status.
54
+ */ async evaluate(transitions, fromStepId, status) {
55
+ const matches = transitions.filter((t)=>this.matches(t, fromStepId, status));
56
+ if (matches.length === 0) return null;
57
+ const ranked = matches.map((transition)=>({
58
+ transition,
59
+ specificity: patternSpecificity(transition.onStatus)
60
+ }));
61
+ const maxSpecificity = Math.max(...ranked.map((candidate)=>candidate.specificity));
62
+ const best = ranked.filter((candidate)=>candidate.specificity === maxSpecificity);
63
+ if (best.length > 1) {
64
+ throw new _errors.InvalidFlowGraphError('AMBIGUOUS_TRANSITION', `Ambiguous transition from "${fromStepId}" on status "${status}": ${best.length} matches`, {
65
+ fromStepId,
66
+ status,
67
+ count: best.length
68
+ });
69
+ }
70
+ return best[0].transition.toStepId;
71
+ }
72
+ matches(transition, fromStepId, status) {
73
+ return transition.fromStepId === fromStepId && matchesPattern(transition.onStatus, status);
74
+ }
75
+ };
76
+ FlowEvaluator = _ts_decorate([
77
+ (0, _common.Injectable)()
78
+ ], FlowEvaluator);
79
+
80
+ //# sourceMappingURL=flow-evaluator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/flow/flow-evaluator.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport type { TransitionDefinition } from '../core/ir';\nimport { InvalidFlowGraphError } from '../core/errors';\n\nfunction escapeRegex(value: string): string {\n return value.replace(/[|\\\\{}()[\\]^$+.:]/g, '\\\\$&');\n}\n\nfunction matchesPattern(pattern: string, status: string): boolean {\n if (!pattern.includes('*') && !pattern.includes('?')) {\n return pattern === status;\n }\n const source = pattern\n .split('')\n .map((ch) => {\n if (ch === '*') return '.*';\n if (ch === '?') return '.';\n return escapeRegex(ch);\n })\n .join('');\n return new RegExp(`^${source}$`).test(status);\n}\n\nfunction patternSpecificity(pattern: string): number {\n let score = 0;\n for (const ch of pattern) {\n if (ch !== '*' && ch !== '?') score += 1;\n }\n return pattern.includes('*') || pattern.includes('?') ? score : score + 1000;\n}\n\n/**\n * FlowEvaluator resolves the next step in a flow graph given the current step\n * and its exit status. It is a pure, side-effect-free decision function:\n * given the same inputs it always returns the same next step (or END).\n *\n * Per ORACLE verdict 3c, the API is uniformly async — even though the current\n * implementation is synchronous internally, returning a Promise keeps the\n * caller contract identical to future evaluators that may need to consult\n * remote state (e.g. conditional / data-driven transitions).\n */\n@Injectable()\nexport class FlowEvaluator {\n /**\n * Evaluate the next step ID given the current step and exit status.\n *\n * - Returns `null` if the job should END — either no transition matches\n * the (fromStepId, onStatus) pair, or the matching transition's\n * `toStepId` is `null` (explicit END).\n * - Supports `*` and `?` wildcards in `onStatus`. Exact matches win\n * over wildcard matches. If multiple matches have the same\n * specificity, the graph is ambiguous and the caller must fix it.\n *\n * @param transitions All transitions in the job's flow graph.\n * @param fromStepId The current step's ID.\n * @param status The current step's exit status.\n */\n async evaluate(\n transitions: TransitionDefinition[],\n fromStepId: string,\n status: string,\n ): Promise<string | null> {\n const matches = transitions.filter((t) => this.matches(t, fromStepId, status));\n if (matches.length === 0) return null;\n\n const ranked = matches.map((transition) => ({\n transition,\n specificity: patternSpecificity(transition.onStatus),\n }));\n const maxSpecificity = Math.max(...ranked.map((candidate) => candidate.specificity));\n const best = ranked.filter((candidate) => candidate.specificity === maxSpecificity);\n\n if (best.length > 1) {\n throw new InvalidFlowGraphError(\n 'AMBIGUOUS_TRANSITION',\n `Ambiguous transition from \"${fromStepId}\" on status \"${status}\": ${best.length} matches`,\n { fromStepId, status, count: best.length },\n );\n }\n return best[0]!.transition.toStepId;\n }\n\n matches(transition: TransitionDefinition, fromStepId: string, status: string): boolean {\n return (\n transition.fromStepId === fromStepId &&\n matchesPattern(transition.onStatus, status)\n );\n }\n}\n"],"names":["FlowEvaluator","escapeRegex","value","replace","matchesPattern","pattern","status","includes","source","split","map","ch","join","RegExp","test","patternSpecificity","score","evaluate","transitions","fromStepId","matches","filter","t","length","ranked","transition","specificity","onStatus","maxSpecificity","Math","max","candidate","best","InvalidFlowGraphError","count","toStepId"],"mappings":";;;;+BA0CaA;;;eAAAA;;;wBA1Cc;wBAEW;;;;;;;AAEtC,SAASC,YAAYC,KAAa;IAChC,OAAOA,MAAMC,OAAO,CAAC,sBAAsB;AAC7C;AAEA,SAASC,eAAeC,OAAe,EAAEC,MAAc;IACrD,IAAI,CAACD,QAAQE,QAAQ,CAAC,QAAQ,CAACF,QAAQE,QAAQ,CAAC,MAAM;QACpD,OAAOF,YAAYC;IACrB;IACA,MAAME,SAASH,QACZI,KAAK,CAAC,IACNC,GAAG,CAAC,CAACC;QACJ,IAAIA,OAAO,KAAK,OAAO;QACvB,IAAIA,OAAO,KAAK,OAAO;QACvB,OAAOV,YAAYU;IACrB,GACCC,IAAI,CAAC;IACR,OAAO,IAAIC,OAAO,CAAC,CAAC,EAAEL,OAAO,CAAC,CAAC,EAAEM,IAAI,CAACR;AACxC;AAEA,SAASS,mBAAmBV,OAAe;IACzC,IAAIW,QAAQ;IACZ,KAAK,MAAML,MAAMN,QAAS;QACxB,IAAIM,OAAO,OAAOA,OAAO,KAAKK,SAAS;IACzC;IACA,OAAOX,QAAQE,QAAQ,CAAC,QAAQF,QAAQE,QAAQ,CAAC,OAAOS,QAAQA,QAAQ;AAC1E;AAaO,IAAA,AAAMhB,gBAAN,MAAMA;IACX;;;;;;;;;;;;;GAaC,GACD,MAAMiB,SACJC,WAAmC,EACnCC,UAAkB,EAClBb,MAAc,EACU;QACxB,MAAMc,UAAUF,YAAYG,MAAM,CAAC,CAACC,IAAM,IAAI,CAACF,OAAO,CAACE,GAAGH,YAAYb;QACtE,IAAIc,QAAQG,MAAM,KAAK,GAAG,OAAO;QAEjC,MAAMC,SAASJ,QAAQV,GAAG,CAAC,CAACe,aAAgB,CAAA;gBAC1CA;gBACAC,aAAaX,mBAAmBU,WAAWE,QAAQ;YACrD,CAAA;QACA,MAAMC,iBAAiBC,KAAKC,GAAG,IAAIN,OAAOd,GAAG,CAAC,CAACqB,YAAcA,UAAUL,WAAW;QAClF,MAAMM,OAAOR,OAAOH,MAAM,CAAC,CAACU,YAAcA,UAAUL,WAAW,KAAKE;QAEpE,IAAII,KAAKT,MAAM,GAAG,GAAG;YACnB,MAAM,IAAIU,6BAAqB,CAC7B,wBACA,CAAC,2BAA2B,EAAEd,WAAW,aAAa,EAAEb,OAAO,GAAG,EAAE0B,KAAKT,MAAM,CAAC,QAAQ,CAAC,EACzF;gBAAEJ;gBAAYb;gBAAQ4B,OAAOF,KAAKT,MAAM;YAAC;QAE7C;QACA,OAAOS,IAAI,CAAC,EAAE,CAAEP,UAAU,CAACU,QAAQ;IACrC;IAEAf,QAAQK,UAAgC,EAAEN,UAAkB,EAAEb,MAAc,EAAW;QACrF,OACEmB,WAAWN,UAAU,KAAKA,cAC1Bf,eAAeqB,WAAWE,QAAQ,EAAErB;IAExC;AACF"}
@@ -0,0 +1,2 @@
1
+ export * from './flow-evaluator';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/flow/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./flow-evaluator"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/flow/index.ts"],"sourcesContent":["export * from './flow-evaluator';\n"],"names":[],"mappings":";;;;qBAAc"}
@@ -0,0 +1,18 @@
1
+ export * from './core';
2
+ export * from './compiler';
3
+ export * from './partition-helpers';
4
+ export * from './registry';
5
+ export * from './execution';
6
+ export * from './transaction';
7
+ export * from './repository';
8
+ export * as BatchDecorators from './decorators';
9
+ export * from './module';
10
+ export * from './builder';
11
+ export * from './explorer';
12
+ export * from './listeners';
13
+ export * from './policies';
14
+ export * from './flow';
15
+ export * from './observability';
16
+ export * from './adapters';
17
+ export * from './io';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,eAAe,MAAM,cAAc,CAAC;AAChD,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC"}
@@ -0,0 +1,90 @@
1
+ // Public API barrel for @nest-batch/core.
2
+ //
3
+ // Decorator functions (ItemReader, ItemProcessor, ItemWriter, Tasklet) live in
4
+ // ./decorators and share names with interfaces in ./core/item. To avoid name
5
+ // collisions in the public surface, decorators are re-exported under the
6
+ // `BatchDecorators` namespace; interfaces remain reachable as bare names from
7
+ // ./core/item (or via core/index).
8
+ "use strict";
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+ Object.defineProperty(exports, "BatchDecorators", {
13
+ enumerable: true,
14
+ get: function() {
15
+ return _decorators;
16
+ }
17
+ });
18
+ _export_star(require("./core"), exports);
19
+ _export_star(require("./compiler"), exports);
20
+ _export_star(require("./partition-helpers"), exports);
21
+ _export_star(require("./registry"), exports);
22
+ _export_star(require("./execution"), exports);
23
+ _export_star(require("./transaction"), exports);
24
+ _export_star(require("./repository"), exports);
25
+ const _decorators = /*#__PURE__*/ _interop_require_wildcard(require("./decorators"));
26
+ _export_star(require("./module"), exports);
27
+ _export_star(require("./builder"), exports);
28
+ _export_star(require("./explorer"), exports);
29
+ _export_star(require("./listeners"), exports);
30
+ _export_star(require("./policies"), exports);
31
+ _export_star(require("./flow"), exports);
32
+ _export_star(require("./observability"), exports);
33
+ _export_star(require("./adapters"), exports);
34
+ _export_star(require("./io"), exports);
35
+ function _export_star(from, to) {
36
+ Object.keys(from).forEach(function(k) {
37
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
38
+ Object.defineProperty(to, k, {
39
+ enumerable: true,
40
+ get: function() {
41
+ return from[k];
42
+ }
43
+ });
44
+ }
45
+ });
46
+ return from;
47
+ }
48
+ function _getRequireWildcardCache(nodeInterop) {
49
+ if (typeof WeakMap !== "function") return null;
50
+ var cacheBabelInterop = new WeakMap();
51
+ var cacheNodeInterop = new WeakMap();
52
+ return (_getRequireWildcardCache = function(nodeInterop) {
53
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
54
+ })(nodeInterop);
55
+ }
56
+ function _interop_require_wildcard(obj, nodeInterop) {
57
+ if (!nodeInterop && obj && obj.__esModule) {
58
+ return obj;
59
+ }
60
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
61
+ return {
62
+ default: obj
63
+ };
64
+ }
65
+ var cache = _getRequireWildcardCache(nodeInterop);
66
+ if (cache && cache.has(obj)) {
67
+ return cache.get(obj);
68
+ }
69
+ var newObj = {
70
+ __proto__: null
71
+ };
72
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
73
+ for(var key in obj){
74
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
75
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
76
+ if (desc && (desc.get || desc.set)) {
77
+ Object.defineProperty(newObj, key, desc);
78
+ } else {
79
+ newObj[key] = obj[key];
80
+ }
81
+ }
82
+ }
83
+ newObj.default = obj;
84
+ if (cache) {
85
+ cache.set(obj, newObj);
86
+ }
87
+ return newObj;
88
+ }
89
+
90
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Public API barrel for @nest-batch/core.\n//\n// Decorator functions (ItemReader, ItemProcessor, ItemWriter, Tasklet) live in\n// ./decorators and share names with interfaces in ./core/item. To avoid name\n// collisions in the public surface, decorators are re-exported under the\n// `BatchDecorators` namespace; interfaces remain reachable as bare names from\n// ./core/item (or via core/index).\nexport * from './core';\nexport * from './compiler';\nexport * from './partition-helpers';\nexport * from './registry';\nexport * from './execution';\nexport * from './transaction';\nexport * from './repository';\nexport * as BatchDecorators from './decorators';\nexport * from './module';\nexport * from './builder';\nexport * from './explorer';\nexport * from './listeners';\nexport * from './policies';\nexport * from './flow';\nexport * from './observability';\nexport * from './adapters';\nexport * from './io';\n"],"names":["BatchDecorators"],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,yEAAyE;AACzE,8EAA8E;AAC9E,mCAAmC;;;;;+BAQvBA;;;;;;qBAPE;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;oEACmB;qBACnB;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
@@ -0,0 +1,7 @@
1
+ import type { ExecutionContext, JsonValue } from '../core';
2
+ export declare function readCheckpoint(context: ExecutionContext, key: string): Record<string, JsonValue>;
3
+ export declare function readCheckpointNumber(context: ExecutionContext, key: string, field: string, fallback: number): number;
4
+ export declare function readCheckpointValue<T extends JsonValue>(context: ExecutionContext, key: string, field: string, fallback: T): T;
5
+ export declare function writeCheckpoint(context: ExecutionContext, key: string, state: Record<string, JsonValue>): ExecutionContext;
6
+ export declare function asJsonRecord(value: JsonValue | undefined): Record<string, JsonValue>;
7
+ //# sourceMappingURL=checkpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../src/io/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAI3B;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,MAAM,CAGR;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EACrD,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,GACV,CAAC,CAGH;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAC/B,gBAAgB,CAIlB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAKpF"}
@@ -0,0 +1,56 @@
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 asJsonRecord () {
13
+ return asJsonRecord;
14
+ },
15
+ get readCheckpoint () {
16
+ return readCheckpoint;
17
+ },
18
+ get readCheckpointNumber () {
19
+ return readCheckpointNumber;
20
+ },
21
+ get readCheckpointValue () {
22
+ return readCheckpointValue;
23
+ },
24
+ get writeCheckpoint () {
25
+ return writeCheckpoint;
26
+ }
27
+ });
28
+ function readCheckpoint(context, key) {
29
+ const root = asJsonRecord(context.data);
30
+ const value = root[key];
31
+ return asJsonRecord(value);
32
+ }
33
+ function readCheckpointNumber(context, key, field, fallback) {
34
+ const value = readCheckpoint(context, key)[field];
35
+ return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
36
+ }
37
+ function readCheckpointValue(context, key, field, fallback) {
38
+ const value = readCheckpoint(context, key)[field];
39
+ return value === undefined ? fallback : value;
40
+ }
41
+ function writeCheckpoint(context, key, state) {
42
+ const root = {
43
+ ...asJsonRecord(context.data),
44
+ [key]: state
45
+ };
46
+ context.data = root;
47
+ return context;
48
+ }
49
+ function asJsonRecord(value) {
50
+ if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
51
+ return value;
52
+ }
53
+ return {};
54
+ }
55
+
56
+ //# sourceMappingURL=checkpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/io/checkpoint.ts"],"sourcesContent":["import type { ExecutionContext, JsonValue } from '../core';\n\nexport function readCheckpoint(\n context: ExecutionContext,\n key: string,\n): Record<string, JsonValue> {\n const root = asJsonRecord(context.data);\n const value = root[key];\n return asJsonRecord(value);\n}\n\nexport function readCheckpointNumber(\n context: ExecutionContext,\n key: string,\n field: string,\n fallback: number,\n): number {\n const value = readCheckpoint(context, key)[field];\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback;\n}\n\nexport function readCheckpointValue<T extends JsonValue>(\n context: ExecutionContext,\n key: string,\n field: string,\n fallback: T,\n): T {\n const value = readCheckpoint(context, key)[field];\n return value === undefined ? fallback : (value as T);\n}\n\nexport function writeCheckpoint(\n context: ExecutionContext,\n key: string,\n state: Record<string, JsonValue>,\n): ExecutionContext {\n const root = { ...asJsonRecord(context.data), [key]: state };\n context.data = root;\n return context;\n}\n\nexport function asJsonRecord(value: JsonValue | undefined): Record<string, JsonValue> {\n if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n return value;\n }\n return {};\n}\n"],"names":["asJsonRecord","readCheckpoint","readCheckpointNumber","readCheckpointValue","writeCheckpoint","context","key","root","data","value","field","fallback","Number","isFinite","undefined","state","Array","isArray"],"mappings":";;;;;;;;;;;QAyCgBA;eAAAA;;QAvCAC;eAAAA;;QASAC;eAAAA;;QAUAC;eAAAA;;QAUAC;eAAAA;;;AA7BT,SAASH,eACdI,OAAyB,EACzBC,GAAW;IAEX,MAAMC,OAAOP,aAAaK,QAAQG,IAAI;IACtC,MAAMC,QAAQF,IAAI,CAACD,IAAI;IACvB,OAAON,aAAaS;AACtB;AAEO,SAASP,qBACdG,OAAyB,EACzBC,GAAW,EACXI,KAAa,EACbC,QAAgB;IAEhB,MAAMF,QAAQR,eAAeI,SAASC,IAAI,CAACI,MAAM;IACjD,OAAO,OAAOD,UAAU,YAAYG,OAAOC,QAAQ,CAACJ,SAASA,QAAQE;AACvE;AAEO,SAASR,oBACdE,OAAyB,EACzBC,GAAW,EACXI,KAAa,EACbC,QAAW;IAEX,MAAMF,QAAQR,eAAeI,SAASC,IAAI,CAACI,MAAM;IACjD,OAAOD,UAAUK,YAAYH,WAAYF;AAC3C;AAEO,SAASL,gBACdC,OAAyB,EACzBC,GAAW,EACXS,KAAgC;IAEhC,MAAMR,OAAO;QAAE,GAAGP,aAAaK,QAAQG,IAAI,CAAC;QAAE,CAACF,IAAI,EAAES;IAAM;IAC3DV,QAAQG,IAAI,GAAGD;IACf,OAAOF;AACT;AAEO,SAASL,aAAaS,KAA4B;IACvD,IAAIA,UAAU,QAAQ,OAAOA,UAAU,YAAY,CAACO,MAAMC,OAAO,CAACR,QAAQ;QACxE,OAAOA;IACT;IACA,OAAO,CAAC;AACV"}
@@ -0,0 +1,50 @@
1
+ import type { ExecutionContext, ItemReader, ItemStream, ItemWriter, WriterResult } from '../core';
2
+ import type { JsonValue } from '../core/execution-context';
3
+ export interface DatabasePagingItemReaderOptions<T> {
4
+ readonly pageSize: number;
5
+ readonly checkpointKey?: string;
6
+ fetchPage(args: {
7
+ offset: number;
8
+ limit: number;
9
+ }): Promise<readonly T[]>;
10
+ }
11
+ export declare class DatabasePagingItemReader<T> implements ItemReader<T>, ItemStream {
12
+ private readonly options;
13
+ private offset;
14
+ private buffer;
15
+ private bufferIndex;
16
+ constructor(options: DatabasePagingItemReaderOptions<T>);
17
+ open(context: ExecutionContext): void;
18
+ read(): Promise<T | null>;
19
+ update(context: ExecutionContext): ExecutionContext;
20
+ close(): void;
21
+ private get checkpointKey();
22
+ }
23
+ export interface DatabaseCursorItemReaderOptions<T> {
24
+ readonly pageSize: number;
25
+ readonly checkpointKey?: string;
26
+ readonly initialCursor?: JsonValue;
27
+ fetchAfter(cursor: JsonValue, limit: number): Promise<readonly T[]>;
28
+ getCursor(item: T): JsonValue;
29
+ }
30
+ export declare class DatabaseCursorItemReader<T> implements ItemReader<T>, ItemStream {
31
+ private readonly options;
32
+ private cursor;
33
+ private buffer;
34
+ private bufferIndex;
35
+ constructor(options: DatabaseCursorItemReaderOptions<T>);
36
+ open(context: ExecutionContext): void;
37
+ read(): Promise<T | null>;
38
+ update(context: ExecutionContext): ExecutionContext;
39
+ close(): void;
40
+ private get checkpointKey();
41
+ }
42
+ export interface DatabaseBatchItemWriterOptions<T> {
43
+ writeBatch(items: readonly T[]): Promise<WriterResult | void>;
44
+ }
45
+ export declare class DatabaseBatchItemWriter<T> implements ItemWriter<T> {
46
+ private readonly options;
47
+ constructor(options: DatabaseBatchItemWriterOptions<T>);
48
+ write(items: T[]): Promise<WriterResult | void>;
49
+ }
50
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":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EAAE,CAAC,CAAC;IACpE,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;CAC/B;AAED,qBAAa,wBAAwB,CAAC,CAAC,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU;IAK/D,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,WAAW,CAAK;gBAEK,OAAO,EAAE,+BAA+B,CAAC,CAAC,CAAC;IAExE,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAW/B,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAY/B,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB;IAInD,KAAK,IAAI,IAAI;IAIb,OAAO,KAAK,aAAa,GAExB;CACF;AAED,MAAM,WAAW,8BAA8B,CAAC,CAAC;IAC/C,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CAC/D;AAED,qBAAa,uBAAuB,CAAC,CAAC,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,8BAA8B,CAAC,CAAC,CAAC;IAEvE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CAGhD"}
@@ -0,0 +1,108 @@
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 DatabaseBatchItemWriter () {
13
+ return DatabaseBatchItemWriter;
14
+ },
15
+ get DatabaseCursorItemReader () {
16
+ return DatabaseCursorItemReader;
17
+ },
18
+ get DatabasePagingItemReader () {
19
+ return DatabasePagingItemReader;
20
+ }
21
+ });
22
+ const _checkpoint = require("./checkpoint");
23
+ let DatabasePagingItemReader = class DatabasePagingItemReader {
24
+ options;
25
+ offset = 0;
26
+ buffer = [];
27
+ bufferIndex = 0;
28
+ constructor(options){
29
+ this.options = options;
30
+ }
31
+ open(context) {
32
+ this.offset = (0, _checkpoint.readCheckpointNumber)(context, this.checkpointKey, 'offset', 0);
33
+ this.buffer = [];
34
+ this.bufferIndex = 0;
35
+ }
36
+ async read() {
37
+ if (this.bufferIndex >= this.buffer.length) {
38
+ this.buffer = await this.options.fetchPage({
39
+ offset: this.offset,
40
+ limit: this.options.pageSize
41
+ });
42
+ this.bufferIndex = 0;
43
+ if (this.buffer.length === 0) return null;
44
+ }
45
+ const item = this.buffer[this.bufferIndex];
46
+ this.bufferIndex += 1;
47
+ this.offset += 1;
48
+ return item;
49
+ }
50
+ update(context) {
51
+ return (0, _checkpoint.writeCheckpoint)(context, this.checkpointKey, {
52
+ offset: this.offset
53
+ });
54
+ }
55
+ close() {
56
+ this.buffer = [];
57
+ }
58
+ get checkpointKey() {
59
+ return this.options.checkpointKey ?? 'database-paging-reader';
60
+ }
61
+ };
62
+ let DatabaseCursorItemReader = class DatabaseCursorItemReader {
63
+ options;
64
+ cursor = null;
65
+ buffer = [];
66
+ bufferIndex = 0;
67
+ constructor(options){
68
+ this.options = options;
69
+ }
70
+ open(context) {
71
+ this.cursor = (0, _checkpoint.readCheckpointValue)(context, this.checkpointKey, 'cursor', this.options.initialCursor ?? null);
72
+ this.buffer = [];
73
+ this.bufferIndex = 0;
74
+ }
75
+ async read() {
76
+ if (this.bufferIndex >= this.buffer.length) {
77
+ this.buffer = await this.options.fetchAfter(this.cursor, this.options.pageSize);
78
+ this.bufferIndex = 0;
79
+ if (this.buffer.length === 0) return null;
80
+ }
81
+ const item = this.buffer[this.bufferIndex];
82
+ this.bufferIndex += 1;
83
+ this.cursor = this.options.getCursor(item);
84
+ return item;
85
+ }
86
+ update(context) {
87
+ return (0, _checkpoint.writeCheckpoint)(context, this.checkpointKey, {
88
+ cursor: this.cursor
89
+ });
90
+ }
91
+ close() {
92
+ this.buffer = [];
93
+ }
94
+ get checkpointKey() {
95
+ return this.options.checkpointKey ?? 'database-cursor-reader';
96
+ }
97
+ };
98
+ let DatabaseBatchItemWriter = class DatabaseBatchItemWriter {
99
+ options;
100
+ constructor(options){
101
+ this.options = options;
102
+ }
103
+ write(items) {
104
+ return this.options.writeBatch(items);
105
+ }
106
+ };
107
+
108
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/io/database.ts"],"sourcesContent":["import type { ExecutionContext, ItemReader, ItemStream, ItemWriter, WriterResult } from '../core';\nimport type { JsonValue } from '../core/execution-context';\n\nimport { readCheckpointNumber, readCheckpointValue, writeCheckpoint } from './checkpoint';\n\nexport interface DatabasePagingItemReaderOptions<T> {\n readonly pageSize: number;\n readonly checkpointKey?: string;\n fetchPage(args: { offset: number; limit: number }): Promise<readonly T[]>;\n}\n\nexport class DatabasePagingItemReader<T> implements ItemReader<T>, ItemStream {\n private offset = 0;\n private buffer: readonly T[] = [];\n private bufferIndex = 0;\n\n constructor(private readonly options: DatabasePagingItemReaderOptions<T>) {}\n\n open(context: ExecutionContext): void {\n this.offset = readCheckpointNumber(context, this.checkpointKey, 'offset', 0);\n this.buffer = [];\n this.bufferIndex = 0;\n }\n\n async read(): Promise<T | null> {\n if (this.bufferIndex >= this.buffer.length) {\n this.buffer = await this.options.fetchPage({\n offset: this.offset,\n limit: this.options.pageSize,\n });\n this.bufferIndex = 0;\n if (this.buffer.length === 0) return null;\n }\n const item = this.buffer[this.bufferIndex]!;\n this.bufferIndex += 1;\n this.offset += 1;\n return item;\n }\n\n update(context: ExecutionContext): ExecutionContext {\n return writeCheckpoint(context, this.checkpointKey, { offset: this.offset });\n }\n\n close(): void {\n this.buffer = [];\n }\n\n private get checkpointKey(): string {\n return this.options.checkpointKey ?? 'database-paging-reader';\n }\n}\n\nexport interface DatabaseCursorItemReaderOptions<T> {\n readonly pageSize: number;\n readonly checkpointKey?: string;\n readonly initialCursor?: JsonValue;\n fetchAfter(cursor: JsonValue, limit: number): Promise<readonly T[]>;\n getCursor(item: T): JsonValue;\n}\n\nexport class DatabaseCursorItemReader<T> implements ItemReader<T>, ItemStream {\n private cursor: JsonValue = null;\n private buffer: readonly T[] = [];\n private bufferIndex = 0;\n\n constructor(private readonly options: DatabaseCursorItemReaderOptions<T>) {}\n\n open(context: ExecutionContext): void {\n this.cursor = readCheckpointValue(\n context,\n this.checkpointKey,\n 'cursor',\n this.options.initialCursor ?? null,\n );\n this.buffer = [];\n this.bufferIndex = 0;\n }\n\n async read(): Promise<T | null> {\n if (this.bufferIndex >= this.buffer.length) {\n this.buffer = await this.options.fetchAfter(this.cursor, this.options.pageSize);\n this.bufferIndex = 0;\n if (this.buffer.length === 0) return null;\n }\n const item = this.buffer[this.bufferIndex]!;\n this.bufferIndex += 1;\n this.cursor = this.options.getCursor(item);\n return item;\n }\n\n update(context: ExecutionContext): ExecutionContext {\n return writeCheckpoint(context, this.checkpointKey, { cursor: this.cursor });\n }\n\n close(): void {\n this.buffer = [];\n }\n\n private get checkpointKey(): string {\n return this.options.checkpointKey ?? 'database-cursor-reader';\n }\n}\n\nexport interface DatabaseBatchItemWriterOptions<T> {\n writeBatch(items: readonly T[]): Promise<WriterResult | void>;\n}\n\nexport class DatabaseBatchItemWriter<T> implements ItemWriter<T> {\n constructor(private readonly options: DatabaseBatchItemWriterOptions<T>) {}\n\n write(items: T[]): Promise<WriterResult | void> {\n return this.options.writeBatch(items);\n }\n}\n"],"names":["DatabaseBatchItemWriter","DatabaseCursorItemReader","DatabasePagingItemReader","offset","buffer","bufferIndex","options","open","context","readCheckpointNumber","checkpointKey","read","length","fetchPage","limit","pageSize","item","update","writeCheckpoint","close","cursor","readCheckpointValue","initialCursor","fetchAfter","getCursor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5CA,UAAAA;IAA6C;IAE1EmB,MAAMC,KAAU,EAAgC;QAC9C,OAAO,IAAI,CAACpB,OAAO,CAACqB,UAAU,CAACD;IACjC;AACF"}
@@ -0,0 +1,54 @@
1
+ import type { ExecutionContext, ItemReader, ItemStream } from '../core';
2
+ export interface RestartableFileLineReaderOptions<T = string> {
3
+ readonly path: string;
4
+ readonly encoding?: BufferEncoding;
5
+ readonly checkpointKey?: string;
6
+ readonly skipLines?: number;
7
+ readonly skipBlankLines?: boolean;
8
+ readonly mapLine?: (line: string, lineIndex: number) => T | null | Promise<T | null>;
9
+ }
10
+ export declare class RestartableFileLineReader<T = string> implements ItemReader<T>, ItemStream {
11
+ private readonly options;
12
+ private lines;
13
+ private index;
14
+ constructor(options: RestartableFileLineReaderOptions<T>);
15
+ open(context: ExecutionContext): Promise<void>;
16
+ read(): Promise<T | null>;
17
+ update(context: ExecutionContext): ExecutionContext;
18
+ close(): void;
19
+ private get checkpointKey();
20
+ }
21
+ export interface CsvFileItemReaderOptions<T extends Record<string, unknown>> {
22
+ readonly path: string;
23
+ readonly encoding?: BufferEncoding;
24
+ readonly checkpointKey?: string;
25
+ readonly delimiter?: string;
26
+ readonly headers?: readonly string[];
27
+ readonly hasHeader?: boolean;
28
+ readonly skipBlankLines?: boolean;
29
+ readonly mapRow?: (row: Record<string, string>, lineIndex: number) => T | null | Promise<T | null>;
30
+ }
31
+ export declare class CsvFileItemReader<T extends Record<string, unknown> = Record<string, string>> implements ItemReader<T>, ItemStream {
32
+ private readonly options;
33
+ private lines;
34
+ private headers;
35
+ private index;
36
+ constructor(options: CsvFileItemReaderOptions<T>);
37
+ open(context: ExecutionContext): Promise<void>;
38
+ read(): Promise<T | null>;
39
+ update(context: ExecutionContext): ExecutionContext;
40
+ close(): void;
41
+ private get checkpointKey();
42
+ private get delimiter();
43
+ }
44
+ export interface JsonlFileItemReaderOptions<T> {
45
+ readonly path: string;
46
+ readonly encoding?: BufferEncoding;
47
+ readonly checkpointKey?: string;
48
+ }
49
+ export declare class JsonlFileItemReader<T = unknown> extends RestartableFileLineReader<T> {
50
+ constructor(options: JsonlFileItemReaderOptions<T>);
51
+ }
52
+ export declare function splitLines(raw: string | Buffer): string[];
53
+ export declare function parseDelimitedLine(line: string, delimiter?: string): string[];
54
+ //# sourceMappingURL=file-readers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-readers.d.ts","sourceRoot":"","sources":["../../../src/io/file-readers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIxE,MAAM,WAAW,gCAAgC,CAAC,CAAC,GAAG,MAAM;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CACtF;AAED,qBAAa,yBAAyB,CAAC,CAAC,GAAG,MAAM,CAC/C,YAAW,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU;IAKxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,KAAK,CAAK;gBAEW,OAAO,EAAE,gCAAgC,CAAC,CAAC,CAAC;IAEnE,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9C,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAgB/B,MAAM,CAAC,OAAO,E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