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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (687) hide show
  1. package/build/EntityManager.cjs +36 -39
  2. package/build/EntityManager.cjs.map +1 -1
  3. package/build/EntityManager.d.cts +4 -4
  4. package/build/EntityManager.d.mts +4 -4
  5. package/build/EntityManager.js +29 -32
  6. package/build/EntityManager.js.map +1 -1
  7. package/build/EntityMetadata.cjs +3 -3
  8. package/build/EntityMetadata.js +3 -3
  9. package/build/IndexManager.cjs +1 -1
  10. package/build/IndexManager.js +1 -1
  11. package/build/InstanceData.cjs +1 -1
  12. package/build/InstanceData.js +1 -1
  13. package/build/JoinRows.cjs +1 -1
  14. package/build/JoinRows.js +1 -1
  15. package/build/PluginManager.cjs +0 -1
  16. package/build/PluginManager.cjs.map +1 -1
  17. package/build/PluginManager.d.cts +1 -1
  18. package/build/PluginManager.d.mts +1 -1
  19. package/build/PluginManager.js +0 -1
  20. package/build/PluginManager.js.map +1 -1
  21. package/build/ReactionsManager.cjs +2 -2
  22. package/build/ReactionsManager.js +2 -2
  23. package/build/Todo.cjs +1 -1
  24. package/build/Todo.js +1 -1
  25. package/build/batchloaders/enumCollectionBatchLoader.cjs +1 -1
  26. package/build/batchloaders/enumCollectionBatchLoader.js +1 -1
  27. package/build/batchloaders/loadBatchLoader.cjs +6 -5
  28. package/build/batchloaders/loadBatchLoader.cjs.map +1 -1
  29. package/build/batchloaders/loadBatchLoader.d.cts.map +1 -1
  30. package/build/batchloaders/loadBatchLoader.d.mts.map +1 -1
  31. package/build/batchloaders/loadBatchLoader.js +4 -3
  32. package/build/batchloaders/loadBatchLoader.js.map +1 -1
  33. package/build/batchloaders/manyToManyBatchLoader.cjs +1 -1
  34. package/build/batchloaders/manyToManyBatchLoader.js +1 -1
  35. package/build/batchloaders/oneToManyBatchLoader.cjs +3 -3
  36. package/build/batchloaders/oneToManyBatchLoader.cjs.map +1 -1
  37. package/build/batchloaders/oneToManyBatchLoader.js +2 -2
  38. package/build/batchloaders/oneToOneBatchLoader.cjs +4 -4
  39. package/build/batchloaders/oneToOneBatchLoader.cjs.map +1 -1
  40. package/build/batchloaders/oneToOneBatchLoader.js +3 -3
  41. package/build/batchloaders/populateBatchLoader.cjs +11 -11
  42. package/build/batchloaders/populateBatchLoader.cjs.map +1 -1
  43. package/build/batchloaders/populateBatchLoader.js +8 -8
  44. package/build/batchloaders/recursiveChildrenBatchLoader.cjs +8 -8
  45. package/build/batchloaders/recursiveChildrenBatchLoader.cjs.map +1 -1
  46. package/build/batchloaders/recursiveChildrenBatchLoader.js +5 -5
  47. package/build/batchloaders/recursiveM2mBatchLoader.cjs +5 -5
  48. package/build/batchloaders/recursiveM2mBatchLoader.cjs.map +1 -1
  49. package/build/batchloaders/recursiveM2mBatchLoader.js +2 -2
  50. package/build/batchloaders/recursiveParentsBatchLoader.cjs +8 -8
  51. package/build/batchloaders/recursiveParentsBatchLoader.cjs.map +1 -1
  52. package/build/batchloaders/recursiveParentsBatchLoader.js +5 -5
  53. package/build/changes.cjs +4 -4
  54. package/build/changes.js +4 -4
  55. package/build/config.cjs +3 -3
  56. package/build/config.js +3 -3
  57. package/build/configure.cjs +6 -6
  58. package/build/configure.js +6 -6
  59. package/build/dataloaders/fastWhereFilterHash.cjs +3 -3
  60. package/build/dataloaders/fastWhereFilterHash.cjs.map +1 -1
  61. package/build/dataloaders/fastWhereFilterHash.js +2 -2
  62. package/build/dataloaders/fastWhereFilterHash.js.map +1 -1
  63. package/build/dataloaders/findByUniqueDataLoader.cjs +5 -6
  64. package/build/dataloaders/findByUniqueDataLoader.cjs.map +1 -1
  65. package/build/dataloaders/findByUniqueDataLoader.d.cts.map +1 -1
  66. package/build/dataloaders/findByUniqueDataLoader.d.mts.map +1 -1
  67. package/build/dataloaders/findByUniqueDataLoader.js +3 -4
  68. package/build/dataloaders/findByUniqueDataLoader.js.map +1 -1
  69. package/build/dataloaders/findCountDataLoader.cjs +10 -13
  70. package/build/dataloaders/findCountDataLoader.cjs.map +1 -1
  71. package/build/dataloaders/findCountDataLoader.d.cts +2 -2
  72. package/build/dataloaders/findCountDataLoader.d.mts +2 -2
  73. package/build/dataloaders/findCountDataLoader.js +4 -7
  74. package/build/dataloaders/findCountDataLoader.js.map +1 -1
  75. package/build/dataloaders/findDataLoader.cjs +15 -19
  76. package/build/dataloaders/findDataLoader.cjs.map +1 -1
  77. package/build/dataloaders/findDataLoader.d.cts +2 -2
  78. package/build/dataloaders/findDataLoader.d.cts.map +1 -1
  79. package/build/dataloaders/findDataLoader.d.mts +2 -2
  80. package/build/dataloaders/findDataLoader.d.mts.map +1 -1
  81. package/build/dataloaders/findDataLoader.js +5 -9
  82. package/build/dataloaders/findDataLoader.js.map +1 -1
  83. package/build/dataloaders/findIdsDataLoader.cjs +6 -9
  84. package/build/dataloaders/findIdsDataLoader.cjs.map +1 -1
  85. package/build/dataloaders/findIdsDataLoader.d.cts +1 -1
  86. package/build/dataloaders/findIdsDataLoader.d.mts +1 -1
  87. package/build/dataloaders/findIdsDataLoader.js +3 -6
  88. package/build/dataloaders/findIdsDataLoader.js.map +1 -1
  89. package/build/dataloaders/findOrCreateDataLoader.cjs +1 -2
  90. package/build/dataloaders/findOrCreateDataLoader.cjs.map +1 -1
  91. package/build/dataloaders/findOrCreateDataLoader.js +1 -2
  92. package/build/dataloaders/findOrCreateDataLoader.js.map +1 -1
  93. package/build/dataloaders/findPaginatedDataLoader.cjs +3 -6
  94. package/build/dataloaders/findPaginatedDataLoader.cjs.map +1 -1
  95. package/build/dataloaders/findPaginatedDataLoader.d.cts +1 -1
  96. package/build/dataloaders/findPaginatedDataLoader.d.mts +1 -1
  97. package/build/dataloaders/findPaginatedDataLoader.js +2 -5
  98. package/build/dataloaders/findPaginatedDataLoader.js.map +1 -1
  99. package/build/dataloaders/lensDataLoader.cjs +4 -4
  100. package/build/dataloaders/lensDataLoader.cjs.map +1 -1
  101. package/build/dataloaders/lensDataLoader.js +2 -2
  102. package/build/dataloaders/lensDataLoader.js.map +1 -1
  103. package/build/dataloaders/manyToManyFindDataLoader.cjs +1 -4
  104. package/build/dataloaders/manyToManyFindDataLoader.cjs.map +1 -1
  105. package/build/dataloaders/manyToManyFindDataLoader.d.cts +0 -1
  106. package/build/dataloaders/manyToManyFindDataLoader.d.cts.map +1 -1
  107. package/build/dataloaders/manyToManyFindDataLoader.d.mts +0 -1
  108. package/build/dataloaders/manyToManyFindDataLoader.d.mts.map +1 -1
  109. package/build/dataloaders/manyToManyFindDataLoader.js +1 -4
  110. package/build/dataloaders/manyToManyFindDataLoader.js.map +1 -1
  111. package/build/dataloaders/oneToManyFindDataLoader.cjs +3 -6
  112. package/build/dataloaders/oneToManyFindDataLoader.cjs.map +1 -1
  113. package/build/dataloaders/oneToManyFindDataLoader.d.cts +0 -1
  114. package/build/dataloaders/oneToManyFindDataLoader.d.cts.map +1 -1
  115. package/build/dataloaders/oneToManyFindDataLoader.d.mts +0 -1
  116. package/build/dataloaders/oneToManyFindDataLoader.d.mts.map +1 -1
  117. package/build/dataloaders/oneToManyFindDataLoader.js +2 -5
  118. package/build/dataloaders/oneToManyFindDataLoader.js.map +1 -1
  119. package/build/defaults.cjs +4 -4
  120. package/build/defaults.js +4 -4
  121. package/build/driverApi.cjs +4 -5
  122. package/build/driverApi.cjs.map +1 -1
  123. package/build/driverApi.d.cts +1 -1
  124. package/build/driverApi.d.mts +1 -1
  125. package/build/driverApi.js +2 -2
  126. package/build/driverApi.js.map +1 -1
  127. package/build/drivers/Driver.cjs +0 -1
  128. package/build/drivers/Driver.d.cts +1 -1
  129. package/build/drivers/Driver.d.mts +1 -1
  130. package/build/drivers/Driver.js +0 -1
  131. package/build/drivers/EntityWriter.cjs +2 -2
  132. package/build/drivers/EntityWriter.js +2 -2
  133. package/build/drivers/index.cjs +0 -6
  134. package/build/drivers/index.d.cts +1 -3
  135. package/build/drivers/index.d.mts +1 -3
  136. package/build/drivers/index.js +1 -3
  137. package/build/fieldSerde.cjs +2 -2
  138. package/build/fieldSerde.js +2 -2
  139. package/build/fields.cjs +2 -2
  140. package/build/fields.js +2 -2
  141. package/build/getProperties.cjs +1 -1
  142. package/build/getProperties.js +1 -1
  143. package/build/index.cjs +109 -107
  144. package/build/index.cjs.map +1 -1
  145. package/build/index.d.cts +27 -24
  146. package/build/index.d.cts.map +1 -1
  147. package/build/index.d.mts +27 -24
  148. package/build/index.d.mts.map +1 -1
  149. package/build/index.js +51 -49
  150. package/build/index.js.map +1 -1
  151. package/build/json.cjs +3 -3
  152. package/build/json.js +3 -3
  153. package/build/keys.cjs +1 -1
  154. package/build/keys.js +1 -1
  155. package/build/loadHints.cjs +1 -1
  156. package/build/loadHints.js +1 -1
  157. package/build/loadLens.cjs +1 -1
  158. package/build/loadLens.js +1 -1
  159. package/build/logging/FactoryLogger.cjs +1 -1
  160. package/build/logging/FactoryLogger.js +1 -1
  161. package/build/logging/FieldLogger.cjs +1 -1
  162. package/build/logging/FieldLogger.js +1 -1
  163. package/build/logging/ReactionLogger.cjs +1 -1
  164. package/build/logging/ReactionLogger.js +1 -1
  165. package/build/newEntity.cjs +1 -1
  166. package/build/newEntity.js +1 -1
  167. package/build/newTestInstance.cjs +3 -3
  168. package/build/newTestInstance.js +3 -3
  169. package/build/plugins/PreloadPlugin.cjs +1 -2
  170. package/build/plugins/PreloadPlugin.d.cts +1 -1
  171. package/build/plugins/PreloadPlugin.d.mts +1 -1
  172. package/build/plugins/PreloadPlugin.js +1 -2
  173. package/build/preloading/JsonAggregatePreloader.cjs +31 -31
  174. package/build/preloading/JsonAggregatePreloader.cjs.map +1 -1
  175. package/build/preloading/JsonAggregatePreloader.d.cts +1 -1
  176. package/build/preloading/JsonAggregatePreloader.d.mts +1 -1
  177. package/build/preloading/JsonAggregatePreloader.js +6 -6
  178. package/build/preloading/JsonAggregatePreloader.js.map +1 -1
  179. package/build/preloading/partitionHint.cjs +3 -3
  180. package/build/preloading/partitionHint.js +3 -3
  181. package/build/{ConditionBuilder.cjs → queries/ConditionBuilder.cjs} +7 -8
  182. package/build/queries/ConditionBuilder.cjs.map +1 -0
  183. package/build/{ConditionBuilder.d.cts → queries/ConditionBuilder.d.cts} +3 -3
  184. package/build/queries/ConditionBuilder.d.cts.map +1 -0
  185. package/build/{ConditionBuilder.d.mts → queries/ConditionBuilder.d.mts} +3 -3
  186. package/build/queries/ConditionBuilder.d.mts.map +1 -0
  187. package/build/{ConditionBuilder.js → queries/ConditionBuilder.js} +4 -5
  188. package/build/queries/ConditionBuilder.js.map +1 -0
  189. package/build/{conditions.cjs → queries/conditions.cjs} +1 -2
  190. package/build/queries/conditions.cjs.map +1 -0
  191. package/build/{conditions.d.cts → queries/conditions.d.cts} +2 -2
  192. package/build/queries/conditions.d.cts.map +1 -0
  193. package/build/{conditions.d.mts → queries/conditions.d.mts} +2 -2
  194. package/build/queries/conditions.d.mts.map +1 -0
  195. package/build/{conditions.js → queries/conditions.js} +1 -2
  196. package/build/queries/conditions.js.map +1 -0
  197. package/build/queries/entityQueryUtils.cjs +60 -0
  198. package/build/queries/entityQueryUtils.cjs.map +1 -0
  199. package/build/queries/entityQueryUtils.d.cts +19 -0
  200. package/build/queries/entityQueryUtils.d.cts.map +1 -0
  201. package/build/queries/entityQueryUtils.d.mts +19 -0
  202. package/build/queries/entityQueryUtils.d.mts.map +1 -0
  203. package/build/queries/entityQueryUtils.js +56 -0
  204. package/build/queries/entityQueryUtils.js.map +1 -0
  205. package/build/{Aliases.cjs → queries/find/Aliases.cjs} +23 -28
  206. package/build/queries/find/Aliases.cjs.map +1 -0
  207. package/build/{Aliases.d.cts → queries/find/Aliases.d.cts} +7 -7
  208. package/build/queries/find/Aliases.d.cts.map +1 -0
  209. package/build/{Aliases.d.mts → queries/find/Aliases.d.mts} +7 -7
  210. package/build/queries/find/Aliases.d.mts.map +1 -0
  211. package/build/{Aliases.js → queries/find/Aliases.js} +7 -12
  212. package/build/queries/find/Aliases.js.map +1 -0
  213. package/build/{DeferredAlias.cjs → queries/find/DeferredAlias.cjs} +3 -6
  214. package/build/queries/find/DeferredAlias.cjs.map +1 -0
  215. package/build/{DeferredAlias.d.cts → queries/find/DeferredAlias.d.cts} +4 -4
  216. package/build/queries/find/DeferredAlias.d.cts.map +1 -0
  217. package/build/{DeferredAlias.d.mts → queries/find/DeferredAlias.d.mts} +4 -4
  218. package/build/queries/find/DeferredAlias.d.mts.map +1 -0
  219. package/build/{DeferredAlias.js → queries/find/DeferredAlias.js} +2 -5
  220. package/build/queries/find/DeferredAlias.js.map +1 -0
  221. package/build/{EntityFilter.cjs → queries/find/EntityFilter.cjs} +4 -9
  222. package/build/queries/find/EntityFilter.cjs.map +1 -0
  223. package/build/{EntityFilter.d.cts → queries/find/EntityFilter.d.cts} +6 -6
  224. package/build/queries/find/EntityFilter.d.cts.map +1 -0
  225. package/build/{EntityFilter.d.mts → queries/find/EntityFilter.d.mts} +6 -6
  226. package/build/queries/find/EntityFilter.d.mts.map +1 -0
  227. package/build/{EntityFilter.js → queries/find/EntityFilter.js} +1 -6
  228. package/build/queries/find/EntityFilter.js.map +1 -0
  229. package/build/{EntityGraphQLFilter.cjs → queries/find/EntityGraphQLFilter.cjs} +1 -5
  230. package/build/queries/find/EntityGraphQLFilter.cjs.map +1 -0
  231. package/build/{EntityGraphQLFilter.d.cts → queries/find/EntityGraphQLFilter.d.cts} +3 -3
  232. package/build/queries/find/EntityGraphQLFilter.d.cts.map +1 -0
  233. package/build/{EntityGraphQLFilter.d.mts → queries/find/EntityGraphQLFilter.d.mts} +3 -3
  234. package/build/queries/find/EntityGraphQLFilter.d.mts.map +1 -0
  235. package/build/{EntityGraphQLFilter.js → queries/find/EntityGraphQLFilter.js} +1 -5
  236. package/build/queries/find/EntityGraphQLFilter.js.map +1 -0
  237. package/build/{QueryParser.cjs → queries/find/QueryParser.cjs} +68 -356
  238. package/build/queries/find/QueryParser.cjs.map +1 -0
  239. package/build/{QueryParser.collectionJoins.cjs → queries/find/QueryParser.collectionJoins.cjs} +8 -8
  240. package/build/queries/find/QueryParser.collectionJoins.cjs.map +1 -0
  241. package/build/{QueryParser.collectionJoins.d.cts → queries/find/QueryParser.collectionJoins.d.cts} +1 -1
  242. package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -0
  243. package/build/{QueryParser.collectionJoins.d.mts → queries/find/QueryParser.collectionJoins.d.mts} +1 -1
  244. package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -0
  245. package/build/{QueryParser.collectionJoins.js → queries/find/QueryParser.collectionJoins.js} +2 -2
  246. package/build/queries/find/QueryParser.collectionJoins.js.map +1 -0
  247. package/build/{QueryParser.d.cts → queries/find/QueryParser.d.cts} +5 -159
  248. package/build/queries/find/QueryParser.d.cts.map +1 -0
  249. package/build/{QueryParser.d.mts → queries/find/QueryParser.d.mts} +5 -159
  250. package/build/queries/find/QueryParser.d.mts.map +1 -0
  251. package/build/{QueryParser.js → queries/find/QueryParser.js} +15 -295
  252. package/build/queries/find/QueryParser.js.map +1 -0
  253. package/build/{QueryParser.pruning.cjs → queries/find/QueryParser.pruning.cjs} +6 -20
  254. package/build/queries/find/QueryParser.pruning.cjs.map +1 -0
  255. package/build/queries/find/QueryParser.pruning.d.cts +8 -0
  256. package/build/queries/find/QueryParser.pruning.d.cts.map +1 -0
  257. package/build/queries/find/QueryParser.pruning.d.mts +8 -0
  258. package/build/queries/find/QueryParser.pruning.d.mts.map +1 -0
  259. package/build/{QueryParser.pruning.js → queries/find/QueryParser.pruning.js} +4 -17
  260. package/build/queries/find/QueryParser.pruning.js.map +1 -0
  261. package/build/{QueryVisitor.cjs → queries/find/QueryVisitor.cjs} +2 -3
  262. package/build/queries/find/QueryVisitor.cjs.map +1 -0
  263. package/build/{QueryVisitor.d.cts → queries/find/QueryVisitor.d.cts} +3 -2
  264. package/build/queries/find/QueryVisitor.d.cts.map +1 -0
  265. package/build/{QueryVisitor.d.mts → queries/find/QueryVisitor.d.mts} +3 -2
  266. package/build/queries/find/QueryVisitor.d.mts.map +1 -0
  267. package/build/{QueryVisitor.js → queries/find/QueryVisitor.js} +2 -3
  268. package/build/queries/find/QueryVisitor.js.map +1 -0
  269. package/build/{drivers/buildRawQuery.cjs → queries/find/buildFindQuery.cjs} +14 -15
  270. package/build/queries/find/buildFindQuery.cjs.map +1 -0
  271. package/build/{drivers/buildRawQuery.d.cts → queries/find/buildFindQuery.d.cts} +3 -3
  272. package/build/queries/find/buildFindQuery.d.cts.map +1 -0
  273. package/build/{drivers/buildRawQuery.d.mts → queries/find/buildFindQuery.d.mts} +3 -3
  274. package/build/queries/find/buildFindQuery.d.mts.map +1 -0
  275. package/build/{drivers/buildRawQuery.js → queries/find/buildFindQuery.js} +5 -6
  276. package/build/queries/find/buildFindQuery.js.map +1 -0
  277. package/build/{scopes.cjs → queries/find/scopes.cjs} +2 -3
  278. package/build/queries/find/scopes.cjs.map +1 -0
  279. package/build/{scopes.d.cts → queries/find/scopes.d.cts} +6 -6
  280. package/build/queries/find/scopes.d.cts.map +1 -0
  281. package/build/{scopes.d.mts → queries/find/scopes.d.mts} +6 -6
  282. package/build/queries/find/scopes.d.mts.map +1 -0
  283. package/build/{scopes.js → queries/find/scopes.js} +2 -3
  284. package/build/queries/find/scopes.js.map +1 -0
  285. package/build/queries/parsedConditions.cjs +21 -0
  286. package/build/queries/parsedConditions.cjs.map +1 -0
  287. package/build/queries/parsedConditions.d.cts +127 -0
  288. package/build/queries/parsedConditions.d.cts.map +1 -0
  289. package/build/queries/parsedConditions.d.mts +127 -0
  290. package/build/queries/parsedConditions.d.mts.map +1 -0
  291. package/build/queries/parsedConditions.js +20 -0
  292. package/build/queries/parsedConditions.js.map +1 -0
  293. package/build/{drivers/buildUtils.cjs → queries/renderConditions.cjs} +7 -8
  294. package/build/queries/renderConditions.cjs.map +1 -0
  295. package/build/{drivers/buildUtils.d.mts → queries/renderConditions.d.cts} +5 -4
  296. package/build/queries/renderConditions.d.cts.map +1 -0
  297. package/build/{drivers/buildUtils.d.cts → queries/renderConditions.d.mts} +5 -4
  298. package/build/queries/renderConditions.d.mts.map +1 -0
  299. package/build/{drivers/buildUtils.js → queries/renderConditions.js} +4 -5
  300. package/build/queries/renderConditions.js.map +1 -0
  301. package/build/{skipCondition.cjs → queries/skipCondition.cjs} +1 -2
  302. package/build/queries/skipCondition.cjs.map +1 -0
  303. package/build/{skipCondition.d.cts → queries/skipCondition.d.cts} +2 -2
  304. package/build/{skipCondition.d.cts.map → queries/skipCondition.d.cts.map} +1 -1
  305. package/build/{skipCondition.d.mts → queries/skipCondition.d.mts} +2 -2
  306. package/build/{skipCondition.d.mts.map → queries/skipCondition.d.mts.map} +1 -1
  307. package/build/{skipCondition.js → queries/skipCondition.js} +1 -2
  308. package/build/queries/skipCondition.js.map +1 -0
  309. package/build/{AliasAssigner.cjs → queries/sql/AliasAssigner.cjs} +2 -3
  310. package/build/queries/sql/AliasAssigner.cjs.map +1 -0
  311. package/build/{AliasAssigner.d.cts → queries/sql/AliasAssigner.d.cts} +2 -2
  312. package/build/queries/sql/AliasAssigner.d.cts.map +1 -0
  313. package/build/{AliasAssigner.d.mts → queries/sql/AliasAssigner.d.mts} +2 -2
  314. package/build/queries/sql/AliasAssigner.d.mts.map +1 -0
  315. package/build/{AliasAssigner.js → queries/sql/AliasAssigner.js} +2 -3
  316. package/build/queries/sql/AliasAssigner.js.map +1 -0
  317. package/build/{Expr.cjs → queries/sql/Expr.cjs} +9 -9
  318. package/build/queries/sql/Expr.cjs.map +1 -0
  319. package/build/{Expr.d.cts → queries/sql/Expr.d.cts} +4 -4
  320. package/build/queries/sql/Expr.d.cts.map +1 -0
  321. package/build/{Expr.d.mts → queries/sql/Expr.d.mts} +4 -4
  322. package/build/queries/sql/Expr.d.mts.map +1 -0
  323. package/build/{Expr.js → queries/sql/Expr.js} +4 -4
  324. package/build/queries/sql/Expr.js.map +1 -0
  325. package/build/{Tables.cjs → queries/sql/Tables.cjs} +63 -67
  326. package/build/queries/sql/Tables.cjs.map +1 -0
  327. package/build/{Tables.d.cts → queries/sql/Tables.d.cts} +6 -7
  328. package/build/queries/sql/Tables.d.cts.map +1 -0
  329. package/build/{Tables.d.mts → queries/sql/Tables.d.mts} +6 -7
  330. package/build/queries/sql/Tables.d.mts.map +1 -0
  331. package/build/{Tables.js → queries/sql/Tables.js} +9 -13
  332. package/build/queries/sql/Tables.js.map +1 -0
  333. package/build/{execute.cjs → queries/sql/execute.cjs} +32 -37
  334. package/build/queries/sql/execute.cjs.map +1 -0
  335. package/build/{execute.d.cts → queries/sql/execute.d.cts} +6 -6
  336. package/build/queries/sql/execute.d.cts.map +1 -0
  337. package/build/{execute.d.mts → queries/sql/execute.d.mts} +6 -6
  338. package/build/queries/sql/execute.d.mts.map +1 -0
  339. package/build/{execute.js → queries/sql/execute.js} +5 -10
  340. package/build/queries/sql/execute.js.map +1 -0
  341. package/build/{expressions → queries/sql/expressions}/arrayAgg.cjs +12 -12
  342. package/build/queries/sql/expressions/arrayAgg.cjs.map +1 -0
  343. package/build/{expressions → queries/sql/expressions}/arrayAgg.d.cts +1 -1
  344. package/build/queries/sql/expressions/arrayAgg.d.cts.map +1 -0
  345. package/build/{expressions → queries/sql/expressions}/arrayAgg.d.mts +1 -1
  346. package/build/queries/sql/expressions/arrayAgg.d.mts.map +1 -0
  347. package/build/{expressions → queries/sql/expressions}/arrayAgg.js +1 -1
  348. package/build/queries/sql/expressions/arrayAgg.js.map +1 -0
  349. package/build/{expressions → queries/sql/expressions}/case.cjs +14 -14
  350. package/build/queries/sql/expressions/case.cjs.map +1 -0
  351. package/build/{expressions → queries/sql/expressions}/case.d.cts +1 -1
  352. package/build/queries/sql/expressions/case.d.cts.map +1 -0
  353. package/build/{expressions → queries/sql/expressions}/case.d.mts +1 -1
  354. package/build/queries/sql/expressions/case.d.mts.map +1 -0
  355. package/build/{expressions → queries/sql/expressions}/case.js +1 -1
  356. package/build/queries/sql/expressions/case.js.map +1 -0
  357. package/build/queries/sql/expressions/coalesce.cjs +25 -0
  358. package/build/queries/sql/expressions/coalesce.cjs.map +1 -0
  359. package/build/{expressions → queries/sql/expressions}/coalesce.d.cts +1 -1
  360. package/build/queries/sql/expressions/coalesce.d.cts.map +1 -0
  361. package/build/{expressions → queries/sql/expressions}/coalesce.d.mts +1 -1
  362. package/build/queries/sql/expressions/coalesce.d.mts.map +1 -0
  363. package/build/{expressions → queries/sql/expressions}/coalesce.js +1 -1
  364. package/build/queries/sql/expressions/coalesce.js.map +1 -0
  365. package/build/{expressions → queries/sql/expressions}/codecs.cjs +5 -5
  366. package/build/queries/sql/expressions/codecs.cjs.map +1 -0
  367. package/build/{expressions → queries/sql/expressions}/codecs.d.cts +1 -1
  368. package/build/queries/sql/expressions/codecs.d.cts.map +1 -0
  369. package/build/{expressions → queries/sql/expressions}/codecs.d.mts +1 -1
  370. package/build/queries/sql/expressions/codecs.d.mts.map +1 -0
  371. package/build/{expressions → queries/sql/expressions}/codecs.js +3 -3
  372. package/build/queries/sql/expressions/codecs.js.map +1 -0
  373. package/build/queries/sql/expressions/expression.cjs +102 -0
  374. package/build/queries/sql/expressions/expression.cjs.map +1 -0
  375. package/build/{expressions → queries/sql/expressions}/expression.d.cts +1 -1
  376. package/build/queries/sql/expressions/expression.d.cts.map +1 -0
  377. package/build/{expressions → queries/sql/expressions}/expression.d.mts +1 -1
  378. package/build/queries/sql/expressions/expression.d.mts.map +1 -0
  379. package/build/{expressions → queries/sql/expressions}/expression.js +2 -2
  380. package/build/queries/sql/expressions/expression.js.map +1 -0
  381. package/build/queries/sql/expressions/greatest.cjs +25 -0
  382. package/build/queries/sql/expressions/greatest.cjs.map +1 -0
  383. package/build/{expressions → queries/sql/expressions}/greatest.d.cts +1 -1
  384. package/build/queries/sql/expressions/greatest.d.cts.map +1 -0
  385. package/build/{expressions → queries/sql/expressions}/greatest.d.mts +1 -1
  386. package/build/queries/sql/expressions/greatest.d.mts.map +1 -0
  387. package/build/{expressions → queries/sql/expressions}/greatest.js +1 -1
  388. package/build/queries/sql/expressions/greatest.js.map +1 -0
  389. package/build/queries/sql/expressions/least.cjs +25 -0
  390. package/build/queries/sql/expressions/least.cjs.map +1 -0
  391. package/build/{expressions → queries/sql/expressions}/least.d.cts +1 -1
  392. package/build/queries/sql/expressions/least.d.cts.map +1 -0
  393. package/build/{expressions → queries/sql/expressions}/least.d.mts +1 -1
  394. package/build/queries/sql/expressions/least.d.mts.map +1 -0
  395. package/build/{expressions → queries/sql/expressions}/least.js +1 -1
  396. package/build/queries/sql/expressions/least.js.map +1 -0
  397. package/build/{expressions → queries/sql/expressions}/nullIf.cjs +6 -6
  398. package/build/queries/sql/expressions/nullIf.cjs.map +1 -0
  399. package/build/{expressions → queries/sql/expressions}/nullIf.d.cts +1 -1
  400. package/build/queries/sql/expressions/nullIf.d.cts.map +1 -0
  401. package/build/{expressions → queries/sql/expressions}/nullIf.d.mts +1 -1
  402. package/build/queries/sql/expressions/nullIf.d.mts.map +1 -0
  403. package/build/{expressions → queries/sql/expressions}/nullIf.js +1 -1
  404. package/build/queries/sql/expressions/nullIf.js.map +1 -0
  405. package/build/{expressions → queries/sql/expressions}/parseExpression.cjs +16 -16
  406. package/build/queries/sql/expressions/parseExpression.cjs.map +1 -0
  407. package/build/{expressions → queries/sql/expressions}/parseExpression.d.cts +1 -1
  408. package/build/queries/sql/expressions/parseExpression.d.cts.map +1 -0
  409. package/build/{expressions → queries/sql/expressions}/parseExpression.d.mts +1 -1
  410. package/build/queries/sql/expressions/parseExpression.d.mts.map +1 -0
  411. package/build/{expressions → queries/sql/expressions}/parseExpression.js +2 -2
  412. package/build/queries/sql/expressions/parseExpression.js.map +1 -0
  413. package/build/{expressions → queries/sql/expressions}/types.d.cts +1 -1
  414. package/build/queries/sql/expressions/types.d.cts.map +1 -0
  415. package/build/{expressions → queries/sql/expressions}/types.d.mts +1 -1
  416. package/build/queries/sql/expressions/types.d.mts.map +1 -0
  417. package/build/{keywords.cjs → queries/sql/keywords.cjs} +1 -1
  418. package/build/queries/sql/keywords.cjs.map +1 -0
  419. package/build/{keywords.d.cts → queries/sql/keywords.d.cts} +1 -1
  420. package/build/queries/sql/keywords.d.cts.map +1 -0
  421. package/build/{keywords.d.mts → queries/sql/keywords.d.mts} +1 -1
  422. package/build/queries/sql/keywords.d.mts.map +1 -0
  423. package/build/{keywords.js → queries/sql/keywords.js} +1 -1
  424. package/build/queries/sql/keywords.js.map +1 -0
  425. package/build/{query.cjs → queries/sql/query.cjs} +83 -84
  426. package/build/queries/sql/query.cjs.map +1 -0
  427. package/build/{query.d.cts → queries/sql/query.d.cts} +7 -7
  428. package/build/queries/sql/query.d.cts.map +1 -0
  429. package/build/{query.d.mts → queries/sql/query.d.mts} +7 -7
  430. package/build/queries/sql/query.d.mts.map +1 -0
  431. package/build/{query.js → queries/sql/query.js} +11 -12
  432. package/build/queries/sql/query.js.map +1 -0
  433. package/build/queries/valueFilters.cjs +248 -0
  434. package/build/queries/valueFilters.cjs.map +1 -0
  435. package/build/queries/valueFilters.d.cts +28 -0
  436. package/build/queries/valueFilters.d.cts.map +1 -0
  437. package/build/queries/valueFilters.d.mts +28 -0
  438. package/build/queries/valueFilters.d.mts.map +1 -0
  439. package/build/queries/valueFilters.js +243 -0
  440. package/build/queries/valueFilters.js.map +1 -0
  441. package/build/reactiveHints.cjs +5 -5
  442. package/build/reactiveHints.js +5 -5
  443. package/build/relations/AbstractRelationImpl.cjs +0 -5
  444. package/build/relations/AbstractRelationImpl.cjs.map +1 -1
  445. package/build/relations/AbstractRelationImpl.d.cts +1 -2
  446. package/build/relations/AbstractRelationImpl.d.cts.map +1 -1
  447. package/build/relations/AbstractRelationImpl.d.mts +1 -2
  448. package/build/relations/AbstractRelationImpl.d.mts.map +1 -1
  449. package/build/relations/AbstractRelationImpl.js +1 -5
  450. package/build/relations/AbstractRelationImpl.js.map +1 -1
  451. package/build/relations/AsyncProperty.cjs +1 -1
  452. package/build/relations/AsyncProperty.js +1 -1
  453. package/build/relations/AsyncReactiveField.cjs +3 -3
  454. package/build/relations/AsyncReactiveField.js +3 -3
  455. package/build/relations/Collection.cjs +1 -1
  456. package/build/relations/Collection.js +1 -1
  457. package/build/relations/CustomCollection.cjs +1 -1
  458. package/build/relations/CustomCollection.js +1 -1
  459. package/build/relations/CustomReference.cjs +3 -3
  460. package/build/relations/CustomReference.js +3 -3
  461. package/build/relations/EnumCollection.cjs +2 -2
  462. package/build/relations/EnumCollection.js +2 -2
  463. package/build/relations/LazyField.cjs +6 -7
  464. package/build/relations/LazyField.cjs.map +1 -1
  465. package/build/relations/LazyField.js +5 -6
  466. package/build/relations/LazyField.js.map +1 -1
  467. package/build/relations/ManyToManyCollection.cjs +4 -3
  468. package/build/relations/ManyToManyCollection.cjs.map +1 -1
  469. package/build/relations/ManyToManyCollection.d.cts.map +1 -1
  470. package/build/relations/ManyToManyCollection.d.mts.map +1 -1
  471. package/build/relations/ManyToManyCollection.js +4 -3
  472. package/build/relations/ManyToManyCollection.js.map +1 -1
  473. package/build/relations/ManyToManyLargeCollection.cjs +2 -2
  474. package/build/relations/ManyToManyLargeCollection.js +2 -2
  475. package/build/relations/ManyToOneReference.cjs +7 -6
  476. package/build/relations/ManyToOneReference.cjs.map +1 -1
  477. package/build/relations/ManyToOneReference.d.cts.map +1 -1
  478. package/build/relations/ManyToOneReference.d.mts.map +1 -1
  479. package/build/relations/ManyToOneReference.js +7 -6
  480. package/build/relations/ManyToOneReference.js.map +1 -1
  481. package/build/relations/OneToManyCollection.cjs +6 -5
  482. package/build/relations/OneToManyCollection.cjs.map +1 -1
  483. package/build/relations/OneToManyCollection.d.cts.map +1 -1
  484. package/build/relations/OneToManyCollection.d.mts.map +1 -1
  485. package/build/relations/OneToManyCollection.js +4 -3
  486. package/build/relations/OneToManyCollection.js.map +1 -1
  487. package/build/relations/OneToManyLargeCollection.cjs +3 -3
  488. package/build/relations/OneToManyLargeCollection.js +3 -3
  489. package/build/relations/OneToOneReference.cjs +6 -5
  490. package/build/relations/OneToOneReference.cjs.map +1 -1
  491. package/build/relations/OneToOneReference.d.cts.map +1 -1
  492. package/build/relations/OneToOneReference.d.mts.map +1 -1
  493. package/build/relations/OneToOneReference.js +6 -5
  494. package/build/relations/OneToOneReference.js.map +1 -1
  495. package/build/relations/PolymorphicReference.cjs +7 -6
  496. package/build/relations/PolymorphicReference.cjs.map +1 -1
  497. package/build/relations/PolymorphicReference.d.cts.map +1 -1
  498. package/build/relations/PolymorphicReference.d.mts.map +1 -1
  499. package/build/relations/PolymorphicReference.js +7 -6
  500. package/build/relations/PolymorphicReference.js.map +1 -1
  501. package/build/relations/ReactiveField.cjs +3 -3
  502. package/build/relations/ReactiveField.js +3 -3
  503. package/build/relations/ReactiveGetter.cjs +1 -1
  504. package/build/relations/ReactiveGetter.js +1 -1
  505. package/build/relations/ReactiveManyToMany.cjs +5 -4
  506. package/build/relations/ReactiveManyToMany.cjs.map +1 -1
  507. package/build/relations/ReactiveManyToMany.d.cts.map +1 -1
  508. package/build/relations/ReactiveManyToMany.d.mts.map +1 -1
  509. package/build/relations/ReactiveManyToMany.js +5 -4
  510. package/build/relations/ReactiveManyToMany.js.map +1 -1
  511. package/build/relations/ReactiveManyToManyOtherSide.cjs +3 -3
  512. package/build/relations/ReactiveManyToManyOtherSide.js +3 -3
  513. package/build/relations/ReactiveReference.cjs +8 -7
  514. package/build/relations/ReactiveReference.cjs.map +1 -1
  515. package/build/relations/ReactiveReference.d.cts.map +1 -1
  516. package/build/relations/ReactiveReference.d.mts.map +1 -1
  517. package/build/relations/ReactiveReference.js +8 -7
  518. package/build/relations/ReactiveReference.js.map +1 -1
  519. package/build/relations/RecursiveCollection.cjs +3 -3
  520. package/build/relations/RecursiveCollection.js +3 -3
  521. package/build/relations/Reference.cjs +1 -1
  522. package/build/relations/Reference.js +1 -1
  523. package/build/relations/hasAsyncMethod.cjs +1 -1
  524. package/build/relations/hasAsyncMethod.js +1 -1
  525. package/build/relations/hasManyDerived.cjs +1 -1
  526. package/build/relations/hasManyDerived.js +1 -1
  527. package/build/relations/hasOneDerived.cjs +2 -2
  528. package/build/relations/hasOneDerived.js +2 -2
  529. package/build/relations/hasProperty.cjs +2 -2
  530. package/build/relations/hasProperty.js +2 -2
  531. package/build/relations/index.cjs +13 -13
  532. package/build/relations/index.js +13 -13
  533. package/build/relations/isCascadeDelete.cjs +11 -0
  534. package/build/relations/isCascadeDelete.cjs.map +1 -0
  535. package/build/relations/isCascadeDelete.d.cts +7 -0
  536. package/build/relations/isCascadeDelete.d.cts.map +1 -0
  537. package/build/relations/isCascadeDelete.d.mts +7 -0
  538. package/build/relations/isCascadeDelete.d.mts.map +1 -0
  539. package/build/relations/isCascadeDelete.js +10 -0
  540. package/build/relations/isCascadeDelete.js.map +1 -0
  541. package/build/resurrection.cjs +1 -1
  542. package/build/resurrection.js +1 -1
  543. package/build/rules.cjs +4 -4
  544. package/build/rules.js +4 -4
  545. package/build/serde.cjs +1 -1
  546. package/build/serde.js +1 -1
  547. package/build/unnest.cjs +0 -1
  548. package/build/unnest.cjs.map +1 -1
  549. package/build/unnest.d.cts +1 -1
  550. package/build/unnest.d.mts +1 -1
  551. package/build/unnest.js +0 -1
  552. package/build/unnest.js.map +1 -1
  553. package/build/upsert.cjs +3 -3
  554. package/build/upsert.js +3 -3
  555. package/build/utils.cjs +1 -2
  556. package/build/utils.cjs.map +1 -1
  557. package/build/utils.d.cts +1 -1
  558. package/build/utils.d.mts +1 -1
  559. package/build/utils.js +1 -2
  560. package/build/utils.js.map +1 -1
  561. package/build/withLoaded.cjs +3 -3
  562. package/build/withLoaded.js +3 -3
  563. package/package.json +2 -2
  564. package/build/AliasAssigner.cjs.map +0 -1
  565. package/build/AliasAssigner.d.cts.map +0 -1
  566. package/build/AliasAssigner.d.mts.map +0 -1
  567. package/build/AliasAssigner.js.map +0 -1
  568. package/build/Aliases.cjs.map +0 -1
  569. package/build/Aliases.d.cts.map +0 -1
  570. package/build/Aliases.d.mts.map +0 -1
  571. package/build/Aliases.js.map +0 -1
  572. package/build/ConditionBuilder.cjs.map +0 -1
  573. package/build/ConditionBuilder.d.cts.map +0 -1
  574. package/build/ConditionBuilder.d.mts.map +0 -1
  575. package/build/ConditionBuilder.js.map +0 -1
  576. package/build/DeferredAlias.cjs.map +0 -1
  577. package/build/DeferredAlias.d.cts.map +0 -1
  578. package/build/DeferredAlias.d.mts.map +0 -1
  579. package/build/DeferredAlias.js.map +0 -1
  580. package/build/EntityFilter.cjs.map +0 -1
  581. package/build/EntityFilter.d.cts.map +0 -1
  582. package/build/EntityFilter.d.mts.map +0 -1
  583. package/build/EntityFilter.js.map +0 -1
  584. package/build/EntityGraphQLFilter.cjs.map +0 -1
  585. package/build/EntityGraphQLFilter.d.cts.map +0 -1
  586. package/build/EntityGraphQLFilter.d.mts.map +0 -1
  587. package/build/EntityGraphQLFilter.js.map +0 -1
  588. package/build/Expr.cjs.map +0 -1
  589. package/build/Expr.d.cts.map +0 -1
  590. package/build/Expr.d.mts.map +0 -1
  591. package/build/Expr.js.map +0 -1
  592. package/build/QueryParser.cjs.map +0 -1
  593. package/build/QueryParser.collectionJoins.cjs.map +0 -1
  594. package/build/QueryParser.collectionJoins.d.cts.map +0 -1
  595. package/build/QueryParser.collectionJoins.d.mts.map +0 -1
  596. package/build/QueryParser.collectionJoins.js.map +0 -1
  597. package/build/QueryParser.d.cts.map +0 -1
  598. package/build/QueryParser.d.mts.map +0 -1
  599. package/build/QueryParser.js.map +0 -1
  600. package/build/QueryParser.pruning.cjs.map +0 -1
  601. package/build/QueryParser.pruning.d.cts +0 -10
  602. package/build/QueryParser.pruning.d.cts.map +0 -1
  603. package/build/QueryParser.pruning.d.mts +0 -10
  604. package/build/QueryParser.pruning.d.mts.map +0 -1
  605. package/build/QueryParser.pruning.js.map +0 -1
  606. package/build/QueryVisitor.cjs.map +0 -1
  607. package/build/QueryVisitor.d.cts.map +0 -1
  608. package/build/QueryVisitor.d.mts.map +0 -1
  609. package/build/QueryVisitor.js.map +0 -1
  610. package/build/Tables.cjs.map +0 -1
  611. package/build/Tables.d.cts.map +0 -1
  612. package/build/Tables.d.mts.map +0 -1
  613. package/build/Tables.js.map +0 -1
  614. package/build/conditions.cjs.map +0 -1
  615. package/build/conditions.d.cts.map +0 -1
  616. package/build/conditions.d.mts.map +0 -1
  617. package/build/conditions.js.map +0 -1
  618. package/build/drivers/buildRawQuery.cjs.map +0 -1
  619. package/build/drivers/buildRawQuery.d.cts.map +0 -1
  620. package/build/drivers/buildRawQuery.d.mts.map +0 -1
  621. package/build/drivers/buildRawQuery.js.map +0 -1
  622. package/build/drivers/buildUtils.cjs.map +0 -1
  623. package/build/drivers/buildUtils.d.cts.map +0 -1
  624. package/build/drivers/buildUtils.d.mts.map +0 -1
  625. package/build/drivers/buildUtils.js.map +0 -1
  626. package/build/execute.cjs.map +0 -1
  627. package/build/execute.d.cts.map +0 -1
  628. package/build/execute.d.mts.map +0 -1
  629. package/build/execute.js.map +0 -1
  630. package/build/expressions/arrayAgg.cjs.map +0 -1
  631. package/build/expressions/arrayAgg.d.cts.map +0 -1
  632. package/build/expressions/arrayAgg.d.mts.map +0 -1
  633. package/build/expressions/arrayAgg.js.map +0 -1
  634. package/build/expressions/case.cjs.map +0 -1
  635. package/build/expressions/case.d.cts.map +0 -1
  636. package/build/expressions/case.d.mts.map +0 -1
  637. package/build/expressions/case.js.map +0 -1
  638. package/build/expressions/coalesce.cjs +0 -25
  639. package/build/expressions/coalesce.cjs.map +0 -1
  640. package/build/expressions/coalesce.d.cts.map +0 -1
  641. package/build/expressions/coalesce.d.mts.map +0 -1
  642. package/build/expressions/coalesce.js.map +0 -1
  643. package/build/expressions/codecs.cjs.map +0 -1
  644. package/build/expressions/codecs.d.cts.map +0 -1
  645. package/build/expressions/codecs.d.mts.map +0 -1
  646. package/build/expressions/codecs.js.map +0 -1
  647. package/build/expressions/expression.cjs +0 -102
  648. package/build/expressions/expression.cjs.map +0 -1
  649. package/build/expressions/expression.d.cts.map +0 -1
  650. package/build/expressions/expression.d.mts.map +0 -1
  651. package/build/expressions/expression.js.map +0 -1
  652. package/build/expressions/greatest.cjs +0 -25
  653. package/build/expressions/greatest.cjs.map +0 -1
  654. package/build/expressions/greatest.d.cts.map +0 -1
  655. package/build/expressions/greatest.d.mts.map +0 -1
  656. package/build/expressions/greatest.js.map +0 -1
  657. package/build/expressions/least.cjs +0 -25
  658. package/build/expressions/least.cjs.map +0 -1
  659. package/build/expressions/least.d.cts.map +0 -1
  660. package/build/expressions/least.d.mts.map +0 -1
  661. package/build/expressions/least.js.map +0 -1
  662. package/build/expressions/nullIf.cjs.map +0 -1
  663. package/build/expressions/nullIf.d.cts.map +0 -1
  664. package/build/expressions/nullIf.d.mts.map +0 -1
  665. package/build/expressions/nullIf.js.map +0 -1
  666. package/build/expressions/parseExpression.cjs.map +0 -1
  667. package/build/expressions/parseExpression.d.cts.map +0 -1
  668. package/build/expressions/parseExpression.d.mts.map +0 -1
  669. package/build/expressions/parseExpression.js.map +0 -1
  670. package/build/expressions/types.d.cts.map +0 -1
  671. package/build/expressions/types.d.mts.map +0 -1
  672. package/build/keywords.cjs.map +0 -1
  673. package/build/keywords.d.cts.map +0 -1
  674. package/build/keywords.d.mts.map +0 -1
  675. package/build/keywords.js.map +0 -1
  676. package/build/query.cjs.map +0 -1
  677. package/build/query.d.cts.map +0 -1
  678. package/build/query.d.mts.map +0 -1
  679. package/build/query.js.map +0 -1
  680. package/build/scopes.cjs.map +0 -1
  681. package/build/scopes.d.cts.map +0 -1
  682. package/build/scopes.d.mts.map +0 -1
  683. package/build/scopes.js.map +0 -1
  684. package/build/skipCondition.cjs.map +0 -1
  685. package/build/skipCondition.js.map +0 -1
  686. /package/build/{expressions → queries/sql/expressions}/types.cjs +0 -0
  687. /package/build/{expressions → queries/sql/expressions}/types.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveReference.d.cts","names":[],"sources":["../../src/relations/ReactiveReference.ts"],"mappings":";;;;;;;;;;;UA4BiB,kBAAkB,UAAU,QAAQ,UAAU,QAAQ,qCAAqC,UAC1G,GACA,GACA;EAEA;EACA;EAEA,KAAK;IAAS;IAAuB;MAAu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K;IAAS;IAAuB;MAAuB,QAAQ,IAAI;MAsD1E;EAkBJ;UAKQ;MAmCJ,cAAc,IAAI;MAIlB,kBAAkB,IAAI;MAItB,OAAO,IAAI;EAIf,IAAI,GAAG,IAAI;MAIP;EAKJ,QAAQ,QAAQ,IAAI;MAShB;EAIJ;UAMQ;EAOR,OAAO,OAAO,sBAAsB,GAAG,GAAG,GAAG,IAAI,aAAa,GAAG,MAAM;;MAOnE,iBAAiB,WAAW;MAK5B,MAAM,KAAK;MAIX;MAIA,WAAW,KAAK,KAAK;MAIrB;MAIA;;cAQQ;cAKA;EAIZ,YAAY,GAAG,IAAI,KAAK,KAAK;EAI7B;EASM,0BAA0B;EAWhC,QAAQ;IAAS;MAA0B,aAAa;MAQpD;MAIO,aAAa,eAAe;MAI5B;EAIJ;;;;;;;;;;UAeC;cAOI;;;;;EAQZ,mBAAmB,IAAI;GAYtB,YAAY;GACZ,YAAY;GACZ,aAAa;;;iBAIA,oBAAoB,wBAAwB,oBAAoB"}
@@ -1,16 +1,17 @@
1
- import { lazyField } from "../newEntity.js";
2
- import { AbstractRelationImpl, isCascadeDelete } from "./AbstractRelationImpl.js";
1
+ import { getField, setField } from "../fields.js";
2
+ import { AbstractRelationImpl } from "./AbstractRelationImpl.js";
3
3
  import { RelationT, RelationU } from "./RelationSymbols.js";
4
- import { ReferenceN } from "./ReferenceSymbols.js";
5
- import "./Reference.js";
4
+ import { isCascadeDelete } from "./isCascadeDelete.js";
6
5
  import "../IsLoadedCache.js";
6
+ import { ReferenceN } from "./ReferenceSymbols.js";
7
7
  import { failIfNewEntity, failNoId } from "./ManyToOneReference.js";
8
- import { deTagId, maybeResolveReferenceToId, toIdOf } from "../keys.js";
9
- import { getMetadata } from "../EntityMetadata.js";
10
- import { getField, setField } from "../fields.js";
8
+ import "./Reference.js";
11
9
  import { convertToLoadHint } from "../reactiveHints.js";
12
10
  import { isLoaded } from "../loadHints.js";
13
11
  import { fail } from "../utils.js";
12
+ import { lazyField } from "../newEntity.js";
13
+ import { deTagId, maybeResolveReferenceToId, toIdOf } from "../keys.js";
14
+ import { getMetadata } from "../EntityMetadata.js";
14
15
  import { ensureNotDeleted } from "../index.js";
15
16
  import { getEmInternalApi, sameEntity } from "../EntityManager.js";
16
17
  import { isEntity } from "../Entity.js";
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveReference.js","names":["#fieldName","#otherMeta","#state","#loadPromise","#isLoaded","#isCached","#rr","#loaded"],"sources":["../../src/relations/ReactiveReference.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type IdOf } from \"../EntityManager.ts\";\nimport { getField, setField } from \"../fields.ts\";\nimport {\n type EntityMetadata,\n type ManyToOneField,\n type TaggedId,\n deTagId,\n ensureNotDeleted,\n fail,\n getEmInternalApi,\n getInstanceData,\n getMetadata,\n isEntity,\n isLoaded,\n maybeResolveReferenceToId,\n sameEntity,\n toIdOf,\n} from \"../index.ts\";\nimport { type IsLoadedCachable } from \"../IsLoadedCache.ts\";\nimport { lazyField } from \"../newEntity.ts\";\nimport { type MaybeReactedEntity, type Reacted, type ReactiveHint, convertToLoadHint } from \"../reactiveHints.ts\";\nimport { AbstractRelationImpl, isCascadeDelete } from \"./AbstractRelationImpl.ts\";\nimport { failIfNewEntity, failNoId } from \"./ManyToOneReference.ts\";\nimport { type Reference } from \"./Reference.ts\";\nimport { ReferenceN } from \"./ReferenceSymbols.ts\";\nimport { RelationT, RelationU } from \"./RelationSymbols.ts\";\n\nexport interface ReactiveReference<T extends Entity, U extends Entity, N extends never | undefined> extends Reference<\n T,\n U,\n N\n> {\n isLoaded: boolean;\n isSet: boolean;\n\n load(opts?: { withDeleted?: boolean; forceReload?: true }): Promise<U | N>;\n\n /**\n * Returns the as-of-last-flush previously-calculated entity.\n *\n * This is useful if you have to purposefully avoid using the lambda to calc the latest entity,\n * i.e. if you're in a test and want to watch a calculated entity change from some dummy entity\n * to the new derived entity.\n * */\n fieldValue: U | N;\n\n /** Returns the id of the current assigned entity, or a runtime error if either 1) unset or 2) set to a new entity that doesn't have an `id` yet. */\n id: IdOf<U>;\n\n /** Returns the id of the current assigned entity, undefined if unset, or a runtime error if set to a new entity. */\n idIfSet: IdOf<U> | undefined;\n\n idUntagged: string;\n\n idUntaggedIfSet: string | undefined;\n}\n\nexport function hasReactiveReference<T extends Entity, U extends Entity, const H extends ReactiveHint<T>>(\n hint: H,\n fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U>,\n): ReactiveReference<T, U, never>;\nexport function hasReactiveReference<T extends Entity, U extends Entity, const H extends ReactiveHint<T>>(\n hint: H,\n fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U> | undefined,\n): ReactiveReference<T, U, undefined>;\n/** Creates a `ReactiveReference`. */\nexport function hasReactiveReference<\n T extends Entity,\n U extends Entity,\n const H extends ReactiveHint<T>,\n N extends never | undefined,\n>(hint: H, fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U> | N): ReactiveReference<T, U, N> {\n return lazyField((entity: T, fieldName) => {\n const m2o = getMetadata(entity).allFields[fieldName] as ManyToOneField;\n return new ReactiveReferenceImpl<T, U, H, N>(entity, m2o, hint, fn);\n });\n}\n\n/**\n * Implements ReactiveReferences.\n *\n * This is a bit trickier than ReactiveFields, because we have to differentiate our loaded\n * between:\n *\n * - our load hint is loaded, and we can directly calculate the referenced entity, or\n * - we've fetched the calculated/stored entity from the database, but not purposefully\n * not re-calculating it (which would require fetching the load hint, which might be\n * expensive, and defeat the point of having our field materialized in the database)\n *\n * Further, want to support all of:\n *\n * - When loaded & `.get` has been called, we cache the value\n *\n * - If a WIP mutation happens, we invalidate `.get` *but* if we check `.isLoaded`,\n * we can return the live/updated value, without an `await`.\n *\n * - If a WIP mutation happens, we invalidate `.isLoaded`, and if we're *no longer loaded*,\n * we want to keep returning the stale value (as asserted by the tests), but the next\n * `load` / `populate` should load the graph & recalculate the value.\n */\nexport class ReactiveReferenceImpl<\n T extends Entity,\n U extends Entity,\n H extends ReactiveHint<T>,\n N extends never | undefined,\n>\n extends AbstractRelationImpl<T, U>\n implements ReactiveReference<T, U, N>, IsLoadedCachable\n{\n readonly #fieldName: keyof T & string;\n readonly #otherMeta: EntityMetadata;\n #state: RRState<U, N>;\n // #isLoaded doesn't necessary care if we're ref-mode or full-mode, it's just\n // whether a caller can call `.get` and not have it blow up.\n #isLoaded: boolean | undefined = undefined;\n #isCached: boolean = false;\n #loadPromise: Promise<U | N> | undefined;\n\n constructor(\n entity: T,\n field: ManyToOneField,\n public reactiveHint: H,\n private fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U> | N,\n ) {\n super(entity);\n // Minimizing changes until the other PR lands...\n this.#fieldName = field.fieldName as keyof T & string;\n this.#otherMeta = field.otherMetadata();\n this.#state = new RRUnloadedState<U, N>(this);\n // We can be initialized with [entity | id | undefined], and if it's entity or id, then setImpl\n // will set loaded appropriately; but if we're initialized undefined, then mark loaded here\n if (entity.isNewEntity) {\n // const isLoaded = isEntity(this.current()) ? true : undefined;\n }\n // If the property transformer is not enabled, then the RR will not be in the relations map because they are\n // defined in the implementation file and not the codegen file. So we should insert ourselves regardless.\n (getInstanceData(entity).relations ??= {})[field.fieldName] = this;\n }\n\n async load(opts?: { withDeleted?: boolean; forceReload?: true }): Promise<U | N> {\n ensureNotDeleted(this.entity, \"pending\");\n const { loadHint } = this;\n if (!this.isLoaded || opts?.forceReload) {\n const { em } = this.entity;\n // Just because we're not loaded, doesn't mean we necessarily need to load our full hint.\n // We prefer to load only our previously-calculated/materialized value, and only load the\n // full load hint if we need recalculated.\n const maybeDirty = opts?.forceReload || getEmInternalApi(em).rm.isMaybePendingRecalc(this.entity, this.fieldName);\n if (maybeDirty) {\n return (this.#loadPromise ??= em\n .populate(this.entity, { hint: loadHint, ...opts })\n .then(() => {\n this.#state = this.#state.enterRecalcMode(this);\n this.#isLoaded = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n // Go through `this.get` so that `setField` is called to set our latest value\n this.#isCached = false;\n return this.doGet(opts);\n })\n .finally(() => {\n this.#loadPromise = undefined;\n }));\n } else {\n // If we don't need a full recalc, just make sure we have the entity in memory\n // ...ideally we would check `isSet` and whether the key was in the `instanceData`\n const current = this.current();\n if (isEntity(current) || current === undefined) {\n this.#state = new RRRefState<U, N>(this, current as U | N | undefined);\n this.#isLoaded = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n return current as U | N;\n } else {\n return (this.#loadPromise ??= em\n .load(this.#otherMeta.cstr, current)\n .then((loaded) => {\n this.#state = new RRRefState<U, N>(this, loaded);\n this.#isLoaded = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n return loaded;\n })\n .finally(() => {\n this.#loadPromise = undefined;\n }));\n }\n }\n }\n // The ReactiveField.load() always sets `#isCached = false`, but our assertion is that our\n // IsLoadedCache/resetIsLoaded infra is good enough to \"see all invalidating mutations\",\n // so we don't need this explicit reset.\n // this.#isCached = false;\n return this.doGet(opts);\n }\n\n get isLoaded(): boolean {\n // If we've cached an isLoaded value, just use that, see https://github.com/joist-orm/joist-orm/issues/1166\n if (this.#isLoaded !== undefined) return this.#isLoaded;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n // If a WIP mutation has marked our field as potentially dirty, we need to be \"full\" loaded\n const maybeDirty = getEmInternalApi(this.entity.em).rm.isMaybePendingRecalc(this.entity, this.fieldName);\n if (maybeDirty) {\n // If we're dirty, only being \"full\" loaded is good enough to recalc\n this.#state = this.#state.enterRecalcMode(this);\n this.#isLoaded = isLoaded(this.entity, this.loadHint);\n this.#isCached = false;\n } else {\n // If we've had `.load` called before, assume we're still loaded\n this.#isLoaded = this.#state.canReturnValue;\n }\n return this.#isLoaded;\n }\n\n resetIsLoaded(): void {\n this.#isLoaded = undefined;\n this.#isCached = false;\n }\n\n private doGet(opts?: { withDeleted?: boolean }): U | N {\n const { fn } = this;\n ensureNotDeleted(this.entity, \"pending\");\n // Fast pass if we've already calculated this (cache invalidation will happen on\n // any mutation via #resetIsLoaded)..\n if (this.#isCached) {\n return this.filterDeleted(this.#state.doGet() as U | N, opts);\n }\n // Call isLoaded to probe the load hint, and get `#isLoaded` set, but still have\n // our `if` check the raw `#isLoaded` to know if we should eval-latest or return `loaded`.\n if (this.isLoaded && this.#state.kind === \"full\") {\n const newValue = this.filterDeleted(fn(this.entity as any) as any, opts);\n // It's cheap to set this every time we're called, i.e. even if it's not the\n // official \"being called during em.flush\" update (...unless we're accessing it\n // during the validate phase of `em.flush`, then skip it to avoid tripping up\n // the \"cannot change entities during flush\" logic.)\n if (!getEmInternalApi(this.entity.em).isValidating) {\n this.setImpl(newValue);\n }\n this.#state = new RRFullState<U, N>(this, newValue);\n this.#isCached = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n } else if (this.#state.canReturnValue) {\n // We're either in ref mode, or in full mode but not actually fully loaded,\n // but in theory those states only get set after `.load()` / `.preload()` / import,\n // so we should have some stored value, even if it's not fully up-to-date.\n this.#isCached = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n } else {\n const noun = this.entity.isNewEntity ? \"derived\" : \"loaded\";\n throw new Error(`${this.entity}.${this.fieldName} has not been ${noun} yet`);\n }\n return this.filterDeleted(this.#state.doGet() as U | N, opts);\n }\n\n get fieldValue(): U | N {\n return getField(this.entity, this.fieldName);\n }\n\n get getWithDeleted(): U | N {\n return this.doGet({ withDeleted: true });\n }\n\n get get(): U | N {\n return this.doGet({ withDeleted: false });\n }\n\n set(_: U | N): void {\n fail(`Cannot set ${this.entity}.${this.fieldName} ReactiveReference directly.`);\n }\n\n get isSet(): boolean {\n return this.current() !== undefined;\n }\n\n // Internal method used by OneToManyCollection\n setImpl(entity: U | N): void {\n ensureNotDeleted(this.entity, \"pending\");\n if (sameEntity(entity, this.current({ withDeleted: true }))) {\n return;\n }\n // Prefer to keep the id in our data hash, but if this is a new entity w/o an id, use the entity itself\n setField(this.entity, this.fieldName, isEntity(entity) ? (entity.idTaggedMaybe ?? entity) : entity);\n }\n\n get isPreloaded(): boolean {\n return !!this.maybeFindEntity();\n }\n\n preload(): void {\n this.#state = new RRRefState<U, N>(this, this.maybeFindEntity());\n this.#isLoaded = true;\n this.#isCached = true;\n }\n\n private unload(): void {\n this.#state = new RRUnloadedState<U, N>(this);\n this.#isLoaded = false;\n this.#isCached = false;\n this.#loadPromise = undefined;\n }\n\n import(other: ReactiveReferenceImpl<T, U, H, N>, findEntity: (e: U) => U): void {\n this.#state = other.#state.import(this, findEntity);\n this.#isLoaded = true;\n this.#isCached = true;\n }\n\n /** Returns the tagged id of the current value. */\n get idTaggedMaybe(): TaggedId | N {\n ensureNotDeleted(this.entity, \"pending\");\n return maybeResolveReferenceToId(this.current()) as TaggedId | N;\n }\n\n get id(): IdOf<U> {\n return this.idMaybe || failNoId(this.entity, this.fieldName, this.current());\n }\n\n get idUntagged(): string {\n return this.idUntaggedMaybe || failNoId(this.entity, this.fieldName, this.current());\n }\n\n get idIfSet(): IdOf<U> | N | undefined {\n return this.idMaybe || failIfNewEntity(this.entity, this.fieldName, this.current());\n }\n\n get idUntaggedIfSet(): string | undefined {\n return this.idUntaggedMaybe || failIfNewEntity(this.entity, this.fieldName, this.current());\n }\n\n get loadHint(): any {\n const meta = getMetadata(this.entity);\n return (meta.config.__data.cachedReactiveLoadHints[this.fieldName] ??= convertToLoadHint(meta, this.reactiveHint));\n }\n\n // private impl\n\n /** Returns the id of the current value. */\n private get idMaybe(): IdOf<U> | undefined {\n ensureNotDeleted(this.entity, \"pending\");\n return toIdOf(this.otherMeta, this.idTaggedMaybe);\n }\n\n private get idUntaggedMaybe(): string | undefined {\n return deTagId(this.otherMeta, this.idMaybe);\n }\n\n setFromOpts(_: U | IdOf<U> | N): void {\n throw new Error(`ReactiveReference ${this.entity}.${this.fieldName} cannot be set via opts`);\n }\n\n maybeCascadeDelete(): void {\n if (this.isCascadeDelete) {\n const current = this.current({ withDeleted: true });\n if (current !== undefined && typeof current !== \"string\") {\n this.entity.em.delete(current as U);\n }\n }\n }\n\n async cleanupOnEntityDeleted(): Promise<void> {\n // if we are going to delete this relation as well, then we don't need to clean it up\n if (this.isCascadeDelete) return;\n setField(this.entity, this.fieldName, undefined);\n this.#state = new RRRefState<U, N>(this, undefined as N);\n this.#isLoaded = false;\n this.#isCached = false;\n this.#loadPromise = undefined;\n }\n\n // We need to keep U in data[fieldName] to handle entities without an id assigned yet.\n current(opts?: { withDeleted?: boolean }): U | string | N {\n const current = getField(this.entity, this.fieldName);\n if (current !== undefined && isEntity(current)) {\n return this.filterDeleted(current as U, opts);\n }\n return current;\n }\n\n get fieldName(): string {\n return this.#fieldName;\n }\n\n public get otherMeta(): EntityMetadata<U> {\n return (getMetadata(this.entity).allFields[this.#fieldName] as ManyToOneField).otherMetadata();\n }\n\n public get hasBeenSet(): boolean {\n return true;\n }\n\n public toString(): string {\n return `ReactiveReference(entity: ${this.entity}, hint: ${this.loadHint}, fieldName: ${this.fieldName}, otherMeta: {\n this.otherMeta.type\n }, id: ${this.id})`;\n }\n\n /**\n * Removes pending-hard-delete (but not soft-deleted), unless explicitly asked for.\n *\n * Note that we leave soft-deleted entities b/c the call signature of a `book.author.get`\n * very likely does not expect a soft-deleted entity to result in `undefined`.\n *\n * (Contrasted with `author.books.get` which is more intuitive to have soft-deleted\n * entities filtered out, i.e. it doesn't fundamentally change the return type.)\n */\n private filterDeleted(entity: U | N, opts?: { withDeleted?: boolean }): U | N {\n if (entity && (!opts || !opts.withDeleted) && entity.isDeletedEntity) {\n return undefined!;\n }\n return entity;\n }\n\n private get isCascadeDelete(): boolean {\n return isCascadeDelete(this, this.#fieldName);\n }\n\n /**\n * Looks for an entity in `EntityManager`, b/c we may have it in memory even if\n * our reference is not specifically loaded.\n */\n maybeFindEntity(): U | N {\n // Check this.loaded first b/c a new entity won't have an id yet\n if (this.#state.canReturnValue) {\n const loaded = this.#state.doGet();\n if (loaded !== undefined) {\n return loaded;\n }\n }\n const { idTaggedMaybe } = this;\n return idTaggedMaybe !== undefined ? (this.entity.em.getEntity(idTaggedMaybe) as U | N) : (undefined as N);\n }\n\n [RelationT]: T = null!;\n [RelationU]: U = null!;\n [ReferenceN]: N = null!;\n}\n\n/** Type guard utility for determining if an entity field is a ReactiveReference. */\nexport function isReactiveReference(maybeReactiveRef: any): maybeReactiveRef is ReactiveReference<any, any, any> {\n return maybeReactiveRef instanceof ReactiveReferenceImpl;\n}\n\ninterface RRState<U extends Entity, N extends never | undefined> {\n readonly kind: \"unloaded\" | \"ref\" | \"full\";\n readonly canReturnValue: boolean;\n doGet(): U | N | undefined;\n /**\n * Switches from \"materialized ref value\" semantics to \"recalc from reactive graph when available\" semantics.\n *\n * This is synchronous because it does not mean the load hint is fully loaded yet. It only means this\n * reference should now behave as recalc-capable: if `isLoaded(loadHint)` later reports true, `doGet`\n * will recalculate from `fn(...)`; otherwise we keep returning the last known/stale value until `load()`\n * populates the graph.\n */\n enterRecalcMode(target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N>;\n import(target: ReactiveReferenceImpl<any, any, any, any>, findEntity: (e: U) => U): RRState<U, N>;\n}\n\nclass RRUnloadedState<U extends Entity, N extends never | undefined> implements RRState<U, N> {\n readonly kind = \"unloaded\";\n readonly canReturnValue = false;\n #rr: ReactiveReferenceImpl<any, any, any, any>;\n\n constructor(rr: ReactiveReferenceImpl<any, any, any, any>) {\n this.#rr = rr;\n }\n\n doGet(): U | N | undefined {\n throw new Error(`${this.#rr.entity}.${this.#rr.fieldName} was not loaded`);\n }\n\n enterRecalcMode(target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N> {\n return new RRFullState<U, N>(target, undefined);\n }\n\n import(target: ReactiveReferenceImpl<any, any, any, any>, _findEntity: (e: U) => U): RRState<U, N> {\n return new RRUnloadedState<U, N>(target);\n }\n}\n\nclass RRRefState<U extends Entity, N extends never | undefined> implements RRState<U, N> {\n readonly kind = \"ref\";\n readonly canReturnValue = true;\n #loaded: U | N | undefined;\n\n constructor(_rr: ReactiveReferenceImpl<any, any, any, any>, loaded: U | N | undefined) {\n this.#loaded = loaded;\n }\n\n doGet(): U | N | undefined {\n return this.#loaded;\n }\n\n enterRecalcMode(target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N> {\n return new RRFullState<U, N>(target, this.#loaded);\n }\n\n import(target: ReactiveReferenceImpl<any, any, any, any>, findEntity: (e: U) => U): RRState<U, N> {\n return new RRRefState<U, N>(target, mapReactiveReferenceEntity(this.#loaded, findEntity));\n }\n}\n\nclass RRFullState<U extends Entity, N extends never | undefined> implements RRState<U, N> {\n readonly kind = \"full\";\n readonly canReturnValue = true;\n #loaded: U | N | undefined;\n\n constructor(_rr: ReactiveReferenceImpl<any, any, any, any>, loaded: U | N | undefined) {\n this.#loaded = loaded;\n }\n\n doGet(): U | N | undefined {\n return this.#loaded;\n }\n\n enterRecalcMode(_target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N> {\n return this;\n }\n\n import(target: ReactiveReferenceImpl<any, any, any, any>, findEntity: (e: U) => U): RRState<U, N> {\n return new RRRefState<U, N>(target, mapReactiveReferenceEntity(this.#loaded, findEntity));\n }\n}\n\nfunction mapReactiveReferenceEntity<U extends Entity, N extends never | undefined>(\n entity: U | N | undefined,\n findEntity: (e: U) => U,\n): U | N | undefined {\n return isEntity(entity) ? findEntity(entity) : entity;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmEA,SAAgB,qBAKd,MAAS,IAAsF;CAC/F,OAAO,WAAW,QAAW,cAAc;EACzC,MAAM,MAAM,YAAY,MAAM,CAAC,CAAC,UAAU;EAC1C,OAAO,IAAI,sBAAkC,QAAQ,KAAK,MAAM,EAAE;CACpE,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAa,wBAAb,cAMU,qBAEV;CAaW;CACC;CAbV;CACA;CACA;CAGA,YAAiC,KAAA;CACjC,YAAqB;CACrB;CAEA,YACE,QACA,OACA,cACA,IACA;EACA,MAAM,MAAM;EAHL,KAAA,eAAA;EACC,KAAA,KAAA;EAIR,KAAKA,aAAa,MAAM;EACx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GAAG,KAAKA,IAAI,UAAU,gBAAgB;CAC3E;CAEA,gBAAgB,QAAsE;EACpF,OAAO,IAAI,YAAkB,QAAQ,KAAA,CAAS;CAChD;CAEA,OAAO,QAAmD,aAAyC;EACjG,OAAO,IAAI,gBAAsB,MAAM;CACzC;AACF;AAEA,IAAM,aAAN,MAAM,WAAmF;CACvF,OAAgB;CAChB,iBAA0B;CAC1B;CAEA,YAAY,KAAgD,QAA2B;EACrF,KAAKC,UAAU;CACjB;CAEA,QAA2B;EACzB,OAAO,KAAKA;CACd;CAEA,gBAAgB,QAAsE;EACpF,OAAO,IAAI,YAAkB,QAAQ,KAAKA,OAAO;CACnD;CAEA,OAAO,QAAmD,YAAwC;EAChG,OAAO,IAAI,WAAiB,QAAQ,2BAA2B,KAAKA,SAAS,UAAU,CAAC;CAC1F;AACF;AAEA,IAAM,cAAN,MAA0F;CACxF,OAAgB;CAChB,iBAA0B;CAC1B;CAEA,YAAY,KAAgD,QAA2B;EACrF,KAAKA,UAAU;CACjB;CAEA,QAA2B;EACzB,OAAO,KAAKA;CACd;CAEA,gBAAgB,SAAuE;EACrF,OAAO;CACT;CAEA,OAAO,QAAmD,YAAwC;EAChG,OAAO,IAAI,WAAiB,QAAQ,2BAA2B,KAAKA,SAAS,UAAU,CAAC;CAC1F;AACF;AAEA,SAAS,2BACP,QACA,YACmB;CACnB,OAAO,SAAS,MAAM,IAAI,WAAW,MAAM,IAAI;AACjD"}
1
+ {"version":3,"file":"ReactiveReference.js","names":["#fieldName","#otherMeta","#state","#loadPromise","#isLoaded","#isCached","#rr","#loaded"],"sources":["../../src/relations/ReactiveReference.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type IdOf } from \"../EntityManager.ts\";\nimport { getField, setField } from \"../fields.ts\";\nimport {\n type EntityMetadata,\n type ManyToOneField,\n type TaggedId,\n deTagId,\n ensureNotDeleted,\n fail,\n getEmInternalApi,\n getInstanceData,\n getMetadata,\n isEntity,\n isLoaded,\n maybeResolveReferenceToId,\n sameEntity,\n toIdOf,\n} from \"../index.ts\";\nimport { type IsLoadedCachable } from \"../IsLoadedCache.ts\";\nimport { lazyField } from \"../newEntity.ts\";\nimport { type MaybeReactedEntity, type Reacted, type ReactiveHint, convertToLoadHint } from \"../reactiveHints.ts\";\nimport { AbstractRelationImpl } from \"./AbstractRelationImpl.ts\";\nimport { isCascadeDelete } from \"./isCascadeDelete.ts\";\nimport { failIfNewEntity, failNoId } from \"./ManyToOneReference.ts\";\nimport { type Reference } from \"./Reference.ts\";\nimport { ReferenceN } from \"./ReferenceSymbols.ts\";\nimport { RelationT, RelationU } from \"./RelationSymbols.ts\";\n\nexport interface ReactiveReference<T extends Entity, U extends Entity, N extends never | undefined> extends Reference<\n T,\n U,\n N\n> {\n isLoaded: boolean;\n isSet: boolean;\n\n load(opts?: { withDeleted?: boolean; forceReload?: true }): Promise<U | N>;\n\n /**\n * Returns the as-of-last-flush previously-calculated entity.\n *\n * This is useful if you have to purposefully avoid using the lambda to calc the latest entity,\n * i.e. if you're in a test and want to watch a calculated entity change from some dummy entity\n * to the new derived entity.\n * */\n fieldValue: U | N;\n\n /** Returns the id of the current assigned entity, or a runtime error if either 1) unset or 2) set to a new entity that doesn't have an `id` yet. */\n id: IdOf<U>;\n\n /** Returns the id of the current assigned entity, undefined if unset, or a runtime error if set to a new entity. */\n idIfSet: IdOf<U> | undefined;\n\n idUntagged: string;\n\n idUntaggedIfSet: string | undefined;\n}\n\nexport function hasReactiveReference<T extends Entity, U extends Entity, const H extends ReactiveHint<T>>(\n hint: H,\n fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U>,\n): ReactiveReference<T, U, never>;\nexport function hasReactiveReference<T extends Entity, U extends Entity, const H extends ReactiveHint<T>>(\n hint: H,\n fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U> | undefined,\n): ReactiveReference<T, U, undefined>;\n/** Creates a `ReactiveReference`. */\nexport function hasReactiveReference<\n T extends Entity,\n U extends Entity,\n const H extends ReactiveHint<T>,\n N extends never | undefined,\n>(hint: H, fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U> | N): ReactiveReference<T, U, N> {\n return lazyField((entity: T, fieldName) => {\n const m2o = getMetadata(entity).allFields[fieldName] as ManyToOneField;\n return new ReactiveReferenceImpl<T, U, H, N>(entity, m2o, hint, fn);\n });\n}\n\n/**\n * Implements ReactiveReferences.\n *\n * This is a bit trickier than ReactiveFields, because we have to differentiate our loaded\n * between:\n *\n * - our load hint is loaded, and we can directly calculate the referenced entity, or\n * - we've fetched the calculated/stored entity from the database, but not purposefully\n * not re-calculating it (which would require fetching the load hint, which might be\n * expensive, and defeat the point of having our field materialized in the database)\n *\n * Further, want to support all of:\n *\n * - When loaded & `.get` has been called, we cache the value\n *\n * - If a WIP mutation happens, we invalidate `.get` *but* if we check `.isLoaded`,\n * we can return the live/updated value, without an `await`.\n *\n * - If a WIP mutation happens, we invalidate `.isLoaded`, and if we're *no longer loaded*,\n * we want to keep returning the stale value (as asserted by the tests), but the next\n * `load` / `populate` should load the graph & recalculate the value.\n */\nexport class ReactiveReferenceImpl<\n T extends Entity,\n U extends Entity,\n H extends ReactiveHint<T>,\n N extends never | undefined,\n>\n extends AbstractRelationImpl<T, U>\n implements ReactiveReference<T, U, N>, IsLoadedCachable\n{\n readonly #fieldName: keyof T & string;\n readonly #otherMeta: EntityMetadata;\n #state: RRState<U, N>;\n // #isLoaded doesn't necessary care if we're ref-mode or full-mode, it's just\n // whether a caller can call `.get` and not have it blow up.\n #isLoaded: boolean | undefined = undefined;\n #isCached: boolean = false;\n #loadPromise: Promise<U | N> | undefined;\n\n constructor(\n entity: T,\n field: ManyToOneField,\n public reactiveHint: H,\n private fn: (entity: Reacted<T, H>) => MaybeReactedEntity<U> | N,\n ) {\n super(entity);\n // Minimizing changes until the other PR lands...\n this.#fieldName = field.fieldName as keyof T & string;\n this.#otherMeta = field.otherMetadata();\n this.#state = new RRUnloadedState<U, N>(this);\n // We can be initialized with [entity | id | undefined], and if it's entity or id, then setImpl\n // will set loaded appropriately; but if we're initialized undefined, then mark loaded here\n if (entity.isNewEntity) {\n // const isLoaded = isEntity(this.current()) ? true : undefined;\n }\n // If the property transformer is not enabled, then the RR will not be in the relations map because they are\n // defined in the implementation file and not the codegen file. So we should insert ourselves regardless.\n (getInstanceData(entity).relations ??= {})[field.fieldName] = this;\n }\n\n async load(opts?: { withDeleted?: boolean; forceReload?: true }): Promise<U | N> {\n ensureNotDeleted(this.entity, \"pending\");\n const { loadHint } = this;\n if (!this.isLoaded || opts?.forceReload) {\n const { em } = this.entity;\n // Just because we're not loaded, doesn't mean we necessarily need to load our full hint.\n // We prefer to load only our previously-calculated/materialized value, and only load the\n // full load hint if we need recalculated.\n const maybeDirty = opts?.forceReload || getEmInternalApi(em).rm.isMaybePendingRecalc(this.entity, this.fieldName);\n if (maybeDirty) {\n return (this.#loadPromise ??= em\n .populate(this.entity, { hint: loadHint, ...opts })\n .then(() => {\n this.#state = this.#state.enterRecalcMode(this);\n this.#isLoaded = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n // Go through `this.get` so that `setField` is called to set our latest value\n this.#isCached = false;\n return this.doGet(opts);\n })\n .finally(() => {\n this.#loadPromise = undefined;\n }));\n } else {\n // If we don't need a full recalc, just make sure we have the entity in memory\n // ...ideally we would check `isSet` and whether the key was in the `instanceData`\n const current = this.current();\n if (isEntity(current) || current === undefined) {\n this.#state = new RRRefState<U, N>(this, current as U | N | undefined);\n this.#isLoaded = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n return current as U | N;\n } else {\n return (this.#loadPromise ??= em\n .load(this.#otherMeta.cstr, current)\n .then((loaded) => {\n this.#state = new RRRefState<U, N>(this, loaded);\n this.#isLoaded = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n return loaded;\n })\n .finally(() => {\n this.#loadPromise = undefined;\n }));\n }\n }\n }\n // The ReactiveField.load() always sets `#isCached = false`, but our assertion is that our\n // IsLoadedCache/resetIsLoaded infra is good enough to \"see all invalidating mutations\",\n // so we don't need this explicit reset.\n // this.#isCached = false;\n return this.doGet(opts);\n }\n\n get isLoaded(): boolean {\n // If we've cached an isLoaded value, just use that, see https://github.com/joist-orm/joist-orm/issues/1166\n if (this.#isLoaded !== undefined) return this.#isLoaded;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n // If a WIP mutation has marked our field as potentially dirty, we need to be \"full\" loaded\n const maybeDirty = getEmInternalApi(this.entity.em).rm.isMaybePendingRecalc(this.entity, this.fieldName);\n if (maybeDirty) {\n // If we're dirty, only being \"full\" loaded is good enough to recalc\n this.#state = this.#state.enterRecalcMode(this);\n this.#isLoaded = isLoaded(this.entity, this.loadHint);\n this.#isCached = false;\n } else {\n // If we've had `.load` called before, assume we're still loaded\n this.#isLoaded = this.#state.canReturnValue;\n }\n return this.#isLoaded;\n }\n\n resetIsLoaded(): void {\n this.#isLoaded = undefined;\n this.#isCached = false;\n }\n\n private doGet(opts?: { withDeleted?: boolean }): U | N {\n const { fn } = this;\n ensureNotDeleted(this.entity, \"pending\");\n // Fast pass if we've already calculated this (cache invalidation will happen on\n // any mutation via #resetIsLoaded)..\n if (this.#isCached) {\n return this.filterDeleted(this.#state.doGet() as U | N, opts);\n }\n // Call isLoaded to probe the load hint, and get `#isLoaded` set, but still have\n // our `if` check the raw `#isLoaded` to know if we should eval-latest or return `loaded`.\n if (this.isLoaded && this.#state.kind === \"full\") {\n const newValue = this.filterDeleted(fn(this.entity as any) as any, opts);\n // It's cheap to set this every time we're called, i.e. even if it's not the\n // official \"being called during em.flush\" update (...unless we're accessing it\n // during the validate phase of `em.flush`, then skip it to avoid tripping up\n // the \"cannot change entities during flush\" logic.)\n if (!getEmInternalApi(this.entity.em).isValidating) {\n this.setImpl(newValue);\n }\n this.#state = new RRFullState<U, N>(this, newValue);\n this.#isCached = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n } else if (this.#state.canReturnValue) {\n // We're either in ref mode, or in full mode but not actually fully loaded,\n // but in theory those states only get set after `.load()` / `.preload()` / import,\n // so we should have some stored value, even if it's not fully up-to-date.\n this.#isCached = true;\n getEmInternalApi(this.entity.em).isLoadedCache.add(this);\n } else {\n const noun = this.entity.isNewEntity ? \"derived\" : \"loaded\";\n throw new Error(`${this.entity}.${this.fieldName} has not been ${noun} yet`);\n }\n return this.filterDeleted(this.#state.doGet() as U | N, opts);\n }\n\n get fieldValue(): U | N {\n return getField(this.entity, this.fieldName);\n }\n\n get getWithDeleted(): U | N {\n return this.doGet({ withDeleted: true });\n }\n\n get get(): U | N {\n return this.doGet({ withDeleted: false });\n }\n\n set(_: U | N): void {\n fail(`Cannot set ${this.entity}.${this.fieldName} ReactiveReference directly.`);\n }\n\n get isSet(): boolean {\n return this.current() !== undefined;\n }\n\n // Internal method used by OneToManyCollection\n setImpl(entity: U | N): void {\n ensureNotDeleted(this.entity, \"pending\");\n if (sameEntity(entity, this.current({ withDeleted: true }))) {\n return;\n }\n // Prefer to keep the id in our data hash, but if this is a new entity w/o an id, use the entity itself\n setField(this.entity, this.fieldName, isEntity(entity) ? (entity.idTaggedMaybe ?? entity) : entity);\n }\n\n get isPreloaded(): boolean {\n return !!this.maybeFindEntity();\n }\n\n preload(): void {\n this.#state = new RRRefState<U, N>(this, this.maybeFindEntity());\n this.#isLoaded = true;\n this.#isCached = true;\n }\n\n private unload(): void {\n this.#state = new RRUnloadedState<U, N>(this);\n this.#isLoaded = false;\n this.#isCached = false;\n this.#loadPromise = undefined;\n }\n\n import(other: ReactiveReferenceImpl<T, U, H, N>, findEntity: (e: U) => U): void {\n this.#state = other.#state.import(this, findEntity);\n this.#isLoaded = true;\n this.#isCached = true;\n }\n\n /** Returns the tagged id of the current value. */\n get idTaggedMaybe(): TaggedId | N {\n ensureNotDeleted(this.entity, \"pending\");\n return maybeResolveReferenceToId(this.current()) as TaggedId | N;\n }\n\n get id(): IdOf<U> {\n return this.idMaybe || failNoId(this.entity, this.fieldName, this.current());\n }\n\n get idUntagged(): string {\n return this.idUntaggedMaybe || failNoId(this.entity, this.fieldName, this.current());\n }\n\n get idIfSet(): IdOf<U> | N | undefined {\n return this.idMaybe || failIfNewEntity(this.entity, this.fieldName, this.current());\n }\n\n get idUntaggedIfSet(): string | undefined {\n return this.idUntaggedMaybe || failIfNewEntity(this.entity, this.fieldName, this.current());\n }\n\n get loadHint(): any {\n const meta = getMetadata(this.entity);\n return (meta.config.__data.cachedReactiveLoadHints[this.fieldName] ??= convertToLoadHint(meta, this.reactiveHint));\n }\n\n // private impl\n\n /** Returns the id of the current value. */\n private get idMaybe(): IdOf<U> | undefined {\n ensureNotDeleted(this.entity, \"pending\");\n return toIdOf(this.otherMeta, this.idTaggedMaybe);\n }\n\n private get idUntaggedMaybe(): string | undefined {\n return deTagId(this.otherMeta, this.idMaybe);\n }\n\n setFromOpts(_: U | IdOf<U> | N): void {\n throw new Error(`ReactiveReference ${this.entity}.${this.fieldName} cannot be set via opts`);\n }\n\n maybeCascadeDelete(): void {\n if (this.isCascadeDelete) {\n const current = this.current({ withDeleted: true });\n if (current !== undefined && typeof current !== \"string\") {\n this.entity.em.delete(current as U);\n }\n }\n }\n\n async cleanupOnEntityDeleted(): Promise<void> {\n // if we are going to delete this relation as well, then we don't need to clean it up\n if (this.isCascadeDelete) return;\n setField(this.entity, this.fieldName, undefined);\n this.#state = new RRRefState<U, N>(this, undefined as N);\n this.#isLoaded = false;\n this.#isCached = false;\n this.#loadPromise = undefined;\n }\n\n // We need to keep U in data[fieldName] to handle entities without an id assigned yet.\n current(opts?: { withDeleted?: boolean }): U | string | N {\n const current = getField(this.entity, this.fieldName);\n if (current !== undefined && isEntity(current)) {\n return this.filterDeleted(current as U, opts);\n }\n return current;\n }\n\n get fieldName(): string {\n return this.#fieldName;\n }\n\n public get otherMeta(): EntityMetadata<U> {\n return (getMetadata(this.entity).allFields[this.#fieldName] as ManyToOneField).otherMetadata();\n }\n\n public get hasBeenSet(): boolean {\n return true;\n }\n\n public toString(): string {\n return `ReactiveReference(entity: ${this.entity}, hint: ${this.loadHint}, fieldName: ${this.fieldName}, otherMeta: {\n this.otherMeta.type\n }, id: ${this.id})`;\n }\n\n /**\n * Removes pending-hard-delete (but not soft-deleted), unless explicitly asked for.\n *\n * Note that we leave soft-deleted entities b/c the call signature of a `book.author.get`\n * very likely does not expect a soft-deleted entity to result in `undefined`.\n *\n * (Contrasted with `author.books.get` which is more intuitive to have soft-deleted\n * entities filtered out, i.e. it doesn't fundamentally change the return type.)\n */\n private filterDeleted(entity: U | N, opts?: { withDeleted?: boolean }): U | N {\n if (entity && (!opts || !opts.withDeleted) && entity.isDeletedEntity) {\n return undefined!;\n }\n return entity;\n }\n\n private get isCascadeDelete(): boolean {\n return isCascadeDelete(this, this.#fieldName);\n }\n\n /**\n * Looks for an entity in `EntityManager`, b/c we may have it in memory even if\n * our reference is not specifically loaded.\n */\n maybeFindEntity(): U | N {\n // Check this.loaded first b/c a new entity won't have an id yet\n if (this.#state.canReturnValue) {\n const loaded = this.#state.doGet();\n if (loaded !== undefined) {\n return loaded;\n }\n }\n const { idTaggedMaybe } = this;\n return idTaggedMaybe !== undefined ? (this.entity.em.getEntity(idTaggedMaybe) as U | N) : (undefined as N);\n }\n\n [RelationT]: T = null!;\n [RelationU]: U = null!;\n [ReferenceN]: N = null!;\n}\n\n/** Type guard utility for determining if an entity field is a ReactiveReference. */\nexport function isReactiveReference(maybeReactiveRef: any): maybeReactiveRef is ReactiveReference<any, any, any> {\n return maybeReactiveRef instanceof ReactiveReferenceImpl;\n}\n\ninterface RRState<U extends Entity, N extends never | undefined> {\n readonly kind: \"unloaded\" | \"ref\" | \"full\";\n readonly canReturnValue: boolean;\n doGet(): U | N | undefined;\n /**\n * Switches from \"materialized ref value\" semantics to \"recalc from reactive graph when available\" semantics.\n *\n * This is synchronous because it does not mean the load hint is fully loaded yet. It only means this\n * reference should now behave as recalc-capable: if `isLoaded(loadHint)` later reports true, `doGet`\n * will recalculate from `fn(...)`; otherwise we keep returning the last known/stale value until `load()`\n * populates the graph.\n */\n enterRecalcMode(target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N>;\n import(target: ReactiveReferenceImpl<any, any, any, any>, findEntity: (e: U) => U): RRState<U, N>;\n}\n\nclass RRUnloadedState<U extends Entity, N extends never | undefined> implements RRState<U, N> {\n readonly kind = \"unloaded\";\n readonly canReturnValue = false;\n #rr: ReactiveReferenceImpl<any, any, any, any>;\n\n constructor(rr: ReactiveReferenceImpl<any, any, any, any>) {\n this.#rr = rr;\n }\n\n doGet(): U | N | undefined {\n throw new Error(`${this.#rr.entity}.${this.#rr.fieldName} was not loaded`);\n }\n\n enterRecalcMode(target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N> {\n return new RRFullState<U, N>(target, undefined);\n }\n\n import(target: ReactiveReferenceImpl<any, any, any, any>, _findEntity: (e: U) => U): RRState<U, N> {\n return new RRUnloadedState<U, N>(target);\n }\n}\n\nclass RRRefState<U extends Entity, N extends never | undefined> implements RRState<U, N> {\n readonly kind = \"ref\";\n readonly canReturnValue = true;\n #loaded: U | N | undefined;\n\n constructor(_rr: ReactiveReferenceImpl<any, any, any, any>, loaded: U | N | undefined) {\n this.#loaded = loaded;\n }\n\n doGet(): U | N | undefined {\n return this.#loaded;\n }\n\n enterRecalcMode(target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N> {\n return new RRFullState<U, N>(target, this.#loaded);\n }\n\n import(target: ReactiveReferenceImpl<any, any, any, any>, findEntity: (e: U) => U): RRState<U, N> {\n return new RRRefState<U, N>(target, mapReactiveReferenceEntity(this.#loaded, findEntity));\n }\n}\n\nclass RRFullState<U extends Entity, N extends never | undefined> implements RRState<U, N> {\n readonly kind = \"full\";\n readonly canReturnValue = true;\n #loaded: U | N | undefined;\n\n constructor(_rr: ReactiveReferenceImpl<any, any, any, any>, loaded: U | N | undefined) {\n this.#loaded = loaded;\n }\n\n doGet(): U | N | undefined {\n return this.#loaded;\n }\n\n enterRecalcMode(_target: ReactiveReferenceImpl<any, any, any, any>): RRFullState<U, N> {\n return this;\n }\n\n import(target: ReactiveReferenceImpl<any, any, any, any>, findEntity: (e: U) => U): RRState<U, N> {\n return new RRRefState<U, N>(target, mapReactiveReferenceEntity(this.#loaded, findEntity));\n }\n}\n\nfunction mapReactiveReferenceEntity<U extends Entity, N extends never | undefined>(\n entity: U | N | undefined,\n findEntity: (e: U) => U,\n): U | N | undefined {\n return isEntity(entity) ? findEntity(entity) : entity;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoEA,SAAgB,qBAKd,MAAS,IAAsF;CAC/F,OAAO,WAAW,QAAW,cAAc;EACzC,MAAM,MAAM,YAAY,MAAM,CAAC,CAAC,UAAU;EAC1C,OAAO,IAAI,sBAAkC,QAAQ,KAAK,MAAM,EAAE;CACpE,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAa,wBAAb,cAMU,qBAEV;CAaW;CACC;CAbV;CACA;CACA;CAGA,YAAiC,KAAA;CACjC,YAAqB;CACrB;CAEA,YACE,QACA,OACA,cACA,IACA;EACA,MAAM,MAAM;EAHL,KAAA,eAAA;EACC,KAAA,KAAA;EAIR,KAAKA,aAAa,MAAM;EACxB,KAAKC,aAAa,MAAM,cAAc;EACtC,KAAKC,SAAS,IAAI,gBAAsB,IAAI;EAG5C,IAAI,OAAO,aAAa,CAExB;EAGA,CAAC,gBAAgB,MAAM,CAAC,CAAC,cAAc,CAAC,EAAA,CAAG,MAAM,aAAa;CAChE;CAEA,MAAM,KAAK,MAAsE;EAC/E,iBAAiB,KAAK,QAAQ,SAAS;EACvC,MAAM,EAAE,aAAa;EACrB,IAAI,CAAC,KAAK,YAAY,MAAM,aAAa;GACvC,MAAM,EAAE,OAAO,KAAK;GAKpB,IADmB,MAAM,eAAe,iBAAiB,EAAE,CAAC,CAAC,GAAG,qBAAqB,KAAK,QAAQ,KAAK,SAAS,GAE9G,OAAQ,KAAKC,iBAAiB,GAC3B,SAAS,KAAK,QAAQ;IAAE,MAAM;IAAU,GAA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AC1F;AACF;AAEA,IAAM,cAAN,MAA0F;CACxF,OAAgB;CAChB,iBAA0B;CAC1B;CAEA,YAAY,KAAgD,QAA2B;EACrF,KAAKA,UAAU;CACjB;CAEA,QAA2B;EACzB,OAAO,KAAKA;CACd;CAEA,gBAAgB,SAAuE;EACrF,OAAO;CACT;CAEA,OAAO,QAAmD,YAAwC;EAChG,OAAO,IAAI,WAAiB,QAAQ,2BAA2B,KAAKA,SAAS,UAAU,CAAC;CAC1F;AACF;AAEA,SAAS,2BACP,QACA,YACmB;CACnB,OAAO,SAAS,MAAM,IAAI,WAAW,MAAM,IAAI;AACjD"}
@@ -1,18 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_relations_Collection = require("./Collection.cjs");
3
- const require_newEntity = require("../newEntity.cjs");
4
3
  const require_relations_AbstractRelationImpl = require("./AbstractRelationImpl.cjs");
5
4
  const require_relations_RelationSymbols = require("./RelationSymbols.cjs");
6
5
  const require_relations_RecursiveCycleError = require("./RecursiveCycleError.cjs");
7
- const require_relations_Reference = require("./Reference.cjs");
8
6
  require("../IsLoadedCache.cjs");
7
+ const require_relations_Reference = require("./Reference.cjs");
9
8
  const require_relations_OneToOneReference = require("./OneToOneReference.cjs");
10
9
  const require_batchloaders_recursiveChildrenBatchLoader = require("../batchloaders/recursiveChildrenBatchLoader.cjs");
11
10
  const require_batchloaders_recursiveM2mBatchLoader = require("../batchloaders/recursiveM2mBatchLoader.cjs");
12
11
  const require_batchloaders_recursiveParentsBatchLoader = require("../batchloaders/recursiveParentsBatchLoader.cjs");
13
12
  require("./ReadOnlyCollection.cjs");
14
- const require_EntityMetadata = require("../EntityMetadata.cjs");
15
13
  const require_utils = require("../utils.cjs");
14
+ const require_newEntity = require("../newEntity.cjs");
15
+ const require_EntityMetadata = require("../EntityMetadata.cjs");
16
16
  const require_index = require("../index.cjs");
17
17
  const require_EntityManager = require("../EntityManager.cjs");
18
18
  //#region src/relations/RecursiveCollection.ts
@@ -1,17 +1,17 @@
1
1
  import { isCollection, isLoadedCollection } from "./Collection.js";
2
- import { lazyField } from "../newEntity.js";
3
2
  import { AbstractRelationImpl } from "./AbstractRelationImpl.js";
4
3
  import { RelationT, RelationU } from "./RelationSymbols.js";
5
4
  import { RecursiveCycleError } from "./RecursiveCycleError.js";
6
- import { isLoadedReference, isReference } from "./Reference.js";
7
5
  import "../IsLoadedCache.js";
6
+ import { isLoadedReference, isReference } from "./Reference.js";
8
7
  import { isLoadedOneToOneReference, isOneToOneReference } from "./OneToOneReference.js";
9
8
  import { recursiveChildrenBatchLoader } from "../batchloaders/recursiveChildrenBatchLoader.js";
10
9
  import { recursiveM2mBatchLoader } from "../batchloaders/recursiveM2mBatchLoader.js";
11
10
  import { recursiveParentsBatchLoader } from "../batchloaders/recursiveParentsBatchLoader.js";
12
11
  import "./ReadOnlyCollection.js";
13
- import { getMetadata } from "../EntityMetadata.js";
14
12
  import { fail } from "../utils.js";
13
+ import { lazyField } from "../newEntity.js";
14
+ import { getMetadata } from "../EntityMetadata.js";
15
15
  import { ensureNotDeleted } from "../index.js";
16
16
  import { appendStack, getEmInternalApi } from "../EntityManager.js";
17
17
  //#region src/relations/RecursiveCollection.ts
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_relations_ReferenceSymbols = require("./ReferenceSymbols.cjs");
3
- const require_relations_CustomReference = require("./CustomReference.cjs");
4
3
  const require_relations_ManyToOneReference = require("./ManyToOneReference.cjs");
5
4
  const require_relations_ReactiveReference = require("./ReactiveReference.cjs");
6
5
  const require_relations_OneToOneReference = require("./OneToOneReference.cjs");
6
+ const require_relations_CustomReference = require("./CustomReference.cjs");
7
7
  const require_relations_PolymorphicReference = require("./PolymorphicReference.cjs");
8
8
  require("./index.cjs");
9
9
  require("../EntityManager.cjs");
@@ -1,8 +1,8 @@
1
1
  import { ReferenceN } from "./ReferenceSymbols.js";
2
- import { CustomReference } from "./CustomReference.js";
3
2
  import { ManyToOneReferenceImpl } from "./ManyToOneReference.js";
4
3
  import { ReactiveReferenceImpl } from "./ReactiveReference.js";
5
4
  import { OneToOneReferenceImpl } from "./OneToOneReference.js";
5
+ import { CustomReference } from "./CustomReference.js";
6
6
  import { PolymorphicReferenceImpl } from "./PolymorphicReference.js";
7
7
  import "./index.js";
8
8
  import "../EntityManager.js";
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_newEntity = require("../newEntity.cjs");
3
2
  const require_loadHints = require("../loadHints.cjs");
3
+ const require_newEntity = require("../newEntity.cjs");
4
4
  require("../Entity.cjs");
5
5
  //#region src/relations/hasAsyncMethod.ts
6
6
  const AsyncMethodM = Symbol();
@@ -1,5 +1,5 @@
1
- import { lazyField } from "../newEntity.js";
2
1
  import { isLoaded } from "../loadHints.js";
2
+ import { lazyField } from "../newEntity.js";
3
3
  import "../Entity.js";
4
4
  //#region src/relations/hasAsyncMethod.ts
5
5
  const AsyncMethodM = Symbol();
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_loadHints = require("../loadHints.cjs");
2
3
  const require_newEntity = require("../newEntity.cjs");
3
4
  const require_relations_CustomCollection = require("./CustomCollection.cjs");
4
- const require_loadHints = require("../loadHints.cjs");
5
5
  require("../index.cjs");
6
6
  require("../Entity.cjs");
7
7
  //#region src/relations/hasManyDerived.ts
@@ -1,6 +1,6 @@
1
+ import { isLoaded } from "../loadHints.js";
1
2
  import { lazyField } from "../newEntity.js";
2
3
  import { CustomCollection } from "./CustomCollection.js";
3
- import { isLoaded } from "../loadHints.js";
4
4
  import "../index.js";
5
5
  import "../Entity.js";
6
6
  //#region src/relations/hasManyDerived.ts
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_newEntity = require("../newEntity.cjs");
3
- const require_relations_CustomReference = require("./CustomReference.cjs");
4
2
  require("./Reference.cjs");
5
3
  const require_loadHints = require("../loadHints.cjs");
4
+ const require_newEntity = require("../newEntity.cjs");
5
+ const require_relations_CustomReference = require("./CustomReference.cjs");
6
6
  require("../index.cjs");
7
7
  require("../Entity.cjs");
8
8
  //#region src/relations/hasOneDerived.ts
@@ -1,7 +1,7 @@
1
- import { lazyField } from "../newEntity.js";
2
- import { CustomReference } from "./CustomReference.js";
3
1
  import "./Reference.js";
4
2
  import { isLoaded } from "../loadHints.js";
3
+ import { lazyField } from "../newEntity.js";
4
+ import { CustomReference } from "./CustomReference.js";
5
5
  import "../index.js";
6
6
  import "../Entity.js";
7
7
  //#region src/relations/hasOneDerived.ts
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_newEntity = require("../newEntity.cjs");
3
2
  const require_relations_PropertySymbols = require("./PropertySymbols.cjs");
4
3
  const require_relations_RecursiveCycleError = require("./RecursiveCycleError.cjs");
5
- const require_EntityMetadata = require("../EntityMetadata.cjs");
6
4
  const require_reactiveHints = require("../reactiveHints.cjs");
7
5
  const require_loadHints = require("../loadHints.cjs");
8
6
  const require_utils = require("../utils.cjs");
7
+ const require_newEntity = require("../newEntity.cjs");
8
+ const require_EntityMetadata = require("../EntityMetadata.cjs");
9
9
  require("../Entity.cjs");
10
10
  //#region src/relations/hasProperty.ts
11
11
  /**
@@ -1,10 +1,10 @@
1
- import { lazyField } from "../newEntity.js";
2
1
  import { PropertyT } from "./PropertySymbols.js";
3
2
  import { RecursiveCycleError } from "./RecursiveCycleError.js";
4
- import { getMetadata } from "../EntityMetadata.js";
5
3
  import { convertToLoadHint } from "../reactiveHints.js";
6
4
  import { isLoaded } from "../loadHints.js";
7
5
  import { tryResolve } from "../utils.js";
6
+ import { lazyField } from "../newEntity.js";
7
+ import { getMetadata } from "../EntityMetadata.js";
8
8
  import "../Entity.js";
9
9
  //#region src/relations/hasProperty.ts
10
10
  /**
@@ -1,34 +1,34 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_relations_Collection = require("./Collection.cjs");
3
- const require_relations_CustomCollection = require("./CustomCollection.cjs");
4
3
  const require_relations_EnumCollection = require("./EnumCollection.cjs");
5
- const require_relations_CustomReference = require("./CustomReference.cjs");
6
- const require_relations_hasAsyncMethod = require("./hasAsyncMethod.cjs");
7
4
  const require_relations_RecursiveCycleError = require("./RecursiveCycleError.cjs");
8
5
  const require_relations_hasProperty = require("./hasProperty.cjs");
9
- const require_relations_AsyncProperty = require("./AsyncProperty.cjs");
10
6
  const require_relations_LazyField = require("./LazyField.cjs");
7
+ const require_relations_OneToManyCollection = require("./OneToManyCollection.cjs");
8
+ const require_relations_ManyToOneReference = require("./ManyToOneReference.cjs");
9
+ const require_relations_Reference = require("./Reference.cjs");
10
+ const require_relations_ReactiveReference = require("./ReactiveReference.cjs");
11
+ const require_relations_OneToOneReference = require("./OneToOneReference.cjs");
12
+ const require_relations_ReactiveGetter = require("./ReactiveGetter.cjs");
13
+ const require_relations_Relation = require("./Relation.cjs");
14
+ const require_relations_ReadOnlyCollection = require("./ReadOnlyCollection.cjs");
15
+ const require_relations_RecursiveCollection = require("./RecursiveCollection.cjs");
16
+ const require_relations_CustomCollection = require("./CustomCollection.cjs");
17
+ const require_relations_CustomReference = require("./CustomReference.cjs");
18
+ const require_relations_hasAsyncMethod = require("./hasAsyncMethod.cjs");
19
+ const require_relations_AsyncProperty = require("./AsyncProperty.cjs");
11
20
  const require_relations_hasManyDerived = require("./hasManyDerived.cjs");
12
21
  const require_relations_hasManyThrough = require("./hasManyThrough.cjs");
13
- const require_relations_Reference = require("./Reference.cjs");
14
22
  const require_relations_hasOneDerived = require("./hasOneDerived.cjs");
15
23
  const require_relations_hasOneThrough = require("./hasOneThrough.cjs");
16
24
  const require_relations_ManyToManyCollection = require("./ManyToManyCollection.cjs");
17
- const require_relations_Relation = require("./Relation.cjs");
18
25
  const require_relations_ManyToManyLargeCollection = require("./ManyToManyLargeCollection.cjs");
19
- const require_relations_OneToManyCollection = require("./OneToManyCollection.cjs");
20
- const require_relations_ManyToOneReference = require("./ManyToOneReference.cjs");
21
26
  const require_relations_OneToManyLargeCollection = require("./OneToManyLargeCollection.cjs");
22
- const require_relations_ReactiveReference = require("./ReactiveReference.cjs");
23
- const require_relations_OneToOneReference = require("./OneToOneReference.cjs");
24
27
  const require_relations_PolymorphicReference = require("./PolymorphicReference.cjs");
25
28
  const require_relations_ReactiveField = require("./ReactiveField.cjs");
26
- const require_relations_ReactiveGetter = require("./ReactiveGetter.cjs");
27
29
  const require_relations_ReactiveManyToMany = require("./ReactiveManyToMany.cjs");
28
30
  const require_relations_ReactiveManyToManyOtherSide = require("./ReactiveManyToManyOtherSide.cjs");
29
31
  const require_relations_AsyncReactiveField = require("./AsyncReactiveField.cjs");
30
- const require_relations_RecursiveCollection = require("./RecursiveCollection.cjs");
31
- const require_relations_ReadOnlyCollection = require("./ReadOnlyCollection.cjs");
32
32
  exports.AsyncPropertyImpl = require_relations_AsyncProperty.AsyncPropertyImpl;
33
33
  exports.CustomCollection = require_relations_CustomCollection.CustomCollection;
34
34
  exports.CustomReference = require_relations_CustomReference.CustomReference;
@@ -1,31 +1,31 @@
1
1
  import { isCollection, isLoadedCollection } from "./Collection.js";
2
- import { CustomCollection, hasCustomCollection } from "./CustomCollection.js";
3
2
  import { EnumCollectionImpl, hasEnumCollection } from "./EnumCollection.js";
4
- import { CustomReference, hasCustomReference } from "./CustomReference.js";
5
- import { hasAsyncMethod } from "./hasAsyncMethod.js";
6
3
  import { RecursiveCycleError } from "./RecursiveCycleError.js";
7
4
  import { PropertyImpl, hasProperty, hasReactiveProperty, isLoadedProperty, isProperty } from "./hasProperty.js";
8
- import { AsyncPropertyImpl, hasAsyncProperty, isAsyncProperty, isLoadedAsyncProperty } from "./AsyncProperty.js";
9
5
  import { LazyFieldImpl, hasLazyField, isLazyField, isLoadedLazyField } from "./LazyField.js";
6
+ import { OneToManyCollection, hasMany } from "./OneToManyCollection.js";
7
+ import { ManyToOneReferenceImpl, hasOne, isManyToOneReference } from "./ManyToOneReference.js";
8
+ import { isLoadedReference, isReference } from "./Reference.js";
9
+ import { ReactiveReferenceImpl, hasReactiveReference, isReactiveReference } from "./ReactiveReference.js";
10
+ import { OneToOneReferenceImpl, hasOneToOne, isLoadedOneToOneReference, isOneToOneReference } from "./OneToOneReference.js";
11
+ import { hasReactiveGetter, isReactiveGetter } from "./ReactiveGetter.js";
12
+ import { isRelation } from "./Relation.js";
13
+ import { isLoadedReadOnlyCollection, isReadOnlyCollection } from "./ReadOnlyCollection.js";
14
+ import { hasRecursiveChildren, hasRecursiveM2m, hasRecursiveParents } from "./RecursiveCollection.js";
15
+ import { CustomCollection, hasCustomCollection } from "./CustomCollection.js";
16
+ import { CustomReference, hasCustomReference } from "./CustomReference.js";
17
+ import { hasAsyncMethod } from "./hasAsyncMethod.js";
18
+ import { AsyncPropertyImpl, hasAsyncProperty, isAsyncProperty, isLoadedAsyncProperty } from "./AsyncProperty.js";
10
19
  import { hasManyDerived } from "./hasManyDerived.js";
11
20
  import { hasManyThrough } from "./hasManyThrough.js";
12
- import { isLoadedReference, isReference } from "./Reference.js";
13
21
  import { hasOneDerived } from "./hasOneDerived.js";
14
22
  import { hasOneThrough } from "./hasOneThrough.js";
15
23
  import { ManyToManyCollection, hasManyToMany } from "./ManyToManyCollection.js";
16
- import { isRelation } from "./Relation.js";
17
24
  import { ManyToManyLargeCollection, hasLargeManyToMany } from "./ManyToManyLargeCollection.js";
18
- import { OneToManyCollection, hasMany } from "./OneToManyCollection.js";
19
- import { ManyToOneReferenceImpl, hasOne, isManyToOneReference } from "./ManyToOneReference.js";
20
25
  import { OneToManyLargeCollection, hasLargeMany } from "./OneToManyLargeCollection.js";
21
- import { ReactiveReferenceImpl, hasReactiveReference, isReactiveReference } from "./ReactiveReference.js";
22
- import { OneToOneReferenceImpl, hasOneToOne, isLoadedOneToOneReference, isOneToOneReference } from "./OneToOneReference.js";
23
26
  import { PolymorphicReferenceImpl, hasOnePolymorphic, isPolymorphicReference } from "./PolymorphicReference.js";
24
27
  import { hasReactiveField, isReactiveField } from "./ReactiveField.js";
25
- import { hasReactiveGetter, isReactiveGetter } from "./ReactiveGetter.js";
26
28
  import { ReactiveManyToManyImpl, hasReactiveManyToMany, isReactiveManyToMany } from "./ReactiveManyToMany.js";
27
29
  import { ReactiveManyToManyOtherSideImpl, hasReactiveManyToManyOtherSide, isReactiveManyToManyOtherSide } from "./ReactiveManyToManyOtherSide.js";
28
30
  import { hasAsyncReactiveField, isAsyncReactiveField } from "./AsyncReactiveField.js";
29
- import { hasRecursiveChildren, hasRecursiveM2m, hasRecursiveParents } from "./RecursiveCollection.js";
30
- import { isLoadedReadOnlyCollection, isReadOnlyCollection } from "./ReadOnlyCollection.js";
31
31
  export { AsyncPropertyImpl, CustomCollection, CustomReference, EnumCollectionImpl, LazyFieldImpl, ManyToManyCollection, ManyToManyLargeCollection, ManyToOneReferenceImpl, OneToManyCollection, OneToManyLargeCollection, OneToOneReferenceImpl, PolymorphicReferenceImpl, PropertyImpl, ReactiveManyToManyImpl, ReactiveManyToManyOtherSideImpl, ReactiveReferenceImpl, RecursiveCycleError, hasAsyncMethod, hasAsyncProperty, hasAsyncReactiveField, hasCustomCollection, hasCustomReference, hasEnumCollection, hasLargeMany, hasLargeManyToMany, hasLazyField, hasMany, hasManyDerived, hasManyThrough, hasManyToMany, hasOne, hasOneDerived, hasOnePolymorphic, hasOneThrough, hasOneToOne, hasProperty, hasReactiveField, hasReactiveGetter, hasReactiveManyToMany, hasReactiveManyToManyOtherSide, hasReactiveProperty, hasReactiveReference, hasRecursiveChildren, hasRecursiveM2m, hasRecursiveParents, isAsyncProperty, isAsyncReactiveField, isCollection, isLazyField, isLoadedAsyncProperty, isLoadedCollection, isLoadedLazyField, isLoadedOneToOneReference, isLoadedProperty, isLoadedReadOnlyCollection, isLoadedReference, isManyToOneReference, isOneToOneReference, isPolymorphicReference, isProperty, isReactiveField, isReactiveGetter, isReactiveManyToMany, isReactiveManyToManyOtherSide, isReactiveReference, isReadOnlyCollection, isReference, isRelation };
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_EntityMetadata = require("../EntityMetadata.cjs");
3
+ //#region src/relations/isCascadeDelete.ts
4
+ /** Returns whether this relation is configured for cascade deletion on the entity or a base type. */
5
+ function isCascadeDelete(relation, fieldName) {
6
+ return require_EntityMetadata.getBaseAndSelfMetas(require_EntityMetadata.getMetadata(relation.entity)).some((meta) => meta.config.__data.cascadeDeleteFields.includes(fieldName));
7
+ }
8
+ //#endregion
9
+ exports.isCascadeDelete = isCascadeDelete;
10
+
11
+ //# sourceMappingURL=isCascadeDelete.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCascadeDelete.cjs","names":["getBaseAndSelfMetas","getMetadata"],"sources":["../../src/relations/isCascadeDelete.ts"],"sourcesContent":["import { getBaseAndSelfMetas, getMetadata } from \"../EntityMetadata.ts\";\nimport type { AbstractRelationImpl } from \"./AbstractRelationImpl.ts\";\n\n// Keep metadata imports out of AbstractRelationImpl so query imports cannot evaluate a relation\n// subclass before its base class has initialized.\n/** Returns whether this relation is configured for cascade deletion on the entity or a base type. */\nexport function isCascadeDelete(relation: AbstractRelationImpl<any, any>, fieldName: string): boolean {\n return getBaseAndSelfMetas(getMetadata(relation.entity)).some((meta) =>\n meta.config.__data.cascadeDeleteFields.includes(fieldName as any),\n );\n}\n"],"mappings":";;;;AAMA,SAAgB,gBAAgB,UAA0C,WAA4B;CACpG,OAAOA,uBAAAA,oBAAoBC,uBAAAA,YAAY,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,SAC7D,KAAK,OAAO,OAAO,oBAAoB,SAAS,SAAgB,CAClE;AACF"}
@@ -0,0 +1,7 @@
1
+ import { AbstractRelationImpl } from "./AbstractRelationImpl.cjs";
2
+ //#region src/relations/isCascadeDelete.d.ts
3
+ /** Returns whether this relation is configured for cascade deletion on the entity or a base type. */
4
+ declare function isCascadeDelete(relation: AbstractRelationImpl<any, any>, fieldName: string): boolean;
5
+ //#endregion
6
+ export { isCascadeDelete };
7
+ //# sourceMappingURL=isCascadeDelete.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCascadeDelete.d.cts","names":[],"sources":["../../src/relations/isCascadeDelete.ts"],"mappings":";;;iBAMgB,gBAAgB,UAAU,gCAAgC"}
@@ -0,0 +1,7 @@
1
+ import { AbstractRelationImpl } from "./AbstractRelationImpl.mjs";
2
+ //#region src/relations/isCascadeDelete.d.ts
3
+ /** Returns whether this relation is configured for cascade deletion on the entity or a base type. */
4
+ declare function isCascadeDelete(relation: AbstractRelationImpl<any, any>, fieldName: string): boolean;
5
+ //#endregion
6
+ export { isCascadeDelete };
7
+ //# sourceMappingURL=isCascadeDelete.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCascadeDelete.d.mts","names":[],"sources":["../../src/relations/isCascadeDelete.ts"],"mappings":";;;iBAMgB,gBAAgB,UAAU,gCAAgC"}
@@ -0,0 +1,10 @@
1
+ import { getBaseAndSelfMetas, getMetadata } from "../EntityMetadata.js";
2
+ //#region src/relations/isCascadeDelete.ts
3
+ /** Returns whether this relation is configured for cascade deletion on the entity or a base type. */
4
+ function isCascadeDelete(relation, fieldName) {
5
+ return getBaseAndSelfMetas(getMetadata(relation.entity)).some((meta) => meta.config.__data.cascadeDeleteFields.includes(fieldName));
6
+ }
7
+ //#endregion
8
+ export { isCascadeDelete };
9
+
10
+ //# sourceMappingURL=isCascadeDelete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCascadeDelete.js","names":[],"sources":["../../src/relations/isCascadeDelete.ts"],"sourcesContent":["import { getBaseAndSelfMetas, getMetadata } from \"../EntityMetadata.ts\";\nimport type { AbstractRelationImpl } from \"./AbstractRelationImpl.ts\";\n\n// Keep metadata imports out of AbstractRelationImpl so query imports cannot evaluate a relation\n// subclass before its base class has initialized.\n/** Returns whether this relation is configured for cascade deletion on the entity or a base type. */\nexport function isCascadeDelete(relation: AbstractRelationImpl<any, any>, fieldName: string): boolean {\n return getBaseAndSelfMetas(getMetadata(relation.entity)).some((meta) =>\n meta.config.__data.cascadeDeleteFields.includes(fieldName as any),\n );\n}\n"],"mappings":";;;AAMA,SAAgB,gBAAgB,UAA0C,WAA4B;CACpG,OAAO,oBAAoB,YAAY,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,SAC7D,KAAK,OAAO,OAAO,oBAAoB,SAAS,SAAgB,CAClE;AACF"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_EntityMetadata = require("./EntityMetadata.cjs");
3
2
  const require_fields = require("./fields.cjs");
3
+ const require_EntityMetadata = require("./EntityMetadata.cjs");
4
4
  const require_EntityManager = require("./EntityManager.cjs");
5
5
  const require_Entity = require("./Entity.cjs");
6
6
  //#region src/resurrection.ts
@@ -1,5 +1,5 @@
1
- import { getBaseMeta, getMetadata } from "./EntityMetadata.js";
2
1
  import { setField } from "./fields.js";
2
+ import { getBaseMeta, getMetadata } from "./EntityMetadata.js";
3
3
  import { TooManyError } from "./EntityManager.js";
4
4
  import { isEntity } from "./Entity.js";
5
5
  //#region src/resurrection.ts
package/build/rules.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./typeMap.cjs");
3
- const require_relations_Reference = require("./relations/Reference.cjs");
4
- const require_relations_AsyncReactiveField = require("./relations/AsyncReactiveField.cjs");
5
- require("./relations/index.cjs");
6
2
  const require_fields = require("./fields.cjs");
3
+ require("./typeMap.cjs");
7
4
  require("./changes.cjs");
5
+ const require_relations_Reference = require("./relations/Reference.cjs");
8
6
  require("./reactiveHints.cjs");
9
7
  const require_utils = require("./utils.cjs");
8
+ const require_relations_AsyncReactiveField = require("./relations/AsyncReactiveField.cjs");
9
+ require("./relations/index.cjs");
10
10
  const require_EntityManager = require("./EntityManager.cjs");
11
11
  require("./Entity.cjs");
12
12
  //#region src/rules.ts
package/build/rules.js CHANGED
@@ -1,11 +1,11 @@
1
- import "./typeMap.js";
2
- import { isLoadedReference } from "./relations/Reference.js";
3
- import { isAsyncReactiveField } from "./relations/AsyncReactiveField.js";
4
- import "./relations/index.js";
5
1
  import { getField } from "./fields.js";
2
+ import "./typeMap.js";
6
3
  import "./changes.js";
4
+ import { isLoadedReference } from "./relations/Reference.js";
7
5
  import "./reactiveHints.js";
8
6
  import { groupBy, maybePromiseThen } from "./utils.js";
7
+ import { isAsyncReactiveField } from "./relations/AsyncReactiveField.js";
8
+ import "./relations/index.js";
9
9
  import { getEmInternalApi } from "./EntityManager.js";
10
10
  import "./Entity.js";
11
11
  //#region src/rules.ts
package/build/serde.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_keys = require("./keys.cjs");
3
2
  const require_temporal = require("./temporal.cjs");
4
3
  const require_TypeInfo = require("./TypeInfo.cjs");
4
+ const require_keys = require("./keys.cjs");
5
5
  const require_runtimeConfig = require("./runtimeConfig.cjs");
6
6
  const require_temporalMappers = require("./temporalMappers.cjs");
7
7
  require("./index.cjs");
package/build/serde.js CHANGED
@@ -1,6 +1,6 @@
1
- import { keyToNumber, keyToTaggedId, maybeResolveReferenceToId } from "./keys.js";
2
1
  import { requireTemporal } from "./temporal.js";
3
2
  import { arrayOutputType, canonicalDbType } from "./TypeInfo.js";
3
+ import { keyToNumber, keyToTaggedId, maybeResolveReferenceToId } from "./keys.js";
4
4
  import { getRuntimeConfig } from "./runtimeConfig.js";
5
5
  import { plainDateMapper, plainDateTimeMapper, plainTimeMapper, zonedDateTimeMapper } from "./temporalMappers.js";
6
6
  import "./index.js";
package/build/unnest.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./drivers/EntityWriter.cjs");
3
- require("./QueryParser.cjs");
4
3
  //#region src/unnest.ts
5
4
  /**
6
5
  * Creates a CTE named `alias` that bulk-injects the `columnValues` into a SQL query.
@@ -1 +1 @@
1
- {"version":3,"file":"unnest.cjs","names":[],"sources":["../src/unnest.ts"],"sourcesContent":["import { type OpColumn } from \"./drivers/EntityWriter.ts\";\nimport { type ParsedCteClause } from \"./QueryParser.ts\";\n\n/**\n * Creates a CTE named `alias` that bulk-injects the `columnValues` into a SQL query.\n *\n * I.e. `columns = [first_name, last_name]` means columnValues would be all first names,\n * then all last names, i.e.`[[\"f1\",\"f2\"], [\"l1\",\"l2\"]]`.\n *\n * Note that `columnValues` will be mutated if any array columns need to be made rectangular.\n */\nexport function buildUnnestCte(alias: string, columns: OpColumn[], columnValues: any[][]): ParsedCteClause {\n // Make any arrays-of-arrays rectangular by filling them with nulls\n ensureRectangularArraySizes(columns, columnValues);\n // Use unnest or unnest_arrays depending on whether the column is an array column\n const selects = columns.map((c) => {\n if (c.dbType.endsWith(\"[]\")) {\n if (c.isNullableArray) {\n return `unnest_arrays(?::${c.dbType}[], true)`;\n } else {\n return `unnest_arrays(?::${c.dbType}[])`;\n }\n } else {\n return `unnest(?::${c.dbType}[])`;\n }\n });\n return {\n alias,\n columns,\n query: { kind: \"raw\", sql: `SELECT ${selects.join(\", \")}`, bindings: columnValues },\n };\n}\n\nexport function ensureRectangularArraySizes(columns: OpColumn[], columnValues: any[][]): void {\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i];\n if (column.dbType.endsWith(\"[]\")) {\n const values = columnValues[i];\n const fillTo = findArrayMaxSize(values);\n for (let j = 0; j < values.length; j++) {\n values[j] = fillArrayWithNulls(column, values[j], fillTo);\n }\n }\n }\n}\n\nfunction findArrayMaxSize(columnValues: readonly any[][]): number {\n let max = 1; // postgres really doesn't like `{{}}` so always send at least 1 element\n for (let i = 0; i < columnValues.length; i++) max = Math.max(max, columnValues[i]?.length ?? 0);\n return max;\n}\n\n// Because postgres array-of-arrays must be rectangular, we fill all arrays up the same max size\n// to put on the wire, and then later strip the padded nulls during the unnest_arrays call.\nfunction fillArrayWithNulls(c: OpColumn, array: any[] | null, maxSize: number): any[] {\n const wasNull = array === null;\n const result = array ? [...array] : [];\n const nullsToAdd = Math.max(0, maxSize - (array?.length ?? 0));\n for (let i = 0; i < nullsToAdd; i++) result.push(null);\n // Add our unset marker\n if (c.isNullableArray) result.unshift(wasNull ? null : notNullMarker(c));\n return result;\n}\n\nfunction notNullMarker(c: OpColumn): any {\n // Should probably push this into an OpColumn.notNullMarker value\n if (c.dbType.startsWith(\"varchar\") || c.dbType.startsWith(\"character\") || c.dbType.startsWith(\"text\")) {\n return \"\";\n } else if (c.dbType.startsWith(\"int\")) {\n return 1;\n } else if (c.dbType.startsWith(\"date\")) {\n return new Date(); // maybe something temporal?\n } else if (c.dbType.startsWith(\"timestamp\")) {\n return new Date(); // maybe something temporal?\n } else {\n throw new Error(\"Unhandled nullable array column type \" + c.dbType);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,eAAe,OAAe,SAAqB,cAAwC;CAEzG,4BAA4B,SAAS,YAAY;CAajD,OAAO;EACL;EACA;EACA,OAAO;GAAE,MAAM;GAAO,KAAK,UAdb,QAAQ,KAAK,MAAM;IACjC,IAAI,EAAE,OAAO,SAAS,IAAI,GAAG;KAC3B,IAAI,EAAE,iBACJ,OAAO,oBAAoB,EAAE,OAAO;UAEpC,OAAO,oBAAoB,EAAE,OAAO;IAExC,OACE,OAAO,aAAa,EAAE,OAAO;GAEjC,CAI6C,CAAC,CAAC,KAAK,IAAI;GAAK,UAAU;EAAa;CACpF;AACF;AAEA,SAAgB,4BAA4B,SAAqB,cAA6B;CAC5F,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,SAAS,QAAQ;EACvB,IAAI,OAAO,OAAO,SAAS,IAAI,GAAG;GAChC,MAAM,SAAS,aAAa;GAC5B,MAAM,SAAS,iBAAiB,MAAM;GACtC,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KACjC,OAAO,KAAK,mBAAmB,QAAQ,OAAO,IAAI,MAAM;EAE5D;CACF;AACF;AAEA,SAAS,iBAAiB,cAAwC;CAChE,IAAI,MAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,aAAa,EAAE,EAAE,UAAU,CAAC;CAC9F,OAAO;AACT;AAIA,SAAS,mBAAmB,GAAa,OAAqB,SAAwB;CACpF,MAAM,UAAU,UAAU;CAC1B,MAAM,SAAS,QAAQ,CAAC,GAAG,KAAK,IAAI,CAAC;CACrC,MAAM,aAAa,KAAK,IAAI,GAAG,WAAW,OAAO,UAAU,EAAE;CAC7D,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,KAAK,OAAO,KAAK,IAAI;CAErD,IAAI,EAAE,iBAAiB,OAAO,QAAQ,UAAU,OAAO,cAAc,CAAC,CAAC;CACvE,OAAO;AACT;AAEA,SAAS,cAAc,GAAkB;CAEvC,IAAI,EAAE,OAAO,WAAW,SAAS,KAAK,EAAE,OAAO,WAAW,WAAW,KAAK,EAAE,OAAO,WAAW,MAAM,GAClG,OAAO;MACF,IAAI,EAAE,OAAO,WAAW,KAAK,GAClC,OAAO;MACF,IAAI,EAAE,OAAO,WAAW,MAAM,GACnC,uBAAO,IAAI,KAAK;MACX,IAAI,EAAE,OAAO,WAAW,WAAW,GACxC,uBAAO,IAAI,KAAK;MAEhB,MAAM,IAAI,MAAM,0CAA0C,EAAE,MAAM;AAEtE"}
1
+ {"version":3,"file":"unnest.cjs","names":[],"sources":["../src/unnest.ts"],"sourcesContent":["import { type OpColumn } from \"./drivers/EntityWriter.ts\";\nimport type { ParsedCteClause } from \"./queries/find/QueryParser.ts\";\n\n/**\n * Creates a CTE named `alias` that bulk-injects the `columnValues` into a SQL query.\n *\n * I.e. `columns = [first_name, last_name]` means columnValues would be all first names,\n * then all last names, i.e.`[[\"f1\",\"f2\"], [\"l1\",\"l2\"]]`.\n *\n * Note that `columnValues` will be mutated if any array columns need to be made rectangular.\n */\nexport function buildUnnestCte(alias: string, columns: OpColumn[], columnValues: any[][]): ParsedCteClause {\n // Make any arrays-of-arrays rectangular by filling them with nulls\n ensureRectangularArraySizes(columns, columnValues);\n // Use unnest or unnest_arrays depending on whether the column is an array column\n const selects = columns.map((c) => {\n if (c.dbType.endsWith(\"[]\")) {\n if (c.isNullableArray) {\n return `unnest_arrays(?::${c.dbType}[], true)`;\n } else {\n return `unnest_arrays(?::${c.dbType}[])`;\n }\n } else {\n return `unnest(?::${c.dbType}[])`;\n }\n });\n return {\n alias,\n columns,\n query: { kind: \"raw\", sql: `SELECT ${selects.join(\", \")}`, bindings: columnValues },\n };\n}\n\nexport function ensureRectangularArraySizes(columns: OpColumn[], columnValues: any[][]): void {\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i];\n if (column.dbType.endsWith(\"[]\")) {\n const values = columnValues[i];\n const fillTo = findArrayMaxSize(values);\n for (let j = 0; j < values.length; j++) {\n values[j] = fillArrayWithNulls(column, values[j], fillTo);\n }\n }\n }\n}\n\nfunction findArrayMaxSize(columnValues: readonly any[][]): number {\n let max = 1; // postgres really doesn't like `{{}}` so always send at least 1 element\n for (let i = 0; i < columnValues.length; i++) max = Math.max(max, columnValues[i]?.length ?? 0);\n return max;\n}\n\n// Because postgres array-of-arrays must be rectangular, we fill all arrays up the same max size\n// to put on the wire, and then later strip the padded nulls during the unnest_arrays call.\nfunction fillArrayWithNulls(c: OpColumn, array: any[] | null, maxSize: number): any[] {\n const wasNull = array === null;\n const result = array ? [...array] : [];\n const nullsToAdd = Math.max(0, maxSize - (array?.length ?? 0));\n for (let i = 0; i < nullsToAdd; i++) result.push(null);\n // Add our unset marker\n if (c.isNullableArray) result.unshift(wasNull ? null : notNullMarker(c));\n return result;\n}\n\nfunction notNullMarker(c: OpColumn): any {\n // Should probably push this into an OpColumn.notNullMarker value\n if (c.dbType.startsWith(\"varchar\") || c.dbType.startsWith(\"character\") || c.dbType.startsWith(\"text\")) {\n return \"\";\n } else if (c.dbType.startsWith(\"int\")) {\n return 1;\n } else if (c.dbType.startsWith(\"date\")) {\n return new Date(); // maybe something temporal?\n } else if (c.dbType.startsWith(\"timestamp\")) {\n return new Date(); // maybe something temporal?\n } else {\n throw new Error(\"Unhandled nullable array column type \" + c.dbType);\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,eAAe,OAAe,SAAqB,cAAwC;CAEzG,4BAA4B,SAAS,YAAY;CAajD,OAAO;EACL;EACA;EACA,OAAO;GAAE,MAAM;GAAO,KAAK,UAdb,QAAQ,KAAK,MAAM;IACjC,IAAI,EAAE,OAAO,SAAS,IAAI,GAAG;KAC3B,IAAI,EAAE,iBACJ,OAAO,oBAAoB,EAAE,OAAO;UAEpC,OAAO,oBAAoB,EAAE,OAAO;IAExC,OACE,OAAO,aAAa,EAAE,OAAO;GAEjC,CAI6C,CAAC,CAAC,KAAK,IAAI;GAAK,UAAU;EAAa;CACpF;AACF;AAEA,SAAgB,4BAA4B,SAAqB,cAA6B;CAC5F,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,SAAS,QAAQ;EACvB,IAAI,OAAO,OAAO,SAAS,IAAI,GAAG;GAChC,MAAM,SAAS,aAAa;GAC5B,MAAM,SAAS,iBAAiB,MAAM;GACtC,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KACjC,OAAO,KAAK,mBAAmB,QAAQ,OAAO,IAAI,MAAM;EAE5D;CACF;AACF;AAEA,SAAS,iBAAiB,cAAwC;CAChE,IAAI,MAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,aAAa,EAAE,EAAE,UAAU,CAAC;CAC9F,OAAO;AACT;AAIA,SAAS,mBAAmB,GAAa,OAAqB,SAAwB;CACpF,MAAM,UAAU,UAAU;CAC1B,MAAM,SAAS,QAA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