joist-orm 1.294.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.
- package/build/{drivers/PostgresDriver.d.ts → PostgresDriver.d.ts} +1 -4
- package/build/PostgresDriver.d.ts.map +1 -0
- package/build/{drivers/PostgresDriver.js → PostgresDriver.js} +49 -58
- package/build/PostgresDriver.js.map +1 -0
- package/build/codegen.d.ts +2 -0
- package/build/codegen.d.ts.map +1 -0
- package/build/codegen.js +29 -0
- package/build/codegen.js.map +1 -0
- package/build/graphql-codegen-export.d.ts +2 -0
- package/build/graphql-codegen-export.d.ts.map +1 -0
- package/build/{drivers/index.js → graphql-codegen-export.js} +3 -5
- package/build/graphql-codegen-export.js.map +1 -0
- package/build/graphql-export.d.ts +2 -0
- package/build/graphql-export.d.ts.map +1 -0
- package/build/graphql-export.js +19 -0
- package/build/graphql-export.js.map +1 -0
- package/build/index.d.ts +3 -128
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -284
- package/build/index.js.map +1 -1
- package/build/knex-export.d.ts +2 -0
- package/build/knex-export.d.ts.map +1 -0
- package/build/knex-export.js +19 -0
- package/build/knex-export.js.map +1 -0
- package/build/pg-migrate.d.ts +2 -0
- package/build/pg-migrate.d.ts.map +1 -0
- package/build/pg-migrate.js +30 -0
- package/build/pg-migrate.js.map +1 -0
- package/build/postgres-driver.d.ts +2 -0
- package/build/postgres-driver.d.ts.map +1 -0
- package/build/postgres-driver.js +7 -0
- package/build/postgres-driver.js.map +1 -0
- package/build/tests-export.d.ts +2 -0
- package/build/tests-export.d.ts.map +1 -0
- package/build/tests-export.js +19 -0
- package/build/tests-export.js.map +1 -0
- package/package.json +85 -16
- package/build/AliasAssigner.d.ts +0 -7
- package/build/AliasAssigner.d.ts.map +0 -1
- package/build/AliasAssigner.js +0 -30
- package/build/AliasAssigner.js.map +0 -1
- package/build/Aliases.d.ts +0 -110
- package/build/Aliases.d.ts.map +0 -1
- package/build/Aliases.js +0 -456
- package/build/Aliases.js.map +0 -1
- package/build/BaseEntity.d.ts +0 -66
- package/build/BaseEntity.d.ts.map +0 -1
- package/build/BaseEntity.js +0 -120
- package/build/BaseEntity.js.map +0 -1
- package/build/ConditionBuilder.d.ts +0 -50
- package/build/ConditionBuilder.d.ts.map +0 -1
- package/build/ConditionBuilder.js +0 -178
- package/build/ConditionBuilder.js.map +0 -1
- package/build/Entity.d.ts +0 -38
- package/build/Entity.d.ts.map +0 -1
- package/build/Entity.js +0 -8
- package/build/Entity.js.map +0 -1
- package/build/EntityFields.d.ts +0 -37
- package/build/EntityFields.d.ts.map +0 -1
- package/build/EntityFields.js +0 -3
- package/build/EntityFields.js.map +0 -1
- package/build/EntityFilter.d.ts +0 -113
- package/build/EntityFilter.d.ts.map +0 -1
- package/build/EntityFilter.js +0 -3
- package/build/EntityFilter.js.map +0 -1
- package/build/EntityGraphQLFilter.d.ts +0 -51
- package/build/EntityGraphQLFilter.d.ts.map +0 -1
- package/build/EntityGraphQLFilter.js +0 -54
- package/build/EntityGraphQLFilter.js.map +0 -1
- package/build/EntityManager.d.ts +0 -734
- package/build/EntityManager.d.ts.map +0 -1
- package/build/EntityManager.js +0 -2075
- package/build/EntityManager.js.map +0 -1
- package/build/EntityMetadata.d.ts +0 -185
- package/build/EntityMetadata.d.ts.map +0 -1
- package/build/EntityMetadata.js +0 -61
- package/build/EntityMetadata.js.map +0 -1
- package/build/EnumMetadata.d.ts +0 -15
- package/build/EnumMetadata.d.ts.map +0 -1
- package/build/EnumMetadata.js +0 -3
- package/build/EnumMetadata.js.map +0 -1
- package/build/FlushLock.d.ts +0 -26
- package/build/FlushLock.d.ts.map +0 -1
- package/build/FlushLock.js +0 -57
- package/build/FlushLock.js.map +0 -1
- package/build/HintTree.d.ts +0 -42
- package/build/HintTree.d.ts.map +0 -1
- package/build/HintTree.js +0 -64
- package/build/HintTree.js.map +0 -1
- package/build/IndexManager.d.ts +0 -30
- package/build/IndexManager.d.ts.map +0 -1
- package/build/IndexManager.js +0 -206
- package/build/IndexManager.js.map +0 -1
- package/build/InstanceData.d.ts +0 -59
- package/build/InstanceData.d.ts.map +0 -1
- package/build/InstanceData.js +0 -162
- package/build/InstanceData.js.map +0 -1
- package/build/IsLoadedCache.d.ts +0 -32
- package/build/IsLoadedCache.d.ts.map +0 -1
- package/build/IsLoadedCache.js +0 -80
- package/build/IsLoadedCache.js.map +0 -1
- package/build/JoinRows.d.ts +0 -75
- package/build/JoinRows.d.ts.map +0 -1
- package/build/JoinRows.js +0 -246
- package/build/JoinRows.js.map +0 -1
- package/build/PluginManager.d.ts +0 -90
- package/build/PluginManager.d.ts.map +0 -1
- package/build/PluginManager.js +0 -97
- package/build/PluginManager.js.map +0 -1
- package/build/QueryParser.d.ts +0 -271
- package/build/QueryParser.d.ts.map +0 -1
- package/build/QueryParser.js +0 -853
- package/build/QueryParser.js.map +0 -1
- package/build/QueryParser.pruning.d.ts +0 -5
- package/build/QueryParser.pruning.d.ts.map +0 -1
- package/build/QueryParser.pruning.js +0 -118
- package/build/QueryParser.pruning.js.map +0 -1
- package/build/QueryVisitor.d.ts +0 -19
- package/build/QueryVisitor.d.ts.map +0 -1
- package/build/QueryVisitor.js +0 -84
- package/build/QueryVisitor.js.map +0 -1
- package/build/ReactionsManager.d.ts +0 -84
- package/build/ReactionsManager.d.ts.map +0 -1
- package/build/ReactionsManager.js +0 -308
- package/build/ReactionsManager.js.map +0 -1
- package/build/Todo.d.ts +0 -31
- package/build/Todo.d.ts.map +0 -1
- package/build/Todo.js +0 -73
- package/build/Todo.js.map +0 -1
- package/build/caches.d.ts +0 -6
- package/build/caches.d.ts.map +0 -1
- package/build/caches.js +0 -42
- package/build/caches.js.map +0 -1
- package/build/changes.d.ts +0 -79
- package/build/changes.d.ts.map +0 -1
- package/build/changes.js +0 -251
- package/build/changes.js.map +0 -1
- package/build/config.d.ts +0 -237
- package/build/config.d.ts.map +0 -1
- package/build/config.js +0 -298
- package/build/config.js.map +0 -1
- package/build/config.test.d.ts +0 -2
- package/build/config.test.d.ts.map +0 -1
- package/build/config.test.js +0 -53
- package/build/config.test.js.map +0 -1
- package/build/configure.d.ts +0 -13
- package/build/configure.d.ts.map +0 -1
- package/build/configure.js +0 -329
- package/build/configure.js.map +0 -1
- package/build/dataloaders/findByUniqueDataLoader.d.ts +0 -7
- package/build/dataloaders/findByUniqueDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findByUniqueDataLoader.js +0 -47
- package/build/dataloaders/findByUniqueDataLoader.js.map +0 -1
- package/build/dataloaders/findCountDataLoader.d.ts +0 -7
- package/build/dataloaders/findCountDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findCountDataLoader.js +0 -74
- package/build/dataloaders/findCountDataLoader.js.map +0 -1
- package/build/dataloaders/findDataLoader.d.ts +0 -37
- package/build/dataloaders/findDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findDataLoader.js +0 -337
- package/build/dataloaders/findDataLoader.js.map +0 -1
- package/build/dataloaders/findIdsDataLoader.d.ts +0 -7
- package/build/dataloaders/findIdsDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findIdsDataLoader.js +0 -74
- package/build/dataloaders/findIdsDataLoader.js.map +0 -1
- package/build/dataloaders/findOrCreateDataLoader.d.ts +0 -13
- package/build/dataloaders/findOrCreateDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findOrCreateDataLoader.js +0 -174
- package/build/dataloaders/findOrCreateDataLoader.js.map +0 -1
- package/build/dataloaders/lensDataLoader.d.ts +0 -12
- package/build/dataloaders/lensDataLoader.d.ts.map +0 -1
- package/build/dataloaders/lensDataLoader.js +0 -180
- package/build/dataloaders/lensDataLoader.js.map +0 -1
- package/build/dataloaders/loadDataLoader.d.ts +0 -11
- package/build/dataloaders/loadDataLoader.d.ts.map +0 -1
- package/build/dataloaders/loadDataLoader.js +0 -54
- package/build/dataloaders/loadDataLoader.js.map +0 -1
- package/build/dataloaders/manyToManyDataLoader.d.ts +0 -8
- package/build/dataloaders/manyToManyDataLoader.d.ts.map +0 -1
- package/build/dataloaders/manyToManyDataLoader.js +0 -74
- package/build/dataloaders/manyToManyDataLoader.js.map +0 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.ts +0 -8
- package/build/dataloaders/manyToManyFindDataLoader.d.ts.map +0 -1
- package/build/dataloaders/manyToManyFindDataLoader.js +0 -70
- package/build/dataloaders/manyToManyFindDataLoader.js.map +0 -1
- package/build/dataloaders/oneToManyDataLoader.d.ts +0 -7
- package/build/dataloaders/oneToManyDataLoader.d.ts.map +0 -1
- package/build/dataloaders/oneToManyDataLoader.js +0 -60
- package/build/dataloaders/oneToManyDataLoader.js.map +0 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.ts +0 -8
- package/build/dataloaders/oneToManyFindDataLoader.d.ts.map +0 -1
- package/build/dataloaders/oneToManyFindDataLoader.js +0 -71
- package/build/dataloaders/oneToManyFindDataLoader.js.map +0 -1
- package/build/dataloaders/oneToOneDataLoader.d.ts +0 -7
- package/build/dataloaders/oneToOneDataLoader.d.ts.map +0 -1
- package/build/dataloaders/oneToOneDataLoader.js +0 -59
- package/build/dataloaders/oneToOneDataLoader.js.map +0 -1
- package/build/dataloaders/populateDataLoader.d.ts +0 -13
- package/build/dataloaders/populateDataLoader.d.ts.map +0 -1
- package/build/dataloaders/populateDataLoader.js +0 -148
- package/build/dataloaders/populateDataLoader.js.map +0 -1
- package/build/dataloaders/recursiveChildrenDataLoader.d.ts +0 -7
- package/build/dataloaders/recursiveChildrenDataLoader.d.ts.map +0 -1
- package/build/dataloaders/recursiveChildrenDataLoader.js +0 -77
- package/build/dataloaders/recursiveChildrenDataLoader.js.map +0 -1
- package/build/dataloaders/recursiveParentsDataLoader.d.ts +0 -7
- package/build/dataloaders/recursiveParentsDataLoader.d.ts.map +0 -1
- package/build/dataloaders/recursiveParentsDataLoader.js +0 -59
- package/build/dataloaders/recursiveParentsDataLoader.js.map +0 -1
- package/build/defaults.d.ts +0 -54
- package/build/defaults.d.ts.map +0 -1
- package/build/defaults.js +0 -282
- package/build/defaults.js.map +0 -1
- package/build/driverApi.d.ts +0 -19
- package/build/driverApi.d.ts.map +0 -1
- package/build/driverApi.js +0 -17
- package/build/driverApi.js.map +0 -1
- package/build/drivers/Driver.d.ts +0 -26
- package/build/drivers/Driver.d.ts.map +0 -1
- package/build/drivers/Driver.js +0 -3
- package/build/drivers/Driver.js.map +0 -1
- package/build/drivers/EntityWriter.d.ts +0 -64
- package/build/drivers/EntityWriter.d.ts.map +0 -1
- package/build/drivers/EntityWriter.js +0 -237
- package/build/drivers/EntityWriter.js.map +0 -1
- package/build/drivers/IdAssigner.d.ts +0 -50
- package/build/drivers/IdAssigner.d.ts.map +0 -1
- package/build/drivers/IdAssigner.js +0 -133
- package/build/drivers/IdAssigner.js.map +0 -1
- package/build/drivers/PostgresDriver.d.ts.map +0 -1
- package/build/drivers/PostgresDriver.js.map +0 -1
- package/build/drivers/buildRawQuery.d.ts +0 -20
- package/build/drivers/buildRawQuery.d.ts.map +0 -1
- package/build/drivers/buildRawQuery.js +0 -148
- package/build/drivers/buildRawQuery.js.map +0 -1
- package/build/drivers/buildUtils.d.ts +0 -4
- package/build/drivers/buildUtils.d.ts.map +0 -1
- package/build/drivers/buildUtils.js +0 -79
- package/build/drivers/buildUtils.js.map +0 -1
- package/build/drivers/index.d.ts +0 -5
- package/build/drivers/index.d.ts.map +0 -1
- package/build/drivers/index.js.map +0 -1
- package/build/fields.d.ts +0 -24
- package/build/fields.d.ts.map +0 -1
- package/build/fields.js +0 -162
- package/build/fields.js.map +0 -1
- package/build/getProperties.d.ts +0 -28
- package/build/getProperties.d.ts.map +0 -1
- package/build/getProperties.js +0 -141
- package/build/getProperties.js.map +0 -1
- package/build/json.d.ts +0 -77
- package/build/json.d.ts.map +0 -1
- package/build/json.js +0 -116
- package/build/json.js.map +0 -1
- package/build/k.d.ts +0 -2
- package/build/k.d.ts.map +0 -1
- package/build/k.js +0 -9
- package/build/k.js.map +0 -1
- package/build/keys.d.ts +0 -49
- package/build/keys.d.ts.map +0 -1
- package/build/keys.js +0 -195
- package/build/keys.js.map +0 -1
- package/build/keywords.d.ts +0 -5
- package/build/keywords.d.ts.map +0 -1
- package/build/keywords.js +0 -124
- package/build/keywords.js.map +0 -1
- package/build/loadHints.d.ts +0 -112
- package/build/loadHints.d.ts.map +0 -1
- package/build/loadHints.js +0 -75
- package/build/loadHints.js.map +0 -1
- package/build/loadLens.d.ts +0 -66
- package/build/loadLens.d.ts.map +0 -1
- package/build/loadLens.js +0 -287
- package/build/loadLens.js.map +0 -1
- package/build/logging/FactoryLogger.d.ts +0 -24
- package/build/logging/FactoryLogger.d.ts.map +0 -1
- package/build/logging/FactoryLogger.js +0 -77
- package/build/logging/FactoryLogger.js.map +0 -1
- package/build/logging/FieldLogger.d.ts +0 -27
- package/build/logging/FieldLogger.d.ts.map +0 -1
- package/build/logging/FieldLogger.js +0 -69
- package/build/logging/FieldLogger.js.map +0 -1
- package/build/logging/ReactionLogger.d.ts +0 -23
- package/build/logging/ReactionLogger.d.ts.map +0 -1
- package/build/logging/ReactionLogger.js +0 -65
- package/build/logging/ReactionLogger.js.map +0 -1
- package/build/newEntity.d.ts +0 -45
- package/build/newEntity.d.ts.map +0 -1
- package/build/newEntity.js +0 -106
- package/build/newEntity.js.map +0 -1
- package/build/newTestInstance.d.ts +0 -193
- package/build/newTestInstance.d.ts.map +0 -1
- package/build/newTestInstance.js +0 -738
- package/build/newTestInstance.js.map +0 -1
- package/build/normalizeHints.d.ts +0 -16
- package/build/normalizeHints.d.ts.map +0 -1
- package/build/normalizeHints.js +0 -31
- package/build/normalizeHints.js.map +0 -1
- package/build/plugins/ImmutableEntitiesPlugin.d.ts +0 -9
- package/build/plugins/ImmutableEntitiesPlugin.d.ts.map +0 -1
- package/build/plugins/ImmutableEntitiesPlugin.js +0 -21
- package/build/plugins/ImmutableEntitiesPlugin.js.map +0 -1
- package/build/plugins/PreloadPlugin.d.ts +0 -69
- package/build/plugins/PreloadPlugin.d.ts.map +0 -1
- package/build/plugins/PreloadPlugin.js +0 -3
- package/build/plugins/PreloadPlugin.js.map +0 -1
- package/build/preloading/JsonAggregatePreloader.d.ts +0 -16
- package/build/preloading/JsonAggregatePreloader.d.ts.map +0 -1
- package/build/preloading/JsonAggregatePreloader.js +0 -238
- package/build/preloading/JsonAggregatePreloader.js.map +0 -1
- package/build/preloading/canPreload.d.ts +0 -3
- package/build/preloading/canPreload.d.ts.map +0 -1
- package/build/preloading/canPreload.js +0 -21
- package/build/preloading/canPreload.js.map +0 -1
- package/build/preloading/partitionHint.d.ts +0 -5
- package/build/preloading/partitionHint.d.ts.map +0 -1
- package/build/preloading/partitionHint.js +0 -56
- package/build/preloading/partitionHint.js.map +0 -1
- package/build/reactiveHints.d.ts +0 -129
- package/build/reactiveHints.d.ts.map +0 -1
- package/build/reactiveHints.js +0 -458
- package/build/reactiveHints.js.map +0 -1
- package/build/relations/AbstractPropertyImpl.d.ts +0 -8
- package/build/relations/AbstractPropertyImpl.d.ts.map +0 -1
- package/build/relations/AbstractPropertyImpl.js +0 -15
- package/build/relations/AbstractPropertyImpl.js.map +0 -1
- package/build/relations/AbstractRelationImpl.d.ts +0 -36
- package/build/relations/AbstractRelationImpl.d.ts.map +0 -1
- package/build/relations/AbstractRelationImpl.js +0 -19
- package/build/relations/AbstractRelationImpl.js.map +0 -1
- package/build/relations/Collection.d.ts +0 -28
- package/build/relations/Collection.d.ts.map +0 -1
- package/build/relations/Collection.js +0 -18
- package/build/relations/Collection.js.map +0 -1
- package/build/relations/CustomCollection.d.ts +0 -69
- package/build/relations/CustomCollection.d.ts.map +0 -1
- package/build/relations/CustomCollection.js +0 -166
- package/build/relations/CustomCollection.js.map +0 -1
- package/build/relations/CustomReference.d.ts +0 -71
- package/build/relations/CustomReference.d.ts.map +0 -1
- package/build/relations/CustomReference.js +0 -152
- package/build/relations/CustomReference.js.map +0 -1
- package/build/relations/LargeCollection.d.ts +0 -19
- package/build/relations/LargeCollection.d.ts.map +0 -1
- package/build/relations/LargeCollection.js +0 -3
- package/build/relations/LargeCollection.js.map +0 -1
- package/build/relations/ManyToManyCollection.d.ts +0 -44
- package/build/relations/ManyToManyCollection.d.ts.map +0 -1
- package/build/relations/ManyToManyCollection.js +0 -268
- package/build/relations/ManyToManyCollection.js.map +0 -1
- package/build/relations/ManyToManyLargeCollection.d.ts +0 -30
- package/build/relations/ManyToManyLargeCollection.d.ts.map +0 -1
- package/build/relations/ManyToManyLargeCollection.js +0 -119
- package/build/relations/ManyToManyLargeCollection.js.map +0 -1
- package/build/relations/ManyToOneReference.d.ts +0 -121
- package/build/relations/ManyToOneReference.d.ts.map +0 -1
- package/build/relations/ManyToOneReference.js +0 -389
- package/build/relations/ManyToOneReference.js.map +0 -1
- package/build/relations/OneToManyCollection.d.ts +0 -58
- package/build/relations/OneToManyCollection.d.ts.map +0 -1
- package/build/relations/OneToManyCollection.js +0 -347
- package/build/relations/OneToManyCollection.js.map +0 -1
- package/build/relations/OneToManyLargeCollection.d.ts +0 -26
- package/build/relations/OneToManyLargeCollection.d.ts.map +0 -1
- package/build/relations/OneToManyLargeCollection.js +0 -102
- package/build/relations/OneToManyLargeCollection.js.map +0 -1
- package/build/relations/OneToOneReference.d.ts +0 -93
- package/build/relations/OneToOneReference.d.ts.map +0 -1
- package/build/relations/OneToOneReference.js +0 -228
- package/build/relations/OneToOneReference.js.map +0 -1
- package/build/relations/PolymorphicReference.d.ts +0 -89
- package/build/relations/PolymorphicReference.d.ts.map +0 -1
- package/build/relations/PolymorphicReference.js +0 -244
- package/build/relations/PolymorphicReference.js.map +0 -1
- package/build/relations/ReactiveField.d.ts +0 -87
- package/build/relations/ReactiveField.d.ts.map +0 -1
- package/build/relations/ReactiveField.js +0 -149
- package/build/relations/ReactiveField.js.map +0 -1
- package/build/relations/ReactiveGetter.d.ts +0 -30
- package/build/relations/ReactiveGetter.d.ts.map +0 -1
- package/build/relations/ReactiveGetter.js +0 -38
- package/build/relations/ReactiveGetter.js.map +0 -1
- package/build/relations/ReactiveManyToMany.d.ts +0 -56
- package/build/relations/ReactiveManyToMany.d.ts.map +0 -1
- package/build/relations/ReactiveManyToMany.js +0 -243
- package/build/relations/ReactiveManyToMany.js.map +0 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.ts +0 -47
- package/build/relations/ReactiveManyToManyOtherSide.d.ts.map +0 -1
- package/build/relations/ReactiveManyToManyOtherSide.js +0 -155
- package/build/relations/ReactiveManyToManyOtherSide.js.map +0 -1
- package/build/relations/ReactiveQueryField.d.ts +0 -41
- package/build/relations/ReactiveQueryField.d.ts.map +0 -1
- package/build/relations/ReactiveQueryField.js +0 -125
- package/build/relations/ReactiveQueryField.js.map +0 -1
- package/build/relations/ReactiveReference.d.ts +0 -119
- package/build/relations/ReactiveReference.d.ts.map +0 -1
- package/build/relations/ReactiveReference.js +0 -333
- package/build/relations/ReactiveReference.js.map +0 -1
- package/build/relations/ReadOnlyCollection.d.ts +0 -19
- package/build/relations/ReadOnlyCollection.d.ts.map +0 -1
- package/build/relations/ReadOnlyCollection.js +0 -15
- package/build/relations/ReadOnlyCollection.js.map +0 -1
- package/build/relations/RecursiveCollection.d.ts +0 -84
- package/build/relations/RecursiveCollection.d.ts.map +0 -1
- package/build/relations/RecursiveCollection.js +0 -296
- package/build/relations/RecursiveCollection.js.map +0 -1
- package/build/relations/Reference.d.ts +0 -35
- package/build/relations/Reference.d.ts.map +0 -1
- package/build/relations/Reference.js +0 -21
- package/build/relations/Reference.js.map +0 -1
- package/build/relations/Relation.d.ts +0 -14
- package/build/relations/Relation.d.ts.map +0 -1
- package/build/relations/Relation.js +0 -12
- package/build/relations/Relation.js.map +0 -1
- package/build/relations/hasAsyncMethod.d.ts +0 -27
- package/build/relations/hasAsyncMethod.d.ts.map +0 -1
- package/build/relations/hasAsyncMethod.js +0 -47
- package/build/relations/hasAsyncMethod.js.map +0 -1
- package/build/relations/hasAsyncProperty.d.ts +0 -49
- package/build/relations/hasAsyncProperty.d.ts.map +0 -1
- package/build/relations/hasAsyncProperty.js +0 -98
- package/build/relations/hasAsyncProperty.js.map +0 -1
- package/build/relations/hasManyDerived.d.ts +0 -22
- package/build/relations/hasManyDerived.d.ts.map +0 -1
- package/build/relations/hasManyDerived.js +0 -32
- package/build/relations/hasManyDerived.js.map +0 -1
- package/build/relations/hasManyThrough.d.ts +0 -10
- package/build/relations/hasManyThrough.d.ts.map +0 -1
- package/build/relations/hasManyThrough.js +0 -24
- package/build/relations/hasManyThrough.js.map +0 -1
- package/build/relations/hasOneDerived.d.ts +0 -12
- package/build/relations/hasOneDerived.d.ts.map +0 -1
- package/build/relations/hasOneDerived.js +0 -24
- package/build/relations/hasOneDerived.js.map +0 -1
- package/build/relations/hasOneThrough.d.ts +0 -10
- package/build/relations/hasOneThrough.d.ts.map +0 -1
- package/build/relations/hasOneThrough.js +0 -24
- package/build/relations/hasOneThrough.js.map +0 -1
- package/build/relations/index.d.ts +0 -28
- package/build/relations/index.d.ts.map +0 -1
- package/build/relations/index.js +0 -88
- package/build/relations/index.js.map +0 -1
- package/build/rules.d.ts +0 -123
- package/build/rules.d.ts.map +0 -1
- package/build/rules.js +0 -231
- package/build/rules.js.map +0 -1
- package/build/runtimeConfig.d.ts +0 -17
- package/build/runtimeConfig.d.ts.map +0 -1
- package/build/runtimeConfig.js +0 -18
- package/build/runtimeConfig.js.map +0 -1
- package/build/serde.d.ts +0 -277
- package/build/serde.d.ts.map +0 -1
- package/build/serde.js +0 -517
- package/build/serde.js.map +0 -1
- package/build/temporal.d.ts +0 -16
- package/build/temporal.d.ts.map +0 -1
- package/build/temporal.js +0 -48
- package/build/temporal.js.map +0 -1
- package/build/temporalMappers.d.ts +0 -25
- package/build/temporalMappers.d.ts.map +0 -1
- package/build/temporalMappers.js +0 -59
- package/build/temporalMappers.js.map +0 -1
- package/build/typeMap.d.ts +0 -68
- package/build/typeMap.d.ts.map +0 -1
- package/build/typeMap.js +0 -3
- package/build/typeMap.js.map +0 -1
- package/build/unnest.d.ts +0 -13
- package/build/unnest.d.ts.map +0 -1
- package/build/unnest.js +0 -85
- package/build/unnest.js.map +0 -1
- package/build/upsert.d.ts +0 -42
- package/build/upsert.d.ts.map +0 -1
- package/build/upsert.js +0 -265
- package/build/upsert.js.map +0 -1
- package/build/utils.d.ts +0 -58
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js +0 -236
- package/build/utils.js.map +0 -1
- package/build/withLoaded.d.ts +0 -56
- package/build/withLoaded.d.ts.map +0 -1
- package/build/withLoaded.js +0 -76
- package/build/withLoaded.js.map +0 -1
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oneToManyFindOperation = void 0;
|
|
4
|
-
exports.oneToManyFindDataLoader = oneToManyFindDataLoader;
|
|
5
|
-
const index_1 = require("../index");
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
exports.oneToManyFindOperation = "o2m-find";
|
|
8
|
-
/** Batches o2m.find/include calls (i.e. that don't fully load the o2m relation). */
|
|
9
|
-
function oneToManyFindDataLoader(em, collection) {
|
|
10
|
-
const { meta } = collection;
|
|
11
|
-
const batchKey = `${meta.tableName}-${collection.fieldName}`;
|
|
12
|
-
return em.getLoader(exports.oneToManyFindOperation, batchKey, async (keys) => {
|
|
13
|
-
const { em } = collection.entity;
|
|
14
|
-
const meta = collection.otherMeta;
|
|
15
|
-
const alias = (0, utils_1.abbreviation)(meta.tableName);
|
|
16
|
-
const query = {
|
|
17
|
-
selects: [`"${alias}".*`],
|
|
18
|
-
tables: [{ alias, join: "primary", table: meta.tableName }],
|
|
19
|
-
// Or together `where (id = X and book_id = Y)`
|
|
20
|
-
condition: {
|
|
21
|
-
kind: "exp",
|
|
22
|
-
op: "or",
|
|
23
|
-
conditions: keys.map((key) => {
|
|
24
|
-
const [one, two] = key.split(",");
|
|
25
|
-
// columnOne is the `id=`, so is really the "other" side of the o2m
|
|
26
|
-
const [columnOne, idOne] = one.split("=");
|
|
27
|
-
const [columnTwo, idTwo] = two.split("=");
|
|
28
|
-
const [meta1, meta2] = [collection.otherMeta, collection.meta];
|
|
29
|
-
// Pick the right meta i.e. tag_id --> TagMeta or book_id --> BookMeta
|
|
30
|
-
return {
|
|
31
|
-
kind: "exp",
|
|
32
|
-
op: "and",
|
|
33
|
-
conditions: [
|
|
34
|
-
{
|
|
35
|
-
kind: "column",
|
|
36
|
-
alias,
|
|
37
|
-
column: columnOne,
|
|
38
|
-
dbType: meta1.idDbType,
|
|
39
|
-
cond: { kind: "eq", value: (0, index_1.keyToNumber)(meta1, idOne) },
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
kind: "column",
|
|
43
|
-
alias,
|
|
44
|
-
column: columnTwo,
|
|
45
|
-
dbType: meta2.idDbType,
|
|
46
|
-
cond: { kind: "eq", value: (0, index_1.keyToNumber)(meta2, idTwo) },
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
orderBys: [{ alias, column: "id", order: "ASC" }],
|
|
53
|
-
};
|
|
54
|
-
(0, index_1.addTablePerClassJoinsAndClassTag)(query, meta, alias, true);
|
|
55
|
-
// Skip maybeAddOrderBy b/c we're only returning 1 result
|
|
56
|
-
// maybeAddNotSoftDeleted(conditions, meta, alias, "include");
|
|
57
|
-
const rows = await em["executeFind"](collection.otherMeta, exports.oneToManyFindOperation, query, {});
|
|
58
|
-
em.hydrate(collection.otherMeta.cstr, rows);
|
|
59
|
-
// Decode `id=b:1,author_id=a:1`
|
|
60
|
-
return keys.map((k) => {
|
|
61
|
-
const [otherKey, parentKey] = k.split(",");
|
|
62
|
-
const [, otherId] = otherKey.split("=");
|
|
63
|
-
const [, parentId] = parentKey.split("=");
|
|
64
|
-
const other = em.getEntity(otherId);
|
|
65
|
-
// We have may fetched `other` for a different parent in our batch
|
|
66
|
-
const isMine = other?.[collection.otherFieldName].id === parentId;
|
|
67
|
-
return isMine ? other : undefined;
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=oneToManyFindDataLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oneToManyFindDataLoader.js","sourceRoot":"","sources":["../../src/dataloaders/oneToManyFindDataLoader.ts"],"names":[],"mappings":";;;AAeA,0DAoEC;AAhFD,oCAMkB;AAClB,oCAAwC;AAE3B,QAAA,sBAAsB,GAAG,UAAU,CAAC;AAEjD,oFAAoF;AACpF,SAAgB,uBAAuB,CACrC,EAAiB,EACjB,UAAsE;IAEtE,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;IAC5B,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;IAC7D,OAAO,EAAE,CAAC,SAAS,CAAC,8BAAsB,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACnE,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;QAEjC,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC;QAClC,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAoB;YAC7B,OAAO,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC;YACzB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;YAC3D,+CAA+C;YAC/C,SAAS,EAAE;gBACT,IAAI,EAAE,KAAK;gBACX,EAAE,EAAE,IAAI;gBACR,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBAC3B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAClC,mEAAmE;oBACnE,MAAM,CAAC,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AO,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE5C,gCAAgC;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACpB,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3C,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxC,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC1C,MAAM,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAM,CAAC;YACzC,kEAAkE;YAClE,MAAM,MAAM,GAAI,KAAa,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC;YAC3E,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import DataLoader from "dataloader";
|
|
2
|
-
import { Entity } from "../Entity";
|
|
3
|
-
import { EntityManager } from "../EntityManager";
|
|
4
|
-
import { OneToOneReferenceImpl } from "../relations/OneToOneReference";
|
|
5
|
-
export declare const oneToOneLoadOperation = "o2o-load";
|
|
6
|
-
export declare function oneToOneDataLoader<T extends Entity, U extends Entity>(em: EntityManager, reference: OneToOneReferenceImpl<T, U>): DataLoader<string, U | undefined>;
|
|
7
|
-
//# sourceMappingURL=oneToOneDataLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oneToOneDataLoader.d.ts","sourceRoot":"","sources":["../../src/dataloaders/oneToOneDataLoader.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAUjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EACnE,EAAE,EAAE,aAAa,EACjB,SAAS,EAAE,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,GACrC,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAoDnC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oneToOneLoadOperation = void 0;
|
|
4
|
-
exports.oneToOneDataLoader = oneToOneDataLoader;
|
|
5
|
-
const EntityMetadata_1 = require("../EntityMetadata");
|
|
6
|
-
const fields_1 = require("../fields");
|
|
7
|
-
const index_1 = require("../index");
|
|
8
|
-
const utils_1 = require("../utils");
|
|
9
|
-
exports.oneToOneLoadOperation = "o2o-load";
|
|
10
|
-
function oneToOneDataLoader(em, reference) {
|
|
11
|
-
// The metadata for the entity that contains the reference, i.e. Author.image is the o2o,
|
|
12
|
-
// and (otherMeta/otherFieldName) Image.author is the physical m2o/FK column.
|
|
13
|
-
const meta = (0, EntityMetadata_1.getMetadata)(reference.entity);
|
|
14
|
-
const batchKey = `${meta.tableName}-${reference.fieldName}`;
|
|
15
|
-
return em.getLoader(exports.oneToOneLoadOperation, batchKey, async (_keys) => {
|
|
16
|
-
const { otherMeta, otherFieldName } = reference;
|
|
17
|
-
(0, index_1.assertIdsAreTagged)(_keys);
|
|
18
|
-
const keys = (0, index_1.deTagIds)(meta, _keys);
|
|
19
|
-
const alias = (0, utils_1.abbreviation)(otherMeta.tableName);
|
|
20
|
-
const o2o = meta.allFields[reference.fieldName];
|
|
21
|
-
const other = otherMeta.allFields[reference.otherFieldName];
|
|
22
|
-
const query = {
|
|
23
|
-
selects: [`"${alias}".*`],
|
|
24
|
-
tables: [{ alias, join: "primary", table: otherMeta.tableName }],
|
|
25
|
-
condition: {
|
|
26
|
-
kind: "exp",
|
|
27
|
-
op: "and",
|
|
28
|
-
conditions: [
|
|
29
|
-
{
|
|
30
|
-
kind: "column",
|
|
31
|
-
alias: `${alias}${other.aliasSuffix}`,
|
|
32
|
-
column: o2o.otherColumnName,
|
|
33
|
-
dbType: meta.idDbType,
|
|
34
|
-
cond: { kind: "in", value: keys },
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
orderBys: [],
|
|
39
|
-
};
|
|
40
|
-
(0, index_1.addTablePerClassJoinsAndClassTag)(query, otherMeta, alias, true);
|
|
41
|
-
const { em } = reference.entity;
|
|
42
|
-
const rows = await em["executeFind"](otherMeta, exports.oneToOneLoadOperation, query, {});
|
|
43
|
-
const entities = em.hydrate(otherMeta.cstr, rows);
|
|
44
|
-
const entitiesByOtherId = (0, utils_1.groupBy)(entities, (entity) => {
|
|
45
|
-
// TODO If this came from the UoW, it may not be an id? I.e. pre-insert.
|
|
46
|
-
const ownerId = (0, index_1.maybeResolveReferenceToId)((0, fields_1.getField)(entity, otherFieldName));
|
|
47
|
-
// We almost always expect ownerId to be found, b/c normally we just hydrated this entity
|
|
48
|
-
// directly from a SQL row with owner_id=X, however we might be loading this reference
|
|
49
|
-
// (i.e. find all children where owner_id=X) when the SQL thinks a child is still pointing
|
|
50
|
-
// at the parent (i.e. owner_id=X in the db), but our already-loaded child has had its
|
|
51
|
-
// `child.owner` field either changed to some other owner, or set to undefined. In either,
|
|
52
|
-
// that child should no longer be parent of this owner's collection, so just return a
|
|
53
|
-
// dummy value.
|
|
54
|
-
return ownerId ?? "dummyNoLongerOwned";
|
|
55
|
-
});
|
|
56
|
-
return _keys.map((k) => entitiesByOtherId.get(k)?.[0]);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=oneToOneDataLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oneToOneDataLoader.js","sourceRoot":"","sources":["../../src/dataloaders/oneToOneDataLoader.ts"],"names":[],"mappings":";;;AAiBA,gDAuDC;AArED,sDAA+D;AAC/D,sCAAqC;AACrC,oCAMkB;AAElB,oCAAiD;AAEpC,QAAA,qBAAqB,GAAG,UAAU,CAAC;AAEhD,SAAgB,kBAAkB,CAChC,EAAiB,EACjB,SAAsC;IAEtC,yFAAyF;IACzF,6EAA6E;IAC7E,MAAM,IAAI,GAAG,IAAA,4BAAW,EAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;IAC5D,OAAO,EAAE,CAAC,SAAS,CAAC,6BAAqB,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACnE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;QAEhD,IAAA,0BAAkB,EAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEnC,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAkB,CAAC;QACjE,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,KAAK,GAAoB;YAC7B,OAAO,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC;YACzB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,SAAS,EAAE,C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C;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import DataLoader from "dataloader";
|
|
2
|
-
import { Entity } from "../Entity";
|
|
3
|
-
import { EntityMetadata } from "../EntityMetadata";
|
|
4
|
-
import { EntityManager } from "../index";
|
|
5
|
-
import { LoadHint } from "../loadHints";
|
|
6
|
-
export declare const populateOperation = "populate";
|
|
7
|
-
export declare function populateDataLoader(em: EntityManager, meta: EntityMetadata, hint: LoadHint<any>, mode: "preload" | "intermixed", opts?: {
|
|
8
|
-
forceReload?: boolean;
|
|
9
|
-
}): DataLoader<{
|
|
10
|
-
entity: Entity;
|
|
11
|
-
hint: LoadHint<any>;
|
|
12
|
-
}, any>;
|
|
13
|
-
//# sourceMappingURL=populateDataLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"populateDataLoader.d.ts","sourceRoot":"","sources":["../../src/dataloaders/populateDataLoader.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAEL,aAAa,EAOd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,aAAa,EACjB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,EACnB,IAAI,EAAE,SAAS,GAAG,YAAY,EAC9B,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACnC,UAAU,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAA;CAAE,EAAE,GAAG,CAAC,CAmJ1D"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.populateOperation = void 0;
|
|
4
|
-
exports.populateDataLoader = populateDataLoader;
|
|
5
|
-
const HintTree_1 = require("../HintTree");
|
|
6
|
-
const index_1 = require("../index");
|
|
7
|
-
const reactiveHints_1 = require("../reactiveHints");
|
|
8
|
-
const ReactiveField_1 = require("../relations/ReactiveField");
|
|
9
|
-
const utils_1 = require("../utils");
|
|
10
|
-
exports.populateOperation = "populate";
|
|
11
|
-
function populateDataLoader(em, meta, hint, mode, opts = {}) {
|
|
12
|
-
// For batching populates, we want different levels of course-ness:
|
|
13
|
-
// - preloading populates that are only SQL should be batched together as much as possible, but
|
|
14
|
-
// - intermixed populates (some with custom relations) should be batched as separately as possible
|
|
15
|
-
// (while still batching identical populates together) to reduce the chance of promise deadlocks.
|
|
16
|
-
//
|
|
17
|
-
// I.e. if we know this is a sql-only hint, we can batch all loads for a given entity
|
|
18
|
-
// together do leverage join-based preloading.
|
|
19
|
-
//
|
|
20
|
-
// However, intermixed batches can be prone to promise deadlocking (one relation .load getting
|
|
21
|
-
// stuck in a batch that is asking for its own dependencies to load), so if this is an intermixed
|
|
22
|
-
// hint, then use a batch key that includes the hint itself, which will make it unlikely
|
|
23
|
-
// for non-sql relations to deadlock on each other/themselves.
|
|
24
|
-
const batchKey = mode === "preload"
|
|
25
|
-
? `${meta.tagName}:${opts.forceReload}`
|
|
26
|
-
: `${meta.tagName}:${JSON.stringify(hint)}:${opts.forceReload}`;
|
|
27
|
-
return em.getLoader(exports.populateOperation, batchKey, async (populates) => {
|
|
28
|
-
async function populateLayer(layerMeta, layerNode) {
|
|
29
|
-
// Skip join-based preloading if nothing in this layer needs loading. If any entity in the list
|
|
30
|
-
// needs loading, just load everything
|
|
31
|
-
const { preloader } = (0, index_1.getEmInternalApi)(em);
|
|
32
|
-
// We may not have a layerMeta if we're going through non-field properties
|
|
33
|
-
if (preloader && layerMeta) {
|
|
34
|
-
const preloadThisLayer = Object.entries(layerNode.hints).some(([key, hint]) => {
|
|
35
|
-
return [...hint.entities].some((entity) => !!entity[key] && !entity[key].isLoaded && !entity[key].isPreloaded);
|
|
36
|
-
});
|
|
37
|
-
if (preloadThisLayer) {
|
|
38
|
-
// Do an up-front SQL call of `select id, ...preloads... from table`,
|
|
39
|
-
const assigner = new index_1.AliasAssigner();
|
|
40
|
-
const meta = layerMeta;
|
|
41
|
-
const alias = assigner.getAlias(meta.tableName);
|
|
42
|
-
const entities = [...layerNode.entities].filter((e) => !e.isNewEntity);
|
|
43
|
-
const ids = entities.map((e) => (0, index_1.keyToNumber)(meta, e.id));
|
|
44
|
-
// Create a ParsedFindQuery for `addPreloading` to inject joins into
|
|
45
|
-
const query = {
|
|
46
|
-
// We already have the entities loaded, so can do just `SELECT a.id` + the preload columns
|
|
47
|
-
selects: [(0, index_1.kqDot)(alias, "id")],
|
|
48
|
-
tables: [{ alias, join: "primary", table: meta.tableName }],
|
|
49
|
-
condition: {
|
|
50
|
-
kind: "exp",
|
|
51
|
-
op: "and",
|
|
52
|
-
conditions: [
|
|
53
|
-
{ kind: "column", alias, column: "id", dbType: meta.idDbType, cond: { kind: "in", value: ids } },
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
orderBys: [],
|
|
57
|
-
};
|
|
58
|
-
// If we're selecting from small_publishers, join in our base class in case
|
|
59
|
-
// the preloader wants to join on a column like `publishers.group_id`
|
|
60
|
-
(0, index_1.addTablePerClassJoinsAndClassTag)(query, meta, alias, false);
|
|
61
|
-
const hydrator = preloader.addPreloading(meta, layerNode, query);
|
|
62
|
-
if (hydrator) {
|
|
63
|
-
const rows = await em["executeFind"](meta, exports.populateOperation, query, {});
|
|
64
|
-
const entitiesById = (0, index_1.indexBy)(entities, (e) => (0, index_1.keyToNumber)(meta, e.id));
|
|
65
|
-
const entitiesInOrder = rows.map((row) => entitiesById.get(row["id"]));
|
|
66
|
-
hydrator(rows, entitiesInOrder);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// One breadth-width pass (only 1 level deep, our 2nd pass recurses) to ensure each relation is loaded
|
|
71
|
-
const loadPromises = Object.entries(layerNode.hints).flatMap(([key, tree]) => {
|
|
72
|
-
return [...tree.entities].map((entity) => {
|
|
73
|
-
const relation = (0, reactiveHints_1.getRelationFromMaybePolyKey)(entity, key);
|
|
74
|
-
// This happens to let through non-relation hints like 'name' on user, which wasn't intentional,
|
|
75
|
-
// but currently doesn't blow up (somehow), and is not depended on by internal tests.
|
|
76
|
-
if (!relation || typeof relation.load !== "function") {
|
|
77
|
-
// We don't want to throw on poly hints, because they're not actually loaded on the entity
|
|
78
|
-
if ((0, reactiveHints_1.isPolyHint)(key))
|
|
79
|
-
return;
|
|
80
|
-
throw new Error(`Invalid load hint '${key}' on ${entity}`);
|
|
81
|
-
}
|
|
82
|
-
// If we're populating a hasReactiveField, don't bother loading it
|
|
83
|
-
// if it's already been calculated (i.e. we have no reason to believe its value
|
|
84
|
-
// is stale, so we should avoid pulling all of its data into memory).
|
|
85
|
-
//
|
|
86
|
-
// (Note that we can't do this same optimization for ReactiveReferenceImpl, because
|
|
87
|
-
// as a FK, it will always need at least some `.load()` to fetch its entity from the database.
|
|
88
|
-
// So we go ahead and call `.load()`, assuming it will just load its cached value, but it
|
|
89
|
-
// will also check internally if it's marked for recalc, and load its load hint if necessary.
|
|
90
|
-
if (relation instanceof ReactiveField_1.ReactiveFieldImpl && relation.isSet)
|
|
91
|
-
return;
|
|
92
|
-
if (relation.isLoaded && !opts.forceReload)
|
|
93
|
-
return undefined;
|
|
94
|
-
// Avoid creating a promise for preloaded relations
|
|
95
|
-
if (relation.isPreloaded) {
|
|
96
|
-
relation.preload();
|
|
97
|
-
return undefined;
|
|
98
|
-
}
|
|
99
|
-
return relation.load(opts);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
// 2nd breadth-width pass to do nested load hints, this will fan out at the sibling level.
|
|
103
|
-
// i.e. populateLayer(...reviews...) & populateLayer(...comments...)
|
|
104
|
-
return Promise.all(loadPromises).then(() => {
|
|
105
|
-
// Each of these keys will be fanning out to a new entity, like book -> reviews or book -> comments
|
|
106
|
-
const nestedLoadPromises = Object.entries(layerNode.hints).map(([key, tree]) => {
|
|
107
|
-
if (Object.keys(tree.hints).length === 0)
|
|
108
|
-
return;
|
|
109
|
-
// Get the children we found, i.e. [a1, a2, a3] -> all of their books
|
|
110
|
-
const childrenByParent = new Map([...tree.entities].map((entity) => {
|
|
111
|
-
const relation = (0, reactiveHints_1.getRelationFromMaybePolyKey)(entity, key);
|
|
112
|
-
return [entity, relation ? (0, utils_1.toArray)(getEvenDeleted(relation)) : []];
|
|
113
|
-
}));
|
|
114
|
-
if (childrenByParent.size === 0)
|
|
115
|
-
return;
|
|
116
|
-
// Rewrite our node.entities to be the next layer of children, i.e. children will be all books, for all of
|
|
117
|
-
// `[a1, a2, a3]`, but only the books of `a2` need to recurse into `book: reviews` and only the books of
|
|
118
|
-
// `a3` need to recurse into `book: comments`, so swap `node.entities` (which is currently authors)
|
|
119
|
-
// with the books. This is what prevents our dataloader-merged TreeHint from over-fetching and loading
|
|
120
|
-
// the superset load hint for all entities.
|
|
121
|
-
function rewrite(node) {
|
|
122
|
-
node.entities = new Set(Array.from(node.entities).flatMap((entity) => childrenByParent.get(entity) ?? []));
|
|
123
|
-
Object.values(node.hints).forEach((node) => rewrite(node));
|
|
124
|
-
}
|
|
125
|
-
rewrite(tree);
|
|
126
|
-
const nextMeta = layerMeta?.allFields[key]?.otherMetadata?.();
|
|
127
|
-
return populateLayer(nextMeta, tree);
|
|
128
|
-
});
|
|
129
|
-
return Promise.all(nestedLoadPromises);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return populateLayer(meta, (0, HintTree_1.buildHintTree)(populates)).then(() => populates);
|
|
133
|
-
},
|
|
134
|
-
// We always disable caching, because during a UoW, having called `populate(author, nestedHint1)`
|
|
135
|
-
// once doesn't mean that, on the 2nd call to `populate(author, nestedHint1)`, we can completely
|
|
136
|
-
// skip it b/c author's relations may have been changed/mutated to different not-yet-loaded
|
|
137
|
-
// entities.
|
|
138
|
-
//
|
|
139
|
-
// Even though having `{ cache: false }` looks weird here, i.e. why use dataloader at all?, it
|
|
140
|
-
// still helps us fan-in resolvers callers that are happening ~simultaneously into the same
|
|
141
|
-
// effort.
|
|
142
|
-
{ cache: false });
|
|
143
|
-
}
|
|
144
|
-
/** Probes `relation` to see if it's a m2o/o2m/m2m relation that supports `getWithDeleted`, otherwise calls `get`. */
|
|
145
|
-
function getEvenDeleted(relation) {
|
|
146
|
-
return "getWithDeleted" in relation ? relation.getWithDeleted : relation.get;
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=populateDataLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"populateDataLoader.js","sourceRoot":"","sources":["../../src/dataloaders/populateDataLoader.ts"],"names":[],"mappings":";;;AAqBA,gDAyJC;AA3KD,0CAAsD;AACtD,oCASkB;AAElB,oDAA2E;AAC3E,8DAA+D;AAC/D,oCAAmC;AAEtB,QAAA,iBAAiB,GAAG,UAAU,CAAC;AAE5C,SAAgB,kBAAkB,CAChC,EAAiB,EACjB,IAAoB,EACpB,IAAmB,EACnB,IAA8B,EAC9B,OAAkC,EAAE;IAEpC,mEAAmE;IACnE,+FAA+F;IAC/F,kGAAkG;IAClG,mGAAmG;IACnG,EAAE;IACF,qFAAqF;IACrF,8CAA8C;IAC9C,EAAE;IACF,8FAA8F;IAC9F,iGAAiG;IACjG,wFAAwF;IACxF,8DAA8D;IAC9D,MAAM,QAAQ,GACZ,IAAI,KAAK,SAAS;QAChB,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE;QACvC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IA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AC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC7D,CAAC;oBAED,OAAO,CAAC,IAAI,CAAC,CAAC;oBAEd,MAAM,QAAQ,GAAI,SAAS,EAAE,SAAS,CAAC,GAAG,CAAS,EAAE,aAAa,EAAE,EAAE,CAAC;oBACvE,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;gBACvC,CAAC,CAAC,CAAC;gBACH,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,aAAa,CAAC,IAAI,EAAE,IAAA,wBAAa,EAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC7E,CAAC;IACD,iGAAiG;IACjG,gGAAgG;IAChG,2FAA2F;IAC3F,YAAY;IACZ,EAAE;IACF,8FAA8F;IAC9F,2FAA2F;IAC3F,UAAU;IACV,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;AACJ,CAAC;AAED,qHAAqH;AACrH,SAAS,cAAc,CAAC,QAAa;IACnC,OAAO,gBAAgB,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC/E,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import DataLoader from "dataloader";
|
|
2
|
-
import { Entity } from "../Entity";
|
|
3
|
-
import { EntityManager } from "../EntityManager";
|
|
4
|
-
import { RecursiveChildrenCollectionImpl } from "../relations/RecursiveCollection";
|
|
5
|
-
export declare const recursiveChildrenOperation = "o2m-recursive";
|
|
6
|
-
export declare function recursiveChildrenDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: RecursiveChildrenCollectionImpl<T, U>): DataLoader<Entity, U[]>;
|
|
7
|
-
//# sourceMappingURL=recursiveChildrenDataLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveChildrenDataLoader.d.ts","sourceRoot":"","sources":["../../src/dataloaders/recursiveChildrenDataLoader.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAoB,MAAM,kBAAkB,CAAC;AAcnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAGnF,eAAO,MAAM,0BAA0B,kBAAkB,CAAC;AAE1D,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAC5E,EAAE,EAAE,aAAa,EACjB,UAAU,EAAE,+BAA+B,CAAC,CAAC,EAAE,CAAC,CAAC,GAChD,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAwEzB"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recursiveChildrenOperation = void 0;
|
|
4
|
-
exports.recursiveChildrenDataLoader = recursiveChildrenDataLoader;
|
|
5
|
-
const configure_1 = require("../configure");
|
|
6
|
-
const EntityManager_1 = require("../EntityManager");
|
|
7
|
-
const index_1 = require("../index");
|
|
8
|
-
const utils_1 = require("../utils");
|
|
9
|
-
exports.recursiveChildrenOperation = "o2m-recursive";
|
|
10
|
-
function recursiveChildrenDataLoader(em, collection) {
|
|
11
|
-
let { meta, fieldName } = collection;
|
|
12
|
-
// This could be called from subtypes to get relations defined on the parent. So we need to make sure we are using the
|
|
13
|
-
// correct meta by walking the inheritance tree until we find the meta that actually has the root o2m field
|
|
14
|
-
while (!(collection.o2mFieldName in meta.fields) && meta.baseType)
|
|
15
|
-
meta = (0, configure_1.getMetadataForType)(meta.baseType);
|
|
16
|
-
const batchKey = `${meta.tableName}-${fieldName}`;
|
|
17
|
-
return em.getLoader(exports.recursiveChildrenOperation, batchKey, async (parents) => {
|
|
18
|
-
const o2m = meta.allFields[collection.o2mFieldName];
|
|
19
|
-
const m2o = meta.allFields[o2m.otherFieldName];
|
|
20
|
-
const { columnName } = m2o.serde.columns[0];
|
|
21
|
-
const alias = (0, utils_1.abbreviation)(meta.tableName);
|
|
22
|
-
const query = {
|
|
23
|
-
selects: [`"${alias}".*`],
|
|
24
|
-
tables: [
|
|
25
|
-
// We still select directly from our table, and join into the CTE so that we
|
|
26
|
-
// can use `addTablePerClassJoinsAndClassTag` to get inheritance added for free.
|
|
27
|
-
{ alias, join: "primary", table: meta.tableName },
|
|
28
|
-
{ alias: `${alias}_cte`, join: "inner", table: `${alias}_cte`, col1: `${alias}.id`, col2: `${alias}_cte.id` },
|
|
29
|
-
],
|
|
30
|
-
orderBys: [{ alias, column: "id", order: "ASC" }],
|
|
31
|
-
ctes: [
|
|
32
|
-
{
|
|
33
|
-
alias: `${alias}_cte`,
|
|
34
|
-
query: {
|
|
35
|
-
kind: "raw",
|
|
36
|
-
// b is our base case, which is the immediate children of the parents, and r is the
|
|
37
|
-
// recursive case of finding their children.
|
|
38
|
-
sql: `
|
|
39
|
-
SELECT b.id, b.${columnName} FROM ${(0, index_1.kq)(meta.tableName)} b WHERE b.${columnName} = ANY(?)
|
|
40
|
-
UNION
|
|
41
|
-
SELECT r.id, r.${columnName} FROM ${(0, index_1.kq)(meta.tableName)} r JOIN ${alias}_cte ON r.${columnName} = ${alias}_cte.id
|
|
42
|
-
`,
|
|
43
|
-
// RecursiveChildrenCollectionImpl won't call `.load` on new entities, so we can assume entities have an id
|
|
44
|
-
bindings: [(0, index_1.unsafeDeTagIds)(parents.map((e) => e.idTagged))],
|
|
45
|
-
},
|
|
46
|
-
recursive: true,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
(0, index_1.addTablePerClassJoinsAndClassTag)(query, meta, alias, true);
|
|
51
|
-
const rows = await em["executeFind"](meta, exports.recursiveChildrenOperation, query, {});
|
|
52
|
-
const entities = em.hydrate(meta.cstr, rows);
|
|
53
|
-
// For all the entities we found, group them by their parent (or the root node, which has no parent)
|
|
54
|
-
const entitiesById = (0, utils_1.groupBy)(entities, (entity) => {
|
|
55
|
-
const parentId = (0, index_1.maybeResolveReferenceToId)((0, index_1.getField)(entity, m2o.fieldName));
|
|
56
|
-
return parentId ?? "root";
|
|
57
|
-
});
|
|
58
|
-
// For each found parent, use the preloading infra to inject the children into the relation
|
|
59
|
-
for (const [parentId, children] of entitiesById) {
|
|
60
|
-
if (parentId !== "root") {
|
|
61
|
-
(0, EntityManager_1.getEmInternalApi)(em).setPreloadedRelation(parentId, o2m.fieldName, children);
|
|
62
|
-
// I thought we could delay calling this, but currently `em.populate` calls `preload()` explicitly
|
|
63
|
-
em.getEntity(parentId)[o2m.fieldName].preload();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// Any entity[o2m] still not loaded must be a leaf which didn't have any children; go ahead and mark it as loaded
|
|
67
|
-
for (const entity of [...parents, ...entities]) {
|
|
68
|
-
if (!(0, index_1.isLoadedCollection)(entity[o2m.fieldName]) && !(0, index_1.isLoadedOneToOneReference)(entity[o2m.fieldName])) {
|
|
69
|
-
(0, EntityManager_1.getEmInternalApi)(em).setPreloadedRelation(entity.id, o2m.fieldName, []);
|
|
70
|
-
entity[o2m.fieldName].preload();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// We used preloading to load keys + any recursive keys, so the return value doesn't matter
|
|
74
|
-
return parents.map(() => []);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=recursiveChildrenDataLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveChildrenDataLoader.js","sourceRoot":"","sources":["../../src/dataloaders/recursiveChildrenDataLoader.ts"],"names":[],"mappings":";;;AAsBA,kEA2EC;AAhGD,4CAAkD;AAElD,oDAAmE;A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AAC;QAEH,2FAA2F;QAC3F,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC;YAChD,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACxB,IAAA,gCAAgB,EAAC,EAAE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAC7E,kGAAkG;gBACjG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,iHAAiH;QACjH,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,IAAA,0BAAkB,EAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAA,iCAAyB,EAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;gBACpG,IAAA,gCAAgB,EAAC,EAAE,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;gBACxE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;YAClC,CAAC;QACH,CAAC;QAED,2FAA2F;QAC3F,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import DataLoader from "dataloader";
|
|
2
|
-
import { Entity } from "../Entity";
|
|
3
|
-
import { EntityManager } from "../EntityManager";
|
|
4
|
-
import { RecursiveParentsCollectionImpl } from "../relations/RecursiveCollection";
|
|
5
|
-
export declare const recursiveParentsOperation = "m2o-recursive";
|
|
6
|
-
export declare function recursiveParentsDataLoader<T extends Entity, U extends Entity>(em: EntityManager, collection: RecursiveParentsCollectionImpl<T, U>): DataLoader<Entity, U[]>;
|
|
7
|
-
//# sourceMappingURL=recursiveParentsDataLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveParentsDataLoader.d.ts","sourceRoot":"","sources":["../../src/dataloaders/recursiveParentsDataLoader.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AASjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAGlF,eAAO,MAAM,yBAAyB,kBAAkB,CAAC;AAEzD,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAC3E,EAAE,EAAE,aAAa,EACjB,UAAU,EAAE,8BAA8B,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/C,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAqDzB"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recursiveParentsOperation = void 0;
|
|
4
|
-
exports.recursiveParentsDataLoader = recursiveParentsDataLoader;
|
|
5
|
-
const configure_1 = require("../configure");
|
|
6
|
-
const index_1 = require("../index");
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
exports.recursiveParentsOperation = "m2o-recursive";
|
|
9
|
-
function recursiveParentsDataLoader(em, collection) {
|
|
10
|
-
let { meta, fieldName } = collection;
|
|
11
|
-
// This could be called from subtypes to get relations defined on the parent. So we need to make sure we are using the
|
|
12
|
-
// correct meta by walking the inheritance tree until we find the meta that actually has the root m2o field
|
|
13
|
-
while (!(collection.m2oFieldName in meta.fields) && meta.baseType)
|
|
14
|
-
meta = (0, configure_1.getMetadataForType)(meta.baseType);
|
|
15
|
-
const batchKey = `${meta.tableName}-${fieldName}`;
|
|
16
|
-
return em.getLoader(exports.recursiveParentsOperation, batchKey, async (children) => {
|
|
17
|
-
const m2o = meta.allFields[collection.m2oFieldName];
|
|
18
|
-
// ...can `getField` return a new entity? In theory, we shouldn't see new entities because
|
|
19
|
-
// RecursiveParentsCollectionImpl.load/isLoaded will see the `ManyToOneReferenceImpl` as loaded.
|
|
20
|
-
const immediateParentIds = children.map((c) => (0, index_1.getField)(c, m2o.fieldName)).filter((id) => id !== undefined);
|
|
21
|
-
const { columnName } = m2o.serde.columns[0];
|
|
22
|
-
const alias = (0, utils_1.abbreviation)(meta.tableName);
|
|
23
|
-
const query = {
|
|
24
|
-
selects: [`"${alias}".*`],
|
|
25
|
-
tables: [
|
|
26
|
-
// We still select directly from our table, and join into the CTE so that we
|
|
27
|
-
// can use `addTablePerClassJoinsAndClassTag` to get inheritance added for free.
|
|
28
|
-
{ alias, join: "primary", table: meta.tableName },
|
|
29
|
-
{ alias: `${alias}_cte`, join: "inner", table: `${alias}_cte`, col1: `${alias}.id`, col2: `${alias}_cte.id` },
|
|
30
|
-
],
|
|
31
|
-
orderBys: [{ alias, column: "id", order: "ASC" }],
|
|
32
|
-
ctes: [
|
|
33
|
-
{
|
|
34
|
-
alias: `${alias}_cte`,
|
|
35
|
-
query: {
|
|
36
|
-
kind: "raw",
|
|
37
|
-
// b is our base case, which is the immediate parents of the children we're loading,
|
|
38
|
-
// and r is the recursive case of finding their parents.
|
|
39
|
-
sql: `
|
|
40
|
-
SELECT b.id, b.${columnName} FROM ${(0, index_1.kq)(meta.tableName)} b WHERE b.id = ANY(?)
|
|
41
|
-
UNION
|
|
42
|
-
SELECT r.id, r.${columnName} FROM ${(0, index_1.kq)(meta.tableName)} r JOIN ${alias}_cte ON r.id = ${alias}_cte.${columnName}
|
|
43
|
-
`,
|
|
44
|
-
bindings: [(0, index_1.unsafeDeTagIds)(immediateParentIds)],
|
|
45
|
-
},
|
|
46
|
-
recursive: true,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
(0, index_1.addTablePerClassJoinsAndClassTag)(query, meta, alias, true);
|
|
51
|
-
const rows = await em["executeFind"](meta, exports.recursiveParentsOperation, query, {});
|
|
52
|
-
// Since we're preloading m2os up the tree, merely having the entities in the EM is enough
|
|
53
|
-
// for the ManyToOneReferenceImpl to find them, so we don't need to map them back to the
|
|
54
|
-
// keys, or push them into the preloader cache.
|
|
55
|
-
em.hydrate(meta.cstr, rows);
|
|
56
|
-
return children.map(() => []);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=recursiveParentsDataLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveParentsDataLoader.js","sourceRoot":"","sources":["../../src/dataloaders/recursiveParentsDataLoader.ts"],"names":[],"mappings":";;;AAiBA,gEAwDC;AAxED,4CAAkD;AAGlD,oCAOkB;AAElB,oCAAwC;AAE3B,QAAA,yBAAyB,GAAG,eAAe,CAAC;AAEzD,SAAgB,0BAA0B,CACxC,EAAiB,EACjB,UAAgD;IAEhD,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;IACrC,sHAAsH;IACtH,2GAA2G;IAC3G,OAAO,CAAC,CAAC,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ;QAAE,IAAI,GAAG,IAAA,8BAAkB,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5G,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,SAAS,EAAE,CAAC;IAClD,OAAO,EAAE,CAAC,SAAS,CAAC,iCAAyB,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC1E,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAA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KAAK,QAAQ,UAAU;aAChH;wBACD,QAAQ,EAAE,CAAC,IAAA,sBAAc,EAAC,kBAAkB,CAAC,CAAC;qBAC/C;oBACD,SAAS,EAAE,IAAI;iBAChB;aACF;SACF,CAAC;QAEF,IAAA,wCAAgC,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAE3D,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,iCAAyB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjF,0FAA0F;QAC1F,wFAAwF;QACxF,+CAA+C;QAC/C,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE5B,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/build/defaults.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Deferred } from "joist-utils";
|
|
2
|
-
import { Entity } from "./Entity";
|
|
3
|
-
import { EntityMetadata } from "./EntityMetadata";
|
|
4
|
-
import { ReactiveHint } from "./reactiveHints";
|
|
5
|
-
export declare function hasDefaultValue(meta: EntityMetadata, fieldName: string): boolean;
|
|
6
|
-
/** Run the sync defaults for `entity`. */
|
|
7
|
-
export declare function setSyncDefaults(entity: Entity): void;
|
|
8
|
-
/** Runs the async defaults for all inserted entities in `todos`. */
|
|
9
|
-
export declare function setAsyncDefaults(suppressedTypeErrors: Error[], ctx: unknown, insertsBySubType: Map<EntityMetadata, Entity[]>): Promise<void>;
|
|
10
|
-
/** Sets async defaults *synchronously*, only safe for factories with `DeepNew` entities. */
|
|
11
|
-
export declare function setAsyncDefaultsSynchronously(ctx: unknown, entity: Entity): void;
|
|
12
|
-
/** Wraps the hint + lambda of an async `setDefault`. */
|
|
13
|
-
export declare class AsyncDefault<T extends Entity> {
|
|
14
|
-
#private;
|
|
15
|
-
readonly fieldName: string;
|
|
16
|
-
readonly fieldHint: ReactiveHint<T>;
|
|
17
|
-
readonly fn: (entity: any, ctx: any) => any;
|
|
18
|
-
constructor(fieldName: string, fieldHint: ReactiveHint<T>, fn: (entity: T, ctx: any) => any);
|
|
19
|
-
/** Given a list of inserts of the same type/subtype, set ourselves on each of them. */
|
|
20
|
-
setOnEntities(ctx: any, dt: DependencyTracker, suppressedTypeErrors: Error[], baseMetadata: EntityMetadata, inserts: T[]): Promise<any>;
|
|
21
|
-
setOnFactoryEntity(ctx: unknown, entity: T): void;
|
|
22
|
-
/** For the given `entity`, returns what the default value should be. */
|
|
23
|
-
private getValue;
|
|
24
|
-
private deps;
|
|
25
|
-
}
|
|
26
|
-
type DefaultDependency = {
|
|
27
|
-
meta: EntityMetadata;
|
|
28
|
-
fieldName: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Given a `meta` and a nested field hint, return the meta+field tuples included within the hint.
|
|
32
|
-
*
|
|
33
|
-
* I.e. passing `{ author: { firstName: {}, publisher: "name" } }` would return `[[Author, "firstName"],
|
|
34
|
-
* [Publisher, "name"]]`.
|
|
35
|
-
*/
|
|
36
|
-
export declare function getDefaultDependencies<T extends Entity>(baseMeta: EntityMetadata<T>, baseFieldName: string, baseHint: ReactiveHint<T>): DefaultDependency[];
|
|
37
|
-
/**
|
|
38
|
-
* This tracks cross-default dependencies that are active within a single `em.flush` loop.
|
|
39
|
-
*
|
|
40
|
-
* I.e. this is not a static "the Author.firstName in general depends on Publisher.whatever",
|
|
41
|
-
* it tracks that we're actively inserting 10 new `Author` instances, and their `firstName`
|
|
42
|
-
* default needs to wait until the `Publisher.whatever` fields have their async default
|
|
43
|
-
* calculated.
|
|
44
|
-
*
|
|
45
|
-
* Really this is just a smaller wrapper around a map of `Deferred`s.
|
|
46
|
-
*/
|
|
47
|
-
declare class DependencyTracker {
|
|
48
|
-
#private;
|
|
49
|
-
constructor(insertsBySubType: Map<EntityMetadata, Entity[]>);
|
|
50
|
-
hasMaybePending(meta: EntityMetadata): boolean;
|
|
51
|
-
getDeferred(meta: EntityMetadata, fieldName: string): Deferred<void>;
|
|
52
|
-
}
|
|
53
|
-
export {};
|
|
54
|
-
//# sourceMappingURL=defaults.d.ts.map
|
package/build/defaults.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAsE,MAAM,kBAAkB,CAAC;AAGtH,OAAO,EAAqB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIlE,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAIhF;AAED,0CAA0C;AAC1C,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAyCpD;AAED,oEAAoE;AACpE,wBAAsB,gBAAgB,CACpC,oBAAoB,EAAE,KAAK,EAAE,EAC7B,GAAG,EAAE,OAAO,EAIZ,gBAAgB,EAAE,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,4FAA4F;AAC5F,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAKhF;AAED,wDAAwD;AACxD,qBAAa,YAAY,CAAC,CAAC,SAAS,MAAM;;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;g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