@decaf-ts/core 0.18.0 → 0.20.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 (677) hide show
  1. package/lib/cjs/auth/constants.cjs +2 -2
  2. package/lib/cjs/auth/constants.cjs.map +1 -0
  3. package/lib/cjs/auth/decorators.cjs +1 -0
  4. package/lib/cjs/auth/decorators.cjs.map +1 -0
  5. package/lib/cjs/auth/index.cjs +1 -0
  6. package/lib/cjs/auth/index.cjs.map +1 -0
  7. package/lib/cjs/fs/FilesystemAdapter.cjs +40 -39
  8. package/lib/cjs/fs/FilesystemAdapter.cjs.map +1 -0
  9. package/lib/cjs/fs/FsDispatch.cjs +3 -2
  10. package/lib/cjs/fs/FsDispatch.cjs.map +1 -0
  11. package/lib/cjs/fs/helpers.cjs +1 -0
  12. package/lib/cjs/fs/helpers.cjs.map +1 -0
  13. package/lib/cjs/fs/index.cjs +1 -0
  14. package/lib/cjs/fs/index.cjs.map +1 -0
  15. package/lib/cjs/fs/indexStore.cjs +8 -7
  16. package/lib/cjs/fs/indexStore.cjs.map +1 -0
  17. package/lib/cjs/fs/locks/FilesystemLock.cjs +3 -2
  18. package/lib/cjs/fs/locks/FilesystemLock.cjs.map +1 -0
  19. package/lib/cjs/fs/locks/FilesystemMultiLock.cjs +5 -4
  20. package/lib/cjs/fs/locks/FilesystemMultiLock.cjs.map +1 -0
  21. package/lib/cjs/fs/types.cjs +1 -0
  22. package/lib/cjs/fs/types.cjs.map +1 -0
  23. package/lib/cjs/identity/decorators.cjs +11 -10
  24. package/lib/cjs/identity/decorators.cjs.map +1 -0
  25. package/lib/cjs/identity/index.cjs +1 -0
  26. package/lib/cjs/identity/index.cjs.map +1 -0
  27. package/lib/cjs/index.cjs +4 -3
  28. package/lib/cjs/index.cjs.map +1 -0
  29. package/lib/cjs/interfaces/ContextuallyLogged.cjs +1 -0
  30. package/lib/cjs/interfaces/ContextuallyLogged.cjs.map +1 -0
  31. package/lib/cjs/interfaces/ErrorParser.cjs +1 -0
  32. package/lib/cjs/interfaces/ErrorParser.cjs.map +1 -0
  33. package/lib/cjs/interfaces/Executor.cjs +1 -0
  34. package/lib/cjs/interfaces/Executor.cjs.map +1 -0
  35. package/lib/cjs/interfaces/Observable.cjs +1 -0
  36. package/lib/cjs/interfaces/Observable.cjs.map +1 -0
  37. package/lib/cjs/interfaces/Observer.cjs +1 -0
  38. package/lib/cjs/interfaces/Observer.cjs.map +1 -0
  39. package/lib/cjs/interfaces/Paginatable.cjs +1 -0
  40. package/lib/cjs/interfaces/Paginatable.cjs.map +1 -0
  41. package/lib/cjs/interfaces/Queriable.cjs +1 -0
  42. package/lib/cjs/interfaces/Queriable.cjs.map +1 -0
  43. package/lib/cjs/interfaces/RawExecutor.cjs +1 -0
  44. package/lib/cjs/interfaces/RawExecutor.cjs.map +1 -0
  45. package/lib/cjs/interfaces/SequenceOptions.cjs +1 -0
  46. package/lib/cjs/interfaces/SequenceOptions.cjs.map +1 -0
  47. package/lib/cjs/interfaces/index.cjs +1 -0
  48. package/lib/cjs/interfaces/index.cjs.map +1 -0
  49. package/lib/cjs/migrations/Migration.cjs +16 -15
  50. package/lib/cjs/migrations/Migration.cjs.map +1 -0
  51. package/lib/cjs/migrations/MigrationService.cjs +38 -37
  52. package/lib/cjs/migrations/MigrationService.cjs.map +1 -0
  53. package/lib/cjs/migrations/MigrationTaskBuilder.cjs +3 -2
  54. package/lib/cjs/migrations/MigrationTaskBuilder.cjs.map +1 -0
  55. package/lib/cjs/migrations/MigrationTasks.cjs +22 -17
  56. package/lib/cjs/migrations/MigrationTasks.cjs.map +1 -0
  57. package/lib/cjs/migrations/MigrationVersioning.cjs +1 -0
  58. package/lib/cjs/migrations/MigrationVersioning.cjs.map +1 -0
  59. package/lib/cjs/migrations/SemverMigrationVersioning.cjs +1 -0
  60. package/lib/cjs/migrations/SemverMigrationVersioning.cjs.map +1 -0
  61. package/lib/cjs/migrations/StandardMigrationVersioning.cjs +1 -0
  62. package/lib/cjs/migrations/StandardMigrationVersioning.cjs.map +1 -0
  63. package/lib/cjs/migrations/constants.cjs +3 -2
  64. package/lib/cjs/migrations/constants.cjs.map +1 -0
  65. package/lib/cjs/migrations/decorators.cjs +10 -9
  66. package/lib/cjs/migrations/decorators.cjs.map +1 -0
  67. package/lib/cjs/migrations/index.cjs +6 -5
  68. package/lib/cjs/migrations/index.cjs.map +1 -0
  69. package/lib/cjs/migrations/types.cjs +1 -0
  70. package/lib/cjs/migrations/types.cjs.map +1 -0
  71. package/lib/cjs/model/BaseModel.cjs +14 -8
  72. package/lib/cjs/model/BaseModel.cjs.map +1 -0
  73. package/lib/cjs/model/SequenceModel.cjs +19 -13
  74. package/lib/cjs/model/SequenceModel.cjs.map +1 -0
  75. package/lib/cjs/model/construction.cjs +27 -26
  76. package/lib/cjs/model/construction.cjs.map +1 -0
  77. package/lib/cjs/model/decorators.cjs +48 -47
  78. package/lib/cjs/model/decorators.cjs.map +1 -0
  79. package/lib/cjs/model/index.cjs +1 -0
  80. package/lib/cjs/model/index.cjs.map +1 -0
  81. package/lib/cjs/model/indexing.cjs +6 -5
  82. package/lib/cjs/model/indexing.cjs.map +1 -0
  83. package/lib/cjs/model/types.cjs +1 -0
  84. package/lib/cjs/model/types.cjs.map +1 -0
  85. package/lib/cjs/overrides/Metadata.cjs +1 -0
  86. package/lib/cjs/overrides/Metadata.cjs.map +1 -0
  87. package/lib/cjs/overrides/Model.cjs +1 -0
  88. package/lib/cjs/overrides/Model.cjs.map +1 -0
  89. package/lib/cjs/overrides/ModelBuilder.cjs +1 -0
  90. package/lib/cjs/overrides/ModelBuilder.cjs.map +1 -0
  91. package/lib/cjs/overrides/index.cjs +1 -0
  92. package/lib/cjs/overrides/index.cjs.map +1 -0
  93. package/lib/cjs/overrides/injectables.cjs +1 -0
  94. package/lib/cjs/overrides/injectables.cjs.map +1 -0
  95. package/lib/cjs/overrides/overrides.cjs +22 -21
  96. package/lib/cjs/overrides/overrides.cjs.map +1 -0
  97. package/lib/cjs/persistence/Adapter.cjs +47 -41
  98. package/lib/cjs/persistence/Adapter.cjs.map +1 -0
  99. package/lib/cjs/persistence/Context.cjs +10 -7
  100. package/lib/cjs/persistence/Context.cjs.map +1 -0
  101. package/lib/cjs/persistence/ContextLock.cjs +1 -0
  102. package/lib/cjs/persistence/ContextLock.cjs.map +1 -0
  103. package/lib/cjs/persistence/Dispatch.cjs +15 -14
  104. package/lib/cjs/persistence/Dispatch.cjs.map +1 -0
  105. package/lib/cjs/persistence/ObserverHandler.cjs +3 -2
  106. package/lib/cjs/persistence/ObserverHandler.cjs.map +1 -0
  107. package/lib/cjs/persistence/Sequence.cjs +19 -18
  108. package/lib/cjs/persistence/Sequence.cjs.map +1 -0
  109. package/lib/cjs/persistence/constants.cjs +14 -21
  110. package/lib/cjs/persistence/constants.cjs.map +1 -0
  111. package/lib/cjs/persistence/decorators.cjs +6 -5
  112. package/lib/cjs/persistence/decorators.cjs.map +1 -0
  113. package/lib/cjs/persistence/errors.cjs +1 -0
  114. package/lib/cjs/persistence/errors.cjs.map +1 -0
  115. package/lib/cjs/persistence/event-filters.cjs +5 -4
  116. package/lib/cjs/persistence/event-filters.cjs.map +1 -0
  117. package/lib/cjs/persistence/generators.cjs +1 -0
  118. package/lib/cjs/persistence/generators.cjs.map +1 -0
  119. package/lib/cjs/persistence/index.cjs +1 -0
  120. package/lib/cjs/persistence/index.cjs.map +1 -0
  121. package/lib/cjs/persistence/transactions.cjs +9 -8
  122. package/lib/cjs/persistence/transactions.cjs.map +1 -0
  123. package/lib/cjs/persistence/types.cjs +1 -0
  124. package/lib/cjs/persistence/types.cjs.map +1 -0
  125. package/lib/cjs/query/Condition.cjs +173 -165
  126. package/lib/cjs/query/Condition.cjs.map +1 -0
  127. package/lib/cjs/query/MethodQueryBuilder.cjs +37 -34
  128. package/lib/cjs/query/MethodQueryBuilder.cjs.map +1 -0
  129. package/lib/cjs/query/Paginator.cjs +28 -27
  130. package/lib/cjs/query/Paginator.cjs.map +1 -0
  131. package/lib/cjs/query/Statement.cjs +90 -84
  132. package/lib/cjs/query/Statement.cjs.map +1 -0
  133. package/lib/cjs/query/constants.cjs +5 -21
  134. package/lib/cjs/query/constants.cjs.map +1 -0
  135. package/lib/cjs/query/decorators.cjs +16 -15
  136. package/lib/cjs/query/decorators.cjs.map +1 -0
  137. package/lib/cjs/query/errors.cjs +1 -0
  138. package/lib/cjs/query/errors.cjs.map +1 -0
  139. package/lib/cjs/query/index.cjs +1 -0
  140. package/lib/cjs/query/index.cjs.map +1 -0
  141. package/lib/cjs/query/options.cjs +1 -0
  142. package/lib/cjs/query/options.cjs.map +1 -0
  143. package/lib/cjs/query/selectors.cjs +1 -0
  144. package/lib/cjs/query/selectors.cjs.map +1 -0
  145. package/lib/cjs/query/types.cjs +2 -13
  146. package/lib/cjs/query/types.cjs.map +1 -0
  147. package/lib/cjs/query/utils.cjs +10 -9
  148. package/lib/cjs/query/utils.cjs.map +1 -0
  149. package/lib/cjs/ram/RamAdapter.cjs +21 -20
  150. package/lib/cjs/ram/RamAdapter.cjs.map +1 -0
  151. package/lib/cjs/ram/RamPaginator.cjs +3 -2
  152. package/lib/cjs/ram/RamPaginator.cjs.map +1 -0
  153. package/lib/cjs/ram/RamStatement.cjs +38 -37
  154. package/lib/cjs/ram/RamStatement.cjs.map +1 -0
  155. package/lib/cjs/ram/constants.cjs +1 -0
  156. package/lib/cjs/ram/constants.cjs.map +1 -0
  157. package/lib/cjs/ram/handlers.cjs +3 -2
  158. package/lib/cjs/ram/handlers.cjs.map +1 -0
  159. package/lib/cjs/ram/index.cjs +8 -7
  160. package/lib/cjs/ram/index.cjs.map +1 -0
  161. package/lib/cjs/ram/types.cjs +1 -0
  162. package/lib/cjs/ram/types.cjs.map +1 -0
  163. package/lib/cjs/repository/Repository.cjs +85 -79
  164. package/lib/cjs/repository/Repository.cjs.map +1 -0
  165. package/lib/cjs/repository/constants.cjs +5 -20
  166. package/lib/cjs/repository/constants.cjs.map +1 -0
  167. package/lib/cjs/repository/decorators.cjs +7 -6
  168. package/lib/cjs/repository/decorators.cjs.map +1 -0
  169. package/lib/cjs/repository/errors.cjs +1 -0
  170. package/lib/cjs/repository/errors.cjs.map +1 -0
  171. package/lib/cjs/repository/index.cjs +1 -0
  172. package/lib/cjs/repository/index.cjs.map +1 -0
  173. package/lib/cjs/repository/injectables.cjs +14 -13
  174. package/lib/cjs/repository/injectables.cjs.map +1 -0
  175. package/lib/cjs/repository/types.cjs +1 -0
  176. package/lib/cjs/repository/types.cjs.map +1 -0
  177. package/lib/cjs/repository/utils.cjs +3 -2
  178. package/lib/cjs/repository/utils.cjs.map +1 -0
  179. package/lib/cjs/services/ModelService.cjs +36 -30
  180. package/lib/cjs/services/ModelService.cjs.map +1 -0
  181. package/lib/cjs/services/PersistenceService.cjs +9 -8
  182. package/lib/cjs/services/PersistenceService.cjs.map +1 -0
  183. package/lib/cjs/services/index.cjs +1 -0
  184. package/lib/cjs/services/index.cjs.map +1 -0
  185. package/lib/cjs/services/services.cjs +37 -31
  186. package/lib/cjs/services/services.cjs.map +1 -0
  187. package/lib/cjs/tasks/CleanUpTask.cjs +30 -24
  188. package/lib/cjs/tasks/CleanUpTask.cjs.map +1 -0
  189. package/lib/cjs/tasks/TaskContext.cjs +16 -15
  190. package/lib/cjs/tasks/TaskContext.cjs.map +1 -0
  191. package/lib/cjs/tasks/TaskEngine.cjs +112 -111
  192. package/lib/cjs/tasks/TaskEngine.cjs.map +1 -0
  193. package/lib/cjs/tasks/TaskErrors.cjs +1 -0
  194. package/lib/cjs/tasks/TaskErrors.cjs.map +1 -0
  195. package/lib/cjs/tasks/TaskEventBus.cjs +7 -6
  196. package/lib/cjs/tasks/TaskEventBus.cjs.map +1 -0
  197. package/lib/cjs/tasks/TaskEventService.cjs +8 -7
  198. package/lib/cjs/tasks/TaskEventService.cjs.map +1 -0
  199. package/lib/cjs/tasks/TaskHandler.cjs +5 -4
  200. package/lib/cjs/tasks/TaskHandler.cjs.map +1 -0
  201. package/lib/cjs/tasks/TaskHandlerRegistry.cjs +1 -0
  202. package/lib/cjs/tasks/TaskHandlerRegistry.cjs.map +1 -0
  203. package/lib/cjs/tasks/TaskService.cjs +43 -37
  204. package/lib/cjs/tasks/TaskService.cjs.map +1 -0
  205. package/lib/cjs/tasks/TaskStateChangeError.cjs +1 -0
  206. package/lib/cjs/tasks/TaskStateChangeError.cjs.map +1 -0
  207. package/lib/cjs/tasks/TaskTracker.cjs +62 -61
  208. package/lib/cjs/tasks/TaskTracker.cjs.map +1 -0
  209. package/lib/cjs/tasks/builder.cjs +30 -24
  210. package/lib/cjs/tasks/builder.cjs.map +1 -0
  211. package/lib/cjs/tasks/constants.cjs +6 -10
  212. package/lib/cjs/tasks/constants.cjs.map +1 -0
  213. package/lib/cjs/tasks/decorators.cjs +5 -4
  214. package/lib/cjs/tasks/decorators.cjs.map +1 -0
  215. package/lib/cjs/tasks/index.cjs +6 -5
  216. package/lib/cjs/tasks/index.cjs.map +1 -0
  217. package/lib/cjs/tasks/logging.cjs +12 -11
  218. package/lib/cjs/tasks/logging.cjs.map +1 -0
  219. package/lib/cjs/tasks/models/TaskBackoffModel.cjs +16 -10
  220. package/lib/cjs/tasks/models/TaskBackoffModel.cjs.map +1 -0
  221. package/lib/cjs/tasks/models/TaskErrorModel.cjs +11 -5
  222. package/lib/cjs/tasks/models/TaskErrorModel.cjs.map +1 -0
  223. package/lib/cjs/tasks/models/TaskEventModel.cjs +29 -23
  224. package/lib/cjs/tasks/models/TaskEventModel.cjs.map +1 -0
  225. package/lib/cjs/tasks/models/TaskIOSerializer.cjs +4 -3
  226. package/lib/cjs/tasks/models/TaskIOSerializer.cjs.map +1 -0
  227. package/lib/cjs/tasks/models/TaskLogEntryModel.cjs +11 -5
  228. package/lib/cjs/tasks/models/TaskLogEntryModel.cjs.map +1 -0
  229. package/lib/cjs/tasks/models/TaskModel.cjs +72 -66
  230. package/lib/cjs/tasks/models/TaskModel.cjs.map +1 -0
  231. package/lib/cjs/tasks/models/TaskStepResultModel.cjs +14 -8
  232. package/lib/cjs/tasks/models/TaskStepResultModel.cjs.map +1 -0
  233. package/lib/cjs/tasks/models/TaskStepSpecModel.cjs +11 -5
  234. package/lib/cjs/tasks/models/TaskStepSpecModel.cjs.map +1 -0
  235. package/lib/cjs/tasks/models/index.cjs +1 -0
  236. package/lib/cjs/tasks/models/index.cjs.map +1 -0
  237. package/lib/cjs/tasks/types.cjs +1 -0
  238. package/lib/cjs/tasks/types.cjs.map +1 -0
  239. package/lib/cjs/tasks/utils.cjs +6 -5
  240. package/lib/cjs/tasks/utils.cjs.map +1 -0
  241. package/lib/cjs/utils/ContextualLoggedClass.cjs +5 -4
  242. package/lib/cjs/utils/ContextualLoggedClass.cjs.map +1 -0
  243. package/lib/cjs/utils/decorators.cjs +9 -8
  244. package/lib/cjs/utils/decorators.cjs.map +1 -0
  245. package/lib/cjs/utils/errors.cjs +1 -0
  246. package/lib/cjs/utils/errors.cjs.map +1 -0
  247. package/lib/cjs/utils/index.cjs +1 -0
  248. package/lib/cjs/utils/index.cjs.map +1 -0
  249. package/lib/cjs/utils/throttling.cjs +4 -3
  250. package/lib/cjs/utils/throttling.cjs.map +1 -0
  251. package/lib/cjs/utils/types.cjs +1 -0
  252. package/lib/cjs/utils/types.cjs.map +1 -0
  253. package/lib/cjs/utils/utils.cjs +3 -2
  254. package/lib/cjs/utils/utils.cjs.map +1 -0
  255. package/lib/cjs/workers/TaskEngine.cjs +30 -29
  256. package/lib/cjs/workers/TaskEngine.cjs.map +1 -0
  257. package/lib/cjs/workers/WorkThreadEnvironment.cjs +1 -0
  258. package/lib/cjs/workers/WorkThreadEnvironment.cjs.map +1 -0
  259. package/lib/cjs/workers/index.cjs +1 -0
  260. package/lib/cjs/workers/index.cjs.map +1 -0
  261. package/lib/cjs/workers/messages.cjs +1 -0
  262. package/lib/cjs/workers/messages.cjs.map +1 -0
  263. package/lib/cjs/workers/types.cjs +1 -0
  264. package/lib/cjs/workers/types.cjs.map +1 -0
  265. package/lib/cjs/workers/workerThread.cjs +18 -17
  266. package/lib/cjs/workers/workerThread.cjs.map +1 -0
  267. package/lib/esm/index.js +1 -1
  268. package/lib/types/auth/constants.d.mts +5 -0
  269. package/lib/types/auth/decorators.d.cts +5 -0
  270. package/lib/types/auth/{decorators.d.ts → decorators.d.mts} +2 -2
  271. package/lib/types/auth/index.d.cts +2 -0
  272. package/lib/types/auth/index.d.mts +2 -0
  273. package/lib/types/fs/FilesystemAdapter.d.cts +70 -0
  274. package/lib/types/fs/{FilesystemAdapter.d.ts → FilesystemAdapter.d.mts} +5 -5
  275. package/lib/types/fs/FsDispatch.d.cts +7 -0
  276. package/lib/types/fs/{FsDispatch.d.ts → FsDispatch.d.mts} +4 -4
  277. package/lib/types/fs/helpers.d.mts +17 -0
  278. package/lib/types/fs/index.d.cts +4 -0
  279. package/lib/types/fs/index.d.mts +4 -0
  280. package/lib/types/fs/indexStore.d.cts +28 -0
  281. package/lib/types/fs/{indexStore.d.ts → indexStore.d.mts} +2 -2
  282. package/lib/types/fs/locks/FilesystemLock.d.mts +13 -0
  283. package/lib/types/fs/locks/FilesystemMultiLock.d.mts +8 -0
  284. package/lib/types/fs/types.d.cts +40 -0
  285. package/lib/types/fs/{types.d.ts → types.d.mts} +2 -2
  286. package/lib/types/identity/decorators.d.cts +72 -0
  287. package/lib/types/identity/{decorators.d.ts → decorators.d.mts} +3 -3
  288. package/lib/types/identity/index.d.cts +6 -0
  289. package/lib/types/identity/{index.d.ts → index.d.mts} +1 -1
  290. package/lib/types/index.d.cts +34 -0
  291. package/lib/types/{index.d.ts → index.d.mts} +13 -13
  292. package/lib/types/interfaces/ContextuallyLogged.d.cts +8 -0
  293. package/lib/types/interfaces/{ContextuallyLogged.d.ts → ContextuallyLogged.d.mts} +2 -2
  294. package/lib/types/interfaces/ErrorParser.d.mts +16 -0
  295. package/lib/types/interfaces/Executor.d.mts +16 -0
  296. package/lib/types/interfaces/Observable.d.cts +33 -0
  297. package/lib/types/interfaces/{Observable.d.ts → Observable.d.mts} +1 -1
  298. package/lib/types/interfaces/Observer.d.mts +15 -0
  299. package/lib/types/interfaces/Paginatable.d.cts +20 -0
  300. package/lib/types/interfaces/{Paginatable.d.ts → Paginatable.d.mts} +1 -1
  301. package/lib/types/interfaces/Queriable.d.cts +47 -0
  302. package/lib/types/interfaces/{Queriable.d.ts → Queriable.d.mts} +2 -2
  303. package/lib/types/interfaces/RawExecutor.d.cts +28 -0
  304. package/lib/types/interfaces/{RawExecutor.d.ts → RawExecutor.d.mts} +1 -1
  305. package/lib/types/interfaces/SequenceOptions.d.mts +79 -0
  306. package/lib/types/interfaces/index.d.cts +12 -0
  307. package/lib/types/interfaces/index.d.mts +12 -0
  308. package/lib/types/migrations/Migration.d.cts +19 -0
  309. package/lib/types/migrations/{Migration.d.ts → Migration.d.mts} +4 -4
  310. package/lib/types/migrations/MigrationService.d.cts +63 -0
  311. package/lib/types/migrations/{MigrationService.d.ts → MigrationService.d.mts} +7 -7
  312. package/lib/types/migrations/MigrationTaskBuilder.d.cts +10 -0
  313. package/lib/types/migrations/{MigrationTaskBuilder.d.ts → MigrationTaskBuilder.d.mts} +3 -3
  314. package/lib/types/migrations/MigrationTasks.d.cts +9 -0
  315. package/lib/types/migrations/{MigrationTasks.d.ts → MigrationTasks.d.mts} +2 -2
  316. package/lib/types/migrations/MigrationVersioning.d.mts +7 -0
  317. package/lib/types/migrations/SemverMigrationVersioning.d.cts +10 -0
  318. package/lib/types/migrations/{SemverMigrationVersioning.d.ts → SemverMigrationVersioning.d.mts} +1 -1
  319. package/lib/types/migrations/StandardMigrationVersioning.d.cts +12 -0
  320. package/lib/types/migrations/{StandardMigrationVersioning.d.ts → StandardMigrationVersioning.d.mts} +1 -1
  321. package/lib/types/migrations/constants.d.cts +2 -0
  322. package/lib/types/migrations/{constants.d.ts → constants.d.mts} +1 -1
  323. package/lib/types/migrations/decorators.d.cts +12 -0
  324. package/lib/types/migrations/{decorators.d.ts → decorators.d.mts} +1 -1
  325. package/lib/types/migrations/index.d.cts +15 -0
  326. package/lib/types/migrations/index.d.mts +15 -0
  327. package/lib/types/migrations/types.d.cts +46 -0
  328. package/lib/types/migrations/{types.d.ts → types.d.mts} +5 -5
  329. package/lib/types/model/BaseModel.d.mts +37 -0
  330. package/lib/types/model/SequenceModel.d.cts +32 -0
  331. package/lib/types/model/{SequenceModel.d.ts → SequenceModel.d.mts} +1 -1
  332. package/lib/types/model/construction.d.cts +455 -0
  333. package/lib/types/model/{construction.d.ts → construction.d.mts} +4 -4
  334. package/lib/types/model/decorators.d.cts +237 -0
  335. package/lib/types/model/{decorators.d.ts → decorators.d.mts} +4 -4
  336. package/lib/types/model/index.d.cts +11 -0
  337. package/lib/types/model/{index.d.ts → index.d.mts} +6 -6
  338. package/lib/types/model/indexing.d.cts +20 -0
  339. package/lib/types/model/{indexing.d.ts → indexing.d.mts} +1 -1
  340. package/lib/types/model/types.d.cts +60 -0
  341. package/lib/types/model/{types.d.ts → types.d.mts} +2 -2
  342. package/lib/types/overrides/Metadata.d.cts +22 -0
  343. package/lib/types/overrides/{Metadata.d.ts → Metadata.d.mts} +6 -6
  344. package/lib/types/overrides/Model.d.cts +94 -0
  345. package/lib/types/overrides/{Model.d.ts → Model.d.mts} +3 -3
  346. package/lib/types/overrides/ModelBuilder.d.mts +31 -0
  347. package/lib/types/overrides/index.d.cts +11 -0
  348. package/lib/types/overrides/{index.d.ts → index.d.mts} +5 -5
  349. package/lib/types/overrides/injectables.d.cts +10 -0
  350. package/lib/types/overrides/{injectables.d.ts → injectables.d.mts} +2 -2
  351. package/lib/types/overrides/overrides.d.mts +1 -0
  352. package/lib/types/persistence/Adapter.d.cts +469 -0
  353. package/lib/types/persistence/{Adapter.d.ts → Adapter.d.mts} +15 -15
  354. package/lib/types/persistence/Context.d.cts +16 -0
  355. package/lib/types/persistence/{Context.d.ts → Context.d.mts} +1 -1
  356. package/lib/types/persistence/ContextLock.d.cts +18 -0
  357. package/lib/types/persistence/{ContextLock.d.ts → ContextLock.d.mts} +1 -1
  358. package/lib/types/persistence/Dispatch.d.cts +128 -0
  359. package/lib/types/persistence/{Dispatch.d.ts → Dispatch.d.mts} +4 -4
  360. package/lib/types/persistence/ObserverHandler.d.cts +111 -0
  361. package/lib/types/persistence/{ObserverHandler.d.ts → ObserverHandler.d.mts} +4 -4
  362. package/lib/types/persistence/Sequence.d.cts +126 -0
  363. package/lib/types/persistence/{Sequence.d.ts → Sequence.d.mts} +7 -7
  364. package/lib/types/persistence/constants.d.cts +74 -0
  365. package/lib/types/persistence/{constants.d.ts → constants.d.mts} +2 -2
  366. package/lib/types/persistence/decorators.d.cts +28 -0
  367. package/lib/types/persistence/{decorators.d.ts → decorators.d.mts} +3 -3
  368. package/lib/types/persistence/errors.d.mts +33 -0
  369. package/lib/types/persistence/event-filters.d.cts +20 -0
  370. package/lib/types/persistence/{event-filters.d.ts → event-filters.d.mts} +2 -2
  371. package/lib/types/persistence/generators.d.mts +14 -0
  372. package/lib/types/persistence/index.d.cts +18 -0
  373. package/lib/types/persistence/index.d.mts +18 -0
  374. package/lib/types/persistence/transactions.d.cts +4 -0
  375. package/lib/types/persistence/{transactions.d.ts → transactions.d.mts} +2 -2
  376. package/lib/types/persistence/types.d.cts +86 -0
  377. package/lib/types/persistence/{types.d.ts → types.d.mts} +8 -8
  378. package/lib/types/query/Condition.d.cts +131 -0
  379. package/lib/types/query/{Condition.d.ts → Condition.d.mts} +2 -2
  380. package/lib/types/query/MethodQueryBuilder.d.cts +185 -0
  381. package/lib/types/query/{MethodQueryBuilder.d.ts → MethodQueryBuilder.d.mts} +1 -1
  382. package/lib/types/query/Paginator.d.cts +105 -0
  383. package/lib/types/query/{Paginator.d.ts → Paginator.d.mts} +3 -3
  384. package/lib/types/query/Statement.d.cts +136 -0
  385. package/lib/types/query/{Statement.d.ts → Statement.d.mts} +11 -11
  386. package/lib/types/query/constants.d.mts +69 -0
  387. package/lib/types/query/decorators.d.cts +8 -0
  388. package/lib/types/query/{decorators.d.ts → decorators.d.mts} +3 -3
  389. package/lib/types/query/errors.d.mts +21 -0
  390. package/lib/types/query/index.d.cts +16 -0
  391. package/lib/types/query/index.d.mts +16 -0
  392. package/lib/types/query/options.d.cts +393 -0
  393. package/lib/types/query/{options.d.ts → options.d.mts} +4 -4
  394. package/lib/types/query/selectors.d.cts +39 -0
  395. package/lib/types/query/{selectors.d.ts → selectors.d.mts} +1 -1
  396. package/lib/types/query/types.d.cts +158 -0
  397. package/lib/types/query/{types.d.ts → types.d.mts} +3 -3
  398. package/lib/types/query/utils.d.cts +40 -0
  399. package/lib/types/query/{utils.d.ts → utils.d.mts} +1 -1
  400. package/lib/types/ram/RamAdapter.d.cts +341 -0
  401. package/lib/types/ram/{RamAdapter.d.ts → RamAdapter.d.mts} +7 -7
  402. package/lib/types/ram/RamPaginator.d.cts +54 -0
  403. package/lib/types/ram/{RamPaginator.d.ts → RamPaginator.d.mts} +4 -4
  404. package/lib/types/ram/RamStatement.d.cts +92 -0
  405. package/lib/types/ram/{RamStatement.d.ts → RamStatement.d.mts} +5 -5
  406. package/lib/types/ram/constants.d.mts +8 -0
  407. package/lib/types/ram/handlers.d.cts +24 -0
  408. package/lib/types/ram/{handlers.d.ts → handlers.d.mts} +3 -3
  409. package/lib/types/ram/index.d.cts +12 -0
  410. package/lib/types/ram/{index.d.ts → index.d.mts} +6 -6
  411. package/lib/types/ram/types.d.cts +50 -0
  412. package/lib/types/ram/{types.d.ts → types.d.mts} +3 -3
  413. package/lib/types/repository/Repository.d.cts +501 -0
  414. package/lib/types/repository/{Repository.d.ts → Repository.d.mts} +13 -13
  415. package/lib/types/repository/constants.d.cts +36 -0
  416. package/lib/types/repository/{constants.d.ts → constants.d.mts} +1 -1
  417. package/lib/types/repository/decorators.d.mts +30 -0
  418. package/lib/types/repository/errors.d.mts +19 -0
  419. package/lib/types/repository/index.d.cts +12 -0
  420. package/lib/types/repository/{index.d.ts → index.d.mts} +7 -7
  421. package/lib/types/repository/injectables.d.mts +95 -0
  422. package/lib/types/repository/types.d.cts +28 -0
  423. package/lib/types/repository/{types.d.ts → types.d.mts} +1 -1
  424. package/lib/types/repository/utils.d.mts +36 -0
  425. package/lib/types/services/ModelService.d.cts +45 -0
  426. package/lib/types/services/{ModelService.d.ts → ModelService.d.mts} +8 -8
  427. package/lib/types/services/PersistenceService.d.cts +17 -0
  428. package/lib/types/services/{PersistenceService.d.ts → PersistenceService.d.mts} +4 -4
  429. package/lib/types/services/index.d.cts +8 -0
  430. package/lib/types/services/{index.d.ts → index.d.mts} +3 -3
  431. package/lib/types/services/services.d.cts +96 -0
  432. package/lib/types/services/{services.d.ts → services.d.mts} +5 -5
  433. package/lib/types/tasks/CleanUpTask.d.cts +15 -0
  434. package/lib/types/tasks/{CleanUpTask.d.ts → CleanUpTask.d.mts} +5 -5
  435. package/lib/types/tasks/TaskContext.d.cts +30 -0
  436. package/lib/types/tasks/{TaskContext.d.ts → TaskContext.d.mts} +7 -7
  437. package/lib/types/tasks/TaskEngine.d.cts +97 -0
  438. package/lib/types/tasks/{TaskEngine.d.ts → TaskEngine.d.mts} +18 -18
  439. package/lib/types/tasks/TaskErrors.d.cts +65 -0
  440. package/lib/types/tasks/{TaskErrors.d.ts → TaskErrors.d.mts} +2 -2
  441. package/lib/types/tasks/TaskEventBus.d.cts +17 -0
  442. package/lib/types/tasks/{TaskEventBus.d.ts → TaskEventBus.d.mts} +7 -7
  443. package/lib/types/tasks/TaskEventService.d.cts +7 -0
  444. package/lib/types/tasks/TaskEventService.d.mts +7 -0
  445. package/lib/types/tasks/TaskHandler.d.cts +12 -0
  446. package/lib/types/tasks/{TaskHandler.d.ts → TaskHandler.d.mts} +3 -3
  447. package/lib/types/tasks/TaskHandlerRegistry.d.cts +8 -0
  448. package/lib/types/tasks/{TaskHandlerRegistry.d.ts → TaskHandlerRegistry.d.mts} +1 -1
  449. package/lib/types/tasks/TaskService.d.cts +65 -0
  450. package/lib/types/tasks/{TaskService.d.ts → TaskService.d.mts} +15 -15
  451. package/lib/types/tasks/TaskStateChangeError.d.cts +11 -0
  452. package/lib/types/tasks/{TaskStateChangeError.d.ts → TaskStateChangeError.d.mts} +2 -2
  453. package/lib/types/tasks/TaskTracker.d.cts +47 -0
  454. package/lib/types/tasks/{TaskTracker.d.ts → TaskTracker.d.mts} +8 -8
  455. package/lib/types/tasks/builder.d.cts +72 -0
  456. package/lib/types/tasks/{builder.d.ts → builder.d.mts} +4 -4
  457. package/lib/types/tasks/constants.d.cts +31 -0
  458. package/lib/types/tasks/{constants.d.ts → constants.d.mts} +1 -1
  459. package/lib/types/tasks/decorators.d.mts +4 -0
  460. package/lib/types/tasks/index.d.cts +23 -0
  461. package/lib/types/tasks/index.d.mts +23 -0
  462. package/lib/types/tasks/logging.d.cts +31 -0
  463. package/lib/types/tasks/{logging.d.ts → logging.d.mts} +1 -1
  464. package/lib/types/tasks/models/TaskBackoffModel.d.cts +9 -0
  465. package/lib/types/tasks/models/{TaskBackoffModel.d.ts → TaskBackoffModel.d.mts} +1 -1
  466. package/lib/types/tasks/models/TaskErrorModel.d.mts +8 -0
  467. package/lib/types/tasks/models/TaskEventModel.d.cts +11 -0
  468. package/lib/types/tasks/models/{TaskEventModel.d.ts → TaskEventModel.d.mts} +1 -1
  469. package/lib/types/tasks/models/TaskIOSerializer.d.mts +33 -0
  470. package/lib/types/tasks/models/TaskLogEntryModel.d.mts +10 -0
  471. package/lib/types/tasks/models/TaskModel.d.cts +43 -0
  472. package/lib/types/tasks/models/{TaskModel.d.ts → TaskModel.d.mts} +6 -6
  473. package/lib/types/tasks/models/TaskStepResultModel.d.cts +9 -0
  474. package/lib/types/tasks/models/{TaskStepResultModel.d.ts → TaskStepResultModel.d.mts} +2 -2
  475. package/lib/types/tasks/models/TaskStepSpecModel.d.mts +9 -0
  476. package/lib/types/tasks/models/index.d.cts +8 -0
  477. package/lib/types/tasks/models/index.d.mts +8 -0
  478. package/lib/types/tasks/types.d.cts +71 -0
  479. package/lib/types/tasks/{types.d.ts → types.d.mts} +10 -10
  480. package/lib/types/tasks/utils.d.cts +5 -0
  481. package/lib/types/tasks/{utils.d.ts → utils.d.mts} +2 -2
  482. package/lib/types/utils/ContextualLoggedClass.d.cts +37 -0
  483. package/lib/types/utils/{ContextualLoggedClass.d.ts → ContextualLoggedClass.d.mts} +4 -4
  484. package/lib/types/utils/decorators.d.cts +27 -0
  485. package/lib/types/utils/{decorators.d.ts → decorators.d.mts} +1 -1
  486. package/lib/types/utils/errors.d.mts +56 -0
  487. package/lib/types/utils/index.d.cts +11 -0
  488. package/lib/types/utils/{index.d.ts → index.d.mts} +6 -6
  489. package/lib/types/utils/throttling.d.mts +9 -0
  490. package/lib/types/utils/types.d.mts +23 -0
  491. package/lib/types/utils/utils.d.mts +22 -0
  492. package/lib/types/workers/TaskEngine.d.cts +40 -0
  493. package/lib/types/workers/{TaskEngine.d.ts → TaskEngine.d.mts} +6 -6
  494. package/lib/types/workers/WorkThreadEnvironment.d.cts +35 -0
  495. package/lib/types/workers/{WorkThreadEnvironment.d.ts → WorkThreadEnvironment.d.mts} +1 -1
  496. package/lib/types/workers/index.d.cts +5 -0
  497. package/lib/types/workers/index.d.mts +5 -0
  498. package/lib/types/workers/messages.d.cts +69 -0
  499. package/lib/types/workers/{messages.d.ts → messages.d.mts} +1 -1
  500. package/lib/types/workers/types.d.cts +41 -0
  501. package/lib/types/workers/{types.d.ts → types.d.mts} +3 -3
  502. package/lib/types/workers/workerThread.d.mts +1 -0
  503. package/package.json +4 -4
  504. package/lib/cjs/auth/constants.js.map +0 -1
  505. package/lib/cjs/auth/decorators.js.map +0 -1
  506. package/lib/cjs/auth/index.js.map +0 -1
  507. package/lib/cjs/fs/FilesystemAdapter.js.map +0 -1
  508. package/lib/cjs/fs/FsDispatch.js.map +0 -1
  509. package/lib/cjs/fs/helpers.js.map +0 -1
  510. package/lib/cjs/fs/index.js.map +0 -1
  511. package/lib/cjs/fs/indexStore.js.map +0 -1
  512. package/lib/cjs/fs/locks/FilesystemLock.js.map +0 -1
  513. package/lib/cjs/fs/locks/FilesystemMultiLock.js.map +0 -1
  514. package/lib/cjs/fs/types.js.map +0 -1
  515. package/lib/cjs/identity/decorators.js.map +0 -1
  516. package/lib/cjs/identity/index.js.map +0 -1
  517. package/lib/cjs/index.js.map +0 -1
  518. package/lib/cjs/interfaces/ContextuallyLogged.js.map +0 -1
  519. package/lib/cjs/interfaces/ErrorParser.js.map +0 -1
  520. package/lib/cjs/interfaces/Executor.js.map +0 -1
  521. package/lib/cjs/interfaces/Observable.js.map +0 -1
  522. package/lib/cjs/interfaces/Observer.js.map +0 -1
  523. package/lib/cjs/interfaces/Paginatable.js.map +0 -1
  524. package/lib/cjs/interfaces/Queriable.js.map +0 -1
  525. package/lib/cjs/interfaces/RawExecutor.js.map +0 -1
  526. package/lib/cjs/interfaces/SequenceOptions.js.map +0 -1
  527. package/lib/cjs/interfaces/index.js.map +0 -1
  528. package/lib/cjs/migrations/Migration.js.map +0 -1
  529. package/lib/cjs/migrations/MigrationService.js.map +0 -1
  530. package/lib/cjs/migrations/MigrationTaskBuilder.js.map +0 -1
  531. package/lib/cjs/migrations/MigrationTasks.js.map +0 -1
  532. package/lib/cjs/migrations/MigrationVersioning.js.map +0 -1
  533. package/lib/cjs/migrations/SemverMigrationVersioning.js.map +0 -1
  534. package/lib/cjs/migrations/StandardMigrationVersioning.js.map +0 -1
  535. package/lib/cjs/migrations/constants.js.map +0 -1
  536. package/lib/cjs/migrations/decorators.js.map +0 -1
  537. package/lib/cjs/migrations/index.js.map +0 -1
  538. package/lib/cjs/migrations/types.js.map +0 -1
  539. package/lib/cjs/model/BaseModel.js.map +0 -1
  540. package/lib/cjs/model/SequenceModel.js.map +0 -1
  541. package/lib/cjs/model/construction.js.map +0 -1
  542. package/lib/cjs/model/decorators.js.map +0 -1
  543. package/lib/cjs/model/index.js.map +0 -1
  544. package/lib/cjs/model/indexing.js.map +0 -1
  545. package/lib/cjs/model/types.js.map +0 -1
  546. package/lib/cjs/overrides/Metadata.js.map +0 -1
  547. package/lib/cjs/overrides/Model.js.map +0 -1
  548. package/lib/cjs/overrides/ModelBuilder.js.map +0 -1
  549. package/lib/cjs/overrides/index.js.map +0 -1
  550. package/lib/cjs/overrides/injectables.js.map +0 -1
  551. package/lib/cjs/overrides/overrides.js.map +0 -1
  552. package/lib/cjs/persistence/Adapter.js.map +0 -1
  553. package/lib/cjs/persistence/Context.js.map +0 -1
  554. package/lib/cjs/persistence/ContextLock.js.map +0 -1
  555. package/lib/cjs/persistence/Dispatch.js.map +0 -1
  556. package/lib/cjs/persistence/ObserverHandler.js.map +0 -1
  557. package/lib/cjs/persistence/Sequence.js.map +0 -1
  558. package/lib/cjs/persistence/constants.js.map +0 -1
  559. package/lib/cjs/persistence/decorators.js.map +0 -1
  560. package/lib/cjs/persistence/errors.js.map +0 -1
  561. package/lib/cjs/persistence/event-filters.js.map +0 -1
  562. package/lib/cjs/persistence/generators.js.map +0 -1
  563. package/lib/cjs/persistence/index.js.map +0 -1
  564. package/lib/cjs/persistence/transactions.js.map +0 -1
  565. package/lib/cjs/persistence/types.js.map +0 -1
  566. package/lib/cjs/query/Condition.js.map +0 -1
  567. package/lib/cjs/query/MethodQueryBuilder.js.map +0 -1
  568. package/lib/cjs/query/Paginator.js.map +0 -1
  569. package/lib/cjs/query/Statement.js.map +0 -1
  570. package/lib/cjs/query/constants.js.map +0 -1
  571. package/lib/cjs/query/decorators.js.map +0 -1
  572. package/lib/cjs/query/errors.js.map +0 -1
  573. package/lib/cjs/query/index.js.map +0 -1
  574. package/lib/cjs/query/options.js.map +0 -1
  575. package/lib/cjs/query/selectors.js.map +0 -1
  576. package/lib/cjs/query/types.js.map +0 -1
  577. package/lib/cjs/query/utils.js.map +0 -1
  578. package/lib/cjs/ram/RamAdapter.js.map +0 -1
  579. package/lib/cjs/ram/RamPaginator.js.map +0 -1
  580. package/lib/cjs/ram/RamStatement.js.map +0 -1
  581. package/lib/cjs/ram/constants.js.map +0 -1
  582. package/lib/cjs/ram/handlers.js.map +0 -1
  583. package/lib/cjs/ram/index.js.map +0 -1
  584. package/lib/cjs/ram/types.js.map +0 -1
  585. package/lib/cjs/repository/Repository.js.map +0 -1
  586. package/lib/cjs/repository/constants.js.map +0 -1
  587. package/lib/cjs/repository/decorators.js.map +0 -1
  588. package/lib/cjs/repository/errors.js.map +0 -1
  589. package/lib/cjs/repository/index.js.map +0 -1
  590. package/lib/cjs/repository/injectables.js.map +0 -1
  591. package/lib/cjs/repository/types.js.map +0 -1
  592. package/lib/cjs/repository/utils.js.map +0 -1
  593. package/lib/cjs/services/ModelService.js.map +0 -1
  594. package/lib/cjs/services/PersistenceService.js.map +0 -1
  595. package/lib/cjs/services/index.js.map +0 -1
  596. package/lib/cjs/services/services.js.map +0 -1
  597. package/lib/cjs/tasks/CleanUpTask.js.map +0 -1
  598. package/lib/cjs/tasks/TaskContext.js.map +0 -1
  599. package/lib/cjs/tasks/TaskEngine.js.map +0 -1
  600. package/lib/cjs/tasks/TaskErrors.js.map +0 -1
  601. package/lib/cjs/tasks/TaskEventBus.js.map +0 -1
  602. package/lib/cjs/tasks/TaskEventService.js.map +0 -1
  603. package/lib/cjs/tasks/TaskHandler.js.map +0 -1
  604. package/lib/cjs/tasks/TaskHandlerRegistry.js.map +0 -1
  605. package/lib/cjs/tasks/TaskService.js.map +0 -1
  606. package/lib/cjs/tasks/TaskStateChangeError.js.map +0 -1
  607. package/lib/cjs/tasks/TaskTracker.js.map +0 -1
  608. package/lib/cjs/tasks/builder.js.map +0 -1
  609. package/lib/cjs/tasks/constants.js.map +0 -1
  610. package/lib/cjs/tasks/decorators.js.map +0 -1
  611. package/lib/cjs/tasks/index.js.map +0 -1
  612. package/lib/cjs/tasks/logging.js.map +0 -1
  613. package/lib/cjs/tasks/models/TaskBackoffModel.js.map +0 -1
  614. package/lib/cjs/tasks/models/TaskErrorModel.js.map +0 -1
  615. package/lib/cjs/tasks/models/TaskEventModel.js.map +0 -1
  616. package/lib/cjs/tasks/models/TaskIOSerializer.js.map +0 -1
  617. package/lib/cjs/tasks/models/TaskLogEntryModel.js.map +0 -1
  618. package/lib/cjs/tasks/models/TaskModel.js.map +0 -1
  619. package/lib/cjs/tasks/models/TaskStepResultModel.js.map +0 -1
  620. package/lib/cjs/tasks/models/TaskStepSpecModel.js.map +0 -1
  621. package/lib/cjs/tasks/models/index.js.map +0 -1
  622. package/lib/cjs/tasks/types.js.map +0 -1
  623. package/lib/cjs/tasks/utils.js.map +0 -1
  624. package/lib/cjs/utils/ContextualLoggedClass.js.map +0 -1
  625. package/lib/cjs/utils/decorators.js.map +0 -1
  626. package/lib/cjs/utils/errors.js.map +0 -1
  627. package/lib/cjs/utils/index.js.map +0 -1
  628. package/lib/cjs/utils/throttling.js.map +0 -1
  629. package/lib/cjs/utils/types.js.map +0 -1
  630. package/lib/cjs/utils/utils.js.map +0 -1
  631. package/lib/cjs/workers/TaskEngine.js.map +0 -1
  632. package/lib/cjs/workers/WorkThreadEnvironment.js.map +0 -1
  633. package/lib/cjs/workers/index.js.map +0 -1
  634. package/lib/cjs/workers/messages.js.map +0 -1
  635. package/lib/cjs/workers/types.js.map +0 -1
  636. package/lib/cjs/workers/workerThread.js.map +0 -1
  637. package/lib/types/auth/index.d.ts +0 -2
  638. package/lib/types/fs/index.d.ts +0 -4
  639. package/lib/types/interfaces/index.d.ts +0 -12
  640. package/lib/types/migrations/index.d.ts +0 -15
  641. package/lib/types/persistence/index.d.ts +0 -18
  642. package/lib/types/query/index.d.ts +0 -16
  643. package/lib/types/tasks/TaskEventService.d.ts +0 -7
  644. package/lib/types/tasks/index.d.ts +0 -23
  645. package/lib/types/tasks/models/index.d.ts +0 -8
  646. package/lib/types/workers/index.d.ts +0 -5
  647. /package/lib/types/auth/{constants.d.ts → constants.d.cts} +0 -0
  648. /package/lib/types/fs/{helpers.d.ts → helpers.d.cts} +0 -0
  649. /package/lib/types/fs/locks/{FilesystemLock.d.ts → FilesystemLock.d.cts} +0 -0
  650. /package/lib/types/fs/locks/{FilesystemMultiLock.d.ts → FilesystemMultiLock.d.cts} +0 -0
  651. /package/lib/types/interfaces/{ErrorParser.d.ts → ErrorParser.d.cts} +0 -0
  652. /package/lib/types/interfaces/{Executor.d.ts → Executor.d.cts} +0 -0
  653. /package/lib/types/interfaces/{Observer.d.ts → Observer.d.cts} +0 -0
  654. /package/lib/types/interfaces/{SequenceOptions.d.ts → SequenceOptions.d.cts} +0 -0
  655. /package/lib/types/migrations/{MigrationVersioning.d.ts → MigrationVersioning.d.cts} +0 -0
  656. /package/lib/types/model/{BaseModel.d.ts → BaseModel.d.cts} +0 -0
  657. /package/lib/types/overrides/{ModelBuilder.d.ts → ModelBuilder.d.cts} +0 -0
  658. /package/lib/types/overrides/{overrides.d.ts → overrides.d.cts} +0 -0
  659. /package/lib/types/persistence/{errors.d.ts → errors.d.cts} +0 -0
  660. /package/lib/types/persistence/{generators.d.ts → generators.d.cts} +0 -0
  661. /package/lib/types/query/{constants.d.ts → constants.d.cts} +0 -0
  662. /package/lib/types/query/{errors.d.ts → errors.d.cts} +0 -0
  663. /package/lib/types/ram/{constants.d.ts → constants.d.cts} +0 -0
  664. /package/lib/types/repository/{decorators.d.ts → decorators.d.cts} +0 -0
  665. /package/lib/types/repository/{errors.d.ts → errors.d.cts} +0 -0
  666. /package/lib/types/repository/{injectables.d.ts → injectables.d.cts} +0 -0
  667. /package/lib/types/repository/{utils.d.ts → utils.d.cts} +0 -0
  668. /package/lib/types/tasks/{decorators.d.ts → decorators.d.cts} +0 -0
  669. /package/lib/types/tasks/models/{TaskErrorModel.d.ts → TaskErrorModel.d.cts} +0 -0
  670. /package/lib/types/tasks/models/{TaskIOSerializer.d.ts → TaskIOSerializer.d.cts} +0 -0
  671. /package/lib/types/tasks/models/{TaskLogEntryModel.d.ts → TaskLogEntryModel.d.cts} +0 -0
  672. /package/lib/types/tasks/models/{TaskStepSpecModel.d.ts → TaskStepSpecModel.d.cts} +0 -0
  673. /package/lib/types/utils/{errors.d.ts → errors.d.cts} +0 -0
  674. /package/lib/types/utils/{throttling.d.ts → throttling.d.cts} +0 -0
  675. /package/lib/types/utils/{types.d.ts → types.d.cts} +0 -0
  676. /package/lib/types/utils/{utils.d.ts → utils.d.cts} +0 -0
  677. /package/lib/types/workers/{workerThread.d.ts → workerThread.d.cts} +0 -0
@@ -0,0 +1,50 @@
1
+ import { Model } from "@decaf-ts/decorator-validation";
2
+ import { Repository } from "../repository/index.cjs";
3
+ import { Constructor } from "@decaf-ts/decoration";
4
+ import { Adapter, AdapterFlags } from "../persistence/index.cjs";
5
+ import { Context } from "../persistence/Context.cjs";
6
+ import { MultiLock } from "@decaf-ts/transactional-decorators";
7
+ import { PrimaryKeyType } from "@decaf-ts/db-decorators";
8
+ /**
9
+ * @description In-memory storage structure for the RAM adapter
10
+ * @summary A nested Map structure that stores all entities by their table name and primary key.
11
+ * The outer Map uses table names as keys, while the inner Map uses entity IDs as keys and entity instances as values.
12
+ * @typedef {Map<string, Map<string | number, any>>} RamStorage
13
+ * @memberOf module:core
14
+ * @category Ram
15
+ */
16
+ export type RamStorage = Map<string, Map<PrimaryKeyType, any>>;
17
+ export type RawRamQuery<M extends Model = any> = {
18
+ select: undefined | (keyof M)[];
19
+ from: Constructor<M>;
20
+ where: (el: M) => boolean;
21
+ sort?: (el: M, el2: M) => number;
22
+ groupBy?: (keyof M)[];
23
+ limit?: number;
24
+ skip?: number;
25
+ count?: keyof M | null;
26
+ countDistinct?: keyof M;
27
+ min?: keyof M;
28
+ max?: keyof M;
29
+ sum?: keyof M;
30
+ avg?: keyof M;
31
+ distinct?: keyof M;
32
+ };
33
+ /**
34
+ * @description Flags for RAM adapter operations
35
+ * @summary Interface that extends the base repository flags with RAM-specific flags.
36
+ * Contains user identification information needed for tracking entity creation and updates.
37
+ * @interface RamFlags
38
+ * @property {string} UUID - Unique identifier for the current user
39
+ * @memberOf module:core
40
+ * @category Ram
41
+ */
42
+ export interface RamFlags extends AdapterFlags {
43
+ UUID: string;
44
+ }
45
+ export type RamRepository<M extends Model<boolean>> = Repository<M, Adapter<RamConfig, RamStorage, RawRamQuery<any>, RamContext>>;
46
+ export type RamContext = Context<RamFlags>;
47
+ export type RamConfig = {
48
+ user: string;
49
+ lock?: MultiLock;
50
+ };
@@ -1,8 +1,8 @@
1
1
  import { Model } from "@decaf-ts/decorator-validation";
2
- import { Repository } from "../repository";
2
+ import { Repository } from "../repository/index.js";
3
3
  import { Constructor } from "@decaf-ts/decoration";
4
- import { Adapter, AdapterFlags } from "../persistence";
5
- import { Context } from "../persistence/Context";
4
+ import { Adapter, AdapterFlags } from "../persistence/index.js";
5
+ import { Context } from "../persistence/Context.js";
6
6
  import { MultiLock } from "@decaf-ts/transactional-decorators";
7
7
  import { PrimaryKeyType } from "@decaf-ts/db-decorators";
8
8
  /**
@@ -0,0 +1,501 @@
1
+ import { IRepository, Repository as Rep, PrimaryKeyType } from "@decaf-ts/db-decorators";
2
+ import { Logger } from "@decaf-ts/logging";
3
+ import { ContextualArgs, ContextualizedArgs, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass.cjs";
4
+ import { Adapter } from "../persistence/Adapter.cjs";
5
+ import { ObserverHandler } from "../persistence/ObserverHandler.cjs";
6
+ import type { DirectionLimitOffset, QueryOptions } from "../query/types.cjs";
7
+ import { SelectSelector } from "../query/selectors.cjs";
8
+ import { CountWhereOption, WhereOption } from "../query/options.cjs";
9
+ import { Condition } from "../query/Condition.cjs";
10
+ import { Queriable } from "../interfaces/Queriable.cjs";
11
+ import { SequenceOptions } from "../interfaces/SequenceOptions.cjs";
12
+ import { OrderDirection } from "./constants.cjs";
13
+ import type { AllOperationKeys, ContextOf, EventIds, FlagsOf, InferredAdapterConfig, ObserverFilter, PersistenceObservable, PersistenceObserver } from "../persistence/types.cjs";
14
+ import type { Observer } from "../interfaces/Observer.cjs";
15
+ import { Constructor } from "@decaf-ts/decoration";
16
+ import { Model } from "@decaf-ts/decorator-validation";
17
+ import { SerializedPage } from "../query/Paginator.cjs";
18
+ /**
19
+ * @description Type alias for Repository class with simplified generic parameters.
20
+ * @summary Provides a more concise way to reference the Repository class with its generic parameters.
21
+ * @template M - The model type that extends Model.
22
+ * @template F - The repository flags type.
23
+ * @template C - The context type.
24
+ * @template Q - The query type.
25
+ * @template A - The adapter type.
26
+ * @typedef Repo
27
+ * @memberOf module:core
28
+ */
29
+ export type Repo<M extends Model<boolean>> = Repository<M, any>;
30
+ /**
31
+ * @description Core repository implementation for database operations on models on a table by table way.
32
+ * @summary Provides CRUD operations, querying capabilities, and observer pattern implementation for model persistence.
33
+ * @template M - The model type that extends Model.
34
+ * @template Q - The query type used by the adapter.
35
+ * @template A - The adapter type for database operations.
36
+ * @template F - The repository flags type.
37
+ * @template C - The context type for operations.
38
+ * @param {A} [adapter] - Optional adapter instance for database operations.
39
+ * @param {Constructor<M>} [clazz] - Optional constructor for the model class.
40
+ * @param {...any[]} [args] - Additional arguments for repository initialization.
41
+ * @class Repository
42
+ * @example
43
+ * // Creating a repository for User model
44
+ * const userRepo = Repository.forModel(User);
45
+ *
46
+ * // Using the repository for CRUD operations
47
+ * const user = await userRepo.create(new User({ name: 'John' }));
48
+ * const retrievedUser = await userRepo.read(user.id);
49
+ * user.name = 'Jane';
50
+ * await userRepo.update(user);
51
+ * await userRepo.delete(user.id);
52
+ *
53
+ * // Querying with conditions
54
+ * const users = await userRepo
55
+ * .select()
56
+ * .where({ name: 'Jane' })
57
+ * .orderBy('createdAt', OrderDirection.DSC)
58
+ * .limit(10)
59
+ * .execute();
60
+ * @mermaid
61
+ * sequenceDiagram
62
+ * participant C as Client Code
63
+ * participant R as Repository
64
+ * participant A as Adapter
65
+ * participant DB as Database
66
+ * participant O as Observers
67
+ *
68
+ * C->>+R: create(model)
69
+ * R->>R: createPrefix(model)
70
+ * R->>+A: prepare(model)
71
+ * A-->>-R: prepared data
72
+ * R->>+A: create(table, id, record)
73
+ * A->>+DB: Insert Operation
74
+ * DB-->>-A: Result
75
+ * A-->>-R: record
76
+ * R->>+A: revert(record)
77
+ * A-->>-R: model instance
78
+ * R->>R: createSuffix(model)
79
+ * R->>+O: updateObservers(table, CREATE, id)
80
+ * O-->>-R: Notification complete
81
+ * R-->>-C: created model
82
+ */
83
+ export declare class Repository<M extends Model<boolean>, A extends Adapter<any, any, any, any>> extends Rep<M, ContextOf<A>> implements PersistenceObservable<ContextOf<A>>, PersistenceObserver<ContextOf<A>>, Queriable<M>, IRepository<M, ContextOf<A>> {
84
+ private static _cache;
85
+ protected observers: Observer[];
86
+ protected observerHandler?: ObserverHandler;
87
+ private readonly _adapter;
88
+ private _tableName;
89
+ protected _overrides: Partial<FlagsOf<ContextOf<A>>>;
90
+ private logger;
91
+ /**
92
+ * @description Logger instance for this repository.
93
+ * @summary Provides access to the logger for this repository instance.
94
+ * @return {Logger} The logger instance.
95
+ */
96
+ get log(): Logger;
97
+ /**
98
+ * @description Adapter for database operations.
99
+ * @summary Provides access to the adapter instance for this repository.
100
+ * @template A - The adapter type.
101
+ * @return {A} The adapter instance.
102
+ * @throws {InternalError} If no adapter is found.
103
+ */
104
+ protected get adapter(): A;
105
+ /**
106
+ * @description Table name for this repository's model.
107
+ * @summary Gets the database table name associated with this repository's model.
108
+ * @return {string} The table name.
109
+ */
110
+ protected get tableName(): string;
111
+ /**
112
+ * @description Primary key properties for this repository's model.
113
+ * @summary Gets the sequence options containing primary key information.
114
+ * @return {SequenceOptions} The primary key properties.
115
+ * @deprecated for Model.sequenceFor(class)
116
+ */
117
+ protected get pkProps(): SequenceOptions;
118
+ get filters(): Record<"onlyOnCreate" | "onlyOnUpdate" | "onlyOnDelete" | "onlyOnTransactional" | "onlyOnSingle" | "onlyOnBulk", ObserverFilter>;
119
+ constructor(adapter?: A, clazz?: Constructor<M>, force?: boolean, ...args: any[]);
120
+ protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
121
+ protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
122
+ protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
123
+ protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<A>>>): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
124
+ protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<A>>>): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
125
+ /**
126
+ * @description Creates a proxy with overridden repository flags.
127
+ * @summary Returns a proxy of this repository with the specified flags overridden.
128
+ * @param {Partial<F>} flags - The flags to override.
129
+ * @return {Repository} A proxy of this repository with overridden flags.
130
+ */
131
+ override(flags: Partial<FlagsOf<ContextOf<A>>>): this;
132
+ /**
133
+ * @description Creates a new instance of the Repository class with a specific adapter and arguments.
134
+ *
135
+ * @template A - The type of the adapter.
136
+ * @template Q - The type of the query builder.
137
+ * @template F - The type of the filter.
138
+ * @template C - The type of the context.
139
+ *
140
+ * @param {Partial<InferredAdapterConfig<A>>} conf - adapter configurations to override.
141
+ * @param [args] - Additional arguments to be passed to the new instance.
142
+ *
143
+ * @return A new instance of the Repository class with the specified adapter and arguments.
144
+ */
145
+ for(conf: Partial<InferredAdapterConfig<A>>, ...args: any[]): this;
146
+ /**
147
+ * @description Creates a new observer handler.
148
+ * @summary Factory method for creating an observer handler instance.
149
+ * @return {ObserverHandler} A new observer handler instance.
150
+ */
151
+ protected ObserverHandler(): ObserverHandler;
152
+ /**
153
+ * @description Prepares a model for creation.
154
+ * @summary Validates the model and prepares it for creation in the database.
155
+ * @template M - The model type.
156
+ * @param {M} model - The model to create.
157
+ * @param {...any[]} args - Additional arguments.
158
+ * @return The prepared model and context arguments.
159
+ * @throws {ValidationError} If the model fails validation.
160
+ */
161
+ protected createPrefix(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M, ...any[], ContextOf<A>]>;
162
+ /**
163
+ * @description Creates a model in the database.
164
+ * @summary Persists a model instance to the database.
165
+ * @param {M} model - The model to create.
166
+ * @param {...any[]} args - Additional arguments.
167
+ * @return {Promise<M>} The created model with updated properties.
168
+ */
169
+ create(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
170
+ /**
171
+ * @description Creates multiple models in the database.
172
+ * @summary Persists multiple model instances to the database in a batch operation.
173
+ * @param {M[]} models - The models to create.
174
+ * @param {...any[]} args - Additional arguments.
175
+ * @return {Promise<M[]>} The created models with updated properties.
176
+ */
177
+ createAll(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
178
+ /**
179
+ * @description Prepares multiple models for creation.
180
+ * @summary Validates multiple models and prepares them for creation in the database.
181
+ * @param {M[]} models - The models to create.
182
+ * @param {...any[]} args - Additional arguments.
183
+ * @return The prepared models and context arguments.
184
+ * @throws {ValidationError} If any model fails validation.
185
+ */
186
+ protected createAllPrefix(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M[], ...any[], ContextOf<A>]>;
187
+ /**
188
+ * @description Prepares for reading a model by ID.
189
+ * @summary Prepares the context and enforces decorators before reading a model.
190
+ * @param {string} key - The primary key of the model to read.
191
+ * @param {...any[]} args - Additional arguments.
192
+ * @return The key and context arguments.
193
+ */
194
+ protected readPrefix(key: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType, ...any[], ContextOf<A>]>;
195
+ /**
196
+ * @description Reads a model from the database by ID.
197
+ * @summary Retrieves a model instance from the database using its primary key.
198
+ * @param {PrimaryKeyType} id - The primary key of the model to read.
199
+ * @param {...any[]} args - Additional arguments.
200
+ * @return {Promise<M>} The retrieved model instance.
201
+ */
202
+ read(id: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
203
+ /**
204
+ * @description Prepares for reading multiple models by IDs.
205
+ * @summary Prepares the context and enforces decorators before reading multiple models.
206
+ * @param {string[]|number[]} keys - The primary keys of the models to read.
207
+ * @param {...any[]} args - Additional arguments.
208
+ * @return The keys and context arguments.
209
+ */
210
+ protected readAllPrefix(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType[], ...any[], ContextOf<A>]>;
211
+ /**
212
+ * @description Reads multiple models from the database by IDs.
213
+ * @summary Retrieves multiple model instances from the database using their primary keys.
214
+ * @param {string[]|number[]} keys - The primary keys of the models to read.
215
+ * @param {...any[]} args - Additional arguments.
216
+ * @return {Promise<M[]>} The retrieved model instances.
217
+ */
218
+ readAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
219
+ /**
220
+ * @description Updates a model in the database.
221
+ * @summary Persists changes to an existing model instance in the database.
222
+ * @param {M} model - The model to update.
223
+ * @param {...any[]} args - Additional arguments.
224
+ * @return {Promise<M>} The updated model with refreshed properties.
225
+ */
226
+ update(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
227
+ /**
228
+ * @description Prepares a model for update.
229
+ * @summary Validates the model and prepares it for update in the database.
230
+ * @param {M} model - The model to update.
231
+ * @param {...any[]} args - Additional arguments.
232
+ * @return The prepared model and context arguments.
233
+ * @throws {InternalError} If the model has no primary key value.
234
+ * @throws {ValidationError} If the model fails validation.
235
+ */
236
+ protected updatePrefix(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M, ...args: any[], ContextOf<A>, M | undefined]>;
237
+ /**
238
+ * @description Updates multiple models in the database.
239
+ * @summary Persists changes to multiple existing model instances in the database in a batch operation.
240
+ * @param {M[]} models - The models to update.
241
+ * @param {...any[]} args - Additional arguments.
242
+ * @return {Promise<M[]>} The updated models with refreshed properties.
243
+ */
244
+ updateAll(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
245
+ /**
246
+ * @description Prepares multiple models for update.
247
+ * @summary Validates multiple models and prepares them for update in the database.
248
+ * @param {M[]} models - The models to update.
249
+ * @param {...any[]} args - Additional arguments.
250
+ * @return {Promise<any[]>} The prepared models and context arguments.
251
+ * @throws {InternalError} If any model has no primary key value.
252
+ * @throws {ValidationError} If any model fails validation.
253
+ */
254
+ protected updateAllPrefix(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M[], ...args: any[], ContextOf<A>, M[] | undefined]>;
255
+ /**
256
+ * @description Prepares for deleting a model by ID.
257
+ * @summary Prepares the context and enforces decorators before deleting a model.
258
+ * @param {any} key - The primary key of the model to delete.
259
+ * @param {...any[]} args - Additional arguments.
260
+ * @return The key and context arguments.
261
+ */
262
+ protected deletePrefix(key: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType, ...any[], ContextOf<A>]>;
263
+ /**
264
+ * @description Deletes a model from the database by ID.
265
+ * @summary Removes a model instance from the database using its primary key.
266
+ * @param {string|number|bigint} id - The primary key of the model to delete.
267
+ * @param {...any[]} args - Additional arguments.
268
+ * @return {Promise<M>} The deleted model instance.
269
+ */
270
+ delete(id: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
271
+ /**
272
+ * @description Prepares for deleting multiple models by IDs.
273
+ * @summary Prepares the context and enforces decorators before deleting multiple models.
274
+ * @param {string[]|number[]} keys - The primary keys of the models to delete.
275
+ * @param {...any[]} args - Additional arguments.
276
+ * @return The keys and context arguments.
277
+ */
278
+ protected deleteAllPrefix(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType[], ...any[], ContextOf<A>]>;
279
+ /**
280
+ * @description Deletes multiple models from the database by IDs.
281
+ * @summary Removes multiple model instances from the database using their primary keys.
282
+ * @param {string[]|number[]} keys - The primary keys of the models to delete.
283
+ * @param {...any[]} args - Additional arguments.
284
+ * @return {Promise<M[]>} The deleted model instances.
285
+ */
286
+ deleteAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
287
+ /**
288
+ * @description Creates a select query without specifying fields.
289
+ * @summary Starts building a query that will return all fields of the model.
290
+ * @template S - The array type of select selectors.
291
+ * @return A query builder for the model.
292
+ */
293
+ select<S extends readonly SelectSelector<M>[]>(): WhereOption<M, M[]>;
294
+ /**
295
+ * @description Creates a select query with specific fields.
296
+ * @summary Starts building a query that will return only the specified fields of the model.
297
+ * @template S - The array type of select selectors.
298
+ * @param selector - The fields to select.
299
+ * @return A query builder for the selected fields.
300
+ */
301
+ select<S extends readonly SelectSelector<M>[]>(selector: readonly [...S]): WhereOption<M, Pick<M, S[number]>[]>;
302
+ /**
303
+ * @description Creates a count query
304
+ * @summary Starts building a query that will count records
305
+ * @template S - The select selector type
306
+ * @param {S} [selector] - Optional field to count (counts all if not specified)
307
+ * @return A count query builder with distinct() available
308
+ */
309
+ count<S extends SelectSelector<M>>(selector?: S): CountWhereOption<M>;
310
+ /**
311
+ * @description Creates a min query
312
+ * @summary Starts building a query that will find the minimum value
313
+ * @template S - The select selector type
314
+ * @param {S} selector - Field to find minimum value of
315
+ * @return A min query builder
316
+ */
317
+ min<S extends SelectSelector<M>>(selector: S): WhereOption<M, M[S]>;
318
+ /**
319
+ * @description Creates a max query
320
+ * @summary Starts building a query that will find the maximum value
321
+ * @template S - The select selector type
322
+ * @param {S} selector - Field to find maximum value of
323
+ * @return A max query builder
324
+ */
325
+ max<S extends SelectSelector<M>>(selector: S): WhereOption<M, M[S]>;
326
+ /**
327
+ * @description Creates a sum query
328
+ * @summary Starts building a query that will sum values
329
+ * @template S - The select selector type
330
+ * @param {S} selector - Field to sum
331
+ * @return A sum query builder
332
+ */
333
+ sum<S extends SelectSelector<M>>(selector: S): WhereOption<M, number>;
334
+ /**
335
+ * @description Creates an average query
336
+ * @summary Starts building a query that will compute the average value
337
+ * @template S - The select selector type
338
+ * @param {S} selector - Field to average
339
+ * @return An average query builder
340
+ */
341
+ avg<S extends SelectSelector<M>>(selector: S): WhereOption<M, number>;
342
+ /**
343
+ * @description Creates a distinct query
344
+ * @summary Starts building a query that will find distinct values
345
+ * @template S - The select selector type
346
+ * @param {S} selector - Field to find distinct values of
347
+ * @return A distinct query builder
348
+ */
349
+ distinct<S extends SelectSelector<M>>(selector: S): WhereOption<M, M[S][]>;
350
+ /**
351
+ * @description Executes a query with the specified conditions and options.
352
+ * @summary Provides a simplified way to query the database with common query parameters.
353
+ * @param {Condition<M>} condition - The condition to filter records.
354
+ * @param orderBy - The field to order results by.
355
+ * @param {OrderDirection} [order=OrderDirection.ASC] - The sort direction.
356
+ * @param {number} [limit] - Optional maximum number of results to return.
357
+ * @param {number} [skip] - Optional number of results to skip.
358
+ * @return {Promise<M[]>} The query results as model instances.
359
+ */
360
+ query(condition: Condition<M>, orderBy: keyof M, order?: OrderDirection, limit?: number, skip?: number, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
361
+ listBy(key: keyof M, order: OrderDirection, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
362
+ paginateBy(key: keyof M, order: OrderDirection, ref?: Omit<DirectionLimitOffset, "direction">, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
363
+ find(value: string, order?: OrderDirection, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
364
+ page(value: string, direction?: OrderDirection, ref?: Omit<DirectionLimitOffset, "direction">, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
365
+ findOneBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
366
+ findBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
367
+ findByPaginate(key: keyof M, value: any, ref?: DirectionLimitOffset, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
368
+ /**
369
+ * @description Counts records, optionally filtered by a key value
370
+ * @summary Returns the count of records matching the optional key condition
371
+ * @param {string} key - The field to count (optional, counts all if not specified)
372
+ * @param {...any[]} args - Additional arguments including context
373
+ * @return {Promise<number>} The count of matching records
374
+ */
375
+ countOf(key?: keyof M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
376
+ /**
377
+ * @description Finds the maximum value of a field
378
+ * @summary Returns the maximum value for the specified field across all records
379
+ * @param {string} key - The field to find the maximum value of
380
+ * @param {...any[]} args - Additional arguments including context
381
+ * @return {Promise<any>} The maximum value
382
+ */
383
+ maxOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K]>;
384
+ /**
385
+ * @description Finds the minimum value of a field
386
+ * @summary Returns the minimum value for the specified field across all records
387
+ * @param {string} key - The field to find the minimum value of
388
+ * @param {...any[]} args - Additional arguments including context
389
+ * @return {Promise<any>} The minimum value
390
+ */
391
+ minOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K]>;
392
+ /**
393
+ * @description Calculates the average value of a field
394
+ * @summary Returns the average value for the specified numeric field across all records
395
+ * @param {string} key - The field to calculate the average of
396
+ * @param {...any[]} args - Additional arguments including context
397
+ * @return {Promise<number>} The average value
398
+ */
399
+ avgOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
400
+ /**
401
+ * @description Calculates the sum of a field
402
+ * @summary Returns the sum of values for the specified numeric field across all records
403
+ * @param {string} key - The field to sum
404
+ * @param {...any[]} args - Additional arguments including context
405
+ * @return {Promise<number>} The sum
406
+ */
407
+ sumOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
408
+ /**
409
+ * @description Finds distinct values of a field
410
+ * @summary Returns an array of unique values for the specified field
411
+ * @param {string} key - The field to get distinct values of
412
+ * @param {...any[]} args - Additional arguments including context
413
+ * @return {Promise<any[]>} An array of distinct values
414
+ */
415
+ distinctOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K][]>;
416
+ /**
417
+ * @description Groups records by a field
418
+ * @summary Returns records grouped by the specified field
419
+ * @param {string} key - The field to group by
420
+ * @param {...any[]} args - Additional arguments including context
421
+ * @return {Promise<Record<string, M[]>>} Records grouped by the field value
422
+ */
423
+ groupOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<Record<string, M[]>>;
424
+ statement(name: string, ...args: MaybeContextualArg<ContextOf<A>>): Promise<any>;
425
+ private getDefaultQueryAttributes;
426
+ private buildDefaultStartsWithCondition;
427
+ attr(prop: keyof M): import("..").AttributeOption<M>;
428
+ /**
429
+ * @description Registers an observer for this repository.
430
+ * @summary Adds an observer that will be notified of changes to models in this repository.
431
+ * @param {Observer} observer - The observer to register.
432
+ * @param {ObserverFilter} [filter] - Optional filter to limit which events the observer receives.
433
+ * @return {void}
434
+ * @see {Observable#observe}
435
+ */
436
+ observe(observer: Observer, filter?: ObserverFilter): () => void;
437
+ /**
438
+ * @description Unregisters an observer from this repository.
439
+ * @summary Removes an observer so it will no longer receive notifications of changes.
440
+ * @param {Observer} observer - The observer to unregister.
441
+ * @return {void}
442
+ * @throws {InternalError} If the observer handler is not initialized.
443
+ * @see {Observable#unObserve}
444
+ */
445
+ unObserve(observer: Observer): void;
446
+ /**
447
+ * @description Notifies all observers of an event.
448
+ * @summary Updates all registered observers with information about a database event.
449
+ * @param {string} table - The table name where the event occurred.
450
+ * @param {OperationKeys|BulkCrudOperationKeys|string} event - The type of event that occurred.
451
+ * @param {EventIds} id - The ID or IDs of the affected records.
452
+ * @param {...any[]} args - Additional arguments.
453
+ * @return {Promise<void>} A promise that resolves when all observers have been notified.
454
+ * @throws {InternalError} If the observer handler is not initialized.
455
+ */
456
+ updateObservers(table: Constructor<M> | string, event: AllOperationKeys, id: EventIds, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
457
+ /**
458
+ * @description Alias for updateObservers.
459
+ * @summary Notifies all observers of an event (alias for updateObservers).
460
+ * @param {string} table - The table name where the event occurred.
461
+ * @param {OperationKeys|BulkCrudOperationKeys|string} event - The type of event that occurred.
462
+ * @param {EventIds} id - The ID or IDs of the affected records.
463
+ * @param {...any[]} args - Additional arguments.
464
+ * @return {Promise<void>} A promise that resolves when all observers have been notified.
465
+ */
466
+ refresh(table: Constructor<M> | string, event: AllOperationKeys, id: EventIds, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
467
+ /**
468
+ * @description Creates or retrieves a repository for a model.
469
+ * @summary Factory method that returns a repository instance for the specified model.
470
+ * @template M - The model type that extends Model.
471
+ * @template R - The repository type that extends Repo<M>.
472
+ * @param {Constructor<M>} model - The model constructor.
473
+ * @param {string} [alias] - Optional default adapter flavour if not specified on the model.
474
+ * @param {...any[]} [args] - Additional arguments to pass to the repository constructor.
475
+ * @return {R} A repository instance for the model.
476
+ * @throws {InternalError} If no adapter is registered for the flavour.
477
+ */
478
+ static forModel<M extends Model, R extends Repo<M>>(model: Constructor<M>, alias?: string, ...args: any[]): R;
479
+ /**
480
+ * @description Retrieves a repository for a model from the cache.
481
+ * @summary Gets a repository constructor or instance for the specified model from the internal cache.
482
+ * @template M - The model type that extends Model.
483
+ * @param {Constructor<M>} model - The model constructor.
484
+ * @param {string} [alias] - The adapter alias.
485
+ * @return {Constructor<Repo<M>> | Repo<M>} The repository constructor or instance.
486
+ * @throws {InternalError} If no repository is registered for the model.
487
+ */
488
+ private static get;
489
+ /**
490
+ * @description Registers a repository for a model.
491
+ * @summary Associates a repository constructor or instance with a model in the internal cache.
492
+ * @template M - The model type that extends Model.
493
+ * @param {Constructor<M>} model - The model constructor.
494
+ * @param {Constructor<Repo<M>> | Repo<M>} repo - The repository constructor or instance.
495
+ * @param {string} [alias] the adapter alias/flavour.
496
+ * @throws {InternalError} If a repository is already registered for the model.
497
+ */
498
+ static register<M extends Model>(model: Constructor<M>, repo: Constructor<Repo<M>> | Repo<M>, alias?: string, force?: boolean): void;
499
+ static statements<R extends Repository<any, any>, K extends keyof R>(repo: Constructor<R> | R, method?: K): undefined | (K extends keyof R ? boolean : (keyof R)[]);
500
+ static queries<R extends Repository<any, any>, K extends keyof R>(repo: Constructor<R> | R, method?: K): undefined | (K extends keyof R ? QueryOptions : Record<keyof R, QueryOptions>);
501
+ }
@@ -1,20 +1,20 @@
1
1
  import { IRepository, Repository as Rep, PrimaryKeyType } from "@decaf-ts/db-decorators";
2
2
  import { Logger } from "@decaf-ts/logging";
3
- import { ContextualArgs, ContextualizedArgs, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass";
4
- import { Adapter } from "../persistence/Adapter";
5
- import { ObserverHandler } from "../persistence/ObserverHandler";
6
- import type { DirectionLimitOffset, QueryOptions } from "../query/types";
7
- import { SelectSelector } from "../query/selectors";
8
- import { CountWhereOption, WhereOption } from "../query/options";
9
- import { Condition } from "../query/Condition";
10
- import { Queriable } from "../interfaces/Queriable";
11
- import { SequenceOptions } from "../interfaces/SequenceOptions";
12
- import { OrderDirection } from "./constants";
13
- import type { AllOperationKeys, ContextOf, EventIds, FlagsOf, InferredAdapterConfig, ObserverFilter, PersistenceObservable, PersistenceObserver } from "../persistence/types";
14
- import type { Observer } from "../interfaces/Observer";
3
+ import { ContextualArgs, ContextualizedArgs, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass.js";
4
+ import { Adapter } from "../persistence/Adapter.js";
5
+ import { ObserverHandler } from "../persistence/ObserverHandler.js";
6
+ import type { DirectionLimitOffset, QueryOptions } from "../query/types.js";
7
+ import { SelectSelector } from "../query/selectors.js";
8
+ import { CountWhereOption, WhereOption } from "../query/options.js";
9
+ import { Condition } from "../query/Condition.js";
10
+ import { Queriable } from "../interfaces/Queriable.js";
11
+ import { SequenceOptions } from "../interfaces/SequenceOptions.js";
12
+ import { OrderDirection } from "./constants.js";
13
+ import type { AllOperationKeys, ContextOf, EventIds, FlagsOf, InferredAdapterConfig, ObserverFilter, PersistenceObservable, PersistenceObserver } from "../persistence/types.js";
14
+ import type { Observer } from "../interfaces/Observer.js";
15
15
  import { Constructor } from "@decaf-ts/decoration";
16
16
  import { Model } from "@decaf-ts/decorator-validation";
17
- import { SerializedPage } from "../query/Paginator";
17
+ import { SerializedPage } from "../query/Paginator.js";
18
18
  /**
19
19
  * @description Type alias for Repository class with simplified generic parameters.
20
20
  * @summary Provides a more concise way to reference the Repository class with its generic parameters.
@@ -0,0 +1,36 @@
1
+ import { CascadeMetadata } from "./types.cjs";
2
+ /**
3
+ * @description Enumeration of possible sort directions.
4
+ * @summary Defines the available sort directions for ordering query results.
5
+ * @enum {string}
6
+ * @readonly
7
+ * @memberOf module:core
8
+ */
9
+ export declare enum OrderDirection {
10
+ /** Ascending order (A to Z, 0 to 9) */
11
+ ASC = "asc",
12
+ /** Descending order (Z to A, 9 to 0) */
13
+ DSC = "desc"
14
+ }
15
+ /**
16
+ * @description Enumeration of cascade operation types.
17
+ * @summary Defines the available cascade behaviors for entity relationships.
18
+ * @enum {string}
19
+ * @readonly
20
+ * @memberOf module:core
21
+ */
22
+ export declare enum Cascade {
23
+ /** Perform cascade operation on related entities */
24
+ CASCADE = "cascade",
25
+ /** Do not perform cascade operation on related entities */
26
+ NONE = "none"
27
+ }
28
+ /**
29
+ * @description Shape of the default cascade configuration object used in repositories.
30
+ * @summary Documents the structure of the cascade configuration with explicit update and delete behaviors.
31
+ * @property {'cascade'|'none'} update - Determines whether updates cascade to related entities.
32
+ * @property {'cascade'|'none'} delete - Determines whether deletes cascade to related entities.
33
+ * @typeDef DefaultCascadeConfig
34
+ * @memberOf module:core
35
+ */
36
+ export declare const DefaultCascade: CascadeMetadata;
@@ -1,4 +1,4 @@
1
- import { CascadeMetadata } from "./types";
1
+ import { CascadeMetadata } from "./types.js";
2
2
  /**
3
3
  * @description Enumeration of possible sort directions.
4
4
  * @summary Defines the available sort directions for ordering query results.