joist-core 2.4.0 → 2.5.0-next.10

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 (1095) hide show
  1. package/build/BaseEntity.cjs +9 -3
  2. package/build/BaseEntity.cjs.map +1 -1
  3. package/build/BaseEntity.d.cts +7 -8
  4. package/build/BaseEntity.d.cts.map +1 -1
  5. package/build/BaseEntity.d.mts +7 -8
  6. package/build/BaseEntity.d.mts.map +1 -1
  7. package/build/BaseEntity.js +9 -3
  8. package/build/BaseEntity.js.map +1 -1
  9. package/build/Entity.cjs +2 -3
  10. package/build/Entity.d.cts +3 -6
  11. package/build/Entity.d.cts.map +1 -1
  12. package/build/Entity.d.mts +3 -6
  13. package/build/Entity.d.mts.map +1 -1
  14. package/build/Entity.js +2 -3
  15. package/build/EntityFields.d.cts +3 -6
  16. package/build/EntityFields.d.cts.map +1 -1
  17. package/build/EntityFields.d.mts +3 -6
  18. package/build/EntityFields.d.mts.map +1 -1
  19. package/build/EntityManager.cjs +150 -68
  20. package/build/EntityManager.cjs.map +1 -1
  21. package/build/EntityManager.d.cts +126 -83
  22. package/build/EntityManager.d.cts.map +1 -1
  23. package/build/EntityManager.d.mts +126 -83
  24. package/build/EntityManager.d.mts.map +1 -1
  25. package/build/EntityManager.js +149 -69
  26. package/build/EntityManager.js.map +1 -1
  27. package/build/EntityMetadata.cjs +3 -5
  28. package/build/EntityMetadata.cjs.map +1 -1
  29. package/build/EntityMetadata.d.cts +54 -41
  30. package/build/EntityMetadata.d.cts.map +1 -1
  31. package/build/EntityMetadata.d.mts +54 -41
  32. package/build/EntityMetadata.d.mts.map +1 -1
  33. package/build/EntityMetadata.js +3 -5
  34. package/build/EntityMetadata.js.map +1 -1
  35. package/build/EnumMetadata.d.cts +1 -4
  36. package/build/EnumMetadata.d.cts.map +1 -1
  37. package/build/EnumMetadata.d.mts +1 -4
  38. package/build/EnumMetadata.d.mts.map +1 -1
  39. package/build/IndexManager.cjs +28 -9
  40. package/build/IndexManager.cjs.map +1 -1
  41. package/build/IndexManager.d.cts +3 -6
  42. package/build/IndexManager.d.cts.map +1 -1
  43. package/build/IndexManager.d.mts +3 -6
  44. package/build/IndexManager.d.mts.map +1 -1
  45. package/build/IndexManager.js +28 -9
  46. package/build/IndexManager.js.map +1 -1
  47. package/build/InstanceData.cjs +9 -5
  48. package/build/InstanceData.cjs.map +1 -1
  49. package/build/InstanceData.d.cts +9 -7
  50. package/build/InstanceData.d.cts.map +1 -1
  51. package/build/InstanceData.d.mts +9 -7
  52. package/build/InstanceData.d.mts.map +1 -1
  53. package/build/InstanceData.js +9 -5
  54. package/build/InstanceData.js.map +1 -1
  55. package/build/PluginManager.cjs +3 -4
  56. package/build/PluginManager.cjs.map +1 -1
  57. package/build/PluginManager.d.cts +11 -10
  58. package/build/PluginManager.d.cts.map +1 -1
  59. package/build/PluginManager.d.mts +11 -10
  60. package/build/PluginManager.d.mts.map +1 -1
  61. package/build/PluginManager.js +3 -4
  62. package/build/PluginManager.js.map +1 -1
  63. package/build/RowData.cjs +1 -2
  64. package/build/RowData.d.cts +3 -6
  65. package/build/RowData.d.cts.map +1 -1
  66. package/build/RowData.d.mts +3 -6
  67. package/build/RowData.d.mts.map +1 -1
  68. package/build/RowData.js +1 -2
  69. package/build/_virtual/_rolldown/runtime.cjs +1 -2
  70. package/build/batchloaders/BatchLoader.cjs +1 -2
  71. package/build/batchloaders/BatchLoader.cjs.map +1 -1
  72. package/build/batchloaders/BatchLoader.d.cts +1 -4
  73. package/build/batchloaders/BatchLoader.d.cts.map +1 -1
  74. package/build/batchloaders/BatchLoader.d.mts +1 -4
  75. package/build/batchloaders/BatchLoader.d.mts.map +1 -1
  76. package/build/batchloaders/BatchLoader.js +1 -2
  77. package/build/batchloaders/BatchLoader.js.map +1 -1
  78. package/build/batchloaders/enumCollectionBatchLoader.cjs +3 -4
  79. package/build/batchloaders/enumCollectionBatchLoader.d.cts +3 -6
  80. package/build/batchloaders/enumCollectionBatchLoader.d.cts.map +1 -1
  81. package/build/batchloaders/enumCollectionBatchLoader.d.mts +3 -6
  82. package/build/batchloaders/enumCollectionBatchLoader.d.mts.map +1 -1
  83. package/build/batchloaders/enumCollectionBatchLoader.js +3 -4
  84. package/build/batchloaders/loadBatchLoader.cjs +5 -6
  85. package/build/batchloaders/loadBatchLoader.d.cts +4 -7
  86. package/build/batchloaders/loadBatchLoader.d.cts.map +1 -1
  87. package/build/batchloaders/loadBatchLoader.d.mts +4 -7
  88. package/build/batchloaders/loadBatchLoader.d.mts.map +1 -1
  89. package/build/batchloaders/loadBatchLoader.js +5 -6
  90. package/build/batchloaders/manyToManyBatchLoader.cjs +4 -5
  91. package/build/batchloaders/manyToManyBatchLoader.d.cts +3 -6
  92. package/build/batchloaders/manyToManyBatchLoader.d.cts.map +1 -1
  93. package/build/batchloaders/manyToManyBatchLoader.d.mts +3 -6
  94. package/build/batchloaders/manyToManyBatchLoader.d.mts.map +1 -1
  95. package/build/batchloaders/manyToManyBatchLoader.js +4 -5
  96. package/build/batchloaders/oneToManyBatchLoader.cjs +5 -6
  97. package/build/batchloaders/oneToManyBatchLoader.d.cts +4 -7
  98. package/build/batchloaders/oneToManyBatchLoader.d.cts.map +1 -1
  99. package/build/batchloaders/oneToManyBatchLoader.d.mts +4 -7
  100. package/build/batchloaders/oneToManyBatchLoader.d.mts.map +1 -1
  101. package/build/batchloaders/oneToManyBatchLoader.js +5 -6
  102. package/build/batchloaders/oneToOneBatchLoader.cjs +6 -7
  103. package/build/batchloaders/oneToOneBatchLoader.d.cts +4 -7
  104. package/build/batchloaders/oneToOneBatchLoader.d.cts.map +1 -1
  105. package/build/batchloaders/oneToOneBatchLoader.d.mts +4 -7
  106. package/build/batchloaders/oneToOneBatchLoader.d.mts.map +1 -1
  107. package/build/batchloaders/oneToOneBatchLoader.js +6 -7
  108. package/build/batchloaders/populateBatchLoader.cjs +11 -12
  109. package/build/batchloaders/populateBatchLoader.d.cts +4 -7
  110. package/build/batchloaders/populateBatchLoader.d.cts.map +1 -1
  111. package/build/batchloaders/populateBatchLoader.d.mts +4 -7
  112. package/build/batchloaders/populateBatchLoader.d.mts.map +1 -1
  113. package/build/batchloaders/populateBatchLoader.js +11 -12
  114. package/build/batchloaders/recursiveChildrenBatchLoader.cjs +7 -8
  115. package/build/batchloaders/recursiveChildrenBatchLoader.d.cts +4 -7
  116. package/build/batchloaders/recursiveChildrenBatchLoader.d.cts.map +1 -1
  117. package/build/batchloaders/recursiveChildrenBatchLoader.d.mts +4 -7
  118. package/build/batchloaders/recursiveChildrenBatchLoader.d.mts.map +1 -1
  119. package/build/batchloaders/recursiveChildrenBatchLoader.js +7 -8
  120. package/build/batchloaders/recursiveM2mBatchLoader.cjs +5 -6
  121. package/build/batchloaders/recursiveM2mBatchLoader.d.cts +4 -7
  122. package/build/batchloaders/recursiveM2mBatchLoader.d.cts.map +1 -1
  123. package/build/batchloaders/recursiveM2mBatchLoader.d.mts +4 -7
  124. package/build/batchloaders/recursiveM2mBatchLoader.d.mts.map +1 -1
  125. package/build/batchloaders/recursiveM2mBatchLoader.js +5 -6
  126. package/build/batchloaders/recursiveParentsBatchLoader.cjs +7 -8
  127. package/build/batchloaders/recursiveParentsBatchLoader.d.cts +4 -7
  128. package/build/batchloaders/recursiveParentsBatchLoader.d.cts.map +1 -1
  129. package/build/batchloaders/recursiveParentsBatchLoader.d.mts +4 -7
  130. package/build/batchloaders/recursiveParentsBatchLoader.d.mts.map +1 -1
  131. package/build/batchloaders/recursiveParentsBatchLoader.js +7 -8
  132. package/build/changes.cjs +8 -9
  133. package/build/changes.cjs.map +1 -1
  134. package/build/changes.d.cts +12 -15
  135. package/build/changes.d.cts.map +1 -1
  136. package/build/changes.d.mts +12 -15
  137. package/build/changes.d.mts.map +1 -1
  138. package/build/changes.js +8 -9
  139. package/build/changes.js.map +1 -1
  140. package/build/config.cjs +171 -33
  141. package/build/config.cjs.map +1 -1
  142. package/build/config.d.cts +115 -25
  143. package/build/config.d.cts.map +1 -1
  144. package/build/config.d.mts +115 -25
  145. package/build/config.d.mts.map +1 -1
  146. package/build/config.js +171 -33
  147. package/build/config.js.map +1 -1
  148. package/build/configure.cjs +40 -11
  149. package/build/configure.cjs.map +1 -1
  150. package/build/configure.d.cts +11 -14
  151. package/build/configure.d.cts.map +1 -1
  152. package/build/configure.d.mts +11 -14
  153. package/build/configure.d.mts.map +1 -1
  154. package/build/configure.js +40 -11
  155. package/build/configure.js.map +1 -1
  156. package/build/dataloaders/buildCandidateBatchQuery.cjs +499 -0
  157. package/build/dataloaders/buildCandidateBatchQuery.cjs.map +1 -0
  158. package/build/dataloaders/buildCandidateBatchQuery.d.cts +57 -0
  159. package/build/dataloaders/buildCandidateBatchQuery.d.cts.map +1 -0
  160. package/build/dataloaders/buildCandidateBatchQuery.d.mts +57 -0
  161. package/build/dataloaders/buildCandidateBatchQuery.d.mts.map +1 -0
  162. package/build/dataloaders/buildCandidateBatchQuery.js +498 -0
  163. package/build/dataloaders/buildCandidateBatchQuery.js.map +1 -0
  164. package/build/dataloaders/collectFindArguments.cjs +48 -0
  165. package/build/dataloaders/collectFindArguments.cjs.map +1 -0
  166. package/build/dataloaders/collectFindArguments.d.cts +31 -0
  167. package/build/dataloaders/collectFindArguments.d.cts.map +1 -0
  168. package/build/dataloaders/collectFindArguments.d.mts +31 -0
  169. package/build/dataloaders/collectFindArguments.d.mts.map +1 -0
  170. package/build/dataloaders/collectFindArguments.js +47 -0
  171. package/build/dataloaders/collectFindArguments.js.map +1 -0
  172. package/build/dataloaders/fastWhereFilterHash.cjs +3 -4
  173. package/build/dataloaders/fastWhereFilterHash.d.cts +1 -4
  174. package/build/dataloaders/fastWhereFilterHash.d.cts.map +1 -1
  175. package/build/dataloaders/fastWhereFilterHash.d.mts +1 -4
  176. package/build/dataloaders/fastWhereFilterHash.d.mts.map +1 -1
  177. package/build/dataloaders/fastWhereFilterHash.js +3 -4
  178. package/build/dataloaders/findByUniqueDataLoader.cjs +2 -3
  179. package/build/dataloaders/findByUniqueDataLoader.d.cts +4 -7
  180. package/build/dataloaders/findByUniqueDataLoader.d.cts.map +1 -1
  181. package/build/dataloaders/findByUniqueDataLoader.d.mts +4 -7
  182. package/build/dataloaders/findByUniqueDataLoader.d.mts.map +1 -1
  183. package/build/dataloaders/findByUniqueDataLoader.js +2 -3
  184. package/build/dataloaders/findCountDataLoader.cjs +8 -9
  185. package/build/dataloaders/findCountDataLoader.d.cts +7 -10
  186. package/build/dataloaders/findCountDataLoader.d.cts.map +1 -1
  187. package/build/dataloaders/findCountDataLoader.d.mts +7 -10
  188. package/build/dataloaders/findCountDataLoader.d.mts.map +1 -1
  189. package/build/dataloaders/findCountDataLoader.js +8 -9
  190. package/build/dataloaders/findDataLoader.cjs +48 -77
  191. package/build/dataloaders/findDataLoader.cjs.map +1 -1
  192. package/build/dataloaders/findDataLoader.d.cts +16 -19
  193. package/build/dataloaders/findDataLoader.d.cts.map +1 -1
  194. package/build/dataloaders/findDataLoader.d.mts +16 -19
  195. package/build/dataloaders/findDataLoader.d.mts.map +1 -1
  196. package/build/dataloaders/findDataLoader.js +48 -77
  197. package/build/dataloaders/findDataLoader.js.map +1 -1
  198. package/build/dataloaders/findIdsDataLoader.cjs +6 -7
  199. package/build/dataloaders/findIdsDataLoader.d.cts +4 -7
  200. package/build/dataloaders/findIdsDataLoader.d.cts.map +1 -1
  201. package/build/dataloaders/findIdsDataLoader.d.mts +4 -7
  202. package/build/dataloaders/findIdsDataLoader.d.mts.map +1 -1
  203. package/build/dataloaders/findIdsDataLoader.js +6 -7
  204. package/build/dataloaders/findOrCreateDataLoader.cjs +12 -9
  205. package/build/dataloaders/findOrCreateDataLoader.cjs.map +1 -1
  206. package/build/dataloaders/findOrCreateDataLoader.d.cts +5 -7
  207. package/build/dataloaders/findOrCreateDataLoader.d.cts.map +1 -1
  208. package/build/dataloaders/findOrCreateDataLoader.d.mts +5 -7
  209. package/build/dataloaders/findOrCreateDataLoader.d.mts.map +1 -1
  210. package/build/dataloaders/findOrCreateDataLoader.js +12 -9
  211. package/build/dataloaders/findOrCreateDataLoader.js.map +1 -1
  212. package/build/dataloaders/findPaginatedDataLoader.cjs +16 -19
  213. package/build/dataloaders/findPaginatedDataLoader.cjs.map +1 -1
  214. package/build/dataloaders/findPaginatedDataLoader.d.cts +4 -7
  215. package/build/dataloaders/findPaginatedDataLoader.d.cts.map +1 -1
  216. package/build/dataloaders/findPaginatedDataLoader.d.mts +4 -7
  217. package/build/dataloaders/findPaginatedDataLoader.d.mts.map +1 -1
  218. package/build/dataloaders/findPaginatedDataLoader.js +16 -19
  219. package/build/dataloaders/findPaginatedDataLoader.js.map +1 -1
  220. package/build/dataloaders/lensDataLoader.cjs +5 -6
  221. package/build/dataloaders/lensDataLoader.d.cts +3 -6
  222. package/build/dataloaders/lensDataLoader.d.cts.map +1 -1
  223. package/build/dataloaders/lensDataLoader.d.mts +3 -6
  224. package/build/dataloaders/lensDataLoader.d.mts.map +1 -1
  225. package/build/dataloaders/lensDataLoader.js +5 -6
  226. package/build/dataloaders/manyToManyFindDataLoader.cjs +1 -2
  227. package/build/dataloaders/manyToManyFindDataLoader.d.cts +4 -7
  228. package/build/dataloaders/manyToManyFindDataLoader.d.cts.map +1 -1
  229. package/build/dataloaders/manyToManyFindDataLoader.d.mts +4 -7
  230. package/build/dataloaders/manyToManyFindDataLoader.d.mts.map +1 -1
  231. package/build/dataloaders/manyToManyFindDataLoader.js +1 -2
  232. package/build/dataloaders/oneToManyFindDataLoader.cjs +1 -2
  233. package/build/dataloaders/oneToManyFindDataLoader.d.cts +4 -7
  234. package/build/dataloaders/oneToManyFindDataLoader.d.cts.map +1 -1
  235. package/build/dataloaders/oneToManyFindDataLoader.d.mts +4 -7
  236. package/build/dataloaders/oneToManyFindDataLoader.d.mts.map +1 -1
  237. package/build/dataloaders/oneToManyFindDataLoader.js +1 -2
  238. package/build/defaults.cjs +7 -8
  239. package/build/defaults.cjs.map +1 -1
  240. package/build/defaults.d.cts +9 -11
  241. package/build/defaults.d.cts.map +1 -1
  242. package/build/defaults.d.mts +9 -11
  243. package/build/defaults.d.mts.map +1 -1
  244. package/build/defaults.js +7 -8
  245. package/build/defaults.js.map +1 -1
  246. package/build/drivers/Driver.cjs +1 -1
  247. package/build/drivers/Driver.d.cts +4 -7
  248. package/build/drivers/Driver.d.cts.map +1 -1
  249. package/build/drivers/Driver.d.mts +4 -7
  250. package/build/drivers/Driver.d.mts.map +1 -1
  251. package/build/drivers/Driver.js +1 -1
  252. package/build/drivers/EntityWriter.cjs +8 -8
  253. package/build/drivers/EntityWriter.cjs.map +1 -1
  254. package/build/drivers/EntityWriter.d.cts +20 -10
  255. package/build/drivers/EntityWriter.d.cts.map +1 -1
  256. package/build/drivers/EntityWriter.d.mts +20 -10
  257. package/build/drivers/EntityWriter.d.mts.map +1 -1
  258. package/build/drivers/EntityWriter.js +8 -8
  259. package/build/drivers/EntityWriter.js.map +1 -1
  260. package/build/drivers/IdAssigner.cjs +7 -4
  261. package/build/drivers/IdAssigner.cjs.map +1 -1
  262. package/build/drivers/IdAssigner.d.cts +6 -7
  263. package/build/drivers/IdAssigner.d.cts.map +1 -1
  264. package/build/drivers/IdAssigner.d.mts +6 -7
  265. package/build/drivers/IdAssigner.d.mts.map +1 -1
  266. package/build/drivers/IdAssigner.js +7 -4
  267. package/build/drivers/IdAssigner.js.map +1 -1
  268. package/build/drivers/driverApi.cjs +4 -5
  269. package/build/drivers/driverApi.d.cts +4 -7
  270. package/build/drivers/driverApi.d.cts.map +1 -1
  271. package/build/drivers/driverApi.d.mts +4 -7
  272. package/build/drivers/driverApi.d.mts.map +1 -1
  273. package/build/drivers/driverApi.js +4 -5
  274. package/build/drivers/index.d.cts +1 -1
  275. package/build/drivers/index.d.mts +1 -1
  276. package/build/fields.cjs +81 -23
  277. package/build/fields.cjs.map +1 -1
  278. package/build/fields.d.cts +12 -13
  279. package/build/fields.d.cts.map +1 -1
  280. package/build/fields.d.mts +12 -13
  281. package/build/fields.d.mts.map +1 -1
  282. package/build/fields.js +81 -23
  283. package/build/fields.js.map +1 -1
  284. package/build/flush/FlushLock.cjs +1 -2
  285. package/build/flush/FlushLock.cjs.map +1 -1
  286. package/build/flush/FlushLock.d.cts +1 -4
  287. package/build/flush/FlushLock.d.cts.map +1 -1
  288. package/build/flush/FlushLock.d.mts +1 -4
  289. package/build/flush/FlushLock.d.mts.map +1 -1
  290. package/build/flush/FlushLock.js +1 -2
  291. package/build/flush/FlushLock.js.map +1 -1
  292. package/build/flush/JoinRows.cjs +3 -4
  293. package/build/flush/JoinRows.cjs.map +1 -1
  294. package/build/flush/JoinRows.d.cts +7 -10
  295. package/build/flush/JoinRows.d.cts.map +1 -1
  296. package/build/flush/JoinRows.d.mts +7 -10
  297. package/build/flush/JoinRows.d.mts.map +1 -1
  298. package/build/flush/JoinRows.js +3 -4
  299. package/build/flush/JoinRows.js.map +1 -1
  300. package/build/flush/PendingChanges.d.cts +5 -8
  301. package/build/flush/PendingChanges.d.cts.map +1 -1
  302. package/build/flush/PendingChanges.d.mts +5 -8
  303. package/build/flush/PendingChanges.d.mts.map +1 -1
  304. package/build/flush/ReadDrift.cjs +89 -0
  305. package/build/flush/ReadDrift.cjs.map +1 -0
  306. package/build/flush/ReadDrift.d.cts +23 -0
  307. package/build/flush/ReadDrift.d.cts.map +1 -0
  308. package/build/flush/ReadDrift.d.mts +23 -0
  309. package/build/flush/ReadDrift.d.mts.map +1 -0
  310. package/build/flush/ReadDrift.js +86 -0
  311. package/build/flush/ReadDrift.js.map +1 -0
  312. package/build/flush/Todo.cjs +3 -4
  313. package/build/flush/Todo.d.cts +7 -10
  314. package/build/flush/Todo.d.cts.map +1 -1
  315. package/build/flush/Todo.d.mts +7 -10
  316. package/build/flush/Todo.d.mts.map +1 -1
  317. package/build/flush/Todo.js +3 -4
  318. package/build/getProperties.cjs +4 -5
  319. package/build/getProperties.d.cts +3 -6
  320. package/build/getProperties.d.cts.map +1 -1
  321. package/build/getProperties.d.mts +3 -6
  322. package/build/getProperties.d.mts.map +1 -1
  323. package/build/getProperties.js +4 -5
  324. package/build/index.cjs +71 -57
  325. package/build/index.cjs.map +1 -1
  326. package/build/index.d.cts +68 -66
  327. package/build/index.d.cts.map +1 -1
  328. package/build/index.d.mts +68 -66
  329. package/build/index.d.mts.map +1 -1
  330. package/build/index.js +66 -58
  331. package/build/index.js.map +1 -1
  332. package/build/json.cjs +8 -9
  333. package/build/json.d.cts +13 -15
  334. package/build/json.d.cts.map +1 -1
  335. package/build/json.d.mts +13 -15
  336. package/build/json.d.mts.map +1 -1
  337. package/build/json.js +8 -9
  338. package/build/k.cjs +1 -2
  339. package/build/k.js +1 -2
  340. package/build/keys.cjs +5 -6
  341. package/build/keys.d.cts +30 -32
  342. package/build/keys.d.cts.map +1 -1
  343. package/build/keys.d.mts +30 -32
  344. package/build/keys.d.mts.map +1 -1
  345. package/build/keys.js +5 -6
  346. package/build/loading/HintTree.cjs +1 -2
  347. package/build/loading/HintTree.d.cts +5 -8
  348. package/build/loading/HintTree.d.cts.map +1 -1
  349. package/build/loading/HintTree.d.mts +5 -8
  350. package/build/loading/HintTree.d.mts.map +1 -1
  351. package/build/loading/HintTree.js +1 -2
  352. package/build/loading/IsLoadedCache.cjs +3 -4
  353. package/build/loading/IsLoadedCache.cjs.map +1 -1
  354. package/build/loading/IsLoadedCache.d.cts +3 -6
  355. package/build/loading/IsLoadedCache.d.cts.map +1 -1
  356. package/build/loading/IsLoadedCache.d.mts +3 -6
  357. package/build/loading/IsLoadedCache.d.mts.map +1 -1
  358. package/build/loading/IsLoadedCache.js +3 -4
  359. package/build/loading/IsLoadedCache.js.map +1 -1
  360. package/build/loading/loadHints.cjs +1 -2
  361. package/build/loading/loadHints.d.cts +21 -23
  362. package/build/loading/loadHints.d.cts.map +1 -1
  363. package/build/loading/loadHints.d.mts +21 -23
  364. package/build/loading/loadHints.d.mts.map +1 -1
  365. package/build/loading/loadHints.js +1 -2
  366. package/build/loading/loadLens.cjs +6 -7
  367. package/build/loading/loadLens.d.cts +15 -17
  368. package/build/loading/loadLens.d.cts.map +1 -1
  369. package/build/loading/loadLens.d.mts +15 -17
  370. package/build/loading/loadLens.d.mts.map +1 -1
  371. package/build/loading/loadLens.js +6 -7
  372. package/build/loading/withLoaded.cjs +1 -2
  373. package/build/loading/withLoaded.d.cts +7 -10
  374. package/build/loading/withLoaded.d.cts.map +1 -1
  375. package/build/loading/withLoaded.d.mts +7 -10
  376. package/build/loading/withLoaded.d.mts.map +1 -1
  377. package/build/loading/withLoaded.js +1 -2
  378. package/build/logging/FactoryLogger.cjs +3 -4
  379. package/build/logging/FactoryLogger.cjs.map +1 -1
  380. package/build/logging/FactoryLogger.d.cts +4 -7
  381. package/build/logging/FactoryLogger.d.cts.map +1 -1
  382. package/build/logging/FactoryLogger.d.mts +4 -7
  383. package/build/logging/FactoryLogger.d.mts.map +1 -1
  384. package/build/logging/FactoryLogger.js +4 -5
  385. package/build/logging/FactoryLogger.js.map +1 -1
  386. package/build/logging/FieldLogger.cjs +1 -2
  387. package/build/logging/FieldLogger.cjs.map +1 -1
  388. package/build/logging/FieldLogger.d.cts +4 -7
  389. package/build/logging/FieldLogger.d.cts.map +1 -1
  390. package/build/logging/FieldLogger.d.mts +4 -7
  391. package/build/logging/FieldLogger.d.mts.map +1 -1
  392. package/build/logging/FieldLogger.js +1 -2
  393. package/build/logging/FieldLogger.js.map +1 -1
  394. package/build/logging/ReactionLogger.cjs +3 -4
  395. package/build/logging/ReactionLogger.d.cts +10 -12
  396. package/build/logging/ReactionLogger.d.cts.map +1 -1
  397. package/build/logging/ReactionLogger.d.mts +10 -12
  398. package/build/logging/ReactionLogger.d.mts.map +1 -1
  399. package/build/logging/ReactionLogger.js +3 -4
  400. package/build/metrics/EntityMetrics.cjs +80 -0
  401. package/build/metrics/EntityMetrics.cjs.map +1 -0
  402. package/build/metrics/EntityMetrics.d.cts +53 -0
  403. package/build/metrics/EntityMetrics.d.cts.map +1 -0
  404. package/build/metrics/EntityMetrics.d.mts +53 -0
  405. package/build/metrics/EntityMetrics.d.mts.map +1 -0
  406. package/build/metrics/EntityMetrics.js +78 -0
  407. package/build/metrics/EntityMetrics.js.map +1 -0
  408. package/build/newEntity.cjs +6 -7
  409. package/build/newEntity.cjs.map +1 -1
  410. package/build/newEntity.d.cts +6 -9
  411. package/build/newEntity.d.cts.map +1 -1
  412. package/build/newEntity.d.mts +6 -9
  413. package/build/newEntity.d.mts.map +1 -1
  414. package/build/newEntity.js +6 -7
  415. package/build/newEntity.js.map +1 -1
  416. package/build/newTestInstance.cjs +10 -10
  417. package/build/newTestInstance.cjs.map +1 -1
  418. package/build/newTestInstance.d.cts +24 -26
  419. package/build/newTestInstance.d.cts.map +1 -1
  420. package/build/newTestInstance.d.mts +24 -26
  421. package/build/newTestInstance.d.mts.map +1 -1
  422. package/build/newTestInstance.js +10 -10
  423. package/build/newTestInstance.js.map +1 -1
  424. package/build/normalizeHints.cjs +1 -2
  425. package/build/normalizeHints.d.cts +8 -11
  426. package/build/normalizeHints.d.cts.map +1 -1
  427. package/build/normalizeHints.d.mts +8 -11
  428. package/build/normalizeHints.d.mts.map +1 -1
  429. package/build/normalizeHints.js +1 -2
  430. package/build/nowUTC.cjs +1 -2
  431. package/build/nowUTC.d.cts +4 -7
  432. package/build/nowUTC.d.cts.map +1 -1
  433. package/build/nowUTC.d.mts +4 -7
  434. package/build/nowUTC.d.mts.map +1 -1
  435. package/build/nowUTC.js +1 -2
  436. package/build/plugins/ImmutableEntitiesPlugin.cjs +3 -4
  437. package/build/plugins/ImmutableEntitiesPlugin.d.cts +2 -5
  438. package/build/plugins/ImmutableEntitiesPlugin.d.cts.map +1 -1
  439. package/build/plugins/ImmutableEntitiesPlugin.d.mts +2 -5
  440. package/build/plugins/ImmutableEntitiesPlugin.d.mts.map +1 -1
  441. package/build/plugins/ImmutableEntitiesPlugin.js +3 -4
  442. package/build/plugins/PreloadPlugin.cjs +1 -1
  443. package/build/plugins/PreloadPlugin.d.cts +7 -10
  444. package/build/plugins/PreloadPlugin.d.cts.map +1 -1
  445. package/build/plugins/PreloadPlugin.d.mts +7 -10
  446. package/build/plugins/PreloadPlugin.d.mts.map +1 -1
  447. package/build/plugins/PreloadPlugin.js +1 -1
  448. package/build/preloading/JsonAggregatePreloader.cjs +9 -10
  449. package/build/preloading/JsonAggregatePreloader.d.cts +4 -7
  450. package/build/preloading/JsonAggregatePreloader.d.cts.map +1 -1
  451. package/build/preloading/JsonAggregatePreloader.d.mts +4 -7
  452. package/build/preloading/JsonAggregatePreloader.d.mts.map +1 -1
  453. package/build/preloading/JsonAggregatePreloader.js +9 -10
  454. package/build/preloading/canPreload.cjs +1 -2
  455. package/build/preloading/canPreload.d.cts +1 -4
  456. package/build/preloading/canPreload.d.cts.map +1 -1
  457. package/build/preloading/canPreload.d.mts +1 -4
  458. package/build/preloading/canPreload.d.mts.map +1 -1
  459. package/build/preloading/canPreload.js +1 -2
  460. package/build/preloading/partitionHint.cjs +5 -6
  461. package/build/preloading/partitionHint.d.cts +2 -5
  462. package/build/preloading/partitionHint.d.cts.map +1 -1
  463. package/build/preloading/partitionHint.d.mts +2 -5
  464. package/build/preloading/partitionHint.d.mts.map +1 -1
  465. package/build/preloading/partitionHint.js +5 -6
  466. package/build/queries/ConditionBuilder.cjs +2 -3
  467. package/build/queries/ConditionBuilder.d.cts +3 -5
  468. package/build/queries/ConditionBuilder.d.cts.map +1 -1
  469. package/build/queries/ConditionBuilder.d.mts +3 -5
  470. package/build/queries/ConditionBuilder.d.mts.map +1 -1
  471. package/build/queries/ConditionBuilder.js +2 -3
  472. package/build/queries/conditions.cjs +1 -2
  473. package/build/queries/conditions.d.cts +11 -14
  474. package/build/queries/conditions.d.cts.map +1 -1
  475. package/build/queries/conditions.d.mts +11 -14
  476. package/build/queries/conditions.d.mts.map +1 -1
  477. package/build/queries/conditions.js +1 -2
  478. package/build/queries/entityQueryUtils.cjs +2 -3
  479. package/build/queries/entityQueryUtils.d.cts +5 -8
  480. package/build/queries/entityQueryUtils.d.cts.map +1 -1
  481. package/build/queries/entityQueryUtils.d.mts +5 -8
  482. package/build/queries/entityQueryUtils.d.mts.map +1 -1
  483. package/build/queries/entityQueryUtils.js +2 -3
  484. package/build/queries/find/Aliases.cjs +4 -5
  485. package/build/queries/find/Aliases.d.cts +21 -23
  486. package/build/queries/find/Aliases.d.cts.map +1 -1
  487. package/build/queries/find/Aliases.d.mts +21 -23
  488. package/build/queries/find/Aliases.d.mts.map +1 -1
  489. package/build/queries/find/Aliases.js +4 -5
  490. package/build/queries/find/DeferredAlias.cjs +1 -2
  491. package/build/queries/find/DeferredAlias.d.cts +7 -10
  492. package/build/queries/find/DeferredAlias.d.cts.map +1 -1
  493. package/build/queries/find/DeferredAlias.d.mts +7 -10
  494. package/build/queries/find/DeferredAlias.d.mts.map +1 -1
  495. package/build/queries/find/DeferredAlias.js +1 -2
  496. package/build/queries/find/EntityFilter.cjs +1 -2
  497. package/build/queries/find/EntityFilter.d.cts +15 -18
  498. package/build/queries/find/EntityFilter.d.cts.map +1 -1
  499. package/build/queries/find/EntityFilter.d.mts +15 -18
  500. package/build/queries/find/EntityFilter.d.mts.map +1 -1
  501. package/build/queries/find/EntityFilter.js +1 -2
  502. package/build/queries/find/EntityGraphQLFilter.cjs +1 -2
  503. package/build/queries/find/EntityGraphQLFilter.d.cts +10 -13
  504. package/build/queries/find/EntityGraphQLFilter.d.cts.map +1 -1
  505. package/build/queries/find/EntityGraphQLFilter.d.mts +10 -13
  506. package/build/queries/find/EntityGraphQLFilter.d.mts.map +1 -1
  507. package/build/queries/find/EntityGraphQLFilter.js +1 -2
  508. package/build/queries/find/QueryParser.cjs +27 -17
  509. package/build/queries/find/QueryParser.cjs.map +1 -1
  510. package/build/queries/find/QueryParser.collectionJoins.cjs +3 -3
  511. package/build/queries/find/QueryParser.collectionJoins.cjs.map +1 -1
  512. package/build/queries/find/QueryParser.collectionJoins.d.cts +1 -4
  513. package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -1
  514. package/build/queries/find/QueryParser.collectionJoins.d.mts +1 -4
  515. package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -1
  516. package/build/queries/find/QueryParser.collectionJoins.js +3 -3
  517. package/build/queries/find/QueryParser.collectionJoins.js.map +1 -1
  518. package/build/queries/find/QueryParser.d.cts +43 -22
  519. package/build/queries/find/QueryParser.d.cts.map +1 -1
  520. package/build/queries/find/QueryParser.d.mts +43 -22
  521. package/build/queries/find/QueryParser.d.mts.map +1 -1
  522. package/build/queries/find/QueryParser.js +27 -17
  523. package/build/queries/find/QueryParser.js.map +1 -1
  524. package/build/queries/find/QueryParser.pruning.cjs +52 -4
  525. package/build/queries/find/QueryParser.pruning.cjs.map +1 -1
  526. package/build/queries/find/QueryParser.pruning.d.cts +15 -5
  527. package/build/queries/find/QueryParser.pruning.d.cts.map +1 -1
  528. package/build/queries/find/QueryParser.pruning.d.mts +15 -5
  529. package/build/queries/find/QueryParser.pruning.d.mts.map +1 -1
  530. package/build/queries/find/QueryParser.pruning.js +52 -4
  531. package/build/queries/find/QueryParser.pruning.js.map +1 -1
  532. package/build/queries/find/QueryVisitor.cjs +1 -2
  533. package/build/queries/find/QueryVisitor.d.cts +4 -6
  534. package/build/queries/find/QueryVisitor.d.cts.map +1 -1
  535. package/build/queries/find/QueryVisitor.d.mts +4 -6
  536. package/build/queries/find/QueryVisitor.d.mts.map +1 -1
  537. package/build/queries/find/QueryVisitor.js +1 -2
  538. package/build/queries/find/buildFindQuery.cjs +5 -6
  539. package/build/queries/find/buildFindQuery.cjs.map +1 -1
  540. package/build/queries/find/buildFindQuery.d.cts +3 -5
  541. package/build/queries/find/buildFindQuery.d.cts.map +1 -1
  542. package/build/queries/find/buildFindQuery.d.mts +3 -5
  543. package/build/queries/find/buildFindQuery.d.mts.map +1 -1
  544. package/build/queries/find/buildFindQuery.js +5 -6
  545. package/build/queries/find/buildFindQuery.js.map +1 -1
  546. package/build/queries/find/scopes.cjs +1 -2
  547. package/build/queries/find/scopes.cjs.map +1 -1
  548. package/build/queries/find/scopes.d.cts +17 -20
  549. package/build/queries/find/scopes.d.cts.map +1 -1
  550. package/build/queries/find/scopes.d.mts +17 -20
  551. package/build/queries/find/scopes.d.mts.map +1 -1
  552. package/build/queries/find/scopes.js +1 -2
  553. package/build/queries/find/scopes.js.map +1 -1
  554. package/build/queries/parsedConditions.cjs +1 -2
  555. package/build/queries/parsedConditions.d.cts +7 -10
  556. package/build/queries/parsedConditions.d.cts.map +1 -1
  557. package/build/queries/parsedConditions.d.mts +7 -10
  558. package/build/queries/parsedConditions.d.mts.map +1 -1
  559. package/build/queries/parsedConditions.js +1 -2
  560. package/build/queries/renderConditions.cjs +3 -4
  561. package/build/queries/renderConditions.d.cts +3 -6
  562. package/build/queries/renderConditions.d.cts.map +1 -1
  563. package/build/queries/renderConditions.d.mts +3 -6
  564. package/build/queries/renderConditions.d.mts.map +1 -1
  565. package/build/queries/renderConditions.js +3 -4
  566. package/build/queries/skipCondition.cjs +1 -2
  567. package/build/queries/skipCondition.d.cts +1 -4
  568. package/build/queries/skipCondition.d.cts.map +1 -1
  569. package/build/queries/skipCondition.d.mts +1 -4
  570. package/build/queries/skipCondition.d.mts.map +1 -1
  571. package/build/queries/skipCondition.js +1 -2
  572. package/build/queries/sql/AliasAssigner.cjs +1 -2
  573. package/build/queries/sql/AliasAssigner.cjs.map +1 -1
  574. package/build/queries/sql/AliasAssigner.d.cts +1 -4
  575. package/build/queries/sql/AliasAssigner.d.cts.map +1 -1
  576. package/build/queries/sql/AliasAssigner.d.mts +1 -4
  577. package/build/queries/sql/AliasAssigner.d.mts.map +1 -1
  578. package/build/queries/sql/AliasAssigner.js +1 -2
  579. package/build/queries/sql/AliasAssigner.js.map +1 -1
  580. package/build/queries/sql/Expr.cjs +41 -4
  581. package/build/queries/sql/Expr.cjs.map +1 -1
  582. package/build/queries/sql/Expr.d.cts +47 -31
  583. package/build/queries/sql/Expr.d.cts.map +1 -1
  584. package/build/queries/sql/Expr.d.mts +47 -31
  585. package/build/queries/sql/Expr.d.mts.map +1 -1
  586. package/build/queries/sql/Expr.js +41 -5
  587. package/build/queries/sql/Expr.js.map +1 -1
  588. package/build/queries/sql/JoinTree.cjs +3 -4
  589. package/build/queries/sql/JoinTree.d.cts +10 -12
  590. package/build/queries/sql/JoinTree.d.cts.map +1 -1
  591. package/build/queries/sql/JoinTree.d.mts +10 -12
  592. package/build/queries/sql/JoinTree.d.mts.map +1 -1
  593. package/build/queries/sql/JoinTree.js +3 -4
  594. package/build/queries/sql/Tables.cjs +17 -9
  595. package/build/queries/sql/Tables.cjs.map +1 -1
  596. package/build/queries/sql/Tables.d.cts +51 -46
  597. package/build/queries/sql/Tables.d.cts.map +1 -1
  598. package/build/queries/sql/Tables.d.mts +51 -46
  599. package/build/queries/sql/Tables.d.mts.map +1 -1
  600. package/build/queries/sql/Tables.js +17 -9
  601. package/build/queries/sql/Tables.js.map +1 -1
  602. package/build/queries/sql/custom.cjs +1 -2
  603. package/build/queries/sql/custom.d.cts +16 -18
  604. package/build/queries/sql/custom.d.cts.map +1 -1
  605. package/build/queries/sql/custom.d.mts +16 -18
  606. package/build/queries/sql/custom.d.mts.map +1 -1
  607. package/build/queries/sql/custom.js +1 -2
  608. package/build/queries/sql/execute.cjs +74 -96
  609. package/build/queries/sql/execute.cjs.map +1 -1
  610. package/build/queries/sql/execute.d.cts +54 -39
  611. package/build/queries/sql/execute.d.cts.map +1 -1
  612. package/build/queries/sql/execute.d.mts +54 -39
  613. package/build/queries/sql/execute.d.mts.map +1 -1
  614. package/build/queries/sql/execute.js +75 -97
  615. package/build/queries/sql/execute.js.map +1 -1
  616. package/build/queries/sql/expressions/arrayAgg.cjs +2 -3
  617. package/build/queries/sql/expressions/arrayAgg.d.cts +6 -9
  618. package/build/queries/sql/expressions/arrayAgg.d.cts.map +1 -1
  619. package/build/queries/sql/expressions/arrayAgg.d.mts +6 -9
  620. package/build/queries/sql/expressions/arrayAgg.d.mts.map +1 -1
  621. package/build/queries/sql/expressions/arrayAgg.js +2 -3
  622. package/build/queries/sql/expressions/case.cjs +2 -3
  623. package/build/queries/sql/expressions/case.d.cts +11 -13
  624. package/build/queries/sql/expressions/case.d.cts.map +1 -1
  625. package/build/queries/sql/expressions/case.d.mts +11 -13
  626. package/build/queries/sql/expressions/case.d.mts.map +1 -1
  627. package/build/queries/sql/expressions/case.js +2 -3
  628. package/build/queries/sql/expressions/coalesce.cjs +2 -3
  629. package/build/queries/sql/expressions/coalesce.d.cts +6 -9
  630. package/build/queries/sql/expressions/coalesce.d.cts.map +1 -1
  631. package/build/queries/sql/expressions/coalesce.d.mts +6 -9
  632. package/build/queries/sql/expressions/coalesce.d.mts.map +1 -1
  633. package/build/queries/sql/expressions/coalesce.js +2 -3
  634. package/build/queries/sql/expressions/codecs.cjs +2 -3
  635. package/build/queries/sql/expressions/codecs.d.cts +1 -4
  636. package/build/queries/sql/expressions/codecs.d.cts.map +1 -1
  637. package/build/queries/sql/expressions/codecs.d.mts +1 -4
  638. package/build/queries/sql/expressions/codecs.d.mts.map +1 -1
  639. package/build/queries/sql/expressions/codecs.js +2 -3
  640. package/build/queries/sql/expressions/expression.cjs +4 -5
  641. package/build/queries/sql/expressions/expression.d.cts +8 -10
  642. package/build/queries/sql/expressions/expression.d.cts.map +1 -1
  643. package/build/queries/sql/expressions/expression.d.mts +8 -10
  644. package/build/queries/sql/expressions/expression.d.mts.map +1 -1
  645. package/build/queries/sql/expressions/expression.js +4 -5
  646. package/build/queries/sql/expressions/greatest.cjs +2 -3
  647. package/build/queries/sql/expressions/greatest.d.cts +6 -9
  648. package/build/queries/sql/expressions/greatest.d.cts.map +1 -1
  649. package/build/queries/sql/expressions/greatest.d.mts +6 -9
  650. package/build/queries/sql/expressions/greatest.d.mts.map +1 -1
  651. package/build/queries/sql/expressions/greatest.js +2 -3
  652. package/build/queries/sql/expressions/least.cjs +2 -3
  653. package/build/queries/sql/expressions/least.d.cts +6 -9
  654. package/build/queries/sql/expressions/least.d.cts.map +1 -1
  655. package/build/queries/sql/expressions/least.d.mts +6 -9
  656. package/build/queries/sql/expressions/least.d.mts.map +1 -1
  657. package/build/queries/sql/expressions/least.js +2 -3
  658. package/build/queries/sql/expressions/nullIf.cjs +2 -3
  659. package/build/queries/sql/expressions/nullIf.d.cts +6 -9
  660. package/build/queries/sql/expressions/nullIf.d.cts.map +1 -1
  661. package/build/queries/sql/expressions/nullIf.d.mts +6 -9
  662. package/build/queries/sql/expressions/nullIf.d.mts.map +1 -1
  663. package/build/queries/sql/expressions/nullIf.js +2 -3
  664. package/build/queries/sql/expressions/parseExpression.cjs +3 -4
  665. package/build/queries/sql/expressions/parseExpression.d.cts +5 -8
  666. package/build/queries/sql/expressions/parseExpression.d.cts.map +1 -1
  667. package/build/queries/sql/expressions/parseExpression.d.mts +5 -8
  668. package/build/queries/sql/expressions/parseExpression.d.mts.map +1 -1
  669. package/build/queries/sql/expressions/parseExpression.js +3 -4
  670. package/build/queries/sql/expressions/types.d.cts +12 -14
  671. package/build/queries/sql/expressions/types.d.cts.map +1 -1
  672. package/build/queries/sql/expressions/types.d.mts +12 -14
  673. package/build/queries/sql/expressions/types.d.mts.map +1 -1
  674. package/build/queries/sql/keywords.cjs +1 -2
  675. package/build/queries/sql/keywords.d.cts +4 -7
  676. package/build/queries/sql/keywords.d.cts.map +1 -1
  677. package/build/queries/sql/keywords.d.mts +4 -7
  678. package/build/queries/sql/keywords.d.mts.map +1 -1
  679. package/build/queries/sql/keywords.js +1 -2
  680. package/build/queries/sql/query.cjs +86 -40
  681. package/build/queries/sql/query.cjs.map +1 -1
  682. package/build/queries/sql/query.d.cts +125 -84
  683. package/build/queries/sql/query.d.cts.map +1 -1
  684. package/build/queries/sql/query.d.mts +125 -84
  685. package/build/queries/sql/query.d.mts.map +1 -1
  686. package/build/queries/sql/query.js +84 -40
  687. package/build/queries/sql/query.js.map +1 -1
  688. package/build/queries/unnest.cjs +5 -7
  689. package/build/queries/unnest.cjs.map +1 -1
  690. package/build/queries/unnest.d.cts +3 -6
  691. package/build/queries/unnest.d.cts.map +1 -1
  692. package/build/queries/unnest.d.mts +3 -6
  693. package/build/queries/unnest.d.mts.map +1 -1
  694. package/build/queries/unnest.js +5 -7
  695. package/build/queries/unnest.js.map +1 -1
  696. package/build/queries/valueFilters.cjs +3 -4
  697. package/build/queries/valueFilters.d.cts +7 -10
  698. package/build/queries/valueFilters.d.cts.map +1 -1
  699. package/build/queries/valueFilters.d.mts +7 -10
  700. package/build/queries/valueFilters.d.mts.map +1 -1
  701. package/build/queries/valueFilters.js +3 -4
  702. package/build/reactivity/ReactionsManager.cjs +176 -8
  703. package/build/reactivity/ReactionsManager.cjs.map +1 -1
  704. package/build/reactivity/ReactionsManager.d.cts +58 -8
  705. package/build/reactivity/ReactionsManager.d.cts.map +1 -1
  706. package/build/reactivity/ReactionsManager.d.mts +58 -8
  707. package/build/reactivity/ReactionsManager.d.mts.map +1 -1
  708. package/build/reactivity/ReactionsManager.js +176 -8
  709. package/build/reactivity/ReactionsManager.js.map +1 -1
  710. package/build/reactivity/reactiveHints.cjs +16 -11
  711. package/build/reactivity/reactiveHints.cjs.map +1 -1
  712. package/build/reactivity/reactiveHints.d.cts +26 -27
  713. package/build/reactivity/reactiveHints.d.cts.map +1 -1
  714. package/build/reactivity/reactiveHints.d.mts +26 -27
  715. package/build/reactivity/reactiveHints.d.mts.map +1 -1
  716. package/build/reactivity/reactiveHints.js +16 -11
  717. package/build/reactivity/reactiveHints.js.map +1 -1
  718. package/build/relations/AbstractPropertyImpl.cjs +1 -2
  719. package/build/relations/AbstractPropertyImpl.cjs.map +1 -1
  720. package/build/relations/AbstractPropertyImpl.d.cts +1 -4
  721. package/build/relations/AbstractPropertyImpl.d.cts.map +1 -1
  722. package/build/relations/AbstractPropertyImpl.d.mts +1 -4
  723. package/build/relations/AbstractPropertyImpl.d.mts.map +1 -1
  724. package/build/relations/AbstractPropertyImpl.js +1 -2
  725. package/build/relations/AbstractPropertyImpl.js.map +1 -1
  726. package/build/relations/AbstractRelationImpl.cjs +1 -2
  727. package/build/relations/AbstractRelationImpl.d.cts +1 -4
  728. package/build/relations/AbstractRelationImpl.d.cts.map +1 -1
  729. package/build/relations/AbstractRelationImpl.d.mts +1 -4
  730. package/build/relations/AbstractRelationImpl.d.mts.map +1 -1
  731. package/build/relations/AbstractRelationImpl.js +1 -2
  732. package/build/relations/AsyncProperty.cjs +4 -5
  733. package/build/relations/AsyncProperty.cjs.map +1 -1
  734. package/build/relations/AsyncProperty.d.cts +7 -10
  735. package/build/relations/AsyncProperty.d.cts.map +1 -1
  736. package/build/relations/AsyncProperty.d.mts +7 -10
  737. package/build/relations/AsyncProperty.d.mts.map +1 -1
  738. package/build/relations/AsyncProperty.js +4 -5
  739. package/build/relations/AsyncProperty.js.map +1 -1
  740. package/build/relations/AsyncReactiveField.cjs +30 -13
  741. package/build/relations/AsyncReactiveField.cjs.map +1 -1
  742. package/build/relations/AsyncReactiveField.d.cts +11 -12
  743. package/build/relations/AsyncReactiveField.d.cts.map +1 -1
  744. package/build/relations/AsyncReactiveField.d.mts +11 -12
  745. package/build/relations/AsyncReactiveField.d.mts.map +1 -1
  746. package/build/relations/AsyncReactiveField.js +30 -13
  747. package/build/relations/AsyncReactiveField.js.map +1 -1
  748. package/build/relations/Collection.cjs +3 -4
  749. package/build/relations/Collection.d.cts +6 -9
  750. package/build/relations/Collection.d.cts.map +1 -1
  751. package/build/relations/Collection.d.mts +6 -9
  752. package/build/relations/Collection.d.mts.map +1 -1
  753. package/build/relations/Collection.js +3 -4
  754. package/build/relations/CustomCollection.cjs +6 -7
  755. package/build/relations/CustomCollection.cjs.map +1 -1
  756. package/build/relations/CustomCollection.d.cts +7 -10
  757. package/build/relations/CustomCollection.d.cts.map +1 -1
  758. package/build/relations/CustomCollection.d.mts +7 -10
  759. package/build/relations/CustomCollection.d.mts.map +1 -1
  760. package/build/relations/CustomCollection.js +6 -7
  761. package/build/relations/CustomCollection.js.map +1 -1
  762. package/build/relations/CustomReference.cjs +9 -10
  763. package/build/relations/CustomReference.cjs.map +1 -1
  764. package/build/relations/CustomReference.d.cts +9 -12
  765. package/build/relations/CustomReference.d.cts.map +1 -1
  766. package/build/relations/CustomReference.d.mts +9 -12
  767. package/build/relations/CustomReference.d.mts.map +1 -1
  768. package/build/relations/CustomReference.js +9 -10
  769. package/build/relations/CustomReference.js.map +1 -1
  770. package/build/relations/EnumCollection.cjs +5 -6
  771. package/build/relations/EnumCollection.cjs.map +1 -1
  772. package/build/relations/EnumCollection.d.cts +8 -10
  773. package/build/relations/EnumCollection.d.cts.map +1 -1
  774. package/build/relations/EnumCollection.d.mts +8 -10
  775. package/build/relations/EnumCollection.d.mts.map +1 -1
  776. package/build/relations/EnumCollection.js +5 -6
  777. package/build/relations/EnumCollection.js.map +1 -1
  778. package/build/relations/LargeCollection.cjs +2 -2
  779. package/build/relations/LargeCollection.d.cts +3 -6
  780. package/build/relations/LargeCollection.d.cts.map +1 -1
  781. package/build/relations/LargeCollection.d.mts +3 -6
  782. package/build/relations/LargeCollection.d.mts.map +1 -1
  783. package/build/relations/LargeCollection.js +2 -2
  784. package/build/relations/LazyField.cjs +23 -10
  785. package/build/relations/LazyField.cjs.map +1 -1
  786. package/build/relations/LazyField.d.cts +15 -12
  787. package/build/relations/LazyField.d.cts.map +1 -1
  788. package/build/relations/LazyField.d.mts +15 -12
  789. package/build/relations/LazyField.d.mts.map +1 -1
  790. package/build/relations/LazyField.js +23 -10
  791. package/build/relations/LazyField.js.map +1 -1
  792. package/build/relations/ManyToManyCollection.cjs +7 -8
  793. package/build/relations/ManyToManyCollection.cjs.map +1 -1
  794. package/build/relations/ManyToManyCollection.d.cts +4 -7
  795. package/build/relations/ManyToManyCollection.d.cts.map +1 -1
  796. package/build/relations/ManyToManyCollection.d.mts +4 -7
  797. package/build/relations/ManyToManyCollection.d.mts.map +1 -1
  798. package/build/relations/ManyToManyCollection.js +7 -8
  799. package/build/relations/ManyToManyCollection.js.map +1 -1
  800. package/build/relations/ManyToManyLargeCollection.cjs +8 -9
  801. package/build/relations/ManyToManyLargeCollection.d.cts +6 -9
  802. package/build/relations/ManyToManyLargeCollection.d.cts.map +1 -1
  803. package/build/relations/ManyToManyLargeCollection.d.mts +6 -9
  804. package/build/relations/ManyToManyLargeCollection.d.mts.map +1 -1
  805. package/build/relations/ManyToManyLargeCollection.js +8 -9
  806. package/build/relations/ManyToOneReference.cjs +11 -12
  807. package/build/relations/ManyToOneReference.cjs.map +1 -1
  808. package/build/relations/ManyToOneReference.d.cts +12 -15
  809. package/build/relations/ManyToOneReference.d.cts.map +1 -1
  810. package/build/relations/ManyToOneReference.d.mts +12 -15
  811. package/build/relations/ManyToOneReference.d.mts.map +1 -1
  812. package/build/relations/ManyToOneReference.js +11 -12
  813. package/build/relations/ManyToOneReference.js.map +1 -1
  814. package/build/relations/OneToManyCollection.cjs +8 -9
  815. package/build/relations/OneToManyCollection.cjs.map +1 -1
  816. package/build/relations/OneToManyCollection.d.cts +5 -8
  817. package/build/relations/OneToManyCollection.d.cts.map +1 -1
  818. package/build/relations/OneToManyCollection.d.mts +5 -8
  819. package/build/relations/OneToManyCollection.d.mts.map +1 -1
  820. package/build/relations/OneToManyCollection.js +8 -9
  821. package/build/relations/OneToManyCollection.js.map +1 -1
  822. package/build/relations/OneToManyLargeCollection.cjs +7 -8
  823. package/build/relations/OneToManyLargeCollection.cjs.map +1 -1
  824. package/build/relations/OneToManyLargeCollection.d.cts +6 -9
  825. package/build/relations/OneToManyLargeCollection.d.cts.map +1 -1
  826. package/build/relations/OneToManyLargeCollection.d.mts +6 -9
  827. package/build/relations/OneToManyLargeCollection.d.mts.map +1 -1
  828. package/build/relations/OneToManyLargeCollection.js +7 -8
  829. package/build/relations/OneToManyLargeCollection.js.map +1 -1
  830. package/build/relations/OneToOneReference.cjs +10 -11
  831. package/build/relations/OneToOneReference.cjs.map +1 -1
  832. package/build/relations/OneToOneReference.d.cts +12 -14
  833. package/build/relations/OneToOneReference.d.cts.map +1 -1
  834. package/build/relations/OneToOneReference.d.mts +12 -14
  835. package/build/relations/OneToOneReference.d.mts.map +1 -1
  836. package/build/relations/OneToOneReference.js +10 -11
  837. package/build/relations/OneToOneReference.js.map +1 -1
  838. package/build/relations/PolymorphicReference.cjs +13 -14
  839. package/build/relations/PolymorphicReference.cjs.map +1 -1
  840. package/build/relations/PolymorphicReference.d.cts +9 -12
  841. package/build/relations/PolymorphicReference.d.cts.map +1 -1
  842. package/build/relations/PolymorphicReference.d.mts +9 -12
  843. package/build/relations/PolymorphicReference.d.mts.map +1 -1
  844. package/build/relations/PolymorphicReference.js +13 -14
  845. package/build/relations/PolymorphicReference.js.map +1 -1
  846. package/build/relations/PropertySymbols.cjs +1 -2
  847. package/build/relations/PropertySymbols.d.cts +1 -4
  848. package/build/relations/PropertySymbols.d.cts.map +1 -1
  849. package/build/relations/PropertySymbols.d.mts +1 -4
  850. package/build/relations/PropertySymbols.d.mts.map +1 -1
  851. package/build/relations/PropertySymbols.js +1 -2
  852. package/build/relations/ReactiveField.cjs +35 -15
  853. package/build/relations/ReactiveField.cjs.map +1 -1
  854. package/build/relations/ReactiveField.d.cts +14 -12
  855. package/build/relations/ReactiveField.d.cts.map +1 -1
  856. package/build/relations/ReactiveField.d.mts +14 -12
  857. package/build/relations/ReactiveField.d.mts.map +1 -1
  858. package/build/relations/ReactiveField.js +35 -15
  859. package/build/relations/ReactiveField.js.map +1 -1
  860. package/build/relations/ReactiveGetter.cjs +3 -4
  861. package/build/relations/ReactiveGetter.cjs.map +1 -1
  862. package/build/relations/ReactiveGetter.d.cts +6 -9
  863. package/build/relations/ReactiveGetter.d.cts.map +1 -1
  864. package/build/relations/ReactiveGetter.d.mts +6 -9
  865. package/build/relations/ReactiveGetter.d.mts.map +1 -1
  866. package/build/relations/ReactiveGetter.js +3 -4
  867. package/build/relations/ReactiveGetter.js.map +1 -1
  868. package/build/relations/ReactiveManyToMany.cjs +22 -15
  869. package/build/relations/ReactiveManyToMany.cjs.map +1 -1
  870. package/build/relations/ReactiveManyToMany.d.cts +8 -11
  871. package/build/relations/ReactiveManyToMany.d.cts.map +1 -1
  872. package/build/relations/ReactiveManyToMany.d.mts +8 -11
  873. package/build/relations/ReactiveManyToMany.d.mts.map +1 -1
  874. package/build/relations/ReactiveManyToMany.js +22 -15
  875. package/build/relations/ReactiveManyToMany.js.map +1 -1
  876. package/build/relations/ReactiveManyToManyOtherSide.cjs +4 -5
  877. package/build/relations/ReactiveManyToManyOtherSide.cjs.map +1 -1
  878. package/build/relations/ReactiveManyToManyOtherSide.d.cts +8 -11
  879. package/build/relations/ReactiveManyToManyOtherSide.d.cts.map +1 -1
  880. package/build/relations/ReactiveManyToManyOtherSide.d.mts +8 -11
  881. package/build/relations/ReactiveManyToManyOtherSide.d.mts.map +1 -1
  882. package/build/relations/ReactiveManyToManyOtherSide.js +4 -5
  883. package/build/relations/ReactiveManyToManyOtherSide.js.map +1 -1
  884. package/build/relations/ReactiveReference.cjs +12 -13
  885. package/build/relations/ReactiveReference.cjs.map +1 -1
  886. package/build/relations/ReactiveReference.d.cts +12 -15
  887. package/build/relations/ReactiveReference.d.cts.map +1 -1
  888. package/build/relations/ReactiveReference.d.mts +12 -15
  889. package/build/relations/ReactiveReference.d.mts.map +1 -1
  890. package/build/relations/ReactiveReference.js +12 -13
  891. package/build/relations/ReactiveReference.js.map +1 -1
  892. package/build/relations/ReadOnlyCollection.cjs +3 -4
  893. package/build/relations/ReadOnlyCollection.d.cts +5 -8
  894. package/build/relations/ReadOnlyCollection.d.cts.map +1 -1
  895. package/build/relations/ReadOnlyCollection.d.mts +5 -8
  896. package/build/relations/ReadOnlyCollection.d.mts.map +1 -1
  897. package/build/relations/ReadOnlyCollection.js +3 -4
  898. package/build/relations/RecursiveCollection.cjs +5 -6
  899. package/build/relations/RecursiveCollection.cjs.map +1 -1
  900. package/build/relations/RecursiveCollection.d.cts +13 -15
  901. package/build/relations/RecursiveCollection.d.cts.map +1 -1
  902. package/build/relations/RecursiveCollection.d.mts +13 -15
  903. package/build/relations/RecursiveCollection.d.mts.map +1 -1
  904. package/build/relations/RecursiveCollection.js +5 -6
  905. package/build/relations/RecursiveCollection.js.map +1 -1
  906. package/build/relations/RecursiveCycleError.cjs +1 -2
  907. package/build/relations/RecursiveCycleError.d.cts +2 -4
  908. package/build/relations/RecursiveCycleError.d.cts.map +1 -1
  909. package/build/relations/RecursiveCycleError.d.mts +2 -4
  910. package/build/relations/RecursiveCycleError.d.mts.map +1 -1
  911. package/build/relations/RecursiveCycleError.js +1 -2
  912. package/build/relations/Reference.cjs +4 -5
  913. package/build/relations/Reference.d.cts +8 -10
  914. package/build/relations/Reference.d.cts.map +1 -1
  915. package/build/relations/Reference.d.mts +8 -10
  916. package/build/relations/Reference.d.mts.map +1 -1
  917. package/build/relations/Reference.js +4 -5
  918. package/build/relations/ReferenceSymbols.cjs +1 -2
  919. package/build/relations/ReferenceSymbols.d.cts +1 -4
  920. package/build/relations/ReferenceSymbols.d.cts.map +1 -1
  921. package/build/relations/ReferenceSymbols.d.mts +1 -4
  922. package/build/relations/ReferenceSymbols.d.mts.map +1 -1
  923. package/build/relations/ReferenceSymbols.js +1 -2
  924. package/build/relations/Relation.cjs +3 -4
  925. package/build/relations/Relation.d.cts +4 -6
  926. package/build/relations/Relation.d.cts.map +1 -1
  927. package/build/relations/Relation.d.mts +4 -6
  928. package/build/relations/Relation.d.mts.map +1 -1
  929. package/build/relations/Relation.js +3 -4
  930. package/build/relations/RelationSymbols.cjs +1 -2
  931. package/build/relations/RelationSymbols.d.cts +2 -5
  932. package/build/relations/RelationSymbols.d.cts.map +1 -1
  933. package/build/relations/RelationSymbols.d.mts +2 -5
  934. package/build/relations/RelationSymbols.d.mts.map +1 -1
  935. package/build/relations/RelationSymbols.js +1 -2
  936. package/build/relations/hasAsyncMethod.cjs +25 -7
  937. package/build/relations/hasAsyncMethod.cjs.map +1 -1
  938. package/build/relations/hasAsyncMethod.d.cts +10 -11
  939. package/build/relations/hasAsyncMethod.d.cts.map +1 -1
  940. package/build/relations/hasAsyncMethod.d.mts +10 -11
  941. package/build/relations/hasAsyncMethod.d.mts.map +1 -1
  942. package/build/relations/hasAsyncMethod.js +25 -8
  943. package/build/relations/hasAsyncMethod.js.map +1 -1
  944. package/build/relations/hasManyDerived.cjs +4 -5
  945. package/build/relations/hasManyDerived.d.cts +4 -6
  946. package/build/relations/hasManyDerived.d.cts.map +1 -1
  947. package/build/relations/hasManyDerived.d.mts +4 -6
  948. package/build/relations/hasManyDerived.d.mts.map +1 -1
  949. package/build/relations/hasManyDerived.js +4 -5
  950. package/build/relations/hasManyThrough.cjs +3 -4
  951. package/build/relations/hasManyThrough.d.cts +1 -4
  952. package/build/relations/hasManyThrough.d.cts.map +1 -1
  953. package/build/relations/hasManyThrough.d.mts +1 -4
  954. package/build/relations/hasManyThrough.d.mts.map +1 -1
  955. package/build/relations/hasManyThrough.js +3 -4
  956. package/build/relations/hasOneDerived.cjs +5 -6
  957. package/build/relations/hasOneDerived.d.cts +3 -6
  958. package/build/relations/hasOneDerived.d.cts.map +1 -1
  959. package/build/relations/hasOneDerived.d.mts +3 -6
  960. package/build/relations/hasOneDerived.d.mts.map +1 -1
  961. package/build/relations/hasOneDerived.js +5 -6
  962. package/build/relations/hasOneThrough.cjs +3 -4
  963. package/build/relations/hasOneThrough.d.cts +1 -4
  964. package/build/relations/hasOneThrough.d.cts.map +1 -1
  965. package/build/relations/hasOneThrough.d.mts +1 -4
  966. package/build/relations/hasOneThrough.d.mts.map +1 -1
  967. package/build/relations/hasOneThrough.js +3 -4
  968. package/build/relations/hasProperty.cjs +6 -7
  969. package/build/relations/hasProperty.cjs.map +1 -1
  970. package/build/relations/hasProperty.d.cts +10 -12
  971. package/build/relations/hasProperty.d.cts.map +1 -1
  972. package/build/relations/hasProperty.d.mts +10 -12
  973. package/build/relations/hasProperty.d.mts.map +1 -1
  974. package/build/relations/hasProperty.js +6 -7
  975. package/build/relations/hasProperty.js.map +1 -1
  976. package/build/relations/hasReactiveAsyncMethod.cjs +86 -0
  977. package/build/relations/hasReactiveAsyncMethod.cjs.map +1 -0
  978. package/build/relations/hasReactiveAsyncMethod.d.cts +30 -0
  979. package/build/relations/hasReactiveAsyncMethod.d.cts.map +1 -0
  980. package/build/relations/hasReactiveAsyncMethod.d.mts +30 -0
  981. package/build/relations/hasReactiveAsyncMethod.d.mts.map +1 -0
  982. package/build/relations/hasReactiveAsyncMethod.js +84 -0
  983. package/build/relations/hasReactiveAsyncMethod.js.map +1 -0
  984. package/build/relations/index.cjs +10 -8
  985. package/build/relations/index.d.cts +5 -4
  986. package/build/relations/index.d.mts +5 -4
  987. package/build/relations/index.js +10 -9
  988. package/build/relations/isCascadeDelete.cjs +1 -2
  989. package/build/relations/isCascadeDelete.d.cts +1 -4
  990. package/build/relations/isCascadeDelete.d.cts.map +1 -1
  991. package/build/relations/isCascadeDelete.d.mts +1 -4
  992. package/build/relations/isCascadeDelete.d.mts.map +1 -1
  993. package/build/relations/isCascadeDelete.js +1 -2
  994. package/build/resurrection.cjs +15 -6
  995. package/build/resurrection.cjs.map +1 -1
  996. package/build/resurrection.d.cts +6 -6
  997. package/build/resurrection.d.cts.map +1 -1
  998. package/build/resurrection.d.mts +6 -6
  999. package/build/resurrection.d.mts.map +1 -1
  1000. package/build/resurrection.js +15 -7
  1001. package/build/resurrection.js.map +1 -1
  1002. package/build/rules.cjs +6 -7
  1003. package/build/rules.cjs.map +1 -1
  1004. package/build/rules.d.cts +28 -25
  1005. package/build/rules.d.cts.map +1 -1
  1006. package/build/rules.d.mts +28 -25
  1007. package/build/rules.d.mts.map +1 -1
  1008. package/build/rules.js +6 -7
  1009. package/build/rules.js.map +1 -1
  1010. package/build/runtimeConfig.cjs +1 -2
  1011. package/build/runtimeConfig.d.cts +4 -7
  1012. package/build/runtimeConfig.d.cts.map +1 -1
  1013. package/build/runtimeConfig.d.mts +4 -7
  1014. package/build/runtimeConfig.d.mts.map +1 -1
  1015. package/build/runtimeConfig.js +1 -2
  1016. package/build/serde/TypeInfo.cjs +1 -2
  1017. package/build/serde/TypeInfo.d.cts +3 -6
  1018. package/build/serde/TypeInfo.d.cts.map +1 -1
  1019. package/build/serde/TypeInfo.d.mts +3 -6
  1020. package/build/serde/TypeInfo.d.mts.map +1 -1
  1021. package/build/serde/TypeInfo.js +1 -2
  1022. package/build/serde/columns.cjs +4 -2
  1023. package/build/serde/columns.cjs.map +1 -1
  1024. package/build/serde/columns.d.cts +5 -7
  1025. package/build/serde/columns.d.cts.map +1 -1
  1026. package/build/serde/columns.d.mts +5 -7
  1027. package/build/serde/columns.d.mts.map +1 -1
  1028. package/build/serde/columns.js +4 -2
  1029. package/build/serde/columns.js.map +1 -1
  1030. package/build/serde/fieldSerde.cjs +7 -5
  1031. package/build/serde/fieldSerde.cjs.map +1 -1
  1032. package/build/serde/fieldSerde.d.cts +14 -15
  1033. package/build/serde/fieldSerde.d.cts.map +1 -1
  1034. package/build/serde/fieldSerde.d.mts +14 -15
  1035. package/build/serde/fieldSerde.d.mts.map +1 -1
  1036. package/build/serde/fieldSerde.js +7 -5
  1037. package/build/serde/fieldSerde.js.map +1 -1
  1038. package/build/serde/serde.cjs +64 -5
  1039. package/build/serde/serde.cjs.map +1 -1
  1040. package/build/serde/serde.d.cts +58 -21
  1041. package/build/serde/serde.d.cts.map +1 -1
  1042. package/build/serde/serde.d.mts +58 -21
  1043. package/build/serde/serde.d.mts.map +1 -1
  1044. package/build/serde/serde.js +64 -6
  1045. package/build/serde/serde.js.map +1 -1
  1046. package/build/serde/temporal.cjs +8 -14
  1047. package/build/serde/temporal.cjs.map +1 -1
  1048. package/build/serde/temporal.d.cts +6 -8
  1049. package/build/serde/temporal.d.cts.map +1 -1
  1050. package/build/serde/temporal.d.mts +6 -8
  1051. package/build/serde/temporal.d.mts.map +1 -1
  1052. package/build/serde/temporal.js +8 -14
  1053. package/build/serde/temporal.js.map +1 -1
  1054. package/build/serde/temporalMappers.cjs +9 -6
  1055. package/build/serde/temporalMappers.cjs.map +1 -1
  1056. package/build/serde/temporalMappers.d.cts +5 -8
  1057. package/build/serde/temporalMappers.d.cts.map +1 -1
  1058. package/build/serde/temporalMappers.d.mts +5 -8
  1059. package/build/serde/temporalMappers.d.mts.map +1 -1
  1060. package/build/serde/temporalMappers.js +9 -6
  1061. package/build/serde/temporalMappers.js.map +1 -1
  1062. package/build/transitions.cjs +90 -0
  1063. package/build/transitions.cjs.map +1 -0
  1064. package/build/transitions.d.cts +113 -0
  1065. package/build/transitions.d.cts.map +1 -0
  1066. package/build/transitions.d.mts +113 -0
  1067. package/build/transitions.d.mts.map +1 -0
  1068. package/build/transitions.js +85 -0
  1069. package/build/transitions.js.map +1 -0
  1070. package/build/trusted.cjs +1 -2
  1071. package/build/trusted.cjs.map +1 -1
  1072. package/build/trusted.d.cts +2 -5
  1073. package/build/trusted.d.cts.map +1 -1
  1074. package/build/trusted.d.mts +2 -5
  1075. package/build/trusted.d.mts.map +1 -1
  1076. package/build/trusted.js +1 -2
  1077. package/build/typeMap.cjs +1 -1
  1078. package/build/typeMap.d.cts +18 -20
  1079. package/build/typeMap.d.cts.map +1 -1
  1080. package/build/typeMap.d.mts +18 -20
  1081. package/build/typeMap.d.mts.map +1 -1
  1082. package/build/typeMap.js +1 -1
  1083. package/build/upsert.cjs +7 -8
  1084. package/build/upsert.d.cts +7 -9
  1085. package/build/upsert.d.cts.map +1 -1
  1086. package/build/upsert.d.mts +7 -9
  1087. package/build/upsert.d.mts.map +1 -1
  1088. package/build/upsert.js +7 -8
  1089. package/build/utils.cjs +3 -4
  1090. package/build/utils.d.cts +29 -32
  1091. package/build/utils.d.cts.map +1 -1
  1092. package/build/utils.d.mts +29 -32
  1093. package/build/utils.d.mts.map +1 -1
  1094. package/build/utils.js +3 -4
  1095. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"findPaginatedDataLoader.cjs","names":["getMetadata","parseFindQuery","findOperation","isQueryProvablyEmpty","getBatchKeyFromGenericStructure","hintKey","getEmInternalApi","buildHintTree","filterDeletedEntities","collectAndReplaceArgs","createColumnValuesFromPrepared","buildUnnestCte","queryFilterHash"],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"sourcesContent":["import {\n collectAndReplaceArgs,\n collectValues,\n createColumnValuesFromPrepared,\n filterDeletedEntities,\n findOperation,\n getBatchKeyFromGenericStructure,\n queryFilterHash,\n} from \"src/dataloaders/findDataLoader.ts\";\nimport type { Entity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, getEmInternalApi } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { buildHintTree } from \"src/loading/HintTree.ts\";\nimport type { LoadHint } from \"src/loading/loadHints.ts\";\nimport { hintKey } from \"src/normalizeHints.ts\";\nimport type { FilterAndSettings } from \"src/queries/find/EntityFilter.ts\";\nimport { type ParsedFindQuery, parseFindQuery } from \"src/queries/find/QueryParser.ts\";\nimport { isQueryProvablyEmpty } from \"src/queries/find/QueryVisitor.ts\";\nimport { buildUnnestCte } from \"src/queries/unnest.ts\";\n\ninterface PreparedPaginatedFindEntry<T extends Entity> {\n filter: FilterAndSettings<T>;\n query: ParsedFindQuery;\n bindings: any[];\n findSettings: any;\n limit: number | undefined;\n offset: number | undefined;\n}\n\n/** Returns a dataloader that batches paginated finds by applying pagination inside each lateral subquery. */\nexport function findPaginatedDataLoader<T extends Entity>(\n em: EntityManager,\n type: MaybeAbstractEntityConstructor<T>,\n filter: FilterAndSettings<T>,\n hint: LoadHint<T> | undefined,\n): Promise<T[]> {\n const { where, limit, offset, ...opts } = filter;\n const meta = getMetadata(type);\n const query = parseFindQuery(meta, where, opts);\n const { findSettings } = em[\"prepareFind\"](meta, findOperation, query, { ...opts, limit, offset, checkLimit: false });\n if (isQueryProvablyEmpty(query)) return Promise.resolve([]);\n\n const bindings: any[] = [];\n collectValues(bindings, query);\n const prepared = {\n filter,\n query,\n bindings,\n findSettings,\n limit: findSettings.limit,\n offset: findSettings.offset,\n };\n const batchKey = [\n getBatchKeyFromGenericStructure(meta, query),\n hintKey(hint),\n findSettings.limit,\n findSettings.offset,\n ].join(\"-\");\n\n return em\n .getLoader<PreparedPaginatedFindEntry<T>, T[]>(\n findOperation,\n batchKey,\n async (entries) => {\n if (entries.length === 1) {\n // Skip batching & just execute the query as-is\n const { query, findSettings } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n const rows = await em[\"executePreparedFind\"](meta, findOperation, query, findSettings, false);\n const entities = em.hydrate(type, rows);\n preloadHydrator?.(rows, entities);\n return [filterDeletedEntities(em, entities)];\n }\n\n const { query, findSettings, limit, offset } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n\n // Now craft the actual batched query\n const args = collectAndReplaceArgs(query, entries);\n const argsColumns = [{ columnName: \"tag\", dbType: \"int\" }, ...args.map((a) => a.column)];\n const columnValues = createColumnValuesFromPrepared(args, entries);\n const query2: ParsedFindQuery = {\n selects: [\"_find.tag as tag\", \"_data.*\"],\n tables: [\n { join: \"primary\", table: \"_find\", alias: \"_find\" },\n {\n join: \"lateral\",\n query,\n table: meta.tableName,\n alias: \"_data\",\n fromAlias: \"_find\",\n settings: { limit, offset },\n },\n ],\n ctes: [buildUnnestCte(\"_find\", argsColumns, columnValues)],\n orderBys: [],\n };\n\n const rows = await em[\"executePreparedFind\"](\n meta,\n findOperation,\n query2,\n { ...findSettings, limit: undefined, offset: undefined },\n false,\n );\n const entities = em.hydrate(type, rows);\n preloadHydrator?.(rows, entities);\n\n const results = entries.map(() => [] as T[]);\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const entity = entities[i];\n if (!entity.isDeletedEntity) {\n results[row.tag].push(entity);\n }\n delete row.tag;\n }\n return results;\n },\n { cacheKeyFn: queryFilterHash },\n )\n .load(prepared);\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgB,wBACd,IACA,MACA,QACA,MACc;CACd,MAAM,EAAE,OAAO,OAAO,QAAQ,GAAG,SAAS;CAC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AAOE,mCAAAA,sBAAsB,OAAO,OAAO;EACjD,MAAM,cAAc,CAAC;GAAE,YAAY;GAAO,QAAQ;EAAM,GAAG,GAAG,KAAK,KAAK,MAAM,EAAE,MAAM,CAAC;EACvF,MAAM,eAAeC,mCAAAA,+BAA+B,MAAM,OAAO;EACjE,MAAM,SAA0B;GAC9B,SAAS,CAAC,oBAAoB,SAAS;GACvC,QAAQ,CACN;IAAE,MAAM;IAAW,OAAO;IAAS,OAAO;GAAQ,GAClD;IACE,MAAM;IACN;IACA,OAAO,KAAK;IACZ,OAAO;IACP,WAAW;IACX,UAAU;KAAE;KAAO;IAAO;GAC5B,CACF;GACA,MAAM,CAACC,uBAAAA,eAAe,SAAS,aAAa,YAAY,CAAC;GACzD,UAAU,CAAC;EACb;EAEA,MAAM,OAAO,MAAM,GAAG,sBAAsB,CAC1C,MACAT,mCAAAA,eACA,QACA;GAAE,GAAG;GAAc,OAAO,KAAA;GAAW,QAAQ,KAAA;EAAU,GACvD,KACF;EACA,MAAM,WAAW,GAAG,QAAQ,MAAM,IAAI;EACtC,kBAAkB,MAAM,QAAQ;EAEhC,MAAM,UAAU,QAAQ,UAAU,CAAC,CAAQ;EAC3C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,MAAM,KAAK;GACjB,MAAM,SAAS,SAAS;GACxB,IAAI,CAAC,OAAO,iBACV,QAAQ,IAAI,IAAI,CAAC,KAAK,MAAM;GAE9B,OAAO,IAAI;EACb;EACA,OAAO;CACT,GACA,EAAE,YAAYU,mCAAAA,gBAAgB,CAChC,CAAC,CACA,KAAK,QAAQ;AAClB"}
1
+ {"version":3,"file":"findPaginatedDataLoader.cjs","names":["getMetadata","parseFindQuery","findOperation","isQueryProvablyEmpty","getBatchKeyFromGenericStructure","hintKey","getEmInternalApi","buildHintTree","filterDeletedEntities","collectAndReplaceArgs","createColumnValuesFromPrepared","buildUnnestCte","queryFilterHash"],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"sourcesContent":["import {\n collectAndReplaceArgs,\n collectValues,\n createColumnValuesFromPrepared,\n filterDeletedEntities,\n findOperation,\n getBatchKeyFromGenericStructure,\n queryFilterHash,\n} from \"src/dataloaders/findDataLoader.ts\";\nimport type { Entity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, getEmInternalApi } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { buildHintTree } from \"src/loading/HintTree.ts\";\nimport type { LoadHint } from \"src/loading/loadHints.ts\";\nimport { hintKey } from \"src/normalizeHints.ts\";\nimport type { FilterAndSettings } from \"src/queries/find/EntityFilter.ts\";\nimport { type ParsedFindQuery, parseFindQuery } from \"src/queries/find/QueryParser.ts\";\nimport { isQueryProvablyEmpty } from \"src/queries/find/QueryVisitor.ts\";\nimport { buildUnnestCte } from \"src/queries/unnest.ts\";\n\ninterface PreparedPaginatedFindEntry<T extends Entity> {\n filter: FilterAndSettings<T>;\n query: ParsedFindQuery;\n bindings: any[];\n findSettings: any;\n limit: number | undefined;\n offset: number | undefined;\n}\n\n/** Returns a dataloader that batches paginated finds by applying pagination inside each lateral subquery. */\nexport function findPaginatedDataLoader<T extends Entity>(\n em: EntityManager,\n type: MaybeAbstractEntityConstructor<T>,\n filter: FilterAndSettings<T>,\n hint: LoadHint<T> | undefined,\n): Promise<T[]> {\n const { where, limit, offset, ...opts } = filter;\n const meta = getMetadata(type);\n const query = parseFindQuery(meta, where, opts);\n const { findSettings } = em[\"prepareFind\"](meta, findOperation, query, { ...opts, limit, offset, checkLimit: false });\n if (isQueryProvablyEmpty(query)) return Promise.resolve([]);\n\n const bindings: any[] = [];\n collectValues(bindings, query);\n const prepared = {\n filter,\n query,\n bindings,\n findSettings,\n limit: findSettings.limit,\n offset: findSettings.offset,\n };\n const batchKey = [\n getBatchKeyFromGenericStructure(meta, query),\n hintKey(hint),\n findSettings.limit,\n findSettings.offset,\n ].join(\"-\");\n\n return em\n .getLoader<PreparedPaginatedFindEntry<T>, T[]>(\n findOperation,\n batchKey,\n async (entries) => {\n if (entries.length === 1) {\n // Skip batching & just execute the query as-is\n const { query, findSettings } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n const rowData = await em[\"executePreparedFindRowData\"](meta, findOperation, query, findSettings, false);\n const entities = em[\"hydrateAndFinalize\"](type, rowData, {\n sidecars: (entities) => preloadHydrator?.(rowData, entities),\n });\n return [filterDeletedEntities(em, entities)];\n }\n\n const { query, findSettings, limit, offset } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n\n // Now craft the actual batched query\n const args = collectAndReplaceArgs(query, entries);\n const argsColumns = [{ columnName: \"tag\", dbType: \"int\" }, ...args.map((a) => a.column)];\n const columnValues = createColumnValuesFromPrepared(args, entries);\n const query2: ParsedFindQuery = {\n selects: [\"_find.tag as tag\", \"_data.*\"],\n tables: [\n { join: \"primary\", table: \"_find\", alias: \"_find\" },\n {\n join: \"lateral\",\n query,\n table: meta.tableName,\n alias: \"_data\",\n fromAlias: \"_find\",\n settings: { limit, offset },\n },\n ],\n ctes: [buildUnnestCte(\"_find\", argsColumns, columnValues)],\n orderBys: [],\n };\n\n const rowData = await em[\"executePreparedFindRowData\"](\n meta,\n findOperation,\n query2,\n { ...findSettings, limit: undefined, offset: undefined },\n false,\n );\n const results = entries.map(() => [] as T[]);\n em[\"hydrateAndFinalize\"](type, rowData, {\n sidecars: (entities) => {\n preloadHydrator?.(rowData, entities);\n // Read tags before compaction drops rows already present in the identity map.\n for (let i = 0; i < entities.length; i++) {\n const entity = entities[i];\n if (!entity.isDeletedEntity) {\n results[rowData.get(i, \"tag\")].push(entity);\n }\n }\n },\n });\n return results;\n },\n { cacheKeyFn: queryFilterHash },\n )\n .load(prepared);\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgB,wBACd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E;EACzC,MAAM,kBAAkB,aAAa,QAAQ,UAAU,cAAc,MAAMC,yBAAAA,cAAc,IAAI,GAAG,KAAK;EAGrG,MAAM,OAAOE,mCAAAA,sBAAsB,OAAO,OAAO;EACjD,MAAM,cAAc,CAAC;GAAE,YAAY;GAAO,QAAQ;EAAM,GAAG,GAAG,KAAK,KAAK,MAAM,EAAE,MAAM,CAAC;EACvF,MAAM,eAAeC,mCAAAA,+BAA+B,MAAM,OAAO;EACjE,MAAM,SAA0B;GAC9B,SAAS,CAAC,oBAAoB,SAAS;GACvC,QAAQ,CACN;IAAE,MAAM;IAAW,OAAO;IAAS,OAAO;GAAQ,GAClD;IACE,MAAM;IACN;IACA,OAAO,KAAK;IACZ,OAAO;IACP,WAAW;IACX,UAAU;KAAE;KAAO;IAAO;GAC5B,CACF;GACA,MAAM,CAACC,uBAAAA,eAAe,SAAS,aAAa,YAAY,CAAC;GACzD,UAAU,CAAC;EACb;EAEA,MAAM,UAAU,MAAM,GAAG,6BAA6B,CACpD,MACAT,mCAAAA,eACA,QACA;GAAE,GAAG;GAAc,OAAO,KAAA;GAAW,QAAQ,KAAA;EAAU,GACvD,KACF;EACA,MAAM,UAAU,QAAQ,UAAU,CAAC,CAAQ;EAC3C,GAAG,qBAAqB,CAAC,MAAM,SAAS,EACtC,WAAW,aAAa;GACtB,kBAAkB,SAAS,QAAQ;GAEnC,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;IACxC,MAAM,SAAS,SAAS;IACxB,IAAI,CAAC,OAAO,iBACV,QAAQ,QAAQ,IAAI,GAAG,KAAK,EAAE,CAAC,KAAK,MAAM;GAE9C;EACF,EACF,CAAC;EACD,OAAO;CACT,GACA,EAAE,YAAYU,mCAAAA,gBAAgB,CAChC,CAAC,CACA,KAAK,QAAQ;AAClB"}
@@ -1,10 +1,7 @@
1
- import { FilterAndSettings } from "../queries/find/EntityFilter.cjs";
2
- import { LoadHint } from "../loading/loadHints.cjs";
3
- import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.cjs";
4
1
  import { Entity } from "../Entity.cjs";
5
- //#region src/dataloaders/findPaginatedDataLoader.d.ts
2
+ import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.cjs";
3
+ import { LoadHint } from "../loading/loadHints.cjs";
4
+ import { FilterAndSettings } from "../queries/find/EntityFilter.cjs";
6
5
  /** Returns a dataloader that batches paginated finds by applying pagination inside each lateral subquery. */
7
- declare function findPaginatedDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>, hint: LoadHint<T> | undefined): Promise<T[]>;
8
- //#endregion
9
- export { findPaginatedDataLoader };
6
+ export declare function findPaginatedDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>, hint: LoadHint<T> | undefined): Promise<T[]>;
10
7
  //# sourceMappingURL=findPaginatedDataLoader.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findPaginatedDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"mappings":";;;;;;iBA8BgB,wBAAwB,UAAU,QAChD,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,IAC1B,MAAM,SAAS,iBACd,QAAQ"}
1
+ {"version":3,"file":"findPaginatedDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"mappings":";;;;;wBA8BgB,wBAAwB,UAAU,QAChD,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,IAC1B,MAAM,SAAS,iBACd,QAAQ"}
@@ -1,10 +1,7 @@
1
- import { FilterAndSettings } from "../queries/find/EntityFilter.mjs";
2
- import { LoadHint } from "../loading/loadHints.mjs";
3
- import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.mjs";
4
1
  import { Entity } from "../Entity.mjs";
5
- //#region src/dataloaders/findPaginatedDataLoader.d.ts
2
+ import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.mjs";
3
+ import { LoadHint } from "../loading/loadHints.mjs";
4
+ import { FilterAndSettings } from "../queries/find/EntityFilter.mjs";
6
5
  /** Returns a dataloader that batches paginated finds by applying pagination inside each lateral subquery. */
7
- declare function findPaginatedDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>, hint: LoadHint<T> | undefined): Promise<T[]>;
8
- //#endregion
9
- export { findPaginatedDataLoader };
6
+ export declare function findPaginatedDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>, hint: LoadHint<T> | undefined): Promise<T[]>;
10
7
  //# sourceMappingURL=findPaginatedDataLoader.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findPaginatedDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"mappings":";;;;;;iBA8BgB,wBAAwB,UAAU,QAChD,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,IAC1B,MAAM,SAAS,iBACd,QAAQ"}
1
+ {"version":3,"file":"findPaginatedDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"mappings":";;;;;wBA8BgB,wBAAwB,UAAU,QAChD,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,IAC1B,MAAM,SAAS,iBACd,QAAQ"}
@@ -1,12 +1,12 @@
1
- import { hintKey } from "../normalizeHints.js";
2
- import { isQueryProvablyEmpty } from "../queries/find/QueryVisitor.js";
3
- import { parseFindQuery } from "../queries/find/QueryParser.js";
1
+ import { collectAndReplaceArgs, collectValues, createColumnValuesFromPrepared, filterDeletedEntities, findOperation, getBatchKeyFromGenericStructure, queryFilterHash } from "./findDataLoader.js";
2
+ import { getEmInternalApi } from "../EntityManager.js";
4
3
  import { getMetadata } from "../EntityMetadata.js";
5
4
  import { buildHintTree } from "../loading/HintTree.js";
5
+ import { hintKey } from "../normalizeHints.js";
6
+ import { parseFindQuery } from "../queries/find/QueryParser.js";
7
+ import { isQueryProvablyEmpty } from "../queries/find/QueryVisitor.js";
6
8
  import { buildUnnestCte } from "../queries/unnest.js";
7
- import { collectAndReplaceArgs, collectValues, createColumnValuesFromPrepared, filterDeletedEntities, findOperation, getBatchKeyFromGenericStructure, queryFilterHash } from "./findDataLoader.js";
8
- import { getEmInternalApi } from "../EntityManager.js";
9
- //#region src/dataloaders/findPaginatedDataLoader.ts
9
+ // src/dataloaders/findPaginatedDataLoader.ts
10
10
  /** Returns a dataloader that batches paginated finds by applying pagination inside each lateral subquery. */
11
11
  function findPaginatedDataLoader(em, type, filter, hint) {
12
12
  const { where, limit, offset, ...opts } = filter;
@@ -40,9 +40,8 @@ function findPaginatedDataLoader(em, type, filter, hint) {
40
40
  const { query, findSettings } = entries[0];
41
41
  const { preloader } = getEmInternalApi(em);
42
42
  const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);
43
- const rows = await em["executePreparedFind"](meta, findOperation, query, findSettings, false);
44
- const entities = em.hydrate(type, rows);
45
- preloadHydrator?.(rows, entities);
43
+ const rowData = await em["executePreparedFindRowData"](meta, findOperation, query, findSettings, false);
44
+ const entities = em["hydrateAndFinalize"](type, rowData, { sidecars: (entities) => preloadHydrator?.(rowData, entities) });
46
45
  return [filterDeletedEntities(em, entities)];
47
46
  }
48
47
  const { query, findSettings, limit, offset } = entries[0];
@@ -74,24 +73,22 @@ function findPaginatedDataLoader(em, type, filter, hint) {
74
73
  ctes: [buildUnnestCte("_find", argsColumns, columnValues)],
75
74
  orderBys: []
76
75
  };
77
- const rows = await em["executePreparedFind"](meta, findOperation, query2, {
76
+ const rowData = await em["executePreparedFindRowData"](meta, findOperation, query2, {
78
77
  ...findSettings,
79
78
  limit: void 0,
80
79
  offset: void 0
81
80
  }, false);
82
- const entities = em.hydrate(type, rows);
83
- preloadHydrator?.(rows, entities);
84
81
  const results = entries.map(() => []);
85
- for (let i = 0; i < rows.length; i++) {
86
- const row = rows[i];
87
- const entity = entities[i];
88
- if (!entity.isDeletedEntity) results[row.tag].push(entity);
89
- delete row.tag;
90
- }
82
+ em["hydrateAndFinalize"](type, rowData, { sidecars: (entities) => {
83
+ preloadHydrator?.(rowData, entities);
84
+ for (let i = 0; i < entities.length; i++) {
85
+ const entity = entities[i];
86
+ if (!entity.isDeletedEntity) results[rowData.get(i, "tag")].push(entity);
87
+ }
88
+ } });
91
89
  return results;
92
90
  }, { cacheKeyFn: queryFilterHash }).load(prepared);
93
91
  }
94
- //#endregion
95
92
  export { findPaginatedDataLoader };
96
93
 
97
94
  //# sourceMappingURL=findPaginatedDataLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"findPaginatedDataLoader.js","names":[],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"sourcesContent":["import {\n collectAndReplaceArgs,\n collectValues,\n createColumnValuesFromPrepared,\n filterDeletedEntities,\n findOperation,\n getBatchKeyFromGenericStructure,\n queryFilterHash,\n} from \"src/dataloaders/findDataLoader.ts\";\nimport type { Entity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, getEmInternalApi } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { buildHintTree } from \"src/loading/HintTree.ts\";\nimport type { LoadHint } from \"src/loading/loadHints.ts\";\nimport { hintKey } from \"src/normalizeHints.ts\";\nimport type { FilterAndSettings } from \"src/queries/find/EntityFilter.ts\";\nimport { type ParsedFindQuery, parseFindQuery } from \"src/queries/find/QueryParser.ts\";\nimport { isQueryProvablyEmpty } from \"src/queries/find/QueryVisitor.ts\";\nimport { buildUnnestCte } from \"src/queries/unnest.ts\";\n\ninterface PreparedPaginatedFindEntry<T extends Entity> {\n filter: FilterAndSettings<T>;\n query: ParsedFindQuery;\n bindings: any[];\n findSettings: any;\n limit: number | undefined;\n offset: number | undefined;\n}\n\n/** Returns a dataloader that batches paginated finds by applying pagination inside each lateral subquery. */\nexport function findPaginatedDataLoader<T extends Entity>(\n em: EntityManager,\n type: MaybeAbstractEntityConstructor<T>,\n filter: FilterAndSettings<T>,\n hint: LoadHint<T> | undefined,\n): Promise<T[]> {\n const { where, limit, offset, ...opts } = filter;\n const meta = getMetadata(type);\n const query = parseFindQuery(meta, where, opts);\n const { findSettings } = em[\"prepareFind\"](meta, findOperation, query, { ...opts, limit, offset, checkLimit: false });\n if (isQueryProvablyEmpty(query)) return Promise.resolve([]);\n\n const bindings: any[] = [];\n collectValues(bindings, query);\n const prepared = {\n filter,\n query,\n bindings,\n findSettings,\n limit: findSettings.limit,\n offset: findSettings.offset,\n };\n const batchKey = [\n getBatchKeyFromGenericStructure(meta, query),\n hintKey(hint),\n findSettings.limit,\n findSettings.offset,\n ].join(\"-\");\n\n return em\n .getLoader<PreparedPaginatedFindEntry<T>, T[]>(\n findOperation,\n batchKey,\n async (entries) => {\n if (entries.length === 1) {\n // Skip batching & just execute the query as-is\n const { query, findSettings } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n const rows = await em[\"executePreparedFind\"](meta, findOperation, query, findSettings, false);\n const entities = em.hydrate(type, rows);\n preloadHydrator?.(rows, entities);\n return [filterDeletedEntities(em, entities)];\n }\n\n const { query, findSettings, limit, offset } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n\n // Now craft the actual batched query\n const args = collectAndReplaceArgs(query, entries);\n const argsColumns = [{ columnName: \"tag\", dbType: \"int\" }, ...args.map((a) => a.column)];\n const columnValues = createColumnValuesFromPrepared(args, entries);\n const query2: ParsedFindQuery = {\n selects: [\"_find.tag as tag\", \"_data.*\"],\n tables: [\n { join: \"primary\", table: \"_find\", alias: \"_find\" },\n {\n join: \"lateral\",\n query,\n table: meta.tableName,\n alias: \"_data\",\n fromAlias: \"_find\",\n settings: { limit, offset },\n },\n ],\n ctes: [buildUnnestCte(\"_find\", argsColumns, columnValues)],\n orderBys: [],\n };\n\n const rows = await em[\"executePreparedFind\"](\n meta,\n findOperation,\n query2,\n { ...findSettings, limit: undefined, offset: undefined },\n false,\n );\n const entities = em.hydrate(type, rows);\n preloadHydrator?.(rows, entities);\n\n const results = entries.map(() => [] as T[]);\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const entity = entities[i];\n if (!entity.isDeletedEntity) {\n results[row.tag].push(entity);\n }\n delete row.tag;\n }\n return results;\n },\n { cacheKeyFn: queryFilterHash },\n )\n .load(prepared);\n}\n"],"mappings":";;;;;;;;;;AA8BA,SAAgB,wBACd,IACA,MACA,QACA,MACc;CACd,MAAM,EAAE,OAAO,OAAO,QAAQ,GAAG,SAAS;CAC1C,MAAM,OAAO,YAAY,IAAI;CAC7B,MAAM,QAAQ,eAAe,MAAM,OAAO,IAAI;CAC9C,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC,MAAM,eAAe,OAAO;EAAE,GAAG;EAAM;EAAO;EAAQ,YAAY;CAAM,CAAC;CACpH,IAAI,qBAAqB,KAAK,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAE1D,MAAM,WAAkB,CAAC;CACzB,cAAc,UAAU,KAAK;CAC7B,MAAM,WAAW;EACf;EACA;EACA;EACA;EACA,OAAO,aAAa;EACpB,QAAQ,aAAa;CACvB;CACA,MAAM,WAAW;EACf,gCAAgC,MAAM,KAAK;EAC3C,QAAQ,IAAI;EACZ,aAAa;EACb,aAAa;CACf,CAAC,CAAC,KAAK,GAAG;CAEV,OAAO,GACJ,UACC,eACA,UACA,OAAO,YAAY;EACjB,IAAI,QAAQ,WAAW,GAAG;GAExB,MAAM,EAAE,OAAO,iBAAiB,QAAQ;GACxC,MAAM,EAAE,cAAc,iBAAiB,EAAE;GACzC,MAAM,kBAAkB,aAAa,QAAQ,UAAU,cAAc,MAAM,cAAc,IAAI,GAAG,KAAK;GACrG,MAAM,OAAO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9B,OAAO,IAAI;EACb;EACA,OAAO;CACT,GACA,EAAE,YAAY,gBAAgB,CAChC,CAAC,CACA,KAAK,QAAQ;AAClB"}
1
+ {"version":3,"file":"findPaginatedDataLoader.js","names":[],"sources":["../../src/dataloaders/findPaginatedDataLoader.ts"],"sourcesContent":["import {\n collectAndReplaceArgs,\n collectValues,\n createColumnValuesFromPrepared,\n filterDeletedEntities,\n findOperation,\n getBatchKeyFromGenericStructure,\n queryFilterHash,\n} from \"src/dataloaders/findDataLoader.ts\";\nimport type { Entity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, getEmInternalApi } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { buildHintTree } from \"src/loading/HintTree.ts\";\nimport type { LoadHint } from \"src/loading/loadHints.ts\";\nimport { hintKey } from \"src/normalizeHints.ts\";\nimport type { FilterAndSettings } from \"src/queries/find/EntityFilter.ts\";\nimport { type ParsedFindQuery, parseFindQuery } from \"src/queries/find/QueryParser.ts\";\nimport { isQueryProvablyEmpty } from \"src/queries/find/QueryVisitor.ts\";\nimport { buildUnnestCte } from \"src/queries/unnest.ts\";\n\ninterface PreparedPaginatedFindEntry<T extends Entity> {\n filter: FilterAndSettings<T>;\n query: ParsedFindQuery;\n bindings: any[];\n findSettings: any;\n limit: number | undefined;\n offset: number | undefined;\n}\n\n/** Returns a dataloader that batches paginated finds by applying pagination inside each lateral subquery. */\nexport function findPaginatedDataLoader<T extends Entity>(\n em: EntityManager,\n type: MaybeAbstractEntityConstructor<T>,\n filter: FilterAndSettings<T>,\n hint: LoadHint<T> | undefined,\n): Promise<T[]> {\n const { where, limit, offset, ...opts } = filter;\n const meta = getMetadata(type);\n const query = parseFindQuery(meta, where, opts);\n const { findSettings } = em[\"prepareFind\"](meta, findOperation, query, { ...opts, limit, offset, checkLimit: false });\n if (isQueryProvablyEmpty(query)) return Promise.resolve([]);\n\n const bindings: any[] = [];\n collectValues(bindings, query);\n const prepared = {\n filter,\n query,\n bindings,\n findSettings,\n limit: findSettings.limit,\n offset: findSettings.offset,\n };\n const batchKey = [\n getBatchKeyFromGenericStructure(meta, query),\n hintKey(hint),\n findSettings.limit,\n findSettings.offset,\n ].join(\"-\");\n\n return em\n .getLoader<PreparedPaginatedFindEntry<T>, T[]>(\n findOperation,\n batchKey,\n async (entries) => {\n if (entries.length === 1) {\n // Skip batching & just execute the query as-is\n const { query, findSettings } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n const rowData = await em[\"executePreparedFindRowData\"](meta, findOperation, query, findSettings, false);\n const entities = em[\"hydrateAndFinalize\"](type, rowData, {\n sidecars: (entities) => preloadHydrator?.(rowData, entities),\n });\n return [filterDeletedEntities(em, entities)];\n }\n\n const { query, findSettings, limit, offset } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadHydrator = preloader && hint && preloader.addPreloading(meta, buildHintTree(hint), query);\n\n // Now craft the actual batched query\n const args = collectAndReplaceArgs(query, entries);\n const argsColumns = [{ columnName: \"tag\", dbType: \"int\" }, ...args.map((a) => a.column)];\n const columnValues = createColumnValuesFromPrepared(args, entries);\n const query2: ParsedFindQuery = {\n selects: [\"_find.tag as tag\", \"_data.*\"],\n tables: [\n { join: \"primary\", table: \"_find\", alias: \"_find\" },\n {\n join: \"lateral\",\n query,\n table: meta.tableName,\n alias: \"_data\",\n fromAlias: \"_find\",\n settings: { limit, offset },\n },\n ],\n ctes: [buildUnnestCte(\"_find\", argsColumns, columnValues)],\n orderBys: [],\n };\n\n const rowData = await em[\"executePreparedFindRowData\"](\n meta,\n findOperation,\n query2,\n { ...findSettings, limit: undefined, offset: undefined },\n false,\n );\n const results = entries.map(() => [] as T[]);\n em[\"hydrateAndFinalize\"](type, rowData, {\n sidecars: (entities) => {\n preloadHydrator?.(rowData, entities);\n // Read tags before compaction drops rows already present in the identity map.\n for (let i = 0; i < entities.length; i++) {\n const entity = entities[i];\n if (!entity.isDeletedEntity) {\n results[rowData.get(i, \"tag\")].push(entity);\n }\n }\n },\n });\n return results;\n },\n { cacheKeyFn: queryFilterHash },\n )\n .load(prepared);\n}\n"],"mappings":";;;;;;;;;;AA8BA,SAAgB,wBACd,IACA,MACA,QACA,MACc;CACd,MAAM,EAAE,OAAO,OAAO,QAAQ,GAAG,SAAS;CAC1C,MAAM,OAAO,YAAY,IAAI;CAC7B,MAAM,QAAQ,eAAe,MAAM,OAAO,IAAI;CAC9C,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC,MAAM,eAAe,OAAO;EAAE,GAAG;EAAM;EAAO;EAAQ,YAAY;CAAM,CAAC;CACpH,IAAI,qBAAqB,KAAK,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAE1D,MAAM,WAAkB,CAAC;CACzB,cAAc,UAAU,KAAK;CAC7B,MAAM,WAAW;EACf;EACA;EACA;EACA;EACA,OAAO,aAAa;EACpB,QAAQ,aAAa;CACvB;CACA,MAAM,WAAW;EACf,gCAAgC,MAAM,KAAK;EAC3C,QAAQ,IAAI;EACZ,aAAa;EACb,aAAa;CACf,CAAC,CAAC,KAAK,GAAG;CAEV,OAAO,GACJ,UACC,eACA,UACA,OAAO,YAAY;EACjB,IAAI,QAAQ,WAAW,GAAG;GAExB,MAAM,EAAE,OAAO,iBAAiB,QAAQ;GACxC,MAAM,EAAE,cAAc,iBAAiB,EAAE;GACzC,MAAM,kBAAkB,aAAa,QAAQ,UAAU,cAAc,MAAM,cAAc,IAAI,GAAG,KAAK;GACrG,MAAM,UAAU,MAAM,GAAG,6BAA6B,CAAC,MAAM,eAAe,OAAO,cAAc,KAAK;GACtG,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,SAAS,EACvD,WAAW,aAAa,kBAAkB,SAAS,QAAQ,EAC7D,CAAC;GACD,OAAO,CAAC,sBAAsB,IAAI,QAAQ,CAAC;EAC7C;EAEA,MAAM,EAAE,OAAO,cAAc,OAAO,WAAW,QAAQ;EACvD,MAAM,EAAE,cAAc,iBAAiB,EAAE;EACzC,MAAM,kBAAkB,aAAa,QAAQ,UAAU,cAAc,MAAM,cAAc,IAAI,GAAG,KAAK;EAGrG,MAAM,OAAO,sBAAsB,OAAO,OAAO;EACjD,MAAM,cAAc,CAAC;GAAE,YAAY;GAAO,QAAQ;EAAM,GAAG,GAAG,KAAK,KAAK,MAAM,EAAE,MAAM,CAAC;EACvF,MAAM,eAAe,+BAA+B,MAAM,OAAO;EACjE,MAAM,SAA0B;GAC9B,SAAS,CAAC,oBAAoB,SAAS;GACvC,QAAQ,CACN;IAAE,MAAM;IAAW,OAAO;IAAS,OAAO;GAAQ,GAClD;IACE,MAAM;IACN;IACA,OAAO,KAAK;IACZ,OAAO;IACP,WAAW;IACX,UAAU;KAAE;KAAO;IAAO;GAC5B,CACF;GACA,MAAM,CAAC,eAAe,SAAS,aAAa,YAAY,CAAC;GACzD,UAAU,CAAC;EACb;EAEA,MAAM,UAAU,MAAM,GAAG,6BAA6B,CACpD,MACA,eACA,QACA;GAAE,GAAG;GAAc,OAAO,KAAA;GAAW,QAAQ,KAAA;EAAU,GACvD,KACF;EACA,MAAM,UAAU,QAAQ,UAAU,CAAC,CAAQ;EAC3C,GAAG,qBAAqB,CAAC,MAAM,SAAS,EACtC,WAAW,aAAa;GACtB,kBAAkB,SAAS,QAAQ;GAEnC,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;IACxC,MAAM,SAAS,SAAS;IACxB,IAAI,CAAC,OAAO,iBACV,QAAQ,QAAQ,IAAI,GAAG,KAAK,EAAE,CAAC,KAAK,MAAM;GAE9C;EACF,EACF,CAAC;EACD,OAAO;CACT,GACA,EAAE,YAAY,gBAAgB,CAChC,CAAC,CACA,KAAK,QAAQ;AAClB"}
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../Entity.cjs");
3
+ require("../EntityManager.cjs");
4
+ const require_EntityMetadata = require("../EntityMetadata.cjs");
2
5
  const require_keys = require("../keys.cjs");
6
+ const require_loading_loadLens = require("../loading/loadLens.cjs");
3
7
  const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
4
8
  const require_utils = require("../utils.cjs");
5
- const require_EntityMetadata = require("../EntityMetadata.cjs");
6
- const require_loading_loadLens = require("../loading/loadLens.cjs");
7
- require("../EntityManager.cjs");
8
- require("../Entity.cjs");
9
- //#region src/dataloaders/lensDataLoader.ts
9
+ // src/dataloaders/lensDataLoader.ts
10
10
  const lensOperation = "lens";
11
11
  /**
12
12
  * Loads lens paths via SQL.
@@ -171,7 +171,6 @@ function lensDataLoader(em, type, startIsArray, paths) {
171
171
  });
172
172
  });
173
173
  }
174
- //#endregion
175
174
  exports.lensDataLoader = lensDataLoader;
176
175
  exports.lensOperation = lensOperation;
177
176
 
@@ -1,15 +1,12 @@
1
- import { EntityManager, MaybeAbstractEntityConstructor, TaggedId } from "../EntityManager.cjs";
2
1
  import { Entity } from "../Entity.cjs";
2
+ import { EntityManager, MaybeAbstractEntityConstructor, TaggedId } from "../EntityManager.cjs";
3
3
  import DataLoader from "dataloader";
4
- //#region src/dataloaders/lensDataLoader.d.ts
5
- declare const lensOperation = "lens";
4
+ export declare const lensOperation = "lens";
6
5
  /**
7
6
  * Loads lens paths via SQL.
8
7
  *
9
8
  * I.e. instead of loading `author.load(a => a.books.reviews)` by pulling all
10
9
  * Books into memory, we do a join from the Author to BookReviews.
11
10
  */
12
- declare function lensDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, startIsArray: boolean, paths: string[]): DataLoader<TaggedId, T | T[]>;
13
- //#endregion
14
- export { lensDataLoader, lensOperation };
11
+ export declare function lensDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, startIsArray: boolean, paths: string[]): DataLoader<TaggedId, T | T[]>;
15
12
  //# sourceMappingURL=lensDataLoader.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lensDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/lensDataLoader.ts"],"mappings":";;;;cAuBa;;;;;;;iBAQG,eAAe,UAAU,QACvC,IAAI,eACJ,MAAM,+BAA+B,IACrC,uBACA,kBACC,WAAW,UAAU,IAAI"}
1
+ {"version":3,"file":"lensDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/lensDataLoader.ts"],"mappings":";;;qBAuBa;;;;;;;wBAQG,eAAe,UAAU,QACvC,IAAI,eACJ,MAAM,+BAA+B,IACrC,uBACA,kBACC,WAAW,UAAU,IAAI"}
@@ -1,15 +1,12 @@
1
- import { EntityManager, MaybeAbstractEntityConstructor, TaggedId } from "../EntityManager.mjs";
2
1
  import { Entity } from "../Entity.mjs";
2
+ import { EntityManager, MaybeAbstractEntityConstructor, TaggedId } from "../EntityManager.mjs";
3
3
  import DataLoader from "dataloader";
4
- //#region src/dataloaders/lensDataLoader.d.ts
5
- declare const lensOperation = "lens";
4
+ export declare const lensOperation = "lens";
6
5
  /**
7
6
  * Loads lens paths via SQL.
8
7
  *
9
8
  * I.e. instead of loading `author.load(a => a.books.reviews)` by pulling all
10
9
  * Books into memory, we do a join from the Author to BookReviews.
11
10
  */
12
- declare function lensDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, startIsArray: boolean, paths: string[]): DataLoader<TaggedId, T | T[]>;
13
- //#endregion
14
- export { lensDataLoader, lensOperation };
11
+ export declare function lensDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, startIsArray: boolean, paths: string[]): DataLoader<TaggedId, T | T[]>;
15
12
  //# sourceMappingURL=lensDataLoader.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lensDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/lensDataLoader.ts"],"mappings":";;;;cAuBa;;;;;;;iBAQG,eAAe,UAAU,QACvC,IAAI,eACJ,MAAM,+BAA+B,IACrC,uBACA,kBACC,WAAW,UAAU,IAAI"}
1
+ {"version":3,"file":"lensDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/lensDataLoader.ts"],"mappings":";;;qBAuBa;;;;;;;wBAQG,eAAe,UAAU,QACvC,IAAI,eACJ,MAAM,+BAA+B,IACrC,uBACA,kBACC,WAAW,UAAU,IAAI"}
@@ -1,11 +1,11 @@
1
+ import "../Entity.js";
2
+ import "../EntityManager.js";
3
+ import { getBaseMeta, getMetadata } from "../EntityMetadata.js";
1
4
  import { deTagIds, tagId } from "../keys.js";
5
+ import { mapPathsToTarget } from "../loading/loadLens.js";
2
6
  import { addTablePerClassJoinsAndClassTag, maybeAddOrderBy } from "../queries/find/QueryParser.js";
3
7
  import { abbreviation, groupBy } from "../utils.js";
4
- import { getBaseMeta, getMetadata } from "../EntityMetadata.js";
5
- import { mapPathsToTarget } from "../loading/loadLens.js";
6
- import "../EntityManager.js";
7
- import "../Entity.js";
8
- //#region src/dataloaders/lensDataLoader.ts
8
+ // src/dataloaders/lensDataLoader.ts
9
9
  const lensOperation = "lens";
10
10
  /**
11
11
  * Loads lens paths via SQL.
@@ -170,7 +170,6 @@ function lensDataLoader(em, type, startIsArray, paths) {
170
170
  });
171
171
  });
172
172
  }
173
- //#endregion
174
173
  export { lensDataLoader, lensOperation };
175
174
 
176
175
  //# sourceMappingURL=lensDataLoader.js.map
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_keys = require("../keys.cjs");
3
3
  const require_utils = require("../utils.cjs");
4
- //#region src/dataloaders/manyToManyFindDataLoader.ts
4
+ // src/dataloaders/manyToManyFindDataLoader.ts
5
5
  const manyToManyFindOperation = "m2m-find";
6
6
  /** Batches m2m.find/include calls (i.e. that don't fully load the m2m relation). */
7
7
  function manyToManyFindDataLoader(em, collection) {
@@ -77,7 +77,6 @@ async function load(collection, keys) {
77
77
  }));
78
78
  return keys.map((key) => found.has(key));
79
79
  }
80
- //#endregion
81
80
  exports.manyToManyFindDataLoader = manyToManyFindDataLoader;
82
81
  exports.manyToManyFindOperation = manyToManyFindOperation;
83
82
 
@@ -1,12 +1,9 @@
1
+ import { Entity } from "../Entity.cjs";
2
+ import { EntityManager } from "../EntityManager.cjs";
1
3
  import { ManyToManyCollection } from "../relations/ManyToManyCollection.cjs";
2
4
  import { ManyToManyLargeCollection } from "../relations/ManyToManyLargeCollection.cjs";
3
- import { EntityManager } from "../EntityManager.cjs";
4
- import { Entity } from "../Entity.cjs";
5
5
  import DataLoader from "dataloader";
6
- //#region src/dataloaders/manyToManyFindDataLoader.d.ts
7
- declare const manyToManyFindOperation = "m2m-find";
6
+ export declare const manyToManyFindOperation = "m2m-find";
8
7
  /** Batches m2m.find/include calls (i.e. that don't fully load the m2m relation). */
9
- declare function manyToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: ManyToManyCollection<T, U> | ManyToManyLargeCollection<T, U>): DataLoader<string, boolean>;
10
- //#endregion
11
- export { manyToManyFindDataLoader, manyToManyFindOperation };
8
+ export declare function manyToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: ManyToManyCollection<T, U> | ManyToManyLargeCollection<T, U>): DataLoader<string, boolean>;
12
9
  //# sourceMappingURL=manyToManyFindDataLoader.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manyToManyFindDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/manyToManyFindDataLoader.ts"],"mappings":";;;;;;cASa;;iBAGG,yBAAyB,UAAU,QAAQ,UAAU,QACnE,IAAI,eACJ,YAAY,qBAAqB,GAAG,KAAK,0BAA0B,GAAG,KACrE"}
1
+ {"version":3,"file":"manyToManyFindDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/manyToManyFindDataLoader.ts"],"mappings":";;;;;qBASa;;wBAGG,yBAAyB,UAAU,QAAQ,UAAU,QACnE,IAAI,eACJ,YAAY,qBAAqB,GAAG,KAAK,0BAA0B,GAAG,KACrE"}
@@ -1,12 +1,9 @@
1
+ import { Entity } from "../Entity.mjs";
2
+ import { EntityManager } from "../EntityManager.mjs";
1
3
  import { ManyToManyCollection } from "../relations/ManyToManyCollection.mjs";
2
4
  import { ManyToManyLargeCollection } from "../relations/ManyToManyLargeCollection.mjs";
3
- import { EntityManager } from "../EntityManager.mjs";
4
- import { Entity } from "../Entity.mjs";
5
5
  import DataLoader from "dataloader";
6
- //#region src/dataloaders/manyToManyFindDataLoader.d.ts
7
- declare const manyToManyFindOperation = "m2m-find";
6
+ export declare const manyToManyFindOperation = "m2m-find";
8
7
  /** Batches m2m.find/include calls (i.e. that don't fully load the m2m relation). */
9
- declare function manyToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: ManyToManyCollection<T, U> | ManyToManyLargeCollection<T, U>): DataLoader<string, boolean>;
10
- //#endregion
11
- export { manyToManyFindDataLoader, manyToManyFindOperation };
8
+ export declare function manyToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: ManyToManyCollection<T, U> | ManyToManyLargeCollection<T, U>): DataLoader<string, boolean>;
12
9
  //# sourceMappingURL=manyToManyFindDataLoader.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manyToManyFindDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/manyToManyFindDataLoader.ts"],"mappings":";;;;;;cASa;;iBAGG,yBAAyB,UAAU,QAAQ,UAAU,QACnE,IAAI,eACJ,YAAY,qBAAqB,GAAG,KAAK,0BAA0B,GAAG,KACrE"}
1
+ {"version":3,"file":"manyToManyFindDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/manyToManyFindDataLoader.ts"],"mappings":";;;;;qBASa;;wBAGG,yBAAyB,UAAU,QAAQ,UAAU,QACnE,IAAI,eACJ,YAAY,qBAAqB,GAAG,KAAK,0BAA0B,GAAG,KACrE"}
@@ -1,6 +1,6 @@
1
1
  import { keyToNumber, tagId } from "../keys.js";
2
2
  import { abbreviation } from "../utils.js";
3
- //#region src/dataloaders/manyToManyFindDataLoader.ts
3
+ // src/dataloaders/manyToManyFindDataLoader.ts
4
4
  const manyToManyFindOperation = "m2m-find";
5
5
  /** Batches m2m.find/include calls (i.e. that don't fully load the m2m relation). */
6
6
  function manyToManyFindDataLoader(em, collection) {
@@ -76,7 +76,6 @@ async function load(collection, keys) {
76
76
  }));
77
77
  return keys.map((key) => found.has(key));
78
78
  }
79
- //#endregion
80
79
  export { manyToManyFindDataLoader, manyToManyFindOperation };
81
80
 
82
81
  //# sourceMappingURL=manyToManyFindDataLoader.js.map
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_keys = require("../keys.cjs");
3
3
  const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
4
4
  const require_utils = require("../utils.cjs");
5
- //#region src/dataloaders/oneToManyFindDataLoader.ts
5
+ // src/dataloaders/oneToManyFindDataLoader.ts
6
6
  const oneToManyFindOperation = "o2m-find";
7
7
  /** Batches o2m.find/include calls (i.e. that don't fully load the o2m relation). */
8
8
  function oneToManyFindDataLoader(em, collection) {
@@ -70,7 +70,6 @@ function oneToManyFindDataLoader(em, collection) {
70
70
  });
71
71
  });
72
72
  }
73
- //#endregion
74
73
  exports.oneToManyFindDataLoader = oneToManyFindDataLoader;
75
74
  exports.oneToManyFindOperation = oneToManyFindOperation;
76
75
 
@@ -1,12 +1,9 @@
1
+ import { Entity } from "../Entity.cjs";
2
+ import { EntityManager } from "../EntityManager.cjs";
1
3
  import { OneToManyCollection } from "../relations/OneToManyCollection.cjs";
2
4
  import { OneToManyLargeCollection } from "../relations/OneToManyLargeCollection.cjs";
3
- import { EntityManager } from "../EntityManager.cjs";
4
- import { Entity } from "../Entity.cjs";
5
5
  import DataLoader from "dataloader";
6
- //#region src/dataloaders/oneToManyFindDataLoader.d.ts
7
- declare const oneToManyFindOperation = "o2m-find";
6
+ export declare const oneToManyFindOperation = "o2m-find";
8
7
  /** Batches o2m.find/include calls (i.e. that don't fully load the o2m relation). */
9
- declare function oneToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: OneToManyCollection<T, U> | OneToManyLargeCollection<T, U>): DataLoader<string, U | undefined>;
10
- //#endregion
11
- export { oneToManyFindDataLoader, oneToManyFindOperation };
8
+ export declare function oneToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: OneToManyCollection<T, U> | OneToManyLargeCollection<T, U>): DataLoader<string, U | undefined>;
12
9
  //# sourceMappingURL=oneToManyFindDataLoader.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oneToManyFindDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/oneToManyFindDataLoader.ts"],"mappings":";;;;;;cASa;;iBAGG,wBAAwB,UAAU,QAAQ,UAAU,QAClE,IAAI,eACJ,YAAY,oBAAoB,GAAG,KAAK,yBAAyB,GAAG,KACnE,mBAAmB"}
1
+ {"version":3,"file":"oneToManyFindDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/oneToManyFindDataLoader.ts"],"mappings":";;;;;qBASa;;wBAGG,wBAAwB,UAAU,QAAQ,UAAU,QAClE,IAAI,eACJ,YAAY,oBAAoB,GAAG,KAAK,yBAAyB,GAAG,KACnE,mBAAmB"}
@@ -1,12 +1,9 @@
1
+ import { Entity } from "../Entity.mjs";
2
+ import { EntityManager } from "../EntityManager.mjs";
1
3
  import { OneToManyCollection } from "../relations/OneToManyCollection.mjs";
2
4
  import { OneToManyLargeCollection } from "../relations/OneToManyLargeCollection.mjs";
3
- import { EntityManager } from "../EntityManager.mjs";
4
- import { Entity } from "../Entity.mjs";
5
5
  import DataLoader from "dataloader";
6
- //#region src/dataloaders/oneToManyFindDataLoader.d.ts
7
- declare const oneToManyFindOperation = "o2m-find";
6
+ export declare const oneToManyFindOperation = "o2m-find";
8
7
  /** Batches o2m.find/include calls (i.e. that don't fully load the o2m relation). */
9
- declare function oneToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: OneToManyCollection<T, U> | OneToManyLargeCollection<T, U>): DataLoader<string, U | undefined>;
10
- //#endregion
11
- export { oneToManyFindDataLoader, oneToManyFindOperation };
8
+ export declare function oneToManyFindDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: OneToManyCollection<T, U> | OneToManyLargeCollection<T, U>): DataLoader<string, U | undefined>;
12
9
  //# sourceMappingURL=oneToManyFindDataLoader.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oneToManyFindDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/oneToManyFindDataLoader.ts"],"mappings":";;;;;;cASa;;iBAGG,wBAAwB,UAAU,QAAQ,UAAU,QAClE,IAAI,eACJ,YAAY,oBAAoB,GAAG,KAAK,yBAAyB,GAAG,KACnE,mBAAmB"}
1
+ {"version":3,"file":"oneToManyFindDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/oneToManyFindDataLoader.ts"],"mappings":";;;;;qBASa;;wBAGG,wBAAwB,UAAU,QAAQ,UAAU,QAClE,IAAI,eACJ,YAAY,oBAAoB,GAAG,KAAK,yBAAyB,GAAG,KACnE,mBAAmB"}
@@ -1,7 +1,7 @@
1
1
  import { keyToNumber } from "../keys.js";
2
2
  import { addTablePerClassJoinsAndClassTag } from "../queries/find/QueryParser.js";
3
3
  import { abbreviation } from "../utils.js";
4
- //#region src/dataloaders/oneToManyFindDataLoader.ts
4
+ // src/dataloaders/oneToManyFindDataLoader.ts
5
5
  const oneToManyFindOperation = "o2m-find";
6
6
  /** Batches o2m.find/include calls (i.e. that don't fully load the o2m relation). */
7
7
  function oneToManyFindDataLoader(em, collection) {
@@ -69,7 +69,6 @@ function oneToManyFindDataLoader(em, collection) {
69
69
  });
70
70
  });
71
71
  }
72
- //#endregion
73
72
  export { oneToManyFindDataLoader, oneToManyFindOperation };
74
73
 
75
74
  //# sourceMappingURL=oneToManyFindDataLoader.js.map
@@ -1,16 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_BaseEntity = require("./BaseEntity.cjs");
3
+ require("./Entity.cjs");
4
+ const require_relations_Reference = require("./relations/Reference.cjs");
5
+ const require_EntityMetadata = require("./EntityMetadata.cjs");
6
+ const require_fields = require("./fields.cjs");
2
7
  const require_normalizeHints = require("./normalizeHints.cjs");
3
8
  const require_reactivity_reactiveHints = require("./reactivity/reactiveHints.cjs");
4
- const require_fields = require("./fields.cjs");
5
- const require_relations_Reference = require("./relations/Reference.cjs");
6
9
  require("./relations/index.cjs");
7
- const require_utils = require("./utils.cjs");
8
- const require_EntityMetadata = require("./EntityMetadata.cjs");
9
10
  const require_trusted = require("./trusted.cjs");
10
- require("./Entity.cjs");
11
- const require_BaseEntity = require("./BaseEntity.cjs");
11
+ const require_utils = require("./utils.cjs");
12
12
  let joist_utils = require("joist-utils");
13
- //#region src/defaults.ts
13
+ // src/defaults.ts
14
14
  function hasDefaultValue(meta, fieldName) {
15
15
  return require_EntityMetadata.getBaseAndSelfMetas(meta).some((m) => fieldName in m.config.__data.syncDefaults || fieldName in m.config.__data.asyncDefaults);
16
16
  }
@@ -184,7 +184,6 @@ var DependencyTracker = class {
184
184
  function isRelation(field) {
185
185
  return field.kind !== "primitive" && field.kind !== "enum";
186
186
  }
187
- //#endregion
188
187
  exports.AsyncDefault = AsyncDefault;
189
188
  exports.getDefaultDependencies = getDefaultDependencies;
190
189
  exports.hasDefaultValue = hasDefaultValue;
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.cjs","names":["getBaseAndSelfMetas","runInTrustedContext","getMetadata","getInstanceData","isLoadedReference","#loadHint","convertToLoadHint","#deps","normalizeHint","#deferreds","fail","Deferred"],"sources":["../src/defaults.ts"],"sourcesContent":["import { Deferred } from \"joist-utils\";\nimport { getInstanceData } from \"src/BaseEntity.ts\";\nimport { type Entity } from \"src/Entity.ts\";\nimport {\n type EntityMetadata,\n type EnumField,\n type Field,\n type PrimitiveField,\n getBaseAndSelfMetas,\n getMetadata,\n} from \"src/EntityMetadata.ts\";\nimport { setField } from \"src/fields.ts\";\nimport { normalizeHint } from \"src/normalizeHints.ts\";\nimport { type ReactiveHint, convertToLoadHint } from \"src/reactivity/reactiveHints.ts\";\nimport { isLoadedReference } from \"src/relations/index.ts\";\nimport { runInTrustedContext } from \"src/trusted.ts\";\nimport { fail, failIfAnyRejected } from \"src/utils.ts\";\n\nexport function hasDefaultValue(meta: EntityMetadata, fieldName: string): boolean {\n return getBaseAndSelfMetas(meta).some(\n (m) => fieldName in m.config.__data.syncDefaults || fieldName in m.config.__data.asyncDefaults,\n );\n}\n\n/** Run the sync defaults for `entity`. */\nexport function setSyncDefaults(entity: Entity): void {\n return runInTrustedContext(() => {\n const meta = getMetadata(entity);\n // Allow subtypes to override base setDefaults\n const syncDefaults: Record<string, any> = getBaseAndSelfMetas(meta).reduce(\n (acc, m) => ({ ...acc, ...m.config.__data.syncDefaults }),\n {},\n );\n for (const [fieldName, maybeFn] of Object.entries(syncDefaults)) {\n const field = meta.allFields[fieldName];\n // Use allFields in case a subtype sets a default for one of its base fields\n if (\n (field.kind === \"primitive\" || field.kind === \"enum\") &&\n (field as PrimitiveField | EnumField).derived === \"async\"\n ) {\n // If this is an AsyncReactiveField, we want to push in a default, but setOpts is called\n // from the codegen constructor, so the user-defined `hasAsyncReactiveField` fields will\n // not have been initialized yet (i.e. `entity[field]` will be undefined and not yet an\n // `instanceof AsyncReactiveField`). Thankfully we can just use setField.\n const value = maybeFn instanceof Function ? maybeFn(entity) : maybeFn;\n setField(entity, fieldName, value);\n } else if (!isRelation(field)) {\n const hasBeenSet = fieldName in getInstanceData(entity).data;\n if (!hasBeenSet) {\n const value = maybeFn instanceof Function ? maybeFn(entity) : maybeFn;\n // If the value is undefined, leave it unset, so that a default invoked during\n // the constructor being called (before any other opts are set) can be called\n // again during `em.flush` and get an opportunity to observe other fields.\n if (value !== undefined) {\n (entity as any)[fieldName] = value;\n }\n }\n } else {\n const value = (entity as any)[fieldName];\n if (isLoadedReference(value) && !value.isSet && !value.hasBeenSet) {\n // A sync default usually would never be for a reference, because reference defaults usually\n // require a field hint (so would be async) to get \"the other entity\". However, something like:\n // `config.setDefault(\"original\", (self) => self);` is technically valid.\n value.set(maybeFn instanceof Function ? maybeFn(entity) : maybeFn);\n }\n }\n }\n });\n}\n\n/** Runs the async defaults for all inserted entities in `todos`. */\nexport async function setAsyncDefaults(\n suppressedTypeErrors: Error[],\n ctx: unknown,\n // We want this to be per-subtype, so that a subtype can have its own default, and we still invoke\n // the subtype `setOnEntities(...all subtype entities...)` and `setOnEntities(...any base types...)`\n // as bulk calls.\n insertsBySubType: Map<EntityMetadata, Entity[]>,\n): Promise<void> {\n return runInTrustedContext(async () => {\n const dt = new DependencyTracker(insertsBySubType);\n const results = await Promise.allSettled(\n [...insertsBySubType.entries()].flatMap(([meta, inserts]) => {\n // configure will have copy/pasted base defaults into our config, so we can loop over it directly\n return Object.values(meta.config.__data.asyncDefaults).map((df) =>\n df.setOnEntities(ctx, dt, suppressedTypeErrors, meta, inserts),\n );\n }),\n );\n failIfAnyRejected(results);\n });\n}\n\n/** Sets async defaults *synchronously*, only safe for factories with `DeepNew` entities. */\nexport function setAsyncDefaultsSynchronously(ctx: unknown, entity: Entity): void {\n return runInTrustedContext(() => {\n // configure will have copy/pasted base defaults into our config, so we can loop over it directly\n for (const df of Object.values(getMetadata(entity).config.__data.asyncDefaults)) {\n df.setOnFactoryEntity(ctx, entity);\n }\n });\n}\n\n/** Wraps the hint + lambda of an async `setDefault`. */\nexport class AsyncDefault<T extends Entity> {\n readonly fieldName: string;\n readonly fieldHint: ReactiveHint<T>;\n readonly fn: (entity: any, ctx: any) => any;\n #loadHint: any;\n // We can't calc this until post-boot because it requires following metadata\n #deps: DefaultDependency[] | undefined;\n\n constructor(fieldName: string, fieldHint: ReactiveHint<T>, fn: (entity: T, ctx: any) => any) {\n this.fieldName = fieldName;\n this.fieldHint = fieldHint;\n this.fn = fn;\n }\n\n /** Given a list of inserts of the same type/subtype, set ourselves on each of them. */\n async setOnEntities(\n ctx: any,\n dt: DependencyTracker,\n suppressedTypeErrors: Error[],\n baseMetadata: EntityMetadata,\n inserts: T[],\n ): Promise<any> {\n try {\n // Ensure our dependencies have been set\n // (...and only wait on dependencies that are actively being calculated)\n const deps = this.deps(baseMetadata).filter((dep) => dt.hasMaybePending(dep.meta));\n if (deps.length > 0) {\n // console.log(\n // \"WAITING ON\",\n // deps.map((dep) => `${dep.meta.type}.${dep.fieldName}`),\n // `FOR ${baseMetadata.type}.${this.fieldName}`,\n // );\n // deps promises shouldn't reject, so we should be fine w/o allSettled here\n await Promise.all(deps.map((dep) => dt.getDeferred(dep.meta, dep.fieldName).promise));\n }\n\n // Run our default for all entities, use allSettled to avoid leaving lambdas running if one fails\n const results = await Promise.allSettled(\n inserts\n .map(async (entity) => {\n if (!isRelation(baseMetadata.allFields[this.fieldName])) {\n const hasBeenSet = this.fieldName in getInstanceData(entity).data;\n if (!hasBeenSet) {\n const value = await this.getValue(entity, ctx);\n if (value !== undefined) {\n (entity as any)[this.fieldName] = value;\n }\n }\n } else {\n const value = (entity as any)[this.fieldName];\n if (isLoadedReference(value) && !value.isSet && !value.hasBeenSet) {\n const val = await this.getValue(entity, ctx);\n if (val !== undefined) {\n value.set(val);\n }\n }\n }\n })\n .map((promise) =>\n promise.catch((reason) => {\n // If we NPE-d because a required field wasn't set, hold on to this and\n // let the validation failures reject the `em.flush` instead of us\n if (reason instanceof TypeError) {\n suppressedTypeErrors.push(reason);\n } else {\n throw reason;\n }\n }),\n ),\n );\n failIfAnyRejected(results);\n } finally {\n // Mark ourselves as complete (from a `finally` just in case our `setDefault`\n // blows up, we don't forever block the other defaults waiting on us).\n // console.log(`FINISHED ${baseMetadata.type}.${this.fieldName}`);\n dt.getDeferred(baseMetadata, this.fieldName).resolve();\n }\n }\n\n setOnFactoryEntity(ctx: unknown, entity: T): void {\n // If the lambda uses the `async` keyword, it definitely makes a promise, so don't invoke it\n // from a synchronous factory call.\n if (this.fn.constructor.name === \"AsyncFunction\") return;\n const value = (entity as any)[this.fieldName];\n try {\n if (value === undefined || (isLoadedReference(value) && !value.isSet)) {\n const val = this.fn(entity, ctx);\n // Even though we checked `async () => ...` above, a lambda could still return a Promise\n if (val instanceof Promise) {\n throw new Error(\n `Use the \\`async\\` keyword for the setDefault \"${this.fieldName}\" function that returns a Promise`,\n );\n } else if (val === undefined) {\n // If val is undefined, let the setDefault get invoked again later\n } else {\n if (isLoadedReference(value)) {\n value.set(val);\n } else {\n (entity as any)[this.fieldName] = val;\n }\n }\n }\n } catch (e) {\n // It's likely common to get NPEs/TypeErrors from speculatively executing defaults\n // pre-em.flush, i.e. we don't have the DependencyTracker/etc infra here, the lambdas\n // could do a `book.author.get.name` and NPE on the `author.get.name`. So instead just\n // suppress errors and assume `em.flush` will try again.\n // ...we need to add a NotLoadedError\n // if (!(e instanceof TypeError || e instanceof NotL)) {\n // throw e;\n // }\n }\n }\n\n /** For the given `entity`, returns what the default value should be. */\n private getValue(entity: T, ctx: any): Promise<any> {\n // We can't convert this until now, since it requires the `metadata`\n this.#loadHint ??= convertToLoadHint(getMetadata(entity), this.fieldHint);\n return entity.em.populate(entity, this.#loadHint).then((loaded) => this.fn(loaded, ctx));\n }\n\n // Calc once and cache\n private deps(meta: EntityMetadata): DefaultDependency[] {\n return (this.#deps ??= getDefaultDependencies(meta, this.fieldName, this.fieldHint));\n }\n}\n\ntype DefaultDependency = {\n meta: EntityMetadata;\n fieldName: string;\n};\n\n/**\n * Given a `meta` and a nested field hint, return the meta+field tuples included within the hint.\n *\n * I.e. passing `{ author: { firstName: {}, publisher: \"name\" } }` would return `[[Author, \"firstName\"],\n * [Publisher, \"name\"]]`.\n */\nexport function getDefaultDependencies<T extends Entity>(\n baseMeta: EntityMetadata<T>,\n baseFieldName: string,\n baseHint: ReactiveHint<T>,\n): DefaultDependency[] {\n // Ensure the hint is an `{ ... }`\n const deps: DefaultDependency[] = [];\n const todo: [meta: EntityMetadata, hint: ReactiveHint<any>][] = [[baseMeta, normalizeHint(baseHint)]];\n while (todo.length !== 0) {\n const [meta, hint] = todo.pop()!;\n for (const [fieldName, nestedHint] of Object.entries(hint)) {\n const field = meta.allFields[fieldName];\n // Super naive circular dependency detection\n const isSameField = meta === baseMeta && fieldName === baseFieldName;\n if (isSameField) continue;\n // If this is an invalid hint, just ignore it, and assume someone else will fail on it\n if (!field) continue;\n switch (field.kind) {\n case \"enum\":\n case \"primitive\":\n if (field.default === \"config\" && fieldName in meta.config.__data.asyncDefaults) {\n deps.push({ meta, fieldName });\n }\n break;\n case \"m2o\":\n if (field.default === \"config\" && fieldName in meta.config.__data.asyncDefaults) {\n deps.push({ meta, fieldName });\n }\n if (nestedHint) {\n todo.push([field.otherMetadata(), normalizeHint(nestedHint)]);\n }\n break;\n case \"o2o\":\n case \"o2m\":\n case \"m2m\":\n if (nestedHint) {\n todo.push([field.otherMetadata(), normalizeHint(nestedHint)]);\n }\n break;\n }\n }\n }\n return deps;\n}\n\n/**\n * This tracks cross-default dependencies that are active within a single `em.flush` loop.\n *\n * I.e. this is not a static \"the Author.firstName in general depends on Publisher.whatever\",\n * it tracks that we're actively inserting 10 new `Author` instances, and their `firstName`\n * default needs to wait until the `Publisher.whatever` fields have their async default\n * calculated.\n *\n * Really this is just a smaller wrapper around a map of `Deferred`s.\n */\nclass DependencyTracker {\n // Create a map \"entityType -> fieldName -> deferred\"\n #deferreds = new Map<string, Map<string, Deferred<void>>>();\n\n constructor(insertsBySubType: Map<EntityMetadata, Entity[]>) {\n // Seed it with any entities that we're actively inserting (as any dependencies to\n // entities that aren't even having `setDefault` called can be skipped)\n for (const meta of [...insertsBySubType.keys()]) {\n this.#deferreds.set(meta.type, new Map());\n }\n }\n\n hasMaybePending(meta: EntityMetadata): boolean {\n return this.#deferreds.has(meta.type) ?? false;\n }\n\n getDeferred(meta: EntityMetadata, fieldName: string): Deferred<void> {\n const map = this.#deferreds.get(meta.type) ?? fail(`No deferred check necessary for ${meta.type}.${fieldName}`);\n let deferred = map.get(fieldName);\n if (!deferred) {\n deferred = new Deferred();\n map.set(fieldName, deferred);\n }\n return deferred;\n }\n}\n\nfunction isRelation(field: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K,IAAI,KAAKC,cAAAA,KAAK,mCAAmC,KAAK,KAAK,GAAG,WAAW;EAC9G,IAAI,WAAW,IAAI,IAAI,SAAS;EAChC,IAAI,CAAC,UAAU;GACb,WAAW,IAAIC,YAAAA,SAAS;GACxB,IAAI,IAAI,WAAW,QAAQ;EAC7B;EACA,OAAO;CACT;AACF;AAEA,SAAS,WAAW,OAAuB;CACzC,OAAO,MAAM,SAAS,eAAe,MAAM,SAAS;AACtD"}
1
+ {"version":3,"file":"defaults.cjs","names":["getBaseAndSelfMetas","runInTrustedContext","getMetadata","getInstanceData","isLoadedReference","convertToLoadHint","normalizeHint","fail","Deferred"],"sources":["../src/defaults.ts"],"sourcesContent":["import { Deferred } from \"joist-utils\";\nimport { getInstanceData } from \"src/BaseEntity.ts\";\nimport { type Entity } from \"src/Entity.ts\";\nimport {\n type EntityMetadata,\n type EnumField,\n type Field,\n type PrimitiveField,\n getBaseAndSelfMetas,\n getMetadata,\n} from \"src/EntityMetadata.ts\";\nimport { setField } from \"src/fields.ts\";\nimport { normalizeHint } from \"src/normalizeHints.ts\";\nimport { type ReactiveHint, convertToLoadHint } from \"src/reactivity/reactiveHints.ts\";\nimport { isLoadedReference } from \"src/relations/index.ts\";\nimport { runInTrustedContext } from \"src/trusted.ts\";\nimport { fail, failIfAnyRejected } from \"src/utils.ts\";\n\nexport function hasDefaultValue(meta: EntityMetadata, fieldName: string): boolean {\n return getBaseAndSelfMetas(meta).some(\n (m) => fieldName in m.config.__data.syncDefaults || fieldName in m.config.__data.asyncDefaults,\n );\n}\n\n/** Run the sync defaults for `entity`. */\nexport function setSyncDefaults(entity: Entity): void {\n return runInTrustedContext(() => {\n const meta = getMetadata(entity);\n // Allow subtypes to override base setDefaults\n const syncDefaults: Record<string, any> = getBaseAndSelfMetas(meta).reduce(\n (acc, m) => ({ ...acc, ...m.config.__data.syncDefaults }),\n {},\n );\n for (const [fieldName, maybeFn] of Object.entries(syncDefaults)) {\n const field = meta.allFields[fieldName];\n // Use allFields in case a subtype sets a default for one of its base fields\n if (\n (field.kind === \"primitive\" || field.kind === \"enum\") &&\n (field as PrimitiveField | EnumField).derived === \"async\"\n ) {\n // If this is an AsyncReactiveField, we want to push in a default, but setOpts is called\n // from the codegen constructor, so the user-defined `hasAsyncReactiveField` fields will\n // not have been initialized yet (i.e. `entity[field]` will be undefined and not yet an\n // `instanceof AsyncReactiveField`). Thankfully we can just use setField.\n const value = maybeFn instanceof Function ? maybeFn(entity) : maybeFn;\n setField(entity, fieldName, value);\n } else if (!isRelation(field)) {\n const hasBeenSet = fieldName in getInstanceData(entity).data;\n if (!hasBeenSet) {\n const value = maybeFn instanceof Function ? maybeFn(entity) : maybeFn;\n // If the value is undefined, leave it unset, so that a default invoked during\n // the constructor being called (before any other opts are set) can be called\n // again during `em.flush` and get an opportunity to observe other fields.\n if (value !== undefined) {\n (entity as any)[fieldName] = value;\n }\n }\n } else {\n const value = (entity as any)[fieldName];\n if (isLoadedReference(value) && !value.isSet && !value.hasBeenSet) {\n // A sync default usually would never be for a reference, because reference defaults usually\n // require a field hint (so would be async) to get \"the other entity\". However, something like:\n // `config.setDefault(\"original\", (self) => self);` is technically valid.\n value.set(maybeFn instanceof Function ? maybeFn(entity) : maybeFn);\n }\n }\n }\n });\n}\n\n/** Runs the async defaults for all inserted entities in `todos`. */\nexport async function setAsyncDefaults(\n suppressedTypeErrors: Error[],\n ctx: unknown,\n // We want this to be per-subtype, so that a subtype can have its own default, and we still invoke\n // the subtype `setOnEntities(...all subtype entities...)` and `setOnEntities(...any base types...)`\n // as bulk calls.\n insertsBySubType: Map<EntityMetadata, Entity[]>,\n): Promise<void> {\n return runInTrustedContext(async () => {\n const dt = new DependencyTracker(insertsBySubType);\n const results = await Promise.allSettled(\n [...insertsBySubType.entries()].flatMap(([meta, inserts]) => {\n // configure will have copy/pasted base defaults into our config, so we can loop over it directly\n return Object.values(meta.config.__data.asyncDefaults).map((df) =>\n df.setOnEntities(ctx, dt, suppressedTypeErrors, meta, inserts),\n );\n }),\n );\n failIfAnyRejected(results);\n });\n}\n\n/** Sets async defaults *synchronously*, only safe for factories with `DeepNew` entities. */\nexport function setAsyncDefaultsSynchronously(ctx: unknown, entity: Entity): void {\n return runInTrustedContext(() => {\n // configure will have copy/pasted base defaults into our config, so we can loop over it directly\n for (const df of Object.values(getMetadata(entity).config.__data.asyncDefaults)) {\n df.setOnFactoryEntity(ctx, entity);\n }\n });\n}\n\n/** Wraps the hint + lambda of an async `setDefault`. */\nexport class AsyncDefault<T extends Entity> {\n readonly fieldName: string;\n readonly fieldHint: ReactiveHint<T>;\n readonly fn: (entity: any, ctx: any) => any;\n #loadHint: any;\n // We can't calc this until post-boot because it requires following metadata\n #deps: DefaultDependency[] | undefined;\n\n constructor(fieldName: string, fieldHint: ReactiveHint<T>, fn: (entity: T, ctx: any) => any) {\n this.fieldName = fieldName;\n this.fieldHint = fieldHint;\n this.fn = fn;\n }\n\n /** Given a list of inserts of the same type/subtype, set ourselves on each of them. */\n async setOnEntities(\n ctx: any,\n dt: DependencyTracker,\n suppressedTypeErrors: Error[],\n baseMetadata: EntityMetadata,\n inserts: T[],\n ): Promise<any> {\n try {\n // Ensure our dependencies have been set\n // (...and only wait on dependencies that are actively being calculated)\n const deps = this.deps(baseMetadata).filter((dep) => dt.hasMaybePending(dep.meta));\n if (deps.length > 0) {\n // console.log(\n // \"WAITING ON\",\n // deps.map((dep) => `${dep.meta.type}.${dep.fieldName}`),\n // `FOR ${baseMetadata.type}.${this.fieldName}`,\n // );\n // deps promises shouldn't reject, so we should be fine w/o allSettled here\n await Promise.all(deps.map((dep) => dt.getDeferred(dep.meta, dep.fieldName).promise));\n }\n\n // Run our default for all entities, use allSettled to avoid leaving lambdas running if one fails\n const results = await Promise.allSettled(\n inserts\n .map(async (entity) => {\n if (!isRelation(baseMetadata.allFields[this.fieldName])) {\n const hasBeenSet = this.fieldName in getInstanceData(entity).data;\n if (!hasBeenSet) {\n const value = await this.getValue(entity, ctx);\n if (value !== undefined) {\n (entity as any)[this.fieldName] = value;\n }\n }\n } else {\n const value = (entity as any)[this.fieldName];\n if (isLoadedReference(value) && !value.isSet && !value.hasBeenSet) {\n const val = await this.getValue(entity, ctx);\n if (val !== undefined) {\n value.set(val);\n }\n }\n }\n })\n .map((promise) =>\n promise.catch((reason) => {\n // If we NPE-d because a required field wasn't set, hold on to this and\n // let the validation failures reject the `em.flush` instead of us\n if (reason instanceof TypeError) {\n suppressedTypeErrors.push(reason);\n } else {\n throw reason;\n }\n }),\n ),\n );\n failIfAnyRejected(results);\n } finally {\n // Mark ourselves as complete (from a `finally` just in case our `setDefault`\n // blows up, we don't forever block the other defaults waiting on us).\n // console.log(`FINISHED ${baseMetadata.type}.${this.fieldName}`);\n dt.getDeferred(baseMetadata, this.fieldName).resolve();\n }\n }\n\n setOnFactoryEntity(ctx: unknown, entity: T): void {\n // If the lambda uses the `async` keyword, it definitely makes a promise, so don't invoke it\n // from a synchronous factory call.\n if (this.fn.constructor.name === \"AsyncFunction\") return;\n const value = (entity as any)[this.fieldName];\n try {\n if (value === undefined || (isLoadedReference(value) && !value.isSet)) {\n const val = this.fn(entity, ctx);\n // Even though we checked `async () => ...` above, a lambda could still return a Promise\n if (val instanceof Promise) {\n throw new Error(\n `Use the \\`async\\` keyword for the setDefault \"${this.fieldName}\" function that returns a Promise`,\n );\n } else if (val === undefined) {\n // If val is undefined, let the setDefault get invoked again later\n } else {\n if (isLoadedReference(value)) {\n value.set(val);\n } else {\n (entity as any)[this.fieldName] = val;\n }\n }\n }\n } catch (e) {\n // It's likely common to get NPEs/TypeErrors from speculatively executing defaults\n // pre-em.flush, i.e. we don't have the DependencyTracker/etc infra here, the lambdas\n // could do a `book.author.get.name` and NPE on the `author.get.name`. So instead just\n // suppress errors and assume `em.flush` will try again.\n // ...we need to add a NotLoadedError\n // if (!(e instanceof TypeError || e instanceof NotL)) {\n // throw e;\n // }\n }\n }\n\n /** For the given `entity`, returns what the default value should be. */\n private getValue(entity: T, ctx: any): Promise<any> {\n // We can't convert this until now, since it requires the `metadata`\n this.#loadHint ??= convertToLoadHint(getMetadata(entity), this.fieldHint);\n return entity.em.populate(entity, this.#loadHint).then((loaded) => this.fn(loaded, ctx));\n }\n\n // Calc once and cache\n private deps(meta: EntityMetadata): DefaultDependency[] {\n return (this.#deps ??= getDefaultDependencies(meta, this.fieldName, this.fieldHint));\n }\n}\n\ntype DefaultDependency = {\n meta: EntityMetadata;\n fieldName: string;\n};\n\n/**\n * Given a `meta` and a nested field hint, return the meta+field tuples included within the hint.\n *\n * I.e. passing `{ author: { firstName: {}, publisher: \"name\" } }` would return `[[Author, \"firstName\"],\n * [Publisher, \"name\"]]`.\n */\nexport function getDefaultDependencies<T extends Entity>(\n baseMeta: EntityMetadata<T>,\n baseFieldName: string,\n baseHint: ReactiveHint<T>,\n): DefaultDependency[] {\n // Ensure the hint is an `{ ... }`\n const deps: DefaultDependency[] = [];\n const todo: [meta: EntityMetadata, hint: ReactiveHint<any>][] = [[baseMeta, normalizeHint(baseHint)]];\n while (todo.length !== 0) {\n const [meta, hint] = todo.pop()!;\n for (const [fieldName, nestedHint] of Object.entries(hint)) {\n const field = meta.allFields[fieldName];\n // Super naive circular dependency detection\n const isSameField = meta === baseMeta && fieldName === baseFieldName;\n if (isSameField) continue;\n // If this is an invalid hint, just ignore it, and assume someone else will fail on it\n if (!field) continue;\n switch (field.kind) {\n case \"enum\":\n case \"primitive\":\n if (field.default === \"config\" && fieldName in meta.config.__data.asyncDefaults) {\n deps.push({ meta, fieldName });\n }\n break;\n case \"m2o\":\n if (field.default === \"config\" && fieldName in meta.config.__data.asyncDefaults) {\n deps.push({ meta, fieldName });\n }\n if (nestedHint) {\n todo.push([field.otherMetadata(), normalizeHint(nestedHint)]);\n }\n break;\n case \"o2o\":\n case \"o2m\":\n case \"m2m\":\n if (nestedHint) {\n todo.push([field.otherMetadata(), normalizeHint(nestedHint)]);\n }\n break;\n }\n }\n }\n return deps;\n}\n\n/**\n * This tracks cross-default dependencies that are active within a single `em.flush` loop.\n *\n * I.e. this is not a static \"the Author.firstName in general depends on Publisher.whatever\",\n * it tracks that we're actively inserting 10 new `Author` instances, and their `firstName`\n * default needs to wait until the `Publisher.whatever` fields have their async default\n * calculated.\n *\n * Really this is just a smaller wrapper around a map of `Deferred`s.\n */\nclass DependencyTracker {\n // Create a map \"entityType -> fieldName -> deferred\"\n #deferreds = new Map<string, Map<string, Deferred<void>>>();\n\n constructor(insertsBySubType: Map<EntityMetadata, Entity[]>) {\n // Seed it with any entities that we're actively inserting (as any dependencies to\n // entities that aren't even having `setDefault` called can be skipped)\n for (const meta of [...insertsBySubType.keys()]) {\n this.#deferreds.set(meta.type, new Map());\n }\n }\n\n hasMaybePending(meta: EntityMetadata): boolean {\n return this.#deferreds.has(meta.type) ?? false;\n }\n\n getDeferred(meta: EntityMetadata, fieldName: string): Deferred<void> {\n const map = this.#deferreds.get(meta.type) ?? fail(`No deferred check necessary for ${meta.type}.${fieldName}`);\n let deferred = map.get(fieldName);\n if (!deferred) {\n deferred = new Deferred();\n map.set(fieldName, deferred);\n }\n return deferred;\n }\n}\n\nfunction isRelation(field: Field): boolean {\n return field.kind !== \"primitive\" && field.kind !== \"enum\";\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAgB,gBAAgB,MAAsB,WAA4B;CAChF,OAAOA,uBAAAA,oBAAoB,IAAI,CAAC,CAAC,MAC9B,MAAM,aAAa,EAAE,OAAO,OAAO,gBAAgB,aAAa,EAAE,OAAO,OAAO,aACnF;AACF;;AAGA,SAAgB,gBAAgB,QAAsB;CACpD,OAAOC,gBAAAA,0BAA0B;EAC/B,MAAM,OAAOC,uBAAAA,YAAY,MAAM;EAE/B,MAAM,eAAoCF,uBAAAA,oBAAoB,IAAI,CAAC,CAAC,QACjE,KAAK,OAAO;GAAE,GAAG;GAAK,GAAG,EAAE,OAAO,OAAO;EAAa,IACvD,CAAC,CACH;EACA,KAAK,MAAM,CAAC,WAAW,YAAY,OAAO,QAAQ,YAAY,GAAG;GAC/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