joist-orm 1.293.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (486) hide show
  1. package/build/{drivers/PostgresDriver.d.ts → PostgresDriver.d.ts} +1 -4
  2. package/build/PostgresDriver.d.ts.map +1 -0
  3. package/build/{drivers/PostgresDriver.js → PostgresDriver.js} +49 -58
  4. package/build/PostgresDriver.js.map +1 -0
  5. package/build/codegen.d.ts +2 -0
  6. package/build/codegen.d.ts.map +1 -0
  7. package/build/codegen.js +29 -0
  8. package/build/codegen.js.map +1 -0
  9. package/build/graphql-codegen-export.d.ts +2 -0
  10. package/build/graphql-codegen-export.d.ts.map +1 -0
  11. package/build/{drivers/index.js → graphql-codegen-export.js} +3 -5
  12. package/build/graphql-codegen-export.js.map +1 -0
  13. package/build/graphql-export.d.ts +2 -0
  14. package/build/graphql-export.d.ts.map +1 -0
  15. package/build/graphql-export.js +19 -0
  16. package/build/graphql-export.js.map +1 -0
  17. package/build/index.d.ts +3 -127
  18. package/build/index.d.ts.map +1 -1
  19. package/build/index.js +8 -282
  20. package/build/index.js.map +1 -1
  21. package/build/knex-export.d.ts +2 -0
  22. package/build/knex-export.d.ts.map +1 -0
  23. package/build/knex-export.js +19 -0
  24. package/build/knex-export.js.map +1 -0
  25. package/build/pg-migrate.d.ts +2 -0
  26. package/build/pg-migrate.d.ts.map +1 -0
  27. package/build/pg-migrate.js +30 -0
  28. package/build/pg-migrate.js.map +1 -0
  29. package/build/postgres-driver.d.ts +2 -0
  30. package/build/postgres-driver.d.ts.map +1 -0
  31. package/build/postgres-driver.js +7 -0
  32. package/build/postgres-driver.js.map +1 -0
  33. package/build/tests-export.d.ts +2 -0
  34. package/build/tests-export.d.ts.map +1 -0
  35. package/build/tests-export.js +19 -0
  36. package/build/tests-export.js.map +1 -0
  37. package/build/trusted.d.ts +5 -0
  38. package/build/trusted.d.ts.map +1 -0
  39. package/build/trusted.js +15 -0
  40. package/build/trusted.js.map +1 -0
  41. package/package.json +85 -16
  42. package/build/AliasAssigner.d.ts +0 -7
  43. package/build/AliasAssigner.d.ts.map +0 -1
  44. package/build/AliasAssigner.js +0 -30
  45. package/build/AliasAssigner.js.map +0 -1
  46. package/build/Aliases.d.ts +0 -110
  47. package/build/Aliases.d.ts.map +0 -1
  48. package/build/Aliases.js +0 -456
  49. package/build/Aliases.js.map +0 -1
  50. package/build/BaseEntity.d.ts +0 -66
  51. package/build/BaseEntity.d.ts.map +0 -1
  52. package/build/BaseEntity.js +0 -120
  53. package/build/BaseEntity.js.map +0 -1
  54. package/build/ConditionBuilder.d.ts +0 -50
  55. package/build/ConditionBuilder.d.ts.map +0 -1
  56. package/build/ConditionBuilder.js +0 -178
  57. package/build/ConditionBuilder.js.map +0 -1
  58. package/build/Entity.d.ts +0 -38
  59. package/build/Entity.d.ts.map +0 -1
  60. package/build/Entity.js +0 -8
  61. package/build/Entity.js.map +0 -1
  62. package/build/EntityFields.d.ts +0 -37
  63. package/build/EntityFields.d.ts.map +0 -1
  64. package/build/EntityFields.js +0 -3
  65. package/build/EntityFields.js.map +0 -1
  66. package/build/EntityFilter.d.ts +0 -113
  67. package/build/EntityFilter.d.ts.map +0 -1
  68. package/build/EntityFilter.js +0 -3
  69. package/build/EntityFilter.js.map +0 -1
  70. package/build/EntityGraphQLFilter.d.ts +0 -51
  71. package/build/EntityGraphQLFilter.d.ts.map +0 -1
  72. package/build/EntityGraphQLFilter.js +0 -54
  73. package/build/EntityGraphQLFilter.js.map +0 -1
  74. package/build/EntityManager.d.ts +0 -734
  75. package/build/EntityManager.d.ts.map +0 -1
  76. package/build/EntityManager.js +0 -2069
  77. package/build/EntityManager.js.map +0 -1
  78. package/build/EntityMetadata.d.ts +0 -185
  79. package/build/EntityMetadata.d.ts.map +0 -1
  80. package/build/EntityMetadata.js +0 -61
  81. package/build/EntityMetadata.js.map +0 -1
  82. package/build/EnumMetadata.d.ts +0 -15
  83. package/build/EnumMetadata.d.ts.map +0 -1
  84. package/build/EnumMetadata.js +0 -3
  85. package/build/EnumMetadata.js.map +0 -1
  86. package/build/FlushLock.d.ts +0 -26
  87. package/build/FlushLock.d.ts.map +0 -1
  88. package/build/FlushLock.js +0 -57
  89. package/build/FlushLock.js.map +0 -1
  90. package/build/HintTree.d.ts +0 -42
  91. package/build/HintTree.d.ts.map +0 -1
  92. package/build/HintTree.js +0 -64
  93. package/build/HintTree.js.map +0 -1
  94. package/build/IndexManager.d.ts +0 -30
  95. package/build/IndexManager.d.ts.map +0 -1
  96. package/build/IndexManager.js +0 -206
  97. package/build/IndexManager.js.map +0 -1
  98. package/build/InstanceData.d.ts +0 -59
  99. package/build/InstanceData.d.ts.map +0 -1
  100. package/build/InstanceData.js +0 -162
  101. package/build/InstanceData.js.map +0 -1
  102. package/build/IsLoadedCache.d.ts +0 -32
  103. package/build/IsLoadedCache.d.ts.map +0 -1
  104. package/build/IsLoadedCache.js +0 -80
  105. package/build/IsLoadedCache.js.map +0 -1
  106. package/build/JoinRows.d.ts +0 -75
  107. package/build/JoinRows.d.ts.map +0 -1
  108. package/build/JoinRows.js +0 -246
  109. package/build/JoinRows.js.map +0 -1
  110. package/build/PluginManager.d.ts +0 -90
  111. package/build/PluginManager.d.ts.map +0 -1
  112. package/build/PluginManager.js +0 -97
  113. package/build/PluginManager.js.map +0 -1
  114. package/build/QueryParser.d.ts +0 -271
  115. package/build/QueryParser.d.ts.map +0 -1
  116. package/build/QueryParser.js +0 -853
  117. package/build/QueryParser.js.map +0 -1
  118. package/build/QueryParser.pruning.d.ts +0 -5
  119. package/build/QueryParser.pruning.d.ts.map +0 -1
  120. package/build/QueryParser.pruning.js +0 -118
  121. package/build/QueryParser.pruning.js.map +0 -1
  122. package/build/QueryVisitor.d.ts +0 -19
  123. package/build/QueryVisitor.d.ts.map +0 -1
  124. package/build/QueryVisitor.js +0 -84
  125. package/build/QueryVisitor.js.map +0 -1
  126. package/build/ReactionsManager.d.ts +0 -84
  127. package/build/ReactionsManager.d.ts.map +0 -1
  128. package/build/ReactionsManager.js +0 -307
  129. package/build/ReactionsManager.js.map +0 -1
  130. package/build/Todo.d.ts +0 -31
  131. package/build/Todo.d.ts.map +0 -1
  132. package/build/Todo.js +0 -73
  133. package/build/Todo.js.map +0 -1
  134. package/build/caches.d.ts +0 -6
  135. package/build/caches.d.ts.map +0 -1
  136. package/build/caches.js +0 -42
  137. package/build/caches.js.map +0 -1
  138. package/build/changes.d.ts +0 -79
  139. package/build/changes.d.ts.map +0 -1
  140. package/build/changes.js +0 -251
  141. package/build/changes.js.map +0 -1
  142. package/build/config.d.ts +0 -237
  143. package/build/config.d.ts.map +0 -1
  144. package/build/config.js +0 -298
  145. package/build/config.js.map +0 -1
  146. package/build/config.test.d.ts +0 -2
  147. package/build/config.test.d.ts.map +0 -1
  148. package/build/config.test.js +0 -53
  149. package/build/config.test.js.map +0 -1
  150. package/build/configure.d.ts +0 -13
  151. package/build/configure.d.ts.map +0 -1
  152. package/build/configure.js +0 -329
  153. package/build/configure.js.map +0 -1
  154. package/build/dataloaders/findByUniqueDataLoader.d.ts +0 -7
  155. package/build/dataloaders/findByUniqueDataLoader.d.ts.map +0 -1
  156. package/build/dataloaders/findByUniqueDataLoader.js +0 -47
  157. package/build/dataloaders/findByUniqueDataLoader.js.map +0 -1
  158. package/build/dataloaders/findCountDataLoader.d.ts +0 -7
  159. package/build/dataloaders/findCountDataLoader.d.ts.map +0 -1
  160. package/build/dataloaders/findCountDataLoader.js +0 -74
  161. package/build/dataloaders/findCountDataLoader.js.map +0 -1
  162. package/build/dataloaders/findDataLoader.d.ts +0 -37
  163. package/build/dataloaders/findDataLoader.d.ts.map +0 -1
  164. package/build/dataloaders/findDataLoader.js +0 -337
  165. package/build/dataloaders/findDataLoader.js.map +0 -1
  166. package/build/dataloaders/findIdsDataLoader.d.ts +0 -7
  167. package/build/dataloaders/findIdsDataLoader.d.ts.map +0 -1
  168. package/build/dataloaders/findIdsDataLoader.js +0 -74
  169. package/build/dataloaders/findIdsDataLoader.js.map +0 -1
  170. package/build/dataloaders/findOrCreateDataLoader.d.ts +0 -13
  171. package/build/dataloaders/findOrCreateDataLoader.d.ts.map +0 -1
  172. package/build/dataloaders/findOrCreateDataLoader.js +0 -174
  173. package/build/dataloaders/findOrCreateDataLoader.js.map +0 -1
  174. package/build/dataloaders/lensDataLoader.d.ts +0 -12
  175. package/build/dataloaders/lensDataLoader.d.ts.map +0 -1
  176. package/build/dataloaders/lensDataLoader.js +0 -180
  177. package/build/dataloaders/lensDataLoader.js.map +0 -1
  178. package/build/dataloaders/loadDataLoader.d.ts +0 -11
  179. package/build/dataloaders/loadDataLoader.d.ts.map +0 -1
  180. package/build/dataloaders/loadDataLoader.js +0 -54
  181. package/build/dataloaders/loadDataLoader.js.map +0 -1
  182. package/build/dataloaders/manyToManyDataLoader.d.ts +0 -8
  183. package/build/dataloaders/manyToManyDataLoader.d.ts.map +0 -1
  184. package/build/dataloaders/manyToManyDataLoader.js +0 -74
  185. package/build/dataloaders/manyToManyDataLoader.js.map +0 -1
  186. package/build/dataloaders/manyToManyFindDataLoader.d.ts +0 -8
  187. package/build/dataloaders/manyToManyFindDataLoader.d.ts.map +0 -1
  188. package/build/dataloaders/manyToManyFindDataLoader.js +0 -70
  189. package/build/dataloaders/manyToManyFindDataLoader.js.map +0 -1
  190. package/build/dataloaders/oneToManyDataLoader.d.ts +0 -7
  191. package/build/dataloaders/oneToManyDataLoader.d.ts.map +0 -1
  192. package/build/dataloaders/oneToManyDataLoader.js +0 -60
  193. package/build/dataloaders/oneToManyDataLoader.js.map +0 -1
  194. package/build/dataloaders/oneToManyFindDataLoader.d.ts +0 -8
  195. package/build/dataloaders/oneToManyFindDataLoader.d.ts.map +0 -1
  196. package/build/dataloaders/oneToManyFindDataLoader.js +0 -71
  197. package/build/dataloaders/oneToManyFindDataLoader.js.map +0 -1
  198. package/build/dataloaders/oneToOneDataLoader.d.ts +0 -7
  199. package/build/dataloaders/oneToOneDataLoader.d.ts.map +0 -1
  200. package/build/dataloaders/oneToOneDataLoader.js +0 -59
  201. package/build/dataloaders/oneToOneDataLoader.js.map +0 -1
  202. package/build/dataloaders/populateDataLoader.d.ts +0 -13
  203. package/build/dataloaders/populateDataLoader.d.ts.map +0 -1
  204. package/build/dataloaders/populateDataLoader.js +0 -148
  205. package/build/dataloaders/populateDataLoader.js.map +0 -1
  206. package/build/dataloaders/recursiveChildrenDataLoader.d.ts +0 -7
  207. package/build/dataloaders/recursiveChildrenDataLoader.d.ts.map +0 -1
  208. package/build/dataloaders/recursiveChildrenDataLoader.js +0 -77
  209. package/build/dataloaders/recursiveChildrenDataLoader.js.map +0 -1
  210. package/build/dataloaders/recursiveParentsDataLoader.d.ts +0 -7
  211. package/build/dataloaders/recursiveParentsDataLoader.d.ts.map +0 -1
  212. package/build/dataloaders/recursiveParentsDataLoader.js +0 -59
  213. package/build/dataloaders/recursiveParentsDataLoader.js.map +0 -1
  214. package/build/defaults.d.ts +0 -54
  215. package/build/defaults.d.ts.map +0 -1
  216. package/build/defaults.js +0 -282
  217. package/build/defaults.js.map +0 -1
  218. package/build/driverApi.d.ts +0 -19
  219. package/build/driverApi.d.ts.map +0 -1
  220. package/build/driverApi.js +0 -17
  221. package/build/driverApi.js.map +0 -1
  222. package/build/drivers/Driver.d.ts +0 -26
  223. package/build/drivers/Driver.d.ts.map +0 -1
  224. package/build/drivers/Driver.js +0 -3
  225. package/build/drivers/Driver.js.map +0 -1
  226. package/build/drivers/EntityWriter.d.ts +0 -64
  227. package/build/drivers/EntityWriter.d.ts.map +0 -1
  228. package/build/drivers/EntityWriter.js +0 -237
  229. package/build/drivers/EntityWriter.js.map +0 -1
  230. package/build/drivers/IdAssigner.d.ts +0 -50
  231. package/build/drivers/IdAssigner.d.ts.map +0 -1
  232. package/build/drivers/IdAssigner.js +0 -133
  233. package/build/drivers/IdAssigner.js.map +0 -1
  234. package/build/drivers/PostgresDriver.d.ts.map +0 -1
  235. package/build/drivers/PostgresDriver.js.map +0 -1
  236. package/build/drivers/buildRawQuery.d.ts +0 -20
  237. package/build/drivers/buildRawQuery.d.ts.map +0 -1
  238. package/build/drivers/buildRawQuery.js +0 -148
  239. package/build/drivers/buildRawQuery.js.map +0 -1
  240. package/build/drivers/buildUtils.d.ts +0 -4
  241. package/build/drivers/buildUtils.d.ts.map +0 -1
  242. package/build/drivers/buildUtils.js +0 -79
  243. package/build/drivers/buildUtils.js.map +0 -1
  244. package/build/drivers/index.d.ts +0 -5
  245. package/build/drivers/index.d.ts.map +0 -1
  246. package/build/drivers/index.js.map +0 -1
  247. package/build/fields.d.ts +0 -24
  248. package/build/fields.d.ts.map +0 -1
  249. package/build/fields.js +0 -161
  250. package/build/fields.js.map +0 -1
  251. package/build/getProperties.d.ts +0 -28
  252. package/build/getProperties.d.ts.map +0 -1
  253. package/build/getProperties.js +0 -141
  254. package/build/getProperties.js.map +0 -1
  255. package/build/json.d.ts +0 -77
  256. package/build/json.d.ts.map +0 -1
  257. package/build/json.js +0 -116
  258. package/build/json.js.map +0 -1
  259. package/build/k.d.ts +0 -2
  260. package/build/k.d.ts.map +0 -1
  261. package/build/k.js +0 -9
  262. package/build/k.js.map +0 -1
  263. package/build/keys.d.ts +0 -49
  264. package/build/keys.d.ts.map +0 -1
  265. package/build/keys.js +0 -195
  266. package/build/keys.js.map +0 -1
  267. package/build/keywords.d.ts +0 -5
  268. package/build/keywords.d.ts.map +0 -1
  269. package/build/keywords.js +0 -124
  270. package/build/keywords.js.map +0 -1
  271. package/build/loadHints.d.ts +0 -112
  272. package/build/loadHints.d.ts.map +0 -1
  273. package/build/loadHints.js +0 -75
  274. package/build/loadHints.js.map +0 -1
  275. package/build/loadLens.d.ts +0 -66
  276. package/build/loadLens.d.ts.map +0 -1
  277. package/build/loadLens.js +0 -287
  278. package/build/loadLens.js.map +0 -1
  279. package/build/logging/FactoryLogger.d.ts +0 -24
  280. package/build/logging/FactoryLogger.d.ts.map +0 -1
  281. package/build/logging/FactoryLogger.js +0 -77
  282. package/build/logging/FactoryLogger.js.map +0 -1
  283. package/build/logging/FieldLogger.d.ts +0 -27
  284. package/build/logging/FieldLogger.d.ts.map +0 -1
  285. package/build/logging/FieldLogger.js +0 -69
  286. package/build/logging/FieldLogger.js.map +0 -1
  287. package/build/logging/ReactionLogger.d.ts +0 -23
  288. package/build/logging/ReactionLogger.d.ts.map +0 -1
  289. package/build/logging/ReactionLogger.js +0 -65
  290. package/build/logging/ReactionLogger.js.map +0 -1
  291. package/build/newEntity.d.ts +0 -45
  292. package/build/newEntity.d.ts.map +0 -1
  293. package/build/newEntity.js +0 -106
  294. package/build/newEntity.js.map +0 -1
  295. package/build/newTestInstance.d.ts +0 -193
  296. package/build/newTestInstance.d.ts.map +0 -1
  297. package/build/newTestInstance.js +0 -738
  298. package/build/newTestInstance.js.map +0 -1
  299. package/build/normalizeHints.d.ts +0 -16
  300. package/build/normalizeHints.d.ts.map +0 -1
  301. package/build/normalizeHints.js +0 -31
  302. package/build/normalizeHints.js.map +0 -1
  303. package/build/plugins/ImmutableEntitiesPlugin.d.ts +0 -9
  304. package/build/plugins/ImmutableEntitiesPlugin.d.ts.map +0 -1
  305. package/build/plugins/ImmutableEntitiesPlugin.js +0 -21
  306. package/build/plugins/ImmutableEntitiesPlugin.js.map +0 -1
  307. package/build/plugins/PreloadPlugin.d.ts +0 -69
  308. package/build/plugins/PreloadPlugin.d.ts.map +0 -1
  309. package/build/plugins/PreloadPlugin.js +0 -3
  310. package/build/plugins/PreloadPlugin.js.map +0 -1
  311. package/build/preloading/JsonAggregatePreloader.d.ts +0 -16
  312. package/build/preloading/JsonAggregatePreloader.d.ts.map +0 -1
  313. package/build/preloading/JsonAggregatePreloader.js +0 -238
  314. package/build/preloading/JsonAggregatePreloader.js.map +0 -1
  315. package/build/preloading/canPreload.d.ts +0 -3
  316. package/build/preloading/canPreload.d.ts.map +0 -1
  317. package/build/preloading/canPreload.js +0 -21
  318. package/build/preloading/canPreload.js.map +0 -1
  319. package/build/preloading/partitionHint.d.ts +0 -5
  320. package/build/preloading/partitionHint.d.ts.map +0 -1
  321. package/build/preloading/partitionHint.js +0 -56
  322. package/build/preloading/partitionHint.js.map +0 -1
  323. package/build/reactiveHints.d.ts +0 -129
  324. package/build/reactiveHints.d.ts.map +0 -1
  325. package/build/reactiveHints.js +0 -458
  326. package/build/reactiveHints.js.map +0 -1
  327. package/build/relations/AbstractPropertyImpl.d.ts +0 -8
  328. package/build/relations/AbstractPropertyImpl.d.ts.map +0 -1
  329. package/build/relations/AbstractPropertyImpl.js +0 -15
  330. package/build/relations/AbstractPropertyImpl.js.map +0 -1
  331. package/build/relations/AbstractRelationImpl.d.ts +0 -36
  332. package/build/relations/AbstractRelationImpl.d.ts.map +0 -1
  333. package/build/relations/AbstractRelationImpl.js +0 -19
  334. package/build/relations/AbstractRelationImpl.js.map +0 -1
  335. package/build/relations/Collection.d.ts +0 -28
  336. package/build/relations/Collection.d.ts.map +0 -1
  337. package/build/relations/Collection.js +0 -18
  338. package/build/relations/Collection.js.map +0 -1
  339. package/build/relations/CustomCollection.d.ts +0 -69
  340. package/build/relations/CustomCollection.d.ts.map +0 -1
  341. package/build/relations/CustomCollection.js +0 -166
  342. package/build/relations/CustomCollection.js.map +0 -1
  343. package/build/relations/CustomReference.d.ts +0 -71
  344. package/build/relations/CustomReference.d.ts.map +0 -1
  345. package/build/relations/CustomReference.js +0 -152
  346. package/build/relations/CustomReference.js.map +0 -1
  347. package/build/relations/LargeCollection.d.ts +0 -19
  348. package/build/relations/LargeCollection.d.ts.map +0 -1
  349. package/build/relations/LargeCollection.js +0 -3
  350. package/build/relations/LargeCollection.js.map +0 -1
  351. package/build/relations/ManyToManyCollection.d.ts +0 -44
  352. package/build/relations/ManyToManyCollection.d.ts.map +0 -1
  353. package/build/relations/ManyToManyCollection.js +0 -268
  354. package/build/relations/ManyToManyCollection.js.map +0 -1
  355. package/build/relations/ManyToManyLargeCollection.d.ts +0 -30
  356. package/build/relations/ManyToManyLargeCollection.d.ts.map +0 -1
  357. package/build/relations/ManyToManyLargeCollection.js +0 -119
  358. package/build/relations/ManyToManyLargeCollection.js.map +0 -1
  359. package/build/relations/ManyToOneReference.d.ts +0 -121
  360. package/build/relations/ManyToOneReference.d.ts.map +0 -1
  361. package/build/relations/ManyToOneReference.js +0 -389
  362. package/build/relations/ManyToOneReference.js.map +0 -1
  363. package/build/relations/OneToManyCollection.d.ts +0 -58
  364. package/build/relations/OneToManyCollection.d.ts.map +0 -1
  365. package/build/relations/OneToManyCollection.js +0 -347
  366. package/build/relations/OneToManyCollection.js.map +0 -1
  367. package/build/relations/OneToManyLargeCollection.d.ts +0 -26
  368. package/build/relations/OneToManyLargeCollection.d.ts.map +0 -1
  369. package/build/relations/OneToManyLargeCollection.js +0 -102
  370. package/build/relations/OneToManyLargeCollection.js.map +0 -1
  371. package/build/relations/OneToOneReference.d.ts +0 -93
  372. package/build/relations/OneToOneReference.d.ts.map +0 -1
  373. package/build/relations/OneToOneReference.js +0 -228
  374. package/build/relations/OneToOneReference.js.map +0 -1
  375. package/build/relations/PolymorphicReference.d.ts +0 -89
  376. package/build/relations/PolymorphicReference.d.ts.map +0 -1
  377. package/build/relations/PolymorphicReference.js +0 -244
  378. package/build/relations/PolymorphicReference.js.map +0 -1
  379. package/build/relations/ReactiveField.d.ts +0 -87
  380. package/build/relations/ReactiveField.d.ts.map +0 -1
  381. package/build/relations/ReactiveField.js +0 -149
  382. package/build/relations/ReactiveField.js.map +0 -1
  383. package/build/relations/ReactiveGetter.d.ts +0 -30
  384. package/build/relations/ReactiveGetter.d.ts.map +0 -1
  385. package/build/relations/ReactiveGetter.js +0 -38
  386. package/build/relations/ReactiveGetter.js.map +0 -1
  387. package/build/relations/ReactiveManyToMany.d.ts +0 -56
  388. package/build/relations/ReactiveManyToMany.d.ts.map +0 -1
  389. package/build/relations/ReactiveManyToMany.js +0 -243
  390. package/build/relations/ReactiveManyToMany.js.map +0 -1
  391. package/build/relations/ReactiveManyToManyOtherSide.d.ts +0 -47
  392. package/build/relations/ReactiveManyToManyOtherSide.d.ts.map +0 -1
  393. package/build/relations/ReactiveManyToManyOtherSide.js +0 -155
  394. package/build/relations/ReactiveManyToManyOtherSide.js.map +0 -1
  395. package/build/relations/ReactiveQueryField.d.ts +0 -41
  396. package/build/relations/ReactiveQueryField.d.ts.map +0 -1
  397. package/build/relations/ReactiveQueryField.js +0 -125
  398. package/build/relations/ReactiveQueryField.js.map +0 -1
  399. package/build/relations/ReactiveReference.d.ts +0 -119
  400. package/build/relations/ReactiveReference.d.ts.map +0 -1
  401. package/build/relations/ReactiveReference.js +0 -333
  402. package/build/relations/ReactiveReference.js.map +0 -1
  403. package/build/relations/ReadOnlyCollection.d.ts +0 -19
  404. package/build/relations/ReadOnlyCollection.d.ts.map +0 -1
  405. package/build/relations/ReadOnlyCollection.js +0 -15
  406. package/build/relations/ReadOnlyCollection.js.map +0 -1
  407. package/build/relations/RecursiveCollection.d.ts +0 -84
  408. package/build/relations/RecursiveCollection.d.ts.map +0 -1
  409. package/build/relations/RecursiveCollection.js +0 -296
  410. package/build/relations/RecursiveCollection.js.map +0 -1
  411. package/build/relations/Reference.d.ts +0 -35
  412. package/build/relations/Reference.d.ts.map +0 -1
  413. package/build/relations/Reference.js +0 -21
  414. package/build/relations/Reference.js.map +0 -1
  415. package/build/relations/Relation.d.ts +0 -14
  416. package/build/relations/Relation.d.ts.map +0 -1
  417. package/build/relations/Relation.js +0 -12
  418. package/build/relations/Relation.js.map +0 -1
  419. package/build/relations/hasAsyncMethod.d.ts +0 -27
  420. package/build/relations/hasAsyncMethod.d.ts.map +0 -1
  421. package/build/relations/hasAsyncMethod.js +0 -47
  422. package/build/relations/hasAsyncMethod.js.map +0 -1
  423. package/build/relations/hasAsyncProperty.d.ts +0 -49
  424. package/build/relations/hasAsyncProperty.d.ts.map +0 -1
  425. package/build/relations/hasAsyncProperty.js +0 -98
  426. package/build/relations/hasAsyncProperty.js.map +0 -1
  427. package/build/relations/hasManyDerived.d.ts +0 -22
  428. package/build/relations/hasManyDerived.d.ts.map +0 -1
  429. package/build/relations/hasManyDerived.js +0 -32
  430. package/build/relations/hasManyDerived.js.map +0 -1
  431. package/build/relations/hasManyThrough.d.ts +0 -10
  432. package/build/relations/hasManyThrough.d.ts.map +0 -1
  433. package/build/relations/hasManyThrough.js +0 -24
  434. package/build/relations/hasManyThrough.js.map +0 -1
  435. package/build/relations/hasOneDerived.d.ts +0 -12
  436. package/build/relations/hasOneDerived.d.ts.map +0 -1
  437. package/build/relations/hasOneDerived.js +0 -24
  438. package/build/relations/hasOneDerived.js.map +0 -1
  439. package/build/relations/hasOneThrough.d.ts +0 -10
  440. package/build/relations/hasOneThrough.d.ts.map +0 -1
  441. package/build/relations/hasOneThrough.js +0 -24
  442. package/build/relations/hasOneThrough.js.map +0 -1
  443. package/build/relations/index.d.ts +0 -28
  444. package/build/relations/index.d.ts.map +0 -1
  445. package/build/relations/index.js +0 -88
  446. package/build/relations/index.js.map +0 -1
  447. package/build/rules.d.ts +0 -123
  448. package/build/rules.d.ts.map +0 -1
  449. package/build/rules.js +0 -231
  450. package/build/rules.js.map +0 -1
  451. package/build/runtimeConfig.d.ts +0 -17
  452. package/build/runtimeConfig.d.ts.map +0 -1
  453. package/build/runtimeConfig.js +0 -18
  454. package/build/runtimeConfig.js.map +0 -1
  455. package/build/serde.d.ts +0 -277
  456. package/build/serde.d.ts.map +0 -1
  457. package/build/serde.js +0 -517
  458. package/build/serde.js.map +0 -1
  459. package/build/temporal.d.ts +0 -16
  460. package/build/temporal.d.ts.map +0 -1
  461. package/build/temporal.js +0 -48
  462. package/build/temporal.js.map +0 -1
  463. package/build/temporalMappers.d.ts +0 -25
  464. package/build/temporalMappers.d.ts.map +0 -1
  465. package/build/temporalMappers.js +0 -59
  466. package/build/temporalMappers.js.map +0 -1
  467. package/build/typeMap.d.ts +0 -68
  468. package/build/typeMap.d.ts.map +0 -1
  469. package/build/typeMap.js +0 -3
  470. package/build/typeMap.js.map +0 -1
  471. package/build/unnest.d.ts +0 -13
  472. package/build/unnest.d.ts.map +0 -1
  473. package/build/unnest.js +0 -85
  474. package/build/unnest.js.map +0 -1
  475. package/build/upsert.d.ts +0 -42
  476. package/build/upsert.d.ts.map +0 -1
  477. package/build/upsert.js +0 -265
  478. package/build/upsert.js.map +0 -1
  479. package/build/utils.d.ts +0 -58
  480. package/build/utils.d.ts.map +0 -1
  481. package/build/utils.js +0 -236
  482. package/build/utils.js.map +0 -1
  483. package/build/withLoaded.d.ts +0 -56
  484. package/build/withLoaded.d.ts.map +0 -1
  485. package/build/withLoaded.js +0 -76
  486. package/build/withLoaded.js.map +0 -1
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FactoryLogger = void 0;
7
- exports.setFactoryWriter = setFactoryWriter;
8
- const ansis_1 = __importDefault(require("ansis"));
9
- const config_1 = require("../config");
10
- let writer = undefined;
11
- const { gray, green, yellow } = ansis_1.default;
12
- class FactoryLogger {
13
- level = 0;
14
- writeFn;
15
- skipNextLogCreating = false;
16
- // We default to process.stdout.write to side-step around Jest's console.log instrumentation
17
- // adding "...at..." stack traces to our output.
18
- constructor() {
19
- this.writeFn = writer ?? process.stdout.write.bind(process.stdout);
20
- }
21
- logCreating(cstr) {
22
- // This was already logged by the parent `field = creating new`
23
- if (this.skipNextLogCreating) {
24
- this.skipNextLogCreating = false;
25
- }
26
- else {
27
- this.write("Creating", green.bold(`new ${cstr.name}`), gray(`at ${(0, config_1.getCallerName)(2)}`));
28
- }
29
- }
30
- logAddToUseMap(e, source) {
31
- if (source === "sameBranch" || source === "diffBranch") {
32
- this.write(`${gray(`created`)} ${e.toString()} ${gray("added to scope")}`);
33
- }
34
- else {
35
- this.write(`${gray(`...adding`)} ${e.toString()} ${gray("opt to scope")}`);
36
- }
37
- }
38
- logCreated(e) {
39
- // This matches the `logAddToUseMap` but for entities not going into scope
40
- this.write(`${gray(`created`)} ${e.toString()}`);
41
- }
42
- logFoundExisting(e) {
43
- // Make this yellow because it reverses the "new Entity" we thought we were going to do
44
- this.write(`${yellow(`using existing`)} ${e.toString()}`);
45
- }
46
- logFoundOpt(fieldName, e) {
47
- this.write(`${gray(`${fieldName} =`)} ${e.toString()} ${gray("from opt")}`);
48
- }
49
- logNotFoundAndCreating(fieldName, meta) {
50
- this.write(`${gray(`${fieldName} =`)} creating ${green.bold(`new ${meta.type}`)}`);
51
- this.skipNextLogCreating = true;
52
- }
53
- logFoundInUseMap(fieldName, e) {
54
- this.write(`${gray(`${fieldName} =`)} ${e.toString()} ${gray("from scope")}`);
55
- }
56
- logFoundSingleEntity(fieldName, e) {
57
- this.write(`${gray(`${fieldName} =`)} ${e.toString()} ${gray("from em")}`);
58
- }
59
- indent() {
60
- this.level++;
61
- }
62
- dedent() {
63
- this.level--;
64
- }
65
- write(...line) {
66
- this.writeFn(this.prefix() + line.join(" ") + "\n");
67
- }
68
- prefix() {
69
- return " ".repeat(this.level);
70
- }
71
- }
72
- exports.FactoryLogger = FactoryLogger;
73
- // Allow our test suite observe the logger behavior
74
- function setFactoryWriter(write) {
75
- writer = write;
76
- }
77
- //# sourceMappingURL=FactoryLogger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FactoryLogger.js","sourceRoot":"","sources":["../../src/logging/FactoryLogger.ts"],"names":[],"mappings":";;;;;;AAoFA,4CAEC;AAtFD,kDAA0B;AAC1B,sCAA0C;AAK1C,IAAI,MAAM,GAAwB,SAAS,CAAC;AAG5C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,eAAK,CAAC;AAEtC,MAAa,aAAa;IAChB,KAAK,GAAG,CAAC,CAAC;IACV,OAAO,CAAU;IACjB,mBAAmB,GAAG,KAAK,CAAC;IAEpC,4FAA4F;IAC5F,gDAAgD;IAChD;QACE,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAA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AAC,KAA0B;IACzD,MAAM,GAAG,KAAK,CAAC;AACjB,CAAC"}
@@ -1,27 +0,0 @@
1
- import { Entity } from "../Entity";
2
- export type WriteFn = (line: string) => void;
3
- export type FieldLoggerWatch = {
4
- /** The entity name, i.e. `Author` */
5
- entity: string;
6
- /** The fields, i.e. `["firstName", "lastName"]`. */
7
- fieldNames?: string[];
8
- /** Whether to stop a debugger when the field is set. */
9
- breakpoint?: boolean;
10
- };
11
- /**
12
- * Logs the setting of fields on entities to a `writeFn`, which defaults to `process.stdout`.
13
- */
14
- export declare class FieldLogger {
15
- #private;
16
- constructor(
17
- /** The fields to watch, defaults to all fields. */
18
- watching: FieldLoggerWatch[],
19
- /** An optional/semi-internal write function, mostly for testing. */
20
- writeFn?: WriteFn);
21
- logCreate(entity: Entity): void;
22
- logSet(entity: Entity, fieldName: string, value: unknown): void;
23
- private log;
24
- private shouldLog;
25
- private getColor;
26
- }
27
- //# sourceMappingURL=FieldLogger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FieldLogger.d.ts","sourceRoot":"","sources":["../../src/logging/FieldLogger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAY,MAAM,WAAW,CAAC;AAI7C,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,wDAAwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,qBAAa,WAAW;;;IAKpB,mDAAmD;IACnD,QAAQ,EAAE,gBAAgB,EAAE;IAC5B,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO;IAOnB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAO/B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAe/D,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,QAAQ;CAOjB"}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FieldLogger = void 0;
7
- const ansis_1 = __importDefault(require("ansis"));
8
- const Entity_1 = require("../Entity");
9
- const config_1 = require("../config");
10
- const { gray, green, yellow, blue, red } = ansis_1.default;
11
- /**
12
- * Logs the setting of fields on entities to a `writeFn`, which defaults to `process.stdout`.
13
- */
14
- class FieldLogger {
15
- #writeFn;
16
- #watching = [];
17
- constructor(
18
- /** The fields to watch, defaults to all fields. */
19
- watching,
20
- /** An optional/semi-internal write function, mostly for testing. */
21
- writeFn) {
22
- // We default to process.stdout.write to side-step around Jest's console.log instrumentation
23
- this.#writeFn = writeFn ?? ((line) => process.stdout.write(`${line}\n`));
24
- this.#watching = watching ?? [];
25
- }
26
- logCreate(entity) {
27
- const log = this.shouldLog(entity, "constructor");
28
- if (!log)
29
- return;
30
- this.log(green.bold(`${entity.toTaggedString()}`) + " " + yellow(`created`), gray(`at ${(0, config_1.getFuzzyCallerName)()}`));
31
- if (log === "breakpoint")
32
- debugger;
33
- }
34
- logSet(entity, fieldName, value) {
35
- const log = this.shouldLog(entity, fieldName);
36
- if (!log)
37
- return;
38
- const color = this.getColor(value);
39
- this.log(green.bold(`${entity.toTaggedString()}`) + yellow(`.${fieldName}`), gray(`=`), color(`${value}`),
40
- // We don't know if we'll be called from getField or M2O.set+getField, i.e. how many stack frames to skip
41
- // to really get "the caller's location", so use `getFuzzyCallerName` instead of `getCallerName`.
42
- gray(`at ${(0, config_1.getFuzzyCallerName)()}`));
43
- if (log === "breakpoint")
44
- debugger;
45
- }
46
- log(...line) {
47
- this.#writeFn(`${line.join(" ")}`);
48
- }
49
- shouldLog(entity, fieldName) {
50
- if (this.#watching.length === 0)
51
- return true;
52
- for (const { entity: entityName, fieldNames, breakpoint } of this.#watching) {
53
- if (entity.constructor.name === entityName && (fieldNames === undefined || fieldNames.includes(fieldName))) {
54
- return breakpoint ? "breakpoint" : true;
55
- }
56
- }
57
- return false;
58
- }
59
- // Do some `typeof` -> color
60
- getColor(value) {
61
- return typeof value === "boolean"
62
- ? red // boolean => red
63
- : (0, Entity_1.isEntity)(value)
64
- ? green // entity => green (matches other logging)
65
- : blue; // otherwise strings/dates/numbers are blue;
66
- }
67
- }
68
- exports.FieldLogger = FieldLogger;
69
- //# sourceMappingURL=FieldLogger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FieldLogger.js","sourceRoot":"","sources":["../../src/logging/FieldLogger.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,sCAA6C;AAC7C,sCAA+C;AAE/C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,eAAK,CAAC;AAYjD;;GAEG;AACH,MAAa,WAAW;IACb,QAAQ,CAAU;IAClB,SAAS,GAAuB,EAAE,CAAC;IAE5C;IACE,mDAAmD;IACnD,QAA4B;IAC5B,oEAAoE;IACpE,OAAiB;QAEjB,4FAA4F;QAC5F,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI,EAAE,CAAC;IAClC,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAClD,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,IAAI,CAAC,GA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AW,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;gBAC3G,OAAO,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;YAC1C,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,4BAA4B;IACpB,QAAQ,CAAC,KAAc;QAC7B,OAAO,OAAO,KAAK,KAAK,SAAS;YAC/B,CAAC,CAAC,GAAG,CAAC,iBAAiB;YACvB,CAAC,CAAC,IAAA,iBAAQ,EAAC,KAAK,CAAC;gBACf,CAAC,CAAC,KAAK,CAAC,0CAA0C;gBAClD,CAAC,CAAC,IAAI,CAAC,CAAC,4CAA4C;IAC1D,CAAC;CACF;AA3DD,kCA2DC"}
@@ -1,23 +0,0 @@
1
- import { Reactable } from "../config";
2
- import { Entity } from "../Entity";
3
- import { EntityManager } from "../EntityManager";
4
- import { ReactiveAction } from "../ReactionsManager";
5
- export declare let globalLogger: ReactionLogger | undefined;
6
- type WriteFn = (line: string) => void;
7
- export declare class ReactionLogger {
8
- private writeFn;
9
- constructor(writeFn?: WriteFn);
10
- now(): number;
11
- logQueued(entity: Entity, fieldName: string, r: Reactable): void;
12
- logQueuedAll(entity: Entity, reason: string, r: Reactable): void;
13
- logStartingRecalc(em: EntityManager, kind: "reactables" | "reactiveQueries"): void;
14
- logWalked(todo: Entity[], r: Reactable, entities: Entity[]): void;
15
- logLoading(em: EntityManager, actions: ReactiveAction[]): void;
16
- logLoadingTime(em: EntityManager, millis: number): void;
17
- private entityCount;
18
- private log;
19
- }
20
- export declare function setReactionLogging(enabled: boolean): void;
21
- export declare function setReactionLogging(logger: ReactionLogger): void;
22
- export {};
23
- //# sourceMappingURL=ReactionLogger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReactionLogger.d.ts","sourceRoot":"","sources":["../../src/logging/ReactionLogger.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|| function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ReactionLogger = exports.globalLogger = void 0;
7
- exports.setReactionLogging = setReactionLogging;
8
- const ansis_1 = __importDefault(require("ansis"));
9
- const utils_1 = require("../utils");
10
- const { gray, green, yellow, white } = ansis_1.default;
11
- exports.globalLogger = undefined;
12
- class ReactionLogger {
13
- writeFn;
14
- // We default to process.stdout.write to side-step around Jest's console.log instrumentation
15
- constructor(writeFn = process.stdout.write.bind(process.stdout)) {
16
- this.writeFn = writeFn;
17
- }
18
- now() {
19
- return performance.now();
20
- }
21
- logQueued(entity, fieldName, r) {
22
- this.log(green.bold(`${entity.toTaggedString()}`) + yellow(`.${fieldName}`), gray(`changed, queuing`), green.bold(`${entity.toTaggedString()}`) + yellow(maybeDotPath(r)) + yellow(r.name));
23
- }
24
- logQueuedAll(entity, reason, r) {
25
- this.log(green.bold(`${entity.toTaggedString()}`), gray(`${reason}, queuing`), green.bold(`${entity.toTaggedString()}`) + green(maybeDotPath(r)) + yellow(r.name));
26
- }
27
- logStartingRecalc(em, kind) {
28
- this.log(white.bold(`Recalculating reactive ${kind === "reactiveQueries" ? "queries" : "fields"} values...`), this.entityCount(em));
29
- }
30
- logWalked(todo, r, entities) {
31
- // Keep for future debugging...
32
- const from = todo[0].constructor.name;
33
- this.log(" ", // indent
34
- gray(`Walked`), white(`${todo.length}`), green.bold(`${from}`) + green(`.${r.path.join(".")}`), gray("paths, found"), white(`${entities.length}`), green.bold(`${r.cstr.name}`) + green(".") + yellow(r.name), gray("to recalc"));
35
- if (entities.length > 0) {
36
- this.log(" ", // indent
37
- gray("["), todo.map((e) => e.toTaggedString()).join(" "), gray("] -> ["), [...new Set(entities)].map((e) => e.toTaggedString()).join(" "), gray("]"));
38
- }
39
- }
40
- logLoading(em, actions) {
41
- this.log(" ", gray("Loading"), String(actions.length), gray("actions..."), this.entityCount(em));
42
- // Group by the action name
43
- [...(0, utils_1.groupBy)(actions, (a) => `${a.entity.constructor.name},${a.r.name}`).values()].forEach((actions) => {
44
- const { r, entity } = actions[0];
45
- this.log(" ", green.bold(entity.constructor.name) + green(".") + yellow(r.name), gray("-> ["), String(actions.map((a) => a.entity.toTaggedString()).join(" ")), gray("]"));
46
- });
47
- }
48
- logLoadingTime(em, millis) {
49
- this.log(" ", gray("took"), String(Math.floor(millis)), gray("millis"), this.entityCount(em));
50
- }
51
- entityCount(em) {
52
- return gray("(em.entities=") + em.entities.length + gray(")");
53
- }
54
- log(...line) {
55
- this.writeFn(`${line.join(" ")}\n`);
56
- }
57
- }
58
- exports.ReactionLogger = ReactionLogger;
59
- function setReactionLogging(arg) {
60
- exports.globalLogger = typeof arg === "boolean" ? (arg ? new ReactionLogger() : undefined) : arg;
61
- }
62
- function maybeDotPath(r) {
63
- return r.path.length > 0 ? `.${r.path.join(".")}.` : ".";
64
- }
65
- //# sourceMappingURL=ReactionLogger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReactionLogger.js","sourceRoot":"","sources":["../../src/logging/ReactionLogger.ts"],"names":[],"mappings":";;;;;;AAsGA,gDAEC;AAxGD,kDAA0B;AAK1B,oCAAmC;AAEnC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,eAAK,CAAC;AAElC,QAAA,YAAY,GAA+B,SAAS,CAAC;AAGhE,MAAa,cAAc;IACjB,OAAO,CAAU;IAEzB,4FAA4F;IAC5F,YAAY,UAAmB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACtE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,GAAG;QACD,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED,SAAS,CAAC,MAAc,EAAE,SAAiB,EAAE,CAAY;QACvD,IAAI,CAAC,GAAG,CACN,KAAK,CAAC,IAAI,CAAC,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AkB,CAAC,GAA6B;IAC9D,oBAAY,GAAG,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3F,CAAC;AAED,SAAS,YAAY,CAAC,CAAY;IAChC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3D,CAAC"}
@@ -1,45 +0,0 @@
1
- import { Entity } from "./Entity";
2
- import { EntityConstructor, EntityManager } from "./EntityManager";
3
- import { EntityMetadata } from "./EntityMetadata";
4
- /**
5
- * Constructs an instance of `cstr` but with relations all made lazy.
6
- *
7
- * Specifically we avoid going through `new` b/c that invokes the `constructor` which instantiates
8
- * the instance-level class fields/relations like `books = hasMany`.
9
- *
10
- * Instead, we just call `Object.create`, which does not make any constructor/super calls, and instead
11
- * let any `this.books` accesses resolve to the getters we've installed on the prototype.
12
- */
13
- export declare function newEntity<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>, isNew: boolean): T;
14
- /**
15
- * A function for `has...` methods to integrate with the `newEntity` lazy field system.
16
- *
17
- * We need TypeScript to still see `books = hasMany(...)` as being typed as `Many<Book>`,
18
- * so this method's return type is `R` i.e. the `Many<Book>` relation type.
19
- *
20
- * But at runtime we actually want this to be a `LazyField` that can be rewritten
21
- * into a getter, and only invoked when the relation is actually accessed.
22
- */
23
- export declare function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: string) => R): R;
24
- /**
25
- * Easily resolves `otherMetadata` fields for lazy relations.
26
- *
27
- * When `lazyRelation`s are initialized for their first/only time, i.e. the `books = hasBooks(authorMetadata)`
28
- * call that `getFakeInstance` does, it's when the class bodies are still being evaled, which is before the
29
- * `metadata.ts` file has run.
30
- *
31
- * This means that any `authorMetadata` consts would still be undefined.
32
- *
33
- * So instead we just do not bother passing metadata consts to `has...` methods, and instead let the methods
34
- * one-time resolve `otherMetadata` on their first invocation, which will be after the `metadata.ts` file has
35
- * finished importing, and the consts are all defined.
36
- */
37
- export declare function resolveOtherMeta(entity: Entity, fieldName: string): EntityMetadata;
38
- /** Wraps `has...` relation constructors in an easily-identifiable container. */
39
- export declare class LazyField<T extends Entity> {
40
- #private;
41
- constructor(fn: (entity: T, fieldName: string) => any);
42
- /** Called by our getters to lazily create the relation on first access. */
43
- create(entity: T, fieldName: string): any;
44
- }
45
- //# sourceMappingURL=newEntity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"newEntity.d.ts","sourceRoot":"","sources":["../src/newEntity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAe,MAAM,kBAAkB,CAAC;AAO/D;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAa5G;AA6BD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,CAEzF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc,CAIlF;AAED,gFAAgF;AAChF,qBAAa,SAAS,CAAC,CAAC,SAAS,MAAM;;gBAEzB,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,GAAG;IAIrD,2EAA2E;IAC3E,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM;CAGpC"}
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LazyField = void 0;
4
- exports.newEntity = newEntity;
5
- exports.lazyField = lazyField;
6
- exports.resolveOtherMeta = resolveOtherMeta;
7
- const BaseEntity_1 = require("./BaseEntity");
8
- const EntityMetadata_1 = require("./EntityMetadata");
9
- const getProperties_1 = require("./getProperties");
10
- const utils_1 = require("./utils");
11
- // Marks a constructor like Author has having had our relation getters installed
12
- const lazySymbol = Symbol("lazy");
13
- /**
14
- * Constructs an instance of `cstr` but with relations all made lazy.
15
- *
16
- * Specifically we avoid going through `new` b/c that invokes the `constructor` which instantiates
17
- * the instance-level class fields/relations like `books = hasMany`.
18
- *
19
- * Instead, we just call `Object.create`, which does not make any constructor/super calls, and instead
20
- * let any `this.books` accesses resolve to the getters we've installed on the prototype.
21
- */
22
- function newEntity(em, cstr, isNew) {
23
- if (!Object.hasOwn(cstr, lazySymbol)) {
24
- moveRelationsToGetters(cstr);
25
- cstr[lazySymbol] = true;
26
- }
27
- const meta = (0, EntityMetadata_1.getMetadata)(cstr);
28
- if (meta.ctiAbstract)
29
- (0, utils_1.fail)(`Cannot create an instance of abstract entity ${meta.type}`);
30
- // This side-steps the `Author` constructor that initializes fields instance-level fields, which instead
31
- // we've shoved up to be getters on the prototype, and the only instance field we expect to have is `__data`,
32
- // which is set by the `baseEntityCstr` call.
33
- const entity = Object.create(cstr.prototype);
34
- (0, BaseEntity_1.baseEntityCstr)(em, entity, isNew);
35
- return entity;
36
- }
37
- function moveRelationsToGetters(cstr) {
38
- // Reuse getProperties's detect
39
- for (const [fieldName, value] of (0, getProperties_1.getLazyFields)((0, EntityMetadata_1.getMetadata)(cstr))) {
40
- if (value instanceof LazyField) {
41
- Object.defineProperty(cstr.prototype, fieldName, {
42
- get() {
43
- return (this.__data.relations[fieldName] ??= value.create(this, fieldName));
44
- },
45
- });
46
- }
47
- else if (fieldName === "transientFields") {
48
- Object.defineProperty(cstr.prototype, fieldName, {
49
- get() {
50
- // This prototype-level `get` will only ever be called once per instance, b/c when we're
51
- // called for the first/only time, we set an instance-level `this.transientFields` that, for
52
- // all future calls, will resolve to the instance's own copy of the fields.
53
- //
54
- // This has the pleasant upshot of making the instance-level `transientFields` lazy, and
55
- // they will not be created on an instance until they're actually asked for.
56
- const copy = structuredClone(value);
57
- Object.defineProperty(this, "transientFields", { value: copy });
58
- return copy;
59
- },
60
- });
61
- }
62
- }
63
- }
64
- /**
65
- * A function for `has...` methods to integrate with the `newEntity` lazy field system.
66
- *
67
- * We need TypeScript to still see `books = hasMany(...)` as being typed as `Many<Book>`,
68
- * so this method's return type is `R` i.e. the `Many<Book>` relation type.
69
- *
70
- * But at runtime we actually want this to be a `LazyField` that can be rewritten
71
- * into a getter, and only invoked when the relation is actually accessed.
72
- */
73
- function lazyField(fn) {
74
- return new LazyField(fn);
75
- }
76
- /**
77
- * Easily resolves `otherMetadata` fields for lazy relations.
78
- *
79
- * When `lazyRelation`s are initialized for their first/only time, i.e. the `books = hasBooks(authorMetadata)`
80
- * call that `getFakeInstance` does, it's when the class bodies are still being evaled, which is before the
81
- * `metadata.ts` file has run.
82
- *
83
- * This means that any `authorMetadata` consts would still be undefined.
84
- *
85
- * So instead we just do not bother passing metadata consts to `has...` methods, and instead let the methods
86
- * one-time resolve `otherMetadata` on their first invocation, which will be after the `metadata.ts` file has
87
- * finished importing, and the consts are all defined.
88
- */
89
- function resolveOtherMeta(entity, fieldName) {
90
- const meta = (0, EntityMetadata_1.getMetadata)(entity);
91
- const field = meta.allFields[fieldName] ?? (0, utils_1.fail)(`Could not find field ${meta.type}.${fieldName}`);
92
- return field.otherMetadata();
93
- }
94
- /** Wraps `has...` relation constructors in an easily-identifiable container. */
95
- class LazyField {
96
- #fn;
97
- constructor(fn) {
98
- this.#fn = fn;
99
- }
100
- /** Called by our getters to lazily create the relation on first access. */
101
- create(entity, fieldName) {
102
- return this.#fn(entity, fieldName);
103
- }
104
- }
105
- exports.LazyField = LazyField;
106
- //# sourceMappingURL=newEntity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"newEntity.js","sourceRoot":"","sources":["../src/newEntity.ts"],"names":[],"mappings":";;;AAmBA,8BAaC;AAsCD,8BAEC;AAeD,4CAIC;AA3FD,6CAA8C;AAG9C,qDAA+D;AAC/D,mDAAgD;AAChD,mCAA+B;AAE/B,gFAAgF;AAChF,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAElC;;;;;;;;GAQG;AACH,SAAgB,SAAS,CAAmB,EAAiB,EAAE,IAA0B,EAAE,KAAc;IACvG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC;QACrC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAY,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IACnC,CAAC;IACD,MAAM,IAAI,GAAG,IAAA,4BAAW,EAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,IAAI,CAAC,WAAW;QAAE,IAAA,YAAI,EAAC,gDAAgD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACxF,wGAAwG;IACxG,6GAA6G;IAC7G,6CAA6C;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAM,CAAC;IAClD,IAAA,2BAAc,EAAC,EAAE,EAAE,MAAa,EAAE,KAAK,CAAC,CAAC;IACzC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,sBAAsB,CAAC,IAA4B;IAC1D,+BAA+B;IAC/B,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,IAAA,6BAAa,EAAC,IAAA,4BAAW,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAClE,IAA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,CAAwC;IAC3C,YAAY,EAAyC;QACnD,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,MAAS,EAAE,SAAiB;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC;CACF;AAVD,8BAUC"}
@@ -1,193 +0,0 @@
1
- import { Entity } from "./Entity";
2
- import { EntityConstructor, EntityManager, IdOf, MaybeAbstractEntityConstructor } from "./EntityManager";
3
- import { DeepNew, FactoryExtrasOf } from "./index";
4
- import { ActualFactoryOpts, OptsOf } from "./typeMap";
5
- /**
6
- * DeepPartial-esque type specific to our `newTestInstance` factory.
7
- *
8
- * Specifically (vs using DeepPartial directly) this:
9
- *
10
- * 1. Adds a `use` tag of `Entity | Entity[]` that will be checked for existing
11
- * entities before creating new ones (i.e. "if `newTestInstance` needs a `Book`,
12
- * use the one in `use` instead of making a new one).
13
- *
14
- * 2. Works specifically against the constructor/entity opts fields.
15
- */
16
- export type FactoryOpts<T extends Entity> = DeepPartialOpts<T> & {
17
- use?: Entity | Entity[];
18
- useFactoryDefaults?: boolean | "none";
19
- useExistingCheck?: boolean;
20
- useLogging?: boolean;
21
- } & {
22
- [K in keyof FactoryExtrasOf<T>]?: FactoryExtrasOf<T>[K];
23
- };
24
- export declare const testDate: Date;
25
- export declare const testPlainDate: import("temporal-spec").Temporal.PlainDate | undefined;
26
- export declare const testPlainDateTime: import("temporal-spec").Temporal.PlainDateTime | undefined;
27
- export declare const testZonedDateTime: import("temporal-spec").Temporal.ZonedDateTime | undefined;
28
- /**
29
- * Creates a test instance of `T`.
30
- *
31
- * If the factory code passes factoryOpts.useExisting, they can "intercept" the `em.create`
32
- * to try and resolve "already created" / singleton instances. The `useExisting` callback is
33
- * useful b/c the `opts` will be the "resolved-to-entity" opts, and not the raw "maybe object
34
- * literal, maybe object instance" opts that tests pass into the factory.
35
- */
36
- export declare function newTestInstance<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>,
37
- /** The test's test-specific override opts. */
38
- testOpts?: FactoryOpts<T>,
39
- /** The factory file's default opts. */
40
- factoryOpts?: FactoryOpts<T> & {
41
- useExisting?: (opts: OptsOf<T>, existing: DeepNew<T>) => boolean;
42
- }): DeepNew<T>;
43
- /**
44
- * A marker value for later replacement with the test instance's "unique-ish" index.
45
- *
46
- * This is meant to just be a helpful identifier in fields like entity names/descriptions for
47
- * debugging purposes.
48
- */
49
- export declare const testIndex: number;
50
- /**
51
- * A marker value for the default `newTestInstance` behavior.
52
- *
53
- * Useful for passing arguments to `newTestInstance` where you sometimes want to
54
- * provide a specific value, and other times ask for the "pick a default" behavior
55
- * (i.e. you don't want to pass `undefined` b/c that means explicitly "leave this
56
- * key unset").
57
- *
58
- * Note that this is a function so that we can infer the return type as basically
59
- * `any` without really using `any` (which would disable type-checking in the rest
60
- * of the expression).
61
- */
62
- export declare function defaultValue<T>(): T;
63
- /**
64
- * A marker value to never set a field, even if it's required.
65
- *
66
- * The factories treat `{ author: undefined }` as "still set the author", because of how easy
67
- * it is for destructuring/restructuring opts to implicitly set `undefined` values.
68
- *
69
- * If you want to force a field to not be set, you can use `{ author: noValue() }`.
70
- */
71
- export declare function noValue<T>(): T;
72
- /**
73
- * A marker value to accept values only if explicitly created-or-passed within the current,
74
- * unique "branch" of a factory call.
75
- *
76
- * This is useful for "diamond-shape" entity models like:
77
- *
78
- * ```
79
- * ParentGroup <-- ParentItem
80
- * | |
81
- * ChildGroup <-- ChildItem
82
- * ```
83
- *
84
- * Where it's important that the `ChildItem -> ParentItem -> ParentGroup` path matches
85
- * the `ChildItem -> ChildGroup -> ParentGroup` path.
86
- *
87
- * This can be hard to achieve in normal factory behavior, i.e. for a call like:
88
- *
89
- * ```ts
90
- * const c = newChild(em, {
91
- * groups: [
92
- * { childItems: [{}, {}] },
93
- * { childItems: [{}, {}] },
94
- * ],
95
- * });
96
- * ```
97
- *
98
- * The first `ChildGroup` will create a new `ParentGroup` that is used by everything, which
99
- * is not our intent, as both `ChildGroup`s, and all four `ParentItem`s, will live in a single
100
- * `ParentGroup`.
101
- *
102
- * An initial idea is to pass `parentGroup: {}` in the factories, because that turns off "reusing
103
- * existing instances", but for this problem the `{}` approach is "too good" at creating new
104
- * instances, b/c the above diamond pattern will be disconnected.
105
- *
106
- * So `branchValue` provides a middle ground, where _usually_ it will be a new entity, unless
107
- * it was explicitly created within the same "branch" of a factory call.
108
- */
109
- export declare function maybeBranchValue<T>(opts?: ActualFactoryOpts<T>): T;
110
- /**
111
- * Allows a factory to declare that an optional relation should be filled in with an
112
- * "obvious default", or a new entity if one doesn't exist.
113
- *
114
- * This "obvious default or new entity" is what Joist already does for _required_ relations,
115
- * and so `maybeNew` lets the factory tell Joist to apply the same behavior to an optional
116
- * field.
117
- *
118
- * I.e.:
119
- *
120
- * ```typescript
121
- * export function newAuthor(em: Entity, opts: FactoryOpts<Author>) {
122
- * return newTestInstance(em, Author, {
123
- * // this always make a new publisher, unless explicitly overridden by the test,
124
- * // i.e. when each author really needs "their own" publisher.
125
- * publisher: {},
126
- * // this will make a new publisher but first looks for "good defaults" in the
127
- * // test, i.e. an already-created publisher. This is the default behavior of
128
- * // required fields ("look for a good default"), and `maybeNew` lets you tell
129
- * // Joist to invoke that same "maybe new" behavior for an optional field.
130
- * publisher: maybeNew<Publisher>({}),
131
- * ...opts,
132
- * });
133
- * }
134
- * ```
135
- */
136
- export declare function maybeNew<T extends Entity>(opts?: ActualFactoryOpts<T>): FactoryEntityOpt<T>;
137
- /**
138
- * Similar to `maybeNew` in behaviour/use but with enhancements to support polymorphic fields:
139
- * 1) Allows you to specify which entity type to create, if it is found a new one is needed
140
- * 2) Allows you to prioritize which existing entities to select
141
- *
142
- * For example below, we are specifying that an Author should be created if needed (and optionally it's default opts
143
- * in the `ifNewOpts` field), and also that the priority order for choosing existing entities is Author, Book, and then Publisher.
144
- * Note since BookReview is excluded from `existingSearchOrder`, an existing BookReview will never be chosen.
145
- *
146
- * ```typescript
147
- * export function newComment(em: EntityManager, opts: FactoryOpts<Comment> = {}): New<Comment> {
148
- * return newTestInstance(em, Comment, {
149
- * parent: maybeNewPoly<CommentParent, Author>(
150
- * Author, {
151
- * ifNewOpts: { firstName: "optional"},
152
- * existingSearchOrder: [Author, Book, Publisher]
153
- * }),
154
- * ...opts,
155
- * });
156
- * }
157
- * ```
158
- */
159
- export declare function maybeNewPoly<T extends Entity, NewT extends T = T>(ifNewCstr: EntityConstructor<NewT>, opts?: {
160
- ifNewOpts?: ActualFactoryOpts<NewT>;
161
- existingSearchOrder?: MaybeAbstractEntityConstructor<T>[];
162
- }): FactoryEntityOpt<NewT>;
163
- /**
164
- * Returns a unique-ish test index for putting in `name` fields.
165
- *
166
- * Note that `testIndex` is easier to just include in a string, because it doesn't require passing
167
- * the `EntityManger` and `type`. But if a factory really wants the test index as a number, they can
168
- * call this method.
169
- *
170
- * Despite the name, these are 1-based, i.e. the first `Author` is `a1`.
171
- */
172
- export declare function getTestIndex<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>): number;
173
- type DefinedOr<T> = T | undefined | null;
174
- type DeepPartialOpts<T extends Entity> = AllowRelationsOrPartials<OptsOf<T>>;
175
- /** What a factory can accept for a given entity. */
176
- export type FactoryEntityOpt<T extends Entity> = T | IdOf<T> | (ActualFactoryOpts<T> & {
177
- useFactoryDefaults?: boolean | "none";
178
- });
179
- type AllowRelationsOrPartials<T> = {
180
- [P in keyof T]?: T[P] extends DefinedOr<infer U> ? U extends Array<infer V> ? V extends Entity ? Array<FactoryEntityOpt<V>> : T[P] : U extends Entity ? FactoryEntityOpt<U> : T[P] : T[P];
181
- };
182
- export type UseMapSource = "testOpts" | "useOpt" | "sameBranch" | "diffBranch";
183
- /** Enables factory logging for all factories. */
184
- export declare function setFactoryLogging(enabled: boolean): void;
185
- /** Marker for tests setting derived values during test setup. */
186
- export declare class FactoryInitialValue {
187
- readonly value: any;
188
- constructor(value: any);
189
- }
190
- export declare function isFactoryCreation(entity: Entity): boolean;
191
- export declare function resetFactoryCreated(): void;
192
- export {};
193
- //# sourceMappingURL=newTestInstance.d.ts.map