joist-core 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1548) hide show
  1. package/build/BaseEntity.cjs +112 -0
  2. package/build/BaseEntity.cjs.map +1 -0
  3. package/build/BaseEntity.d.cts +73 -0
  4. package/build/BaseEntity.d.cts.map +1 -0
  5. package/build/BaseEntity.d.mts +73 -0
  6. package/build/BaseEntity.d.mts.map +1 -0
  7. package/build/BaseEntity.js +99 -110
  8. package/build/BaseEntity.js.map +1 -1
  9. package/build/Entity.cjs +12 -0
  10. package/build/Entity.cjs.map +1 -0
  11. package/build/Entity.d.cts +42 -0
  12. package/build/Entity.d.cts.map +1 -0
  13. package/build/Entity.d.mts +42 -0
  14. package/build/Entity.d.mts.map +1 -0
  15. package/build/Entity.js +8 -5
  16. package/build/Entity.js.map +1 -1
  17. package/build/EntityFields.cjs +1 -0
  18. package/build/EntityFields.d.cts +36 -0
  19. package/build/EntityFields.d.cts.map +1 -0
  20. package/build/EntityFields.d.mts +36 -0
  21. package/build/EntityFields.d.mts.map +1 -0
  22. package/build/EntityFields.js +1 -3
  23. package/build/EntityManager.cjs +1935 -0
  24. package/build/EntityManager.cjs.map +1 -0
  25. package/build/EntityManager.d.cts +835 -0
  26. package/build/EntityManager.d.cts.map +1 -0
  27. package/build/EntityManager.d.mts +835 -0
  28. package/build/EntityManager.d.mts.map +1 -0
  29. package/build/EntityManager.js +1812 -2211
  30. package/build/EntityManager.js.map +1 -1
  31. package/build/EntityMetadata.cjs +75 -0
  32. package/build/EntityMetadata.cjs.map +1 -0
  33. package/build/EntityMetadata.d.cts +262 -0
  34. package/build/EntityMetadata.d.cts.map +1 -0
  35. package/build/EntityMetadata.d.mts +262 -0
  36. package/build/EntityMetadata.d.mts.map +1 -0
  37. package/build/EntityMetadata.js +31 -48
  38. package/build/EntityMetadata.js.map +1 -1
  39. package/build/EnumMetadata.cjs +1 -0
  40. package/build/EnumMetadata.d.cts +18 -0
  41. package/build/EnumMetadata.d.cts.map +1 -0
  42. package/build/EnumMetadata.d.mts +18 -0
  43. package/build/EnumMetadata.d.mts.map +1 -0
  44. package/build/EnumMetadata.js +1 -3
  45. package/build/IndexManager.cjs +176 -0
  46. package/build/IndexManager.cjs.map +1 -0
  47. package/build/IndexManager.d.cts +36 -0
  48. package/build/IndexManager.d.cts.map +1 -0
  49. package/build/IndexManager.d.mts +36 -0
  50. package/build/IndexManager.d.mts.map +1 -0
  51. package/build/IndexManager.js +167 -218
  52. package/build/IndexManager.js.map +1 -1
  53. package/build/InstanceData.cjs +218 -0
  54. package/build/InstanceData.cjs.map +1 -0
  55. package/build/InstanceData.d.cts +98 -0
  56. package/build/InstanceData.d.cts.map +1 -0
  57. package/build/InstanceData.d.mts +98 -0
  58. package/build/InstanceData.d.mts.map +1 -0
  59. package/build/InstanceData.js +215 -222
  60. package/build/InstanceData.js.map +1 -1
  61. package/build/PluginManager.cjs +89 -0
  62. package/build/PluginManager.cjs.map +1 -0
  63. package/build/PluginManager.d.cts +112 -0
  64. package/build/PluginManager.d.cts.map +1 -0
  65. package/build/PluginManager.d.mts +112 -0
  66. package/build/PluginManager.d.mts.map +1 -0
  67. package/build/PluginManager.js +80 -106
  68. package/build/PluginManager.js.map +1 -1
  69. package/build/RowData.cjs +37 -0
  70. package/build/RowData.cjs.map +1 -0
  71. package/build/RowData.d.cts +53 -0
  72. package/build/RowData.d.cts.map +1 -0
  73. package/build/RowData.d.mts +53 -0
  74. package/build/RowData.d.mts.map +1 -0
  75. package/build/RowData.js +35 -0
  76. package/build/RowData.js.map +1 -0
  77. package/build/_virtual/_rolldown/runtime.cjs +23 -0
  78. package/build/batchloaders/BatchLoader.cjs +49 -0
  79. package/build/batchloaders/BatchLoader.cjs.map +1 -0
  80. package/build/batchloaders/BatchLoader.d.cts +17 -0
  81. package/build/batchloaders/BatchLoader.d.cts.map +1 -0
  82. package/build/batchloaders/BatchLoader.d.mts +17 -0
  83. package/build/batchloaders/BatchLoader.d.mts.map +1 -0
  84. package/build/batchloaders/BatchLoader.js +45 -54
  85. package/build/batchloaders/BatchLoader.js.map +1 -1
  86. package/build/batchloaders/enumCollectionBatchLoader.cjs +66 -0
  87. package/build/batchloaders/enumCollectionBatchLoader.cjs.map +1 -0
  88. package/build/batchloaders/enumCollectionBatchLoader.d.cts +11 -0
  89. package/build/batchloaders/enumCollectionBatchLoader.d.cts.map +1 -0
  90. package/build/batchloaders/enumCollectionBatchLoader.d.mts +11 -0
  91. package/build/batchloaders/enumCollectionBatchLoader.d.mts.map +1 -0
  92. package/build/batchloaders/enumCollectionBatchLoader.js +58 -48
  93. package/build/batchloaders/enumCollectionBatchLoader.js.map +1 -1
  94. package/build/batchloaders/loadBatchLoader.cjs +78 -0
  95. package/build/batchloaders/loadBatchLoader.cjs.map +1 -0
  96. package/build/batchloaders/loadBatchLoader.d.cts +20 -0
  97. package/build/batchloaders/loadBatchLoader.d.cts.map +1 -0
  98. package/build/batchloaders/loadBatchLoader.d.mts +20 -0
  99. package/build/batchloaders/loadBatchLoader.d.mts.map +1 -0
  100. package/build/batchloaders/loadBatchLoader.js +72 -51
  101. package/build/batchloaders/loadBatchLoader.js.map +1 -1
  102. package/build/batchloaders/manyToManyBatchLoader.cjs +78 -0
  103. package/build/batchloaders/manyToManyBatchLoader.cjs.map +1 -0
  104. package/build/batchloaders/manyToManyBatchLoader.d.cts +11 -0
  105. package/build/batchloaders/manyToManyBatchLoader.d.cts.map +1 -0
  106. package/build/batchloaders/manyToManyBatchLoader.d.mts +11 -0
  107. package/build/batchloaders/manyToManyBatchLoader.d.mts.map +1 -0
  108. package/build/batchloaders/manyToManyBatchLoader.js +70 -61
  109. package/build/batchloaders/manyToManyBatchLoader.js.map +1 -1
  110. package/build/batchloaders/oneToManyBatchLoader.cjs +63 -0
  111. package/build/batchloaders/oneToManyBatchLoader.cjs.map +1 -0
  112. package/build/batchloaders/oneToManyBatchLoader.d.cts +11 -0
  113. package/build/batchloaders/oneToManyBatchLoader.d.cts.map +1 -0
  114. package/build/batchloaders/oneToManyBatchLoader.d.mts +11 -0
  115. package/build/batchloaders/oneToManyBatchLoader.d.mts.map +1 -0
  116. package/build/batchloaders/oneToManyBatchLoader.js +58 -48
  117. package/build/batchloaders/oneToManyBatchLoader.js.map +1 -1
  118. package/build/batchloaders/oneToOneBatchLoader.cjs +64 -0
  119. package/build/batchloaders/oneToOneBatchLoader.cjs.map +1 -0
  120. package/build/batchloaders/oneToOneBatchLoader.d.cts +10 -0
  121. package/build/batchloaders/oneToOneBatchLoader.d.cts.map +1 -0
  122. package/build/batchloaders/oneToOneBatchLoader.d.mts +10 -0
  123. package/build/batchloaders/oneToOneBatchLoader.d.mts.map +1 -0
  124. package/build/batchloaders/oneToOneBatchLoader.js +59 -50
  125. package/build/batchloaders/oneToOneBatchLoader.js.map +1 -1
  126. package/build/batchloaders/populateBatchLoader.cjs +155 -0
  127. package/build/batchloaders/populateBatchLoader.cjs.map +1 -0
  128. package/build/batchloaders/populateBatchLoader.d.cts +17 -0
  129. package/build/batchloaders/populateBatchLoader.d.cts.map +1 -0
  130. package/build/batchloaders/populateBatchLoader.d.mts +17 -0
  131. package/build/batchloaders/populateBatchLoader.d.mts.map +1 -0
  132. package/build/batchloaders/populateBatchLoader.js +147 -203
  133. package/build/batchloaders/populateBatchLoader.js.map +1 -1
  134. package/build/batchloaders/recursiveChildrenBatchLoader.cjs +78 -0
  135. package/build/batchloaders/recursiveChildrenBatchLoader.cjs.map +1 -0
  136. package/build/batchloaders/recursiveChildrenBatchLoader.d.cts +10 -0
  137. package/build/batchloaders/recursiveChildrenBatchLoader.d.cts.map +1 -0
  138. package/build/batchloaders/recursiveChildrenBatchLoader.d.mts +10 -0
  139. package/build/batchloaders/recursiveChildrenBatchLoader.d.mts.map +1 -0
  140. package/build/batchloaders/recursiveChildrenBatchLoader.js +71 -72
  141. package/build/batchloaders/recursiveChildrenBatchLoader.js.map +1 -1
  142. package/build/batchloaders/recursiveM2mBatchLoader.cjs +83 -0
  143. package/build/batchloaders/recursiveM2mBatchLoader.cjs.map +1 -0
  144. package/build/batchloaders/recursiveM2mBatchLoader.d.cts +10 -0
  145. package/build/batchloaders/recursiveM2mBatchLoader.d.cts.map +1 -0
  146. package/build/batchloaders/recursiveM2mBatchLoader.d.mts +10 -0
  147. package/build/batchloaders/recursiveM2mBatchLoader.d.mts.map +1 -0
  148. package/build/batchloaders/recursiveM2mBatchLoader.js +76 -79
  149. package/build/batchloaders/recursiveM2mBatchLoader.js.map +1 -1
  150. package/build/batchloaders/recursiveParentsBatchLoader.cjs +65 -0
  151. package/build/batchloaders/recursiveParentsBatchLoader.cjs.map +1 -0
  152. package/build/batchloaders/recursiveParentsBatchLoader.d.cts +10 -0
  153. package/build/batchloaders/recursiveParentsBatchLoader.d.cts.map +1 -0
  154. package/build/batchloaders/recursiveParentsBatchLoader.d.mts +10 -0
  155. package/build/batchloaders/recursiveParentsBatchLoader.d.mts.map +1 -0
  156. package/build/batchloaders/recursiveParentsBatchLoader.js +58 -55
  157. package/build/batchloaders/recursiveParentsBatchLoader.js.map +1 -1
  158. package/build/changes.cjs +221 -0
  159. package/build/changes.cjs.map +1 -0
  160. package/build/changes.d.cts +95 -0
  161. package/build/changes.d.cts.map +1 -0
  162. package/build/changes.d.mts +95 -0
  163. package/build/changes.d.mts.map +1 -0
  164. package/build/changes.js +208 -285
  165. package/build/changes.js.map +1 -1
  166. package/build/config.cjs +295 -0
  167. package/build/config.cjs.map +1 -0
  168. package/build/config.d.cts +277 -0
  169. package/build/config.d.cts.map +1 -0
  170. package/build/config.d.mts +277 -0
  171. package/build/config.d.mts.map +1 -0
  172. package/build/config.js +255 -301
  173. package/build/config.js.map +1 -1
  174. package/build/configure.cjs +324 -0
  175. package/build/configure.cjs.map +1 -0
  176. package/build/configure.d.cts +19 -0
  177. package/build/configure.d.cts.map +1 -0
  178. package/build/configure.d.mts +19 -0
  179. package/build/configure.d.mts.map +1 -0
  180. package/build/configure.js +265 -348
  181. package/build/configure.js.map +1 -1
  182. package/build/dataloaders/fastWhereFilterHash.cjs +140 -0
  183. package/build/dataloaders/fastWhereFilterHash.cjs.map +1 -0
  184. package/build/dataloaders/fastWhereFilterHash.d.cts +18 -0
  185. package/build/dataloaders/fastWhereFilterHash.d.cts.map +1 -0
  186. package/build/dataloaders/fastWhereFilterHash.d.mts +18 -0
  187. package/build/dataloaders/fastWhereFilterHash.d.mts.map +1 -0
  188. package/build/dataloaders/fastWhereFilterHash.js +108 -133
  189. package/build/dataloaders/fastWhereFilterHash.js.map +1 -1
  190. package/build/dataloaders/findByUniqueDataLoader.cjs +58 -0
  191. package/build/dataloaders/findByUniqueDataLoader.cjs.map +1 -0
  192. package/build/dataloaders/findByUniqueDataLoader.d.cts +10 -0
  193. package/build/dataloaders/findByUniqueDataLoader.d.cts.map +1 -0
  194. package/build/dataloaders/findByUniqueDataLoader.d.mts +10 -0
  195. package/build/dataloaders/findByUniqueDataLoader.d.mts.map +1 -0
  196. package/build/dataloaders/findByUniqueDataLoader.js +53 -44
  197. package/build/dataloaders/findByUniqueDataLoader.js.map +1 -1
  198. package/build/dataloaders/findCountDataLoader.cjs +123 -0
  199. package/build/dataloaders/findCountDataLoader.cjs.map +1 -0
  200. package/build/dataloaders/findCountDataLoader.d.cts +19 -0
  201. package/build/dataloaders/findCountDataLoader.d.cts.map +1 -0
  202. package/build/dataloaders/findCountDataLoader.d.mts +19 -0
  203. package/build/dataloaders/findCountDataLoader.d.mts.map +1 -0
  204. package/build/dataloaders/findCountDataLoader.js +112 -109
  205. package/build/dataloaders/findCountDataLoader.js.map +1 -1
  206. package/build/dataloaders/findDataLoader.cjs +365 -0
  207. package/build/dataloaders/findDataLoader.cjs.map +1 -0
  208. package/build/dataloaders/findDataLoader.d.cts +79 -0
  209. package/build/dataloaders/findDataLoader.d.cts.map +1 -0
  210. package/build/dataloaders/findDataLoader.d.mts +79 -0
  211. package/build/dataloaders/findDataLoader.d.mts.map +1 -0
  212. package/build/dataloaders/findDataLoader.js +298 -382
  213. package/build/dataloaders/findDataLoader.js.map +1 -1
  214. package/build/dataloaders/findIdsDataLoader.cjs +82 -0
  215. package/build/dataloaders/findIdsDataLoader.cjs.map +1 -0
  216. package/build/dataloaders/findIdsDataLoader.d.cts +9 -0
  217. package/build/dataloaders/findIdsDataLoader.d.cts.map +1 -0
  218. package/build/dataloaders/findIdsDataLoader.d.mts +9 -0
  219. package/build/dataloaders/findIdsDataLoader.d.mts.map +1 -0
  220. package/build/dataloaders/findIdsDataLoader.js +77 -74
  221. package/build/dataloaders/findIdsDataLoader.js.map +1 -1
  222. package/build/dataloaders/findOrCreateDataLoader.cjs +120 -0
  223. package/build/dataloaders/findOrCreateDataLoader.cjs.map +1 -0
  224. package/build/dataloaders/findOrCreateDataLoader.d.cts +15 -0
  225. package/build/dataloaders/findOrCreateDataLoader.d.cts.map +1 -0
  226. package/build/dataloaders/findOrCreateDataLoader.d.mts +15 -0
  227. package/build/dataloaders/findOrCreateDataLoader.d.mts.map +1 -0
  228. package/build/dataloaders/findOrCreateDataLoader.js +102 -164
  229. package/build/dataloaders/findOrCreateDataLoader.js.map +1 -1
  230. package/build/dataloaders/findPaginatedDataLoader.cjs +98 -0
  231. package/build/dataloaders/findPaginatedDataLoader.cjs.map +1 -0
  232. package/build/dataloaders/findPaginatedDataLoader.d.cts +10 -0
  233. package/build/dataloaders/findPaginatedDataLoader.d.cts.map +1 -0
  234. package/build/dataloaders/findPaginatedDataLoader.d.mts +10 -0
  235. package/build/dataloaders/findPaginatedDataLoader.d.mts.map +1 -0
  236. package/build/dataloaders/findPaginatedDataLoader.js +93 -80
  237. package/build/dataloaders/findPaginatedDataLoader.js.map +1 -1
  238. package/build/dataloaders/lensDataLoader.cjs +178 -0
  239. package/build/dataloaders/lensDataLoader.cjs.map +1 -0
  240. package/build/dataloaders/lensDataLoader.d.cts +15 -0
  241. package/build/dataloaders/lensDataLoader.d.cts.map +1 -0
  242. package/build/dataloaders/lensDataLoader.d.mts +15 -0
  243. package/build/dataloaders/lensDataLoader.d.mts.map +1 -0
  244. package/build/dataloaders/lensDataLoader.js +172 -176
  245. package/build/dataloaders/lensDataLoader.js.map +1 -1
  246. package/build/dataloaders/manyToManyFindDataLoader.cjs +84 -0
  247. package/build/dataloaders/manyToManyFindDataLoader.cjs.map +1 -0
  248. package/build/dataloaders/manyToManyFindDataLoader.d.cts +12 -0
  249. package/build/dataloaders/manyToManyFindDataLoader.d.cts.map +1 -0
  250. package/build/dataloaders/manyToManyFindDataLoader.d.mts +12 -0
  251. package/build/dataloaders/manyToManyFindDataLoader.d.mts.map +1 -0
  252. package/build/dataloaders/manyToManyFindDataLoader.js +76 -70
  253. package/build/dataloaders/manyToManyFindDataLoader.js.map +1 -1
  254. package/build/dataloaders/oneToManyFindDataLoader.cjs +77 -0
  255. package/build/dataloaders/oneToManyFindDataLoader.cjs.map +1 -0
  256. package/build/dataloaders/oneToManyFindDataLoader.d.cts +12 -0
  257. package/build/dataloaders/oneToManyFindDataLoader.d.cts.map +1 -0
  258. package/build/dataloaders/oneToManyFindDataLoader.d.mts +12 -0
  259. package/build/dataloaders/oneToManyFindDataLoader.d.mts.map +1 -0
  260. package/build/dataloaders/oneToManyFindDataLoader.js +71 -67
  261. package/build/dataloaders/oneToManyFindDataLoader.js.map +1 -1
  262. package/build/defaults.cjs +195 -0
  263. package/build/defaults.cjs.map +1 -0
  264. package/build/defaults.d.cts +56 -0
  265. package/build/defaults.d.cts.map +1 -0
  266. package/build/defaults.d.mts +56 -0
  267. package/build/defaults.d.mts.map +1 -0
  268. package/build/defaults.js +171 -271
  269. package/build/defaults.js.map +1 -1
  270. package/build/drivers/Driver.cjs +3 -0
  271. package/build/drivers/Driver.d.cts +51 -0
  272. package/build/drivers/Driver.d.cts.map +1 -0
  273. package/build/drivers/Driver.d.mts +51 -0
  274. package/build/drivers/Driver.d.mts.map +1 -0
  275. package/build/drivers/Driver.js +3 -3
  276. package/build/drivers/EntityWriter.cjs +208 -0
  277. package/build/drivers/EntityWriter.cjs.map +1 -0
  278. package/build/drivers/EntityWriter.d.cts +66 -0
  279. package/build/drivers/EntityWriter.d.cts.map +1 -0
  280. package/build/drivers/EntityWriter.d.mts +66 -0
  281. package/build/drivers/EntityWriter.d.mts.map +1 -0
  282. package/build/drivers/EntityWriter.js +183 -219
  283. package/build/drivers/EntityWriter.js.map +1 -1
  284. package/build/drivers/IdAssigner.cjs +89 -0
  285. package/build/drivers/IdAssigner.cjs.map +1 -0
  286. package/build/drivers/IdAssigner.d.cts +50 -0
  287. package/build/drivers/IdAssigner.d.cts.map +1 -0
  288. package/build/drivers/IdAssigner.d.mts +50 -0
  289. package/build/drivers/IdAssigner.d.mts.map +1 -0
  290. package/build/drivers/IdAssigner.js +80 -124
  291. package/build/drivers/IdAssigner.js.map +1 -1
  292. package/build/drivers/driverApi.cjs +19 -0
  293. package/build/drivers/driverApi.cjs.map +1 -0
  294. package/build/drivers/driverApi.d.cts +22 -0
  295. package/build/drivers/driverApi.d.cts.map +1 -0
  296. package/build/drivers/driverApi.d.mts +22 -0
  297. package/build/drivers/driverApi.d.mts.map +1 -0
  298. package/build/drivers/driverApi.js +18 -0
  299. package/build/drivers/driverApi.js.map +1 -0
  300. package/build/drivers/index.cjs +7 -0
  301. package/build/drivers/index.d.cts +4 -0
  302. package/build/drivers/index.d.mts +4 -0
  303. package/build/drivers/index.js +3 -22
  304. package/build/fields.cjs +127 -0
  305. package/build/fields.cjs.map +1 -0
  306. package/build/fields.d.cts +29 -0
  307. package/build/fields.d.cts.map +1 -0
  308. package/build/fields.d.mts +29 -0
  309. package/build/fields.d.mts.map +1 -0
  310. package/build/fields.js +98 -160
  311. package/build/fields.js.map +1 -1
  312. package/build/flush/FlushLock.cjs +51 -0
  313. package/build/flush/FlushLock.cjs.map +1 -0
  314. package/build/flush/FlushLock.d.cts +29 -0
  315. package/build/flush/FlushLock.d.cts.map +1 -0
  316. package/build/flush/FlushLock.d.mts +29 -0
  317. package/build/flush/FlushLock.d.mts.map +1 -0
  318. package/build/flush/FlushLock.js +51 -0
  319. package/build/flush/FlushLock.js.map +1 -0
  320. package/build/flush/JoinRows.cjs +263 -0
  321. package/build/flush/JoinRows.cjs.map +1 -0
  322. package/build/flush/JoinRows.d.cts +120 -0
  323. package/build/flush/JoinRows.d.cts.map +1 -0
  324. package/build/flush/JoinRows.d.mts +120 -0
  325. package/build/flush/JoinRows.d.mts.map +1 -0
  326. package/build/flush/JoinRows.js +261 -0
  327. package/build/flush/JoinRows.js.map +1 -0
  328. package/build/flush/PendingChanges.cjs +1 -0
  329. package/build/flush/PendingChanges.d.cts +29 -0
  330. package/build/flush/PendingChanges.d.cts.map +1 -0
  331. package/build/flush/PendingChanges.d.mts +29 -0
  332. package/build/flush/PendingChanges.d.mts.map +1 -0
  333. package/build/flush/PendingChanges.js +1 -0
  334. package/build/flush/Todo.cjs +71 -0
  335. package/build/flush/Todo.cjs.map +1 -0
  336. package/build/flush/Todo.d.cts +38 -0
  337. package/build/flush/Todo.d.cts.map +1 -0
  338. package/build/flush/Todo.d.mts +38 -0
  339. package/build/flush/Todo.d.mts.map +1 -0
  340. package/build/flush/Todo.js +67 -0
  341. package/build/flush/Todo.js.map +1 -0
  342. package/build/getProperties.cjs +87 -0
  343. package/build/getProperties.cjs.map +1 -0
  344. package/build/getProperties.d.cts +30 -0
  345. package/build/getProperties.d.cts.map +1 -0
  346. package/build/getProperties.d.mts +30 -0
  347. package/build/getProperties.d.mts.map +1 -0
  348. package/build/getProperties.js +71 -128
  349. package/build/getProperties.js.map +1 -1
  350. package/build/index.cjs +524 -0
  351. package/build/index.cjs.map +1 -0
  352. package/build/index.d.cts +180 -0
  353. package/build/index.d.cts.map +1 -0
  354. package/build/index.d.mts +180 -0
  355. package/build/index.d.mts.map +1 -0
  356. package/build/index.js +171 -292
  357. package/build/index.js.map +1 -1
  358. package/build/json.cjs +79 -0
  359. package/build/json.cjs.map +1 -0
  360. package/build/json.d.cts +76 -0
  361. package/build/json.d.cts.map +1 -0
  362. package/build/json.d.mts +76 -0
  363. package/build/json.d.mts.map +1 -0
  364. package/build/json.js +68 -106
  365. package/build/json.js.map +1 -1
  366. package/build/k.cjs +9 -0
  367. package/build/k.cjs.map +1 -0
  368. package/build/k.d.cts +1 -0
  369. package/build/k.d.mts +1 -0
  370. package/build/k.js +6 -6
  371. package/build/k.js.map +1 -1
  372. package/build/keys.cjs +181 -0
  373. package/build/keys.cjs.map +1 -0
  374. package/build/keys.d.cts +55 -0
  375. package/build/keys.d.cts.map +1 -0
  376. package/build/keys.d.mts +55 -0
  377. package/build/keys.d.mts.map +1 -0
  378. package/build/keys.js +129 -162
  379. package/build/keys.js.map +1 -1
  380. package/build/loading/HintTree.cjs +67 -0
  381. package/build/loading/HintTree.cjs.map +1 -0
  382. package/build/loading/HintTree.d.cts +45 -0
  383. package/build/loading/HintTree.d.cts.map +1 -0
  384. package/build/loading/HintTree.d.mts +45 -0
  385. package/build/loading/HintTree.d.mts.map +1 -0
  386. package/build/loading/HintTree.js +66 -0
  387. package/build/loading/HintTree.js.map +1 -0
  388. package/build/loading/IsLoadedCache.cjs +58 -0
  389. package/build/loading/IsLoadedCache.cjs.map +1 -0
  390. package/build/loading/IsLoadedCache.d.cts +35 -0
  391. package/build/loading/IsLoadedCache.d.cts.map +1 -0
  392. package/build/loading/IsLoadedCache.d.mts +35 -0
  393. package/build/loading/IsLoadedCache.d.mts.map +1 -0
  394. package/build/loading/IsLoadedCache.js +57 -0
  395. package/build/loading/IsLoadedCache.js.map +1 -0
  396. package/build/loading/loadHints.cjs +95 -0
  397. package/build/loading/loadHints.cjs.map +1 -0
  398. package/build/loading/loadHints.d.cts +116 -0
  399. package/build/loading/loadHints.d.cts.map +1 -0
  400. package/build/loading/loadHints.d.mts +116 -0
  401. package/build/loading/loadHints.d.mts.map +1 -0
  402. package/build/loading/loadHints.js +88 -0
  403. package/build/loading/loadHints.js.map +1 -0
  404. package/build/loading/loadLens.cjs +212 -0
  405. package/build/loading/loadLens.cjs.map +1 -0
  406. package/build/loading/loadLens.d.cts +77 -0
  407. package/build/loading/loadLens.d.cts.map +1 -0
  408. package/build/loading/loadLens.d.mts +77 -0
  409. package/build/loading/loadLens.d.mts.map +1 -0
  410. package/build/loading/loadLens.js +201 -0
  411. package/build/loading/loadLens.js.map +1 -0
  412. package/build/loading/withLoaded.cjs +64 -0
  413. package/build/loading/withLoaded.cjs.map +1 -0
  414. package/build/loading/withLoaded.d.cts +65 -0
  415. package/build/loading/withLoaded.d.cts.map +1 -0
  416. package/build/loading/withLoaded.d.mts +65 -0
  417. package/build/loading/withLoaded.d.mts.map +1 -0
  418. package/build/loading/withLoaded.js +61 -0
  419. package/build/loading/withLoaded.js.map +1 -0
  420. package/build/logging/FactoryLogger.cjs +66 -0
  421. package/build/logging/FactoryLogger.cjs.map +1 -0
  422. package/build/logging/FactoryLogger.d.cts +27 -0
  423. package/build/logging/FactoryLogger.d.cts.map +1 -0
  424. package/build/logging/FactoryLogger.d.mts +27 -0
  425. package/build/logging/FactoryLogger.d.mts.map +1 -0
  426. package/build/logging/FactoryLogger.js +58 -73
  427. package/build/logging/FactoryLogger.js.map +1 -1
  428. package/build/logging/FieldLogger.cjs +57 -0
  429. package/build/logging/FieldLogger.cjs.map +1 -0
  430. package/build/logging/FieldLogger.d.cts +32 -0
  431. package/build/logging/FieldLogger.d.cts.map +1 -0
  432. package/build/logging/FieldLogger.d.mts +32 -0
  433. package/build/logging/FieldLogger.d.mts.map +1 -0
  434. package/build/logging/FieldLogger.js +51 -67
  435. package/build/logging/FieldLogger.js.map +1 -1
  436. package/build/logging/ReactionLogger.cjs +93 -0
  437. package/build/logging/ReactionLogger.cjs.map +1 -0
  438. package/build/logging/ReactionLogger.d.cts +37 -0
  439. package/build/logging/ReactionLogger.d.cts.map +1 -0
  440. package/build/logging/ReactionLogger.d.mts +37 -0
  441. package/build/logging/ReactionLogger.d.mts.map +1 -0
  442. package/build/logging/ReactionLogger.js +76 -66
  443. package/build/logging/ReactionLogger.js.map +1 -1
  444. package/build/newEntity.cjs +89 -0
  445. package/build/newEntity.cjs.map +1 -0
  446. package/build/newEntity.d.cts +48 -0
  447. package/build/newEntity.d.cts.map +1 -0
  448. package/build/newEntity.d.mts +48 -0
  449. package/build/newEntity.d.mts.map +1 -0
  450. package/build/newEntity.js +71 -94
  451. package/build/newEntity.js.map +1 -1
  452. package/build/newTestInstance.cjs +539 -0
  453. package/build/newTestInstance.cjs.map +1 -0
  454. package/build/newTestInstance.d.cts +207 -0
  455. package/build/newTestInstance.d.cts.map +1 -0
  456. package/build/newTestInstance.d.mts +207 -0
  457. package/build/newTestInstance.d.mts.map +1 -0
  458. package/build/newTestInstance.js +459 -721
  459. package/build/newTestInstance.js.map +1 -1
  460. package/build/normalizeHints.cjs +58 -0
  461. package/build/normalizeHints.cjs.map +1 -0
  462. package/build/normalizeHints.d.cts +24 -0
  463. package/build/normalizeHints.d.cts.map +1 -0
  464. package/build/normalizeHints.d.mts +24 -0
  465. package/build/normalizeHints.d.mts.map +1 -0
  466. package/build/normalizeHints.js +40 -55
  467. package/build/normalizeHints.js.map +1 -1
  468. package/build/nowUTC.cjs +15 -0
  469. package/build/nowUTC.cjs.map +1 -0
  470. package/build/nowUTC.d.cts +10 -0
  471. package/build/nowUTC.d.cts.map +1 -0
  472. package/build/nowUTC.d.mts +10 -0
  473. package/build/nowUTC.d.mts.map +1 -0
  474. package/build/nowUTC.js +14 -0
  475. package/build/nowUTC.js.map +1 -0
  476. package/build/plugins/ImmutableEntitiesPlugin.cjs +21 -0
  477. package/build/plugins/ImmutableEntitiesPlugin.cjs.map +1 -0
  478. package/build/plugins/ImmutableEntitiesPlugin.d.cts +12 -0
  479. package/build/plugins/ImmutableEntitiesPlugin.d.cts.map +1 -0
  480. package/build/plugins/ImmutableEntitiesPlugin.d.mts +12 -0
  481. package/build/plugins/ImmutableEntitiesPlugin.d.mts.map +1 -0
  482. package/build/plugins/ImmutableEntitiesPlugin.js +19 -20
  483. package/build/plugins/ImmutableEntitiesPlugin.js.map +1 -1
  484. package/build/plugins/PreloadPlugin.cjs +3 -0
  485. package/build/plugins/PreloadPlugin.d.cts +77 -0
  486. package/build/plugins/PreloadPlugin.d.cts.map +1 -0
  487. package/build/plugins/PreloadPlugin.d.mts +77 -0
  488. package/build/plugins/PreloadPlugin.d.mts.map +1 -0
  489. package/build/plugins/PreloadPlugin.js +3 -3
  490. package/build/preloading/JsonAggregatePreloader.cjs +280 -0
  491. package/build/preloading/JsonAggregatePreloader.cjs.map +1 -0
  492. package/build/preloading/JsonAggregatePreloader.d.cts +19 -0
  493. package/build/preloading/JsonAggregatePreloader.d.cts.map +1 -0
  494. package/build/preloading/JsonAggregatePreloader.d.mts +19 -0
  495. package/build/preloading/JsonAggregatePreloader.d.mts.map +1 -0
  496. package/build/preloading/JsonAggregatePreloader.js +270 -320
  497. package/build/preloading/JsonAggregatePreloader.js.map +1 -1
  498. package/build/preloading/canPreload.cjs +19 -0
  499. package/build/preloading/canPreload.cjs.map +1 -0
  500. package/build/preloading/canPreload.d.cts +6 -0
  501. package/build/preloading/canPreload.d.cts.map +1 -0
  502. package/build/preloading/canPreload.d.mts +6 -0
  503. package/build/preloading/canPreload.d.mts.map +1 -0
  504. package/build/preloading/canPreload.js +15 -21
  505. package/build/preloading/canPreload.js.map +1 -1
  506. package/build/preloading/partitionHint.cjs +43 -0
  507. package/build/preloading/partitionHint.cjs.map +1 -0
  508. package/build/preloading/partitionHint.d.cts +8 -0
  509. package/build/preloading/partitionHint.d.cts.map +1 -0
  510. package/build/preloading/partitionHint.d.mts +8 -0
  511. package/build/preloading/partitionHint.d.mts.map +1 -0
  512. package/build/preloading/partitionHint.js +36 -56
  513. package/build/preloading/partitionHint.js.map +1 -1
  514. package/build/queries/ConditionBuilder.cjs +106 -0
  515. package/build/queries/ConditionBuilder.cjs.map +1 -0
  516. package/build/queries/ConditionBuilder.d.cts +31 -0
  517. package/build/queries/ConditionBuilder.d.cts.map +1 -0
  518. package/build/queries/ConditionBuilder.d.mts +31 -0
  519. package/build/queries/ConditionBuilder.d.mts.map +1 -0
  520. package/build/queries/ConditionBuilder.js +105 -0
  521. package/build/queries/ConditionBuilder.js.map +1 -0
  522. package/build/queries/conditions.cjs +15 -0
  523. package/build/queries/conditions.cjs.map +1 -0
  524. package/build/queries/conditions.d.cts +38 -0
  525. package/build/queries/conditions.d.cts.map +1 -0
  526. package/build/queries/conditions.d.mts +38 -0
  527. package/build/queries/conditions.d.mts.map +1 -0
  528. package/build/queries/conditions.js +13 -0
  529. package/build/queries/conditions.js.map +1 -0
  530. package/build/queries/entityQueryUtils.cjs +60 -0
  531. package/build/queries/entityQueryUtils.cjs.map +1 -0
  532. package/build/queries/entityQueryUtils.d.cts +19 -0
  533. package/build/queries/entityQueryUtils.d.cts.map +1 -0
  534. package/build/queries/entityQueryUtils.d.mts +19 -0
  535. package/build/queries/entityQueryUtils.d.mts.map +1 -0
  536. package/build/queries/entityQueryUtils.js +56 -0
  537. package/build/queries/entityQueryUtils.js.map +1 -0
  538. package/build/queries/find/Aliases.cjs +301 -0
  539. package/build/queries/find/Aliases.cjs.map +1 -0
  540. package/build/queries/find/Aliases.d.cts +122 -0
  541. package/build/queries/find/Aliases.d.cts.map +1 -0
  542. package/build/queries/find/Aliases.d.mts +122 -0
  543. package/build/queries/find/Aliases.d.mts.map +1 -0
  544. package/build/queries/find/Aliases.js +293 -0
  545. package/build/queries/find/Aliases.js.map +1 -0
  546. package/build/queries/find/DeferredAlias.cjs +25 -0
  547. package/build/queries/find/DeferredAlias.cjs.map +1 -0
  548. package/build/queries/find/DeferredAlias.d.cts +22 -0
  549. package/build/queries/find/DeferredAlias.d.cts.map +1 -0
  550. package/build/queries/find/DeferredAlias.d.mts +22 -0
  551. package/build/queries/find/DeferredAlias.d.mts.map +1 -0
  552. package/build/queries/find/DeferredAlias.js +22 -0
  553. package/build/queries/find/DeferredAlias.js.map +1 -0
  554. package/build/queries/find/EntityFilter.cjs +27 -0
  555. package/build/queries/find/EntityFilter.cjs.map +1 -0
  556. package/build/queries/find/EntityFilter.d.cts +127 -0
  557. package/build/queries/find/EntityFilter.d.cts.map +1 -0
  558. package/build/queries/find/EntityFilter.d.mts +127 -0
  559. package/build/queries/find/EntityFilter.d.mts.map +1 -0
  560. package/build/queries/find/EntityFilter.js +26 -0
  561. package/build/queries/find/EntityFilter.js.map +1 -0
  562. package/build/queries/find/EntityGraphQLFilter.cjs +52 -0
  563. package/build/queries/find/EntityGraphQLFilter.cjs.map +1 -0
  564. package/build/queries/find/EntityGraphQLFilter.d.cts +59 -0
  565. package/build/queries/find/EntityGraphQLFilter.d.cts.map +1 -0
  566. package/build/queries/find/EntityGraphQLFilter.d.mts +59 -0
  567. package/build/queries/find/EntityGraphQLFilter.d.mts.map +1 -0
  568. package/build/queries/find/EntityGraphQLFilter.js +50 -0
  569. package/build/queries/find/EntityGraphQLFilter.js.map +1 -0
  570. package/build/queries/find/QueryParser.cjs +553 -0
  571. package/build/queries/find/QueryParser.cjs.map +1 -0
  572. package/build/queries/find/QueryParser.collectionJoins.cjs +353 -0
  573. package/build/queries/find/QueryParser.collectionJoins.cjs.map +1 -0
  574. package/build/queries/find/QueryParser.collectionJoins.d.cts +30 -0
  575. package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -0
  576. package/build/queries/find/QueryParser.collectionJoins.d.mts +30 -0
  577. package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -0
  578. package/build/queries/find/QueryParser.collectionJoins.js +352 -0
  579. package/build/queries/find/QueryParser.collectionJoins.js.map +1 -0
  580. package/build/queries/find/QueryParser.d.cts +192 -0
  581. package/build/queries/find/QueryParser.d.cts.map +1 -0
  582. package/build/queries/find/QueryParser.d.mts +192 -0
  583. package/build/queries/find/QueryParser.d.mts.map +1 -0
  584. package/build/queries/find/QueryParser.js +546 -0
  585. package/build/queries/find/QueryParser.js.map +1 -0
  586. package/build/queries/find/QueryParser.pruning.cjs +115 -0
  587. package/build/queries/find/QueryParser.pruning.cjs.map +1 -0
  588. package/build/queries/find/QueryParser.pruning.d.cts +8 -0
  589. package/build/queries/find/QueryParser.pruning.d.cts.map +1 -0
  590. package/build/queries/find/QueryParser.pruning.d.mts +8 -0
  591. package/build/queries/find/QueryParser.pruning.d.mts.map +1 -0
  592. package/build/queries/find/QueryParser.pruning.js +113 -0
  593. package/build/queries/find/QueryParser.pruning.js.map +1 -0
  594. package/build/queries/find/QueryVisitor.cjs +77 -0
  595. package/build/queries/find/QueryVisitor.cjs.map +1 -0
  596. package/build/queries/find/QueryVisitor.d.cts +24 -0
  597. package/build/queries/find/QueryVisitor.d.cts.map +1 -0
  598. package/build/queries/find/QueryVisitor.d.mts +24 -0
  599. package/build/queries/find/QueryVisitor.d.mts.map +1 -0
  600. package/build/queries/find/QueryVisitor.js +74 -0
  601. package/build/queries/find/QueryVisitor.js.map +1 -0
  602. package/build/queries/find/buildFindQuery.cjs +112 -0
  603. package/build/queries/find/buildFindQuery.cjs.map +1 -0
  604. package/build/queries/find/buildFindQuery.d.cts +24 -0
  605. package/build/queries/find/buildFindQuery.d.cts.map +1 -0
  606. package/build/queries/find/buildFindQuery.d.mts +24 -0
  607. package/build/queries/find/buildFindQuery.d.mts.map +1 -0
  608. package/build/queries/find/buildFindQuery.js +110 -0
  609. package/build/queries/find/buildFindQuery.js.map +1 -0
  610. package/build/queries/find/scopes.cjs +301 -0
  611. package/build/queries/find/scopes.cjs.map +1 -0
  612. package/build/queries/find/scopes.d.cts +188 -0
  613. package/build/queries/find/scopes.d.cts.map +1 -0
  614. package/build/queries/find/scopes.d.mts +188 -0
  615. package/build/queries/find/scopes.d.mts.map +1 -0
  616. package/build/queries/find/scopes.js +296 -0
  617. package/build/queries/find/scopes.js.map +1 -0
  618. package/build/queries/parsedConditions.cjs +21 -0
  619. package/build/queries/parsedConditions.cjs.map +1 -0
  620. package/build/queries/parsedConditions.d.cts +127 -0
  621. package/build/queries/parsedConditions.d.cts.map +1 -0
  622. package/build/queries/parsedConditions.d.mts +127 -0
  623. package/build/queries/parsedConditions.d.mts.map +1 -0
  624. package/build/queries/parsedConditions.js +20 -0
  625. package/build/queries/parsedConditions.js.map +1 -0
  626. package/build/queries/renderConditions.cjs +66 -0
  627. package/build/queries/renderConditions.cjs.map +1 -0
  628. package/build/queries/renderConditions.d.cts +15 -0
  629. package/build/queries/renderConditions.d.cts.map +1 -0
  630. package/build/queries/renderConditions.d.mts +15 -0
  631. package/build/queries/renderConditions.d.mts.map +1 -0
  632. package/build/queries/renderConditions.js +64 -0
  633. package/build/queries/renderConditions.js.map +1 -0
  634. package/build/queries/skipCondition.cjs +14 -0
  635. package/build/queries/skipCondition.cjs.map +1 -0
  636. package/build/queries/skipCondition.d.cts +7 -0
  637. package/build/queries/skipCondition.d.cts.map +1 -0
  638. package/build/queries/skipCondition.d.mts +7 -0
  639. package/build/queries/skipCondition.d.mts.map +1 -0
  640. package/build/queries/skipCondition.js +13 -0
  641. package/build/queries/skipCondition.js.map +1 -0
  642. package/build/queries/sql/AliasAssigner.cjs +35 -0
  643. package/build/queries/sql/AliasAssigner.cjs.map +1 -0
  644. package/build/queries/sql/AliasAssigner.d.cts +13 -0
  645. package/build/queries/sql/AliasAssigner.d.cts.map +1 -0
  646. package/build/queries/sql/AliasAssigner.d.mts +13 -0
  647. package/build/queries/sql/AliasAssigner.d.mts.map +1 -0
  648. package/build/queries/sql/AliasAssigner.js +34 -0
  649. package/build/queries/sql/AliasAssigner.js.map +1 -0
  650. package/build/queries/sql/Expr.cjs +529 -0
  651. package/build/queries/sql/Expr.cjs.map +1 -0
  652. package/build/queries/sql/Expr.d.cts +284 -0
  653. package/build/queries/sql/Expr.d.cts.map +1 -0
  654. package/build/queries/sql/Expr.d.mts +284 -0
  655. package/build/queries/sql/Expr.d.mts.map +1 -0
  656. package/build/queries/sql/Expr.js +512 -0
  657. package/build/queries/sql/Expr.js.map +1 -0
  658. package/build/queries/sql/JoinTree.cjs +72 -0
  659. package/build/queries/sql/JoinTree.cjs.map +1 -0
  660. package/build/queries/sql/JoinTree.d.cts +107 -0
  661. package/build/queries/sql/JoinTree.d.cts.map +1 -0
  662. package/build/queries/sql/JoinTree.d.mts +107 -0
  663. package/build/queries/sql/JoinTree.d.mts.map +1 -0
  664. package/build/queries/sql/JoinTree.js +71 -0
  665. package/build/queries/sql/JoinTree.js.map +1 -0
  666. package/build/queries/sql/Tables.cjs +803 -0
  667. package/build/queries/sql/Tables.cjs.map +1 -0
  668. package/build/queries/sql/Tables.d.cts +322 -0
  669. package/build/queries/sql/Tables.d.cts.map +1 -0
  670. package/build/queries/sql/Tables.d.mts +322 -0
  671. package/build/queries/sql/Tables.d.mts.map +1 -0
  672. package/build/queries/sql/Tables.js +786 -0
  673. package/build/queries/sql/Tables.js.map +1 -0
  674. package/build/queries/sql/custom.cjs +52 -0
  675. package/build/queries/sql/custom.cjs.map +1 -0
  676. package/build/queries/sql/custom.d.cts +85 -0
  677. package/build/queries/sql/custom.d.cts.map +1 -0
  678. package/build/queries/sql/custom.d.mts +85 -0
  679. package/build/queries/sql/custom.d.mts.map +1 -0
  680. package/build/queries/sql/custom.js +49 -0
  681. package/build/queries/sql/custom.js.map +1 -0
  682. package/build/queries/sql/execute.cjs +276 -0
  683. package/build/queries/sql/execute.cjs.map +1 -0
  684. package/build/queries/sql/execute.d.cts +294 -0
  685. package/build/queries/sql/execute.d.cts.map +1 -0
  686. package/build/queries/sql/execute.d.mts +294 -0
  687. package/build/queries/sql/execute.d.mts.map +1 -0
  688. package/build/queries/sql/execute.js +273 -0
  689. package/build/queries/sql/execute.js.map +1 -0
  690. package/build/queries/sql/expressions/arrayAgg.cjs +63 -0
  691. package/build/queries/sql/expressions/arrayAgg.cjs.map +1 -0
  692. package/build/queries/sql/expressions/arrayAgg.d.cts +24 -0
  693. package/build/queries/sql/expressions/arrayAgg.d.cts.map +1 -0
  694. package/build/queries/sql/expressions/arrayAgg.d.mts +24 -0
  695. package/build/queries/sql/expressions/arrayAgg.d.mts.map +1 -0
  696. package/build/queries/sql/expressions/arrayAgg.js +61 -0
  697. package/build/queries/sql/expressions/arrayAgg.js.map +1 -0
  698. package/build/queries/sql/expressions/case.cjs +71 -0
  699. package/build/queries/sql/expressions/case.cjs.map +1 -0
  700. package/build/queries/sql/expressions/case.d.cts +57 -0
  701. package/build/queries/sql/expressions/case.d.cts.map +1 -0
  702. package/build/queries/sql/expressions/case.d.mts +57 -0
  703. package/build/queries/sql/expressions/case.d.mts.map +1 -0
  704. package/build/queries/sql/expressions/case.js +68 -0
  705. package/build/queries/sql/expressions/case.js.map +1 -0
  706. package/build/queries/sql/expressions/coalesce.cjs +25 -0
  707. package/build/queries/sql/expressions/coalesce.cjs.map +1 -0
  708. package/build/queries/sql/expressions/coalesce.d.cts +21 -0
  709. package/build/queries/sql/expressions/coalesce.d.cts.map +1 -0
  710. package/build/queries/sql/expressions/coalesce.d.mts +21 -0
  711. package/build/queries/sql/expressions/coalesce.d.mts.map +1 -0
  712. package/build/queries/sql/expressions/coalesce.js +22 -0
  713. package/build/queries/sql/expressions/coalesce.js.map +1 -0
  714. package/build/queries/sql/expressions/codecs.cjs +126 -0
  715. package/build/queries/sql/expressions/codecs.cjs.map +1 -0
  716. package/build/queries/sql/expressions/codecs.d.cts +11 -0
  717. package/build/queries/sql/expressions/codecs.d.cts.map +1 -0
  718. package/build/queries/sql/expressions/codecs.d.mts +11 -0
  719. package/build/queries/sql/expressions/codecs.d.mts.map +1 -0
  720. package/build/queries/sql/expressions/codecs.js +125 -0
  721. package/build/queries/sql/expressions/codecs.js.map +1 -0
  722. package/build/queries/sql/expressions/expression.cjs +102 -0
  723. package/build/queries/sql/expressions/expression.cjs.map +1 -0
  724. package/build/queries/sql/expressions/expression.d.cts +23 -0
  725. package/build/queries/sql/expressions/expression.d.cts.map +1 -0
  726. package/build/queries/sql/expressions/expression.d.mts +23 -0
  727. package/build/queries/sql/expressions/expression.d.mts.map +1 -0
  728. package/build/queries/sql/expressions/expression.js +97 -0
  729. package/build/queries/sql/expressions/expression.js.map +1 -0
  730. package/build/queries/sql/expressions/greatest.cjs +25 -0
  731. package/build/queries/sql/expressions/greatest.cjs.map +1 -0
  732. package/build/queries/sql/expressions/greatest.d.cts +21 -0
  733. package/build/queries/sql/expressions/greatest.d.cts.map +1 -0
  734. package/build/queries/sql/expressions/greatest.d.mts +21 -0
  735. package/build/queries/sql/expressions/greatest.d.mts.map +1 -0
  736. package/build/queries/sql/expressions/greatest.js +22 -0
  737. package/build/queries/sql/expressions/greatest.js.map +1 -0
  738. package/build/queries/sql/expressions/least.cjs +25 -0
  739. package/build/queries/sql/expressions/least.cjs.map +1 -0
  740. package/build/queries/sql/expressions/least.d.cts +21 -0
  741. package/build/queries/sql/expressions/least.d.cts.map +1 -0
  742. package/build/queries/sql/expressions/least.d.mts +21 -0
  743. package/build/queries/sql/expressions/least.d.mts.map +1 -0
  744. package/build/queries/sql/expressions/least.js +22 -0
  745. package/build/queries/sql/expressions/least.js.map +1 -0
  746. package/build/queries/sql/expressions/nullIf.cjs +27 -0
  747. package/build/queries/sql/expressions/nullIf.cjs.map +1 -0
  748. package/build/queries/sql/expressions/nullIf.d.cts +22 -0
  749. package/build/queries/sql/expressions/nullIf.d.cts.map +1 -0
  750. package/build/queries/sql/expressions/nullIf.d.mts +22 -0
  751. package/build/queries/sql/expressions/nullIf.d.mts.map +1 -0
  752. package/build/queries/sql/expressions/nullIf.js +24 -0
  753. package/build/queries/sql/expressions/nullIf.js.map +1 -0
  754. package/build/queries/sql/expressions/parseExpression.cjs +75 -0
  755. package/build/queries/sql/expressions/parseExpression.cjs.map +1 -0
  756. package/build/queries/sql/expressions/parseExpression.d.cts +19 -0
  757. package/build/queries/sql/expressions/parseExpression.d.cts.map +1 -0
  758. package/build/queries/sql/expressions/parseExpression.d.mts +19 -0
  759. package/build/queries/sql/expressions/parseExpression.d.mts.map +1 -0
  760. package/build/queries/sql/expressions/parseExpression.js +70 -0
  761. package/build/queries/sql/expressions/parseExpression.js.map +1 -0
  762. package/build/queries/sql/expressions/types.cjs +1 -0
  763. package/build/queries/sql/expressions/types.d.cts +114 -0
  764. package/build/queries/sql/expressions/types.d.cts.map +1 -0
  765. package/build/queries/sql/expressions/types.d.mts +114 -0
  766. package/build/queries/sql/expressions/types.d.mts.map +1 -0
  767. package/build/queries/sql/expressions/types.js +1 -0
  768. package/build/queries/sql/keywords.cjs +136 -0
  769. package/build/queries/sql/keywords.cjs.map +1 -0
  770. package/build/queries/sql/keywords.d.cts +18 -0
  771. package/build/queries/sql/keywords.d.cts.map +1 -0
  772. package/build/queries/sql/keywords.d.mts +18 -0
  773. package/build/queries/sql/keywords.d.mts.map +1 -0
  774. package/build/queries/sql/keywords.js +132 -0
  775. package/build/queries/sql/keywords.js.map +1 -0
  776. package/build/queries/sql/query.cjs +1610 -0
  777. package/build/queries/sql/query.cjs.map +1 -0
  778. package/build/queries/sql/query.d.cts +844 -0
  779. package/build/queries/sql/query.d.cts.map +1 -0
  780. package/build/queries/sql/query.d.mts +844 -0
  781. package/build/queries/sql/query.d.mts.map +1 -0
  782. package/build/queries/sql/query.js +1592 -0
  783. package/build/queries/sql/query.js.map +1 -0
  784. package/build/queries/unnest.cjs +62 -0
  785. package/build/queries/unnest.cjs.map +1 -0
  786. package/build/queries/unnest.d.cts +16 -0
  787. package/build/queries/unnest.d.cts.map +1 -0
  788. package/build/queries/unnest.d.mts +16 -0
  789. package/build/queries/unnest.d.mts.map +1 -0
  790. package/build/queries/unnest.js +60 -0
  791. package/build/queries/unnest.js.map +1 -0
  792. package/build/queries/valueFilters.cjs +240 -0
  793. package/build/queries/valueFilters.cjs.map +1 -0
  794. package/build/queries/valueFilters.d.cts +26 -0
  795. package/build/queries/valueFilters.d.cts.map +1 -0
  796. package/build/queries/valueFilters.d.mts +26 -0
  797. package/build/queries/valueFilters.d.mts.map +1 -0
  798. package/build/queries/valueFilters.js +236 -0
  799. package/build/queries/valueFilters.js.map +1 -0
  800. package/build/reactivity/ReactionsManager.cjs +264 -0
  801. package/build/reactivity/ReactionsManager.cjs.map +1 -0
  802. package/build/reactivity/ReactionsManager.d.cts +98 -0
  803. package/build/reactivity/ReactionsManager.d.cts.map +1 -0
  804. package/build/reactivity/ReactionsManager.d.mts +98 -0
  805. package/build/reactivity/ReactionsManager.d.mts.map +1 -0
  806. package/build/reactivity/ReactionsManager.js +263 -0
  807. package/build/reactivity/ReactionsManager.js.map +1 -0
  808. package/build/reactivity/reactiveHints.cjs +328 -0
  809. package/build/reactivity/reactiveHints.cjs.map +1 -0
  810. package/build/reactivity/reactiveHints.d.cts +143 -0
  811. package/build/reactivity/reactiveHints.d.cts.map +1 -0
  812. package/build/reactivity/reactiveHints.d.mts +143 -0
  813. package/build/reactivity/reactiveHints.d.mts.map +1 -0
  814. package/build/reactivity/reactiveHints.js +321 -0
  815. package/build/reactivity/reactiveHints.js.map +1 -0
  816. package/build/relations/AbstractPropertyImpl.cjs +16 -0
  817. package/build/relations/AbstractPropertyImpl.cjs.map +1 -0
  818. package/build/relations/AbstractPropertyImpl.d.cts +11 -0
  819. package/build/relations/AbstractPropertyImpl.d.cts.map +1 -0
  820. package/build/relations/AbstractPropertyImpl.d.mts +11 -0
  821. package/build/relations/AbstractPropertyImpl.d.mts.map +1 -0
  822. package/build/relations/AbstractPropertyImpl.js +13 -13
  823. package/build/relations/AbstractPropertyImpl.js.map +1 -1
  824. package/build/relations/AbstractRelationImpl.cjs +15 -0
  825. package/build/relations/AbstractRelationImpl.cjs.map +1 -0
  826. package/build/relations/AbstractRelationImpl.d.cts +43 -0
  827. package/build/relations/AbstractRelationImpl.d.cts.map +1 -0
  828. package/build/relations/AbstractRelationImpl.d.mts +43 -0
  829. package/build/relations/AbstractRelationImpl.d.mts.map +1 -0
  830. package/build/relations/AbstractRelationImpl.js +12 -17
  831. package/build/relations/AbstractRelationImpl.js.map +1 -1
  832. package/build/relations/AsyncProperty.cjs +75 -0
  833. package/build/relations/AsyncProperty.cjs.map +1 -0
  834. package/build/relations/AsyncProperty.d.cts +40 -0
  835. package/build/relations/AsyncProperty.d.cts.map +1 -0
  836. package/build/relations/AsyncProperty.d.mts +40 -0
  837. package/build/relations/AsyncProperty.d.mts.map +1 -0
  838. package/build/relations/AsyncProperty.js +61 -70
  839. package/build/relations/AsyncProperty.js.map +1 -1
  840. package/build/relations/AsyncReactiveField.cjs +110 -0
  841. package/build/relations/AsyncReactiveField.cjs.map +1 -0
  842. package/build/relations/AsyncReactiveField.d.cts +50 -0
  843. package/build/relations/AsyncReactiveField.d.cts.map +1 -0
  844. package/build/relations/AsyncReactiveField.d.mts +50 -0
  845. package/build/relations/AsyncReactiveField.d.mts.map +1 -0
  846. package/build/relations/AsyncReactiveField.js +97 -116
  847. package/build/relations/AsyncReactiveField.js.map +1 -1
  848. package/build/relations/Collection.cjs +23 -0
  849. package/build/relations/Collection.cjs.map +1 -0
  850. package/build/relations/Collection.d.cts +37 -0
  851. package/build/relations/Collection.d.cts.map +1 -0
  852. package/build/relations/Collection.d.mts +37 -0
  853. package/build/relations/Collection.d.mts.map +1 -0
  854. package/build/relations/Collection.js +14 -11
  855. package/build/relations/Collection.js.map +1 -1
  856. package/build/relations/CustomCollection.cjs +144 -0
  857. package/build/relations/CustomCollection.cjs.map +1 -0
  858. package/build/relations/CustomCollection.d.cts +74 -0
  859. package/build/relations/CustomCollection.d.cts.map +1 -0
  860. package/build/relations/CustomCollection.d.mts +74 -0
  861. package/build/relations/CustomCollection.d.mts.map +1 -0
  862. package/build/relations/CustomCollection.js +138 -162
  863. package/build/relations/CustomCollection.js.map +1 -1
  864. package/build/relations/CustomReference.cjs +142 -0
  865. package/build/relations/CustomReference.cjs.map +1 -0
  866. package/build/relations/CustomReference.d.cts +76 -0
  867. package/build/relations/CustomReference.d.cts.map +1 -0
  868. package/build/relations/CustomReference.d.mts +76 -0
  869. package/build/relations/CustomReference.d.mts.map +1 -0
  870. package/build/relations/CustomReference.js +135 -147
  871. package/build/relations/CustomReference.js.map +1 -1
  872. package/build/relations/EnumCollection.cjs +178 -0
  873. package/build/relations/EnumCollection.cjs.map +1 -0
  874. package/build/relations/EnumCollection.d.cts +86 -0
  875. package/build/relations/EnumCollection.d.cts.map +1 -0
  876. package/build/relations/EnumCollection.d.mts +86 -0
  877. package/build/relations/EnumCollection.d.mts.map +1 -0
  878. package/build/relations/EnumCollection.js +172 -207
  879. package/build/relations/EnumCollection.js.map +1 -1
  880. package/build/relations/LargeCollection.cjs +4 -0
  881. package/build/relations/LargeCollection.d.cts +22 -0
  882. package/build/relations/LargeCollection.d.cts.map +1 -0
  883. package/build/relations/LargeCollection.d.mts +22 -0
  884. package/build/relations/LargeCollection.d.mts.map +1 -0
  885. package/build/relations/LargeCollection.js +4 -3
  886. package/build/relations/LazyField.cjs +140 -0
  887. package/build/relations/LazyField.cjs.map +1 -0
  888. package/build/relations/LazyField.d.cts +51 -0
  889. package/build/relations/LazyField.d.cts.map +1 -0
  890. package/build/relations/LazyField.d.mts +51 -0
  891. package/build/relations/LazyField.d.mts.map +1 -0
  892. package/build/relations/LazyField.js +134 -0
  893. package/build/relations/LazyField.js.map +1 -0
  894. package/build/relations/ManyToManyCollection.cjs +421 -0
  895. package/build/relations/ManyToManyCollection.cjs.map +1 -0
  896. package/build/relations/ManyToManyCollection.d.cts +59 -0
  897. package/build/relations/ManyToManyCollection.d.cts.map +1 -0
  898. package/build/relations/ManyToManyCollection.d.mts +59 -0
  899. package/build/relations/ManyToManyCollection.d.mts.map +1 -0
  900. package/build/relations/ManyToManyCollection.js +411 -471
  901. package/build/relations/ManyToManyCollection.js.map +1 -1
  902. package/build/relations/ManyToManyLargeCollection.cjs +91 -0
  903. package/build/relations/ManyToManyLargeCollection.cjs.map +1 -0
  904. package/build/relations/ManyToManyLargeCollection.d.cts +34 -0
  905. package/build/relations/ManyToManyLargeCollection.d.cts.map +1 -0
  906. package/build/relations/ManyToManyLargeCollection.d.mts +34 -0
  907. package/build/relations/ManyToManyLargeCollection.d.mts.map +1 -0
  908. package/build/relations/ManyToManyLargeCollection.js +85 -118
  909. package/build/relations/ManyToManyLargeCollection.js.map +1 -1
  910. package/build/relations/ManyToOneReference.cjs +364 -0
  911. package/build/relations/ManyToOneReference.cjs.map +1 -0
  912. package/build/relations/ManyToOneReference.d.cts +121 -0
  913. package/build/relations/ManyToOneReference.d.cts.map +1 -0
  914. package/build/relations/ManyToOneReference.d.mts +121 -0
  915. package/build/relations/ManyToOneReference.d.mts.map +1 -0
  916. package/build/relations/ManyToOneReference.js +344 -411
  917. package/build/relations/ManyToOneReference.js.map +1 -1
  918. package/build/relations/OneToManyCollection.cjs +492 -0
  919. package/build/relations/OneToManyCollection.cjs.map +1 -0
  920. package/build/relations/OneToManyCollection.d.cts +69 -0
  921. package/build/relations/OneToManyCollection.d.cts.map +1 -0
  922. package/build/relations/OneToManyCollection.d.mts +69 -0
  923. package/build/relations/OneToManyCollection.d.mts.map +1 -0
  924. package/build/relations/OneToManyCollection.js +480 -579
  925. package/build/relations/OneToManyCollection.js.map +1 -1
  926. package/build/relations/OneToManyLargeCollection.cjs +85 -0
  927. package/build/relations/OneToManyLargeCollection.cjs.map +1 -0
  928. package/build/relations/OneToManyLargeCollection.d.cts +29 -0
  929. package/build/relations/OneToManyLargeCollection.d.cts.map +1 -0
  930. package/build/relations/OneToManyLargeCollection.d.mts +29 -0
  931. package/build/relations/OneToManyLargeCollection.d.mts.map +1 -0
  932. package/build/relations/OneToManyLargeCollection.js +79 -99
  933. package/build/relations/OneToManyLargeCollection.js.map +1 -1
  934. package/build/relations/OneToOneReference.cjs +209 -0
  935. package/build/relations/OneToOneReference.cjs.map +1 -0
  936. package/build/relations/OneToOneReference.d.cts +97 -0
  937. package/build/relations/OneToOneReference.d.cts.map +1 -0
  938. package/build/relations/OneToOneReference.d.mts +97 -0
  939. package/build/relations/OneToOneReference.d.mts.map +1 -0
  940. package/build/relations/OneToOneReference.js +193 -221
  941. package/build/relations/OneToOneReference.js.map +1 -1
  942. package/build/relations/PolymorphicReference.cjs +210 -0
  943. package/build/relations/PolymorphicReference.cjs.map +1 -0
  944. package/build/relations/PolymorphicReference.d.cts +93 -0
  945. package/build/relations/PolymorphicReference.d.cts.map +1 -0
  946. package/build/relations/PolymorphicReference.d.mts +93 -0
  947. package/build/relations/PolymorphicReference.d.mts.map +1 -0
  948. package/build/relations/PolymorphicReference.js +200 -237
  949. package/build/relations/PolymorphicReference.js.map +1 -1
  950. package/build/relations/PropertySymbols.cjs +7 -0
  951. package/build/relations/PropertySymbols.cjs.map +1 -0
  952. package/build/relations/PropertySymbols.d.cts +5 -0
  953. package/build/relations/PropertySymbols.d.cts.map +1 -0
  954. package/build/relations/PropertySymbols.d.mts +5 -0
  955. package/build/relations/PropertySymbols.d.mts.map +1 -0
  956. package/build/relations/PropertySymbols.js +6 -0
  957. package/build/relations/PropertySymbols.js.map +1 -0
  958. package/build/relations/ReactiveField.cjs +114 -0
  959. package/build/relations/ReactiveField.cjs.map +1 -0
  960. package/build/relations/ReactiveField.d.cts +88 -0
  961. package/build/relations/ReactiveField.d.cts.map +1 -0
  962. package/build/relations/ReactiveField.d.mts +88 -0
  963. package/build/relations/ReactiveField.d.mts.map +1 -0
  964. package/build/relations/ReactiveField.js +104 -137
  965. package/build/relations/ReactiveField.js.map +1 -1
  966. package/build/relations/ReactiveGetter.cjs +40 -0
  967. package/build/relations/ReactiveGetter.cjs.map +1 -0
  968. package/build/relations/ReactiveGetter.d.cts +33 -0
  969. package/build/relations/ReactiveGetter.d.cts.map +1 -0
  970. package/build/relations/ReactiveGetter.d.mts +33 -0
  971. package/build/relations/ReactiveGetter.d.mts.map +1 -0
  972. package/build/relations/ReactiveGetter.js +30 -31
  973. package/build/relations/ReactiveGetter.js.map +1 -1
  974. package/build/relations/ReactiveManyToMany.cjs +198 -0
  975. package/build/relations/ReactiveManyToMany.cjs.map +1 -0
  976. package/build/relations/ReactiveManyToMany.d.cts +63 -0
  977. package/build/relations/ReactiveManyToMany.d.cts.map +1 -0
  978. package/build/relations/ReactiveManyToMany.d.mts +63 -0
  979. package/build/relations/ReactiveManyToMany.d.mts.map +1 -0
  980. package/build/relations/ReactiveManyToMany.js +187 -238
  981. package/build/relations/ReactiveManyToMany.js.map +1 -1
  982. package/build/relations/ReactiveManyToManyOtherSide.cjs +148 -0
  983. package/build/relations/ReactiveManyToManyOtherSide.cjs.map +1 -0
  984. package/build/relations/ReactiveManyToManyOtherSide.d.cts +53 -0
  985. package/build/relations/ReactiveManyToManyOtherSide.d.cts.map +1 -0
  986. package/build/relations/ReactiveManyToManyOtherSide.d.mts +53 -0
  987. package/build/relations/ReactiveManyToManyOtherSide.d.mts.map +1 -0
  988. package/build/relations/ReactiveManyToManyOtherSide.js +139 -152
  989. package/build/relations/ReactiveManyToManyOtherSide.js.map +1 -1
  990. package/build/relations/ReactiveReference.cjs +336 -0
  991. package/build/relations/ReactiveReference.cjs.map +1 -0
  992. package/build/relations/ReactiveReference.d.cts +124 -0
  993. package/build/relations/ReactiveReference.d.cts.map +1 -0
  994. package/build/relations/ReactiveReference.d.mts +124 -0
  995. package/build/relations/ReactiveReference.d.mts.map +1 -0
  996. package/build/relations/ReactiveReference.js +321 -385
  997. package/build/relations/ReactiveReference.js.map +1 -1
  998. package/build/relations/ReadOnlyCollection.cjs +18 -0
  999. package/build/relations/ReadOnlyCollection.cjs.map +1 -0
  1000. package/build/relations/ReadOnlyCollection.d.cts +22 -0
  1001. package/build/relations/ReadOnlyCollection.d.cts.map +1 -0
  1002. package/build/relations/ReadOnlyCollection.d.mts +22 -0
  1003. package/build/relations/ReadOnlyCollection.d.mts.map +1 -0
  1004. package/build/relations/ReadOnlyCollection.js +9 -9
  1005. package/build/relations/ReadOnlyCollection.js.map +1 -1
  1006. package/build/relations/RecursiveCollection.cjs +386 -0
  1007. package/build/relations/RecursiveCollection.cjs.map +1 -0
  1008. package/build/relations/RecursiveCollection.d.cts +112 -0
  1009. package/build/relations/RecursiveCollection.d.cts.map +1 -0
  1010. package/build/relations/RecursiveCollection.d.mts +112 -0
  1011. package/build/relations/RecursiveCollection.d.mts.map +1 -0
  1012. package/build/relations/RecursiveCollection.js +367 -427
  1013. package/build/relations/RecursiveCollection.js.map +1 -1
  1014. package/build/relations/RecursiveCycleError.cjs +17 -0
  1015. package/build/relations/RecursiveCycleError.cjs.map +1 -0
  1016. package/build/relations/RecursiveCycleError.d.cts +15 -0
  1017. package/build/relations/RecursiveCycleError.d.cts.map +1 -0
  1018. package/build/relations/RecursiveCycleError.d.mts +15 -0
  1019. package/build/relations/RecursiveCycleError.d.mts.map +1 -0
  1020. package/build/relations/RecursiveCycleError.js +14 -13
  1021. package/build/relations/RecursiveCycleError.js.map +1 -1
  1022. package/build/relations/Reference.cjs +25 -0
  1023. package/build/relations/Reference.cjs.map +1 -0
  1024. package/build/relations/Reference.d.cts +39 -0
  1025. package/build/relations/Reference.d.cts.map +1 -0
  1026. package/build/relations/Reference.d.mts +39 -0
  1027. package/build/relations/Reference.d.mts.map +1 -0
  1028. package/build/relations/Reference.js +15 -14
  1029. package/build/relations/Reference.js.map +1 -1
  1030. package/build/relations/ReferenceSymbols.cjs +7 -0
  1031. package/build/relations/ReferenceSymbols.cjs.map +1 -0
  1032. package/build/relations/ReferenceSymbols.d.cts +5 -0
  1033. package/build/relations/ReferenceSymbols.d.cts.map +1 -0
  1034. package/build/relations/ReferenceSymbols.d.mts +5 -0
  1035. package/build/relations/ReferenceSymbols.d.mts.map +1 -0
  1036. package/build/relations/ReferenceSymbols.js +6 -0
  1037. package/build/relations/ReferenceSymbols.js.map +1 -0
  1038. package/build/relations/Relation.cjs +17 -0
  1039. package/build/relations/Relation.cjs.map +1 -0
  1040. package/build/relations/Relation.d.cts +16 -0
  1041. package/build/relations/Relation.d.cts.map +1 -0
  1042. package/build/relations/Relation.d.mts +16 -0
  1043. package/build/relations/Relation.d.mts.map +1 -0
  1044. package/build/relations/Relation.js +10 -8
  1045. package/build/relations/Relation.js.map +1 -1
  1046. package/build/relations/RelationSymbols.cjs +9 -0
  1047. package/build/relations/RelationSymbols.cjs.map +1 -0
  1048. package/build/relations/RelationSymbols.d.cts +6 -0
  1049. package/build/relations/RelationSymbols.d.cts.map +1 -0
  1050. package/build/relations/RelationSymbols.d.mts +6 -0
  1051. package/build/relations/RelationSymbols.d.mts.map +1 -0
  1052. package/build/relations/RelationSymbols.js +7 -0
  1053. package/build/relations/RelationSymbols.js.map +1 -0
  1054. package/build/relations/hasAsyncMethod.cjs +47 -0
  1055. package/build/relations/hasAsyncMethod.cjs.map +1 -0
  1056. package/build/relations/hasAsyncMethod.d.cts +29 -0
  1057. package/build/relations/hasAsyncMethod.d.cts.map +1 -0
  1058. package/build/relations/hasAsyncMethod.d.mts +29 -0
  1059. package/build/relations/hasAsyncMethod.d.mts.map +1 -0
  1060. package/build/relations/hasAsyncMethod.js +40 -43
  1061. package/build/relations/hasAsyncMethod.js.map +1 -1
  1062. package/build/relations/hasManyDerived.cjs +35 -0
  1063. package/build/relations/hasManyDerived.cjs.map +1 -0
  1064. package/build/relations/hasManyDerived.d.cts +25 -0
  1065. package/build/relations/hasManyDerived.d.cts.map +1 -0
  1066. package/build/relations/hasManyDerived.d.mts +25 -0
  1067. package/build/relations/hasManyDerived.d.mts.map +1 -0
  1068. package/build/relations/hasManyDerived.js +30 -28
  1069. package/build/relations/hasManyDerived.js.map +1 -1
  1070. package/build/relations/hasManyThrough.cjs +29 -0
  1071. package/build/relations/hasManyThrough.cjs.map +1 -0
  1072. package/build/relations/hasManyThrough.d.cts +16 -0
  1073. package/build/relations/hasManyThrough.d.cts.map +1 -0
  1074. package/build/relations/hasManyThrough.d.mts +16 -0
  1075. package/build/relations/hasManyThrough.d.mts.map +1 -0
  1076. package/build/relations/hasManyThrough.js +24 -20
  1077. package/build/relations/hasManyThrough.js.map +1 -1
  1078. package/build/relations/hasOneDerived.cjs +32 -0
  1079. package/build/relations/hasOneDerived.cjs.map +1 -0
  1080. package/build/relations/hasOneDerived.d.cts +15 -0
  1081. package/build/relations/hasOneDerived.d.cts.map +1 -0
  1082. package/build/relations/hasOneDerived.d.mts +15 -0
  1083. package/build/relations/hasOneDerived.d.mts.map +1 -0
  1084. package/build/relations/hasOneDerived.js +27 -20
  1085. package/build/relations/hasOneDerived.js.map +1 -1
  1086. package/build/relations/hasOneThrough.cjs +31 -0
  1087. package/build/relations/hasOneThrough.cjs.map +1 -0
  1088. package/build/relations/hasOneThrough.d.cts +16 -0
  1089. package/build/relations/hasOneThrough.d.cts.map +1 -0
  1090. package/build/relations/hasOneThrough.d.mts +16 -0
  1091. package/build/relations/hasOneThrough.d.mts.map +1 -0
  1092. package/build/relations/hasOneThrough.js +26 -22
  1093. package/build/relations/hasOneThrough.js.map +1 -1
  1094. package/build/relations/hasProperty.cjs +109 -0
  1095. package/build/relations/hasProperty.cjs.map +1 -0
  1096. package/build/relations/hasProperty.d.cts +53 -0
  1097. package/build/relations/hasProperty.d.cts.map +1 -0
  1098. package/build/relations/hasProperty.d.mts +53 -0
  1099. package/build/relations/hasProperty.d.mts.map +1 -0
  1100. package/build/relations/hasProperty.js +90 -95
  1101. package/build/relations/hasProperty.js.map +1 -1
  1102. package/build/relations/index.cjs +99 -0
  1103. package/build/relations/index.d.cts +32 -0
  1104. package/build/relations/index.d.mts +32 -0
  1105. package/build/relations/index.js +31 -97
  1106. package/build/relations/isCascadeDelete.cjs +11 -0
  1107. package/build/relations/isCascadeDelete.cjs.map +1 -0
  1108. package/build/relations/isCascadeDelete.d.cts +7 -0
  1109. package/build/relations/isCascadeDelete.d.cts.map +1 -0
  1110. package/build/relations/isCascadeDelete.d.mts +7 -0
  1111. package/build/relations/isCascadeDelete.d.mts.map +1 -0
  1112. package/build/relations/isCascadeDelete.js +10 -0
  1113. package/build/relations/isCascadeDelete.js.map +1 -0
  1114. package/build/resurrection.cjs +74 -0
  1115. package/build/resurrection.cjs.map +1 -0
  1116. package/build/resurrection.d.cts +13 -0
  1117. package/build/resurrection.d.cts.map +1 -0
  1118. package/build/resurrection.d.mts +13 -0
  1119. package/build/resurrection.d.mts.map +1 -0
  1120. package/build/resurrection.js +48 -69
  1121. package/build/resurrection.js.map +1 -1
  1122. package/build/rules.cjs +227 -0
  1123. package/build/rules.cjs.map +1 -0
  1124. package/build/rules.d.cts +145 -0
  1125. package/build/rules.d.cts.map +1 -0
  1126. package/build/rules.d.mts +145 -0
  1127. package/build/rules.d.mts.map +1 -0
  1128. package/build/rules.js +189 -204
  1129. package/build/rules.js.map +1 -1
  1130. package/build/runtimeConfig.cjs +25 -0
  1131. package/build/runtimeConfig.cjs.map +1 -0
  1132. package/build/runtimeConfig.d.cts +24 -0
  1133. package/build/runtimeConfig.d.cts.map +1 -0
  1134. package/build/runtimeConfig.d.mts +24 -0
  1135. package/build/runtimeConfig.d.mts.map +1 -0
  1136. package/build/runtimeConfig.js +16 -12
  1137. package/build/runtimeConfig.js.map +1 -1
  1138. package/build/serde/TypeInfo.cjs +80 -0
  1139. package/build/serde/TypeInfo.cjs.map +1 -0
  1140. package/build/serde/TypeInfo.d.cts +57 -0
  1141. package/build/serde/TypeInfo.d.cts.map +1 -0
  1142. package/build/serde/TypeInfo.d.mts +57 -0
  1143. package/build/serde/TypeInfo.d.mts.map +1 -0
  1144. package/build/serde/TypeInfo.js +78 -0
  1145. package/build/serde/TypeInfo.js.map +1 -0
  1146. package/build/serde/columns.cjs +63 -0
  1147. package/build/serde/columns.cjs.map +1 -0
  1148. package/build/serde/columns.d.cts +38 -0
  1149. package/build/serde/columns.d.cts.map +1 -0
  1150. package/build/serde/columns.d.mts +38 -0
  1151. package/build/serde/columns.d.mts.map +1 -0
  1152. package/build/serde/columns.js +62 -0
  1153. package/build/serde/columns.js.map +1 -0
  1154. package/build/serde/fieldSerde.cjs +188 -0
  1155. package/build/serde/fieldSerde.cjs.map +1 -0
  1156. package/build/serde/fieldSerde.d.cts +87 -0
  1157. package/build/serde/fieldSerde.d.cts.map +1 -0
  1158. package/build/serde/fieldSerde.d.mts +87 -0
  1159. package/build/serde/fieldSerde.d.mts.map +1 -0
  1160. package/build/serde/fieldSerde.js +182 -0
  1161. package/build/serde/fieldSerde.js.map +1 -0
  1162. package/build/serde/serde.cjs +499 -0
  1163. package/build/serde/serde.cjs.map +1 -0
  1164. package/build/serde/serde.d.cts +248 -0
  1165. package/build/serde/serde.d.cts.map +1 -0
  1166. package/build/serde/serde.d.mts +248 -0
  1167. package/build/serde/serde.d.mts.map +1 -0
  1168. package/build/serde/serde.js +485 -0
  1169. package/build/serde/serde.js.map +1 -0
  1170. package/build/serde/temporal.cjs +57 -0
  1171. package/build/serde/temporal.cjs.map +1 -0
  1172. package/build/serde/temporal.d.cts +44 -0
  1173. package/build/serde/temporal.d.cts.map +1 -0
  1174. package/build/serde/temporal.d.mts +44 -0
  1175. package/build/serde/temporal.d.mts.map +1 -0
  1176. package/build/serde/temporal.js +55 -0
  1177. package/build/serde/temporal.js.map +1 -0
  1178. package/build/serde/temporalMappers.cjs +62 -0
  1179. package/build/serde/temporalMappers.cjs.map +1 -0
  1180. package/build/serde/temporalMappers.d.cts +36 -0
  1181. package/build/serde/temporalMappers.d.cts.map +1 -0
  1182. package/build/serde/temporalMappers.d.mts +36 -0
  1183. package/build/serde/temporalMappers.d.mts.map +1 -0
  1184. package/build/serde/temporalMappers.js +58 -0
  1185. package/build/serde/temporalMappers.js.map +1 -0
  1186. package/build/trusted.cjs +16 -0
  1187. package/build/trusted.cjs.map +1 -0
  1188. package/build/trusted.d.cts +8 -0
  1189. package/build/trusted.d.cts.map +1 -0
  1190. package/build/trusted.d.mts +8 -0
  1191. package/build/trusted.d.mts.map +1 -0
  1192. package/build/trusted.js +8 -8
  1193. package/build/trusted.js.map +1 -1
  1194. package/build/typeMap.cjs +3 -0
  1195. package/build/typeMap.d.cts +88 -0
  1196. package/build/typeMap.d.cts.map +1 -0
  1197. package/build/typeMap.d.mts +88 -0
  1198. package/build/typeMap.d.mts.map +1 -0
  1199. package/build/typeMap.js +3 -3
  1200. package/build/upsert.cjs +175 -0
  1201. package/build/upsert.cjs.map +1 -0
  1202. package/build/upsert.d.cts +42 -0
  1203. package/build/upsert.d.cts.map +1 -0
  1204. package/build/upsert.d.mts +42 -0
  1205. package/build/upsert.d.mts.map +1 -0
  1206. package/build/upsert.js +159 -274
  1207. package/build/upsert.js.map +1 -1
  1208. package/build/utils.cjs +204 -0
  1209. package/build/utils.cjs.map +1 -0
  1210. package/build/utils.d.cts +65 -0
  1211. package/build/utils.d.cts.map +1 -0
  1212. package/build/utils.d.mts +65 -0
  1213. package/build/utils.d.mts.map +1 -0
  1214. package/build/utils.js +123 -192
  1215. package/build/utils.js.map +1 -1
  1216. package/package.json +34 -14
  1217. package/build/AliasAssigner.d.ts +0 -10
  1218. package/build/AliasAssigner.d.ts.map +0 -1
  1219. package/build/AliasAssigner.js +0 -39
  1220. package/build/AliasAssigner.js.map +0 -1
  1221. package/build/Aliases.d.ts +0 -117
  1222. package/build/Aliases.d.ts.map +0 -1
  1223. package/build/Aliases.js +0 -457
  1224. package/build/Aliases.js.map +0 -1
  1225. package/build/BaseEntity.d.ts +0 -68
  1226. package/build/BaseEntity.d.ts.map +0 -1
  1227. package/build/ConditionBuilder.d.ts +0 -29
  1228. package/build/ConditionBuilder.d.ts.map +0 -1
  1229. package/build/ConditionBuilder.js +0 -112
  1230. package/build/ConditionBuilder.js.map +0 -1
  1231. package/build/Entity.d.ts +0 -39
  1232. package/build/Entity.d.ts.map +0 -1
  1233. package/build/EntityFields.d.ts +0 -37
  1234. package/build/EntityFields.d.ts.map +0 -1
  1235. package/build/EntityFields.js.map +0 -1
  1236. package/build/EntityFilter.d.ts +0 -134
  1237. package/build/EntityFilter.d.ts.map +0 -1
  1238. package/build/EntityFilter.js +0 -21
  1239. package/build/EntityFilter.js.map +0 -1
  1240. package/build/EntityGraphQLFilter.d.ts +0 -56
  1241. package/build/EntityGraphQLFilter.d.ts.map +0 -1
  1242. package/build/EntityGraphQLFilter.js +0 -53
  1243. package/build/EntityGraphQLFilter.js.map +0 -1
  1244. package/build/EntityManager.d.ts +0 -740
  1245. package/build/EntityManager.d.ts.map +0 -1
  1246. package/build/EntityMetadata.d.ts +0 -233
  1247. package/build/EntityMetadata.d.ts.map +0 -1
  1248. package/build/EnumMetadata.d.ts +0 -15
  1249. package/build/EnumMetadata.d.ts.map +0 -1
  1250. package/build/EnumMetadata.js.map +0 -1
  1251. package/build/FlushLock.d.ts +0 -26
  1252. package/build/FlushLock.d.ts.map +0 -1
  1253. package/build/FlushLock.js +0 -57
  1254. package/build/FlushLock.js.map +0 -1
  1255. package/build/HintTree.d.ts +0 -42
  1256. package/build/HintTree.d.ts.map +0 -1
  1257. package/build/HintTree.js +0 -64
  1258. package/build/HintTree.js.map +0 -1
  1259. package/build/IndexManager.d.ts +0 -31
  1260. package/build/IndexManager.d.ts.map +0 -1
  1261. package/build/InstanceData.d.ts +0 -79
  1262. package/build/InstanceData.d.ts.map +0 -1
  1263. package/build/IsLoadedCache.d.ts +0 -32
  1264. package/build/IsLoadedCache.d.ts.map +0 -1
  1265. package/build/IsLoadedCache.js +0 -91
  1266. package/build/IsLoadedCache.js.map +0 -1
  1267. package/build/JoinRows.d.ts +0 -117
  1268. package/build/JoinRows.d.ts.map +0 -1
  1269. package/build/JoinRows.js +0 -320
  1270. package/build/JoinRows.js.map +0 -1
  1271. package/build/PendingChanges.d.ts +0 -26
  1272. package/build/PendingChanges.d.ts.map +0 -1
  1273. package/build/PendingChanges.js +0 -3
  1274. package/build/PendingChanges.js.map +0 -1
  1275. package/build/PluginManager.d.ts +0 -102
  1276. package/build/PluginManager.d.ts.map +0 -1
  1277. package/build/QueryParser.collectionJoins.d.ts +0 -27
  1278. package/build/QueryParser.collectionJoins.d.ts.map +0 -1
  1279. package/build/QueryParser.collectionJoins.js +0 -466
  1280. package/build/QueryParser.collectionJoins.js.map +0 -1
  1281. package/build/QueryParser.collectionJoins.test.d.ts +0 -2
  1282. package/build/QueryParser.collectionJoins.test.d.ts.map +0 -1
  1283. package/build/QueryParser.collectionJoins.test.js +0 -772
  1284. package/build/QueryParser.collectionJoins.test.js.map +0 -1
  1285. package/build/QueryParser.d.ts +0 -336
  1286. package/build/QueryParser.d.ts.map +0 -1
  1287. package/build/QueryParser.js +0 -965
  1288. package/build/QueryParser.js.map +0 -1
  1289. package/build/QueryParser.pruning.d.ts +0 -7
  1290. package/build/QueryParser.pruning.d.ts.map +0 -1
  1291. package/build/QueryParser.pruning.js +0 -195
  1292. package/build/QueryParser.pruning.js.map +0 -1
  1293. package/build/QueryParser.pruning.test.d.ts +0 -2
  1294. package/build/QueryParser.pruning.test.d.ts.map +0 -1
  1295. package/build/QueryParser.pruning.test.js +0 -106
  1296. package/build/QueryParser.pruning.test.js.map +0 -1
  1297. package/build/QueryParser.test.d.ts +0 -2
  1298. package/build/QueryParser.test.d.ts.map +0 -1
  1299. package/build/QueryParser.test.js +0 -27
  1300. package/build/QueryParser.test.js.map +0 -1
  1301. package/build/QueryVisitor.d.ts +0 -19
  1302. package/build/QueryVisitor.d.ts.map +0 -1
  1303. package/build/QueryVisitor.js +0 -106
  1304. package/build/QueryVisitor.js.map +0 -1
  1305. package/build/ReactionsManager.d.ts +0 -85
  1306. package/build/ReactionsManager.d.ts.map +0 -1
  1307. package/build/ReactionsManager.js +0 -315
  1308. package/build/ReactionsManager.js.map +0 -1
  1309. package/build/Todo.d.ts +0 -35
  1310. package/build/Todo.d.ts.map +0 -1
  1311. package/build/Todo.js +0 -73
  1312. package/build/Todo.js.map +0 -1
  1313. package/build/batchloaders/BatchLoader.d.ts +0 -14
  1314. package/build/batchloaders/BatchLoader.d.ts.map +0 -1
  1315. package/build/batchloaders/enumCollectionBatchLoader.d.ts +0 -7
  1316. package/build/batchloaders/enumCollectionBatchLoader.d.ts.map +0 -1
  1317. package/build/batchloaders/loadBatchLoader.d.ts +0 -17
  1318. package/build/batchloaders/loadBatchLoader.d.ts.map +0 -1
  1319. package/build/batchloaders/manyToManyBatchLoader.d.ts +0 -7
  1320. package/build/batchloaders/manyToManyBatchLoader.d.ts.map +0 -1
  1321. package/build/batchloaders/oneToManyBatchLoader.d.ts +0 -7
  1322. package/build/batchloaders/oneToManyBatchLoader.d.ts.map +0 -1
  1323. package/build/batchloaders/oneToOneBatchLoader.d.ts +0 -7
  1324. package/build/batchloaders/oneToOneBatchLoader.d.ts.map +0 -1
  1325. package/build/batchloaders/populateBatchLoader.d.ts +0 -13
  1326. package/build/batchloaders/populateBatchLoader.d.ts.map +0 -1
  1327. package/build/batchloaders/recursiveChildrenBatchLoader.d.ts +0 -7
  1328. package/build/batchloaders/recursiveChildrenBatchLoader.d.ts.map +0 -1
  1329. package/build/batchloaders/recursiveM2mBatchLoader.d.ts +0 -7
  1330. package/build/batchloaders/recursiveM2mBatchLoader.d.ts.map +0 -1
  1331. package/build/batchloaders/recursiveParentsBatchLoader.d.ts +0 -7
  1332. package/build/batchloaders/recursiveParentsBatchLoader.d.ts.map +0 -1
  1333. package/build/changes.d.ts +0 -92
  1334. package/build/changes.d.ts.map +0 -1
  1335. package/build/config.d.ts +0 -250
  1336. package/build/config.d.ts.map +0 -1
  1337. package/build/config.test.d.ts +0 -2
  1338. package/build/config.test.d.ts.map +0 -1
  1339. package/build/config.test.js +0 -53
  1340. package/build/config.test.js.map +0 -1
  1341. package/build/configure.d.ts +0 -15
  1342. package/build/configure.d.ts.map +0 -1
  1343. package/build/dataloaders/fastWhereFilterHash.d.ts +0 -15
  1344. package/build/dataloaders/fastWhereFilterHash.d.ts.map +0 -1
  1345. package/build/dataloaders/fastWhereFilterHash.test.d.ts +0 -2
  1346. package/build/dataloaders/fastWhereFilterHash.test.d.ts.map +0 -1
  1347. package/build/dataloaders/fastWhereFilterHash.test.js +0 -59
  1348. package/build/dataloaders/fastWhereFilterHash.test.js.map +0 -1
  1349. package/build/dataloaders/findByUniqueDataLoader.d.ts +0 -7
  1350. package/build/dataloaders/findByUniqueDataLoader.d.ts.map +0 -1
  1351. package/build/dataloaders/findCountDataLoader.d.ts +0 -16
  1352. package/build/dataloaders/findCountDataLoader.d.ts.map +0 -1
  1353. package/build/dataloaders/findDataLoader.d.ts +0 -76
  1354. package/build/dataloaders/findDataLoader.d.ts.map +0 -1
  1355. package/build/dataloaders/findIdsDataLoader.d.ts +0 -6
  1356. package/build/dataloaders/findIdsDataLoader.d.ts.map +0 -1
  1357. package/build/dataloaders/findOrCreateDataLoader.d.ts +0 -13
  1358. package/build/dataloaders/findOrCreateDataLoader.d.ts.map +0 -1
  1359. package/build/dataloaders/findPaginatedDataLoader.d.ts +0 -7
  1360. package/build/dataloaders/findPaginatedDataLoader.d.ts.map +0 -1
  1361. package/build/dataloaders/lensDataLoader.d.ts +0 -12
  1362. package/build/dataloaders/lensDataLoader.d.ts.map +0 -1
  1363. package/build/dataloaders/manyToManyFindDataLoader.d.ts +0 -8
  1364. package/build/dataloaders/manyToManyFindDataLoader.d.ts.map +0 -1
  1365. package/build/dataloaders/oneToManyFindDataLoader.d.ts +0 -8
  1366. package/build/dataloaders/oneToManyFindDataLoader.d.ts.map +0 -1
  1367. package/build/defaults.d.ts +0 -54
  1368. package/build/defaults.d.ts.map +0 -1
  1369. package/build/driverApi.d.ts +0 -19
  1370. package/build/driverApi.d.ts.map +0 -1
  1371. package/build/driverApi.js +0 -17
  1372. package/build/driverApi.js.map +0 -1
  1373. package/build/drivers/Driver.d.ts +0 -26
  1374. package/build/drivers/Driver.d.ts.map +0 -1
  1375. package/build/drivers/Driver.js.map +0 -1
  1376. package/build/drivers/EntityWriter.d.ts +0 -64
  1377. package/build/drivers/EntityWriter.d.ts.map +0 -1
  1378. package/build/drivers/IdAssigner.d.ts +0 -48
  1379. package/build/drivers/IdAssigner.d.ts.map +0 -1
  1380. package/build/drivers/buildRawQuery.d.ts +0 -22
  1381. package/build/drivers/buildRawQuery.d.ts.map +0 -1
  1382. package/build/drivers/buildRawQuery.js +0 -153
  1383. package/build/drivers/buildRawQuery.js.map +0 -1
  1384. package/build/drivers/buildUtils.d.ts +0 -9
  1385. package/build/drivers/buildUtils.d.ts.map +0 -1
  1386. package/build/drivers/buildUtils.js +0 -88
  1387. package/build/drivers/buildUtils.js.map +0 -1
  1388. package/build/drivers/index.d.ts +0 -6
  1389. package/build/drivers/index.d.ts.map +0 -1
  1390. package/build/drivers/index.js.map +0 -1
  1391. package/build/fields.d.ts +0 -26
  1392. package/build/fields.d.ts.map +0 -1
  1393. package/build/getProperties.d.ts +0 -28
  1394. package/build/getProperties.d.ts.map +0 -1
  1395. package/build/index.d.ts +0 -133
  1396. package/build/index.d.ts.map +0 -1
  1397. package/build/json.d.ts +0 -77
  1398. package/build/json.d.ts.map +0 -1
  1399. package/build/k.d.ts +0 -2
  1400. package/build/k.d.ts.map +0 -1
  1401. package/build/keys.d.ts +0 -49
  1402. package/build/keys.d.ts.map +0 -1
  1403. package/build/keywords.d.ts +0 -5
  1404. package/build/keywords.d.ts.map +0 -1
  1405. package/build/keywords.js +0 -124
  1406. package/build/keywords.js.map +0 -1
  1407. package/build/loadHints.d.ts +0 -121
  1408. package/build/loadHints.d.ts.map +0 -1
  1409. package/build/loadHints.js +0 -129
  1410. package/build/loadHints.js.map +0 -1
  1411. package/build/loadLens.d.ts +0 -77
  1412. package/build/loadLens.d.ts.map +0 -1
  1413. package/build/loadLens.js +0 -320
  1414. package/build/loadLens.js.map +0 -1
  1415. package/build/logging/FactoryLogger.d.ts +0 -24
  1416. package/build/logging/FactoryLogger.d.ts.map +0 -1
  1417. package/build/logging/FieldLogger.d.ts +0 -27
  1418. package/build/logging/FieldLogger.d.ts.map +0 -1
  1419. package/build/logging/ReactionLogger.d.ts +0 -27
  1420. package/build/logging/ReactionLogger.d.ts.map +0 -1
  1421. package/build/newEntity.d.ts +0 -45
  1422. package/build/newEntity.d.ts.map +0 -1
  1423. package/build/newTestInstance.d.ts +0 -208
  1424. package/build/newTestInstance.d.ts.map +0 -1
  1425. package/build/normalizeHints.d.ts +0 -23
  1426. package/build/normalizeHints.d.ts.map +0 -1
  1427. package/build/plugins/ImmutableEntitiesPlugin.d.ts +0 -9
  1428. package/build/plugins/ImmutableEntitiesPlugin.d.ts.map +0 -1
  1429. package/build/plugins/PreloadPlugin.d.ts +0 -69
  1430. package/build/plugins/PreloadPlugin.d.ts.map +0 -1
  1431. package/build/plugins/PreloadPlugin.js.map +0 -1
  1432. package/build/preloading/JsonAggregatePreloader.d.ts +0 -16
  1433. package/build/preloading/JsonAggregatePreloader.d.ts.map +0 -1
  1434. package/build/preloading/canPreload.d.ts +0 -3
  1435. package/build/preloading/canPreload.d.ts.map +0 -1
  1436. package/build/preloading/partitionHint.d.ts +0 -5
  1437. package/build/preloading/partitionHint.d.ts.map +0 -1
  1438. package/build/reactiveHints.d.ts +0 -146
  1439. package/build/reactiveHints.d.ts.map +0 -1
  1440. package/build/reactiveHints.js +0 -509
  1441. package/build/reactiveHints.js.map +0 -1
  1442. package/build/relations/AbstractPropertyImpl.d.ts +0 -8
  1443. package/build/relations/AbstractPropertyImpl.d.ts.map +0 -1
  1444. package/build/relations/AbstractRelationImpl.d.ts +0 -41
  1445. package/build/relations/AbstractRelationImpl.d.ts.map +0 -1
  1446. package/build/relations/AsyncProperty.d.ts +0 -36
  1447. package/build/relations/AsyncProperty.d.ts.map +0 -1
  1448. package/build/relations/AsyncReactiveField.d.ts +0 -41
  1449. package/build/relations/AsyncReactiveField.d.ts.map +0 -1
  1450. package/build/relations/Collection.d.ts +0 -33
  1451. package/build/relations/Collection.d.ts.map +0 -1
  1452. package/build/relations/CustomCollection.d.ts +0 -69
  1453. package/build/relations/CustomCollection.d.ts.map +0 -1
  1454. package/build/relations/CustomReference.d.ts +0 -71
  1455. package/build/relations/CustomReference.d.ts.map +0 -1
  1456. package/build/relations/EnumCollection.d.ts +0 -81
  1457. package/build/relations/EnumCollection.d.ts.map +0 -1
  1458. package/build/relations/LargeCollection.d.ts +0 -19
  1459. package/build/relations/LargeCollection.d.ts.map +0 -1
  1460. package/build/relations/LargeCollection.js.map +0 -1
  1461. package/build/relations/ManyToManyCollection.d.ts +0 -52
  1462. package/build/relations/ManyToManyCollection.d.ts.map +0 -1
  1463. package/build/relations/ManyToManyLargeCollection.d.ts +0 -31
  1464. package/build/relations/ManyToManyLargeCollection.d.ts.map +0 -1
  1465. package/build/relations/ManyToOneReference.d.ts +0 -117
  1466. package/build/relations/ManyToOneReference.d.ts.map +0 -1
  1467. package/build/relations/OneToManyCollection.d.ts +0 -62
  1468. package/build/relations/OneToManyCollection.d.ts.map +0 -1
  1469. package/build/relations/OneToManyLargeCollection.d.ts +0 -26
  1470. package/build/relations/OneToManyLargeCollection.d.ts.map +0 -1
  1471. package/build/relations/OneToOneReference.d.ts +0 -93
  1472. package/build/relations/OneToOneReference.d.ts.map +0 -1
  1473. package/build/relations/PolymorphicReference.d.ts +0 -89
  1474. package/build/relations/PolymorphicReference.d.ts.map +0 -1
  1475. package/build/relations/ReactiveField.d.ts +0 -85
  1476. package/build/relations/ReactiveField.d.ts.map +0 -1
  1477. package/build/relations/ReactiveGetter.d.ts +0 -30
  1478. package/build/relations/ReactiveGetter.d.ts.map +0 -1
  1479. package/build/relations/ReactiveManyToMany.d.ts +0 -57
  1480. package/build/relations/ReactiveManyToMany.d.ts.map +0 -1
  1481. package/build/relations/ReactiveManyToManyOtherSide.d.ts +0 -48
  1482. package/build/relations/ReactiveManyToManyOtherSide.d.ts.map +0 -1
  1483. package/build/relations/ReactiveReference.d.ts +0 -119
  1484. package/build/relations/ReactiveReference.d.ts.map +0 -1
  1485. package/build/relations/ReadOnlyCollection.d.ts +0 -19
  1486. package/build/relations/ReadOnlyCollection.d.ts.map +0 -1
  1487. package/build/relations/RecursiveCollection.d.ts +0 -108
  1488. package/build/relations/RecursiveCollection.d.ts.map +0 -1
  1489. package/build/relations/RecursiveCycleError.d.ts +0 -13
  1490. package/build/relations/RecursiveCycleError.d.ts.map +0 -1
  1491. package/build/relations/Reference.d.ts +0 -35
  1492. package/build/relations/Reference.d.ts.map +0 -1
  1493. package/build/relations/Relation.d.ts +0 -14
  1494. package/build/relations/Relation.d.ts.map +0 -1
  1495. package/build/relations/hasAsyncMethod.d.ts +0 -27
  1496. package/build/relations/hasAsyncMethod.d.ts.map +0 -1
  1497. package/build/relations/hasManyDerived.d.ts +0 -22
  1498. package/build/relations/hasManyDerived.d.ts.map +0 -1
  1499. package/build/relations/hasManyThrough.d.ts +0 -10
  1500. package/build/relations/hasManyThrough.d.ts.map +0 -1
  1501. package/build/relations/hasOneDerived.d.ts +0 -12
  1502. package/build/relations/hasOneDerived.d.ts.map +0 -1
  1503. package/build/relations/hasOneThrough.d.ts +0 -10
  1504. package/build/relations/hasOneThrough.d.ts.map +0 -1
  1505. package/build/relations/hasProperty.d.ts +0 -50
  1506. package/build/relations/hasProperty.d.ts.map +0 -1
  1507. package/build/relations/index.d.ts +0 -30
  1508. package/build/relations/index.d.ts.map +0 -1
  1509. package/build/relations/index.js.map +0 -1
  1510. package/build/resurrection.d.ts +0 -10
  1511. package/build/resurrection.d.ts.map +0 -1
  1512. package/build/rules.d.ts +0 -123
  1513. package/build/rules.d.ts.map +0 -1
  1514. package/build/runtimeConfig.d.ts +0 -17
  1515. package/build/runtimeConfig.d.ts.map +0 -1
  1516. package/build/scopes.d.ts +0 -185
  1517. package/build/scopes.d.ts.map +0 -1
  1518. package/build/scopes.js +0 -302
  1519. package/build/scopes.js.map +0 -1
  1520. package/build/serde.d.ts +0 -277
  1521. package/build/serde.d.ts.map +0 -1
  1522. package/build/serde.js +0 -517
  1523. package/build/serde.js.map +0 -1
  1524. package/build/temporal.d.ts +0 -46
  1525. package/build/temporal.d.ts.map +0 -1
  1526. package/build/temporal.js +0 -66
  1527. package/build/temporal.js.map +0 -1
  1528. package/build/temporalMappers.d.ts +0 -25
  1529. package/build/temporalMappers.d.ts.map +0 -1
  1530. package/build/temporalMappers.js +0 -59
  1531. package/build/temporalMappers.js.map +0 -1
  1532. package/build/trusted.d.ts +0 -5
  1533. package/build/trusted.d.ts.map +0 -1
  1534. package/build/typeMap.d.ts +0 -68
  1535. package/build/typeMap.d.ts.map +0 -1
  1536. package/build/typeMap.js.map +0 -1
  1537. package/build/unnest.d.ts +0 -13
  1538. package/build/unnest.d.ts.map +0 -1
  1539. package/build/unnest.js +0 -85
  1540. package/build/unnest.js.map +0 -1
  1541. package/build/upsert.d.ts +0 -42
  1542. package/build/upsert.d.ts.map +0 -1
  1543. package/build/utils.d.ts +0 -60
  1544. package/build/utils.d.ts.map +0 -1
  1545. package/build/withLoaded.d.ts +0 -56
  1546. package/build/withLoaded.d.ts.map +0 -1
  1547. package/build/withLoaded.js +0 -76
  1548. package/build/withLoaded.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"findDataLoader.js","sourceRoot":"","sources":["../../src/dataloaders/findDataLoader.ts"],"names":[],"mappings":";;;AAsCA,wCAgHC;AASD,0CAEC;AAED,0CAIC;AAGD,sDAgBC;AAiCD,sDAiDC;AAmBD,wEAaC;AAGD,sCAcC;AAiID,wCAkBC;AA+BD,0EAUC;AAvfD,gEAAgD;AAChD,oDAAmG;AACnG,sDAAgE;AAChE,0CAA4C;AAC5C,gDAWwB;AACxB,kDAAkD;AAElD,sCAA+C;AAC/C,0CAAoC;AAEpC,sDAA4C;AAC5C,sCAA2C;AAC3C,oCAAuC;AACvC,+DAA4D;AAE/C,QAAA,aAAa,GAAG,MAAM,CAAC;AAUpC,SAAgB,cAAc,CAC5B,EAAiB,EACjB,IAAuC,EACvC,MAA4B,EAC5B,IAA6B;IAE7B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAClC,IAAI,OAAO,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,4BAAW,EAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAA,4BAAc,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,qBAAa,EAAE,KAAK,EAAE;QACjF,GAAG,IAAI;QACP,KAAK,EAAE,EAAE,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KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;gBAC9C,IAAI,GAAG,KAAK,CAAC;gBACb,MAAM;YACR,CAAC;QACH,CAAC;QACD,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,CAAM,EAAE,CAAM;IAC/B,OAAO,IAAA,cAAK,EAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAA,oBAAW,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,SAAgB,+BAA+B,CAAC,IAAoB,EAAE,KAAsB;IAC1F,6FAA6F;IAC7F,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,WAAW,CAAC,KAAK,CAAC,CAAC;IACnB,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC/B,8EAA8E;QAC7E,KAAa,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IAClC,CAAC;IACD,qDAAqD;IACrD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"findDataLoader.js","names":[],"sources":["../../src/dataloaders/findDataLoader.ts"],"sourcesContent":["import { fastWhereFilterHash } from \"src/dataloaders/fastWhereFilterHash.ts\";\nimport type { OpColumn } from \"src/drivers/EntityWriter.ts\";\nimport type { Entity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, getEmInternalApi } from \"src/EntityManager.ts\";\nimport { type EntityMetadata, getMetadata } from \"src/EntityMetadata.ts\";\nimport { equal, equalArrays } from \"src/fields.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 { opToFn } from \"src/queries/find/EntityGraphQLFilter.ts\";\nimport {\n type ParsedCteClause,\n type ParsedFindQuery,\n type ParsedGroupBy,\n type ParsedSelect,\n getTables,\n parseAlias,\n parseFindQuery,\n} from \"src/queries/find/QueryParser.ts\";\nimport { isQueryProvablyEmpty, visitConditions } from \"src/queries/find/QueryVisitor.ts\";\nimport type { ColumnCondition, ParsedValueFilter, RawCondition } from \"src/queries/parsedConditions.ts\";\nimport { kqDot } from \"src/queries/sql/keywords.ts\";\nimport { buildUnnestCte } from \"src/queries/unnest.ts\";\nimport { assertNever, fail } from \"src/utils.ts\";\n\nexport const findOperation = \"find\";\n\ninterface PreparedFindEntry<T extends Entity> {\n filter: FilterAndSettings<T>;\n query: ParsedFindQuery;\n bindings: any[];\n findSettings: any;\n checkLimit: boolean | undefined;\n}\n\nexport function findDataLoader<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, ...opts } = filter;\n if (\"limit\" in opts || \"offset\" in opts) {\n throw new Error(\"Cannot use limit/offset with findDataLoader\");\n }\n\n const meta = getMetadata(type);\n const query = parseFindQuery(meta, where, opts);\n const { checkLimit, findSettings } = em[\"prepareFind\"](meta, findOperation, query, {\n ...opts,\n limit: em.entityLimit,\n });\n if (isQueryProvablyEmpty(query)) return Promise.resolve([]);\n\n const bindings: any[] = [];\n collectValues(bindings, query);\n const prepared = { filter, query, bindings, findSettings, checkLimit } satisfies PreparedFindEntry<T>;\n const batchKey = getBatchKeyFromGenericStructure(meta, query);\n\n return em\n .getLoader<PreparedFindEntry<T>, T[]>(\n findOperation,\n // It's unlikely we'll have simultaneous em.finds with the same WHERE clause structure\n // but lots of different load hints, and it'd be complicated to implement the preloading\n // in a way that doesn't naively over-fetch data (which our loadDataLoader does prevent,\n // but it's simpler b/c it's given exact ids to load), so for now just include the load\n // hint in the batch key.\n `${batchKey}-${hintKey(hint)}`,\n async (entries) => {\n // We're guaranteed that these queries all have the same structure\n\n // Don't bother with the CTE if there's only 1 query (or each query has exactly the same filter values)\n if (entries.length === 1) {\n const { query, findSettings, checkLimit } = entries[0];\n // Maybe add preload joins\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, checkLimit);\n const entities = em[\"hydrateAndFinalize\"](type, rowData, {\n sidecars: (entities) => preloadHydrator?.(rowData, entities),\n });\n return [filterDeletedEntities(em, entities)];\n }\n\n // WITH _find (tag, arg1, arg2) AS (\n // SELECT unnest($0::int[]), unnest($0::varchar[]), unnest($0::varchar[])\n // )\n // SELECT a.*, array_agg(_find.tag) AS _tags\n // FROM authors a\n // CROSS JOIN _find AS _find\n // WHERE a.first_name = _find.arg0 OR a.last_name = _find.arg1\n // GROUP BY a.id\n\n // Build the list of 'arg1', 'arg2', ... strings\n const { query, findSettings, checkLimit } = entries[0];\n const { preloader } = getEmInternalApi(em);\n const preloadJoins = preloader && hint && preloader.getPreloadJoins(meta, buildHintTree(hint), query);\n\n const args = collectAndReplaceArgs(query, entries);\n const argsColumns: OpColumn[] = [{ columnName: \"tag\", dbType: \"int\" }, ...args.map((a) => a.column)];\n const columnValues = createColumnValuesFromPrepared(args, entries);\n const query2: ParsedFindQuery = {\n ...query,\n selects: [\"array_agg(_find.tag) as _tags\", ...query.selects],\n tables: [{ join: \"cross\", table: \"_find\", alias: \"_find\" }, ...query.tables],\n ctes: [buildUnnestCte(\"_find\", argsColumns, columnValues), ...(query.ctes ?? [])],\n };\n if (preloadJoins) {\n query2.selects.push(\n ...preloadJoins.flatMap((j) =>\n // Because we 'group by primary.id' to collapse the \"a1 matched multiple finds\" into\n // a single row, we also need to pick just the first value of each preload column\n j.selects.map((s) => `(array_agg(${s.value}))[1] AS ${s.as}`),\n ),\n );\n query2.tables.push(...preloadJoins.map((j) => j.join));\n }\n\n // Because we want to use `array_agg(tag)`, add `GROUP BY`s to the values we're selecting\n query2.groupBys = buildGroupBys(query2.selects);\n\n // Also because of our `array_agg` group by, add any order bys to the group by\n const [primary] = getTables(query2);\n for (const { alias, column } of query2.orderBys) {\n if (alias !== primary.alias) {\n query2.groupBys.push({ alias, column });\n }\n }\n\n const rowData = await em[\"executePreparedFindRowData\"](meta, findOperation, query2, findSettings, checkLimit);\n\n // Make an empty array for each batched query, per the dataloader contract\n const results = entries.map(() => [] as T[]);\n em[\"hydrateAndFinalize\"](type, rowData, {\n sidecars: (entities) => {\n preloadJoins?.forEach((j) => j.hydrator(rowData, entities));\n // Put each row into the tagged query it matched\n for (let i = 0; i < entities.length; i++) {\n const entity = entities[i];\n if (!entity.isDeletedEntity) {\n for (const tag of rowData.get(i, \"_tags\")) results[tag].push(entity);\n }\n }\n },\n });\n return results;\n },\n // Our filter/order tuple is a complex object, so use a stable cache key to ensure caching works.\n { cacheKeyFn: queryFilterHash },\n )\n .load(prepared);\n}\n\n/**\n * Returns a stable cache key from the already-parsed query rather than the raw `where`.\n *\n * A scope `where` is an opaque proxy that `fastWhereFilterHash` can't serialize — but it doesn't need\n * to: by this point the scope's structure and values are already worked into the `ParsedFindQuery`, so\n * hashing that distinguishes e.g. `Author.adult` (age>=18) from `Author.senior` (age>=65) correctly.\n */\nexport function queryFilterHash(entry: { query: ParsedFindQuery; findSettings: object }): any {\n return whereFilterHash({ query: entry.query, findSettings: entry.findSettings });\n}\n\nexport function whereFilterHash(where: object): any {\n const key = fastWhereFilterHash(where);\n if (key === undefined) throw new Error(\"fastWhereFilterHash could not serialize find filter\");\n return key;\n}\n\n/** Filters pending-delete entities in place to avoid allocating a replacement array for the common find path. */\nexport function filterDeletedEntities<T extends Entity>(em: EntityManager, entities: T[]): T[] {\n // Most EMs never delete entities, so skip even the findIndex scan until a delete has happened.\n if (!getEmInternalApi(em).hasAnyDeletes()) return entities;\n\n const firstDeleted = entities.findIndex((entity) => entity.isDeletedEntity);\n if (firstDeleted === -1) return entities;\n\n let writeIndex = firstDeleted;\n for (let readIndex = firstDeleted + 1; readIndex < entities.length; readIndex++) {\n const entity = entities[readIndex];\n if (!entity.isDeletedEntity) {\n entities[writeIndex++] = entity;\n }\n }\n entities.length = writeIndex;\n return entities;\n}\n\nclass ArgCounter {\n private index = 0;\n next(): number {\n return this.index++;\n }\n}\n\n/**\n * A single batched arg: the `_find` CTE column to create, plus the index into each entry's `bindings`\n * array that fills it. `bindingIndex` can differ from the column's position because inlined constants\n * are skipped — see {@link collectAndReplaceArgs}.\n */\nexport interface CteArg {\n column: OpColumn;\n bindingIndex: number;\n}\n\n/**\n * Rewrites each batched arg in `query` into a `_find.argX` placeholder.\n *\n * Any condition whose value(s) are identical across every batched query is left inline (using\n * query's condition as-is from entity0), so it renders as `col = ?` for better query planning.\n *\n * The returned array has the non-constant CTE columns, one {@link CteArg} per `_find.argX`.\n *\n * Because constants are skipped, the 1st CTE column (i.e. for last name) might actually have a\n * binding index of `1` if we've skipped an early constant column (i.e. first name).\n *\n * @param query the initial query in the batch, that all other queries structurally match\n * @param entries the values (bindings) for each query in the batch\n */\nexport function collectAndReplaceArgs(query: ParsedFindQuery, entries: readonly { bindings: any[] }[]): CteArg[] {\n const args: CteArg[] = [];\n const argsIndex = new ArgCounter();\n // `bindings` were pushed in this same `visitConditions` order, so we can walk the conditions and\n // each entry's `bindings` in lockstep, deciding per condition whether to inline or batch its value(s).\n const constant = computeConstantBindings(entries);\n let bindingIndex = 0;\n visitConditions(query, {\n visitCond(c: ColumnCondition) {\n if (\"value\" in c.cond) {\n const { kind } = c.cond;\n // `between` consumes two bindings, everything else (incl. array `in`/`nin`) consumes one.\n const consumed = kind === \"between\" ? 2 : 1;\n const start = bindingIndex;\n bindingIndex += consumed;\n // If every batched query shares this condition's value(s), leave it as a normal `col = ?`\n // condition (rendered from `entries[0]`'s value) instead of threading it through the CTE.\n let allConstant = true;\n for (let k = 0; k < consumed; k++) {\n if (!constant[start + k]) {\n allConstant = false;\n break;\n }\n }\n if (allConstant) return;\n // `arg${args.length}` keeps the CTE column names in step with the `_find.argX` references that\n // `rewriteToRawCondition` emits, since both only advance for the args we actually batch.\n if (kind === \"between\") {\n args.push({ column: { columnName: `arg${args.length}`, dbType: c.dbType }, bindingIndex: start });\n args.push({ column: { columnName: `arg${args.length}`, dbType: c.dbType }, bindingIndex: start + 1 });\n } else {\n // Figure out the _find CTE's `unnest($n::${dbType})` so Postgres knows what we're sending in\n const dbType =\n kind === \"in\" || kind === \"nin\"\n ? `${c.dbType}[]` // `in`/`nin` compare against an array column\n : kind === \"jsonPathExists\" || kind === \"jsonPathPredicate\"\n ? \"jsonpath\" // jsonPath needs `::jsonpath` (not `::jsonb`, which would be an invalid `jsonb @@ jsonb`)\n : c.dbType;\n args.push({ column: { columnName: `arg${args.length}`, dbType }, bindingIndex: start });\n }\n return rewriteToRawCondition(c, argsIndex);\n } else if (c.cond.kind === \"is-null\" || c.cond.kind === \"not-null\") {\n // leave it alone\n } else {\n throw new Error(\"Unsupported\");\n }\n },\n });\n return args;\n}\n\nfunction rewriteToRawCondition(c: ColumnCondition, argsIndex: ArgCounter): RawCondition {\n const [op, negate] = makeOp(c.cond, argsIndex);\n return {\n kind: \"raw\",\n aliases: [c.alias],\n condition: `${negate ? \"NOT \" : \"\"}${kqDot(c.alias, c.column)} ${op}`,\n pruneable: c.pruneable ?? false,\n bindings: [],\n };\n}\n\n/**\n * Builds the column-major values for the `_find` CTE.\n *\n * Column 0 is the per-entry `tag`; the remaining columns mirror `args` 1:1, each pulling its\n * `bindingIndex` from every entry's `bindings` (so inlined constants are naturally skipped).\n */\nexport function createColumnValuesFromPrepared(\n args: readonly CteArg[],\n entries: readonly { bindings: any[] }[],\n): any[][] {\n const columnValues: any[][] = new Array(args.length + 1);\n for (let i = 0; i < columnValues.length; i++) columnValues[i] = [];\n entries.forEach((entry, i) => {\n columnValues[0].push(i);\n for (let k = 0; k < args.length; k++) {\n columnValues[k + 1].push(entry.bindings[args[k].bindingIndex]);\n }\n });\n return columnValues;\n}\n\n/** Pushes the arg values of a given query in the cross-query `bindings` array. */\nexport function collectValues(bindings: any[], query: ParsedFindQuery): void {\n visitConditions(query, {\n visitCond(c: ColumnCondition) {\n if (\"value\" in c.cond) {\n // between has two values\n if (c.cond.kind === \"between\") {\n bindings.push(c.cond.value[0]);\n bindings.push(c.cond.value[1]);\n } else {\n bindings.push(c.cond.value);\n }\n }\n },\n });\n}\n\n/** Returns true for select expressions that do not need to be represented in GROUP BY. */\nfunction isAggregateSelect(select: string): boolean {\n return select.toLowerCase().includes(\"array_agg(\");\n}\n\n/** Builds GROUP BYs for selected values, accounting for whole-row selects that are grouped by primary key. */\nfunction buildGroupBys(selects: ParsedSelect[]): ParsedGroupBy[] {\n const sqlSelects = selects.map(selectSqlForGroupBy);\n const wholeRowAliases = new Set(\n sqlSelects\n .filter((select) => !isAggregateSelect(select) && stripSelectAlias(select).endsWith(\".*\"))\n .map(parseAlias),\n );\n return sqlSelects\n .filter((select) => !isAggregateSelect(select))\n .filter((select) => !isCoveredByWholeRowGroupBy(select, wholeRowAliases))\n .map((select) => groupBySelect(select));\n}\n\n/** Returns a SQL string for group-by analysis, until we support bindings in ParsedGroupBy. */\nfunction selectSqlForGroupBy(select: ParsedSelect): string {\n if (typeof select === \"string\") {\n return select;\n }\n throw new Error(`find batching does not support grouped selects with bindings: ${select.sql}`);\n}\n\n/** Builds a GROUP BY for a selected value so `array_agg(_find.tag)` can coexist with plugin-rewritten selects. */\nfunction groupBySelect(select: string): ParsedGroupBy {\n const expression = stripSelectAlias(select);\n if (expression.endsWith(\".*\")) {\n return { alias: parseAlias(expression), column: \"id\" };\n }\n return { expression };\n}\n\n/** Removes a trailing SQL alias from a select expression, i.e. `(a.id) as id` -> `(a.id)`. */\nfunction stripSelectAlias(select: string): string {\n const match = /^(.*)\\s+as\\s+[^\\s]+$/i.exec(select);\n return match?.[1] ?? select;\n}\n\n/** Returns true when an expression is functionally covered by an already-grouped whole-row alias. */\nfunction isCoveredByWholeRowGroupBy(select: string, wholeRowAliases: Set<string>): boolean {\n const expression = stripSelectAlias(select);\n if (expression.endsWith(\".*\")) {\n return false;\n }\n const aliases = findSelectedAliases(expression);\n return aliases.length > 0 && aliases.every((alias) => wholeRowAliases.has(alias));\n}\n\n/** Finds SQL aliases referenced as `alias.column` or `\"alias\".column`, i.e. `a.first_name` -> `a`. */\nfunction findSelectedAliases(expression: string): string[] {\n const aliases = new Set<string>();\n for (const match of expression.matchAll(/(?:\"([^\"]+)\"|([a-zA-Z_][\\w]*))\\./g)) {\n aliases.add(match[1] ?? match[2]);\n }\n return [...aliases];\n}\n\n/** Returns [operator, argsTaken, negate], i.e. `[\"=\", 1, false]`. */\nfunction makeOp(cond: ParsedValueFilter<any>, argsIndex: ArgCounter): [string, boolean] {\n switch (cond.kind) {\n case \"eq\":\n case \"ne\":\n case \"gte\":\n case \"gt\":\n case \"lte\":\n case \"lt\":\n case \"like\":\n case \"nlike\":\n case \"ilike\":\n case \"nilike\":\n case \"regex\":\n case \"nregex\":\n case \"iregex\":\n case \"niregex\":\n case \"jsonPathExists\":\n case \"jsonPathPredicate\":\n case \"contains\":\n case \"overlaps\":\n case \"containedBy\": {\n const fn = opToFn[cond.kind] ?? fail(`Invalid operator ${cond.kind}`);\n return [`${fn} _find.arg${argsIndex.next()}`, false];\n }\n case \"noverlaps\":\n case \"ncontains\": {\n const fn = (opToFn as any)[cond.kind.substring(1)] ?? fail(`Invalid operator ${cond.kind}`);\n return [`${fn} _find.arg${argsIndex.next()}`, true];\n }\n case \"is-null\":\n return [`IS NULL`, false];\n case \"not-null\":\n return [`IS NOT NULL`, false];\n case \"in\":\n return [`= ANY(_find.arg${argsIndex.next()})`, false];\n case \"nin\":\n return [`!= ALL(_find.arg${argsIndex.next()})`, false];\n case \"between\":\n return [`BETWEEN _find.arg${argsIndex.next()} AND _find.arg${argsIndex.next()}`, false];\n default:\n assertNever(cond);\n }\n}\n\n/**\n * Creates a `VALUES (...), (...)` SQL string for use in a CTE, typically for our\n * batch INSERTs/UPDATEs where the CTE is how we inject N rows of data/params into\n * the single INSERT/UPDATE statement.\n *\n * The caller is responsible for filling in the `bindings`, which should have 1\n * entry for each `rows x columns` cell.\n *\n * @deprecated Use newUnnestCte instead because it uses arrays to have a bounded number of parameters.\n */\nexport function buildValuesCte(\n alias: string,\n columns: { columnName: string; dbType: string }[],\n rows: readonly any[],\n // Should have a value for each `row x column` cell.\n bindings: readonly any[],\n): ParsedCteClause {\n return {\n alias,\n columns,\n query: {\n kind: \"raw\",\n sql: `VALUES\n ${rows.map((_, i) => `(${columns.map((c) => (i === 0 ? `?::${c.dbType}` : `?`)).join(\", \")})`).join(\", \")}\n `,\n bindings,\n },\n };\n}\n\n/** Returns, per binding slot, whether every batched query shares the same value. */\nfunction computeConstantBindings(entries: readonly { bindings: any[] }[]): boolean[] {\n const length = entries[0].bindings.length;\n const constant = new Array<boolean>(length);\n for (let j = 0; j < length; j++) {\n const first = entries[0].bindings[j];\n let same = true;\n for (let i = 1; i < entries.length; i++) {\n if (!argsEqual(entries[i].bindings[j], first)) {\n same = false;\n break;\n }\n }\n constant[j] = same;\n }\n return constant;\n}\n\n/**\n * Deep-equals two find-arg values (scalars, Dates, Temporals, or arrays thereof), reusing the same\n * scalar/array equality `setField` uses for change detection.\n *\n * Only used to decide whether a condition can be inlined, so false negatives are safe (we just fall\n * back to the CTE); we only return true when the values are genuinely equal.\n */\nfunction argsEqual(a: any, b: any): boolean {\n return equal(a, b) || (Array.isArray(a) && Array.isArray(b) && equalArrays(a, b));\n}\n\nexport function getBatchKeyFromGenericStructure(meta: EntityMetadata, query: ParsedFindQuery): string {\n // Temporarily swap condition values for `*` so we can see the generic structure of the query,\n // then restore them; this avoids deep-cloning the entire parsed query on every em.find call.\n // Track values per condition object b/c parseFindQuery does not deep copy complex conditions,\n // i.e. `a.firstName.eq(...)`, so the same condition instance could appear twice.\n const saved = new Map<any, any>();\n visitConditions(query, {\n visitCond(c: ColumnCondition) {\n const { cond } = c;\n if (\"value\" in cond && !saved.has(cond)) {\n saved.set(cond, cond.value);\n cond.value = \"*\";\n }\n },\n });\n const structure = JSON.stringify(query);\n for (const [cond, value] of saved) cond.value = value;\n // Include the meta b/c STI queries for different subtypes will look identical\n return meta.stiDiscriminatorValue ? `${structure}|${meta.type}` : structure;\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,MAAa,gBAAgB;AAU7B,SAAgB,eACd,IACA,MACA,QACA,MACc;CACd,MAAM,EAAE,OAAO,GAAG,SAAS;CAC3B,IAAI,WAAW,QAAQ,YAAY,MACjC,MAAM,IAAI,MAAM,6CAA6C;CAG/D,MAAM,OAAO,YAAY,IAAI;CAC7B,MAAM,QAAQ,eAAe,MAAM,OAAO,IAAI;CAC9C,MAAM,EAAE,YAAY,iBAAiB,GAAG,cAAc,CAAC,MAAM,eAAe,OAAO;EACjF,GAAG;EACH,OAAO,GAAG;CACZ,CAAC;CACD,IAAI,qBAAqB,KAAK,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAE1D,MAAM,WAAkB,CAAC;CACzB,cAAc,UAAU,KAAK;CAC7B,MAAM,WAAW;EAAE;EAAQ;EAAO;EAAU;EAAc;CAAW;CACrE,MAAM,WAAW,gCAAgC,MAAM,KAAK;CAE5D,OAAO,GACJ,UACC,eAMA,GAAG,SAAS,GAAG,QAAQ,IAAI,KAC3B,OAAO,YAAY;EAIjB,IAAI,QAAQ,WAAW,GAAG;GACxB,MAAM,EAAE,OAAO,cAAc,eAAe,QAAQ;GAEpD,MAAM,EAAE,cAAc,iBAAiB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GAAQ,GAAiB;CAC1C,OAAO,MAAM,GAAG,CAAC,KAAM,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,KAAK,YAAY,GAAG,CAAC;AACjF;AAEA,SAAgB,gCAAgC,MAAsB,OAAgC;CAKpG,MAAM,wBAAQ,IAAI,IAAc;CAChC,gBAAgB,OAAO,EACrB,UAAU,GAAoB;EAC5B,MAAM,EAAE,SAAS;EACjB,IAAI,WAAW,QAAQ,CAAC,MAAM,IAAI,IAAI,GAAG;GACvC,MAAM,IAAI,MAAM,KAAK,KAAK;GAC1B,KAAK,QAAQ;EACf;CACF,EACF,CAAC;CACD,MAAM,YAAY,KAAK,UAAU,KAAK;CACtC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,KAAK,QAAQ;CAEhD,OAAO,KAAK,wBAAwB,GAAG,UAAU,GAAG,KAAK,SAAS;AACpE"}
@@ -0,0 +1,82 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_keys = require("../keys.cjs");
3
+ const require_queries_sql_keywords = require("../queries/sql/keywords.cjs");
4
+ const require_queries_find_QueryVisitor = require("../queries/find/QueryVisitor.cjs");
5
+ const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
6
+ const require_utils = require("../utils.cjs");
7
+ const require_EntityMetadata = require("../EntityMetadata.cjs");
8
+ const require_queries_unnest = require("../queries/unnest.cjs");
9
+ const require_dataloaders_findDataLoader = require("./findDataLoader.cjs");
10
+ //#region src/dataloaders/findIdsDataLoader.ts
11
+ const findIdsOperation = "find-ids";
12
+ function findIdsDataLoader(em, type, filter) {
13
+ const { where, ...opts } = filter;
14
+ if (opts.limit || opts.offset) throw new Error("Cannot use limit/offset with findIdsDataLoader");
15
+ const meta = require_EntityMetadata.getMetadata(type);
16
+ const query = require_queries_find_QueryParser.parseFindQuery(meta, where, opts);
17
+ const { findSettings } = em["prepareFind"](meta, findIdsOperation, query, {
18
+ ...opts,
19
+ limit: void 0
20
+ });
21
+ if (require_queries_find_QueryVisitor.isQueryProvablyEmpty(query)) return Promise.resolve([]);
22
+ const bindings = [];
23
+ require_dataloaders_findDataLoader.collectValues(bindings, query);
24
+ const prepared = {
25
+ filter,
26
+ query,
27
+ bindings,
28
+ findSettings
29
+ };
30
+ const batchKey = require_dataloaders_findDataLoader.getBatchKeyFromGenericStructure(meta, query);
31
+ return em.getLoader(findIdsOperation, batchKey, async (entries) => {
32
+ if (entries.length === 1) {
33
+ const { query, findSettings } = entries[0];
34
+ const primary = query.tables.find((t) => t.join === "primary") ?? require_utils.fail("No primary");
35
+ query.selects = [`${require_queries_sql_keywords.kq(primary.alias)}.id as id`];
36
+ query.orderBys = [{
37
+ alias: primary.alias,
38
+ column: "id",
39
+ order: "ASC"
40
+ }];
41
+ return [(await em["executePreparedFind"](meta, findIdsOperation, query, findSettings, false)).map((row) => require_keys.keyToTaggedId(meta, row.id))];
42
+ }
43
+ const { query, findSettings } = entries[0];
44
+ const args = require_dataloaders_findDataLoader.collectAndReplaceArgs(query, entries);
45
+ const argsColumns = [{
46
+ columnName: "tag",
47
+ dbType: "int"
48
+ }, ...args.map((a) => a.column)];
49
+ const primary = query.tables.find((t) => t.join === "primary") ?? require_utils.fail("No primary");
50
+ query.selects = [`${require_queries_sql_keywords.kq(primary.alias)}.id as id`];
51
+ query.orderBys = [{
52
+ alias: primary.alias,
53
+ column: "id",
54
+ order: "ASC"
55
+ }];
56
+ const query2 = {
57
+ selects: ["_find.tag as tag", "_data.id as id"],
58
+ tables: [{
59
+ join: "primary",
60
+ table: "_find",
61
+ alias: "_find"
62
+ }, {
63
+ join: "lateral",
64
+ query,
65
+ table: meta.tableName,
66
+ alias: "_data",
67
+ fromAlias: "_f"
68
+ }],
69
+ ctes: [require_queries_unnest.buildUnnestCte("_find", argsColumns, require_dataloaders_findDataLoader.createColumnValuesFromPrepared(args, entries))],
70
+ orderBys: []
71
+ };
72
+ const rows = await em["executePreparedFind"](meta, findIdsOperation, query2, findSettings, false);
73
+ const results = entries.map(() => []);
74
+ for (const row of rows) results[row.tag].push(require_keys.keyToTaggedId(meta, row.id));
75
+ return results;
76
+ }, { cacheKeyFn: require_dataloaders_findDataLoader.queryFilterHash }).load(prepared);
77
+ }
78
+ //#endregion
79
+ exports.findIdsDataLoader = findIdsDataLoader;
80
+ exports.findIdsOperation = findIdsOperation;
81
+
82
+ //# sourceMappingURL=findIdsDataLoader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findIdsDataLoader.cjs","names":["getMetadata","parseFindQuery","isQueryProvablyEmpty","getBatchKeyFromGenericStructure","fail","kq","keyToTaggedId","collectAndReplaceArgs","buildUnnestCte","createColumnValuesFromPrepared","queryFilterHash"],"sources":["../../src/dataloaders/findIdsDataLoader.ts"],"sourcesContent":["import {\n collectAndReplaceArgs,\n collectValues,\n createColumnValuesFromPrepared,\n getBatchKeyFromGenericStructure,\n queryFilterHash,\n} from \"src/dataloaders/findDataLoader.ts\";\nimport type { Entity } from \"src/Entity.ts\";\nimport type { EntityManager, MaybeAbstractEntityConstructor } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { keyToTaggedId } from \"src/keys.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 { kq } from \"src/queries/sql/keywords.ts\";\nimport { buildUnnestCte } from \"src/queries/unnest.ts\";\nimport { fail } from \"src/utils.ts\";\n\nexport const findIdsOperation = \"find-ids\";\n\nexport function findIdsDataLoader<T extends Entity>(\n em: EntityManager,\n type: MaybeAbstractEntityConstructor<T>,\n filter: FilterAndSettings<T>,\n): Promise<string[]> {\n const { where, ...opts } = filter;\n if (opts.limit || opts.offset) {\n throw new Error(\"Cannot use limit/offset with findIdsDataLoader\");\n }\n\n const meta = getMetadata(type);\n const query = parseFindQuery(meta, where, opts);\n const { findSettings } = em[\"prepareFind\"](meta, findIdsOperation, query, { ...opts, limit: undefined });\n if (isQueryProvablyEmpty(query)) return Promise.resolve([]);\n\n const bindings: any[] = [];\n collectValues(bindings, query);\n const prepared = { filter, query, bindings, findSettings };\n const batchKey = getBatchKeyFromGenericStructure(meta, query);\n\n return em\n .getLoader<typeof prepared, string[]>(\n findIdsOperation,\n batchKey,\n async (entries) => {\n // We're guaranteed that these queries all have the same structure\n\n // Don't bother with the CTE if there's only 1 query (or each query has exactly the same filter values)\n if (entries.length === 1) {\n const { query, findSettings } = entries[0];\n const primary = query.tables.find((t) => t.join === \"primary\") ?? fail(\"No primary\");\n query.selects = [`${kq(primary.alias)}.id as id`];\n query.orderBys = [{ alias: primary.alias, column: \"id\", order: \"ASC\" }];\n const rows = await em[\"executePreparedFind\"](meta, findIdsOperation, query, findSettings, false);\n return [rows.map((row: any) => keyToTaggedId(meta, row.id)!)];\n }\n\n // WITH _find (tag, arg1, arg2) AS (\n // SELECT unnest($0::int[]) unnest($0::varchar[]), unnest($0::varchar[])\n // )\n // SELECT _find.tag, _data.id\n // FROM _find\n // CROSS JOIN LATERAL (\n // SELECT distinct a.id as id\n // FROM author a WHERE a.first_name = _find.arg1 OR a.last_name = _find.arg2\n // ) _data\n\n // Build the list of 'arg1', 'arg2', ... strings\n const { query, findSettings } = entries[0];\n const args = collectAndReplaceArgs(query, entries);\n const argsColumns = [{ columnName: \"tag\", dbType: \"int\" }, ...args.map((a) => a.column)];\n\n // We're not returning the entities, just selecting their IDs\n const primary = query.tables.find((t) => t.join === \"primary\") ?? fail(\"No primary\");\n query.selects = [`${kq(primary.alias)}.id as id`];\n query.orderBys = [{ alias: primary.alias, column: \"id\", order: \"ASC\" }];\n\n const query2: ParsedFindQuery = {\n selects: [\"_find.tag as tag\", \"_data.id as id\"],\n tables: [\n { join: \"primary\", table: \"_find\", alias: \"_find\" },\n { join: \"lateral\", query, table: meta.tableName, alias: \"_data\", fromAlias: \"_f\" },\n ],\n // For each unique query, capture its filter values in `bindings` to populate the CTE _find table\n ctes: [buildUnnestCte(\"_find\", argsColumns, createColumnValuesFromPrepared(args, entries))],\n orderBys: [],\n };\n\n const rows = await em[\"executePreparedFind\"](meta, findIdsOperation, query2, findSettings, false);\n\n // Make an empty array for each batched query, per the dataloader contract\n const results: string[][] = entries.map(() => []);\n // Then put each row's ID into the tagged query it matched\n for (const row of rows) {\n results[row.tag].push(keyToTaggedId(meta, row.id)!);\n }\n return results;\n },\n // Our filter/order tuple is a complex object, so use a stable cache key to ensure caching works.\n { cacheKeyFn: queryFilterHash },\n )\n .load(prepared);\n}\n"],"mappings":";;;;;;;;;;AAkBA,MAAa,mBAAmB;AAEhC,SAAgB,kBACd,IACA,MACA,QACmB;CACnB,MAAM,EAAE,OAAO,GAAG,SAAS;CAC3B,IAAI,KAAK,SAAS,KAAK,QACrB,MAAM,IAAI,MAAM,gDAAgD;CAGlE,MAAM,OAAOA,uBAAAA,YAAY,IAAI;CAC7B,MAAM,QAAQC,iCAAAA,eAAe,MAAM,OAAO,IAAI;CAC9C,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC,MAAM,kBAAkB,OAAO;EAAE,GAAG;EAAM,OAAO,KAAA;CAAU,CAAC;CACvG,IAAIC,kCAAAA,qBAAqB,KAAK,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAE1D,MAAM,WAAkB,CAAC;CACzB,mCAAA,cAAc,UAAU,KAAK;CAC7B,MAAM,WAAW;EAAE;EAAQ;EAAO;EAAU;CAAa;CACzD,MAAM,WAAWC,mCAAAA,gCAAgC,MAAM,KAAK;CAE5D,OAAO,GACJ,UACC,kBACA,UACA,OAAO,YAAY;EAIjB,IAAI,QAAQ,WAAW,GAAG;GACxB,MAAM,EAAE,OAAO,iBAAiB,QAAQ;GACxC,MAAM,UAAU,MAAM,OAAO,MAAM,MAAM,EAAE,SAAS,SAAS,KAAKC,cAAAA,KAAK,YAAY;GACnF,MAAM,UAAU,CAAC,GAAGC,6BAAA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AEpD,OAAO;CACT,GAEA,EAAE,YAAYI,mCAAAA,gBAAgB,CAChC,CAAC,CACA,KAAK,QAAQ;AAClB"}
@@ -0,0 +1,9 @@
1
+ import { FilterAndSettings } from "../queries/find/EntityFilter.cjs";
2
+ import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.cjs";
3
+ import { Entity } from "../Entity.cjs";
4
+ //#region src/dataloaders/findIdsDataLoader.d.ts
5
+ declare const findIdsOperation = "find-ids";
6
+ declare function findIdsDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>): Promise<string[]>;
7
+ //#endregion
8
+ export { findIdsDataLoader, findIdsOperation };
9
+ //# sourceMappingURL=findIdsDataLoader.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findIdsDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findIdsDataLoader.ts"],"mappings":";;;;cAkBa;iBAEG,kBAAkB,UAAU,QAC1C,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,KACzB"}
@@ -0,0 +1,9 @@
1
+ import { FilterAndSettings } from "../queries/find/EntityFilter.mjs";
2
+ import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.mjs";
3
+ import { Entity } from "../Entity.mjs";
4
+ //#region src/dataloaders/findIdsDataLoader.d.ts
5
+ declare const findIdsOperation = "find-ids";
6
+ declare function findIdsDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>): Promise<string[]>;
7
+ //#endregion
8
+ export { findIdsDataLoader, findIdsOperation };
9
+ //# sourceMappingURL=findIdsDataLoader.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findIdsDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/findIdsDataLoader.ts"],"mappings":";;;;cAkBa;iBAEG,kBAAkB,UAAU,QAC1C,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,KACzB"}
@@ -1,77 +1,80 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findIdsOperation = void 0;
4
- exports.findIdsDataLoader = findIdsDataLoader;
5
- const EntityMetadata_1 = require("../EntityMetadata");
6
- const keys_1 = require("../keys");
7
- const keywords_1 = require("../keywords");
8
- const QueryParser_1 = require("../QueryParser");
9
- const unnest_1 = require("../unnest");
10
- const utils_1 = require("../utils");
11
- const findDataLoader_1 = require("./findDataLoader");
12
- exports.findIdsOperation = "find-ids";
1
+ import { keyToTaggedId } from "../keys.js";
2
+ import { kq } from "../queries/sql/keywords.js";
3
+ import { isQueryProvablyEmpty } from "../queries/find/QueryVisitor.js";
4
+ import { parseFindQuery } from "../queries/find/QueryParser.js";
5
+ import { fail } from "../utils.js";
6
+ import { getMetadata } from "../EntityMetadata.js";
7
+ import { buildUnnestCte } from "../queries/unnest.js";
8
+ import { collectAndReplaceArgs, collectValues, createColumnValuesFromPrepared, getBatchKeyFromGenericStructure, queryFilterHash } from "./findDataLoader.js";
9
+ //#region src/dataloaders/findIdsDataLoader.ts
10
+ const findIdsOperation = "find-ids";
13
11
  function findIdsDataLoader(em, type, filter) {
14
- const { where, ...opts } = filter;
15
- if (opts.limit || opts.offset) {
16
- throw new Error("Cannot use limit/offset with findIdsDataLoader");
17
- }
18
- const meta = (0, EntityMetadata_1.getMetadata)(type);
19
- const query = (0, QueryParser_1.parseFindQuery)(meta, where, opts);
20
- const { findSettings } = em["prepareFind"](meta, exports.findIdsOperation, query, { ...opts, limit: undefined });
21
- const bindings = [];
22
- (0, findDataLoader_1.collectValues)(bindings, query);
23
- const prepared = { filter, query, bindings, findSettings };
24
- const batchKey = (0, findDataLoader_1.getBatchKeyFromGenericStructure)(meta, query);
25
- return em
26
- .getLoader(exports.findIdsOperation, batchKey, async (entries) => {
27
- // We're guaranteed that these queries all have the same structure
28
- // Don't bother with the CTE if there's only 1 query (or each query has exactly the same filter values)
29
- if (entries.length === 1) {
30
- const { query, findSettings } = entries[0];
31
- const primary = query.tables.find((t) => t.join === "primary") ?? (0, utils_1.fail)("No primary");
32
- query.selects = [`${(0, keywords_1.kq)(primary.alias)}.id as id`];
33
- query.orderBys = [{ alias: primary.alias, column: "id", order: "ASC" }];
34
- const rows = await em["executePreparedFind"](meta, exports.findIdsOperation, query, findSettings, false);
35
- return [rows.map((row) => (0, keys_1.keyToTaggedId)(meta, row.id))];
36
- }
37
- // WITH _find (tag, arg1, arg2) AS (
38
- // SELECT unnest($0::int[]) unnest($0::varchar[]), unnest($0::varchar[])
39
- // )
40
- // SELECT _find.tag, _data.id
41
- // FROM _find
42
- // CROSS JOIN LATERAL (
43
- // SELECT distinct a.id as id
44
- // FROM author a WHERE a.first_name = _find.arg1 OR a.last_name = _find.arg2
45
- // ) _data
46
- // Build the list of 'arg1', 'arg2', ... strings
47
- const { query, findSettings } = entries[0];
48
- const args = (0, findDataLoader_1.collectAndReplaceArgs)(query, entries);
49
- const argsColumns = [{ columnName: "tag", dbType: "int" }, ...args.map((a) => a.column)];
50
- // We're not returning the entities, just selecting their IDs
51
- const primary = query.tables.find((t) => t.join === "primary") ?? (0, utils_1.fail)("No primary");
52
- query.selects = [`${(0, keywords_1.kq)(primary.alias)}.id as id`];
53
- query.orderBys = [{ alias: primary.alias, column: "id", order: "ASC" }];
54
- const query2 = {
55
- selects: ["_find.tag as tag", "_data.id as id"],
56
- tables: [
57
- { join: "primary", table: "_find", alias: "_find" },
58
- { join: "lateral", query, table: meta.tableName, alias: "_data", fromAlias: "_f" },
59
- ],
60
- // For each unique query, capture its filter values in `bindings` to populate the CTE _find table
61
- ctes: [(0, unnest_1.buildUnnestCte)("_find", argsColumns, (0, findDataLoader_1.createColumnValuesFromPrepared)(args, entries))],
62
- orderBys: [],
63
- };
64
- const rows = await em["executePreparedFind"](meta, exports.findIdsOperation, query2, findSettings, false);
65
- // Make an empty array for each batched query, per the dataloader contract
66
- const results = entries.map(() => []);
67
- // Then put each row's ID into the tagged query it matched
68
- for (const row of rows) {
69
- results[row.tag].push((0, keys_1.keyToTaggedId)(meta, row.id));
70
- }
71
- return results;
72
- },
73
- // Our filter/order tuple is a complex object, so use a stable cache key to ensure caching works.
74
- { cacheKeyFn: findDataLoader_1.queryFilterHash })
75
- .load(prepared);
12
+ const { where, ...opts } = filter;
13
+ if (opts.limit || opts.offset) throw new Error("Cannot use limit/offset with findIdsDataLoader");
14
+ const meta = getMetadata(type);
15
+ const query = parseFindQuery(meta, where, opts);
16
+ const { findSettings } = em["prepareFind"](meta, findIdsOperation, query, {
17
+ ...opts,
18
+ limit: void 0
19
+ });
20
+ if (isQueryProvablyEmpty(query)) return Promise.resolve([]);
21
+ const bindings = [];
22
+ collectValues(bindings, query);
23
+ const prepared = {
24
+ filter,
25
+ query,
26
+ bindings,
27
+ findSettings
28
+ };
29
+ const batchKey = getBatchKeyFromGenericStructure(meta, query);
30
+ return em.getLoader(findIdsOperation, batchKey, async (entries) => {
31
+ if (entries.length === 1) {
32
+ const { query, findSettings } = entries[0];
33
+ const primary = query.tables.find((t) => t.join === "primary") ?? fail("No primary");
34
+ query.selects = [`${kq(primary.alias)}.id as id`];
35
+ query.orderBys = [{
36
+ alias: primary.alias,
37
+ column: "id",
38
+ order: "ASC"
39
+ }];
40
+ return [(await em["executePreparedFind"](meta, findIdsOperation, query, findSettings, false)).map((row) => keyToTaggedId(meta, row.id))];
41
+ }
42
+ const { query, findSettings } = entries[0];
43
+ const args = collectAndReplaceArgs(query, entries);
44
+ const argsColumns = [{
45
+ columnName: "tag",
46
+ dbType: "int"
47
+ }, ...args.map((a) => a.column)];
48
+ const primary = query.tables.find((t) => t.join === "primary") ?? fail("No primary");
49
+ query.selects = [`${kq(primary.alias)}.id as id`];
50
+ query.orderBys = [{
51
+ alias: primary.alias,
52
+ column: "id",
53
+ order: "ASC"
54
+ }];
55
+ const query2 = {
56
+ selects: ["_find.tag as tag", "_data.id as id"],
57
+ tables: [{
58
+ join: "primary",
59
+ table: "_find",
60
+ alias: "_find"
61
+ }, {
62
+ join: "lateral",
63
+ query,
64
+ table: meta.tableName,
65
+ alias: "_data",
66
+ fromAlias: "_f"
67
+ }],
68
+ ctes: [buildUnnestCte("_find", argsColumns, createColumnValuesFromPrepared(args, entries))],
69
+ orderBys: []
70
+ };
71
+ const rows = await em["executePreparedFind"](meta, findIdsOperation, query2, findSettings, false);
72
+ const results = entries.map(() => []);
73
+ for (const row of rows) results[row.tag].push(keyToTaggedId(meta, row.id));
74
+ return results;
75
+ }, { cacheKeyFn: queryFilterHash }).load(prepared);
76
76
  }
77
+ //#endregion
78
+ export { findIdsDataLoader, findIdsOperation };
79
+
77
80
  //# sourceMappingURL=findIdsDataLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"findIdsDataLoader.js","sourceRoot":"","sources":["../../src/dataloaders/findIdsDataLoader.ts"],"names":[],"mappings":";;;AAmBA,8CAgFC;AAhGD,sDAAgD;AAChD,kCAAwC;AACxC,0CAAiC;AACjC,gDAAiE;AACjE,sCAA2C;AAC3C,oCAAgC;AAChC,qDAM0B;AAEb,QAAA,gBAAgB,GAAG,UAAU,CAAC;AAE3C,SAAgB,iBAAiB,CAC/B,EAAiB,EACjB,IAAuC,EACvC,MAA4B;IAE5B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAClC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,4BAAW,EAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAA,4BAAc,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,wBAAgB,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,S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F;YACD,iGAAiG;YACjG,IAAI,EAAE,CAAC,IAAA,uBAAc,EAAC,OAAO,EAAE,WAAW,EAAE,IAAA,+CAA8B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3F,QAAQ,EAAE,EAAE;SACb,CAAC;QAEF,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,qBAAqB,CAAC,CAAC,IAAI,EAAE,wBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QAElG,0EAA0E;QAC1E,MAAM,OAAO,GAAe,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAClD,0DAA0D;QAC1D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,oBAAa,EAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAE,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,iGAAiG;IACjG,EAAE,UAAU,EAAE,gCAAe,EAAE,CAChC;SACA,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC"}
1
+ {"version":3,"file":"findIdsDataLoader.js","names":[],"sources":["../../src/dataloaders/findIdsDataLoader.ts"],"sourcesContent":["import {\n collectAndReplaceArgs,\n collectValues,\n createColumnValuesFromPrepared,\n getBatchKeyFromGenericStructure,\n queryFilterHash,\n} from \"src/dataloaders/findDataLoader.ts\";\nimport type { Entity } from \"src/Entity.ts\";\nimport type { EntityManager, MaybeAbstractEntityConstructor } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { keyToTaggedId } from \"src/keys.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 { kq } from \"src/queries/sql/keywords.ts\";\nimport { buildUnnestCte } from \"src/queries/unnest.ts\";\nimport { fail } from \"src/utils.ts\";\n\nexport const findIdsOperation = \"find-ids\";\n\nexport function findIdsDataLoader<T extends Entity>(\n em: EntityManager,\n type: MaybeAbstractEntityConstructor<T>,\n filter: FilterAndSettings<T>,\n): Promise<string[]> {\n const { where, ...opts } = filter;\n if (opts.limit || opts.offset) {\n throw new Error(\"Cannot use limit/offset with findIdsDataLoader\");\n }\n\n const meta = getMetadata(type);\n const query = parseFindQuery(meta, where, opts);\n const { findSettings } = em[\"prepareFind\"](meta, findIdsOperation, query, { ...opts, limit: undefined });\n if (isQueryProvablyEmpty(query)) return Promise.resolve([]);\n\n const bindings: any[] = [];\n collectValues(bindings, query);\n const prepared = { filter, query, bindings, findSettings };\n const batchKey = getBatchKeyFromGenericStructure(meta, query);\n\n return em\n .getLoader<typeof prepared, string[]>(\n findIdsOperation,\n batchKey,\n async (entries) => {\n // We're guaranteed that these queries all have the same structure\n\n // Don't bother with the CTE if there's only 1 query (or each query has exactly the same filter values)\n if (entries.length === 1) {\n const { query, findSettings } = entries[0];\n const primary = query.tables.find((t) => t.join === \"primary\") ?? fail(\"No primary\");\n query.selects = [`${kq(primary.alias)}.id as id`];\n query.orderBys = [{ alias: primary.alias, column: \"id\", order: \"ASC\" }];\n const rows = await em[\"executePreparedFind\"](meta, findIdsOperation, query, findSettings, false);\n return [rows.map((row: any) => keyToTaggedId(meta, row.id)!)];\n }\n\n // WITH _find (tag, arg1, arg2) AS (\n // SELECT unnest($0::int[]) unnest($0::varchar[]), unnest($0::varchar[])\n // )\n // SELECT _find.tag, _data.id\n // FROM _find\n // CROSS JOIN LATERAL (\n // SELECT distinct a.id as id\n // FROM author a WHERE a.first_name = _find.arg1 OR a.last_name = _find.arg2\n // ) _data\n\n // Build the list of 'arg1', 'arg2', ... strings\n const { query, findSettings } = entries[0];\n const args = collectAndReplaceArgs(query, entries);\n const argsColumns = [{ columnName: \"tag\", dbType: \"int\" }, ...args.map((a) => a.column)];\n\n // We're not returning the entities, just selecting their IDs\n const primary = query.tables.find((t) => t.join === \"primary\") ?? fail(\"No primary\");\n query.selects = [`${kq(primary.alias)}.id as id`];\n query.orderBys = [{ alias: primary.alias, column: \"id\", order: \"ASC\" }];\n\n const query2: ParsedFindQuery = {\n selects: [\"_find.tag as tag\", \"_data.id as id\"],\n tables: [\n { join: \"primary\", table: \"_find\", alias: \"_find\" },\n { join: \"lateral\", query, table: meta.tableName, alias: \"_data\", fromAlias: \"_f\" },\n ],\n // For each unique query, capture its filter values in `bindings` to populate the CTE _find table\n ctes: [buildUnnestCte(\"_find\", argsColumns, createColumnValuesFromPrepared(args, entries))],\n orderBys: [],\n };\n\n const rows = await em[\"executePreparedFind\"](meta, findIdsOperation, query2, findSettings, false);\n\n // Make an empty array for each batched query, per the dataloader contract\n const results: string[][] = entries.map(() => []);\n // Then put each row's ID into the tagged query it matched\n for (const row of rows) {\n results[row.tag].push(keyToTaggedId(meta, row.id)!);\n }\n return results;\n },\n // Our filter/order tuple is a complex object, so use a stable cache key to ensure caching works.\n { cacheKeyFn: queryFilterHash },\n )\n .load(prepared);\n}\n"],"mappings":";;;;;;;;;AAkBA,MAAa,mBAAmB;AAEhC,SAAgB,kBACd,IACA,MACA,QACmB;CACnB,MAAM,EAAE,OAAO,GAAG,SAAS;CAC3B,IAAI,KAAK,SAAS,KAAK,QACrB,MAAM,IAAI,MAAM,gDAAgD;CAGlE,MAAM,OAAO,YAAY,IAAI;CAC7B,MAAM,QAAQ,eAAe,MAAM,OAAO,IAAI;CAC9C,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC,MAAM,kBAAkB,OAAO;EAAE,GAAG;EAAM,OAAO,KAAA;CAAU,CAAC;CACvG,IAAI,qBAAqB,KAAK,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAE1D,MAAM,WAAkB,CAAC;CACzB,cAAc,UAAU,KAAK;CAC7B,MAAM,WAAW;EA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,CAAC;EACb;EAEA,MAAM,OAAO,MAAM,GAAG,sBAAsB,CAAC,MAAM,kBAAkB,QAAQ,cAAc,KAAK;EAGhG,MAAM,UAAsB,QAAQ,UAAU,CAAC,CAAC;EAEhD,KAAK,MAAM,OAAO,MAChB,QAAQ,IAAI,IAAI,CAAC,KAAK,cAAc,MAAM,IAAI,EAAE,CAAE;EAEpD,OAAO;CACT,GAEA,EAAE,YAAY,gBAAgB,CAChC,CAAC,CACA,KAAK,QAAQ;AAClB"}
@@ -0,0 +1,120 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_relations_Reference = require("../relations/Reference.cjs");
3
+ require("../relations/index.cjs");
4
+ const require_utils = require("../utils.cjs");
5
+ const require_EntityMetadata = require("../EntityMetadata.cjs");
6
+ const require_dataloaders_findDataLoader = require("./findDataLoader.cjs");
7
+ const require_resurrection = require("../resurrection.cjs");
8
+ const require_EntityManager = require("../EntityManager.cjs");
9
+ const require_Entity = require("../Entity.cjs");
10
+ //#region src/dataloaders/findOrCreateDataLoader.ts
11
+ function findOrCreateDataLoader(em, type, where, softDeletes) {
12
+ const meta = require_EntityMetadata.getMetadata(type);
13
+ const hasAnyStrings = Object.values(meta.allFields).some((f) => f.kind === "primitive" && f.type === "string");
14
+ const hasAnyCitext = Object.values(meta.allFields).some((f) => f.kind === "primitive" && f.citext);
15
+ where = hasAnyStrings ? maybeClean(meta, where) : where;
16
+ const whereValue = require_dataloaders_findDataLoader.whereFilterHash(hasAnyCitext ? maybeLower(meta, where) : where);
17
+ const batchKey = `${type.name}-${whereValue}-${softDeletes}`;
18
+ const invalidKeys = Object.keys(where).filter((key) => {
19
+ const field = meta.allFields[key] ?? require_utils.fail(`Invalid field ${key}`);
20
+ return !(field.kind === "primitive" || field.kind === "enum" || field.kind === "m2o" || field.kind === "poly");
21
+ });
22
+ if (invalidKeys.length > 0) throw new Error("findOrCreate only supports primitive, enum, m2o, or poly fields in the where clause. Invalid keys: " + invalidKeys.join(", "));
23
+ return em.getLoader("find-or-create", batchKey, async (keys) => {
24
+ const [{ ifNew, upsert }] = keys;
25
+ const inMemory = em.filterEntities(type, where);
26
+ if (inMemory.length > 1) throw new require_EntityManager.TooManyError(`Found more than one existing ${type.name} with ${whereAsString(where)}`);
27
+ else if (inMemory.length === 1) {
28
+ const entity = inMemory[0];
29
+ require_resurrection.resurrectIfSoftDeleted(entity);
30
+ if (upsert) entity.set(upsert);
31
+ return keys.map(() => entity);
32
+ }
33
+ if (Object.values(where).some((v) => require_Entity.isEntity(v) && v.isNewEntity)) {
34
+ const entity = em.create(type, {
35
+ ...where,
36
+ ...ifNew
37
+ });
38
+ if (upsert) entity.set(upsert);
39
+ return keys.map(() => entity);
40
+ }
41
+ const entities = await em.find(type, Object.fromEntries(Object.entries(where).map(([k, v]) => [k, v === void 0 ? null : v])), { softDeletes: "include" });
42
+ let entity;
43
+ if (entities.length > 1) throw new require_EntityManager.TooManyError(`Found more than one existing ${type.name} with ${whereAsString(where)}`);
44
+ else if (entities.length === 1) {
45
+ entity = entities[0];
46
+ require_resurrection.resurrectIfSoftDeleted(entity);
47
+ } else entity = em.create(type, {
48
+ ...where,
49
+ ...ifNew
50
+ });
51
+ if (upsert) entity.set(upsert);
52
+ return keys.map(() => entity);
53
+ }, { cacheKeyFn: require_dataloaders_findDataLoader.whereFilterHash });
54
+ }
55
+ /** A simple in-memory match of `entity` against a mini/flat "WHERE clause" of `opts`. */
56
+ function entityMatches(entity, opts) {
57
+ const meta = require_EntityMetadata.getMetadata(entity);
58
+ return Object.entries(opts).every(([fieldName, value]) => {
59
+ const field = meta.allFields[fieldName] ?? require_utils.fail(`Invalid field ${fieldName}`);
60
+ const fn = fieldName;
61
+ switch (field.kind) {
62
+ case "primaryKey":
63
+ case "enum": return entity[fn] === value;
64
+ case "primitive": if (field.citext) return compareCaseInsensitive(entity[fn], value);
65
+ else return entity[fn] === value;
66
+ case "m2o":
67
+ case "poly":
68
+ const relation = entity[fn];
69
+ if (require_relations_Reference.isLoadedReference(relation)) return require_EntityManager.sameEntity(relation.get, value);
70
+ else if (relation.isSet) return require_EntityManager.sameEntity(relation.id, value);
71
+ else return value === void 0 || value === null;
72
+ default: throw new Error(`Unsupported field ${fieldName}`);
73
+ }
74
+ });
75
+ }
76
+ function whereAsString(where) {
77
+ return Object.entries(where).map(([key, value]) => `${key}=${value}`).join(", ");
78
+ }
79
+ function compareCaseInsensitive(str1, str2) {
80
+ return str1 !== void 0 && str2 !== void 0 && typeof str1 === "string" && typeof str2 === "string" && str1.toLowerCase() === str2.toLowerCase();
81
+ }
82
+ /** Returns a copy of `opts` with any `citext` values turned to lower case. */
83
+ function maybeLower(meta, opts) {
84
+ if (!opts) return opts;
85
+ let result = void 0;
86
+ for (const k in opts) {
87
+ const v = opts[k];
88
+ const field = meta.allFields[k];
89
+ if (field && field.kind === "primitive" && field.type === "string" && field.citext) {
90
+ const lowered = v?.toLowerCase();
91
+ if (lowered !== v) {
92
+ result ??= { ...opts };
93
+ result[k] = lowered;
94
+ }
95
+ }
96
+ }
97
+ return result ?? opts;
98
+ }
99
+ /** Returns a copy of `opts` with any string values trimmed/coalesced. */
100
+ function maybeClean(meta, opts) {
101
+ if (!opts) return opts;
102
+ let result = void 0;
103
+ for (const k in opts) {
104
+ const v = opts[k];
105
+ const field = meta.allFields[k];
106
+ if (field && field.kind === "primitive" && field.type === "string" && field.sanitize !== false) {
107
+ const cleaned = require_utils.cleanStringValue(v);
108
+ if (cleaned !== v) {
109
+ result ??= { ...opts };
110
+ result[k] = cleaned;
111
+ }
112
+ }
113
+ }
114
+ return result ?? opts;
115
+ }
116
+ //#endregion
117
+ exports.entityMatches = entityMatches;
118
+ exports.findOrCreateDataLoader = findOrCreateDataLoader;
119
+
120
+ //# sourceMappingURL=findOrCreateDataLoader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findOrCreateDataLoader.cjs","names":["getMetadata","whereFilterHash","fail","TooManyError","isEntity","isLoadedReference","sameEntity","cleanStringValue"],"sources":["../../src/dataloaders/findOrCreateDataLoader.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport { whereFilterHash } from \"src/dataloaders/findDataLoader.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\nimport { type EntityConstructor, type EntityManager, TooManyError, sameEntity } from \"src/EntityManager.ts\";\nimport { type EntityMetadata, getMetadata } from \"src/EntityMetadata.ts\";\nimport { type ManyToOneReference, type PolymorphicReference, isLoadedReference } from \"src/relations/index.ts\";\nimport { resurrectIfSoftDeleted } from \"src/resurrection.ts\";\nimport type { OptsOf } from \"src/typeMap.ts\";\nimport { cleanStringValue, fail } from \"src/utils.ts\";\n\ninterface FindOrCreateKey<T extends Entity> {\n ifNew: OptsOf<T>;\n upsert: Partial<OptsOf<T>> | undefined;\n}\n\nexport function findOrCreateDataLoader<T extends Entity>(\n em: EntityManager,\n type: EntityConstructor<T>,\n where: Partial<OptsOf<T>>,\n softDeletes: \"include\" | \"exclude\",\n): DataLoader<FindOrCreateKey<T>, T> {\n const meta = getMetadata(type);\n\n // Do some extra logic to make unclean strings/citext not create duplicate entities\n const hasAnyStrings = Object.values(meta.allFields).some((f) => f.kind === \"primitive\" && f.type === \"string\");\n const hasAnyCitext = Object.values(meta.allFields).some((f) => f.kind === \"primitive\" && f.citext);\n\n // The `where` here will be later used to `em.create`, so we only clean (not lower for citext)\n where = hasAnyStrings ? maybeClean(meta, where) : where;\n // Use `whereFilterHash` to batch the same `findOrCreate` `where: { firstName: \"a1\" }` calls together to avoid duplicates\n const whereValue = whereFilterHash(\n // Only maybeLower for the purposes of batching, not the later em.create\n hasAnyCitext ? maybeLower(meta, where) : (where as any),\n );\n const batchKey = `${type.name}-${whereValue}-${softDeletes}`;\n\n const invalidKeys = Object.keys(where).filter((key) => {\n const field = meta.allFields[key] ?? fail(`Invalid field ${key}`);\n const supported =\n field.kind === \"primitive\" || field.kind === \"enum\" || field.kind === \"m2o\" || field.kind === \"poly\";\n return !supported;\n });\n if (invalidKeys.length > 0) {\n throw new Error(\n \"findOrCreate only supports primitive, enum, m2o, or poly fields in the where clause. Invalid keys: \" +\n invalidKeys.join(\", \"),\n );\n }\n\n return em.getLoader<FindOrCreateKey<T>, T>(\n \"find-or-create\",\n batchKey,\n async (keys) => {\n // Because our `batchKey` is based only on the `where` clause, if the user called\n // `findOrCreate({ firstName: a1 })` multiple times, but with different ifNew/upsert\n // conditions (or different cased strings and is using a citext column), we'll end\n // up with multiple keys...\n //\n // This is fundamentally asking to create the same entity, but with different ifNew/upsert\n // conditions, which we could fail on, but for now just take the first tuple of\n // {where/ifNew/upsert} and assume it wins\n const [{ ifNew, upsert }] = keys;\n\n // Before we find/create an entity, see if we have a maybe-new one in the EM already.\n // This will also use any WIP changes we've made to the found entity, which ideally is\n // something `em.find` would do as well, but its queries are much more complex...\n const inMemory = em.filterEntities(type, where);\n if (inMemory.length > 1) {\n throw new TooManyError(`Found more than one existing ${type.name} with ${whereAsString(where)}`);\n } else if (inMemory.length === 1) {\n const entity = inMemory[0] as T;\n resurrectIfSoftDeleted(entity);\n if (upsert) {\n entity.set(upsert);\n }\n return keys.map(() => entity);\n }\n\n // If there is a param like `{ publisher: newPublisherEntity }`, then we know that\n // an entity matching this condition can't be in the db anyway, so skip the em.find\n const hasNewEntityParam = Object.values(where).some((v) => isEntity(v) && v.isNewEntity);\n if (hasNewEntityParam) {\n const entity = em.create(type, { ...where, ...(ifNew as object) } as OptsOf<T>);\n if (upsert) {\n entity.set(upsert);\n }\n return keys.map(() => entity);\n }\n\n // If we didn't find it in the EM, do the db query/em.create\n const entities = await em.find(\n type,\n // Convert `publisher: undefined` --> `publisher: null`, and we need to make a copy anyway\n Object.fromEntries(Object.entries(where).map(([k, v]) => [k, v === undefined ? null : v])) as any,\n // Always include soft-deleted rows so findOrCreate can resurrect them instead of creating duplicates.\n { softDeletes: \"include\" },\n );\n let entity: T;\n if (entities.length > 1) {\n throw new TooManyError(`Found more than one existing ${type.name} with ${whereAsString(where)}`);\n } else if (entities.length === 1) {\n entity = entities[0];\n resurrectIfSoftDeleted(entity);\n } else {\n entity = em.create(type, { ...where, ...(ifNew as object) } as OptsOf<T>);\n }\n if (upsert) {\n entity.set(upsert);\n }\n return keys.map(() => entity);\n },\n // Our filter tuple is a complex object, so use a stable cache key to ensure caching works.\n { cacheKeyFn: whereFilterHash as any },\n );\n}\n\n/** A simple in-memory match of `entity` against a mini/flat \"WHERE clause\" of `opts`. */\nexport function entityMatches<T extends Entity>(entity: T, opts: Partial<OptsOf<T>>): boolean {\n const meta = getMetadata(entity);\n return Object.entries(opts).every(([fieldName, value]) => {\n const field = meta.allFields[fieldName] ?? fail(`Invalid field ${fieldName}`);\n const fn = fieldName as keyof T & keyof OptsOf<T>;\n switch (field.kind) {\n case \"primaryKey\":\n case \"enum\":\n return entity[fn] === value;\n case \"primitive\":\n if (field.citext) {\n return compareCaseInsensitive(entity[fn], value);\n } else {\n return entity[fn] === value;\n }\n case \"m2o\":\n case \"poly\":\n const relation = entity[fn] as ManyToOneReference<T, any, any> | PolymorphicReference<T, any, any>;\n if (isLoadedReference(relation)) {\n // Prefer using `.get` because it will handle new/id-less entities\n return sameEntity(relation.get, value as any);\n } else if (relation.isSet) {\n // Otherwise use ids\n return sameEntity(relation.id as any, value as any);\n } else {\n // Relation is not set, match if value is null-ish (null or undefined)\n return value === undefined || value === null;\n }\n default:\n throw new Error(`Unsupported field ${fieldName}`);\n }\n });\n}\n\nfunction whereAsString(where: object): string {\n return Object.entries(where)\n .map(([key, value]) => `${key}=${value}`)\n .join(\", \");\n}\n\nfunction compareCaseInsensitive(str1: any, str2: any): boolean {\n return (\n str1 !== undefined &&\n str2 !== undefined &&\n typeof str1 === \"string\" &&\n typeof str2 === \"string\" &&\n str1.toLowerCase() === str2.toLowerCase()\n );\n}\n\n/** Returns a copy of `opts` with any `citext` values turned to lower case. */\nfunction maybeLower<T extends object | undefined>(meta: EntityMetadata, opts: T): T {\n if (!opts) return opts;\n let result: T | undefined = undefined;\n for (const k in opts) {\n const v = (opts as any)[k];\n const field = meta.allFields[k];\n const isString = field && field.kind === \"primitive\" && field.type === \"string\";\n if (isString && field.citext) {\n const lowered = v?.toLowerCase();\n if (lowered !== v) {\n result ??= { ...opts };\n (result as any)[k] = lowered as any;\n }\n }\n }\n return result ?? opts;\n}\n\n/** Returns a copy of `opts` with any string values trimmed/coalesced. */\nfunction maybeClean<T extends object | undefined>(meta: EntityMetadata, opts: T): T {\n if (!opts) return opts;\n let result: T | undefined = undefined;\n for (const k in opts) {\n const v = (opts as any)[k];\n const field = meta.allFields[k];\n const isString = field && field.kind === \"primitive\" && field.type === \"string\";\n if (isString && field.sanitize !== false) {\n const cleaned = cleanStringValue(v);\n if (cleaned !== v) {\n result ??= { ...opts }; // Only create copy on first change\n (result as any)[k] = cleaned;\n }\n }\n }\n return result ?? opts;\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,uBACd,IACA,MACA,OACA,aACmC;CACnC,MAAM,OAAOA,uBAAAA,YAAY,IAAI;CAG7B,MAAM,gBAAgB,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,MAAM,MAAM,EAAE,SAAS,eAAe,EAAE,SAAS,QAAQ;CAC7G,MAAM,eAAe,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,MAAM,MAAM,EAAE,SAAS,eAAe,EAAE,MAAM;CAGjG,QAAQ,gBAAgB,WAAW,MAAM,KAAK,IAAI;CAElD,MAAM,aAAaC,mCAAAA,gBAEjB,eAAe,WAAW,MAAM,KAAK,IAAK,KAC5C;CACA,MAAM,WAAW,GAAG,KAAK,KAAK,GAAG,WAAW,GAAG;CAE/C,MAAM,cAAc,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,QAAQ;EACrD,MAAM,QAAQ,KAAK,UAAU,QAAQC,cAAAA,KAAK,iBAAiB,KAAK;EAGhE,OAAO,EADL,MAAM,SAAS,eAAe,MAAM,SAAS,UAAU,MAAM,SAAS,SAAS,MAAM,SAAS;CAElG,CAAC;CACD,IAAI,YAA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AM,SAAS,eAAe,MAAM,SAAS,YACvD,MAAM,QAAQ;GAC5B,MAAM,UAAU,GAAG,YAAY;GAC/B,IAAI,YAAY,GAAG;IACjB,WAAW,EAAE,GAAG,KAAK;IACrB,OAAgB,KAAK;GACvB;EACF;CACF;CACA,OAAO,UAAU;AACnB;;AAGA,SAAS,WAAyC,MAAsB,MAAY;CAClF,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,SAAwB,KAAA;CAC5B,KAAK,MAAM,KAAK,MAAM;EACpB,MAAM,IAAK,KAAa;EACxB,MAAM,QAAQ,KAAK,UAAU;EAE7B,IADiB,SAAS,MAAM,SAAS,eAAe,MAAM,SAAS,YACvD,MAAM,aAAa,OAAO;GACxC,MAAM,UAAUC,cAAAA,iBAAiB,CAAC;GAClC,IAAI,YAAY,GAAG;IACjB,WAAW,EAAE,GAAG,KAAK;IACrB,OAAgB,KAAK;GACvB;EACF;CACF;CACA,OAAO,UAAU;AACnB"}
@@ -0,0 +1,15 @@
1
+ import { OptsOf } from "../typeMap.cjs";
2
+ import { EntityConstructor, EntityManager } from "../EntityManager.cjs";
3
+ import { Entity } from "../Entity.cjs";
4
+ import DataLoader from "dataloader";
5
+ //#region src/dataloaders/findOrCreateDataLoader.d.ts
6
+ interface FindOrCreateKey<T extends Entity> {
7
+ ifNew: OptsOf<T>;
8
+ upsert: Partial<OptsOf<T>> | undefined;
9
+ }
10
+ declare function findOrCreateDataLoader<T extends Entity>(em: EntityManager, type: EntityConstructor<T>, where: Partial<OptsOf<T>>, softDeletes: "include" | "exclude"): DataLoader<FindOrCreateKey<T>, T>;
11
+ /** A simple in-memory match of `entity` against a mini/flat "WHERE clause" of `opts`. */
12
+ declare function entityMatches<T extends Entity>(entity: T, opts: Partial<OptsOf<T>>): boolean;
13
+ //#endregion
14
+ export { entityMatches, findOrCreateDataLoader };
15
+ //# sourceMappingURL=findOrCreateDataLoader.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findOrCreateDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findOrCreateDataLoader.ts"],"mappings":";;;;;UAUU,gBAAgB,UAAU;EAClC,OAAO,OAAO;EACd,QAAQ,QAAQ,OAAO;;iBAGT,uBAAuB,UAAU,QAC/C,IAAI,eACJ,MAAM,kBAAkB,IACxB,OAAO,QAAQ,OAAO,KACtB,qCACC,WAAW,gBAAgB,IAAI;;iBAiGlB,cAAc,UAAU,QAAQ,QAAQ,GAAG,MAAM,QAAQ,OAAO"}