joist-core 2.3.0-next.96 → 2.3.0-next.97

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 (687) hide show
  1. package/build/EntityManager.cjs +36 -39
  2. package/build/EntityManager.cjs.map +1 -1
  3. package/build/EntityManager.d.cts +4 -4
  4. package/build/EntityManager.d.mts +4 -4
  5. package/build/EntityManager.js +29 -32
  6. package/build/EntityManager.js.map +1 -1
  7. package/build/EntityMetadata.cjs +3 -3
  8. package/build/EntityMetadata.js +3 -3
  9. package/build/IndexManager.cjs +1 -1
  10. package/build/IndexManager.js +1 -1
  11. package/build/InstanceData.cjs +1 -1
  12. package/build/InstanceData.js +1 -1
  13. package/build/JoinRows.cjs +1 -1
  14. package/build/JoinRows.js +1 -1
  15. package/build/PluginManager.cjs +0 -1
  16. package/build/PluginManager.cjs.map +1 -1
  17. package/build/PluginManager.d.cts +1 -1
  18. package/build/PluginManager.d.mts +1 -1
  19. package/build/PluginManager.js +0 -1
  20. package/build/PluginManager.js.map +1 -1
  21. package/build/ReactionsManager.cjs +2 -2
  22. package/build/ReactionsManager.js +2 -2
  23. package/build/Todo.cjs +1 -1
  24. package/build/Todo.js +1 -1
  25. package/build/batchloaders/enumCollectionBatchLoader.cjs +1 -1
  26. package/build/batchloaders/enumCollectionBatchLoader.js +1 -1
  27. package/build/batchloaders/loadBatchLoader.cjs +6 -5
  28. package/build/batchloaders/loadBatchLoader.cjs.map +1 -1
  29. package/build/batchloaders/loadBatchLoader.d.cts.map +1 -1
  30. package/build/batchloaders/loadBatchLoader.d.mts.map +1 -1
  31. package/build/batchloaders/loadBatchLoader.js +4 -3
  32. package/build/batchloaders/loadBatchLoader.js.map +1 -1
  33. package/build/batchloaders/manyToManyBatchLoader.cjs +1 -1
  34. package/build/batchloaders/manyToManyBatchLoader.js +1 -1
  35. package/build/batchloaders/oneToManyBatchLoader.cjs +3 -3
  36. package/build/batchloaders/oneToManyBatchLoader.cjs.map +1 -1
  37. package/build/batchloaders/oneToManyBatchLoader.js +2 -2
  38. package/build/batchloaders/oneToOneBatchLoader.cjs +4 -4
  39. package/build/batchloaders/oneToOneBatchLoader.cjs.map +1 -1
  40. package/build/batchloaders/oneToOneBatchLoader.js +3 -3
  41. package/build/batchloaders/populateBatchLoader.cjs +11 -11
  42. package/build/batchloaders/populateBatchLoader.cjs.map +1 -1
  43. package/build/batchloaders/populateBatchLoader.js +8 -8
  44. package/build/batchloaders/recursiveChildrenBatchLoader.cjs +8 -8
  45. package/build/batchloaders/recursiveChildrenBatchLoader.cjs.map +1 -1
  46. package/build/batchloaders/recursiveChildrenBatchLoader.js +5 -5
  47. package/build/batchloaders/recursiveM2mBatchLoader.cjs +5 -5
  48. package/build/batchloaders/recursiveM2mBatchLoader.cjs.map +1 -1
  49. package/build/batchloaders/recursiveM2mBatchLoader.js +2 -2
  50. package/build/batchloaders/recursiveParentsBatchLoader.cjs +8 -8
  51. package/build/batchloaders/recursiveParentsBatchLoader.cjs.map +1 -1
  52. package/build/batchloaders/recursiveParentsBatchLoader.js +5 -5
  53. package/build/changes.cjs +4 -4
  54. package/build/changes.js +4 -4
  55. package/build/config.cjs +3 -3
  56. package/build/config.js +3 -3
  57. package/build/configure.cjs +6 -6
  58. package/build/configure.js +6 -6
  59. package/build/dataloaders/fastWhereFilterHash.cjs +3 -3
  60. package/build/dataloaders/fastWhereFilterHash.cjs.map +1 -1
  61. package/build/dataloaders/fastWhereFilterHash.js +2 -2
  62. package/build/dataloaders/fastWhereFilterHash.js.map +1 -1
  63. package/build/dataloaders/findByUniqueDataLoader.cjs +5 -6
  64. package/build/dataloaders/findByUniqueDataLoader.cjs.map +1 -1
  65. package/build/dataloaders/findByUniqueDataLoader.d.cts.map +1 -1
  66. package/build/dataloaders/findByUniqueDataLoader.d.mts.map +1 -1
  67. package/build/dataloaders/findByUniqueDataLoader.js +3 -4
  68. package/build/dataloaders/findByUniqueDataLoader.js.map +1 -1
  69. package/build/dataloaders/findCountDataLoader.cjs +10 -13
  70. package/build/dataloaders/findCountDataLoader.cjs.map +1 -1
  71. package/build/dataloaders/findCountDataLoader.d.cts +2 -2
  72. package/build/dataloaders/findCountDataLoader.d.mts +2 -2
  73. package/build/dataloaders/findCountDataLoader.js +4 -7
  74. package/build/dataloaders/findCountDataLoader.js.map +1 -1
  75. package/build/dataloaders/findDataLoader.cjs +15 -19
  76. package/build/dataloaders/findDataLoader.cjs.map +1 -1
  77. package/build/dataloaders/findDataLoader.d.cts +2 -2
  78. package/build/dataloaders/findDataLoader.d.cts.map +1 -1
  79. package/build/dataloaders/findDataLoader.d.mts +2 -2
  80. package/build/dataloaders/findDataLoader.d.mts.map +1 -1
  81. package/build/dataloaders/findDataLoader.js +5 -9
  82. package/build/dataloaders/findDataLoader.js.map +1 -1
  83. package/build/dataloaders/findIdsDataLoader.cjs +6 -9
  84. package/build/dataloaders/findIdsDataLoader.cjs.map +1 -1
  85. package/build/dataloaders/findIdsDataLoader.d.cts +1 -1
  86. package/build/dataloaders/findIdsDataLoader.d.mts +1 -1
  87. package/build/dataloaders/findIdsDataLoader.js +3 -6
  88. package/build/dataloaders/findIdsDataLoader.js.map +1 -1
  89. package/build/dataloaders/findOrCreateDataLoader.cjs +1 -2
  90. package/build/dataloaders/findOrCreateDataLoader.cjs.map +1 -1
  91. package/build/dataloaders/findOrCreateDataLoader.js +1 -2
  92. package/build/dataloaders/findOrCreateDataLoader.js.map +1 -1
  93. package/build/dataloaders/findPaginatedDataLoader.cjs +3 -6
  94. package/build/dataloaders/findPaginatedDataLoader.cjs.map +1 -1
  95. package/build/dataloaders/findPaginatedDataLoader.d.cts +1 -1
  96. package/build/dataloaders/findPaginatedDataLoader.d.mts +1 -1
  97. package/build/dataloaders/findPaginatedDataLoader.js +2 -5
  98. package/build/dataloaders/findPaginatedDataLoader.js.map +1 -1
  99. package/build/dataloaders/lensDataLoader.cjs +4 -4
  100. package/build/dataloaders/lensDataLoader.cjs.map +1 -1
  101. package/build/dataloaders/lensDataLoader.js +2 -2
  102. package/build/dataloaders/lensDataLoader.js.map +1 -1
  103. package/build/dataloaders/manyToManyFindDataLoader.cjs +1 -4
  104. package/build/dataloaders/manyToManyFindDataLoader.cjs.map +1 -1
  105. package/build/dataloaders/manyToManyFindDataLoader.d.cts +0 -1
  106. package/build/dataloaders/manyToManyFindDataLoader.d.cts.map +1 -1
  107. package/build/dataloaders/manyToManyFindDataLoader.d.mts +0 -1
  108. package/build/dataloaders/manyToManyFindDataLoader.d.mts.map +1 -1
  109. package/build/dataloaders/manyToManyFindDataLoader.js +1 -4
  110. package/build/dataloaders/manyToManyFindDataLoader.js.map +1 -1
  111. package/build/dataloaders/oneToManyFindDataLoader.cjs +3 -6
  112. package/build/dataloaders/oneToManyFindDataLoader.cjs.map +1 -1
  113. package/build/dataloaders/oneToManyFindDataLoader.d.cts +0 -1
  114. package/build/dataloaders/oneToManyFindDataLoader.d.cts.map +1 -1
  115. package/build/dataloaders/oneToManyFindDataLoader.d.mts +0 -1
  116. package/build/dataloaders/oneToManyFindDataLoader.d.mts.map +1 -1
  117. package/build/dataloaders/oneToManyFindDataLoader.js +2 -5
  118. package/build/dataloaders/oneToManyFindDataLoader.js.map +1 -1
  119. package/build/defaults.cjs +4 -4
  120. package/build/defaults.js +4 -4
  121. package/build/driverApi.cjs +4 -5
  122. package/build/driverApi.cjs.map +1 -1
  123. package/build/driverApi.d.cts +1 -1
  124. package/build/driverApi.d.mts +1 -1
  125. package/build/driverApi.js +2 -2
  126. package/build/driverApi.js.map +1 -1
  127. package/build/drivers/Driver.cjs +0 -1
  128. package/build/drivers/Driver.d.cts +1 -1
  129. package/build/drivers/Driver.d.mts +1 -1
  130. package/build/drivers/Driver.js +0 -1
  131. package/build/drivers/EntityWriter.cjs +2 -2
  132. package/build/drivers/EntityWriter.js +2 -2
  133. package/build/drivers/index.cjs +0 -6
  134. package/build/drivers/index.d.cts +1 -3
  135. package/build/drivers/index.d.mts +1 -3
  136. package/build/drivers/index.js +1 -3
  137. package/build/fieldSerde.cjs +2 -2
  138. package/build/fieldSerde.js +2 -2
  139. package/build/fields.cjs +2 -2
  140. package/build/fields.js +2 -2
  141. package/build/getProperties.cjs +1 -1
  142. package/build/getProperties.js +1 -1
  143. package/build/index.cjs +109 -107
  144. package/build/index.cjs.map +1 -1
  145. package/build/index.d.cts +27 -24
  146. package/build/index.d.cts.map +1 -1
  147. package/build/index.d.mts +27 -24
  148. package/build/index.d.mts.map +1 -1
  149. package/build/index.js +51 -49
  150. package/build/index.js.map +1 -1
  151. package/build/json.cjs +3 -3
  152. package/build/json.js +3 -3
  153. package/build/keys.cjs +1 -1
  154. package/build/keys.js +1 -1
  155. package/build/loadHints.cjs +1 -1
  156. package/build/loadHints.js +1 -1
  157. package/build/loadLens.cjs +1 -1
  158. package/build/loadLens.js +1 -1
  159. package/build/logging/FactoryLogger.cjs +1 -1
  160. package/build/logging/FactoryLogger.js +1 -1
  161. package/build/logging/FieldLogger.cjs +1 -1
  162. package/build/logging/FieldLogger.js +1 -1
  163. package/build/logging/ReactionLogger.cjs +1 -1
  164. package/build/logging/ReactionLogger.js +1 -1
  165. package/build/newEntity.cjs +1 -1
  166. package/build/newEntity.js +1 -1
  167. package/build/newTestInstance.cjs +3 -3
  168. package/build/newTestInstance.js +3 -3
  169. package/build/plugins/PreloadPlugin.cjs +1 -2
  170. package/build/plugins/PreloadPlugin.d.cts +1 -1
  171. package/build/plugins/PreloadPlugin.d.mts +1 -1
  172. package/build/plugins/PreloadPlugin.js +1 -2
  173. package/build/preloading/JsonAggregatePreloader.cjs +31 -31
  174. package/build/preloading/JsonAggregatePreloader.cjs.map +1 -1
  175. package/build/preloading/JsonAggregatePreloader.d.cts +1 -1
  176. package/build/preloading/JsonAggregatePreloader.d.mts +1 -1
  177. package/build/preloading/JsonAggregatePreloader.js +6 -6
  178. package/build/preloading/JsonAggregatePreloader.js.map +1 -1
  179. package/build/preloading/partitionHint.cjs +3 -3
  180. package/build/preloading/partitionHint.js +3 -3
  181. package/build/{ConditionBuilder.cjs → queries/ConditionBuilder.cjs} +7 -8
  182. package/build/queries/ConditionBuilder.cjs.map +1 -0
  183. package/build/{ConditionBuilder.d.cts → queries/ConditionBuilder.d.cts} +3 -3
  184. package/build/queries/ConditionBuilder.d.cts.map +1 -0
  185. package/build/{ConditionBuilder.d.mts → queries/ConditionBuilder.d.mts} +3 -3
  186. package/build/queries/ConditionBuilder.d.mts.map +1 -0
  187. package/build/{ConditionBuilder.js → queries/ConditionBuilder.js} +4 -5
  188. package/build/queries/ConditionBuilder.js.map +1 -0
  189. package/build/{conditions.cjs → queries/conditions.cjs} +1 -2
  190. package/build/queries/conditions.cjs.map +1 -0
  191. package/build/{conditions.d.cts → queries/conditions.d.cts} +2 -2
  192. package/build/queries/conditions.d.cts.map +1 -0
  193. package/build/{conditions.d.mts → queries/conditions.d.mts} +2 -2
  194. package/build/queries/conditions.d.mts.map +1 -0
  195. package/build/{conditions.js → queries/conditions.js} +1 -2
  196. package/build/queries/conditions.js.map +1 -0
  197. package/build/queries/entityQueryUtils.cjs +60 -0
  198. package/build/queries/entityQueryUtils.cjs.map +1 -0
  199. package/build/queries/entityQueryUtils.d.cts +19 -0
  200. package/build/queries/entityQueryUtils.d.cts.map +1 -0
  201. package/build/queries/entityQueryUtils.d.mts +19 -0
  202. package/build/queries/entityQueryUtils.d.mts.map +1 -0
  203. package/build/queries/entityQueryUtils.js +56 -0
  204. package/build/queries/entityQueryUtils.js.map +1 -0
  205. package/build/{Aliases.cjs → queries/find/Aliases.cjs} +23 -28
  206. package/build/queries/find/Aliases.cjs.map +1 -0
  207. package/build/{Aliases.d.cts → queries/find/Aliases.d.cts} +7 -7
  208. package/build/queries/find/Aliases.d.cts.map +1 -0
  209. package/build/{Aliases.d.mts → queries/find/Aliases.d.mts} +7 -7
  210. package/build/queries/find/Aliases.d.mts.map +1 -0
  211. package/build/{Aliases.js → queries/find/Aliases.js} +7 -12
  212. package/build/queries/find/Aliases.js.map +1 -0
  213. package/build/{DeferredAlias.cjs → queries/find/DeferredAlias.cjs} +3 -6
  214. package/build/queries/find/DeferredAlias.cjs.map +1 -0
  215. package/build/{DeferredAlias.d.cts → queries/find/DeferredAlias.d.cts} +4 -4
  216. package/build/queries/find/DeferredAlias.d.cts.map +1 -0
  217. package/build/{DeferredAlias.d.mts → queries/find/DeferredAlias.d.mts} +4 -4
  218. package/build/queries/find/DeferredAlias.d.mts.map +1 -0
  219. package/build/{DeferredAlias.js → queries/find/DeferredAlias.js} +2 -5
  220. package/build/queries/find/DeferredAlias.js.map +1 -0
  221. package/build/{EntityFilter.cjs → queries/find/EntityFilter.cjs} +4 -9
  222. package/build/queries/find/EntityFilter.cjs.map +1 -0
  223. package/build/{EntityFilter.d.cts → queries/find/EntityFilter.d.cts} +6 -6
  224. package/build/queries/find/EntityFilter.d.cts.map +1 -0
  225. package/build/{EntityFilter.d.mts → queries/find/EntityFilter.d.mts} +6 -6
  226. package/build/queries/find/EntityFilter.d.mts.map +1 -0
  227. package/build/{EntityFilter.js → queries/find/EntityFilter.js} +1 -6
  228. package/build/queries/find/EntityFilter.js.map +1 -0
  229. package/build/{EntityGraphQLFilter.cjs → queries/find/EntityGraphQLFilter.cjs} +1 -5
  230. package/build/queries/find/EntityGraphQLFilter.cjs.map +1 -0
  231. package/build/{EntityGraphQLFilter.d.cts → queries/find/EntityGraphQLFilter.d.cts} +3 -3
  232. package/build/queries/find/EntityGraphQLFilter.d.cts.map +1 -0
  233. package/build/{EntityGraphQLFilter.d.mts → queries/find/EntityGraphQLFilter.d.mts} +3 -3
  234. package/build/queries/find/EntityGraphQLFilter.d.mts.map +1 -0
  235. package/build/{EntityGraphQLFilter.js → queries/find/EntityGraphQLFilter.js} +1 -5
  236. package/build/queries/find/EntityGraphQLFilter.js.map +1 -0
  237. package/build/{QueryParser.cjs → queries/find/QueryParser.cjs} +68 -356
  238. package/build/queries/find/QueryParser.cjs.map +1 -0
  239. package/build/{QueryParser.collectionJoins.cjs → queries/find/QueryParser.collectionJoins.cjs} +8 -8
  240. package/build/queries/find/QueryParser.collectionJoins.cjs.map +1 -0
  241. package/build/{QueryParser.collectionJoins.d.cts → queries/find/QueryParser.collectionJoins.d.cts} +1 -1
  242. package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -0
  243. package/build/{QueryParser.collectionJoins.d.mts → queries/find/QueryParser.collectionJoins.d.mts} +1 -1
  244. package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -0
  245. package/build/{QueryParser.collectionJoins.js → queries/find/QueryParser.collectionJoins.js} +2 -2
  246. package/build/queries/find/QueryParser.collectionJoins.js.map +1 -0
  247. package/build/{QueryParser.d.cts → queries/find/QueryParser.d.cts} +5 -159
  248. package/build/queries/find/QueryParser.d.cts.map +1 -0
  249. package/build/{QueryParser.d.mts → queries/find/QueryParser.d.mts} +5 -159
  250. package/build/queries/find/QueryParser.d.mts.map +1 -0
  251. package/build/{QueryParser.js → queries/find/QueryParser.js} +15 -295
  252. package/build/queries/find/QueryParser.js.map +1 -0
  253. package/build/{QueryParser.pruning.cjs → queries/find/QueryParser.pruning.cjs} +6 -20
  254. package/build/queries/find/QueryParser.pruning.cjs.map +1 -0
  255. package/build/queries/find/QueryParser.pruning.d.cts +8 -0
  256. package/build/queries/find/QueryParser.pruning.d.cts.map +1 -0
  257. package/build/queries/find/QueryParser.pruning.d.mts +8 -0
  258. package/build/queries/find/QueryParser.pruning.d.mts.map +1 -0
  259. package/build/{QueryParser.pruning.js → queries/find/QueryParser.pruning.js} +4 -17
  260. package/build/queries/find/QueryParser.pruning.js.map +1 -0
  261. package/build/{QueryVisitor.cjs → queries/find/QueryVisitor.cjs} +2 -3
  262. package/build/queries/find/QueryVisitor.cjs.map +1 -0
  263. package/build/{QueryVisitor.d.cts → queries/find/QueryVisitor.d.cts} +3 -2
  264. package/build/queries/find/QueryVisitor.d.cts.map +1 -0
  265. package/build/{QueryVisitor.d.mts → queries/find/QueryVisitor.d.mts} +3 -2
  266. package/build/queries/find/QueryVisitor.d.mts.map +1 -0
  267. package/build/{QueryVisitor.js → queries/find/QueryVisitor.js} +2 -3
  268. package/build/queries/find/QueryVisitor.js.map +1 -0
  269. package/build/{drivers/buildRawQuery.cjs → queries/find/buildFindQuery.cjs} +14 -15
  270. package/build/queries/find/buildFindQuery.cjs.map +1 -0
  271. package/build/{drivers/buildRawQuery.d.cts → queries/find/buildFindQuery.d.cts} +3 -3
  272. package/build/queries/find/buildFindQuery.d.cts.map +1 -0
  273. package/build/{drivers/buildRawQuery.d.mts → queries/find/buildFindQuery.d.mts} +3 -3
  274. package/build/queries/find/buildFindQuery.d.mts.map +1 -0
  275. package/build/{drivers/buildRawQuery.js → queries/find/buildFindQuery.js} +5 -6
  276. package/build/queries/find/buildFindQuery.js.map +1 -0
  277. package/build/{scopes.cjs → queries/find/scopes.cjs} +2 -3
  278. package/build/queries/find/scopes.cjs.map +1 -0
  279. package/build/{scopes.d.cts → queries/find/scopes.d.cts} +6 -6
  280. package/build/queries/find/scopes.d.cts.map +1 -0
  281. package/build/{scopes.d.mts → queries/find/scopes.d.mts} +6 -6
  282. package/build/queries/find/scopes.d.mts.map +1 -0
  283. package/build/{scopes.js → queries/find/scopes.js} +2 -3
  284. package/build/queries/find/scopes.js.map +1 -0
  285. package/build/queries/parsedConditions.cjs +21 -0
  286. package/build/queries/parsedConditions.cjs.map +1 -0
  287. package/build/queries/parsedConditions.d.cts +127 -0
  288. package/build/queries/parsedConditions.d.cts.map +1 -0
  289. package/build/queries/parsedConditions.d.mts +127 -0
  290. package/build/queries/parsedConditions.d.mts.map +1 -0
  291. package/build/queries/parsedConditions.js +20 -0
  292. package/build/queries/parsedConditions.js.map +1 -0
  293. package/build/{drivers/buildUtils.cjs → queries/renderConditions.cjs} +7 -8
  294. package/build/queries/renderConditions.cjs.map +1 -0
  295. package/build/{drivers/buildUtils.d.mts → queries/renderConditions.d.cts} +5 -4
  296. package/build/queries/renderConditions.d.cts.map +1 -0
  297. package/build/{drivers/buildUtils.d.cts → queries/renderConditions.d.mts} +5 -4
  298. package/build/queries/renderConditions.d.mts.map +1 -0
  299. package/build/{drivers/buildUtils.js → queries/renderConditions.js} +4 -5
  300. package/build/queries/renderConditions.js.map +1 -0
  301. package/build/{skipCondition.cjs → queries/skipCondition.cjs} +1 -2
  302. package/build/queries/skipCondition.cjs.map +1 -0
  303. package/build/{skipCondition.d.cts → queries/skipCondition.d.cts} +2 -2
  304. package/build/{skipCondition.d.cts.map → queries/skipCondition.d.cts.map} +1 -1
  305. package/build/{skipCondition.d.mts → queries/skipCondition.d.mts} +2 -2
  306. package/build/{skipCondition.d.mts.map → queries/skipCondition.d.mts.map} +1 -1
  307. package/build/{skipCondition.js → queries/skipCondition.js} +1 -2
  308. package/build/queries/skipCondition.js.map +1 -0
  309. package/build/{AliasAssigner.cjs → queries/sql/AliasAssigner.cjs} +2 -3
  310. package/build/queries/sql/AliasAssigner.cjs.map +1 -0
  311. package/build/{AliasAssigner.d.cts → queries/sql/AliasAssigner.d.cts} +2 -2
  312. package/build/queries/sql/AliasAssigner.d.cts.map +1 -0
  313. package/build/{AliasAssigner.d.mts → queries/sql/AliasAssigner.d.mts} +2 -2
  314. package/build/queries/sql/AliasAssigner.d.mts.map +1 -0
  315. package/build/{AliasAssigner.js → queries/sql/AliasAssigner.js} +2 -3
  316. package/build/queries/sql/AliasAssigner.js.map +1 -0
  317. package/build/{Expr.cjs → queries/sql/Expr.cjs} +9 -9
  318. package/build/queries/sql/Expr.cjs.map +1 -0
  319. package/build/{Expr.d.cts → queries/sql/Expr.d.cts} +4 -4
  320. package/build/queries/sql/Expr.d.cts.map +1 -0
  321. package/build/{Expr.d.mts → queries/sql/Expr.d.mts} +4 -4
  322. package/build/queries/sql/Expr.d.mts.map +1 -0
  323. package/build/{Expr.js → queries/sql/Expr.js} +4 -4
  324. package/build/queries/sql/Expr.js.map +1 -0
  325. package/build/{Tables.cjs → queries/sql/Tables.cjs} +63 -67
  326. package/build/queries/sql/Tables.cjs.map +1 -0
  327. package/build/{Tables.d.cts → queries/sql/Tables.d.cts} +6 -7
  328. package/build/queries/sql/Tables.d.cts.map +1 -0
  329. package/build/{Tables.d.mts → queries/sql/Tables.d.mts} +6 -7
  330. package/build/queries/sql/Tables.d.mts.map +1 -0
  331. package/build/{Tables.js → queries/sql/Tables.js} +9 -13
  332. package/build/queries/sql/Tables.js.map +1 -0
  333. package/build/{execute.cjs → queries/sql/execute.cjs} +32 -37
  334. package/build/queries/sql/execute.cjs.map +1 -0
  335. package/build/{execute.d.cts → queries/sql/execute.d.cts} +6 -6
  336. package/build/queries/sql/execute.d.cts.map +1 -0
  337. package/build/{execute.d.mts → queries/sql/execute.d.mts} +6 -6
  338. package/build/queries/sql/execute.d.mts.map +1 -0
  339. package/build/{execute.js → queries/sql/execute.js} +5 -10
  340. package/build/queries/sql/execute.js.map +1 -0
  341. package/build/{expressions → queries/sql/expressions}/arrayAgg.cjs +12 -12
  342. package/build/queries/sql/expressions/arrayAgg.cjs.map +1 -0
  343. package/build/{expressions → queries/sql/expressions}/arrayAgg.d.cts +1 -1
  344. package/build/queries/sql/expressions/arrayAgg.d.cts.map +1 -0
  345. package/build/{expressions → queries/sql/expressions}/arrayAgg.d.mts +1 -1
  346. package/build/queries/sql/expressions/arrayAgg.d.mts.map +1 -0
  347. package/build/{expressions → queries/sql/expressions}/arrayAgg.js +1 -1
  348. package/build/queries/sql/expressions/arrayAgg.js.map +1 -0
  349. package/build/{expressions → queries/sql/expressions}/case.cjs +14 -14
  350. package/build/queries/sql/expressions/case.cjs.map +1 -0
  351. package/build/{expressions → queries/sql/expressions}/case.d.cts +1 -1
  352. package/build/queries/sql/expressions/case.d.cts.map +1 -0
  353. package/build/{expressions → queries/sql/expressions}/case.d.mts +1 -1
  354. package/build/queries/sql/expressions/case.d.mts.map +1 -0
  355. package/build/{expressions → queries/sql/expressions}/case.js +1 -1
  356. package/build/queries/sql/expressions/case.js.map +1 -0
  357. package/build/queries/sql/expressions/coalesce.cjs +25 -0
  358. package/build/queries/sql/expressions/coalesce.cjs.map +1 -0
  359. package/build/{expressions → queries/sql/expressions}/coalesce.d.cts +1 -1
  360. package/build/queries/sql/expressions/coalesce.d.cts.map +1 -0
  361. package/build/{expressions → queries/sql/expressions}/coalesce.d.mts +1 -1
  362. package/build/queries/sql/expressions/coalesce.d.mts.map +1 -0
  363. package/build/{expressions → queries/sql/expressions}/coalesce.js +1 -1
  364. package/build/queries/sql/expressions/coalesce.js.map +1 -0
  365. package/build/{expressions → queries/sql/expressions}/codecs.cjs +5 -5
  366. package/build/queries/sql/expressions/codecs.cjs.map +1 -0
  367. package/build/{expressions → queries/sql/expressions}/codecs.d.cts +1 -1
  368. package/build/queries/sql/expressions/codecs.d.cts.map +1 -0
  369. package/build/{expressions → queries/sql/expressions}/codecs.d.mts +1 -1
  370. package/build/queries/sql/expressions/codecs.d.mts.map +1 -0
  371. package/build/{expressions → queries/sql/expressions}/codecs.js +3 -3
  372. package/build/queries/sql/expressions/codecs.js.map +1 -0
  373. package/build/queries/sql/expressions/expression.cjs +102 -0
  374. package/build/queries/sql/expressions/expression.cjs.map +1 -0
  375. package/build/{expressions → queries/sql/expressions}/expression.d.cts +1 -1
  376. package/build/queries/sql/expressions/expression.d.cts.map +1 -0
  377. package/build/{expressions → queries/sql/expressions}/expression.d.mts +1 -1
  378. package/build/queries/sql/expressions/expression.d.mts.map +1 -0
  379. package/build/{expressions → queries/sql/expressions}/expression.js +2 -2
  380. package/build/queries/sql/expressions/expression.js.map +1 -0
  381. package/build/queries/sql/expressions/greatest.cjs +25 -0
  382. package/build/queries/sql/expressions/greatest.cjs.map +1 -0
  383. package/build/{expressions → queries/sql/expressions}/greatest.d.cts +1 -1
  384. package/build/queries/sql/expressions/greatest.d.cts.map +1 -0
  385. package/build/{expressions → queries/sql/expressions}/greatest.d.mts +1 -1
  386. package/build/queries/sql/expressions/greatest.d.mts.map +1 -0
  387. package/build/{expressions → queries/sql/expressions}/greatest.js +1 -1
  388. package/build/queries/sql/expressions/greatest.js.map +1 -0
  389. package/build/queries/sql/expressions/least.cjs +25 -0
  390. package/build/queries/sql/expressions/least.cjs.map +1 -0
  391. package/build/{expressions → queries/sql/expressions}/least.d.cts +1 -1
  392. package/build/queries/sql/expressions/least.d.cts.map +1 -0
  393. package/build/{expressions → queries/sql/expressions}/least.d.mts +1 -1
  394. package/build/queries/sql/expressions/least.d.mts.map +1 -0
  395. package/build/{expressions → queries/sql/expressions}/least.js +1 -1
  396. package/build/queries/sql/expressions/least.js.map +1 -0
  397. package/build/{expressions → queries/sql/expressions}/nullIf.cjs +6 -6
  398. package/build/queries/sql/expressions/nullIf.cjs.map +1 -0
  399. package/build/{expressions → queries/sql/expressions}/nullIf.d.cts +1 -1
  400. package/build/queries/sql/expressions/nullIf.d.cts.map +1 -0
  401. package/build/{expressions → queries/sql/expressions}/nullIf.d.mts +1 -1
  402. package/build/queries/sql/expressions/nullIf.d.mts.map +1 -0
  403. package/build/{expressions → queries/sql/expressions}/nullIf.js +1 -1
  404. package/build/queries/sql/expressions/nullIf.js.map +1 -0
  405. package/build/{expressions → queries/sql/expressions}/parseExpression.cjs +16 -16
  406. package/build/queries/sql/expressions/parseExpression.cjs.map +1 -0
  407. package/build/{expressions → queries/sql/expressions}/parseExpression.d.cts +1 -1
  408. package/build/queries/sql/expressions/parseExpression.d.cts.map +1 -0
  409. package/build/{expressions → queries/sql/expressions}/parseExpression.d.mts +1 -1
  410. package/build/queries/sql/expressions/parseExpression.d.mts.map +1 -0
  411. package/build/{expressions → queries/sql/expressions}/parseExpression.js +2 -2
  412. package/build/queries/sql/expressions/parseExpression.js.map +1 -0
  413. package/build/{expressions → queries/sql/expressions}/types.d.cts +1 -1
  414. package/build/queries/sql/expressions/types.d.cts.map +1 -0
  415. package/build/{expressions → queries/sql/expressions}/types.d.mts +1 -1
  416. package/build/queries/sql/expressions/types.d.mts.map +1 -0
  417. package/build/{keywords.cjs → queries/sql/keywords.cjs} +1 -1
  418. package/build/queries/sql/keywords.cjs.map +1 -0
  419. package/build/{keywords.d.cts → queries/sql/keywords.d.cts} +1 -1
  420. package/build/queries/sql/keywords.d.cts.map +1 -0
  421. package/build/{keywords.d.mts → queries/sql/keywords.d.mts} +1 -1
  422. package/build/queries/sql/keywords.d.mts.map +1 -0
  423. package/build/{keywords.js → queries/sql/keywords.js} +1 -1
  424. package/build/queries/sql/keywords.js.map +1 -0
  425. package/build/{query.cjs → queries/sql/query.cjs} +83 -84
  426. package/build/queries/sql/query.cjs.map +1 -0
  427. package/build/{query.d.cts → queries/sql/query.d.cts} +7 -7
  428. package/build/queries/sql/query.d.cts.map +1 -0
  429. package/build/{query.d.mts → queries/sql/query.d.mts} +7 -7
  430. package/build/queries/sql/query.d.mts.map +1 -0
  431. package/build/{query.js → queries/sql/query.js} +11 -12
  432. package/build/queries/sql/query.js.map +1 -0
  433. package/build/queries/valueFilters.cjs +248 -0
  434. package/build/queries/valueFilters.cjs.map +1 -0
  435. package/build/queries/valueFilters.d.cts +28 -0
  436. package/build/queries/valueFilters.d.cts.map +1 -0
  437. package/build/queries/valueFilters.d.mts +28 -0
  438. package/build/queries/valueFilters.d.mts.map +1 -0
  439. package/build/queries/valueFilters.js +243 -0
  440. package/build/queries/valueFilters.js.map +1 -0
  441. package/build/reactiveHints.cjs +5 -5
  442. package/build/reactiveHints.js +5 -5
  443. package/build/relations/AbstractRelationImpl.cjs +0 -5
  444. package/build/relations/AbstractRelationImpl.cjs.map +1 -1
  445. package/build/relations/AbstractRelationImpl.d.cts +1 -2
  446. package/build/relations/AbstractRelationImpl.d.cts.map +1 -1
  447. package/build/relations/AbstractRelationImpl.d.mts +1 -2
  448. package/build/relations/AbstractRelationImpl.d.mts.map +1 -1
  449. package/build/relations/AbstractRelationImpl.js +1 -5
  450. package/build/relations/AbstractRelationImpl.js.map +1 -1
  451. package/build/relations/AsyncProperty.cjs +1 -1
  452. package/build/relations/AsyncProperty.js +1 -1
  453. package/build/relations/AsyncReactiveField.cjs +3 -3
  454. package/build/relations/AsyncReactiveField.js +3 -3
  455. package/build/relations/Collection.cjs +1 -1
  456. package/build/relations/Collection.js +1 -1
  457. package/build/relations/CustomCollection.cjs +1 -1
  458. package/build/relations/CustomCollection.js +1 -1
  459. package/build/relations/CustomReference.cjs +3 -3
  460. package/build/relations/CustomReference.js +3 -3
  461. package/build/relations/EnumCollection.cjs +2 -2
  462. package/build/relations/EnumCollection.js +2 -2
  463. package/build/relations/LazyField.cjs +6 -7
  464. package/build/relations/LazyField.cjs.map +1 -1
  465. package/build/relations/LazyField.js +5 -6
  466. package/build/relations/LazyField.js.map +1 -1
  467. package/build/relations/ManyToManyCollection.cjs +4 -3
  468. package/build/relations/ManyToManyCollection.cjs.map +1 -1
  469. package/build/relations/ManyToManyCollection.d.cts.map +1 -1
  470. package/build/relations/ManyToManyCollection.d.mts.map +1 -1
  471. package/build/relations/ManyToManyCollection.js +4 -3
  472. package/build/relations/ManyToManyCollection.js.map +1 -1
  473. package/build/relations/ManyToManyLargeCollection.cjs +2 -2
  474. package/build/relations/ManyToManyLargeCollection.js +2 -2
  475. package/build/relations/ManyToOneReference.cjs +7 -6
  476. package/build/relations/ManyToOneReference.cjs.map +1 -1
  477. package/build/relations/ManyToOneReference.d.cts.map +1 -1
  478. package/build/relations/ManyToOneReference.d.mts.map +1 -1
  479. package/build/relations/ManyToOneReference.js +7 -6
  480. package/build/relations/ManyToOneReference.js.map +1 -1
  481. package/build/relations/OneToManyCollection.cjs +6 -5
  482. package/build/relations/OneToManyCollection.cjs.map +1 -1
  483. package/build/relations/OneToManyCollection.d.cts.map +1 -1
  484. package/build/relations/OneToManyCollection.d.mts.map +1 -1
  485. package/build/relations/OneToManyCollection.js +4 -3
  486. package/build/relations/OneToManyCollection.js.map +1 -1
  487. package/build/relations/OneToManyLargeCollection.cjs +3 -3
  488. package/build/relations/OneToManyLargeCollection.js +3 -3
  489. package/build/relations/OneToOneReference.cjs +6 -5
  490. package/build/relations/OneToOneReference.cjs.map +1 -1
  491. package/build/relations/OneToOneReference.d.cts.map +1 -1
  492. package/build/relations/OneToOneReference.d.mts.map +1 -1
  493. package/build/relations/OneToOneReference.js +6 -5
  494. package/build/relations/OneToOneReference.js.map +1 -1
  495. package/build/relations/PolymorphicReference.cjs +7 -6
  496. package/build/relations/PolymorphicReference.cjs.map +1 -1
  497. package/build/relations/PolymorphicReference.d.cts.map +1 -1
  498. package/build/relations/PolymorphicReference.d.mts.map +1 -1
  499. package/build/relations/PolymorphicReference.js +7 -6
  500. package/build/relations/PolymorphicReference.js.map +1 -1
  501. package/build/relations/ReactiveField.cjs +3 -3
  502. package/build/relations/ReactiveField.js +3 -3
  503. package/build/relations/ReactiveGetter.cjs +1 -1
  504. package/build/relations/ReactiveGetter.js +1 -1
  505. package/build/relations/ReactiveManyToMany.cjs +5 -4
  506. package/build/relations/ReactiveManyToMany.cjs.map +1 -1
  507. package/build/relations/ReactiveManyToMany.d.cts.map +1 -1
  508. package/build/relations/ReactiveManyToMany.d.mts.map +1 -1
  509. package/build/relations/ReactiveManyToMany.js +5 -4
  510. package/build/relations/ReactiveManyToMany.js.map +1 -1
  511. package/build/relations/ReactiveManyToManyOtherSide.cjs +3 -3
  512. package/build/relations/ReactiveManyToManyOtherSide.js +3 -3
  513. package/build/relations/ReactiveReference.cjs +8 -7
  514. package/build/relations/ReactiveReference.cjs.map +1 -1
  515. package/build/relations/ReactiveReference.d.cts.map +1 -1
  516. package/build/relations/ReactiveReference.d.mts.map +1 -1
  517. package/build/relations/ReactiveReference.js +8 -7
  518. package/build/relations/ReactiveReference.js.map +1 -1
  519. package/build/relations/RecursiveCollection.cjs +3 -3
  520. package/build/relations/RecursiveCollection.js +3 -3
  521. package/build/relations/Reference.cjs +1 -1
  522. package/build/relations/Reference.js +1 -1
  523. package/build/relations/hasAsyncMethod.cjs +1 -1
  524. package/build/relations/hasAsyncMethod.js +1 -1
  525. package/build/relations/hasManyDerived.cjs +1 -1
  526. package/build/relations/hasManyDerived.js +1 -1
  527. package/build/relations/hasOneDerived.cjs +2 -2
  528. package/build/relations/hasOneDerived.js +2 -2
  529. package/build/relations/hasProperty.cjs +2 -2
  530. package/build/relations/hasProperty.js +2 -2
  531. package/build/relations/index.cjs +13 -13
  532. package/build/relations/index.js +13 -13
  533. package/build/relations/isCascadeDelete.cjs +11 -0
  534. package/build/relations/isCascadeDelete.cjs.map +1 -0
  535. package/build/relations/isCascadeDelete.d.cts +7 -0
  536. package/build/relations/isCascadeDelete.d.cts.map +1 -0
  537. package/build/relations/isCascadeDelete.d.mts +7 -0
  538. package/build/relations/isCascadeDelete.d.mts.map +1 -0
  539. package/build/relations/isCascadeDelete.js +10 -0
  540. package/build/relations/isCascadeDelete.js.map +1 -0
  541. package/build/resurrection.cjs +1 -1
  542. package/build/resurrection.js +1 -1
  543. package/build/rules.cjs +4 -4
  544. package/build/rules.js +4 -4
  545. package/build/serde.cjs +1 -1
  546. package/build/serde.js +1 -1
  547. package/build/unnest.cjs +0 -1
  548. package/build/unnest.cjs.map +1 -1
  549. package/build/unnest.d.cts +1 -1
  550. package/build/unnest.d.mts +1 -1
  551. package/build/unnest.js +0 -1
  552. package/build/unnest.js.map +1 -1
  553. package/build/upsert.cjs +3 -3
  554. package/build/upsert.js +3 -3
  555. package/build/utils.cjs +1 -2
  556. package/build/utils.cjs.map +1 -1
  557. package/build/utils.d.cts +1 -1
  558. package/build/utils.d.mts +1 -1
  559. package/build/utils.js +1 -2
  560. package/build/utils.js.map +1 -1
  561. package/build/withLoaded.cjs +3 -3
  562. package/build/withLoaded.js +3 -3
  563. package/package.json +2 -2
  564. package/build/AliasAssigner.cjs.map +0 -1
  565. package/build/AliasAssigner.d.cts.map +0 -1
  566. package/build/AliasAssigner.d.mts.map +0 -1
  567. package/build/AliasAssigner.js.map +0 -1
  568. package/build/Aliases.cjs.map +0 -1
  569. package/build/Aliases.d.cts.map +0 -1
  570. package/build/Aliases.d.mts.map +0 -1
  571. package/build/Aliases.js.map +0 -1
  572. package/build/ConditionBuilder.cjs.map +0 -1
  573. package/build/ConditionBuilder.d.cts.map +0 -1
  574. package/build/ConditionBuilder.d.mts.map +0 -1
  575. package/build/ConditionBuilder.js.map +0 -1
  576. package/build/DeferredAlias.cjs.map +0 -1
  577. package/build/DeferredAlias.d.cts.map +0 -1
  578. package/build/DeferredAlias.d.mts.map +0 -1
  579. package/build/DeferredAlias.js.map +0 -1
  580. package/build/EntityFilter.cjs.map +0 -1
  581. package/build/EntityFilter.d.cts.map +0 -1
  582. package/build/EntityFilter.d.mts.map +0 -1
  583. package/build/EntityFilter.js.map +0 -1
  584. package/build/EntityGraphQLFilter.cjs.map +0 -1
  585. package/build/EntityGraphQLFilter.d.cts.map +0 -1
  586. package/build/EntityGraphQLFilter.d.mts.map +0 -1
  587. package/build/EntityGraphQLFilter.js.map +0 -1
  588. package/build/Expr.cjs.map +0 -1
  589. package/build/Expr.d.cts.map +0 -1
  590. package/build/Expr.d.mts.map +0 -1
  591. package/build/Expr.js.map +0 -1
  592. package/build/QueryParser.cjs.map +0 -1
  593. package/build/QueryParser.collectionJoins.cjs.map +0 -1
  594. package/build/QueryParser.collectionJoins.d.cts.map +0 -1
  595. package/build/QueryParser.collectionJoins.d.mts.map +0 -1
  596. package/build/QueryParser.collectionJoins.js.map +0 -1
  597. package/build/QueryParser.d.cts.map +0 -1
  598. package/build/QueryParser.d.mts.map +0 -1
  599. package/build/QueryParser.js.map +0 -1
  600. package/build/QueryParser.pruning.cjs.map +0 -1
  601. package/build/QueryParser.pruning.d.cts +0 -10
  602. package/build/QueryParser.pruning.d.cts.map +0 -1
  603. package/build/QueryParser.pruning.d.mts +0 -10
  604. package/build/QueryParser.pruning.d.mts.map +0 -1
  605. package/build/QueryParser.pruning.js.map +0 -1
  606. package/build/QueryVisitor.cjs.map +0 -1
  607. package/build/QueryVisitor.d.cts.map +0 -1
  608. package/build/QueryVisitor.d.mts.map +0 -1
  609. package/build/QueryVisitor.js.map +0 -1
  610. package/build/Tables.cjs.map +0 -1
  611. package/build/Tables.d.cts.map +0 -1
  612. package/build/Tables.d.mts.map +0 -1
  613. package/build/Tables.js.map +0 -1
  614. package/build/conditions.cjs.map +0 -1
  615. package/build/conditions.d.cts.map +0 -1
  616. package/build/conditions.d.mts.map +0 -1
  617. package/build/conditions.js.map +0 -1
  618. package/build/drivers/buildRawQuery.cjs.map +0 -1
  619. package/build/drivers/buildRawQuery.d.cts.map +0 -1
  620. package/build/drivers/buildRawQuery.d.mts.map +0 -1
  621. package/build/drivers/buildRawQuery.js.map +0 -1
  622. package/build/drivers/buildUtils.cjs.map +0 -1
  623. package/build/drivers/buildUtils.d.cts.map +0 -1
  624. package/build/drivers/buildUtils.d.mts.map +0 -1
  625. package/build/drivers/buildUtils.js.map +0 -1
  626. package/build/execute.cjs.map +0 -1
  627. package/build/execute.d.cts.map +0 -1
  628. package/build/execute.d.mts.map +0 -1
  629. package/build/execute.js.map +0 -1
  630. package/build/expressions/arrayAgg.cjs.map +0 -1
  631. package/build/expressions/arrayAgg.d.cts.map +0 -1
  632. package/build/expressions/arrayAgg.d.mts.map +0 -1
  633. package/build/expressions/arrayAgg.js.map +0 -1
  634. package/build/expressions/case.cjs.map +0 -1
  635. package/build/expressions/case.d.cts.map +0 -1
  636. package/build/expressions/case.d.mts.map +0 -1
  637. package/build/expressions/case.js.map +0 -1
  638. package/build/expressions/coalesce.cjs +0 -25
  639. package/build/expressions/coalesce.cjs.map +0 -1
  640. package/build/expressions/coalesce.d.cts.map +0 -1
  641. package/build/expressions/coalesce.d.mts.map +0 -1
  642. package/build/expressions/coalesce.js.map +0 -1
  643. package/build/expressions/codecs.cjs.map +0 -1
  644. package/build/expressions/codecs.d.cts.map +0 -1
  645. package/build/expressions/codecs.d.mts.map +0 -1
  646. package/build/expressions/codecs.js.map +0 -1
  647. package/build/expressions/expression.cjs +0 -102
  648. package/build/expressions/expression.cjs.map +0 -1
  649. package/build/expressions/expression.d.cts.map +0 -1
  650. package/build/expressions/expression.d.mts.map +0 -1
  651. package/build/expressions/expression.js.map +0 -1
  652. package/build/expressions/greatest.cjs +0 -25
  653. package/build/expressions/greatest.cjs.map +0 -1
  654. package/build/expressions/greatest.d.cts.map +0 -1
  655. package/build/expressions/greatest.d.mts.map +0 -1
  656. package/build/expressions/greatest.js.map +0 -1
  657. package/build/expressions/least.cjs +0 -25
  658. package/build/expressions/least.cjs.map +0 -1
  659. package/build/expressions/least.d.cts.map +0 -1
  660. package/build/expressions/least.d.mts.map +0 -1
  661. package/build/expressions/least.js.map +0 -1
  662. package/build/expressions/nullIf.cjs.map +0 -1
  663. package/build/expressions/nullIf.d.cts.map +0 -1
  664. package/build/expressions/nullIf.d.mts.map +0 -1
  665. package/build/expressions/nullIf.js.map +0 -1
  666. package/build/expressions/parseExpression.cjs.map +0 -1
  667. package/build/expressions/parseExpression.d.cts.map +0 -1
  668. package/build/expressions/parseExpression.d.mts.map +0 -1
  669. package/build/expressions/parseExpression.js.map +0 -1
  670. package/build/expressions/types.d.cts.map +0 -1
  671. package/build/expressions/types.d.mts.map +0 -1
  672. package/build/keywords.cjs.map +0 -1
  673. package/build/keywords.d.cts.map +0 -1
  674. package/build/keywords.d.mts.map +0 -1
  675. package/build/keywords.js.map +0 -1
  676. package/build/query.cjs.map +0 -1
  677. package/build/query.d.cts.map +0 -1
  678. package/build/query.d.mts.map +0 -1
  679. package/build/query.js.map +0 -1
  680. package/build/scopes.cjs.map +0 -1
  681. package/build/scopes.d.cts.map +0 -1
  682. package/build/scopes.d.mts.map +0 -1
  683. package/build/scopes.js.map +0 -1
  684. package/build/skipCondition.cjs.map +0 -1
  685. package/build/skipCondition.js.map +0 -1
  686. /package/build/{expressions → queries/sql/expressions}/types.cjs +0 -0
  687. /package/build/{expressions → queries/sql/expressions}/types.js +0 -0
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./fieldSerde.cjs");
3
2
  require("./loadHints.cjs");
3
+ require("./fieldSerde.cjs");
4
+ const require_configure = require("./configure.cjs");
5
+ require("./config.cjs");
4
6
  require("./EntityManager.cjs");
5
7
  const require_Entity = require("./Entity.cjs");
6
8
  const require_BaseEntity = require("./BaseEntity.cjs");
7
- require("./config.cjs");
8
- const require_configure = require("./configure.cjs");
9
9
  //#region src/EntityMetadata.ts
10
10
  function getMetadata(param) {
11
11
  if (!param) throw new Error(`Cannot getMetadata of ${param}`);
@@ -1,10 +1,10 @@
1
- import "./fieldSerde.js";
2
1
  import "./loadHints.js";
2
+ import "./fieldSerde.js";
3
+ import { getMetadataForType } from "./configure.js";
4
+ import "./config.js";
3
5
  import "./EntityManager.js";
4
6
  import { isEntity } from "./Entity.js";
5
7
  import { getInstanceData } from "./BaseEntity.js";
6
- import "./config.js";
7
- import { getMetadataForType } from "./configure.js";
8
8
  //#region src/EntityMetadata.ts
9
9
  function getMetadata(param) {
10
10
  if (!param) throw new Error(`Cannot getMetadata of ${param}`);
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_relations_Reference = require("./relations/Reference.cjs");
3
+ const require_utils = require("./utils.cjs");
3
4
  require("./relations/index.cjs");
4
5
  const require_EntityMetadata = require("./EntityMetadata.cjs");
5
- const require_utils = require("./utils.cjs");
6
6
  const require_Entity = require("./Entity.cjs");
7
7
  //#region src/IndexManager.ts
8
8
  const emptySet = /* @__PURE__ */ new Set();
@@ -1,7 +1,7 @@
1
1
  import { isLoadedReference } from "./relations/Reference.js";
2
+ import { groupBy } from "./utils.js";
2
3
  import "./relations/index.js";
3
4
  import { getMetadata } from "./EntityMetadata.js";
4
- import { groupBy } from "./utils.js";
5
5
  import { isEntity } from "./Entity.js";
6
6
  //#region src/IndexManager.ts
7
7
  const emptySet = /* @__PURE__ */ new Set();
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_RowData = require("./RowData.cjs");
3
- require("./EntityMetadata.cjs");
4
3
  const require_utils = require("./utils.cjs");
4
+ require("./EntityMetadata.cjs");
5
5
  const require_EntityManager = require("./EntityManager.cjs");
6
6
  require("./Entity.cjs");
7
7
  //#region src/InstanceData.ts
@@ -1,6 +1,6 @@
1
1
  import { emptyRowData } from "./RowData.js";
2
- import "./EntityMetadata.js";
3
2
  import { hasAnyKey } from "./utils.js";
3
+ import "./EntityMetadata.js";
4
4
  import { getEmInternalApi } from "./EntityManager.js";
5
5
  import "./Entity.js";
6
6
  //#region src/InstanceData.ts
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./Todo.cjs");
3
3
  require("./ReactionsManager.cjs");
4
+ const require_utils = require("./utils.cjs");
4
5
  const require_keys = require("./keys.cjs");
5
6
  const require_EntityMetadata = require("./EntityMetadata.cjs");
6
- const require_utils = require("./utils.cjs");
7
7
  const require_EntityManager = require("./EntityManager.cjs");
8
8
  require("./Entity.cjs");
9
9
  //#region src/JoinRows.ts
package/build/JoinRows.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import "./Todo.js";
2
2
  import "./ReactionsManager.js";
3
+ import { remove } from "./utils.js";
3
4
  import { keyToNumber, keyToTaggedId } from "./keys.js";
4
5
  import { getBaseAndSelfMetas } from "./EntityMetadata.js";
5
- import { remove } from "./utils.js";
6
6
  import { getEmInternalApi } from "./EntityManager.js";
7
7
  import "./Entity.js";
8
8
  //#region src/JoinRows.ts
@@ -3,7 +3,6 @@ require("./Todo.cjs");
3
3
  require("./EntityMetadata.cjs");
4
4
  const require_EntityManager = require("./EntityManager.cjs");
5
5
  require("./Entity.cjs");
6
- require("./QueryParser.cjs");
7
6
  //#region src/PluginManager.ts
8
7
  const syncPluginMethods = [
9
8
  "beforeGetField",
@@ -1 +1 @@
1
- {"version":3,"file":"PluginManager.cjs","names":["isDefined","#pluginsByCallback","#plugins"],"sources":["../src/PluginManager.ts"],"sourcesContent":["import { type Entity } from \"./Entity.ts\";\nimport { type EntityManager, type FindOperation, isDefined } from \"./EntityManager.ts\";\nimport { type EntityMetadata } from \"./EntityMetadata.ts\";\nimport { type ParsedFindQuery } from \"./QueryParser.ts\";\nimport { type RowData } from \"./RowData.ts\";\nimport { type JoinRowTodo, type Todo } from \"./Todo.ts\";\n\ninterface PluginMethods {\n /**\n * Called before a field value is retrieved from an entity via getField.\n *\n * @param entity The entity instance being accessed\n * @param field The field name being retrieved\n */\n beforeGetField?(entity: Entity, field: string): void;\n /**\n * Called before a field value is set on an entity via setField.\n *\n * @param entity The entity instance being modified\n * @param field The field name being set\n * @param newValue The new value being assigned to the field\n */\n beforeSetField?(entity: Entity, field: string, newValue: any): void;\n /**\n * Called before a find operation is executed.\n *\n * @param meta Metadata for the entity type being queried\n * @param operation The type of find operation being performed\n * @param query The parsed query conditions\n * @param settings Query settings including limit and offset\n */\n beforeFind?(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void;\n /**\n * Called after a find operation has been executed to observe the raw database rows.\n *\n * The result is an observation-only {@link RowData} view — i.e. `rows.rowCount` for metrics,\n * `rows.get(i, columnName)` for specific cells, or `rows.toRows()` to materialize POJO rows.\n * For lazy results, cells decode on access, so a hook that only counts rows costs nothing;\n * materializing via `toRows()` decodes every cell of every row. Mutating materialized rows is\n * unsupported and is not guaranteed to affect entity hydration.\n *\n * @param meta Metadata for the entity type that was queried\n * @param operation The type of find operation that was performed\n * @param rows A read-only view of the raw database rows returned from the query\n */\n afterFind?(meta: EntityMetadata, operation: FindOperation, rows: RowData): void;\n\n beforeValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void;\n}\n\nconst syncPluginMethods = [\n \"beforeGetField\",\n \"beforeSetField\",\n \"beforeFind\",\n \"afterFind\",\n \"afterWrite\",\n] as const satisfies readonly (keyof PluginMethods)[];\nconst asyncPluginMethods = [\"beforeValidate\", \"afterValidate\"] as const satisfies readonly (keyof PluginMethods)[];\nconst emsSymbol = Symbol(\"ems\");\n/**\n * Base class for plugins that hook into entity lifecycle events.\n *\n * Plugins can implement any of the PluginMethods to intercept entity operations\n * and are automatically registered with the EntityManager when added via PluginManager.\n */\nexport abstract class Plugin {\n // We need to store the EntityManager references in a WeakRef array so that they can be garbage collected. If we\n // didn't do this, then multiple EMs with the same plugin instance could keep each other from being garbage collected.\n [emsSymbol]: WeakRef<EntityManager>[] = [];\n\n maybeCloneForNewEm(): this | undefined {\n return undefined;\n }\n\n get ems(): readonly EntityManager[] {\n return this[emsSymbol]\n .values()\n .map((wr) => wr.deref())\n .filter(isDefined)\n .toArray();\n }\n}\n\nexport interface Plugin extends PluginMethods {}\n\n/**\n * Manages plugin lifecycle and dispatches plugin callbacks to registered plugins.\n *\n * The PluginManager optimizes callback dispatch by only creating dispatcher methods\n * for callbacks that have at least one registered plugin, making unused plugin hooks\n * zero-cost at runtime.\n */\nexport class PluginManager implements Required<PluginMethods> {\n #plugins = new Set<Plugin>();\n readonly #pluginsByCallback: Partial<Record<keyof Plugin, Plugin[]>> = {};\n constructor(public readonly em: EntityManager) {}\n\n /** Returns whether any registered plugin implements `method`, i.e. so callers can skip building its args. */\n hasHook(method: keyof PluginMethods): boolean {\n return this.#pluginsByCallback[method] !== undefined;\n }\n\n /**\n * Registers a plugin with this EntityManager.\n *\n * Dynamically creates dispatcher methods for any plugin callbacks implemented by this plugin,\n * enabling lazy initialization of only the hooks that are actually used.\n *\n * @throws Error if the plugin is already registered with another EntityManager\n */\n addPlugin(plugin: Plugin) {\n if (this.#plugins.has(plugin)) return; // if we're already added, then we can just early exit\n this.#plugins.add(plugin);\n plugin[emsSymbol].push(new WeakRef(this.em));\n for (const method of syncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // As a performance optimization, we only create the actual implementation for each method on the plugin manager\n // once we have at least one plugin using that method. This is to make it so any unused plugin methods are\n // effectively no-ops when called from within the em.\n if (!Object.hasOwn(this, method)) {\n this[method] = function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n (plugin[method] as (...args: any[]) => unknown)(...args);\n }\n };\n }\n }\n }\n for (const method of asyncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // Validate-phase plugin hooks are intentionally awaited without making hot-path hooks async.\n if (!Object.hasOwn(this, method)) {\n this[method] = async function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n await (plugin[method] as (...args: any[]) => Promise<void> | void)(...args);\n }\n };\n }\n }\n }\n }\n\n get plugins(): readonly Plugin[] {\n return [...this.#plugins];\n }\n\n cloneTo(other: PluginManager) {\n this.#plugins\n .values()\n .map((plugin) => plugin.maybeCloneForNewEm())\n .filter(isDefined)\n .forEach((plugin) => other.addPlugin(plugin));\n }\n\n // Defined as no-op functions initially instead of using optional chaining for performance reasons, see:\n // https://adventures.nodeland.dev/archive/noop-functions-vs-optional-chaining-a-performance/\n\n beforeGetField(entity: Entity, field: string): void {}\n beforeSetField(entity: Entity, field: string, newValue: any): void {}\n beforeFind(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void {}\n afterFind(meta: EntityMetadata, operation: FindOperation, rows: RowData) {}\n beforeValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void {}\n}\n"],"mappings":";;;;;;;AAkEA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,qBAAqB,CAAC,kBAAkB,eAAe;AAC7D,MAAM,YAAY,OAAO,KAAK;;;;;;;AAO9B,IAAsB,SAAtB,MAA6B;CAG3B,CAAC,aAAuC,CAAC;CAEzC,qBAAuC,CAEvC;CAEA,IAAI,MAAgC;EAClC,OAAO,KAAK,UAAU,CACnB,OAAO,CAAC,CACR,KAAK,OAAO,GAAG,MAAM,CAAC,CAAC,CACvB,OAAOA,sBAAAA,SAAS,CAAC,CACjB,QAAQ;CACb;AACF;;;;;;;;AAWA,IAAa,gBAAb,MAA8D;CAGhC;CAF5B,2BAAW,IAAI,IAAY;CAC3B,qBAAuE,CAAC;CACxE,YAAY,IAAmC;EAAnB,KAAA,KAAA;CAAoB;;CAGhD,QAAQ,QAAsC;EAC5C,OAAO,KAAKC,mBAAmB,YAAY,KAAA;CAC7C;;;;;;;;;CAUA,UAAU,QAAgB;EACxB,IAAI,KAAKC,SAAS,IAAI,MAAM,GAAG;EAC/B,KAAKA,SAAS,IAAI,MAAM;EACxB,OAAO,UAAU,CAAC,KAAK,IAAI,QAAQ,KAAK,EAAE,CAAC;EAC3C,KAAK,MAAM,UAAU,mBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKD,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAIpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,SAA+B,GAAG,MAAa;IAC5D,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,OAAQ,OAAO,CAAiC,GAAG,IAAI;GAE3D;EAEJ;EAEF,KAAK,MAAM,UAAU,oBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKA,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAEpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,eAAqC,GAAG,MAAa;IAClE,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,MAAO,OAAO,OAAO,CAA8C,GAAG,IAAI;GAE9E;EAEJ;CAEJ;CAEA,IAAI,UAA6B;EAC/B,OAAO,CAAC,GAAG,KAAKC,QAAQ;CAC1B;CAEA,QAAQ,OAAsB;EAC5B,KAAKA,SACF,OAAO,CAAC,CACR,KAAK,WAAW,OAAO,mBAAmB,CAAC,CAAC,CAC5C,OAAOF,sBAAAA,SAAS,CAAC,CACjB,SAAS,WAAW,MAAM,UAAU,MAAM,CAAC;CAChD;CAKA,eAAe,QAAgB,OAAqB,CAAC;CACrD,eAAe,QAAgB,OAAe,UAAqB,CAAC;CACpE,WACE,MACA,WACA,OACA,UAQM,CAAC;CACT,UAAU,MAAsB,WAA0B,MAAe,CAAC;CAC1E,eAAe,UAAmD,CAAC;CACnE,cAAc,UAAmD,CAAC;CAClE,WAAW,aAAmC,cAAiD,CAAC;AAClG"}
1
+ {"version":3,"file":"PluginManager.cjs","names":["isDefined","#pluginsByCallback","#plugins"],"sources":["../src/PluginManager.ts"],"sourcesContent":["import { type Entity } from \"./Entity.ts\";\nimport { type EntityManager, type FindOperation, isDefined } from \"./EntityManager.ts\";\nimport { type EntityMetadata } from \"./EntityMetadata.ts\";\nimport type { ParsedFindQuery } from \"./queries/find/QueryParser.ts\";\nimport { type RowData } from \"./RowData.ts\";\nimport { type JoinRowTodo, type Todo } from \"./Todo.ts\";\n\ninterface PluginMethods {\n /**\n * Called before a field value is retrieved from an entity via getField.\n *\n * @param entity The entity instance being accessed\n * @param field The field name being retrieved\n */\n beforeGetField?(entity: Entity, field: string): void;\n /**\n * Called before a field value is set on an entity via setField.\n *\n * @param entity The entity instance being modified\n * @param field The field name being set\n * @param newValue The new value being assigned to the field\n */\n beforeSetField?(entity: Entity, field: string, newValue: any): void;\n /**\n * Called before a find operation is executed.\n *\n * @param meta Metadata for the entity type being queried\n * @param operation The type of find operation being performed\n * @param query The parsed query conditions\n * @param settings Query settings including limit and offset\n */\n beforeFind?(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void;\n /**\n * Called after a find operation has been executed to observe the raw database rows.\n *\n * The result is an observation-only {@link RowData} view — i.e. `rows.rowCount` for metrics,\n * `rows.get(i, columnName)` for specific cells, or `rows.toRows()` to materialize POJO rows.\n * For lazy results, cells decode on access, so a hook that only counts rows costs nothing;\n * materializing via `toRows()` decodes every cell of every row. Mutating materialized rows is\n * unsupported and is not guaranteed to affect entity hydration.\n *\n * @param meta Metadata for the entity type that was queried\n * @param operation The type of find operation that was performed\n * @param rows A read-only view of the raw database rows returned from the query\n */\n afterFind?(meta: EntityMetadata, operation: FindOperation, rows: RowData): void;\n\n beforeValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void;\n}\n\nconst syncPluginMethods = [\n \"beforeGetField\",\n \"beforeSetField\",\n \"beforeFind\",\n \"afterFind\",\n \"afterWrite\",\n] as const satisfies readonly (keyof PluginMethods)[];\nconst asyncPluginMethods = [\"beforeValidate\", \"afterValidate\"] as const satisfies readonly (keyof PluginMethods)[];\nconst emsSymbol = Symbol(\"ems\");\n/**\n * Base class for plugins that hook into entity lifecycle events.\n *\n * Plugins can implement any of the PluginMethods to intercept entity operations\n * and are automatically registered with the EntityManager when added via PluginManager.\n */\nexport abstract class Plugin {\n // We need to store the EntityManager references in a WeakRef array so that they can be garbage collected. If we\n // didn't do this, then multiple EMs with the same plugin instance could keep each other from being garbage collected.\n [emsSymbol]: WeakRef<EntityManager>[] = [];\n\n maybeCloneForNewEm(): this | undefined {\n return undefined;\n }\n\n get ems(): readonly EntityManager[] {\n return this[emsSymbol]\n .values()\n .map((wr) => wr.deref())\n .filter(isDefined)\n .toArray();\n }\n}\n\nexport interface Plugin extends PluginMethods {}\n\n/**\n * Manages plugin lifecycle and dispatches plugin callbacks to registered plugins.\n *\n * The PluginManager optimizes callback dispatch by only creating dispatcher methods\n * for callbacks that have at least one registered plugin, making unused plugin hooks\n * zero-cost at runtime.\n */\nexport class PluginManager implements Required<PluginMethods> {\n #plugins = new Set<Plugin>();\n readonly #pluginsByCallback: Partial<Record<keyof Plugin, Plugin[]>> = {};\n constructor(public readonly em: EntityManager) {}\n\n /** Returns whether any registered plugin implements `method`, i.e. so callers can skip building its args. */\n hasHook(method: keyof PluginMethods): boolean {\n return this.#pluginsByCallback[method] !== undefined;\n }\n\n /**\n * Registers a plugin with this EntityManager.\n *\n * Dynamically creates dispatcher methods for any plugin callbacks implemented by this plugin,\n * enabling lazy initialization of only the hooks that are actually used.\n *\n * @throws Error if the plugin is already registered with another EntityManager\n */\n addPlugin(plugin: Plugin) {\n if (this.#plugins.has(plugin)) return; // if we're already added, then we can just early exit\n this.#plugins.add(plugin);\n plugin[emsSymbol].push(new WeakRef(this.em));\n for (const method of syncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // As a performance optimization, we only create the actual implementation for each method on the plugin manager\n // once we have at least one plugin using that method. This is to make it so any unused plugin methods are\n // effectively no-ops when called from within the em.\n if (!Object.hasOwn(this, method)) {\n this[method] = function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n (plugin[method] as (...args: any[]) => unknown)(...args);\n }\n };\n }\n }\n }\n for (const method of asyncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // Validate-phase plugin hooks are intentionally awaited without making hot-path hooks async.\n if (!Object.hasOwn(this, method)) {\n this[method] = async function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n await (plugin[method] as (...args: any[]) => Promise<void> | void)(...args);\n }\n };\n }\n }\n }\n }\n\n get plugins(): readonly Plugin[] {\n return [...this.#plugins];\n }\n\n cloneTo(other: PluginManager) {\n this.#plugins\n .values()\n .map((plugin) => plugin.maybeCloneForNewEm())\n .filter(isDefined)\n .forEach((plugin) => other.addPlugin(plugin));\n }\n\n // Defined as no-op functions initially instead of using optional chaining for performance reasons, see:\n // https://adventures.nodeland.dev/archive/noop-functions-vs-optional-chaining-a-performance/\n\n beforeGetField(entity: Entity, field: string): void {}\n beforeSetField(entity: Entity, field: string, newValue: any): void {}\n beforeFind(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void {}\n afterFind(meta: EntityMetadata, operation: FindOperation, rows: RowData) {}\n beforeValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void {}\n}\n"],"mappings":";;;;;;AAkEA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,qBAAqB,CAAC,kBAAkB,eAAe;AAC7D,MAAM,YAAY,OAAO,KAAK;;;;;;;AAO9B,IAAsB,SAAtB,MAA6B;CAG3B,CAAC,aAAuC,CAAC;CAEzC,qBAAuC,CAEvC;CAEA,IAAI,MAAgC;EAClC,OAAO,KAAK,UAAU,CACnB,OAAO,CAAC,CACR,KAAK,OAAO,GAAG,MAAM,CAAC,CAAC,CACvB,OAAOA,sBAAAA,SAAS,CAAC,CACjB,QAAQ;CACb;AACF;;;;;;;;AAWA,IAAa,gBAAb,MAA8D;CAGhC;CAF5B,2BAAW,IAAI,IAAY;CAC3B,qBAAuE,CAAC;CACxE,YAAY,IAAmC;EAAnB,KAAA,KAAA;CAAoB;;CAGhD,QAAQ,QAAsC;EAC5C,OAAO,KAAKC,mBAAmB,YAAY,KAAA;CAC7C;;;;;;;;;CAUA,UAAU,QAAgB;EACxB,IAAI,KAAKC,SAAS,IAAI,MAAM,GAAG;EAC/B,KAAKA,SAAS,IAAI,MAAM;EACxB,OAAO,UAAU,CAAC,KAAK,IAAI,QAAQ,KAAK,EAAE,CAAC;EAC3C,KAAK,MAAM,UAAU,mBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKD,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAIpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,SAA+B,GAAG,MAAa;IAC5D,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,OAAQ,OAAO,CAAiC,GAAG,IAAI;GAE3D;EAEJ;EAEF,KAAK,MAAM,UAAU,oBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKA,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAEpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,eAAqC,GAAG,MAAa;IAClE,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,MAAO,OAAO,OAAO,CAA8C,GAAG,IAAI;GAE9E;EAEJ;CAEJ;CAEA,IAAI,UAA6B;EAC/B,OAAO,CAAC,GAAG,KAAKC,QAAQ;CAC1B;CAEA,QAAQ,OAAsB;EAC5B,KAAKA,SACF,OAAO,CAAC,CACR,KAAK,WAAW,OAAO,mBAAmB,CAAC,CAAC,CAC5C,OAAOF,sBAAAA,SAAS,CAAC,CACjB,SAAS,WAAW,MAAM,UAAU,MAAM,CAAC;CAChD;CAKA,eAAe,QAAgB,OAAqB,CAAC;CACrD,eAAe,QAAgB,OAAe,UAAqB,CAAC;CACpE,WACE,MACA,WACA,OACA,UAQM,CAAC;CACT,UAAU,MAAsB,WAA0B,MAAe,CAAC;CAC1E,eAAe,UAAmD,CAAC;CACnE,cAAc,UAAmD,CAAC;CAClE,WAAW,aAAmC,cAAiD,CAAC;AAClG"}
@@ -1,9 +1,9 @@
1
1
  import { JoinRowTodo, Todo } from "./Todo.cjs";
2
+ import { ParsedFindQuery } from "./queries/find/QueryParser.cjs";
2
3
  import { RowData } from "./RowData.cjs";
3
4
  import { EntityMetadata } from "./EntityMetadata.cjs";
4
5
  import { EntityManager, FindOperation } from "./EntityManager.cjs";
5
6
  import { Entity } from "./Entity.cjs";
6
- import { ParsedFindQuery } from "./QueryParser.cjs";
7
7
  //#region src/PluginManager.d.ts
8
8
  interface PluginMethods {
9
9
  /**
@@ -1,9 +1,9 @@
1
1
  import { JoinRowTodo, Todo } from "./Todo.mjs";
2
+ import { ParsedFindQuery } from "./queries/find/QueryParser.mjs";
2
3
  import { RowData } from "./RowData.mjs";
3
4
  import { EntityMetadata } from "./EntityMetadata.mjs";
4
5
  import { EntityManager, FindOperation } from "./EntityManager.mjs";
5
6
  import { Entity } from "./Entity.mjs";
6
- import { ParsedFindQuery } from "./QueryParser.mjs";
7
7
  //#region src/PluginManager.d.ts
8
8
  interface PluginMethods {
9
9
  /**
@@ -2,7 +2,6 @@ import "./Todo.js";
2
2
  import "./EntityMetadata.js";
3
3
  import { isDefined } from "./EntityManager.js";
4
4
  import "./Entity.js";
5
- import "./QueryParser.js";
6
5
  //#region src/PluginManager.ts
7
6
  const syncPluginMethods = [
8
7
  "beforeGetField",
@@ -1 +1 @@
1
- {"version":3,"file":"PluginManager.js","names":["#pluginsByCallback","#plugins"],"sources":["../src/PluginManager.ts"],"sourcesContent":["import { type Entity } from \"./Entity.ts\";\nimport { type EntityManager, type FindOperation, isDefined } from \"./EntityManager.ts\";\nimport { type EntityMetadata } from \"./EntityMetadata.ts\";\nimport { type ParsedFindQuery } from \"./QueryParser.ts\";\nimport { type RowData } from \"./RowData.ts\";\nimport { type JoinRowTodo, type Todo } from \"./Todo.ts\";\n\ninterface PluginMethods {\n /**\n * Called before a field value is retrieved from an entity via getField.\n *\n * @param entity The entity instance being accessed\n * @param field The field name being retrieved\n */\n beforeGetField?(entity: Entity, field: string): void;\n /**\n * Called before a field value is set on an entity via setField.\n *\n * @param entity The entity instance being modified\n * @param field The field name being set\n * @param newValue The new value being assigned to the field\n */\n beforeSetField?(entity: Entity, field: string, newValue: any): void;\n /**\n * Called before a find operation is executed.\n *\n * @param meta Metadata for the entity type being queried\n * @param operation The type of find operation being performed\n * @param query The parsed query conditions\n * @param settings Query settings including limit and offset\n */\n beforeFind?(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void;\n /**\n * Called after a find operation has been executed to observe the raw database rows.\n *\n * The result is an observation-only {@link RowData} view — i.e. `rows.rowCount` for metrics,\n * `rows.get(i, columnName)` for specific cells, or `rows.toRows()` to materialize POJO rows.\n * For lazy results, cells decode on access, so a hook that only counts rows costs nothing;\n * materializing via `toRows()` decodes every cell of every row. Mutating materialized rows is\n * unsupported and is not guaranteed to affect entity hydration.\n *\n * @param meta Metadata for the entity type that was queried\n * @param operation The type of find operation that was performed\n * @param rows A read-only view of the raw database rows returned from the query\n */\n afterFind?(meta: EntityMetadata, operation: FindOperation, rows: RowData): void;\n\n beforeValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void;\n}\n\nconst syncPluginMethods = [\n \"beforeGetField\",\n \"beforeSetField\",\n \"beforeFind\",\n \"afterFind\",\n \"afterWrite\",\n] as const satisfies readonly (keyof PluginMethods)[];\nconst asyncPluginMethods = [\"beforeValidate\", \"afterValidate\"] as const satisfies readonly (keyof PluginMethods)[];\nconst emsSymbol = Symbol(\"ems\");\n/**\n * Base class for plugins that hook into entity lifecycle events.\n *\n * Plugins can implement any of the PluginMethods to intercept entity operations\n * and are automatically registered with the EntityManager when added via PluginManager.\n */\nexport abstract class Plugin {\n // We need to store the EntityManager references in a WeakRef array so that they can be garbage collected. If we\n // didn't do this, then multiple EMs with the same plugin instance could keep each other from being garbage collected.\n [emsSymbol]: WeakRef<EntityManager>[] = [];\n\n maybeCloneForNewEm(): this | undefined {\n return undefined;\n }\n\n get ems(): readonly EntityManager[] {\n return this[emsSymbol]\n .values()\n .map((wr) => wr.deref())\n .filter(isDefined)\n .toArray();\n }\n}\n\nexport interface Plugin extends PluginMethods {}\n\n/**\n * Manages plugin lifecycle and dispatches plugin callbacks to registered plugins.\n *\n * The PluginManager optimizes callback dispatch by only creating dispatcher methods\n * for callbacks that have at least one registered plugin, making unused plugin hooks\n * zero-cost at runtime.\n */\nexport class PluginManager implements Required<PluginMethods> {\n #plugins = new Set<Plugin>();\n readonly #pluginsByCallback: Partial<Record<keyof Plugin, Plugin[]>> = {};\n constructor(public readonly em: EntityManager) {}\n\n /** Returns whether any registered plugin implements `method`, i.e. so callers can skip building its args. */\n hasHook(method: keyof PluginMethods): boolean {\n return this.#pluginsByCallback[method] !== undefined;\n }\n\n /**\n * Registers a plugin with this EntityManager.\n *\n * Dynamically creates dispatcher methods for any plugin callbacks implemented by this plugin,\n * enabling lazy initialization of only the hooks that are actually used.\n *\n * @throws Error if the plugin is already registered with another EntityManager\n */\n addPlugin(plugin: Plugin) {\n if (this.#plugins.has(plugin)) return; // if we're already added, then we can just early exit\n this.#plugins.add(plugin);\n plugin[emsSymbol].push(new WeakRef(this.em));\n for (const method of syncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // As a performance optimization, we only create the actual implementation for each method on the plugin manager\n // once we have at least one plugin using that method. This is to make it so any unused plugin methods are\n // effectively no-ops when called from within the em.\n if (!Object.hasOwn(this, method)) {\n this[method] = function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n (plugin[method] as (...args: any[]) => unknown)(...args);\n }\n };\n }\n }\n }\n for (const method of asyncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // Validate-phase plugin hooks are intentionally awaited without making hot-path hooks async.\n if (!Object.hasOwn(this, method)) {\n this[method] = async function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n await (plugin[method] as (...args: any[]) => Promise<void> | void)(...args);\n }\n };\n }\n }\n }\n }\n\n get plugins(): readonly Plugin[] {\n return [...this.#plugins];\n }\n\n cloneTo(other: PluginManager) {\n this.#plugins\n .values()\n .map((plugin) => plugin.maybeCloneForNewEm())\n .filter(isDefined)\n .forEach((plugin) => other.addPlugin(plugin));\n }\n\n // Defined as no-op functions initially instead of using optional chaining for performance reasons, see:\n // https://adventures.nodeland.dev/archive/noop-functions-vs-optional-chaining-a-performance/\n\n beforeGetField(entity: Entity, field: string): void {}\n beforeSetField(entity: Entity, field: string, newValue: any): void {}\n beforeFind(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void {}\n afterFind(meta: EntityMetadata, operation: FindOperation, rows: RowData) {}\n beforeValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void {}\n}\n"],"mappings":";;;;;;AAkEA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,qBAAqB,CAAC,kBAAkB,eAAe;AAC7D,MAAM,YAAY,OAAO,KAAK;;;;;;;AAO9B,IAAsB,SAAtB,MAA6B;CAG3B,CAAC,aAAuC,CAAC;CAEzC,qBAAuC,CAEvC;CAEA,IAAI,MAAgC;EAClC,OAAO,KAAK,UAAU,CACnB,OAAO,CAAC,CACR,KAAK,OAAO,GAAG,MAAM,CAAC,CAAC,CACvB,OAAO,SAAS,CAAC,CACjB,QAAQ;CACb;AACF;;;;;;;;AAWA,IAAa,gBAAb,MAA8D;CAGhC;CAF5B,2BAAW,IAAI,IAAY;CAC3B,qBAAuE,CAAC;CACxE,YAAY,IAAmC;EAAnB,KAAA,KAAA;CAAoB;;CAGhD,QAAQ,QAAsC;EAC5C,OAAO,KAAKA,mBAAmB,YAAY,KAAA;CAC7C;;;;;;;;;CAUA,UAAU,QAAgB;EACxB,IAAI,KAAKC,SAAS,IAAI,MAAM,GAAG;EAC/B,KAAKA,SAAS,IAAI,MAAM;EACxB,OAAO,UAAU,CAAC,KAAK,IAAI,QAAQ,KAAK,EAAE,CAAC;EAC3C,KAAK,MAAM,UAAU,mBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKD,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAIpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,SAA+B,GAAG,MAAa;IAC5D,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,OAAQ,OAAO,CAAiC,GAAG,IAAI;GAE3D;EAEJ;EAEF,KAAK,MAAM,UAAU,oBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKA,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAEpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,eAAqC,GAAG,MAAa;IAClE,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,MAAO,OAAO,OAAO,CAA8C,GAAG,IAAI;GAE9E;EAEJ;CAEJ;CAEA,IAAI,UAA6B;EAC/B,OAAO,CAAC,GAAG,KAAKC,QAAQ;CAC1B;CAEA,QAAQ,OAAsB;EAC5B,KAAKA,SACF,OAAO,CAAC,CACR,KAAK,WAAW,OAAO,mBAAmB,CAAC,CAAC,CAC5C,OAAO,SAAS,CAAC,CACjB,SAAS,WAAW,MAAM,UAAU,MAAM,CAAC;CAChD;CAKA,eAAe,QAAgB,OAAqB,CAAC;CACrD,eAAe,QAAgB,OAAe,UAAqB,CAAC;CACpE,WACE,MACA,WACA,OACA,UAQM,CAAC;CACT,UAAU,MAAsB,WAA0B,MAAe,CAAC;CAC1E,eAAe,UAAmD,CAAC;CACnE,cAAc,UAAmD,CAAC;CAClE,WAAW,aAAmC,cAAiD,CAAC;AAClG"}
1
+ {"version":3,"file":"PluginManager.js","names":["#pluginsByCallback","#plugins"],"sources":["../src/PluginManager.ts"],"sourcesContent":["import { type Entity } from \"./Entity.ts\";\nimport { type EntityManager, type FindOperation, isDefined } from \"./EntityManager.ts\";\nimport { type EntityMetadata } from \"./EntityMetadata.ts\";\nimport type { ParsedFindQuery } from \"./queries/find/QueryParser.ts\";\nimport { type RowData } from \"./RowData.ts\";\nimport { type JoinRowTodo, type Todo } from \"./Todo.ts\";\n\ninterface PluginMethods {\n /**\n * Called before a field value is retrieved from an entity via getField.\n *\n * @param entity The entity instance being accessed\n * @param field The field name being retrieved\n */\n beforeGetField?(entity: Entity, field: string): void;\n /**\n * Called before a field value is set on an entity via setField.\n *\n * @param entity The entity instance being modified\n * @param field The field name being set\n * @param newValue The new value being assigned to the field\n */\n beforeSetField?(entity: Entity, field: string, newValue: any): void;\n /**\n * Called before a find operation is executed.\n *\n * @param meta Metadata for the entity type being queried\n * @param operation The type of find operation being performed\n * @param query The parsed query conditions\n * @param settings Query settings including limit and offset\n */\n beforeFind?(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void;\n /**\n * Called after a find operation has been executed to observe the raw database rows.\n *\n * The result is an observation-only {@link RowData} view — i.e. `rows.rowCount` for metrics,\n * `rows.get(i, columnName)` for specific cells, or `rows.toRows()` to materialize POJO rows.\n * For lazy results, cells decode on access, so a hook that only counts rows costs nothing;\n * materializing via `toRows()` decodes every cell of every row. Mutating materialized rows is\n * unsupported and is not guaranteed to affect entity hydration.\n *\n * @param meta Metadata for the entity type that was queried\n * @param operation The type of find operation that was performed\n * @param rows A read-only view of the raw database rows returned from the query\n */\n afterFind?(meta: EntityMetadata, operation: FindOperation, rows: RowData): void;\n\n beforeValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterValidate?(entities: readonly Entity[]): Promise<void> | void;\n\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void;\n}\n\nconst syncPluginMethods = [\n \"beforeGetField\",\n \"beforeSetField\",\n \"beforeFind\",\n \"afterFind\",\n \"afterWrite\",\n] as const satisfies readonly (keyof PluginMethods)[];\nconst asyncPluginMethods = [\"beforeValidate\", \"afterValidate\"] as const satisfies readonly (keyof PluginMethods)[];\nconst emsSymbol = Symbol(\"ems\");\n/**\n * Base class for plugins that hook into entity lifecycle events.\n *\n * Plugins can implement any of the PluginMethods to intercept entity operations\n * and are automatically registered with the EntityManager when added via PluginManager.\n */\nexport abstract class Plugin {\n // We need to store the EntityManager references in a WeakRef array so that they can be garbage collected. If we\n // didn't do this, then multiple EMs with the same plugin instance could keep each other from being garbage collected.\n [emsSymbol]: WeakRef<EntityManager>[] = [];\n\n maybeCloneForNewEm(): this | undefined {\n return undefined;\n }\n\n get ems(): readonly EntityManager[] {\n return this[emsSymbol]\n .values()\n .map((wr) => wr.deref())\n .filter(isDefined)\n .toArray();\n }\n}\n\nexport interface Plugin extends PluginMethods {}\n\n/**\n * Manages plugin lifecycle and dispatches plugin callbacks to registered plugins.\n *\n * The PluginManager optimizes callback dispatch by only creating dispatcher methods\n * for callbacks that have at least one registered plugin, making unused plugin hooks\n * zero-cost at runtime.\n */\nexport class PluginManager implements Required<PluginMethods> {\n #plugins = new Set<Plugin>();\n readonly #pluginsByCallback: Partial<Record<keyof Plugin, Plugin[]>> = {};\n constructor(public readonly em: EntityManager) {}\n\n /** Returns whether any registered plugin implements `method`, i.e. so callers can skip building its args. */\n hasHook(method: keyof PluginMethods): boolean {\n return this.#pluginsByCallback[method] !== undefined;\n }\n\n /**\n * Registers a plugin with this EntityManager.\n *\n * Dynamically creates dispatcher methods for any plugin callbacks implemented by this plugin,\n * enabling lazy initialization of only the hooks that are actually used.\n *\n * @throws Error if the plugin is already registered with another EntityManager\n */\n addPlugin(plugin: Plugin) {\n if (this.#plugins.has(plugin)) return; // if we're already added, then we can just early exit\n this.#plugins.add(plugin);\n plugin[emsSymbol].push(new WeakRef(this.em));\n for (const method of syncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // As a performance optimization, we only create the actual implementation for each method on the plugin manager\n // once we have at least one plugin using that method. This is to make it so any unused plugin methods are\n // effectively no-ops when called from within the em.\n if (!Object.hasOwn(this, method)) {\n this[method] = function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n (plugin[method] as (...args: any[]) => unknown)(...args);\n }\n };\n }\n }\n }\n for (const method of asyncPluginMethods) {\n if (method in plugin) {\n (this.#pluginsByCallback[method] ??= []).push(plugin);\n // Validate-phase plugin hooks are intentionally awaited without making hot-path hooks async.\n if (!Object.hasOwn(this, method)) {\n this[method] = async function (this: PluginManager, ...args: any[]) {\n for (const plugin of this.#pluginsByCallback[method]!) {\n await (plugin[method] as (...args: any[]) => Promise<void> | void)(...args);\n }\n };\n }\n }\n }\n }\n\n get plugins(): readonly Plugin[] {\n return [...this.#plugins];\n }\n\n cloneTo(other: PluginManager) {\n this.#plugins\n .values()\n .map((plugin) => plugin.maybeCloneForNewEm())\n .filter(isDefined)\n .forEach((plugin) => other.addPlugin(plugin));\n }\n\n // Defined as no-op functions initially instead of using optional chaining for performance reasons, see:\n // https://adventures.nodeland.dev/archive/noop-functions-vs-optional-chaining-a-performance/\n\n beforeGetField(entity: Entity, field: string): void {}\n beforeSetField(entity: Entity, field: string, newValue: any): void {}\n beforeFind(\n meta: EntityMetadata,\n operation: FindOperation,\n query: ParsedFindQuery,\n settings: {\n limit?: number;\n offset?: number;\n allowMultipleLeftJoins?: boolean;\n optimizeJoinsToExists?: boolean;\n pruneJoins?: boolean;\n keepAliases?: string[];\n },\n ): void {}\n afterFind(meta: EntityMetadata, operation: FindOperation, rows: RowData) {}\n beforeValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterValidate(entities: readonly Entity[]): Promise<void> | void {}\n afterWrite(entityTodos: Record<string, Todo>, joinRowTodos: Record<string, JoinRowTodo>): void {}\n}\n"],"mappings":";;;;;AAkEA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,qBAAqB,CAAC,kBAAkB,eAAe;AAC7D,MAAM,YAAY,OAAO,KAAK;;;;;;;AAO9B,IAAsB,SAAtB,MAA6B;CAG3B,CAAC,aAAuC,CAAC;CAEzC,qBAAuC,CAEvC;CAEA,IAAI,MAAgC;EAClC,OAAO,KAAK,UAAU,CACnB,OAAO,CAAC,CACR,KAAK,OAAO,GAAG,MAAM,CAAC,CAAC,CACvB,OAAO,SAAS,CAAC,CACjB,QAAQ;CACb;AACF;;;;;;;;AAWA,IAAa,gBAAb,MAA8D;CAGhC;CAF5B,2BAAW,IAAI,IAAY;CAC3B,qBAAuE,CAAC;CACxE,YAAY,IAAmC;EAAnB,KAAA,KAAA;CAAoB;;CAGhD,QAAQ,QAAsC;EAC5C,OAAO,KAAKA,mBAAmB,YAAY,KAAA;CAC7C;;;;;;;;;CAUA,UAAU,QAAgB;EACxB,IAAI,KAAKC,SAAS,IAAI,MAAM,GAAG;EAC/B,KAAKA,SAAS,IAAI,MAAM;EACxB,OAAO,UAAU,CAAC,KAAK,IAAI,QAAQ,KAAK,EAAE,CAAC;EAC3C,KAAK,MAAM,UAAU,mBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKD,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAIpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,SAA+B,GAAG,MAAa;IAC5D,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,OAAQ,OAAO,CAAiC,GAAG,IAAI;GAE3D;EAEJ;EAEF,KAAK,MAAM,UAAU,oBACnB,IAAI,UAAU,QAAQ;GACpB,CAAC,KAAKA,mBAAmB,YAAY,CAAC,EAAA,CAAG,KAAK,MAAM;GAEpD,IAAI,CAAC,OAAO,OAAO,MAAM,MAAM,GAC7B,KAAK,UAAU,eAAqC,GAAG,MAAa;IAClE,KAAK,MAAM,UAAU,KAAKA,mBAAmB,SAC3C,MAAO,OAAO,OAAO,CAA8C,GAAG,IAAI;GAE9E;EAEJ;CAEJ;CAEA,IAAI,UAA6B;EAC/B,OAAO,CAAC,GAAG,KAAKC,QAAQ;CAC1B;CAEA,QAAQ,OAAsB;EAC5B,KAAKA,SACF,OAAO,CAAC,CACR,KAAK,WAAW,OAAO,mBAAmB,CAAC,CAAC,CAC5C,OAAO,SAAS,CAAC,CACjB,SAAS,WAAW,MAAM,UAAU,MAAM,CAAC;CAChD;CAKA,eAAe,QAAgB,OAAqB,CAAC;CACrD,eAAe,QAAgB,OAAe,UAAqB,CAAC;CACpE,WACE,MACA,WACA,OACA,UAQM,CAAC;CACT,UAAU,MAAsB,WAA0B,MAAe,CAAC;CAC1E,eAAe,UAAmD,CAAC;CACnE,cAAc,UAAmD,CAAC;CAClE,WAAW,aAAmC,cAAiD,CAAC;AAClG"}
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_logging_ReactionLogger = require("./logging/ReactionLogger.cjs");
3
3
  const require_trusted = require("./trusted.cjs");
4
- const require_EntityMetadata = require("./EntityMetadata.cjs");
5
4
  const require_reactiveHints = require("./reactiveHints.cjs");
5
+ require("./config.cjs");
6
+ const require_EntityMetadata = require("./EntityMetadata.cjs");
6
7
  const require_index = require("./index.cjs");
7
8
  const require_EntityManager = require("./EntityManager.cjs");
8
9
  require("./Entity.cjs");
9
- require("./config.cjs");
10
10
  //#region src/ReactionsManager.ts
11
11
  /**
12
12
  * Manages the reactivity of tracking which source fields have changed and finding/recalculating
@@ -1,11 +1,11 @@
1
1
  import { globalLogger, noopReactionLogger } from "./logging/ReactionLogger.js";
2
2
  import { runInTrustedContext } from "./trusted.js";
3
- import { getMetadata } from "./EntityMetadata.js";
4
3
  import { followReverseHint } from "./reactiveHints.js";
4
+ import "./config.js";
5
+ import { getMetadata } from "./EntityMetadata.js";
5
6
  import { NoIdError } from "./index.js";
6
7
  import { getEmInternalApi } from "./EntityManager.js";
7
8
  import "./Entity.js";
8
- import "./config.js";
9
9
  //#region src/ReactionsManager.ts
10
10
  /**
11
11
  * Manages the reactivity of tracking which source fields have changed and finding/recalculating
package/build/Todo.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./JoinRows.cjs");
3
- const require_EntityMetadata = require("./EntityMetadata.cjs");
4
3
  const require_utils = require("./utils.cjs");
4
+ const require_EntityMetadata = require("./EntityMetadata.cjs");
5
5
  require("./Entity.cjs");
6
6
  const require_BaseEntity = require("./BaseEntity.cjs");
7
7
  //#region src/Todo.ts
package/build/Todo.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./JoinRows.js";
2
- import { getMetadata } from "./EntityMetadata.js";
3
2
  import { groupBy } from "./utils.js";
3
+ import { getMetadata } from "./EntityMetadata.js";
4
4
  import "./Entity.js";
5
5
  import { getInstanceData } from "./BaseEntity.js";
6
6
  //#region src/Todo.ts
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./BatchLoader.cjs");
3
- const require_keys = require("../keys.cjs");
4
3
  const require_utils = require("../utils.cjs");
4
+ const require_keys = require("../keys.cjs");
5
5
  require("../index.cjs");
6
6
  const require_EntityManager = require("../EntityManager.cjs");
7
7
  //#region src/batchloaders/enumCollectionBatchLoader.ts
@@ -1,6 +1,6 @@
1
1
  import "./BatchLoader.js";
2
- import { keyToNumber } from "../keys.js";
3
2
  import { abbreviation } from "../utils.js";
3
+ import { keyToNumber } from "../keys.js";
4
4
  import "../index.js";
5
5
  import { getEmInternalApi } from "../EntityManager.js";
6
6
  //#region src/batchloaders/enumCollectionBatchLoader.ts
@@ -1,13 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./BatchLoader.cjs");
3
- const require_keys = require("../keys.cjs");
4
- require("../EntityMetadata.cjs");
3
+ const require_queries_entityQueryUtils = require("../queries/entityQueryUtils.cjs");
4
+ const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
5
5
  require("../loadHints.cjs");
6
6
  const require_utils = require("../utils.cjs");
7
+ const require_keys = require("../keys.cjs");
8
+ require("../EntityMetadata.cjs");
7
9
  const require_HintTree = require("../HintTree.cjs");
8
10
  const require_EntityManager = require("../EntityManager.cjs");
9
11
  const require_BaseEntity = require("../BaseEntity.cjs");
10
- const require_QueryParser = require("../QueryParser.cjs");
11
12
  //#region src/batchloaders/loadBatchLoader.ts
12
13
  const loadOperation = "load";
13
14
  /**
@@ -22,7 +23,7 @@ function loadBatchLoader(em, meta, overwriteExisting = false) {
22
23
  const keys = loads.map((l) => require_keys.keyToNumber(meta, l.taggedId));
23
24
  const alias = require_utils.abbreviation(meta.tableName);
24
25
  const query = {
25
- selects: meta.hasLazyColumns ? require_QueryParser.lazyExcludedSelects(meta, alias) : [`"${alias}".*`],
26
+ selects: meta.hasLazyColumns ? require_queries_entityQueryUtils.lazyExcludedSelects(meta, alias) : [`"${alias}".*`],
26
27
  tables: [{
27
28
  alias,
28
29
  join: "primary",
@@ -48,7 +49,7 @@ function loadBatchLoader(em, meta, overwriteExisting = false) {
48
49
  order: "ASC"
49
50
  }]
50
51
  };
51
- require_QueryParser.addTablePerClassJoinsAndClassTag(query, meta, alias, true);
52
+ require_queries_find_QueryParser.addTablePerClassJoinsAndClassTag(query, meta, alias, true);
52
53
  const { preloader } = require_EntityManager.getEmInternalApi(em);
53
54
  const preloadHydrator = preloader && preloader.addPreloading(meta, require_HintTree.buildHintTree(loads.map((l) => ({
54
55
  entity: l.taggedId,
@@ -1 +1 @@
1
- {"version":3,"file":"loadBatchLoader.cjs","names":["keyToNumber","abbreviation","lazyExcludedSelects","getEmInternalApi","buildHintTree","tagId"],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"sourcesContent":["import { getInstanceData } from \"../BaseEntity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { type EntityMetadata } from \"../EntityMetadata.ts\";\nimport { buildHintTree } from \"../HintTree.ts\";\nimport { keyToNumber, tagId } from \"../keys.ts\";\nimport { type LoadHint } from \"../loadHints.ts\";\nimport { type ParsedFindQuery, addTablePerClassJoinsAndClassTag, lazyExcludedSelects } from \"../QueryParser.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const loadOperation = \"load\";\n\n/**\n * Batches em.load-style fetches, writing to identity map (via hydrate) instead of returning values.\n * After the batch resolves, callers retrieve their entity from `em.findExistingInstance`.\n *\n * Accepts tuples of `{ taggedId, hint }` so the preloader can inject join-based\n * preloading into the same SELECT that fetches the entities.\n */\nexport function loadBatchLoader(\n em: EntityManager,\n meta: EntityMetadata,\n overwriteExisting: boolean = false,\n): BatchLoader<{ taggedId: string; hint: LoadHint<any> | undefined }> {\n return em.getBatchLoader(loadOperation, `${meta.type}-${overwriteExisting}`, async (loads) => {\n const keys = loads.map((l) => keyToNumber(meta, l.taggedId));\n const alias = abbreviation(meta.tableName);\n const query = {\n selects: meta.hasLazyColumns ? lazyExcludedSelects(meta, alias) : [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [{ kind: \"column\", alias, column: \"id\", dbType: meta.idDbType, cond: { kind: \"in\", value: keys } }],\n },\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n } satisfies ParsedFindQuery;\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n // Inject preloading joins into the query if enabled\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator =\n preloader &&\n preloader.addPreloading(meta, buildHintTree(loads.map((l) => ({ entity: l.taggedId, hint: l.hint }))), query);\n const rowData = await em[\"executeFindRowData\"](meta, loadOperation, query, {});\n em[\"hydrateAndFinalize\"](meta.cstr, rowData, {\n overwriteExisting,\n sidecars: (entities) => {\n preloadHydrator && preloadHydrator(rowData, entities);\n // If we're missing any requested rows, mark any requested-but-not-found entities as deleted\n if (rowData.rowCount !== loads.length) {\n const foundIds = new Set<string>();\n for (let i = 0; i < rowData.rowCount; i++) foundIds.add(tagId(meta, rowData.get(i, \"id\")));\n for (const load of loads) {\n if (!foundIds.has(load.taggedId)) {\n const existingEntity = em.findExistingInstance(load.taggedId);\n if (existingEntity) {\n getInstanceData(existingEntity).markDeletedBecauseNotFound();\n }\n }\n }\n }\n },\n });\n });\n}\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,gBAAgB;;;;;;;;AAS7B,SAAgB,gBACd,IACA,MACA,oBAA6B,OACuC;CACpE,OAAO,GAAG,eAAe,eAAe,GAAG,KAAK,KAAK,GAAG,qBAAqB,OAAO,UAAU;EAC5F,MAAM,OAAO,MAAM,KAAK,MAAMA,aAAAA,YAAY,MAAM,EAAE,QAAQ,CAAC;EAC3D,MAAM,QAAQC,cAAAA,aAAa,KAAK,SAAS;EACzC,MAAM,QAAQ;GACZ,SAAS,KAAK,iBAAiBC,oBAAAA,oBAAoB,MAAM,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI;GACjF,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,CAAC;GAC1D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CAAC;KAAE,MAAM;KAAU;KAAO,QAAQ;KAAM,QAAQ,KAAK;KAAU,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAAE,CAAC;GAChH;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;EAClD;EACA,oBAAA,iCAAiC,OAAO,MAAM,OAAO,IAAI;EAEzD,MAAM,EAAE,cAAcC,sBAAAA,iBAAiB,EAAE;EACzC,MAAM,kBACJ,aACA,UAAU,cAAc,MAAMC,iBAAAA,cAAc,MAAM,KAAK,OAAO;GAAE,QAAQ,EAAE;GAAU,MAAM,EAAE;EAAK,EAAE,CAAC,GAAG,KAAK;EAC9G,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,MAAM,eAAe,OAAO,CAAC,CAAC;EAC7E,GAAG,qBAAqB,CAAC,KAAK,MAAM,SAAS;GAC3C;GACA,WAAW,aAAa;IACtB,mBAAmB,gBAAgB,SAAS,QAAQ;IAEpD,IAAI,QAAQ,aAAa,MAAM,QAAQ;KACrC,MAAM,2BAAW,IAAI,IAAY;KACjC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,UAAU,KAAK,SAAS,IAAIC,aAAAA,MAAM,MAAM,QAAQ,IAAI,GAAG,IAAI,CAAC,CAAC;KACzF,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,SAAS,IAAI,KAAK,QAAQ,GAAG;MAChC,MAAM,iBAAiB,GAAG,qBAAqB,KAAK,QAAQ;MAC5D,IAAI,gBACF,mBAAA,gBAAgB,cAAc,CAAC,CAAC,2BAA2B;KAE/D;IAEJ;GACF;EACF,CAAC;CACH,CAAC;AACH"}
1
+ {"version":3,"file":"loadBatchLoader.cjs","names":["keyToNumber","abbreviation","lazyExcludedSelects","getEmInternalApi","buildHintTree","tagId"],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"sourcesContent":["import { getInstanceData } from \"../BaseEntity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { type EntityMetadata } from \"../EntityMetadata.ts\";\nimport { buildHintTree } from \"../HintTree.ts\";\nimport { keyToNumber, tagId } from \"../keys.ts\";\nimport { type LoadHint } from \"../loadHints.ts\";\nimport { lazyExcludedSelects } from \"../queries/entityQueryUtils.ts\";\nimport { type ParsedFindQuery, addTablePerClassJoinsAndClassTag } from \"../queries/find/QueryParser.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const loadOperation = \"load\";\n\n/**\n * Batches em.load-style fetches, writing to identity map (via hydrate) instead of returning values.\n * After the batch resolves, callers retrieve their entity from `em.findExistingInstance`.\n *\n * Accepts tuples of `{ taggedId, hint }` so the preloader can inject join-based\n * preloading into the same SELECT that fetches the entities.\n */\nexport function loadBatchLoader(\n em: EntityManager,\n meta: EntityMetadata,\n overwriteExisting: boolean = false,\n): BatchLoader<{ taggedId: string; hint: LoadHint<any> | undefined }> {\n return em.getBatchLoader(loadOperation, `${meta.type}-${overwriteExisting}`, async (loads) => {\n const keys = loads.map((l) => keyToNumber(meta, l.taggedId));\n const alias = abbreviation(meta.tableName);\n const query = {\n selects: meta.hasLazyColumns ? lazyExcludedSelects(meta, alias) : [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [{ kind: \"column\", alias, column: \"id\", dbType: meta.idDbType, cond: { kind: \"in\", value: keys } }],\n },\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n } satisfies ParsedFindQuery;\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n // Inject preloading joins into the query if enabled\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator =\n preloader &&\n preloader.addPreloading(meta, buildHintTree(loads.map((l) => ({ entity: l.taggedId, hint: l.hint }))), query);\n const rowData = await em[\"executeFindRowData\"](meta, loadOperation, query, {});\n em[\"hydrateAndFinalize\"](meta.cstr, rowData, {\n overwriteExisting,\n sidecars: (entities) => {\n preloadHydrator && preloadHydrator(rowData, entities);\n // If we're missing any requested rows, mark any requested-but-not-found entities as deleted\n if (rowData.rowCount !== loads.length) {\n const foundIds = new Set<string>();\n for (let i = 0; i < rowData.rowCount; i++) foundIds.add(tagId(meta, rowData.get(i, \"id\")));\n for (const load of loads) {\n if (!foundIds.has(load.taggedId)) {\n const existingEntity = em.findExistingInstance(load.taggedId);\n if (existingEntity) {\n getInstanceData(existingEntity).markDeletedBecauseNotFound();\n }\n }\n }\n }\n },\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,gBAAgB;;;;;;;;AAS7B,SAAgB,gBACd,IACA,MACA,oBAA6B,OACuC;CACpE,OAAO,GAAG,eAAe,eAAe,GAAG,KAAK,KAAK,GAAG,qBAAqB,OAAO,UAAU;EAC5F,MAAM,OAAO,MAAM,KAAK,MAAMA,aAAAA,YAAY,MAAM,EAAE,QAAQ,CAAC;EAC3D,MAAM,QAAQC,cAAAA,aAAa,KAAK,SAAS;EACzC,MAAM,QAAQ;GACZ,SAAS,KAAK,iBAAiBC,iCAAAA,oBAAoB,MAAM,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI;GACjF,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,CAAC;GAC1D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CAAC;KAAE,MAAM;KAAU;KAAO,QAAQ;KAAM,QAAQ,KAAK;KAAU,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAAE,CAAC;GAChH;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;EAClD;EACA,iCAAA,iCAAiC,OAAO,MAAM,OAAO,IAAI;EAEzD,MAAM,EAAE,cAAcC,sBAAAA,iBAAiB,EAAE;EACzC,MAAM,kBACJ,aACA,UAAU,cAAc,MAAMC,iBAAAA,cAAc,MAAM,KAAK,OAAO;GAAE,QAAQ,EAAE;GAAU,MAAM,EAAE;EAAK,EAAE,CAAC,GAAG,KAAK;EAC9G,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,MAAM,eAAe,OAAO,CAAC,CAAC;EAC7E,GAAG,qBAAqB,CAAC,KAAK,MAAM,SAAS;GAC3C;GACA,WAAW,aAAa;IACtB,mBAAmB,gBAAgB,SAAS,QAAQ;IAEpD,IAAI,QAAQ,aAAa,MAAM,QAAQ;KACrC,MAAM,2BAAW,IAAI,IAAY;KACjC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,UAAU,KAAK,SAAS,IAAIC,aAAAA,MAAM,MAAM,QAAQ,IAAI,GAAG,IAAI,CAAC,CAAC;KACzF,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,SAAS,IAAI,KAAK,QAAQ,GAAG;MAChC,MAAM,iBAAiB,GAAG,qBAAqB,KAAK,QAAQ;MAC5D,IAAI,gBACF,mBAAA,gBAAgB,cAAc,CAAC,CAAC,2BAA2B;KAE/D;IAEJ;GACF;EACF,CAAC;CACH,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadBatchLoader.d.cts","names":[],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"mappings":";;;;;cAUa;;;;;;;;iBASG,gBACd,IAAI,eACJ,MAAM,gBACN,8BACC;EAAc;EAAkB,MAAM"}
1
+ {"version":3,"file":"loadBatchLoader.d.cts","names":[],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"mappings":";;;;;cAWa;;;;;;;;iBASG,gBACd,IAAI,eACJ,MAAM,gBACN,8BACC;EAAc;EAAkB,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadBatchLoader.d.mts","names":[],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"mappings":";;;;;cAUa;;;;;;;;iBASG,gBACd,IAAI,eACJ,MAAM,gBACN,8BACC;EAAc;EAAkB,MAAM"}
1
+ {"version":3,"file":"loadBatchLoader.d.mts","names":[],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"mappings":";;;;;cAWa;;;;;;;;iBASG,gBACd,IAAI,eACJ,MAAM,gBACN,8BACC;EAAc;EAAkB,MAAM"}
@@ -1,12 +1,13 @@
1
1
  import "./BatchLoader.js";
2
- import { keyToNumber, tagId } from "../keys.js";
3
- import "../EntityMetadata.js";
2
+ import { lazyExcludedSelects } from "../queries/entityQueryUtils.js";
3
+ import { addTablePerClassJoinsAndClassTag } from "../queries/find/QueryParser.js";
4
4
  import "../loadHints.js";
5
5
  import { abbreviation } from "../utils.js";
6
+ import { keyToNumber, tagId } from "../keys.js";
7
+ import "../EntityMetadata.js";
6
8
  import { buildHintTree } from "../HintTree.js";
7
9
  import { getEmInternalApi } from "../EntityManager.js";
8
10
  import { getInstanceData } from "../BaseEntity.js";
9
- import { addTablePerClassJoinsAndClassTag, lazyExcludedSelects } from "../QueryParser.js";
10
11
  //#region src/batchloaders/loadBatchLoader.ts
11
12
  const loadOperation = "load";
12
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"loadBatchLoader.js","names":[],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"sourcesContent":["import { getInstanceData } from \"../BaseEntity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { type EntityMetadata } from \"../EntityMetadata.ts\";\nimport { buildHintTree } from \"../HintTree.ts\";\nimport { keyToNumber, tagId } from \"../keys.ts\";\nimport { type LoadHint } from \"../loadHints.ts\";\nimport { type ParsedFindQuery, addTablePerClassJoinsAndClassTag, lazyExcludedSelects } from \"../QueryParser.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const loadOperation = \"load\";\n\n/**\n * Batches em.load-style fetches, writing to identity map (via hydrate) instead of returning values.\n * After the batch resolves, callers retrieve their entity from `em.findExistingInstance`.\n *\n * Accepts tuples of `{ taggedId, hint }` so the preloader can inject join-based\n * preloading into the same SELECT that fetches the entities.\n */\nexport function loadBatchLoader(\n em: EntityManager,\n meta: EntityMetadata,\n overwriteExisting: boolean = false,\n): BatchLoader<{ taggedId: string; hint: LoadHint<any> | undefined }> {\n return em.getBatchLoader(loadOperation, `${meta.type}-${overwriteExisting}`, async (loads) => {\n const keys = loads.map((l) => keyToNumber(meta, l.taggedId));\n const alias = abbreviation(meta.tableName);\n const query = {\n selects: meta.hasLazyColumns ? lazyExcludedSelects(meta, alias) : [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [{ kind: \"column\", alias, column: \"id\", dbType: meta.idDbType, cond: { kind: \"in\", value: keys } }],\n },\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n } satisfies ParsedFindQuery;\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n // Inject preloading joins into the query if enabled\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator =\n preloader &&\n preloader.addPreloading(meta, buildHintTree(loads.map((l) => ({ entity: l.taggedId, hint: l.hint }))), query);\n const rowData = await em[\"executeFindRowData\"](meta, loadOperation, query, {});\n em[\"hydrateAndFinalize\"](meta.cstr, rowData, {\n overwriteExisting,\n sidecars: (entities) => {\n preloadHydrator && preloadHydrator(rowData, entities);\n // If we're missing any requested rows, mark any requested-but-not-found entities as deleted\n if (rowData.rowCount !== loads.length) {\n const foundIds = new Set<string>();\n for (let i = 0; i < rowData.rowCount; i++) foundIds.add(tagId(meta, rowData.get(i, \"id\")));\n for (const load of loads) {\n if (!foundIds.has(load.taggedId)) {\n const existingEntity = em.findExistingInstance(load.taggedId);\n if (existingEntity) {\n getInstanceData(existingEntity).markDeletedBecauseNotFound();\n }\n }\n }\n }\n },\n });\n });\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,gBAAgB;;;;;;;;AAS7B,SAAgB,gBACd,IACA,MACA,oBAA6B,OACuC;CACpE,OAAO,GAAG,eAAe,eAAe,GAAG,KAAK,KAAK,GAAG,qBAAqB,OAAO,UAAU;EAC5F,MAAM,OAAO,MAAM,KAAK,MAAM,YAAY,MAAM,EAAE,QAAQ,CAAC;EAC3D,MAAM,QAAQ,aAAa,KAAK,SAAS;EACzC,MAAM,QAAQ;GACZ,SAAS,KAAK,iBAAiB,oBAAoB,MAAM,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI;GACjF,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,CAAC;GAC1D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CAAC;KAAE,MAAM;KAAU;KAAO,QAAQ;KAAM,QAAQ,KAAK;KAAU,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAAE,CAAC;GAChH;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;EAClD;EACA,iCAAiC,OAAO,MAAM,OAAO,IAAI;EAEzD,MAAM,EAAE,cAAc,iBAAiB,EAAE;EACzC,MAAM,kBACJ,aACA,UAAU,cAAc,MAAM,cAAc,MAAM,KAAK,OAAO;GAAE,QAAQ,EAAE;GAAU,MAAM,EAAE;EAAK,EAAE,CAAC,GAAG,KAAK;EAC9G,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,MAAM,eAAe,OAAO,CAAC,CAAC;EAC7E,GAAG,qBAAqB,CAAC,KAAK,MAAM,SAAS;GAC3C;GACA,WAAW,aAAa;IACtB,mBAAmB,gBAAgB,SAAS,QAAQ;IAEpD,IAAI,QAAQ,aAAa,MAAM,QAAQ;KACrC,MAAM,2BAAW,IAAI,IAAY;KACjC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,UAAU,KAAK,SAAS,IAAI,MAAM,MAAM,QAAQ,IAAI,GAAG,IAAI,CAAC,CAAC;KACzF,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,SAAS,IAAI,KAAK,QAAQ,GAAG;MAChC,MAAM,iBAAiB,GAAG,qBAAqB,KAAK,QAAQ;MAC5D,IAAI,gBACF,gBAAgB,cAAc,CAAC,CAAC,2BAA2B;KAE/D;IAEJ;GACF;EACF,CAAC;CACH,CAAC;AACH"}
1
+ {"version":3,"file":"loadBatchLoader.js","names":[],"sources":["../../src/batchloaders/loadBatchLoader.ts"],"sourcesContent":["import { getInstanceData } from \"../BaseEntity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { type EntityMetadata } from \"../EntityMetadata.ts\";\nimport { buildHintTree } from \"../HintTree.ts\";\nimport { keyToNumber, tagId } from \"../keys.ts\";\nimport { type LoadHint } from \"../loadHints.ts\";\nimport { lazyExcludedSelects } from \"../queries/entityQueryUtils.ts\";\nimport { type ParsedFindQuery, addTablePerClassJoinsAndClassTag } from \"../queries/find/QueryParser.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const loadOperation = \"load\";\n\n/**\n * Batches em.load-style fetches, writing to identity map (via hydrate) instead of returning values.\n * After the batch resolves, callers retrieve their entity from `em.findExistingInstance`.\n *\n * Accepts tuples of `{ taggedId, hint }` so the preloader can inject join-based\n * preloading into the same SELECT that fetches the entities.\n */\nexport function loadBatchLoader(\n em: EntityManager,\n meta: EntityMetadata,\n overwriteExisting: boolean = false,\n): BatchLoader<{ taggedId: string; hint: LoadHint<any> | undefined }> {\n return em.getBatchLoader(loadOperation, `${meta.type}-${overwriteExisting}`, async (loads) => {\n const keys = loads.map((l) => keyToNumber(meta, l.taggedId));\n const alias = abbreviation(meta.tableName);\n const query = {\n selects: meta.hasLazyColumns ? lazyExcludedSelects(meta, alias) : [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [{ kind: \"column\", alias, column: \"id\", dbType: meta.idDbType, cond: { kind: \"in\", value: keys } }],\n },\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n } satisfies ParsedFindQuery;\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n // Inject preloading joins into the query if enabled\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator =\n preloader &&\n preloader.addPreloading(meta, buildHintTree(loads.map((l) => ({ entity: l.taggedId, hint: l.hint }))), query);\n const rowData = await em[\"executeFindRowData\"](meta, loadOperation, query, {});\n em[\"hydrateAndFinalize\"](meta.cstr, rowData, {\n overwriteExisting,\n sidecars: (entities) => {\n preloadHydrator && preloadHydrator(rowData, entities);\n // If we're missing any requested rows, mark any requested-but-not-found entities as deleted\n if (rowData.rowCount !== loads.length) {\n const foundIds = new Set<string>();\n for (let i = 0; i < rowData.rowCount; i++) foundIds.add(tagId(meta, rowData.get(i, \"id\")));\n for (const load of loads) {\n if (!foundIds.has(load.taggedId)) {\n const existingEntity = em.findExistingInstance(load.taggedId);\n if (existingEntity) {\n getInstanceData(existingEntity).markDeletedBecauseNotFound();\n }\n }\n }\n }\n },\n });\n });\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,gBAAgB;;;;;;;;AAS7B,SAAgB,gBACd,IACA,MACA,oBAA6B,OACuC;CACpE,OAAO,GAAG,eAAe,eAAe,GAAG,KAAK,KAAK,GAAG,qBAAqB,OAAO,UAAU;EAC5F,MAAM,OAAO,MAAM,KAAK,MAAM,YAAY,MAAM,EAAE,QAAQ,CAAC;EAC3D,MAAM,QAAQ,aAAa,KAAK,SAAS;EACzC,MAAM,QAAQ;GACZ,SAAS,KAAK,iBAAiB,oBAAoB,MAAM,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI;GACjF,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,CAAC;GAC1D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CAAC;KAAE,MAAM;KAAU;KAAO,QAAQ;KAAM,QAAQ,KAAK;KAAU,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAAE,CAAC;GAChH;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;EAClD;EACA,iCAAiC,OAAO,MAAM,OAAO,IAAI;EAEzD,MAAM,EAAE,cAAc,iBAAiB,EAAE;EACzC,MAAM,kBACJ,aACA,UAAU,cAAc,MAAM,cAAc,MAAM,KAAK,OAAO;GAAE,QAAQ,EAAE;GAAU,MAAM,EAAE;EAAK,EAAE,CAAC,GAAG,KAAK;EAC9G,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,MAAM,eAAe,OAAO,CAAC,CAAC;EAC7E,GAAG,qBAAqB,CAAC,KAAK,MAAM,SAAS;GAC3C;GACA,WAAW,aAAa;IACtB,mBAAmB,gBAAgB,SAAS,QAAQ;IAEpD,IAAI,QAAQ,aAAa,MAAM,QAAQ;KACrC,MAAM,2BAAW,IAAI,IAAY;KACjC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,UAAU,KAAK,SAAS,IAAI,MAAM,MAAM,QAAQ,IAAI,GAAG,IAAI,CAAC,CAAC;KACzF,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,SAAS,IAAI,KAAK,QAAQ,GAAG;MAChC,MAAM,iBAAiB,GAAG,qBAAqB,KAAK,QAAQ;MAC5D,IAAI,gBACF,gBAAgB,cAAc,CAAC,CAAC,2BAA2B;KAE/D;IAEJ;GACF;EACF,CAAC;CACH,CAAC;AACH"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./BatchLoader.cjs");
3
- const require_keys = require("../keys.cjs");
4
3
  const require_utils = require("../utils.cjs");
4
+ const require_keys = require("../keys.cjs");
5
5
  require("../index.cjs");
6
6
  const require_EntityManager = require("../EntityManager.cjs");
7
7
  require("../Entity.cjs");
@@ -1,6 +1,6 @@
1
1
  import "./BatchLoader.js";
2
- import { keyToNumber } from "../keys.js";
3
2
  import { abbreviation, getOrSet } from "../utils.js";
3
+ import { keyToNumber } from "../keys.js";
4
4
  import "../index.js";
5
5
  import { getEmInternalApi } from "../EntityManager.js";
6
6
  import "../Entity.js";
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./BatchLoader.cjs");
3
- const require_keys = require("../keys.cjs");
4
3
  const require_fields = require("../fields.cjs");
4
+ const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
5
5
  const require_utils = require("../utils.cjs");
6
+ const require_keys = require("../keys.cjs");
6
7
  require("../index.cjs");
7
8
  const require_EntityManager = require("../EntityManager.cjs");
8
9
  require("../Entity.cjs");
9
- const require_QueryParser = require("../QueryParser.cjs");
10
10
  //#region src/batchloaders/oneToManyBatchLoader.ts
11
11
  const oneToManyLoadOperation = "o2m-load";
12
12
  function oneToManyBatchLoader(em, collection) {
@@ -46,7 +46,7 @@ function oneToManyBatchLoader(em, collection) {
46
46
  order: "ASC"
47
47
  }]
48
48
  };
49
- require_QueryParser.addTablePerClassJoinsAndClassTag(query, meta, alias, true);
49
+ require_queries_find_QueryParser.addTablePerClassJoinsAndClassTag(query, meta, alias, true);
50
50
  const rowData = await em["executeFindRowData"](meta, oneToManyLoadOperation, query, {});
51
51
  const entities = em["hydrateAndFinalize"](meta.cstr, rowData);
52
52
  const entitiesById = require_utils.groupBy(entities, (entity) => {
@@ -1 +1 @@
1
- {"version":3,"file":"oneToManyBatchLoader.cjs","names":["deTagIds","abbreviation","groupBy","maybeResolveReferenceToId","getField","getEmInternalApi"],"sources":["../../src/batchloaders/oneToManyBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { getField } from \"../fields.ts\";\nimport {\n type OneToManyCollection,\n type OneToManyField,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n assertIdsAreTagged,\n deTagIds,\n maybeResolveReferenceToId,\n} from \"../index.ts\";\nimport { abbreviation, groupBy } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const oneToManyLoadOperation = \"o2m-load\";\n\nexport function oneToManyBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: OneToManyCollection<T, U>,\n): BatchLoader<string> {\n const { meta: oneMeta, fieldName } = collection;\n const batchKey = `${oneMeta.tableName}-${fieldName}`;\n return em.getBatchLoader(oneToManyLoadOperation, batchKey, async (_keys) => {\n const { otherMeta: meta } = collection;\n\n assertIdsAreTagged(_keys);\n const keys = deTagIds(oneMeta, _keys);\n\n const alias = abbreviation(meta.tableName);\n const o2m = oneMeta.allFields[collection.fieldName] as OneToManyField;\n const other = meta.allFields[collection.otherFieldName];\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [\n {\n kind: \"column\",\n alias: `${alias}${other.aliasSuffix}`,\n column: o2m.otherColumnName,\n dbType: meta.idDbType,\n cond: { kind: \"in\", value: keys },\n },\n ],\n },\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n };\n\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](meta, oneToManyLoadOperation, query, {});\n const entities = em[\"hydrateAndFinalize\"](meta.cstr, rowData);\n\n const entitiesById = groupBy(entities, (entity) => {\n const ownerId = maybeResolveReferenceToId(getField(entity, collection.otherFieldName));\n return ownerId ?? \"dummyNoLongerOwned\";\n });\n\n const api = getEmInternalApi(em);\n for (const key of _keys) {\n api.setPreloadedRelation(key, fieldName, entitiesById.get(key) || []);\n }\n });\n}\n"],"mappings":";;;;;;;;;;AAeA,MAAa,yBAAyB;AAEtC,SAAgB,qBACd,IACA,YACqB;CACrB,MAAM,EAAE,MAAM,SAAS,cAAc;CACrC,MAAM,WAAW,GAAG,QAAQ,UAAU,GAAG;CACzC,OAAO,GAAG,eAAe,wBAAwB,UAAU,OAAO,UAAU;EAC1E,MAAM,EAAE,WAAW,SAAS;EAE5B,aAAA,mBAAmB,KAAK;EACxB,MAAM,OAAOA,aAAAA,SAAS,SAAS,KAAK;EAEpC,MAAM,QAAQC,cAAAA,aAAa,KAAK,SAAS;EACzC,MAAM,MAAM,QAAQ,UAAU,WAAW;EACzC,MAAM,QAAQ,KAAK,UAAU,WAAW;EACxC,MAAM,QAAyB;GAC7B,SAAS,CAAC,IAAI,MAAM,IAAI;GACxB,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,CAAC;GAC1D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CACV;KACE,MAAM;KACN,OAAO,GAAG,QAAQ,MAAM;KACxB,QAAQ,IAAI;KACZ,QAAQ,KAAK;KACb,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAClC,CACF;GACF;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;EAClD;EAEA,oBAAA,iCAAiC,OAAO,MAAM,OAAO,IAAI;EAEzD,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,MAAM,wBAAwB,OAAO,CAAC,CAAC;EACtF,MAAM,WAAW,GAAG,qBAAqB,CAAC,KAAK,MAAM,OAAO;EAE5D,MAAM,eAAeC,cAAAA,QAAQ,WAAW,WAAW;GAEjD,OADgBC,aAAAA,0BAA0BC,eAAAA,SAAS,QAAQ,WAAW,cAAc,CACvE,KAAK;EACpB,CAAC;EAED,MAAM,MAAMC,sBAAAA,iBAAiB,EAAE;EAC/B,KAAK,MAAM,OAAO,OAChB,IAAI,qBAAqB,KAAK,WAAW,aAAa,IAAI,GAAG,KAAK,CAAC,CAAC;CAExE,CAAC;AACH"}
1
+ {"version":3,"file":"oneToManyBatchLoader.cjs","names":["deTagIds","abbreviation","groupBy","maybeResolveReferenceToId","getField","getEmInternalApi"],"sources":["../../src/batchloaders/oneToManyBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { getField } from \"../fields.ts\";\nimport {\n type OneToManyCollection,\n type OneToManyField,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n assertIdsAreTagged,\n deTagIds,\n maybeResolveReferenceToId,\n} from \"../index.ts\";\nimport { abbreviation, groupBy } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const oneToManyLoadOperation = \"o2m-load\";\n\nexport function oneToManyBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: OneToManyCollection<T, U>,\n): BatchLoader<string> {\n const { meta: oneMeta, fieldName } = collection;\n const batchKey = `${oneMeta.tableName}-${fieldName}`;\n return em.getBatchLoader(oneToManyLoadOperation, batchKey, async (_keys) => {\n const { otherMeta: meta } = collection;\n\n assertIdsAreTagged(_keys);\n const keys = deTagIds(oneMeta, _keys);\n\n const alias = abbreviation(meta.tableName);\n const o2m = oneMeta.allFields[collection.fieldName] as OneToManyField;\n const other = meta.allFields[collection.otherFieldName];\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [\n {\n kind: \"column\",\n alias: `${alias}${other.aliasSuffix}`,\n column: o2m.otherColumnName,\n dbType: meta.idDbType,\n cond: { kind: \"in\", value: keys },\n },\n ],\n },\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n };\n\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](meta, oneToManyLoadOperation, query, {});\n const entities = em[\"hydrateAndFinalize\"](meta.cstr, rowData);\n\n const entitiesById = groupBy(entities, (entity) => {\n const ownerId = maybeResolveReferenceToId(getField(entity, collection.otherFieldName));\n return ownerId ?? \"dummyNoLongerOwned\";\n });\n\n const api = getEmInternalApi(em);\n for (const key of _keys) {\n api.setPreloadedRelation(key, fieldName, entitiesById.get(key) || []);\n }\n });\n}\n"],"mappings":";;;;;;;;;;AAeA,MAAa,yBAAyB;AAEtC,SAAgB,qBACd,IACA,YACqB;CACrB,MAAM,EAAE,MAAM,SAAS,cAAc;CACrC,MAAM,WAAW,GAAG,QAAQ,UAAU,GAAG;CACzC,OAAO,GAAG,eAAe,wBAAwB,UAAU,OAAO,UAAU;EAC1E,MAAM,EAAE,WAAW,SAAS;EAE5B,aAAA,mBAAmB,KAAK;EACxB,MAAM,OAAOA,aAAAA,SAAS,SAAS,KAAK;EAEpC,MAAM,QAAQC,cAAAA,aAAa,KAAK,SAAS;EACzC,MAAM,MAAM,QAAQ,UAAU,WAAW;EACzC,MAAM,QAAQ,KAAK,UAAU,WAAW;EACxC,MAAM,QAAyB;GAC7B,SAAS,CAAC,IAAI,MAAM,IAAI;GACxB,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,CAAC;GAC1D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CACV;KACE,MAAM;KACN,OAAO,GAAG,QAAQ,MAAM;KACxB,QAAQ,IAAI;KACZ,QAAQ,KAAK;KACb,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAClC,CACF;GACF;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;EAClD;EAEA,iCAAA,iCAAiC,OAAO,MAAM,OAAO,IAAI;EAEzD,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,MAAM,wBAAwB,OAAO,CAAC,CAAC;EACtF,MAAM,WAAW,GAAG,qBAAqB,CAAC,KAAK,MAAM,OAAO;EAE5D,MAAM,eAAeC,cAAAA,QAAQ,WAAW,WAAW;GAEjD,OADgBC,aAAAA,0BAA0BC,eAAAA,SAAS,QAAQ,WAAW,cAAc,CACvE,KAAK;EACpB,CAAC;EAED,MAAM,MAAMC,sBAAAA,iBAAiB,EAAE;EAC/B,KAAK,MAAM,OAAO,OAChB,IAAI,qBAAqB,KAAK,WAAW,aAAa,IAAI,GAAG,KAAK,CAAC,CAAC;CAExE,CAAC;AACH"}
@@ -1,11 +1,11 @@
1
1
  import "./BatchLoader.js";
2
- import { assertIdsAreTagged, deTagIds, maybeResolveReferenceToId } from "../keys.js";
3
2
  import { getField } from "../fields.js";
3
+ import { addTablePerClassJoinsAndClassTag } from "../queries/find/QueryParser.js";
4
4
  import { abbreviation, groupBy } from "../utils.js";
5
+ import { assertIdsAreTagged, deTagIds, maybeResolveReferenceToId } from "../keys.js";
5
6
  import "../index.js";
6
7
  import { getEmInternalApi } from "../EntityManager.js";
7
8
  import "../Entity.js";
8
- import { addTablePerClassJoinsAndClassTag } from "../QueryParser.js";
9
9
  //#region src/batchloaders/oneToManyBatchLoader.ts
10
10
  const oneToManyLoadOperation = "o2m-load";
11
11
  function oneToManyBatchLoader(em, collection) {
@@ -1,14 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./BatchLoader.cjs");
3
+ const require_fields = require("../fields.cjs");
4
+ const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
3
5
  require("../relations/OneToOneReference.cjs");
6
+ const require_utils = require("../utils.cjs");
4
7
  const require_keys = require("../keys.cjs");
5
8
  const require_EntityMetadata = require("../EntityMetadata.cjs");
6
- const require_fields = require("../fields.cjs");
7
- const require_utils = require("../utils.cjs");
8
9
  require("../index.cjs");
9
10
  const require_EntityManager = require("../EntityManager.cjs");
10
11
  require("../Entity.cjs");
11
- const require_QueryParser = require("../QueryParser.cjs");
12
12
  //#region src/batchloaders/oneToOneBatchLoader.ts
13
13
  const oneToOneLoadOperation = "o2o-load";
14
14
  function oneToOneBatchLoader(em, reference) {
@@ -44,7 +44,7 @@ function oneToOneBatchLoader(em, reference) {
44
44
  },
45
45
  orderBys: []
46
46
  };
47
- require_QueryParser.addTablePerClassJoinsAndClassTag(query, otherMeta, alias, true);
47
+ require_queries_find_QueryParser.addTablePerClassJoinsAndClassTag(query, otherMeta, alias, true);
48
48
  const rowData = await em["executeFindRowData"](otherMeta, oneToOneLoadOperation, query, {});
49
49
  const entities = em["hydrateAndFinalize"](otherMeta.cstr, rowData);
50
50
  const entitiesByOtherId = require_utils.groupBy(entities, (entity) => {
@@ -1 +1 @@
1
- {"version":3,"file":"oneToOneBatchLoader.cjs","names":["getMetadata","deTagIds","abbreviation","groupBy","maybeResolveReferenceToId","getField","getEmInternalApi"],"sources":["../../src/batchloaders/oneToOneBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { type OneToOneField, getMetadata } from \"../EntityMetadata.ts\";\nimport { getField } from \"../fields.ts\";\nimport {\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n assertIdsAreTagged,\n deTagIds,\n maybeResolveReferenceToId,\n} from \"../index.ts\";\nimport { type OneToOneReferenceImpl } from \"../relations/OneToOneReference.ts\";\nimport { abbreviation, groupBy } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const oneToOneLoadOperation = \"o2o-load\";\n\nexport function oneToOneBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n reference: OneToOneReferenceImpl<T, U>,\n): BatchLoader<string> {\n const meta = getMetadata(reference.entity);\n const batchKey = `${meta.tableName}-${reference.fieldName}`;\n return em.getBatchLoader(oneToOneLoadOperation, batchKey, async (_keys) => {\n const { otherMeta, otherFieldName } = reference;\n\n assertIdsAreTagged(_keys);\n const keys = deTagIds(meta, _keys);\n\n const alias = abbreviation(otherMeta.tableName);\n const o2o = meta.allFields[reference.fieldName] as OneToOneField;\n const other = otherMeta.allFields[reference.otherFieldName];\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: otherMeta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [\n {\n kind: \"column\",\n alias: `${alias}${other.aliasSuffix}`,\n column: o2o.otherColumnName,\n dbType: meta.idDbType,\n cond: { kind: \"in\", value: keys },\n },\n ],\n },\n orderBys: [],\n };\n addTablePerClassJoinsAndClassTag(query, otherMeta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](otherMeta, oneToOneLoadOperation, query, {});\n const entities = em[\"hydrateAndFinalize\"](otherMeta.cstr, rowData);\n\n const entitiesByOtherId = groupBy(entities, (entity) => {\n const ownerId = maybeResolveReferenceToId(getField(entity, otherFieldName));\n return ownerId ?? \"dummyNoLongerOwned\";\n });\n\n const api = getEmInternalApi(em);\n for (const key of _keys) {\n const found = entitiesByOtherId.get(key);\n api.setPreloadedRelation(key, reference.fieldName as string, found ? [found[0]] : []);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,wBAAwB;AAErC,SAAgB,oBACd,IACA,WACqB;CACrB,MAAM,OAAOA,uBAAAA,YAAY,UAAU,MAAM;CACzC,MAAM,WAAW,GAAG,KAAK,UAAU,GAAG,UAAU;CAChD,OAAO,GAAG,eAAe,uBAAuB,UAAU,OAAO,UAAU;EACzE,MAAM,EAAE,WAAW,mBAAmB;EAEtC,aAAA,mBAAmB,KAAK;EACxB,MAAM,OAAOC,aAAAA,SAAS,MAAM,KAAK;EAEjC,MAAM,QAAQC,cAAAA,aAAa,UAAU,SAAS;EAC9C,MAAM,MAAM,KAAK,UAAU,UAAU;EACrC,MAAM,QAAQ,UAAU,UAAU,UAAU;EAC5C,MAAM,QAAyB;GAC7B,SAAS,CAAC,IAAI,MAAM,IAAI;GACxB,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,UAAU;GAAU,CAAC;GAC/D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CACV;KACE,MAAM;KACN,OAAO,GAAG,QAAQ,MAAM;KACxB,QAAQ,IAAI;KACZ,QAAQ,KAAK;KACb,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAClC,CACF;GACF;GACA,UAAU,CAAC;EACb;EACA,oBAAA,iCAAiC,OAAO,WAAW,OAAO,IAAI;EAE9D,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,WAAW,uBAAuB,OAAO,CAAC,CAAC;EAC1F,MAAM,WAAW,GAAG,qBAAqB,CAAC,UAAU,MAAM,OAAO;EAEjE,MAAM,oBAAoBC,cAAAA,QAAQ,WAAW,WAAW;GAEtD,OADgBC,aAAAA,0BAA0BC,eAAAA,SAAS,QAAQ,cAAc,CAC5D,KAAK;EACpB,CAAC;EAED,MAAM,MAAMC,sBAAAA,iBAAiB,EAAE;EAC/B,KAAK,MAAM,OAAO,OAAO;GACvB,MAAM,QAAQ,kBAAkB,IAAI,GAAG;GACvC,IAAI,qBAAqB,KAAK,UAAU,WAAqB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;EACtF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"oneToOneBatchLoader.cjs","names":["getMetadata","deTagIds","abbreviation","groupBy","maybeResolveReferenceToId","getField","getEmInternalApi"],"sources":["../../src/batchloaders/oneToOneBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport { type OneToOneField, getMetadata } from \"../EntityMetadata.ts\";\nimport { getField } from \"../fields.ts\";\nimport {\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n assertIdsAreTagged,\n deTagIds,\n maybeResolveReferenceToId,\n} from \"../index.ts\";\nimport { type OneToOneReferenceImpl } from \"../relations/OneToOneReference.ts\";\nimport { abbreviation, groupBy } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const oneToOneLoadOperation = \"o2o-load\";\n\nexport function oneToOneBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n reference: OneToOneReferenceImpl<T, U>,\n): BatchLoader<string> {\n const meta = getMetadata(reference.entity);\n const batchKey = `${meta.tableName}-${reference.fieldName}`;\n return em.getBatchLoader(oneToOneLoadOperation, batchKey, async (_keys) => {\n const { otherMeta, otherFieldName } = reference;\n\n assertIdsAreTagged(_keys);\n const keys = deTagIds(meta, _keys);\n\n const alias = abbreviation(otherMeta.tableName);\n const o2o = meta.allFields[reference.fieldName] as OneToOneField;\n const other = otherMeta.allFields[reference.otherFieldName];\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [{ alias, join: \"primary\", table: otherMeta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [\n {\n kind: \"column\",\n alias: `${alias}${other.aliasSuffix}`,\n column: o2o.otherColumnName,\n dbType: meta.idDbType,\n cond: { kind: \"in\", value: keys },\n },\n ],\n },\n orderBys: [],\n };\n addTablePerClassJoinsAndClassTag(query, otherMeta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](otherMeta, oneToOneLoadOperation, query, {});\n const entities = em[\"hydrateAndFinalize\"](otherMeta.cstr, rowData);\n\n const entitiesByOtherId = groupBy(entities, (entity) => {\n const ownerId = maybeResolveReferenceToId(getField(entity, otherFieldName));\n return ownerId ?? \"dummyNoLongerOwned\";\n });\n\n const api = getEmInternalApi(em);\n for (const key of _keys) {\n const found = entitiesByOtherId.get(key);\n api.setPreloadedRelation(key, reference.fieldName as string, found ? [found[0]] : []);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,wBAAwB;AAErC,SAAgB,oBACd,IACA,WACqB;CACrB,MAAM,OAAOA,uBAAAA,YAAY,UAAU,MAAM;CACzC,MAAM,WAAW,GAAG,KAAK,UAAU,GAAG,UAAU;CAChD,OAAO,GAAG,eAAe,uBAAuB,UAAU,OAAO,UAAU;EACzE,MAAM,EAAE,WAAW,mBAAmB;EAEtC,aAAA,mBAAmB,KAAK;EACxB,MAAM,OAAOC,aAAAA,SAAS,MAAM,KAAK;EAEjC,MAAM,QAAQC,cAAAA,aAAa,UAAU,SAAS;EAC9C,MAAM,MAAM,KAAK,UAAU,UAAU;EACrC,MAAM,QAAQ,UAAU,UAAU,UAAU;EAC5C,MAAM,QAAyB;GAC7B,SAAS,CAAC,IAAI,MAAM,IAAI;GACxB,QAAQ,CAAC;IAAE;IAAO,MAAM;IAAW,OAAO,UAAU;GAAU,CAAC;GAC/D,WAAW;IACT,MAAM;IACN,IAAI;IACJ,YAAY,CACV;KACE,MAAM;KACN,OAAO,GAAG,QAAQ,MAAM;KACxB,QAAQ,IAAI;KACZ,QAAQ,KAAK;KACb,MAAM;MAAE,MAAM;MAAM,OAAO;KAAK;IAClC,CACF;GACF;GACA,UAAU,CAAC;EACb;EACA,iCAAA,iCAAiC,OAAO,WAAW,OAAO,IAAI;EAE9D,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,WAAW,uBAAuB,OAAO,CAAC,CAAC;EAC1F,MAAM,WAAW,GAAG,qBAAqB,CAAC,UAAU,MAAM,OAAO;EAEjE,MAAM,oBAAoBC,cAAAA,QAAQ,WAAW,WAAW;GAEtD,OADgBC,aAAAA,0BAA0BC,eAAAA,SAAS,QAAQ,cAAc,CAC5D,KAAK;EACpB,CAAC;EAED,MAAM,MAAMC,sBAAAA,iBAAiB,EAAE;EAC/B,KAAK,MAAM,OAAO,OAAO;GACvB,MAAM,QAAQ,kBAAkB,IAAI,GAAG;GACvC,IAAI,qBAAqB,KAAK,UAAU,WAAqB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;EACtF;CACF,CAAC;AACH"}
@@ -1,13 +1,13 @@
1
1
  import "./BatchLoader.js";
2
+ import { getField } from "../fields.js";
3
+ import { addTablePerClassJoinsAndClassTag } from "../queries/find/QueryParser.js";
2
4
  import "../relations/OneToOneReference.js";
5
+ import { abbreviation, groupBy } from "../utils.js";
3
6
  import { assertIdsAreTagged, deTagIds, maybeResolveReferenceToId } from "../keys.js";
4
7
  import { getMetadata } from "../EntityMetadata.js";
5
- import { getField } from "../fields.js";
6
- import { abbreviation, groupBy } from "../utils.js";
7
8
  import "../index.js";
8
9
  import { getEmInternalApi } from "../EntityManager.js";
9
10
  import "../Entity.js";
10
- import { addTablePerClassJoinsAndClassTag } from "../QueryParser.js";
11
11
  //#region src/batchloaders/oneToOneBatchLoader.ts
12
12
  const oneToOneLoadOperation = "o2o-load";
13
13
  function oneToOneBatchLoader(em, reference) {