@warlock.js/cascade 4.0.48 → 4.0.59

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 (401) hide show
  1. package/cjs/context/database-data-source-context.d.ts +29 -0
  2. package/cjs/context/database-data-source-context.d.ts.map +1 -0
  3. package/cjs/context/database-data-source-context.js +28 -0
  4. package/cjs/context/database-data-source-context.js.map +1 -0
  5. package/cjs/context/database-transaction-context.d.ts +31 -0
  6. package/cjs/context/database-transaction-context.d.ts.map +1 -0
  7. package/cjs/context/database-transaction-context.js +34 -0
  8. package/cjs/context/database-transaction-context.js.map +1 -0
  9. package/cjs/contracts/database-driver.contract.d.ts +143 -0
  10. package/cjs/contracts/database-driver.contract.d.ts.map +1 -0
  11. package/cjs/contracts/database-id-generator.contract.d.ts +109 -0
  12. package/cjs/contracts/database-id-generator.contract.d.ts.map +1 -0
  13. package/cjs/contracts/database-remover.contract.d.ts +104 -0
  14. package/cjs/contracts/database-remover.contract.d.ts.map +1 -0
  15. package/cjs/contracts/database-restorer.contract.d.ts +143 -0
  16. package/cjs/contracts/database-restorer.contract.d.ts.map +1 -0
  17. package/cjs/contracts/database-writer.contract.d.ts +119 -0
  18. package/cjs/contracts/database-writer.contract.d.ts.map +1 -0
  19. package/cjs/contracts/driver-blueprint.contract.d.ts +45 -0
  20. package/cjs/contracts/driver-blueprint.contract.d.ts.map +1 -0
  21. package/cjs/contracts/index.d.ts +10 -0
  22. package/cjs/contracts/index.d.ts.map +1 -0
  23. package/cjs/contracts/migration-driver.contract.d.ts +365 -0
  24. package/cjs/contracts/migration-driver.contract.d.ts.map +1 -0
  25. package/cjs/contracts/query-builder.contract.d.ts +1128 -0
  26. package/cjs/contracts/query-builder.contract.d.ts.map +1 -0
  27. package/cjs/contracts/sync-adapter.contract.d.ts +58 -0
  28. package/cjs/contracts/sync-adapter.contract.d.ts.map +1 -0
  29. package/cjs/data-source/data-source-registry.d.ts +104 -0
  30. package/cjs/data-source/data-source-registry.d.ts.map +1 -0
  31. package/cjs/data-source/data-source-registry.js +138 -0
  32. package/cjs/data-source/data-source-registry.js.map +1 -0
  33. package/cjs/data-source/data-source.d.ts +106 -0
  34. package/cjs/data-source/data-source.d.ts.map +1 -0
  35. package/cjs/data-source/data-source.js +77 -0
  36. package/cjs/data-source/data-source.js.map +1 -0
  37. package/cjs/database-dirty-tracker.d.ts +253 -0
  38. package/cjs/database-dirty-tracker.d.ts.map +1 -0
  39. package/cjs/database-dirty-tracker.js +389 -0
  40. package/cjs/database-dirty-tracker.js.map +1 -0
  41. package/cjs/drivers/mongo/mongo-id-generator.d.ts +116 -0
  42. package/cjs/drivers/mongo/mongo-id-generator.d.ts.map +1 -0
  43. package/cjs/drivers/mongo/mongo-id-generator.js +149 -0
  44. package/cjs/drivers/mongo/mongo-id-generator.js.map +1 -0
  45. package/cjs/drivers/mongo/mongo-migration-driver.d.ts +228 -0
  46. package/cjs/drivers/mongo/mongo-migration-driver.d.ts.map +1 -0
  47. package/cjs/drivers/mongo/mongo-migration-driver.js +524 -0
  48. package/cjs/drivers/mongo/mongo-migration-driver.js.map +1 -0
  49. package/cjs/drivers/mongo/mongo-query-builder.d.ts +922 -0
  50. package/cjs/drivers/mongo/mongo-query-builder.d.ts.map +1 -0
  51. package/cjs/drivers/mongo/mongo-query-builder.js +1740 -0
  52. package/cjs/drivers/mongo/mongo-query-builder.js.map +1 -0
  53. package/cjs/drivers/mongo/mongo-query-operations.d.ts +226 -0
  54. package/cjs/drivers/mongo/mongo-query-operations.d.ts.map +1 -0
  55. package/cjs/drivers/mongo/mongo-query-operations.js +270 -0
  56. package/cjs/drivers/mongo/mongo-query-operations.js.map +1 -0
  57. package/cjs/drivers/mongo/mongo-query-parser.d.ts +262 -0
  58. package/cjs/drivers/mongo/mongo-query-parser.d.ts.map +1 -0
  59. package/cjs/drivers/mongo/mongo-query-parser.js +1351 -0
  60. package/cjs/drivers/mongo/mongo-query-parser.js.map +1 -0
  61. package/cjs/drivers/mongo/mongo-sync-adapter.d.ts +79 -0
  62. package/cjs/drivers/mongo/mongo-sync-adapter.d.ts.map +1 -0
  63. package/cjs/drivers/mongo/mongo-sync-adapter.js +146 -0
  64. package/cjs/drivers/mongo/mongo-sync-adapter.js.map +1 -0
  65. package/cjs/drivers/mongo/mongodb-blueprint.d.ts +30 -0
  66. package/cjs/drivers/mongo/mongodb-blueprint.d.ts.map +1 -0
  67. package/cjs/drivers/mongo/mongodb-blueprint.js +51 -0
  68. package/cjs/drivers/mongo/mongodb-blueprint.js.map +1 -0
  69. package/cjs/drivers/mongo/mongodb-driver.d.ts +188 -0
  70. package/cjs/drivers/mongo/mongodb-driver.d.ts.map +1 -0
  71. package/cjs/drivers/mongo/mongodb-driver.js +411 -0
  72. package/cjs/drivers/mongo/mongodb-driver.js.map +1 -0
  73. package/cjs/drivers/mongo/types.d.ts +43 -0
  74. package/cjs/drivers/mongo/types.d.ts.map +1 -0
  75. package/cjs/errors/missing-data-source.error.d.ts +22 -0
  76. package/cjs/errors/missing-data-source.error.d.ts.map +1 -0
  77. package/cjs/errors/missing-data-source.error.js +29 -0
  78. package/cjs/errors/missing-data-source.error.js.map +1 -0
  79. package/cjs/events/model-events.d.ts +231 -0
  80. package/cjs/events/model-events.d.ts.map +1 -0
  81. package/cjs/events/model-events.js +259 -0
  82. package/cjs/events/model-events.js.map +1 -0
  83. package/cjs/expressions/aggregate-expressions.d.ts +215 -0
  84. package/cjs/expressions/aggregate-expressions.d.ts.map +1 -0
  85. package/cjs/expressions/aggregate-expressions.js +221 -0
  86. package/cjs/expressions/aggregate-expressions.js.map +1 -0
  87. package/cjs/expressions/index.d.ts +2 -0
  88. package/cjs/expressions/index.d.ts.map +1 -0
  89. package/cjs/index.d.ts +41 -0
  90. package/cjs/index.d.ts.map +1 -0
  91. package/cjs/index.js +1 -267
  92. package/cjs/index.js.map +1 -1
  93. package/cjs/migration/column-builder.d.ts +167 -0
  94. package/cjs/migration/column-builder.d.ts.map +1 -0
  95. package/cjs/migration/column-builder.js +217 -0
  96. package/cjs/migration/column-builder.js.map +1 -0
  97. package/cjs/migration/foreign-key-builder.d.ts +110 -0
  98. package/cjs/migration/foreign-key-builder.d.ts.map +1 -0
  99. package/cjs/migration/foreign-key-builder.js +129 -0
  100. package/cjs/migration/foreign-key-builder.js.map +1 -0
  101. package/cjs/migration/index.d.ts +6 -0
  102. package/cjs/migration/index.d.ts.map +1 -0
  103. package/cjs/migration/migration-runner.d.ts +231 -0
  104. package/cjs/migration/migration-runner.d.ts.map +1 -0
  105. package/cjs/migration/migration-runner.js +443 -0
  106. package/cjs/migration/migration-runner.js.map +1 -0
  107. package/cjs/migration/migration.js +1346 -0
  108. package/cjs/migration/migration.js.map +1 -0
  109. package/cjs/migration/types.d.ts +132 -0
  110. package/cjs/migration/types.d.ts.map +1 -0
  111. package/cjs/model/model.d.ts +1267 -0
  112. package/cjs/model/model.d.ts.map +1 -0
  113. package/cjs/model/model.js +1463 -0
  114. package/cjs/model/model.js.map +1 -0
  115. package/cjs/model/register-model.d.ts +80 -0
  116. package/cjs/model/register-model.d.ts.map +1 -0
  117. package/cjs/model/register-model.js +91 -0
  118. package/cjs/model/register-model.js.map +1 -0
  119. package/cjs/remover/database-remover.d.ts +100 -0
  120. package/cjs/remover/database-remover.d.ts.map +1 -0
  121. package/cjs/remover/database-remover.js +209 -0
  122. package/cjs/remover/database-remover.js.map +1 -0
  123. package/cjs/restorer/database-restorer.d.ts +131 -0
  124. package/cjs/restorer/database-restorer.d.ts.map +1 -0
  125. package/cjs/restorer/database-restorer.js +425 -0
  126. package/cjs/restorer/database-restorer.js.map +1 -0
  127. package/cjs/sync/index.d.ts +12 -0
  128. package/cjs/sync/index.d.ts.map +1 -0
  129. package/cjs/sync/model-events.d.ts +62 -0
  130. package/cjs/sync/model-events.d.ts.map +1 -0
  131. package/cjs/sync/model-events.js +49 -0
  132. package/cjs/sync/model-events.js.map +1 -0
  133. package/cjs/sync/model-sync-operation.d.ts +163 -0
  134. package/cjs/sync/model-sync-operation.d.ts.map +1 -0
  135. package/cjs/sync/model-sync-operation.js +292 -0
  136. package/cjs/sync/model-sync-operation.js.map +1 -0
  137. package/cjs/sync/model-sync.d.ts +130 -0
  138. package/cjs/sync/model-sync.d.ts.map +1 -0
  139. package/cjs/sync/model-sync.js +178 -0
  140. package/cjs/sync/model-sync.js.map +1 -0
  141. package/cjs/sync/sync-context.d.ts +70 -0
  142. package/cjs/sync/sync-context.d.ts.map +1 -0
  143. package/cjs/sync/sync-context.js +101 -0
  144. package/cjs/sync/sync-context.js.map +1 -0
  145. package/cjs/sync/sync-manager.d.ts +213 -0
  146. package/cjs/sync/sync-manager.d.ts.map +1 -0
  147. package/cjs/sync/sync-manager.js +689 -0
  148. package/cjs/sync/sync-manager.js.map +1 -0
  149. package/cjs/sync/types.d.ts +289 -0
  150. package/cjs/sync/types.d.ts.map +1 -0
  151. package/cjs/types.d.ts +45 -0
  152. package/cjs/types.d.ts.map +1 -0
  153. package/cjs/utils/connect-to-database.d.ts +246 -0
  154. package/cjs/utils/connect-to-database.d.ts.map +1 -0
  155. package/cjs/utils/connect-to-database.js +92 -0
  156. package/cjs/utils/connect-to-database.js.map +1 -0
  157. package/cjs/utils/database-writer.utils.d.ts +15 -0
  158. package/cjs/utils/database-writer.utils.d.ts.map +1 -0
  159. package/cjs/utils/database-writer.utils.js +14 -0
  160. package/cjs/utils/database-writer.utils.js.map +1 -0
  161. package/cjs/utils/define-model.js +100 -0
  162. package/cjs/utils/define-model.js.map +1 -0
  163. package/cjs/utils/once-connected.d.ts +146 -0
  164. package/cjs/utils/once-connected.d.ts.map +1 -0
  165. package/cjs/utils/once-connected.js +252 -0
  166. package/cjs/utils/once-connected.js.map +1 -0
  167. package/cjs/validation/database-seal-plugins.d.ts +2 -0
  168. package/cjs/validation/database-seal-plugins.d.ts.map +1 -0
  169. package/cjs/validation/database-seal-plugins.js +4 -0
  170. package/cjs/validation/database-seal-plugins.js.map +1 -0
  171. package/cjs/validation/database-writer-validation-error.d.ts +97 -0
  172. package/cjs/validation/database-writer-validation-error.d.ts.map +1 -0
  173. package/cjs/validation/database-writer-validation-error.js +160 -0
  174. package/cjs/validation/database-writer-validation-error.js.map +1 -0
  175. package/cjs/validation/index.d.ts +3 -0
  176. package/cjs/validation/index.d.ts.map +1 -0
  177. package/cjs/validation/mutators/embed-mutator.d.ts +9 -0
  178. package/cjs/validation/mutators/embed-mutator.d.ts.map +1 -0
  179. package/cjs/validation/mutators/embed-mutator.js +33 -0
  180. package/cjs/validation/mutators/embed-mutator.js.map +1 -0
  181. package/cjs/validation/plugins/embed-validator-plugin.d.ts +24 -0
  182. package/cjs/validation/plugins/embed-validator-plugin.d.ts.map +1 -0
  183. package/cjs/validation/plugins/embed-validator-plugin.js +18 -0
  184. package/cjs/validation/plugins/embed-validator-plugin.js.map +1 -0
  185. package/cjs/validation/rules/database-model-rule.d.ts +7 -0
  186. package/cjs/validation/rules/database-model-rule.d.ts.map +1 -0
  187. package/cjs/validation/rules/database-model-rule.js +27 -0
  188. package/cjs/validation/rules/database-model-rule.js.map +1 -0
  189. package/cjs/validation/transformers/embed-model-transformer.d.ts +3 -0
  190. package/cjs/validation/transformers/embed-model-transformer.d.ts.map +1 -0
  191. package/cjs/validation/transformers/embed-model-transformer.js +18 -0
  192. package/cjs/validation/transformers/embed-model-transformer.js.map +1 -0
  193. package/cjs/validation/validators/embed-validator.d.ts +21 -0
  194. package/cjs/validation/validators/embed-validator.d.ts.map +1 -0
  195. package/cjs/validation/validators/embed-validator.js +42 -0
  196. package/cjs/validation/validators/embed-validator.js.map +1 -0
  197. package/cjs/writer/database-writer.d.ts +181 -0
  198. package/cjs/writer/database-writer.d.ts.map +1 -0
  199. package/cjs/writer/database-writer.js +402 -0
  200. package/cjs/writer/database-writer.js.map +1 -0
  201. package/esm/context/database-data-source-context.d.ts +29 -0
  202. package/esm/context/database-data-source-context.d.ts.map +1 -0
  203. package/esm/context/database-data-source-context.js +28 -0
  204. package/esm/context/database-data-source-context.js.map +1 -0
  205. package/esm/context/database-transaction-context.d.ts +31 -0
  206. package/esm/context/database-transaction-context.d.ts.map +1 -0
  207. package/esm/context/database-transaction-context.js +34 -0
  208. package/esm/context/database-transaction-context.js.map +1 -0
  209. package/esm/contracts/database-driver.contract.d.ts +143 -0
  210. package/esm/contracts/database-driver.contract.d.ts.map +1 -0
  211. package/esm/contracts/database-id-generator.contract.d.ts +109 -0
  212. package/esm/contracts/database-id-generator.contract.d.ts.map +1 -0
  213. package/esm/contracts/database-remover.contract.d.ts +104 -0
  214. package/esm/contracts/database-remover.contract.d.ts.map +1 -0
  215. package/esm/contracts/database-restorer.contract.d.ts +143 -0
  216. package/esm/contracts/database-restorer.contract.d.ts.map +1 -0
  217. package/esm/contracts/database-writer.contract.d.ts +119 -0
  218. package/esm/contracts/database-writer.contract.d.ts.map +1 -0
  219. package/esm/contracts/driver-blueprint.contract.d.ts +45 -0
  220. package/esm/contracts/driver-blueprint.contract.d.ts.map +1 -0
  221. package/esm/contracts/index.d.ts +10 -0
  222. package/esm/contracts/index.d.ts.map +1 -0
  223. package/esm/contracts/migration-driver.contract.d.ts +365 -0
  224. package/esm/contracts/migration-driver.contract.d.ts.map +1 -0
  225. package/esm/contracts/query-builder.contract.d.ts +1128 -0
  226. package/esm/contracts/query-builder.contract.d.ts.map +1 -0
  227. package/esm/contracts/sync-adapter.contract.d.ts +58 -0
  228. package/esm/contracts/sync-adapter.contract.d.ts.map +1 -0
  229. package/esm/data-source/data-source-registry.d.ts +104 -0
  230. package/esm/data-source/data-source-registry.d.ts.map +1 -0
  231. package/esm/data-source/data-source-registry.js +138 -0
  232. package/esm/data-source/data-source-registry.js.map +1 -0
  233. package/esm/data-source/data-source.d.ts +106 -0
  234. package/esm/data-source/data-source.d.ts.map +1 -0
  235. package/esm/data-source/data-source.js +77 -0
  236. package/esm/data-source/data-source.js.map +1 -0
  237. package/esm/database-dirty-tracker.d.ts +253 -0
  238. package/esm/database-dirty-tracker.d.ts.map +1 -0
  239. package/esm/database-dirty-tracker.js +389 -0
  240. package/esm/database-dirty-tracker.js.map +1 -0
  241. package/esm/drivers/mongo/mongo-id-generator.d.ts +116 -0
  242. package/esm/drivers/mongo/mongo-id-generator.d.ts.map +1 -0
  243. package/esm/drivers/mongo/mongo-id-generator.js +149 -0
  244. package/esm/drivers/mongo/mongo-id-generator.js.map +1 -0
  245. package/esm/drivers/mongo/mongo-migration-driver.d.ts +228 -0
  246. package/esm/drivers/mongo/mongo-migration-driver.d.ts.map +1 -0
  247. package/esm/drivers/mongo/mongo-migration-driver.js +524 -0
  248. package/esm/drivers/mongo/mongo-migration-driver.js.map +1 -0
  249. package/esm/drivers/mongo/mongo-query-builder.d.ts +922 -0
  250. package/esm/drivers/mongo/mongo-query-builder.d.ts.map +1 -0
  251. package/esm/drivers/mongo/mongo-query-builder.js +1740 -0
  252. package/esm/drivers/mongo/mongo-query-builder.js.map +1 -0
  253. package/esm/drivers/mongo/mongo-query-operations.d.ts +226 -0
  254. package/esm/drivers/mongo/mongo-query-operations.d.ts.map +1 -0
  255. package/esm/drivers/mongo/mongo-query-operations.js +270 -0
  256. package/esm/drivers/mongo/mongo-query-operations.js.map +1 -0
  257. package/esm/drivers/mongo/mongo-query-parser.d.ts +262 -0
  258. package/esm/drivers/mongo/mongo-query-parser.d.ts.map +1 -0
  259. package/esm/drivers/mongo/mongo-query-parser.js +1351 -0
  260. package/esm/drivers/mongo/mongo-query-parser.js.map +1 -0
  261. package/esm/drivers/mongo/mongo-sync-adapter.d.ts +79 -0
  262. package/esm/drivers/mongo/mongo-sync-adapter.d.ts.map +1 -0
  263. package/esm/drivers/mongo/mongo-sync-adapter.js +146 -0
  264. package/esm/drivers/mongo/mongo-sync-adapter.js.map +1 -0
  265. package/esm/drivers/mongo/mongodb-blueprint.d.ts +30 -0
  266. package/esm/drivers/mongo/mongodb-blueprint.d.ts.map +1 -0
  267. package/esm/drivers/mongo/mongodb-blueprint.js +51 -0
  268. package/esm/drivers/mongo/mongodb-blueprint.js.map +1 -0
  269. package/esm/drivers/mongo/mongodb-driver.d.ts +188 -0
  270. package/esm/drivers/mongo/mongodb-driver.d.ts.map +1 -0
  271. package/esm/drivers/mongo/mongodb-driver.js +411 -0
  272. package/esm/drivers/mongo/mongodb-driver.js.map +1 -0
  273. package/esm/drivers/mongo/types.d.ts +43 -0
  274. package/esm/drivers/mongo/types.d.ts.map +1 -0
  275. package/esm/errors/missing-data-source.error.d.ts +22 -0
  276. package/esm/errors/missing-data-source.error.d.ts.map +1 -0
  277. package/esm/errors/missing-data-source.error.js +29 -0
  278. package/esm/errors/missing-data-source.error.js.map +1 -0
  279. package/esm/events/model-events.d.ts +231 -0
  280. package/esm/events/model-events.d.ts.map +1 -0
  281. package/esm/events/model-events.js +259 -0
  282. package/esm/events/model-events.js.map +1 -0
  283. package/esm/expressions/aggregate-expressions.d.ts +215 -0
  284. package/esm/expressions/aggregate-expressions.d.ts.map +1 -0
  285. package/esm/expressions/aggregate-expressions.js +221 -0
  286. package/esm/expressions/aggregate-expressions.js.map +1 -0
  287. package/esm/expressions/index.d.ts +2 -0
  288. package/esm/expressions/index.d.ts.map +1 -0
  289. package/esm/index.d.ts +41 -0
  290. package/esm/index.d.ts.map +1 -0
  291. package/esm/index.js +1 -40
  292. package/esm/index.js.map +1 -1
  293. package/esm/migration/column-builder.d.ts +167 -0
  294. package/esm/migration/column-builder.d.ts.map +1 -0
  295. package/esm/migration/column-builder.js +217 -0
  296. package/esm/migration/column-builder.js.map +1 -0
  297. package/esm/migration/foreign-key-builder.d.ts +110 -0
  298. package/esm/migration/foreign-key-builder.d.ts.map +1 -0
  299. package/esm/migration/foreign-key-builder.js +129 -0
  300. package/esm/migration/foreign-key-builder.js.map +1 -0
  301. package/esm/migration/index.d.ts +6 -0
  302. package/esm/migration/index.d.ts.map +1 -0
  303. package/esm/migration/migration-runner.d.ts +231 -0
  304. package/esm/migration/migration-runner.d.ts.map +1 -0
  305. package/esm/migration/migration-runner.js +443 -0
  306. package/esm/migration/migration-runner.js.map +1 -0
  307. package/esm/migration/migration.js +1346 -0
  308. package/esm/migration/migration.js.map +1 -0
  309. package/esm/migration/types.d.ts +132 -0
  310. package/esm/migration/types.d.ts.map +1 -0
  311. package/esm/model/model.d.ts +1267 -0
  312. package/esm/model/model.d.ts.map +1 -0
  313. package/esm/model/model.js +1463 -0
  314. package/esm/model/model.js.map +1 -0
  315. package/esm/model/register-model.d.ts +80 -0
  316. package/esm/model/register-model.d.ts.map +1 -0
  317. package/esm/model/register-model.js +91 -0
  318. package/esm/model/register-model.js.map +1 -0
  319. package/esm/remover/database-remover.d.ts +100 -0
  320. package/esm/remover/database-remover.d.ts.map +1 -0
  321. package/esm/remover/database-remover.js +209 -0
  322. package/esm/remover/database-remover.js.map +1 -0
  323. package/esm/restorer/database-restorer.d.ts +131 -0
  324. package/esm/restorer/database-restorer.d.ts.map +1 -0
  325. package/esm/restorer/database-restorer.js +425 -0
  326. package/esm/restorer/database-restorer.js.map +1 -0
  327. package/esm/sync/index.d.ts +12 -0
  328. package/esm/sync/index.d.ts.map +1 -0
  329. package/esm/sync/model-events.d.ts +62 -0
  330. package/esm/sync/model-events.d.ts.map +1 -0
  331. package/esm/sync/model-events.js +49 -0
  332. package/esm/sync/model-events.js.map +1 -0
  333. package/esm/sync/model-sync-operation.d.ts +163 -0
  334. package/esm/sync/model-sync-operation.d.ts.map +1 -0
  335. package/esm/sync/model-sync-operation.js +292 -0
  336. package/esm/sync/model-sync-operation.js.map +1 -0
  337. package/esm/sync/model-sync.d.ts +130 -0
  338. package/esm/sync/model-sync.d.ts.map +1 -0
  339. package/esm/sync/model-sync.js +178 -0
  340. package/esm/sync/model-sync.js.map +1 -0
  341. package/esm/sync/sync-context.d.ts +70 -0
  342. package/esm/sync/sync-context.d.ts.map +1 -0
  343. package/esm/sync/sync-context.js +101 -0
  344. package/esm/sync/sync-context.js.map +1 -0
  345. package/esm/sync/sync-manager.d.ts +213 -0
  346. package/esm/sync/sync-manager.d.ts.map +1 -0
  347. package/esm/sync/sync-manager.js +689 -0
  348. package/esm/sync/sync-manager.js.map +1 -0
  349. package/esm/sync/types.d.ts +289 -0
  350. package/esm/sync/types.d.ts.map +1 -0
  351. package/esm/types.d.ts +45 -0
  352. package/esm/types.d.ts.map +1 -0
  353. package/esm/utils/connect-to-database.d.ts +246 -0
  354. package/esm/utils/connect-to-database.d.ts.map +1 -0
  355. package/esm/utils/connect-to-database.js +92 -0
  356. package/esm/utils/connect-to-database.js.map +1 -0
  357. package/esm/utils/database-writer.utils.d.ts +15 -0
  358. package/esm/utils/database-writer.utils.d.ts.map +1 -0
  359. package/esm/utils/database-writer.utils.js +14 -0
  360. package/esm/utils/database-writer.utils.js.map +1 -0
  361. package/esm/utils/define-model.js +100 -0
  362. package/esm/utils/define-model.js.map +1 -0
  363. package/esm/utils/once-connected.d.ts +146 -0
  364. package/esm/utils/once-connected.d.ts.map +1 -0
  365. package/esm/utils/once-connected.js +252 -0
  366. package/esm/utils/once-connected.js.map +1 -0
  367. package/esm/validation/database-seal-plugins.d.ts +2 -0
  368. package/esm/validation/database-seal-plugins.d.ts.map +1 -0
  369. package/esm/validation/database-seal-plugins.js +4 -0
  370. package/esm/validation/database-seal-plugins.js.map +1 -0
  371. package/esm/validation/database-writer-validation-error.d.ts +97 -0
  372. package/esm/validation/database-writer-validation-error.d.ts.map +1 -0
  373. package/esm/validation/database-writer-validation-error.js +160 -0
  374. package/esm/validation/database-writer-validation-error.js.map +1 -0
  375. package/esm/validation/index.d.ts +3 -0
  376. package/esm/validation/index.d.ts.map +1 -0
  377. package/esm/validation/mutators/embed-mutator.d.ts +9 -0
  378. package/esm/validation/mutators/embed-mutator.d.ts.map +1 -0
  379. package/esm/validation/mutators/embed-mutator.js +33 -0
  380. package/esm/validation/mutators/embed-mutator.js.map +1 -0
  381. package/esm/validation/plugins/embed-validator-plugin.d.ts +24 -0
  382. package/esm/validation/plugins/embed-validator-plugin.d.ts.map +1 -0
  383. package/esm/validation/plugins/embed-validator-plugin.js +18 -0
  384. package/esm/validation/plugins/embed-validator-plugin.js.map +1 -0
  385. package/esm/validation/rules/database-model-rule.d.ts +7 -0
  386. package/esm/validation/rules/database-model-rule.d.ts.map +1 -0
  387. package/esm/validation/rules/database-model-rule.js +27 -0
  388. package/esm/validation/rules/database-model-rule.js.map +1 -0
  389. package/esm/validation/transformers/embed-model-transformer.d.ts +3 -0
  390. package/esm/validation/transformers/embed-model-transformer.d.ts.map +1 -0
  391. package/esm/validation/transformers/embed-model-transformer.js +18 -0
  392. package/esm/validation/transformers/embed-model-transformer.js.map +1 -0
  393. package/esm/validation/validators/embed-validator.d.ts +21 -0
  394. package/esm/validation/validators/embed-validator.d.ts.map +1 -0
  395. package/esm/validation/validators/embed-validator.js +42 -0
  396. package/esm/validation/validators/embed-validator.js.map +1 -0
  397. package/esm/writer/database-writer.d.ts +181 -0
  398. package/esm/writer/database-writer.d.ts.map +1 -0
  399. package/esm/writer/database-writer.js +402 -0
  400. package/esm/writer/database-writer.js.map +1 -0
  401. package/package.json +61 -52
@@ -0,0 +1,411 @@
1
+ import {colors}from'@mongez/copper';import {log}from'@warlock.js/logger';import {EventEmitter}from'node:events';import {databaseTransactionContext}from'../../context/database-transaction-context.js';import {dataSourceRegistry}from'../../data-source/data-source-registry.js';import {MongoIdGenerator}from'./mongo-id-generator.js';import {MongoMigrationDriver}from'./mongo-migration-driver.js';import {MongoQueryBuilder}from'./mongo-query-builder.js';import {MongoSyncAdapter}from'./mongo-sync-adapter.js';import {MongoDBBlueprint}from'./mongodb-blueprint.js';const DEFAULT_TRANSACTION_OPTIONS = {
2
+ readPreference: "primary",
3
+ readConcern: { level: "local" },
4
+ writeConcern: { w: "majority" },
5
+ };
6
+ let ObjectId;
7
+ /**
8
+ * MongoDB driver implementation that fulfils the Cascade driver contract.
9
+ *
10
+ * It encapsulates the native Mongo client, exposes lifecycle events, and
11
+ * provides helpers for CRUD, transactions, atomic updates, and sync adapters.
12
+ */
13
+ class MongoDbDriver {
14
+ config;
15
+ driverOptions;
16
+ events = new EventEmitter();
17
+ client;
18
+ database;
19
+ connected = false;
20
+ syncAdapterInstance;
21
+ migrationDriverInstance;
22
+ transactionOptions;
23
+ idGeneratorInstance;
24
+ _blueprint;
25
+ get blueprint() {
26
+ if (!this._blueprint) {
27
+ this._blueprint = new MongoDBBlueprint(this.database);
28
+ }
29
+ return this._blueprint;
30
+ }
31
+ /**
32
+ * The name of this driver.
33
+ */
34
+ name = "mongodb";
35
+ /**
36
+ * Create a new MongoDB driver using the supplied connection options.
37
+ *
38
+ * @param config - Connection configuration
39
+ * @param driverOptions - Driver-specific options
40
+ */
41
+ constructor(config, driverOptions) {
42
+ this.config = config;
43
+ this.driverOptions = driverOptions;
44
+ this.transactionOptions = {
45
+ ...DEFAULT_TRANSACTION_OPTIONS,
46
+ ...driverOptions?.transactionOptions,
47
+ };
48
+ }
49
+ /**
50
+ * Indicates whether the driver currently maintains an active connection.
51
+ */
52
+ get isConnected() {
53
+ return this.connected;
54
+ }
55
+ /**
56
+ * Get the MongoDB database instance.
57
+ *
58
+ * @returns The MongoDB Db instance
59
+ * @throws {Error} If not connected
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const db = driver.getDatabase();
64
+ * const collection = db.collection("users");
65
+ * ```
66
+ */
67
+ getDatabase() {
68
+ if (!this.database) {
69
+ throw new Error("Database not available. Ensure the driver is connected before accessing the database.");
70
+ }
71
+ return this.database;
72
+ }
73
+ /**
74
+ * Get the ID generator instance for this driver.
75
+ *
76
+ * Creates a MongoIdGenerator on first access if autoGenerateId is enabled.
77
+ *
78
+ * @returns The ID generator instance, or undefined if disabled
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const idGenerator = driver.getIdGenerator();
83
+ * if (idGenerator) {
84
+ * const id = await idGenerator.generateNextId({ table: "users" });
85
+ * }
86
+ * ```
87
+ */
88
+ getIdGenerator() {
89
+ // Return undefined if ID generation is disabled
90
+ if (this.driverOptions?.autoGenerateId === false) {
91
+ return undefined;
92
+ }
93
+ // Create ID generator lazily on first access
94
+ if (!this.idGeneratorInstance) {
95
+ this.idGeneratorInstance = new MongoIdGenerator(this, this.driverOptions?.counterCollection);
96
+ }
97
+ return this.idGeneratorInstance;
98
+ }
99
+ /**
100
+ * Establish a MongoDB connection using the configured options.
101
+ * Throws if the connection attempt fails.
102
+ */
103
+ async connect() {
104
+ if (this.connected) {
105
+ return;
106
+ }
107
+ const uri = this.resolveUri();
108
+ const { MongoClient, ObjectId: ObjectIdMongoDB } = await import('mongodb');
109
+ ObjectId = ObjectIdMongoDB;
110
+ const client = new MongoClient(uri, this.buildClientOptions());
111
+ try {
112
+ log.info("database", "connection", `Connecting to database ${colors.bold(colors.yellowBright(this.config.database))}`);
113
+ await client.connect();
114
+ this.client = client;
115
+ this.database = client.db(this.config.database);
116
+ this.connected = true;
117
+ log.success("database", "connection", "Connected to database");
118
+ client.on("close", () => {
119
+ if (this.connected) {
120
+ this.connected = false;
121
+ this.emit("disconnected");
122
+ log.warn("database", "connection", "Disconnected from database");
123
+ }
124
+ });
125
+ this.emit("connected");
126
+ }
127
+ catch (error) {
128
+ await client.close().catch(() => undefined);
129
+ this.emit("disconnected");
130
+ throw error;
131
+ }
132
+ }
133
+ /**
134
+ * Close the underlying MongoDB connection.
135
+ */
136
+ async disconnect() {
137
+ if (!this.client) {
138
+ return;
139
+ }
140
+ try {
141
+ await this.client.close();
142
+ }
143
+ finally {
144
+ this.connected = false;
145
+ this.emit("disconnected");
146
+ }
147
+ }
148
+ /**
149
+ * Subscribe to driver lifecycle events.
150
+ */
151
+ on(event, listener) {
152
+ this.events.on(event, listener);
153
+ }
154
+ /**
155
+ * Insert a single document into the given collection.
156
+ */
157
+ async insert(table, document, options) {
158
+ const collection = this.getDatabaseInstance().collection(table);
159
+ const mongoOptions = this.withSession(options);
160
+ const result = await collection.insertOne(document, mongoOptions);
161
+ return {
162
+ document: {
163
+ ...document,
164
+ _id: result.insertedId,
165
+ },
166
+ };
167
+ }
168
+ /**
169
+ * Insert multiple documents into the given collection.
170
+ */
171
+ async insertMany(table, documents, options) {
172
+ const collection = this.getDatabaseInstance().collection(table);
173
+ const mongoOptions = this.withSession(options);
174
+ const result = await collection.insertMany(documents, mongoOptions);
175
+ return documents.map((document, index) => {
176
+ const insertedId = result.insertedIds[index];
177
+ return {
178
+ document: {
179
+ ...document,
180
+ _id: insertedId,
181
+ },
182
+ };
183
+ });
184
+ }
185
+ /**
186
+ * Update a single document that matches the provided filter.
187
+ */
188
+ async update(table, filter, update, options) {
189
+ const collection = this.getDatabaseInstance().collection(table);
190
+ const mongoOptions = this.withSession(options);
191
+ const result = await collection.updateOne(filter, update, mongoOptions);
192
+ return { modifiedCount: result.modifiedCount };
193
+ }
194
+ /**
195
+ * Replace a single document that matches the provided filter.
196
+ */
197
+ async replace(table, filter, document, options) {
198
+ const collection = this.getDatabaseInstance().collection(table);
199
+ const result = await collection.findOneAndReplace(filter, document);
200
+ return result?.value;
201
+ }
202
+ /**
203
+ * Update multiple documents that match the provided filter.
204
+ */
205
+ async updateMany(table, filter, update, options) {
206
+ const collection = this.getDatabaseInstance().collection(table);
207
+ const mongoOptions = this.withSession(options);
208
+ const result = await collection.updateMany(filter, update, mongoOptions);
209
+ return { modifiedCount: result.modifiedCount };
210
+ }
211
+ /**
212
+ * Delete a single document that matches the provided filter.
213
+ */
214
+ async delete(table, filter = {}, options) {
215
+ const collection = this.getDatabaseInstance().collection(table);
216
+ const mongoOptions = this.withSession(options);
217
+ const result = await collection.deleteOne(filter, mongoOptions);
218
+ return result.deletedCount > 0 ? 1 : 0;
219
+ }
220
+ /**
221
+ * Delete documents that match the provided filter.
222
+ */
223
+ async deleteMany(table, filter = {}, options) {
224
+ const collection = this.getDatabaseInstance().collection(table);
225
+ const mongoOptions = this.withSession(options);
226
+ const result = await collection.deleteMany(filter, mongoOptions);
227
+ return result.deletedCount ?? 0;
228
+ }
229
+ /**
230
+ * Remove all records from a collection.
231
+ *
232
+ * This uses deleteMany with an empty filter to remove all documents.
233
+ * For very large collections, consider using the migration driver's
234
+ * dropTable + createTable approach for better performance.
235
+ */
236
+ async truncateTable(table, options) {
237
+ const collection = this.getDatabaseInstance().collection(table);
238
+ const mongoOptions = this.withSession(options);
239
+ const result = await collection.deleteMany({}, mongoOptions);
240
+ return result.deletedCount ?? 0;
241
+ }
242
+ /**
243
+ * Serialize the given data
244
+ */
245
+ serialize(data) {
246
+ if (data._id && data._id instanceof ObjectId) {
247
+ data._id = data._id.toString();
248
+ }
249
+ return data;
250
+ }
251
+ /**
252
+ * Deserialize the given data
253
+ */
254
+ deserialize(data) {
255
+ if (data._id && typeof data._id === "string") {
256
+ data._id = new ObjectId(data._id);
257
+ }
258
+ return data;
259
+ }
260
+ /**
261
+ * Provide a Mongo-backed query builder instance for the given collection.
262
+ */
263
+ queryBuilder(table) {
264
+ return new MongoQueryBuilder(table, dataSourceRegistry.get());
265
+ }
266
+ /**
267
+ * Begin a MongoDB transaction, returning commit/rollback helpers.
268
+ */
269
+ async beginTransaction() {
270
+ const client = this.getClientInstance();
271
+ const session = client.startSession();
272
+ await session.startTransaction(this.transactionOptions);
273
+ databaseTransactionContext.enter({ session });
274
+ let finished = false;
275
+ const finalize = async (operation) => {
276
+ if (finished)
277
+ return;
278
+ try {
279
+ await operation();
280
+ }
281
+ finally {
282
+ finished = true;
283
+ databaseTransactionContext.exit();
284
+ await session.endSession().catch(() => undefined);
285
+ }
286
+ };
287
+ return {
288
+ context: session,
289
+ commit: async () => {
290
+ await finalize(async () => {
291
+ try {
292
+ await session.commitTransaction();
293
+ }
294
+ catch (error) {
295
+ await session.abortTransaction().catch(() => undefined);
296
+ throw error;
297
+ }
298
+ });
299
+ },
300
+ rollback: async () => {
301
+ await finalize(async () => {
302
+ await session.abortTransaction();
303
+ });
304
+ },
305
+ };
306
+ }
307
+ /**
308
+ * Execute atomic operations (typically $inc/$set style updates) against documents.
309
+ *
310
+ * Uses `updateMany` so callers can atomically modify any set of documents.
311
+ */
312
+ async atomic(table, filter, operations, options) {
313
+ const collection = this.getDatabaseInstance().collection(table);
314
+ const mongoOptions = this.withSession(options);
315
+ const result = await collection.updateMany(filter, operations, mongoOptions);
316
+ return { modifiedCount: result.modifiedCount };
317
+ }
318
+ /**
319
+ * Lazily create (and cache) the Mongo sync adapter.
320
+ * The adapter uses this driver instance to ensure all operations
321
+ * participate in active transactions via the session context.
322
+ */
323
+ syncAdapter() {
324
+ if (!this.syncAdapterInstance) {
325
+ this.syncAdapterInstance = new MongoSyncAdapter(this);
326
+ }
327
+ return this.syncAdapterInstance;
328
+ }
329
+ /**
330
+ * Lazily create (and cache) the Mongo migration driver.
331
+ * The migration driver handles schema operations like indexes, collections, etc.
332
+ */
333
+ migrationDriver() {
334
+ if (!this.migrationDriverInstance) {
335
+ this.migrationDriverInstance = new MongoMigrationDriver(this);
336
+ }
337
+ return this.migrationDriverInstance;
338
+ }
339
+ /**
340
+ * Expose the underlying Mongo client for advanced consumers.
341
+ */
342
+ getClient() {
343
+ return this.getClientInstance();
344
+ }
345
+ /**
346
+ * Retrieve the active Mongo client, throwing if the driver is disconnected.
347
+ */
348
+ getClientInstance() {
349
+ if (!this.client) {
350
+ throw new Error("Mongo driver is not connected.");
351
+ }
352
+ return this.client;
353
+ }
354
+ /**
355
+ * Retrieve the active Mongo database, throwing if the driver is disconnected.
356
+ * @private
357
+ */
358
+ getDatabaseInstance() {
359
+ if (!this.database) {
360
+ throw new Error("Mongo driver is not connected to a database.");
361
+ }
362
+ return this.database;
363
+ }
364
+ /**
365
+ * Resolve the Mongo connection string based on provided options.
366
+ */
367
+ resolveUri() {
368
+ if (this.config.uri) {
369
+ return this.config.uri;
370
+ }
371
+ const host = this.config.host ?? "localhost";
372
+ const port = this.config.port ?? 27017;
373
+ return `mongodb://${host}:${port}`;
374
+ }
375
+ /**
376
+ * Build the Mongo client options derived from the driver configuration.
377
+ */
378
+ buildClientOptions() {
379
+ const baseOptions = {
380
+ ...(this.config.clientOptions ?? {}),
381
+ };
382
+ if (this.config.username && !baseOptions.auth) {
383
+ baseOptions.auth = {
384
+ username: this.config.username,
385
+ password: this.config.password,
386
+ };
387
+ }
388
+ if (this.config.authSource && !baseOptions.authSource) {
389
+ baseOptions.authSource = this.config.authSource;
390
+ }
391
+ return baseOptions;
392
+ }
393
+ /**
394
+ * Emit a driver lifecycle event.
395
+ */
396
+ emit(event, ...args) {
397
+ this.events.emit(event, ...args);
398
+ }
399
+ /**
400
+ * Attach the active transaction session (when available) to Mongo options.
401
+ */
402
+ withSession(options) {
403
+ const session = databaseTransactionContext.getSession();
404
+ if (!session) {
405
+ return options;
406
+ }
407
+ const baseOptions = options ? { ...options } : {};
408
+ baseOptions.session = session;
409
+ return baseOptions;
410
+ }
411
+ }export{MongoDbDriver};//# sourceMappingURL=mongodb-driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongodb-driver.js","sources":["../../../src/drivers/mongo/mongodb-driver.ts"],"sourcesContent":[null],"names":[],"mappings":"8iBAsCA,MAAM,2BAA2B,GAAuB;AACtD,IAAA,cAAc,EAAE,SAAS;AACzB,IAAA,WAAW,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;AAC/B,IAAA,YAAY,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE;CAChC,CAAC;AAEF,IAAI,QAA2C,CAAC;AAEhD;;;;;AAKG;MACU,aAAa,CAAA;AA+BL,IAAA,MAAA,CAAA;AAUA,IAAA,aAAA,CAAA;AAxCF,IAAA,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;AACtC,IAAA,MAAM,CAAe;AACrB,IAAA,QAAQ,CAAM;IACb,SAAS,GAAG,KAAK,CAAC;AAClB,IAAA,mBAAmB,CAAoB;AACvC,IAAA,uBAAuB,CAA2B;AACzC,IAAA,kBAAkB,CAAqB;AAChD,IAAA,mBAAmB,CAAuB;AAC1C,IAAA,UAAU,CAA2B;AAE7C,IAAA,IAAW,SAAS,GAAA;AAClB,QAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,IAAI,CAAC,UAAU,GAAG,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
+ */
5
+ export type PipelineStage = "$match" | "$project" | "$sort" | "$group" | "$lookup" | "$limit" | "$skip" | "$unwind" | "$addFields" | "$setWindowFields";
6
+ /**
7
+ * Represents a single operation in the query builder chain.
8
+ */
9
+ export type Operation = {
10
+ /** The MongoDB aggregation stage this operation belongs to */
11
+ stage: PipelineStage;
12
+ /** Whether this operation can be merged with other operations of the same stage */
13
+ mergeable: boolean;
14
+ /** The operation type (for processing logic) */
15
+ type: string;
16
+ /** The operation payload */
17
+ payload: any;
18
+ };
19
+ /**
20
+ * MongoDB driver-specific options.
21
+ *
22
+ * These are cascade-next specific configurations for the MongoDB driver,
23
+ * not native MongoDB client options.
24
+ */
25
+ export type MongoDriverOptions = {
26
+ /**
27
+ * Enable auto-generation of numeric IDs.
28
+ * When enabled, creates a counter collection for managing sequential IDs.
29
+ * @default false
30
+ */
31
+ autoGenerateId?: boolean;
32
+ /**
33
+ * Counter collection name for auto-generated IDs.
34
+ * @default "counters"
35
+ */
36
+ counterCollection?: string;
37
+ /**
38
+ * Transaction options for this driver.
39
+ * Applied to all transactions unless overridden.
40
+ */
41
+ transactionOptions?: TransactionOptions;
42
+ };
43
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/drivers/mongo/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,UAAU,GACV,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,GACP,SAAS,GACT,YAAY,GACZ,kBAAkB,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,8DAA8D;IAC9D,KAAK,EAAE,aAAa,CAAC;IACrB,mFAAmF;IACnF,SAAS,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Error thrown when a requested data source is not found in the registry.
3
+ *
4
+ * This can occur when:
5
+ * - Attempting to retrieve a non-existent named data source
6
+ * - Trying to get the default data source before any have been registered
7
+ * - Context override references an unregistered data source name
8
+ */
9
+ export declare class MissingDataSourceError extends Error {
10
+ /**
11
+ * The name of the data source that was not found (if applicable).
12
+ */
13
+ readonly dataSourceName?: string;
14
+ /**
15
+ * Creates a new MissingDataSourceError.
16
+ *
17
+ * @param message - Descriptive error message
18
+ * @param dataSourceName - Optional data source name that was not found
19
+ */
20
+ constructor(message: string, dataSourceName?: string);
21
+ }
22
+ //# sourceMappingURL=missing-data-source.error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missing-data-source.error.d.ts","sourceRoot":"","sources":["../../src/errors/missing-data-source.error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C;;OAEG;IACH,SAAgB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExC;;;;;OAKG;gBACgB,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;CAU5D"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Error thrown when a requested data source is not found in the registry.
3
+ *
4
+ * This can occur when:
5
+ * - Attempting to retrieve a non-existent named data source
6
+ * - Trying to get the default data source before any have been registered
7
+ * - Context override references an unregistered data source name
8
+ */
9
+ class MissingDataSourceError extends Error {
10
+ /**
11
+ * The name of the data source that was not found (if applicable).
12
+ */
13
+ dataSourceName;
14
+ /**
15
+ * Creates a new MissingDataSourceError.
16
+ *
17
+ * @param message - Descriptive error message
18
+ * @param dataSourceName - Optional data source name that was not found
19
+ */
20
+ constructor(message, dataSourceName) {
21
+ super(message);
22
+ this.name = "MissingDataSourceError";
23
+ this.dataSourceName = dataSourceName;
24
+ // Maintains proper stack trace for where error was thrown (V8 only)
25
+ if (Error.captureStackTrace) {
26
+ Error.captureStackTrace(this, MissingDataSourceError);
27
+ }
28
+ }
29
+ }export{MissingDataSourceError};//# sourceMappingURL=missing-data-source.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missing-data-source.error.js","sources":["../../src/errors/missing-data-source.error.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;AAOG;AACG,MAAO,sBAAuB,SAAQ,KAAK,CAAA;AAC/C;;AAEG;AACa,IAAA,cAAc,CAAU;AAExC;;;;;AAKG;IACH,WAAmB,CAAA,OAAe,EAAE,cAAuB,EAAA;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;AACrC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;;QAGrC,IAAI,KAAK,CAAC,iBAAiB,EAAE;AAC3B,YAAA,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;AACvD,SAAA;KACF;AACF"}