joist-core 2.3.0-next.96 → 2.3.0-next.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/EntityManager.cjs +36 -39
- package/build/EntityManager.cjs.map +1 -1
- package/build/EntityManager.d.cts +4 -4
- package/build/EntityManager.d.mts +4 -4
- package/build/EntityManager.js +29 -32
- package/build/EntityManager.js.map +1 -1
- package/build/EntityMetadata.cjs +3 -3
- package/build/EntityMetadata.js +3 -3
- package/build/IndexManager.cjs +1 -1
- package/build/IndexManager.js +1 -1
- package/build/InstanceData.cjs +1 -1
- package/build/InstanceData.js +1 -1
- package/build/JoinRows.cjs +1 -1
- package/build/JoinRows.js +1 -1
- package/build/PluginManager.cjs +0 -1
- package/build/PluginManager.cjs.map +1 -1
- package/build/PluginManager.d.cts +1 -1
- package/build/PluginManager.d.mts +1 -1
- package/build/PluginManager.js +0 -1
- package/build/PluginManager.js.map +1 -1
- package/build/ReactionsManager.cjs +2 -2
- package/build/ReactionsManager.js +2 -2
- package/build/Todo.cjs +1 -1
- package/build/Todo.js +1 -1
- package/build/batchloaders/enumCollectionBatchLoader.cjs +1 -1
- package/build/batchloaders/enumCollectionBatchLoader.js +1 -1
- package/build/batchloaders/loadBatchLoader.cjs +6 -5
- package/build/batchloaders/loadBatchLoader.cjs.map +1 -1
- package/build/batchloaders/loadBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/loadBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/loadBatchLoader.js +4 -3
- package/build/batchloaders/loadBatchLoader.js.map +1 -1
- package/build/batchloaders/manyToManyBatchLoader.cjs +1 -1
- package/build/batchloaders/manyToManyBatchLoader.js +1 -1
- package/build/batchloaders/oneToManyBatchLoader.cjs +3 -3
- package/build/batchloaders/oneToManyBatchLoader.cjs.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.js +2 -2
- package/build/batchloaders/oneToOneBatchLoader.cjs +4 -4
- package/build/batchloaders/oneToOneBatchLoader.cjs.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.js +3 -3
- package/build/batchloaders/populateBatchLoader.cjs +11 -11
- package/build/batchloaders/populateBatchLoader.cjs.map +1 -1
- package/build/batchloaders/populateBatchLoader.js +8 -8
- package/build/batchloaders/recursiveChildrenBatchLoader.cjs +8 -8
- package/build/batchloaders/recursiveChildrenBatchLoader.cjs.map +1 -1
- package/build/batchloaders/recursiveChildrenBatchLoader.js +5 -5
- package/build/batchloaders/recursiveM2mBatchLoader.cjs +5 -5
- package/build/batchloaders/recursiveM2mBatchLoader.cjs.map +1 -1
- package/build/batchloaders/recursiveM2mBatchLoader.js +2 -2
- package/build/batchloaders/recursiveParentsBatchLoader.cjs +8 -8
- package/build/batchloaders/recursiveParentsBatchLoader.cjs.map +1 -1
- package/build/batchloaders/recursiveParentsBatchLoader.js +5 -5
- package/build/changes.cjs +4 -4
- package/build/changes.js +4 -4
- package/build/config.cjs +3 -3
- package/build/config.js +3 -3
- package/build/configure.cjs +6 -6
- package/build/configure.js +6 -6
- package/build/dataloaders/fastWhereFilterHash.cjs +3 -3
- package/build/dataloaders/fastWhereFilterHash.cjs.map +1 -1
- package/build/dataloaders/fastWhereFilterHash.js +2 -2
- package/build/dataloaders/fastWhereFilterHash.js.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.cjs +5 -6
- package/build/dataloaders/findByUniqueDataLoader.cjs.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.js +3 -4
- package/build/dataloaders/findByUniqueDataLoader.js.map +1 -1
- package/build/dataloaders/findCountDataLoader.cjs +10 -13
- package/build/dataloaders/findCountDataLoader.cjs.map +1 -1
- package/build/dataloaders/findCountDataLoader.d.cts +2 -2
- package/build/dataloaders/findCountDataLoader.d.mts +2 -2
- package/build/dataloaders/findCountDataLoader.js +4 -7
- package/build/dataloaders/findCountDataLoader.js.map +1 -1
- package/build/dataloaders/findDataLoader.cjs +15 -19
- package/build/dataloaders/findDataLoader.cjs.map +1 -1
- package/build/dataloaders/findDataLoader.d.cts +2 -2
- package/build/dataloaders/findDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findDataLoader.d.mts +2 -2
- package/build/dataloaders/findDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findDataLoader.js +5 -9
- package/build/dataloaders/findDataLoader.js.map +1 -1
- package/build/dataloaders/findIdsDataLoader.cjs +6 -9
- package/build/dataloaders/findIdsDataLoader.cjs.map +1 -1
- package/build/dataloaders/findIdsDataLoader.d.cts +1 -1
- package/build/dataloaders/findIdsDataLoader.d.mts +1 -1
- package/build/dataloaders/findIdsDataLoader.js +3 -6
- package/build/dataloaders/findIdsDataLoader.js.map +1 -1
- package/build/dataloaders/findOrCreateDataLoader.cjs +1 -2
- package/build/dataloaders/findOrCreateDataLoader.cjs.map +1 -1
- package/build/dataloaders/findOrCreateDataLoader.js +1 -2
- package/build/dataloaders/findOrCreateDataLoader.js.map +1 -1
- package/build/dataloaders/findPaginatedDataLoader.cjs +3 -6
- package/build/dataloaders/findPaginatedDataLoader.cjs.map +1 -1
- package/build/dataloaders/findPaginatedDataLoader.d.cts +1 -1
- package/build/dataloaders/findPaginatedDataLoader.d.mts +1 -1
- package/build/dataloaders/findPaginatedDataLoader.js +2 -5
- package/build/dataloaders/findPaginatedDataLoader.js.map +1 -1
- package/build/dataloaders/lensDataLoader.cjs +4 -4
- package/build/dataloaders/lensDataLoader.cjs.map +1 -1
- package/build/dataloaders/lensDataLoader.js +2 -2
- package/build/dataloaders/lensDataLoader.js.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.cjs +1 -4
- package/build/dataloaders/manyToManyFindDataLoader.cjs.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.cts +0 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.cts.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.mts +0 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.mts.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.js +1 -4
- package/build/dataloaders/manyToManyFindDataLoader.js.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.cjs +3 -6
- package/build/dataloaders/oneToManyFindDataLoader.cjs.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.cts +0 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.cts.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.mts +0 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.mts.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.js +2 -5
- package/build/dataloaders/oneToManyFindDataLoader.js.map +1 -1
- package/build/defaults.cjs +4 -4
- package/build/defaults.js +4 -4
- package/build/driverApi.cjs +4 -5
- package/build/driverApi.cjs.map +1 -1
- package/build/driverApi.d.cts +1 -1
- package/build/driverApi.d.mts +1 -1
- package/build/driverApi.js +2 -2
- package/build/driverApi.js.map +1 -1
- package/build/drivers/Driver.cjs +0 -1
- package/build/drivers/Driver.d.cts +1 -1
- package/build/drivers/Driver.d.mts +1 -1
- package/build/drivers/Driver.js +0 -1
- package/build/drivers/EntityWriter.cjs +2 -2
- package/build/drivers/EntityWriter.js +2 -2
- package/build/drivers/index.cjs +0 -6
- package/build/drivers/index.d.cts +1 -3
- package/build/drivers/index.d.mts +1 -3
- package/build/drivers/index.js +1 -3
- package/build/fieldSerde.cjs +2 -2
- package/build/fieldSerde.js +2 -2
- package/build/fields.cjs +2 -2
- package/build/fields.js +2 -2
- package/build/getProperties.cjs +1 -1
- package/build/getProperties.js +1 -1
- package/build/index.cjs +109 -107
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +27 -24
- package/build/index.d.cts.map +1 -1
- package/build/index.d.mts +27 -24
- package/build/index.d.mts.map +1 -1
- package/build/index.js +51 -49
- package/build/index.js.map +1 -1
- package/build/json.cjs +3 -3
- package/build/json.js +3 -3
- package/build/keys.cjs +1 -1
- package/build/keys.js +1 -1
- package/build/loadHints.cjs +1 -1
- package/build/loadHints.js +1 -1
- package/build/loadLens.cjs +1 -1
- package/build/loadLens.js +1 -1
- package/build/logging/FactoryLogger.cjs +1 -1
- package/build/logging/FactoryLogger.js +1 -1
- package/build/logging/FieldLogger.cjs +1 -1
- package/build/logging/FieldLogger.js +1 -1
- package/build/logging/ReactionLogger.cjs +1 -1
- package/build/logging/ReactionLogger.js +1 -1
- package/build/newEntity.cjs +1 -1
- package/build/newEntity.js +1 -1
- package/build/newTestInstance.cjs +3 -3
- package/build/newTestInstance.js +3 -3
- package/build/plugins/PreloadPlugin.cjs +1 -2
- package/build/plugins/PreloadPlugin.d.cts +1 -1
- package/build/plugins/PreloadPlugin.d.mts +1 -1
- package/build/plugins/PreloadPlugin.js +1 -2
- package/build/preloading/JsonAggregatePreloader.cjs +31 -31
- package/build/preloading/JsonAggregatePreloader.cjs.map +1 -1
- package/build/preloading/JsonAggregatePreloader.d.cts +1 -1
- package/build/preloading/JsonAggregatePreloader.d.mts +1 -1
- package/build/preloading/JsonAggregatePreloader.js +6 -6
- package/build/preloading/JsonAggregatePreloader.js.map +1 -1
- package/build/preloading/partitionHint.cjs +3 -3
- package/build/preloading/partitionHint.js +3 -3
- package/build/{ConditionBuilder.cjs → queries/ConditionBuilder.cjs} +7 -8
- package/build/queries/ConditionBuilder.cjs.map +1 -0
- package/build/{ConditionBuilder.d.cts → queries/ConditionBuilder.d.cts} +3 -3
- package/build/queries/ConditionBuilder.d.cts.map +1 -0
- package/build/{ConditionBuilder.d.mts → queries/ConditionBuilder.d.mts} +3 -3
- package/build/queries/ConditionBuilder.d.mts.map +1 -0
- package/build/{ConditionBuilder.js → queries/ConditionBuilder.js} +4 -5
- package/build/queries/ConditionBuilder.js.map +1 -0
- package/build/{conditions.cjs → queries/conditions.cjs} +1 -2
- package/build/queries/conditions.cjs.map +1 -0
- package/build/{conditions.d.cts → queries/conditions.d.cts} +2 -2
- package/build/queries/conditions.d.cts.map +1 -0
- package/build/{conditions.d.mts → queries/conditions.d.mts} +2 -2
- package/build/queries/conditions.d.mts.map +1 -0
- package/build/{conditions.js → queries/conditions.js} +1 -2
- package/build/queries/conditions.js.map +1 -0
- package/build/queries/entityQueryUtils.cjs +60 -0
- package/build/queries/entityQueryUtils.cjs.map +1 -0
- package/build/queries/entityQueryUtils.d.cts +19 -0
- package/build/queries/entityQueryUtils.d.cts.map +1 -0
- package/build/queries/entityQueryUtils.d.mts +19 -0
- package/build/queries/entityQueryUtils.d.mts.map +1 -0
- package/build/queries/entityQueryUtils.js +56 -0
- package/build/queries/entityQueryUtils.js.map +1 -0
- package/build/{Aliases.cjs → queries/find/Aliases.cjs} +23 -28
- package/build/queries/find/Aliases.cjs.map +1 -0
- package/build/{Aliases.d.cts → queries/find/Aliases.d.cts} +7 -7
- package/build/queries/find/Aliases.d.cts.map +1 -0
- package/build/{Aliases.d.mts → queries/find/Aliases.d.mts} +7 -7
- package/build/queries/find/Aliases.d.mts.map +1 -0
- package/build/{Aliases.js → queries/find/Aliases.js} +7 -12
- package/build/queries/find/Aliases.js.map +1 -0
- package/build/{DeferredAlias.cjs → queries/find/DeferredAlias.cjs} +3 -6
- package/build/queries/find/DeferredAlias.cjs.map +1 -0
- package/build/{DeferredAlias.d.cts → queries/find/DeferredAlias.d.cts} +4 -4
- package/build/queries/find/DeferredAlias.d.cts.map +1 -0
- package/build/{DeferredAlias.d.mts → queries/find/DeferredAlias.d.mts} +4 -4
- package/build/queries/find/DeferredAlias.d.mts.map +1 -0
- package/build/{DeferredAlias.js → queries/find/DeferredAlias.js} +2 -5
- package/build/queries/find/DeferredAlias.js.map +1 -0
- package/build/{EntityFilter.cjs → queries/find/EntityFilter.cjs} +4 -9
- package/build/queries/find/EntityFilter.cjs.map +1 -0
- package/build/{EntityFilter.d.cts → queries/find/EntityFilter.d.cts} +6 -6
- package/build/queries/find/EntityFilter.d.cts.map +1 -0
- package/build/{EntityFilter.d.mts → queries/find/EntityFilter.d.mts} +6 -6
- package/build/queries/find/EntityFilter.d.mts.map +1 -0
- package/build/{EntityFilter.js → queries/find/EntityFilter.js} +1 -6
- package/build/queries/find/EntityFilter.js.map +1 -0
- package/build/{EntityGraphQLFilter.cjs → queries/find/EntityGraphQLFilter.cjs} +1 -5
- package/build/queries/find/EntityGraphQLFilter.cjs.map +1 -0
- package/build/{EntityGraphQLFilter.d.cts → queries/find/EntityGraphQLFilter.d.cts} +3 -3
- package/build/queries/find/EntityGraphQLFilter.d.cts.map +1 -0
- package/build/{EntityGraphQLFilter.d.mts → queries/find/EntityGraphQLFilter.d.mts} +3 -3
- package/build/queries/find/EntityGraphQLFilter.d.mts.map +1 -0
- package/build/{EntityGraphQLFilter.js → queries/find/EntityGraphQLFilter.js} +1 -5
- package/build/queries/find/EntityGraphQLFilter.js.map +1 -0
- package/build/{QueryParser.cjs → queries/find/QueryParser.cjs} +68 -356
- package/build/queries/find/QueryParser.cjs.map +1 -0
- package/build/{QueryParser.collectionJoins.cjs → queries/find/QueryParser.collectionJoins.cjs} +8 -8
- package/build/queries/find/QueryParser.collectionJoins.cjs.map +1 -0
- package/build/{QueryParser.collectionJoins.d.cts → queries/find/QueryParser.collectionJoins.d.cts} +1 -1
- package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -0
- package/build/{QueryParser.collectionJoins.d.mts → queries/find/QueryParser.collectionJoins.d.mts} +1 -1
- package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -0
- package/build/{QueryParser.collectionJoins.js → queries/find/QueryParser.collectionJoins.js} +2 -2
- package/build/queries/find/QueryParser.collectionJoins.js.map +1 -0
- package/build/{QueryParser.d.cts → queries/find/QueryParser.d.cts} +5 -159
- package/build/queries/find/QueryParser.d.cts.map +1 -0
- package/build/{QueryParser.d.mts → queries/find/QueryParser.d.mts} +5 -159
- package/build/queries/find/QueryParser.d.mts.map +1 -0
- package/build/{QueryParser.js → queries/find/QueryParser.js} +15 -295
- package/build/queries/find/QueryParser.js.map +1 -0
- package/build/{QueryParser.pruning.cjs → queries/find/QueryParser.pruning.cjs} +6 -20
- package/build/queries/find/QueryParser.pruning.cjs.map +1 -0
- package/build/queries/find/QueryParser.pruning.d.cts +8 -0
- package/build/queries/find/QueryParser.pruning.d.cts.map +1 -0
- package/build/queries/find/QueryParser.pruning.d.mts +8 -0
- package/build/queries/find/QueryParser.pruning.d.mts.map +1 -0
- package/build/{QueryParser.pruning.js → queries/find/QueryParser.pruning.js} +4 -17
- package/build/queries/find/QueryParser.pruning.js.map +1 -0
- package/build/{QueryVisitor.cjs → queries/find/QueryVisitor.cjs} +2 -3
- package/build/queries/find/QueryVisitor.cjs.map +1 -0
- package/build/{QueryVisitor.d.cts → queries/find/QueryVisitor.d.cts} +3 -2
- package/build/queries/find/QueryVisitor.d.cts.map +1 -0
- package/build/{QueryVisitor.d.mts → queries/find/QueryVisitor.d.mts} +3 -2
- package/build/queries/find/QueryVisitor.d.mts.map +1 -0
- package/build/{QueryVisitor.js → queries/find/QueryVisitor.js} +2 -3
- package/build/queries/find/QueryVisitor.js.map +1 -0
- package/build/{drivers/buildRawQuery.cjs → queries/find/buildFindQuery.cjs} +14 -15
- package/build/queries/find/buildFindQuery.cjs.map +1 -0
- package/build/{drivers/buildRawQuery.d.cts → queries/find/buildFindQuery.d.cts} +3 -3
- package/build/queries/find/buildFindQuery.d.cts.map +1 -0
- package/build/{drivers/buildRawQuery.d.mts → queries/find/buildFindQuery.d.mts} +3 -3
- package/build/queries/find/buildFindQuery.d.mts.map +1 -0
- package/build/{drivers/buildRawQuery.js → queries/find/buildFindQuery.js} +5 -6
- package/build/queries/find/buildFindQuery.js.map +1 -0
- package/build/{scopes.cjs → queries/find/scopes.cjs} +2 -3
- package/build/queries/find/scopes.cjs.map +1 -0
- package/build/{scopes.d.cts → queries/find/scopes.d.cts} +6 -6
- package/build/queries/find/scopes.d.cts.map +1 -0
- package/build/{scopes.d.mts → queries/find/scopes.d.mts} +6 -6
- package/build/queries/find/scopes.d.mts.map +1 -0
- package/build/{scopes.js → queries/find/scopes.js} +2 -3
- package/build/queries/find/scopes.js.map +1 -0
- package/build/queries/parsedConditions.cjs +21 -0
- package/build/queries/parsedConditions.cjs.map +1 -0
- package/build/queries/parsedConditions.d.cts +127 -0
- package/build/queries/parsedConditions.d.cts.map +1 -0
- package/build/queries/parsedConditions.d.mts +127 -0
- package/build/queries/parsedConditions.d.mts.map +1 -0
- package/build/queries/parsedConditions.js +20 -0
- package/build/queries/parsedConditions.js.map +1 -0
- package/build/{drivers/buildUtils.cjs → queries/renderConditions.cjs} +7 -8
- package/build/queries/renderConditions.cjs.map +1 -0
- package/build/{drivers/buildUtils.d.mts → queries/renderConditions.d.cts} +5 -4
- package/build/queries/renderConditions.d.cts.map +1 -0
- package/build/{drivers/buildUtils.d.cts → queries/renderConditions.d.mts} +5 -4
- package/build/queries/renderConditions.d.mts.map +1 -0
- package/build/{drivers/buildUtils.js → queries/renderConditions.js} +4 -5
- package/build/queries/renderConditions.js.map +1 -0
- package/build/{skipCondition.cjs → queries/skipCondition.cjs} +1 -2
- package/build/queries/skipCondition.cjs.map +1 -0
- package/build/{skipCondition.d.cts → queries/skipCondition.d.cts} +2 -2
- package/build/{skipCondition.d.cts.map → queries/skipCondition.d.cts.map} +1 -1
- package/build/{skipCondition.d.mts → queries/skipCondition.d.mts} +2 -2
- package/build/{skipCondition.d.mts.map → queries/skipCondition.d.mts.map} +1 -1
- package/build/{skipCondition.js → queries/skipCondition.js} +1 -2
- package/build/queries/skipCondition.js.map +1 -0
- package/build/{AliasAssigner.cjs → queries/sql/AliasAssigner.cjs} +2 -3
- package/build/queries/sql/AliasAssigner.cjs.map +1 -0
- package/build/{AliasAssigner.d.cts → queries/sql/AliasAssigner.d.cts} +2 -2
- package/build/queries/sql/AliasAssigner.d.cts.map +1 -0
- package/build/{AliasAssigner.d.mts → queries/sql/AliasAssigner.d.mts} +2 -2
- package/build/queries/sql/AliasAssigner.d.mts.map +1 -0
- package/build/{AliasAssigner.js → queries/sql/AliasAssigner.js} +2 -3
- package/build/queries/sql/AliasAssigner.js.map +1 -0
- package/build/{Expr.cjs → queries/sql/Expr.cjs} +9 -9
- package/build/queries/sql/Expr.cjs.map +1 -0
- package/build/{Expr.d.cts → queries/sql/Expr.d.cts} +4 -4
- package/build/queries/sql/Expr.d.cts.map +1 -0
- package/build/{Expr.d.mts → queries/sql/Expr.d.mts} +4 -4
- package/build/queries/sql/Expr.d.mts.map +1 -0
- package/build/{Expr.js → queries/sql/Expr.js} +4 -4
- package/build/queries/sql/Expr.js.map +1 -0
- package/build/{Tables.cjs → queries/sql/Tables.cjs} +63 -67
- package/build/queries/sql/Tables.cjs.map +1 -0
- package/build/{Tables.d.cts → queries/sql/Tables.d.cts} +6 -7
- package/build/queries/sql/Tables.d.cts.map +1 -0
- package/build/{Tables.d.mts → queries/sql/Tables.d.mts} +6 -7
- package/build/queries/sql/Tables.d.mts.map +1 -0
- package/build/{Tables.js → queries/sql/Tables.js} +9 -13
- package/build/queries/sql/Tables.js.map +1 -0
- package/build/{execute.cjs → queries/sql/execute.cjs} +32 -37
- package/build/queries/sql/execute.cjs.map +1 -0
- package/build/{execute.d.cts → queries/sql/execute.d.cts} +6 -6
- package/build/queries/sql/execute.d.cts.map +1 -0
- package/build/{execute.d.mts → queries/sql/execute.d.mts} +6 -6
- package/build/queries/sql/execute.d.mts.map +1 -0
- package/build/{execute.js → queries/sql/execute.js} +5 -10
- package/build/queries/sql/execute.js.map +1 -0
- package/build/{expressions → queries/sql/expressions}/arrayAgg.cjs +12 -12
- package/build/queries/sql/expressions/arrayAgg.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/arrayAgg.d.cts +1 -1
- package/build/queries/sql/expressions/arrayAgg.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/arrayAgg.d.mts +1 -1
- package/build/queries/sql/expressions/arrayAgg.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/arrayAgg.js +1 -1
- package/build/queries/sql/expressions/arrayAgg.js.map +1 -0
- package/build/{expressions → queries/sql/expressions}/case.cjs +14 -14
- package/build/queries/sql/expressions/case.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/case.d.cts +1 -1
- package/build/queries/sql/expressions/case.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/case.d.mts +1 -1
- package/build/queries/sql/expressions/case.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/case.js +1 -1
- package/build/queries/sql/expressions/case.js.map +1 -0
- package/build/queries/sql/expressions/coalesce.cjs +25 -0
- package/build/queries/sql/expressions/coalesce.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/coalesce.d.cts +1 -1
- package/build/queries/sql/expressions/coalesce.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/coalesce.d.mts +1 -1
- package/build/queries/sql/expressions/coalesce.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/coalesce.js +1 -1
- package/build/queries/sql/expressions/coalesce.js.map +1 -0
- package/build/{expressions → queries/sql/expressions}/codecs.cjs +5 -5
- package/build/queries/sql/expressions/codecs.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/codecs.d.cts +1 -1
- package/build/queries/sql/expressions/codecs.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/codecs.d.mts +1 -1
- package/build/queries/sql/expressions/codecs.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/codecs.js +3 -3
- package/build/queries/sql/expressions/codecs.js.map +1 -0
- package/build/queries/sql/expressions/expression.cjs +102 -0
- package/build/queries/sql/expressions/expression.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/expression.d.cts +1 -1
- package/build/queries/sql/expressions/expression.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/expression.d.mts +1 -1
- package/build/queries/sql/expressions/expression.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/expression.js +2 -2
- package/build/queries/sql/expressions/expression.js.map +1 -0
- package/build/queries/sql/expressions/greatest.cjs +25 -0
- package/build/queries/sql/expressions/greatest.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/greatest.d.cts +1 -1
- package/build/queries/sql/expressions/greatest.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/greatest.d.mts +1 -1
- package/build/queries/sql/expressions/greatest.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/greatest.js +1 -1
- package/build/queries/sql/expressions/greatest.js.map +1 -0
- package/build/queries/sql/expressions/least.cjs +25 -0
- package/build/queries/sql/expressions/least.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/least.d.cts +1 -1
- package/build/queries/sql/expressions/least.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/least.d.mts +1 -1
- package/build/queries/sql/expressions/least.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/least.js +1 -1
- package/build/queries/sql/expressions/least.js.map +1 -0
- package/build/{expressions → queries/sql/expressions}/nullIf.cjs +6 -6
- package/build/queries/sql/expressions/nullIf.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/nullIf.d.cts +1 -1
- package/build/queries/sql/expressions/nullIf.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/nullIf.d.mts +1 -1
- package/build/queries/sql/expressions/nullIf.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/nullIf.js +1 -1
- package/build/queries/sql/expressions/nullIf.js.map +1 -0
- package/build/{expressions → queries/sql/expressions}/parseExpression.cjs +16 -16
- package/build/queries/sql/expressions/parseExpression.cjs.map +1 -0
- package/build/{expressions → queries/sql/expressions}/parseExpression.d.cts +1 -1
- package/build/queries/sql/expressions/parseExpression.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/parseExpression.d.mts +1 -1
- package/build/queries/sql/expressions/parseExpression.d.mts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/parseExpression.js +2 -2
- package/build/queries/sql/expressions/parseExpression.js.map +1 -0
- package/build/{expressions → queries/sql/expressions}/types.d.cts +1 -1
- package/build/queries/sql/expressions/types.d.cts.map +1 -0
- package/build/{expressions → queries/sql/expressions}/types.d.mts +1 -1
- package/build/queries/sql/expressions/types.d.mts.map +1 -0
- package/build/{keywords.cjs → queries/sql/keywords.cjs} +1 -1
- package/build/queries/sql/keywords.cjs.map +1 -0
- package/build/{keywords.d.cts → queries/sql/keywords.d.cts} +1 -1
- package/build/queries/sql/keywords.d.cts.map +1 -0
- package/build/{keywords.d.mts → queries/sql/keywords.d.mts} +1 -1
- package/build/queries/sql/keywords.d.mts.map +1 -0
- package/build/{keywords.js → queries/sql/keywords.js} +1 -1
- package/build/queries/sql/keywords.js.map +1 -0
- package/build/{query.cjs → queries/sql/query.cjs} +83 -84
- package/build/queries/sql/query.cjs.map +1 -0
- package/build/{query.d.cts → queries/sql/query.d.cts} +7 -7
- package/build/queries/sql/query.d.cts.map +1 -0
- package/build/{query.d.mts → queries/sql/query.d.mts} +7 -7
- package/build/queries/sql/query.d.mts.map +1 -0
- package/build/{query.js → queries/sql/query.js} +11 -12
- package/build/queries/sql/query.js.map +1 -0
- package/build/queries/valueFilters.cjs +248 -0
- package/build/queries/valueFilters.cjs.map +1 -0
- package/build/queries/valueFilters.d.cts +28 -0
- package/build/queries/valueFilters.d.cts.map +1 -0
- package/build/queries/valueFilters.d.mts +28 -0
- package/build/queries/valueFilters.d.mts.map +1 -0
- package/build/queries/valueFilters.js +243 -0
- package/build/queries/valueFilters.js.map +1 -0
- package/build/reactiveHints.cjs +5 -5
- package/build/reactiveHints.js +5 -5
- package/build/relations/AbstractRelationImpl.cjs +0 -5
- package/build/relations/AbstractRelationImpl.cjs.map +1 -1
- package/build/relations/AbstractRelationImpl.d.cts +1 -2
- package/build/relations/AbstractRelationImpl.d.cts.map +1 -1
- package/build/relations/AbstractRelationImpl.d.mts +1 -2
- package/build/relations/AbstractRelationImpl.d.mts.map +1 -1
- package/build/relations/AbstractRelationImpl.js +1 -5
- package/build/relations/AbstractRelationImpl.js.map +1 -1
- package/build/relations/AsyncProperty.cjs +1 -1
- package/build/relations/AsyncProperty.js +1 -1
- package/build/relations/AsyncReactiveField.cjs +3 -3
- package/build/relations/AsyncReactiveField.js +3 -3
- package/build/relations/Collection.cjs +1 -1
- package/build/relations/Collection.js +1 -1
- package/build/relations/CustomCollection.cjs +1 -1
- package/build/relations/CustomCollection.js +1 -1
- package/build/relations/CustomReference.cjs +3 -3
- package/build/relations/CustomReference.js +3 -3
- package/build/relations/EnumCollection.cjs +2 -2
- package/build/relations/EnumCollection.js +2 -2
- package/build/relations/LazyField.cjs +6 -7
- package/build/relations/LazyField.cjs.map +1 -1
- package/build/relations/LazyField.js +5 -6
- package/build/relations/LazyField.js.map +1 -1
- package/build/relations/ManyToManyCollection.cjs +4 -3
- package/build/relations/ManyToManyCollection.cjs.map +1 -1
- package/build/relations/ManyToManyCollection.d.cts.map +1 -1
- package/build/relations/ManyToManyCollection.d.mts.map +1 -1
- package/build/relations/ManyToManyCollection.js +4 -3
- package/build/relations/ManyToManyCollection.js.map +1 -1
- package/build/relations/ManyToManyLargeCollection.cjs +2 -2
- package/build/relations/ManyToManyLargeCollection.js +2 -2
- package/build/relations/ManyToOneReference.cjs +7 -6
- package/build/relations/ManyToOneReference.cjs.map +1 -1
- package/build/relations/ManyToOneReference.d.cts.map +1 -1
- package/build/relations/ManyToOneReference.d.mts.map +1 -1
- package/build/relations/ManyToOneReference.js +7 -6
- package/build/relations/ManyToOneReference.js.map +1 -1
- package/build/relations/OneToManyCollection.cjs +6 -5
- package/build/relations/OneToManyCollection.cjs.map +1 -1
- package/build/relations/OneToManyCollection.d.cts.map +1 -1
- package/build/relations/OneToManyCollection.d.mts.map +1 -1
- package/build/relations/OneToManyCollection.js +4 -3
- package/build/relations/OneToManyCollection.js.map +1 -1
- package/build/relations/OneToManyLargeCollection.cjs +3 -3
- package/build/relations/OneToManyLargeCollection.js +3 -3
- package/build/relations/OneToOneReference.cjs +6 -5
- package/build/relations/OneToOneReference.cjs.map +1 -1
- package/build/relations/OneToOneReference.d.cts.map +1 -1
- package/build/relations/OneToOneReference.d.mts.map +1 -1
- package/build/relations/OneToOneReference.js +6 -5
- package/build/relations/OneToOneReference.js.map +1 -1
- package/build/relations/PolymorphicReference.cjs +7 -6
- package/build/relations/PolymorphicReference.cjs.map +1 -1
- package/build/relations/PolymorphicReference.d.cts.map +1 -1
- package/build/relations/PolymorphicReference.d.mts.map +1 -1
- package/build/relations/PolymorphicReference.js +7 -6
- package/build/relations/PolymorphicReference.js.map +1 -1
- package/build/relations/ReactiveField.cjs +3 -3
- package/build/relations/ReactiveField.js +3 -3
- package/build/relations/ReactiveGetter.cjs +1 -1
- package/build/relations/ReactiveGetter.js +1 -1
- package/build/relations/ReactiveManyToMany.cjs +5 -4
- package/build/relations/ReactiveManyToMany.cjs.map +1 -1
- package/build/relations/ReactiveManyToMany.d.cts.map +1 -1
- package/build/relations/ReactiveManyToMany.d.mts.map +1 -1
- package/build/relations/ReactiveManyToMany.js +5 -4
- package/build/relations/ReactiveManyToMany.js.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.cjs +3 -3
- package/build/relations/ReactiveManyToManyOtherSide.js +3 -3
- package/build/relations/ReactiveReference.cjs +8 -7
- package/build/relations/ReactiveReference.cjs.map +1 -1
- package/build/relations/ReactiveReference.d.cts.map +1 -1
- package/build/relations/ReactiveReference.d.mts.map +1 -1
- package/build/relations/ReactiveReference.js +8 -7
- package/build/relations/ReactiveReference.js.map +1 -1
- package/build/relations/RecursiveCollection.cjs +3 -3
- package/build/relations/RecursiveCollection.js +3 -3
- package/build/relations/Reference.cjs +1 -1
- package/build/relations/Reference.js +1 -1
- package/build/relations/hasAsyncMethod.cjs +1 -1
- package/build/relations/hasAsyncMethod.js +1 -1
- package/build/relations/hasManyDerived.cjs +1 -1
- package/build/relations/hasManyDerived.js +1 -1
- package/build/relations/hasOneDerived.cjs +2 -2
- package/build/relations/hasOneDerived.js +2 -2
- package/build/relations/hasProperty.cjs +2 -2
- package/build/relations/hasProperty.js +2 -2
- package/build/relations/index.cjs +13 -13
- package/build/relations/index.js +13 -13
- package/build/relations/isCascadeDelete.cjs +11 -0
- package/build/relations/isCascadeDelete.cjs.map +1 -0
- package/build/relations/isCascadeDelete.d.cts +7 -0
- package/build/relations/isCascadeDelete.d.cts.map +1 -0
- package/build/relations/isCascadeDelete.d.mts +7 -0
- package/build/relations/isCascadeDelete.d.mts.map +1 -0
- package/build/relations/isCascadeDelete.js +10 -0
- package/build/relations/isCascadeDelete.js.map +1 -0
- package/build/resurrection.cjs +1 -1
- package/build/resurrection.js +1 -1
- package/build/rules.cjs +4 -4
- package/build/rules.js +4 -4
- package/build/serde.cjs +1 -1
- package/build/serde.js +1 -1
- package/build/unnest.cjs +0 -1
- package/build/unnest.cjs.map +1 -1
- package/build/unnest.d.cts +1 -1
- package/build/unnest.d.mts +1 -1
- package/build/unnest.js +0 -1
- package/build/unnest.js.map +1 -1
- package/build/upsert.cjs +3 -3
- package/build/upsert.js +3 -3
- package/build/utils.cjs +1 -2
- package/build/utils.cjs.map +1 -1
- package/build/utils.d.cts +1 -1
- package/build/utils.d.mts +1 -1
- package/build/utils.js +1 -2
- package/build/utils.js.map +1 -1
- package/build/withLoaded.cjs +3 -3
- package/build/withLoaded.js +3 -3
- package/package.json +2 -2
- package/build/AliasAssigner.cjs.map +0 -1
- package/build/AliasAssigner.d.cts.map +0 -1
- package/build/AliasAssigner.d.mts.map +0 -1
- package/build/AliasAssigner.js.map +0 -1
- package/build/Aliases.cjs.map +0 -1
- package/build/Aliases.d.cts.map +0 -1
- package/build/Aliases.d.mts.map +0 -1
- package/build/Aliases.js.map +0 -1
- package/build/ConditionBuilder.cjs.map +0 -1
- package/build/ConditionBuilder.d.cts.map +0 -1
- package/build/ConditionBuilder.d.mts.map +0 -1
- package/build/ConditionBuilder.js.map +0 -1
- package/build/DeferredAlias.cjs.map +0 -1
- package/build/DeferredAlias.d.cts.map +0 -1
- package/build/DeferredAlias.d.mts.map +0 -1
- package/build/DeferredAlias.js.map +0 -1
- package/build/EntityFilter.cjs.map +0 -1
- package/build/EntityFilter.d.cts.map +0 -1
- package/build/EntityFilter.d.mts.map +0 -1
- package/build/EntityFilter.js.map +0 -1
- package/build/EntityGraphQLFilter.cjs.map +0 -1
- package/build/EntityGraphQLFilter.d.cts.map +0 -1
- package/build/EntityGraphQLFilter.d.mts.map +0 -1
- package/build/EntityGraphQLFilter.js.map +0 -1
- package/build/Expr.cjs.map +0 -1
- package/build/Expr.d.cts.map +0 -1
- package/build/Expr.d.mts.map +0 -1
- package/build/Expr.js.map +0 -1
- package/build/QueryParser.cjs.map +0 -1
- package/build/QueryParser.collectionJoins.cjs.map +0 -1
- package/build/QueryParser.collectionJoins.d.cts.map +0 -1
- package/build/QueryParser.collectionJoins.d.mts.map +0 -1
- package/build/QueryParser.collectionJoins.js.map +0 -1
- package/build/QueryParser.d.cts.map +0 -1
- package/build/QueryParser.d.mts.map +0 -1
- package/build/QueryParser.js.map +0 -1
- package/build/QueryParser.pruning.cjs.map +0 -1
- package/build/QueryParser.pruning.d.cts +0 -10
- package/build/QueryParser.pruning.d.cts.map +0 -1
- package/build/QueryParser.pruning.d.mts +0 -10
- package/build/QueryParser.pruning.d.mts.map +0 -1
- package/build/QueryParser.pruning.js.map +0 -1
- package/build/QueryVisitor.cjs.map +0 -1
- package/build/QueryVisitor.d.cts.map +0 -1
- package/build/QueryVisitor.d.mts.map +0 -1
- package/build/QueryVisitor.js.map +0 -1
- package/build/Tables.cjs.map +0 -1
- package/build/Tables.d.cts.map +0 -1
- package/build/Tables.d.mts.map +0 -1
- package/build/Tables.js.map +0 -1
- package/build/conditions.cjs.map +0 -1
- package/build/conditions.d.cts.map +0 -1
- package/build/conditions.d.mts.map +0 -1
- package/build/conditions.js.map +0 -1
- package/build/drivers/buildRawQuery.cjs.map +0 -1
- package/build/drivers/buildRawQuery.d.cts.map +0 -1
- package/build/drivers/buildRawQuery.d.mts.map +0 -1
- package/build/drivers/buildRawQuery.js.map +0 -1
- package/build/drivers/buildUtils.cjs.map +0 -1
- package/build/drivers/buildUtils.d.cts.map +0 -1
- package/build/drivers/buildUtils.d.mts.map +0 -1
- package/build/drivers/buildUtils.js.map +0 -1
- package/build/execute.cjs.map +0 -1
- package/build/execute.d.cts.map +0 -1
- package/build/execute.d.mts.map +0 -1
- package/build/execute.js.map +0 -1
- package/build/expressions/arrayAgg.cjs.map +0 -1
- package/build/expressions/arrayAgg.d.cts.map +0 -1
- package/build/expressions/arrayAgg.d.mts.map +0 -1
- package/build/expressions/arrayAgg.js.map +0 -1
- package/build/expressions/case.cjs.map +0 -1
- package/build/expressions/case.d.cts.map +0 -1
- package/build/expressions/case.d.mts.map +0 -1
- package/build/expressions/case.js.map +0 -1
- package/build/expressions/coalesce.cjs +0 -25
- package/build/expressions/coalesce.cjs.map +0 -1
- package/build/expressions/coalesce.d.cts.map +0 -1
- package/build/expressions/coalesce.d.mts.map +0 -1
- package/build/expressions/coalesce.js.map +0 -1
- package/build/expressions/codecs.cjs.map +0 -1
- package/build/expressions/codecs.d.cts.map +0 -1
- package/build/expressions/codecs.d.mts.map +0 -1
- package/build/expressions/codecs.js.map +0 -1
- package/build/expressions/expression.cjs +0 -102
- package/build/expressions/expression.cjs.map +0 -1
- package/build/expressions/expression.d.cts.map +0 -1
- package/build/expressions/expression.d.mts.map +0 -1
- package/build/expressions/expression.js.map +0 -1
- package/build/expressions/greatest.cjs +0 -25
- package/build/expressions/greatest.cjs.map +0 -1
- package/build/expressions/greatest.d.cts.map +0 -1
- package/build/expressions/greatest.d.mts.map +0 -1
- package/build/expressions/greatest.js.map +0 -1
- package/build/expressions/least.cjs +0 -25
- package/build/expressions/least.cjs.map +0 -1
- package/build/expressions/least.d.cts.map +0 -1
- package/build/expressions/least.d.mts.map +0 -1
- package/build/expressions/least.js.map +0 -1
- package/build/expressions/nullIf.cjs.map +0 -1
- package/build/expressions/nullIf.d.cts.map +0 -1
- package/build/expressions/nullIf.d.mts.map +0 -1
- package/build/expressions/nullIf.js.map +0 -1
- package/build/expressions/parseExpression.cjs.map +0 -1
- package/build/expressions/parseExpression.d.cts.map +0 -1
- package/build/expressions/parseExpression.d.mts.map +0 -1
- package/build/expressions/parseExpression.js.map +0 -1
- package/build/expressions/types.d.cts.map +0 -1
- package/build/expressions/types.d.mts.map +0 -1
- package/build/keywords.cjs.map +0 -1
- package/build/keywords.d.cts.map +0 -1
- package/build/keywords.d.mts.map +0 -1
- package/build/keywords.js.map +0 -1
- package/build/query.cjs.map +0 -1
- package/build/query.d.cts.map +0 -1
- package/build/query.d.mts.map +0 -1
- package/build/query.js.map +0 -1
- package/build/scopes.cjs.map +0 -1
- package/build/scopes.d.cts.map +0 -1
- package/build/scopes.d.mts.map +0 -1
- package/build/scopes.js.map +0 -1
- package/build/skipCondition.cjs.map +0 -1
- package/build/skipCondition.js.map +0 -1
- /package/build/{expressions → queries/sql/expressions}/types.cjs +0 -0
- /package/build/{expressions → queries/sql/expressions}/types.js +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./BatchLoader.cjs");
|
|
3
|
-
const
|
|
4
|
-
const require_batchloaders_manyToManyBatchLoader = require("./manyToManyBatchLoader.cjs");
|
|
5
|
-
const require_batchloaders_oneToManyBatchLoader = require("./oneToManyBatchLoader.cjs");
|
|
3
|
+
const require_queries_sql_keywords = require("../queries/sql/keywords.cjs");
|
|
6
4
|
const require_batchloaders_oneToOneBatchLoader = require("./oneToOneBatchLoader.cjs");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
require("../EntityMetadata.cjs");
|
|
5
|
+
const require_batchloaders_oneToManyBatchLoader = require("./oneToManyBatchLoader.cjs");
|
|
6
|
+
const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
|
|
10
7
|
const require_reactiveHints = require("../reactiveHints.cjs");
|
|
11
8
|
const require_normalizeHints = require("../normalizeHints.cjs");
|
|
12
9
|
require("../loadHints.cjs");
|
|
13
10
|
const require_utils = require("../utils.cjs");
|
|
11
|
+
const require_batchloaders_manyToManyBatchLoader = require("./manyToManyBatchLoader.cjs");
|
|
12
|
+
const require_relations_ReactiveField = require("../relations/ReactiveField.cjs");
|
|
13
|
+
const require_keys = require("../keys.cjs");
|
|
14
|
+
require("../EntityMetadata.cjs");
|
|
15
|
+
const require_queries_sql_AliasAssigner = require("../queries/sql/AliasAssigner.cjs");
|
|
14
16
|
const require_HintTree = require("../HintTree.cjs");
|
|
15
17
|
require("../index.cjs");
|
|
16
18
|
const require_batchloaders_loadBatchLoader = require("./loadBatchLoader.cjs");
|
|
17
19
|
const require_EntityManager = require("../EntityManager.cjs");
|
|
18
20
|
require("../Entity.cjs");
|
|
19
|
-
const require_QueryParser = require("../QueryParser.cjs");
|
|
20
|
-
const require_AliasAssigner = require("../AliasAssigner.cjs");
|
|
21
21
|
//#region src/batchloaders/populateBatchLoader.ts
|
|
22
22
|
const populateOperation = "populate";
|
|
23
23
|
function populateBatchLoader(em, meta, hint, mode, opts = {}) {
|
|
@@ -30,13 +30,13 @@ function populateBatchLoader(em, meta, hint, mode, opts = {}) {
|
|
|
30
30
|
for (const entity of hint.entities) if (entity[key]?.isLoaded === false && !entity[key]?.isPreloaded) return true;
|
|
31
31
|
return false;
|
|
32
32
|
})) {
|
|
33
|
-
const assigner = new
|
|
33
|
+
const assigner = new require_queries_sql_AliasAssigner.AliasAssigner();
|
|
34
34
|
const meta = layerMeta;
|
|
35
35
|
const alias = assigner.getAlias(meta.tableName);
|
|
36
36
|
const entities = [...layerNode.entities].filter((e) => !e.isNewEntity);
|
|
37
37
|
const ids = entities.map((e) => require_keys.keyToNumber(meta, e.id));
|
|
38
38
|
const query = {
|
|
39
|
-
selects: [
|
|
39
|
+
selects: [require_queries_sql_keywords.kqDot(alias, "id")],
|
|
40
40
|
tables: [{
|
|
41
41
|
alias,
|
|
42
42
|
join: "primary",
|
|
@@ -58,7 +58,7 @@ function populateBatchLoader(em, meta, hint, mode, opts = {}) {
|
|
|
58
58
|
},
|
|
59
59
|
orderBys: []
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
require_queries_find_QueryParser.addTablePerClassJoinsAndClassTag(query, meta, alias, false);
|
|
62
62
|
const hydrator = preloader.addPreloading(meta, layerNode, query);
|
|
63
63
|
if (hydrator) {
|
|
64
64
|
const rows = await em["executeFind"](meta, populateOperation, query, {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populateBatchLoader.cjs","names":["hintKey","getEmInternalApi","AliasAssigner","keyToNumber","kqDot","indexBy","isPolyHint","getRelationFromMaybePolyKey","ReactiveFieldImpl","oneToManyBatchLoader","manyToManyBatchLoader","oneToOneBatchLoader","loadBatchLoader","toArray","buildHintTree"],"sources":["../../src/batchloaders/populateBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityMetadata } from \"../EntityMetadata.ts\";\nimport { type HintNode, buildHintTree } from \"../HintTree.ts\";\nimport {\n AliasAssigner,\n type EntityManager,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n getEmInternalApi,\n indexBy,\n keyToNumber,\n kqDot,\n} from \"../index.ts\";\nimport { type LoadHint } from \"../loadHints.ts\";\nimport { hintKey } from \"../normalizeHints.ts\";\nimport { getRelationFromMaybePolyKey, isPolyHint } from \"../reactiveHints.ts\";\nimport { ReactiveFieldImpl } from \"../relations/ReactiveField.ts\";\nimport { toArray } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\nimport { loadBatchLoader } from \"./loadBatchLoader.ts\";\nimport { manyToManyBatchLoader } from \"./manyToManyBatchLoader.ts\";\nimport { oneToManyBatchLoader } from \"./oneToManyBatchLoader.ts\";\nimport { oneToOneBatchLoader } from \"./oneToOneBatchLoader.ts\";\n\nexport const populateOperation = \"populate\";\n\nexport function populateBatchLoader(\n em: EntityManager,\n meta: EntityMetadata,\n hint: LoadHint<any>,\n mode: \"preload\" | \"intermixed\",\n opts: { forceReload?: boolean } = {},\n): BatchLoader<{ entity: Entity; hint: LoadHint<any> }> {\n // For batching populates, we want different levels of course-ness:\n // - preloading populates that are only SQL should be batched together as much as possible, but\n // - intermixed populates (some with custom relations) should be batched as separately as possible\n // (while still batching identical populates together) to reduce the chance of promise deadlocks.\n //\n // I.e. if we know this is a sql-only hint, we can batch all loads for a given entity\n // together do leverage join-based preloading.\n //\n // However, intermixed batches can be prone to promise deadlocking (one relation .load getting\n // stuck in a batch that is asking for its own dependencies to load), so if this is an intermixed\n // hint, then use a batch key that includes the hint itself, which will make it unlikely\n // for non-sql relations to deadlock on each other/themselves.\n const batchKey =\n mode === \"preload\" ? `${meta.tagName}:${opts.forceReload}` : `${meta.tagName}:${hintKey(hint)}:${opts.forceReload}`;\n return em.getBatchLoader(populateOperation, batchKey, async (populates) => {\n async function populateLayer(layerMeta: EntityMetadata | undefined, layerNode: HintNode<Entity>): Promise<void> {\n // Skip join-based preloading if nothing in this layer needs loading. If any entity in the list\n // needs loading, just load everything\n const { preloader } = getEmInternalApi(em);\n // We may not have a layerMeta if we're going through non-field properties\n if (preloader && layerMeta) {\n const preloadThisLayer = Object.entries(layerNode.hints).some(([key, hint]) => {\n for (const entity of hint.entities) {\n if ((entity as any)[key]?.isLoaded === false && !(entity as any)[key]?.isPreloaded) return true;\n }\n return false;\n });\n if (preloadThisLayer) {\n // Do an up-front SQL call of `select id, ...preloads... from table`,\n const assigner = new AliasAssigner();\n const meta = layerMeta;\n const alias = assigner.getAlias(meta.tableName);\n const entities = [...layerNode.entities].filter((e) => !e.isNewEntity);\n const ids = entities.map((e) => keyToNumber(meta, e.id));\n // Create a ParsedFindQuery for `addPreloading` to inject joins into\n const query: ParsedFindQuery = {\n // We already have the entities loaded, so can do just `SELECT a.id` + the preload columns\n selects: [kqDot(alias, \"id\")],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [\n { kind: \"column\", alias, column: \"id\", dbType: meta.idDbType, cond: { kind: \"in\", value: ids } },\n ],\n },\n orderBys: [],\n };\n // If we're selecting from small_publishers, join in our base class in case\n // the preloader wants to join on a column like `publishers.group_id`\n addTablePerClassJoinsAndClassTag(query, meta, alias, false);\n const hydrator = preloader.addPreloading(meta, layerNode, query);\n if (hydrator) {\n const rows = await em[\"executeFind\"](meta, populateOperation, query, {});\n const entitiesById = indexBy(entities, (e) => keyToNumber(meta, e.id));\n const entitiesInOrder = rows.map((row) => entitiesById.get(row[\"id\"]));\n hydrator(rows, entitiesInOrder);\n }\n }\n }\n\n // First pass: batch SQL relations directly, fall back to relation.load() for non-SQL\n const batchPromises = new Set<Promise<void>>();\n const relationsToPreload: { preload(): void }[] = [];\n const fallbackPromises: (Promise<any> | undefined)[] = [];\n\n for (const [key, tree] of Object.entries(layerNode.hints)) {\n const field = layerMeta?.allFields[key];\n // Hoist the poly-key parsing out of the per-entity loop; most keys are not poly\n const isPoly = isPolyHint(key);\n let loader: BatchLoader<any> | undefined;\n let batchPromise: Promise<void> | undefined;\n for (const entity of tree.entities) {\n const relation = isPoly ? getRelationFromMaybePolyKey(entity, key) : (entity as any)[key];\n // This happens to let through non-relation hints like 'name' on user, which wasn't intentional,\n // but currently doesn't blow up (somehow), and is depended on by internal tests.\n if (!relation || typeof relation.load !== \"function\") {\n // We don't want to throw on poly hints, because they're not actually loaded on the entity\n if (isPoly) continue;\n throw new Error(`Invalid load hint '${key}' on ${entity}`);\n }\n\n // If we're populating a hasReactiveField, don't bother loading it\n // if it's already been calculated (i.e. we have no reason to believe its value\n // is stale, so we should avoid pulling all of its data into memory).\n //\n // (Note that we can't do this same optimization for ReactiveReferenceImpl, because\n // as a FK, it will always need at least some `.load()` to fetch its entity from the database.\n // So we go ahead and call `.load()`, assuming it will just load its cached value, but it\n // will also check internally if it's marked for recalc, and load its load hint if necessary.\n if (relation instanceof ReactiveFieldImpl && relation.isSet) continue;\n if (relation.isLoaded && !opts.forceReload) continue;\n if (relation.isPreloaded) {\n relation.preload();\n continue;\n }\n\n // For non-derived SQL relations on existing entities, use batch loaders directly\n // (1 shared promise per batch instead of per-entity async overhead).\n // Skip new entities (no id) and derived relations (reactive m2m/m2o have extra logic in load).\n if (!entity.isNewEntity && field) {\n if (field.kind === \"o2m\") {\n batchPromise = (loader ??= oneToManyBatchLoader(em, relation)).load(entity.idTagged!);\n relationsToPreload.push(relation);\n continue;\n } else if (field.kind === \"m2m\" && !field.derived) {\n batchPromise = (loader ??= manyToManyBatchLoader(em, relation)).load(\n `${relation.columnName}=${entity.id}`,\n );\n relationsToPreload.push(relation);\n continue;\n } else if (field.kind === \"o2o\") {\n batchPromise = (loader ??= oneToOneBatchLoader(em, relation)).load(entity.idTagged!);\n relationsToPreload.push(relation);\n continue;\n } else if (field.kind === \"m2o\" && !field.derived) {\n const taggedId = relation.idTaggedMaybe;\n if (taggedId) {\n batchPromise = (loader ??= loadBatchLoader(em, field.otherMetadata())).load({\n taggedId,\n hint: undefined,\n });\n relationsToPreload.push(relation);\n continue;\n }\n }\n }\n fallbackPromises.push(relation.load(opts) as Promise<any>);\n }\n if (batchPromise) batchPromises.add(batchPromise);\n }\n\n if (batchPromises.size > 0 || fallbackPromises.length > 0) {\n await Promise.all([Promise.all(batchPromises), Promise.all(fallbackPromises)]);\n }\n for (const relation of relationsToPreload) {\n relation.preload();\n }\n\n // 2nd breadth-width pass to do nested load hints, this will fan out at the sibling level.\n // i.e. populateLayer(...reviews...) & populateLayer(...comments...)\n let nestedLoadPromises: (Promise<void> | undefined)[] | undefined;\n for (const [key, tree] of Object.entries(layerNode.hints)) {\n if (Object.keys(tree.hints).length === 0) continue;\n\n // Get the children we found, i.e. [a1, a2, a3] -> all of their books\n const childrenByParent = new Map<Entity, Entity[]>();\n for (const entity of tree.entities) {\n const relation = getRelationFromMaybePolyKey(entity, key);\n childrenByParent.set(entity, relation ? toArray(getEvenDeleted(relation)) : []);\n }\n if (childrenByParent.size === 0) continue;\n\n // Rewrite our node.entities to be the next layer of children, i.e. children will be all books, for all of\n // `[a1, a2, a3]`, but only the books of `a2` need to recurse into `book: reviews` and only the books of\n // `a3` need to recurse into `book: comments`, so swap `node.entities` (which is currently authors)\n // with the books. This is what prevents our dataloader-merged TreeHint from over-fetching and loading\n // the superset load hint for all entities.\n function rewrite(node: HintNode<Entity>) {\n const next = new Set<Entity>();\n for (const entity of node.entities) {\n const children = childrenByParent.get(entity);\n if (children) for (const child of children) next.add(child);\n }\n node.entities = next;\n Object.values(node.hints).forEach((node) => rewrite(node));\n }\n\n rewrite(tree);\n\n const nextMeta = (layerMeta?.allFields[key] as any)?.otherMetadata?.();\n (nestedLoadPromises ??= []).push(populateLayer(nextMeta, tree));\n }\n if (nestedLoadPromises) await Promise.all(nestedLoadPromises);\n }\n\n await populateLayer(meta, buildHintTree(populates));\n });\n}\n\n/** Probes `relation` to see if it's a m2o/o2m/m2m relation that supports `getWithDeleted`, otherwise calls `get`. */\nfunction getEvenDeleted(relation: any): any {\n return \"getWithDeleted\" in relation ? relation.getWithDeleted : relation.get;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,oBAAoB;AAEjC,SAAgB,oBACd,IACA,MACA,MACA,MACA,OAAkC,CAAC,GACmB;CAatD,MAAM,WACJ,SAAS,YAAY,GAAG,KAAK,QAAQ,GAAG,KAAK,gBAAgB,GAAG,KAAK,QAAQ,GAAGA,uBAAAA,QAAQ,IAAI,EAAE,GAAG,KAAK;CACxG,OAAO,GAAG,eAAe,mBAAmB,UAAU,OAAO,cAAc;EACzE,eAAe,cAAc,WAAuC,WAA4C;GAG9G,MAAM,EAAE,cAAcC,sBAAAA,iBAAiB,EAAE;GAEzC,IAAI,aAAa,WACU;QAAA,OAAO,QAAQ,UAAU,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,UAAU;KAC7E,KAAK,MAAM,UAAU,KAAK,UACxB,IAAK,OAAe,IAAI,EAAE,aAAa,SAAS,CAAE,OAAe,IAAI,EAAE,aAAa,OAAO;KAE7F,OAAO;I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
+
{"version":3,"file":"populateBatchLoader.cjs","names":["hintKey","getEmInternalApi","AliasAssigner","keyToNumber","kqDot","indexBy","isPolyHint","getRelationFromMaybePolyKey","ReactiveFieldImpl","oneToManyBatchLoader","manyToManyBatchLoader","oneToOneBatchLoader","loadBatchLoader","toArray","buildHintTree"],"sources":["../../src/batchloaders/populateBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityMetadata } from \"../EntityMetadata.ts\";\nimport { type HintNode, buildHintTree } from \"../HintTree.ts\";\nimport {\n AliasAssigner,\n type EntityManager,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n getEmInternalApi,\n indexBy,\n keyToNumber,\n kqDot,\n} from \"../index.ts\";\nimport { type LoadHint } from \"../loadHints.ts\";\nimport { hintKey } from \"../normalizeHints.ts\";\nimport { getRelationFromMaybePolyKey, isPolyHint } from \"../reactiveHints.ts\";\nimport { ReactiveFieldImpl } from \"../relations/ReactiveField.ts\";\nimport { toArray } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\nimport { loadBatchLoader } from \"./loadBatchLoader.ts\";\nimport { manyToManyBatchLoader } from \"./manyToManyBatchLoader.ts\";\nimport { oneToManyBatchLoader } from \"./oneToManyBatchLoader.ts\";\nimport { oneToOneBatchLoader } from \"./oneToOneBatchLoader.ts\";\n\nexport const populateOperation = \"populate\";\n\nexport function populateBatchLoader(\n em: EntityManager,\n meta: EntityMetadata,\n hint: LoadHint<any>,\n mode: \"preload\" | \"intermixed\",\n opts: { forceReload?: boolean } = {},\n): BatchLoader<{ entity: Entity; hint: LoadHint<any> }> {\n // For batching populates, we want different levels of course-ness:\n // - preloading populates that are only SQL should be batched together as much as possible, but\n // - intermixed populates (some with custom relations) should be batched as separately as possible\n // (while still batching identical populates together) to reduce the chance of promise deadlocks.\n //\n // I.e. if we know this is a sql-only hint, we can batch all loads for a given entity\n // together do leverage join-based preloading.\n //\n // However, intermixed batches can be prone to promise deadlocking (one relation .load getting\n // stuck in a batch that is asking for its own dependencies to load), so if this is an intermixed\n // hint, then use a batch key that includes the hint itself, which will make it unlikely\n // for non-sql relations to deadlock on each other/themselves.\n const batchKey =\n mode === \"preload\" ? `${meta.tagName}:${opts.forceReload}` : `${meta.tagName}:${hintKey(hint)}:${opts.forceReload}`;\n return em.getBatchLoader(populateOperation, batchKey, async (populates) => {\n async function populateLayer(layerMeta: EntityMetadata | undefined, layerNode: HintNode<Entity>): Promise<void> {\n // Skip join-based preloading if nothing in this layer needs loading. If any entity in the list\n // needs loading, just load everything\n const { preloader } = getEmInternalApi(em);\n // We may not have a layerMeta if we're going through non-field properties\n if (preloader && layerMeta) {\n const preloadThisLayer = Object.entries(layerNode.hints).some(([key, hint]) => {\n for (const entity of hint.entities) {\n if ((entity as any)[key]?.isLoaded === false && !(entity as any)[key]?.isPreloaded) return true;\n }\n return false;\n });\n if (preloadThisLayer) {\n // Do an up-front SQL call of `select id, ...preloads... from table`,\n const assigner = new AliasAssigner();\n const meta = layerMeta;\n const alias = assigner.getAlias(meta.tableName);\n const entities = [...layerNode.entities].filter((e) => !e.isNewEntity);\n const ids = entities.map((e) => keyToNumber(meta, e.id));\n // Create a ParsedFindQuery for `addPreloading` to inject joins into\n const query: ParsedFindQuery = {\n // We already have the entities loaded, so can do just `SELECT a.id` + the preload columns\n selects: [kqDot(alias, \"id\")],\n tables: [{ alias, join: \"primary\", table: meta.tableName }],\n condition: {\n kind: \"exp\",\n op: \"and\",\n conditions: [\n { kind: \"column\", alias, column: \"id\", dbType: meta.idDbType, cond: { kind: \"in\", value: ids } },\n ],\n },\n orderBys: [],\n };\n // If we're selecting from small_publishers, join in our base class in case\n // the preloader wants to join on a column like `publishers.group_id`\n addTablePerClassJoinsAndClassTag(query, meta, alias, false);\n const hydrator = preloader.addPreloading(meta, layerNode, query);\n if (hydrator) {\n const rows = await em[\"executeFind\"](meta, populateOperation, query, {});\n const entitiesById = indexBy(entities, (e) => keyToNumber(meta, e.id));\n const entitiesInOrder = rows.map((row) => entitiesById.get(row[\"id\"]));\n hydrator(rows, entitiesInOrder);\n }\n }\n }\n\n // First pass: batch SQL relations directly, fall back to relation.load() for non-SQL\n const batchPromises = new Set<Promise<void>>();\n const relationsToPreload: { preload(): void }[] = [];\n const fallbackPromises: (Promise<any> | undefined)[] = [];\n\n for (const [key, tree] of Object.entries(layerNode.hints)) {\n const field = layerMeta?.allFields[key];\n // Hoist the poly-key parsing out of the per-entity loop; most keys are not poly\n const isPoly = isPolyHint(key);\n let loader: BatchLoader<any> | undefined;\n let batchPromise: Promise<void> | undefined;\n for (const entity of tree.entities) {\n const relation = isPoly ? getRelationFromMaybePolyKey(entity, key) : (entity as any)[key];\n // This happens to let through non-relation hints like 'name' on user, which wasn't intentional,\n // but currently doesn't blow up (somehow), and is depended on by internal tests.\n if (!relation || typeof relation.load !== \"function\") {\n // We don't want to throw on poly hints, because they're not actually loaded on the entity\n if (isPoly) continue;\n throw new Error(`Invalid load hint '${key}' on ${entity}`);\n }\n\n // If we're populating a hasReactiveField, don't bother loading it\n // if it's already been calculated (i.e. we have no reason to believe its value\n // is stale, so we should avoid pulling all of its data into memory).\n //\n // (Note that we can't do this same optimization for ReactiveReferenceImpl, because\n // as a FK, it will always need at least some `.load()` to fetch its entity from the database.\n // So we go ahead and call `.load()`, assuming it will just load its cached value, but it\n // will also check internally if it's marked for recalc, and load its load hint if necessary.\n if (relation instanceof ReactiveFieldImpl && relation.isSet) continue;\n if (relation.isLoaded && !opts.forceReload) continue;\n if (relation.isPreloaded) {\n relation.preload();\n continue;\n }\n\n // For non-derived SQL relations on existing entities, use batch loaders directly\n // (1 shared promise per batch instead of per-entity async overhead).\n // Skip new entities (no id) and derived relations (reactive m2m/m2o have extra logic in load).\n if (!entity.isNewEntity && field) {\n if (field.kind === \"o2m\") {\n batchPromise = (loader ??= oneToManyBatchLoader(em, relation)).load(entity.idTagged!);\n relationsToPreload.push(relation);\n continue;\n } else if (field.kind === \"m2m\" && !field.derived) {\n batchPromise = (loader ??= manyToManyBatchLoader(em, relation)).load(\n `${relation.columnName}=${entity.id}`,\n );\n relationsToPreload.push(relation);\n continue;\n } else if (field.kind === \"o2o\") {\n batchPromise = (loader ??= oneToOneBatchLoader(em, relation)).load(entity.idTagged!);\n relationsToPreload.push(relation);\n continue;\n } else if (field.kind === \"m2o\" && !field.derived) {\n const taggedId = relation.idTaggedMaybe;\n if (taggedId) {\n batchPromise = (loader ??= loadBatchLoader(em, field.otherMetadata())).load({\n taggedId,\n hint: undefined,\n });\n relationsToPreload.push(relation);\n continue;\n }\n }\n }\n fallbackPromises.push(relation.load(opts) as Promise<any>);\n }\n if (batchPromise) batchPromises.add(batchPromise);\n }\n\n if (batchPromises.size > 0 || fallbackPromises.length > 0) {\n await Promise.all([Promise.all(batchPromises), Promise.all(fallbackPromises)]);\n }\n for (const relation of relationsToPreload) {\n relation.preload();\n }\n\n // 2nd breadth-width pass to do nested load hints, this will fan out at the sibling level.\n // i.e. populateLayer(...reviews...) & populateLayer(...comments...)\n let nestedLoadPromises: (Promise<void> | undefined)[] | undefined;\n for (const [key, tree] of Object.entries(layerNode.hints)) {\n if (Object.keys(tree.hints).length === 0) continue;\n\n // Get the children we found, i.e. [a1, a2, a3] -> all of their books\n const childrenByParent = new Map<Entity, Entity[]>();\n for (const entity of tree.entities) {\n const relation = getRelationFromMaybePolyKey(entity, key);\n childrenByParent.set(entity, relation ? toArray(getEvenDeleted(relation)) : []);\n }\n if (childrenByParent.size === 0) continue;\n\n // Rewrite our node.entities to be the next layer of children, i.e. children will be all books, for all of\n // `[a1, a2, a3]`, but only the books of `a2` need to recurse into `book: reviews` and only the books of\n // `a3` need to recurse into `book: comments`, so swap `node.entities` (which is currently authors)\n // with the books. This is what prevents our dataloader-merged TreeHint from over-fetching and loading\n // the superset load hint for all entities.\n function rewrite(node: HintNode<Entity>) {\n const next = new Set<Entity>();\n for (const entity of node.entities) {\n const children = childrenByParent.get(entity);\n if (children) for (const child of children) next.add(child);\n }\n node.entities = next;\n Object.values(node.hints).forEach((node) => rewrite(node));\n }\n\n rewrite(tree);\n\n const nextMeta = (layerMeta?.allFields[key] as any)?.otherMetadata?.();\n (nestedLoadPromises ??= []).push(populateLayer(nextMeta, tree));\n }\n if (nestedLoadPromises) await Promise.all(nestedLoadPromises);\n }\n\n await populateLayer(meta, buildHintTree(populates));\n });\n}\n\n/** Probes `relation` to see if it's a m2o/o2m/m2m relation that supports `getWithDeleted`, otherwise calls `get`. */\nfunction getEvenDeleted(relation: any): any {\n return \"getWithDeleted\" in relation ? relation.getWithDeleted : relation.get;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,oBAAoB;AAEjC,SAAgB,oBACd,IACA,MACA,MACA,MACA,OAAkC,CAAC,GACmB;CAatD,MAAM,WACJ,SAAS,YAAY,GAAG,KAAK,QAAQ,GAAG,KAAK,gBAAgB,GAAG,KAAK,QAAQ,GAAGA,uBAAAA,QAAQ,IAAI,EAAE,GAAG,KAAK;CACxG,OAAO,GAAG,eAAe,mBAAmB,UAAU,OAAO,cAAc;EACzE,eAAe,cAAc,WAAuC,WAA4C;GAG9G,MAAM,EAAE,cAAcC,sBAAAA,iBAAiB,EAAE;GAEzC,IAAI,aAAa,WACU;QAAA,OAAO,QAAQ,UAAU,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,UAAU;KAC7E,KAAK,MAAM,UAAU,KAAK,UACxB,IAAK,OAAe,IAAI,EAAE,aAAa,SAAS,CAAE,OAAe,IAAI,EAAE,aAAa,OAAO;KAE7F,OAAO;IACT,CACmB,GAAG;KAEpB,MAAM,WAAW,IAAIC,kCAAAA,cAAc;KACnC,MAAM,OAAO;KACb,MAAM,QAAQ,SAAS,SAAS,KAAK,SAAS;KAC9C,MAAM,WAAW,CAAC,GAAG,UAAU,QAAQ,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,WAAW;KACrE,MAAM,MAAM,SAAS,KAAK,MAAMC,aAAAA,YAAY,MAAM,EAAE,EAAE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IAAI,OAAO,KAAK,KAAK,KAAK,CAAC,CAAC,WAAW,GAAG;IAG1C,MAAM,mCAAmB,IAAI,IAAsB;IACnD,KAAK,MAAM,UAAU,KAAK,UAAU;KAClC,MAAM,WAAWL,sBAAAA,4BAA4B,QAAQ,GAAG;KACxD,iBAAiB,IAAI,QAAQ,WAAWM,cAAAA,QAAQ,eAAe,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChF;IACA,IAAI,iBAAiB,SAAS,GAAG;IAOjC,SAAS,QAAQ,MAAwB;KACvC,MAAM,uBAAO,IAAI,IAAY;KAC7B,KAAK,MAAM,UAAU,KAAK,UAAU;MAClC,MAAM,WAAW,iBAAiB,IAAI,MAAM;MAC5C,IAAI,UAAU,KAAK,MAAM,SAAS,UAAU,KAAK,IAAI,KAAK;KAC5D;KACA,KAAK,WAAW;KAChB,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,SAAS,QAAQ,IAAI,CAAC;IAC3D;IAEA,QAAQ,IAAI;IAEZ,MAAM,YAAY,WAAW,UAAU,KAAA,EAAc,gBAAgB;IACrE,CAAC,uBAAuB,CAAC,EAAA,CAAG,KAAK,cAAc,UAAU,IAAI,CAAC;GAChE;GACA,IAAI,oBAAoB,MAAM,QAAQ,IAAI,kBAAkB;EAC9D;EAEA,MAAM,cAAc,MAAMC,iBAAAA,cAAc,SAAS,CAAC;CACpD,CAAC;AACH;;AAGA,SAAS,eAAe,UAAoB;CAC1C,OAAO,oBAAoB,WAAW,SAAS,iBAAiB,SAAS;AAC3E"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import "./BatchLoader.js";
|
|
2
|
-
import { kqDot } from "../keywords.js";
|
|
3
|
-
import { manyToManyBatchLoader } from "./manyToManyBatchLoader.js";
|
|
4
|
-
import { oneToManyBatchLoader } from "./oneToManyBatchLoader.js";
|
|
2
|
+
import { kqDot } from "../queries/sql/keywords.js";
|
|
5
3
|
import { oneToOneBatchLoader } from "./oneToOneBatchLoader.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "../EntityMetadata.js";
|
|
4
|
+
import { oneToManyBatchLoader } from "./oneToManyBatchLoader.js";
|
|
5
|
+
import { addTablePerClassJoinsAndClassTag } from "../queries/find/QueryParser.js";
|
|
9
6
|
import { getRelationFromMaybePolyKey, isPolyHint } from "../reactiveHints.js";
|
|
10
7
|
import { hintKey } from "../normalizeHints.js";
|
|
11
8
|
import "../loadHints.js";
|
|
12
9
|
import { indexBy, toArray } from "../utils.js";
|
|
10
|
+
import { manyToManyBatchLoader } from "./manyToManyBatchLoader.js";
|
|
11
|
+
import { ReactiveFieldImpl } from "../relations/ReactiveField.js";
|
|
12
|
+
import { keyToNumber } from "../keys.js";
|
|
13
|
+
import "../EntityMetadata.js";
|
|
14
|
+
import { AliasAssigner } from "../queries/sql/AliasAssigner.js";
|
|
13
15
|
import { buildHintTree } from "../HintTree.js";
|
|
14
16
|
import "../index.js";
|
|
15
17
|
import { loadBatchLoader } from "./loadBatchLoader.js";
|
|
16
18
|
import { getEmInternalApi } from "../EntityManager.js";
|
|
17
19
|
import "../Entity.js";
|
|
18
|
-
import { addTablePerClassJoinsAndClassTag } from "../QueryParser.js";
|
|
19
|
-
import { AliasAssigner } from "../AliasAssigner.js";
|
|
20
20
|
//#region src/batchloaders/populateBatchLoader.ts
|
|
21
21
|
const populateOperation = "populate";
|
|
22
22
|
function populateBatchLoader(em, meta, hint, mode, opts = {}) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./BatchLoader.cjs");
|
|
3
|
-
const require_keywords = require("../keywords.cjs");
|
|
4
3
|
const require_relations_Collection = require("../relations/Collection.cjs");
|
|
4
|
+
const require_fields = require("../fields.cjs");
|
|
5
|
+
const require_queries_sql_keywords = require("../queries/sql/keywords.cjs");
|
|
6
|
+
const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
|
|
5
7
|
const require_relations_OneToOneReference = require("../relations/OneToOneReference.cjs");
|
|
6
8
|
require("../relations/RecursiveCollection.cjs");
|
|
7
|
-
const require_keys = require("../keys.cjs");
|
|
8
|
-
const require_fields = require("../fields.cjs");
|
|
9
9
|
const require_utils = require("../utils.cjs");
|
|
10
|
+
const require_keys = require("../keys.cjs");
|
|
11
|
+
const require_configure = require("../configure.cjs");
|
|
10
12
|
require("../index.cjs");
|
|
11
13
|
const require_EntityManager = require("../EntityManager.cjs");
|
|
12
14
|
require("../Entity.cjs");
|
|
13
|
-
const require_configure = require("../configure.cjs");
|
|
14
|
-
const require_QueryParser = require("../QueryParser.cjs");
|
|
15
15
|
//#region src/batchloaders/recursiveChildrenBatchLoader.ts
|
|
16
16
|
const recursiveChildrenOperation = "o2m-recursive";
|
|
17
17
|
function recursiveChildrenBatchLoader(em, collection) {
|
|
@@ -46,16 +46,16 @@ function recursiveChildrenBatchLoader(em, collection) {
|
|
|
46
46
|
query: {
|
|
47
47
|
kind: "raw",
|
|
48
48
|
sql: `
|
|
49
|
-
SELECT b.id, b.${columnName} FROM ${
|
|
49
|
+
SELECT b.id, b.${columnName} FROM ${require_queries_sql_keywords.kq(meta.tableName)} b WHERE b.${columnName} = ANY(?)
|
|
50
50
|
UNION
|
|
51
|
-
SELECT r.id, r.${columnName} FROM ${
|
|
51
|
+
SELECT r.id, r.${columnName} FROM ${require_queries_sql_keywords.kq(meta.tableName)} r JOIN ${alias}_cte ON r.${columnName} = ${alias}_cte.id
|
|
52
52
|
`,
|
|
53
53
|
bindings: [require_keys.deTagIds(meta, parents.map((e) => e.idTagged))]
|
|
54
54
|
},
|
|
55
55
|
recursive: true
|
|
56
56
|
}]
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
require_queries_find_QueryParser.addTablePerClassJoinsAndClassTag(query, meta, alias, true);
|
|
59
59
|
const rowData = await em["executeFindRowData"](meta, recursiveChildrenOperation, query, {});
|
|
60
60
|
const entities = em["hydrateAndFinalize"](meta.cstr, rowData);
|
|
61
61
|
const entitiesById = require_utils.groupBy(entities, (entity) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveChildrenBatchLoader.cjs","names":["getMetadataForType","abbreviation","kq","deTagIds","groupBy","maybeResolveReferenceToId","getField","isLoadedCollection","isLoadedOneToOneReference"],"sources":["../../src/batchloaders/recursiveChildrenBatchLoader.ts"],"sourcesContent":["import { getMetadataForType } from \"../configure.ts\";\nimport { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport {\n type ManyToOneField,\n type OneToManyField,\n type OneToOneField,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n deTagIds,\n getField,\n isLoadedCollection,\n isLoadedOneToOneReference,\n kq,\n maybeResolveReferenceToId,\n} from \"../index.ts\";\nimport { type RecursiveChildrenCollectionImpl } from \"../relations/RecursiveCollection.ts\";\nimport { abbreviation, groupBy } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const recursiveChildrenOperation = \"o2m-recursive\";\n\nexport function recursiveChildrenBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: RecursiveChildrenCollectionImpl<T, U>,\n): BatchLoader<Entity> {\n let { meta, fieldName } = collection;\n // This could be called from subtypes to get relations defined on the parent. So we need to make sure we are using the\n // correct meta by walking the inheritance tree until we find the meta that actually has the root o2m field\n // We intentionally don't use getMetadataForField here because CTI-specialized fields stay on the subtype metadata,\n // while these raw recursive CTEs need the metadata/table that physically owns the FK column.\n while (!(collection.o2mFieldName in meta.fields) && meta.baseType) meta = getMetadataForType(meta.baseType);\n const batchKey = `${meta.tableName}-${fieldName}`;\n return em.getBatchLoader(recursiveChildrenOperation, batchKey, async (parents) => {\n const o2m = meta.allFields[collection.o2mFieldName] as OneToManyField | OneToOneField;\n const m2o = meta.allFields[o2m.otherFieldName] as ManyToOneField;\n const { columnName } = m2o.serde.columns[0];\n\n const alias = abbreviation(meta.tableName);\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [\n // We still select directly from our table, and join into the CTE so that we\n // can use `addTablePerClassJoinsAndClassTag` to get inheritance added for free.\n { alias, join: \"primary\", table: meta.tableName },\n { alias: `${alias}_cte`, join: \"inner\", table: `${alias}_cte`, col1: `${alias}.id`, col2: `${alias}_cte.id` },\n ],\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n ctes: [\n {\n alias: `${alias}_cte`,\n query: {\n kind: \"raw\",\n // b is our base case, which is the immediate children of the parents, and r is the\n // recursive case of finding their children.\n sql: `\n SELECT b.id, b.${columnName} FROM ${kq(meta.tableName)} b WHERE b.${columnName} = ANY(?)\n UNION\n SELECT r.id, r.${columnName} FROM ${kq(meta.tableName)} r JOIN ${alias}_cte ON r.${columnName} = ${alias}_cte.id\n `,\n // RecursiveChildrenCollectionImpl won't call `.load` on new entities, so we can assume entities have an id\n bindings: [\n deTagIds(\n meta,\n parents.map((e) => e.idTagged),\n ),\n ],\n },\n recursive: true,\n },\n ],\n };\n\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](meta, recursiveChildrenOperation, query, {});\n const entities = em[\"hydrateAndFinalize\"](meta.cstr, rowData);\n\n // For all the entities we found, group them by their parent (or the root node, which has no parent)\n const entitiesById = groupBy(entities, (entity) => {\n const parentId = maybeResolveReferenceToId(getField(entity, m2o.fieldName));\n return parentId ?? \"root\";\n });\n\n // For each found parent, use the preloading infra to inject the children into the relation\n for (const [parentId, children] of entitiesById) {\n if (parentId !== \"root\") {\n getEmInternalApi(em).setPreloadedRelation(parentId, o2m.fieldName, children);\n // I thought we could delay calling this, but currently `em.populate` calls `preload()` explicitly\n (em.getEntity(parentId) as any)[o2m.fieldName].preload();\n }\n }\n\n // Any entity[o2m] still not loaded must be a leaf which didn't have any children; go ahead and mark it as loaded\n for (const entity of [...parents, ...entities]) {\n if (!isLoadedCollection(entity[o2m.fieldName]) && !isLoadedOneToOneReference(entity[o2m.fieldName])) {\n getEmInternalApi(em).setPreloadedRelation(entity.id, o2m.fieldName, []);\n entity[o2m.fieldName].preload();\n }\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAa,6BAA6B;AAE1C,SAAgB,6BACd,IACA,YACqB;CACrB,IAAI,EAAE,MAAM,cAAc;CAK1B,OAAO,EAAE,WAAW,gBAAgB,KAAK,WAAW,KAAK,UAAU,OAAOA,kBAAAA,mBAAmB,KAAK,QAAQ;CAC1G,MAAM,WAAW,GAAG,KAAK,UAAU,GAAG;CACtC,OAAO,GAAG,eAAe,4BAA4B,UAAU,OAAO,YAAY;EAChF,MAAM,MAAM,KAAK,UAAU,WAAW;EACtC,MAAM,MAAM,KAAK,UAAU,IAAI;EAC/B,MAAM,EAAE,eAAe,IAAI,MAAM,QAAQ;EAEzC,MAAM,QAAQC,cAAAA,aAAa,KAAK,SAAS;EACzC,MAAM,QAAyB;GAC7B,SAAS,CAAC,IAAI,MAAM,IAAI;GACxB,QAAQ,CAGN;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,GAChD;IAAE,OAAO,GAAG,MAAM;IAAO,MAAM;IAAS,OAAO,GAAG,MAAM;IAAO,MAAM,GAAG,MAAM;IAAM,MAAM,GAAG,MAAM;GAAS,CAC9G;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;GAChD,MAAM,CACJ;IACE,OAAO,GAAG,MAAM;IAChB,OAAO;KACL,MAAM;KAGN,KAAK;8BACa,WAAW,QAAQC,
|
|
1
|
+
{"version":3,"file":"recursiveChildrenBatchLoader.cjs","names":["getMetadataForType","abbreviation","kq","deTagIds","groupBy","maybeResolveReferenceToId","getField","isLoadedCollection","isLoadedOneToOneReference"],"sources":["../../src/batchloaders/recursiveChildrenBatchLoader.ts"],"sourcesContent":["import { getMetadataForType } from \"../configure.ts\";\nimport { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport {\n type ManyToOneField,\n type OneToManyField,\n type OneToOneField,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n deTagIds,\n getField,\n isLoadedCollection,\n isLoadedOneToOneReference,\n kq,\n maybeResolveReferenceToId,\n} from \"../index.ts\";\nimport { type RecursiveChildrenCollectionImpl } from \"../relations/RecursiveCollection.ts\";\nimport { abbreviation, groupBy } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const recursiveChildrenOperation = \"o2m-recursive\";\n\nexport function recursiveChildrenBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: RecursiveChildrenCollectionImpl<T, U>,\n): BatchLoader<Entity> {\n let { meta, fieldName } = collection;\n // This could be called from subtypes to get relations defined on the parent. So we need to make sure we are using the\n // correct meta by walking the inheritance tree until we find the meta that actually has the root o2m field\n // We intentionally don't use getMetadataForField here because CTI-specialized fields stay on the subtype metadata,\n // while these raw recursive CTEs need the metadata/table that physically owns the FK column.\n while (!(collection.o2mFieldName in meta.fields) && meta.baseType) meta = getMetadataForType(meta.baseType);\n const batchKey = `${meta.tableName}-${fieldName}`;\n return em.getBatchLoader(recursiveChildrenOperation, batchKey, async (parents) => {\n const o2m = meta.allFields[collection.o2mFieldName] as OneToManyField | OneToOneField;\n const m2o = meta.allFields[o2m.otherFieldName] as ManyToOneField;\n const { columnName } = m2o.serde.columns[0];\n\n const alias = abbreviation(meta.tableName);\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [\n // We still select directly from our table, and join into the CTE so that we\n // can use `addTablePerClassJoinsAndClassTag` to get inheritance added for free.\n { alias, join: \"primary\", table: meta.tableName },\n { alias: `${alias}_cte`, join: \"inner\", table: `${alias}_cte`, col1: `${alias}.id`, col2: `${alias}_cte.id` },\n ],\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n ctes: [\n {\n alias: `${alias}_cte`,\n query: {\n kind: \"raw\",\n // b is our base case, which is the immediate children of the parents, and r is the\n // recursive case of finding their children.\n sql: `\n SELECT b.id, b.${columnName} FROM ${kq(meta.tableName)} b WHERE b.${columnName} = ANY(?)\n UNION\n SELECT r.id, r.${columnName} FROM ${kq(meta.tableName)} r JOIN ${alias}_cte ON r.${columnName} = ${alias}_cte.id\n `,\n // RecursiveChildrenCollectionImpl won't call `.load` on new entities, so we can assume entities have an id\n bindings: [\n deTagIds(\n meta,\n parents.map((e) => e.idTagged),\n ),\n ],\n },\n recursive: true,\n },\n ],\n };\n\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](meta, recursiveChildrenOperation, query, {});\n const entities = em[\"hydrateAndFinalize\"](meta.cstr, rowData);\n\n // For all the entities we found, group them by their parent (or the root node, which has no parent)\n const entitiesById = groupBy(entities, (entity) => {\n const parentId = maybeResolveReferenceToId(getField(entity, m2o.fieldName));\n return parentId ?? \"root\";\n });\n\n // For each found parent, use the preloading infra to inject the children into the relation\n for (const [parentId, children] of entitiesById) {\n if (parentId !== \"root\") {\n getEmInternalApi(em).setPreloadedRelation(parentId, o2m.fieldName, children);\n // I thought we could delay calling this, but currently `em.populate` calls `preload()` explicitly\n (em.getEntity(parentId) as any)[o2m.fieldName].preload();\n }\n }\n\n // Any entity[o2m] still not loaded must be a leaf which didn't have any children; go ahead and mark it as loaded\n for (const entity of [...parents, ...entities]) {\n if (!isLoadedCollection(entity[o2m.fieldName]) && !isLoadedOneToOneReference(entity[o2m.fieldName])) {\n getEmInternalApi(em).setPreloadedRelation(entity.id, o2m.fieldName, []);\n entity[o2m.fieldName].preload();\n }\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAa,6BAA6B;AAE1C,SAAgB,6BACd,IACA,YACqB;CACrB,IAAI,EAAE,MAAM,cAAc;CAK1B,OAAO,EAAE,WAAW,gBAAgB,KAAK,WAAW,KAAK,UAAU,OAAOA,kBAAAA,mBAAmB,KAAK,QAAQ;CAC1G,MAAM,WAAW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U,aAAa,cACjC,IAAI,aAAa,QAAQ;GACvB,sBAAA,iBAAiB,EAAE,CAAC,CAAC,qBAAqB,UAAU,IAAI,WAAW,QAAQ;GAE3E,GAAI,UAAU,QAAQ,CAAC,CAAS,IAAI,UAAU,CAAC,QAAQ;EACzD;EAIF,KAAK,MAAM,UAAU,CAAC,GAAG,SAAS,GAAG,QAAQ,GAC3C,IAAI,CAACC,6BAAAA,mBAAmB,OAAO,IAAI,UAAU,KAAK,CAACC,oCAAAA,0BAA0B,OAAO,IAAI,UAAU,GAAG;GACnG,sBAAA,iBAAiB,EAAE,CAAC,CAAC,qBAAqB,OAAO,IAAI,IAAI,WAAW,CAAC,CAAC;GACtE,OAAO,IAAI,UAAU,CAAC,QAAQ;EAChC;CAEJ,CAAC;AACH"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "./BatchLoader.js";
|
|
2
|
-
import { kq } from "../keywords.js";
|
|
3
2
|
import { isLoadedCollection } from "../relations/Collection.js";
|
|
3
|
+
import { getField } from "../fields.js";
|
|
4
|
+
import { kq } from "../queries/sql/keywords.js";
|
|
5
|
+
import { addTablePerClassJoinsAndClassTag } from "../queries/find/QueryParser.js";
|
|
4
6
|
import { isLoadedOneToOneReference } from "../relations/OneToOneReference.js";
|
|
5
7
|
import "../relations/RecursiveCollection.js";
|
|
6
|
-
import { deTagIds, maybeResolveReferenceToId } from "../keys.js";
|
|
7
|
-
import { getField } from "../fields.js";
|
|
8
8
|
import { abbreviation, groupBy } from "../utils.js";
|
|
9
|
+
import { deTagIds, maybeResolveReferenceToId } from "../keys.js";
|
|
10
|
+
import { getMetadataForType } from "../configure.js";
|
|
9
11
|
import "../index.js";
|
|
10
12
|
import { getEmInternalApi } from "../EntityManager.js";
|
|
11
13
|
import "../Entity.js";
|
|
12
|
-
import { getMetadataForType } from "../configure.js";
|
|
13
|
-
import { addTablePerClassJoinsAndClassTag } from "../QueryParser.js";
|
|
14
14
|
//#region src/batchloaders/recursiveChildrenBatchLoader.ts
|
|
15
15
|
const recursiveChildrenOperation = "o2m-recursive";
|
|
16
16
|
function recursiveChildrenBatchLoader(em, collection) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./BatchLoader.cjs");
|
|
3
|
-
const require_keywords = require("../keywords.cjs");
|
|
4
3
|
const require_relations_Collection = require("../relations/Collection.cjs");
|
|
4
|
+
const require_queries_sql_keywords = require("../queries/sql/keywords.cjs");
|
|
5
5
|
require("../relations/RecursiveCollection.cjs");
|
|
6
|
+
const require_utils = require("../utils.cjs");
|
|
6
7
|
const require_keys = require("../keys.cjs");
|
|
7
8
|
const require_EntityMetadata = require("../EntityMetadata.cjs");
|
|
8
|
-
const require_utils = require("../utils.cjs");
|
|
9
9
|
require("../index.cjs");
|
|
10
10
|
const require_EntityManager = require("../EntityManager.cjs");
|
|
11
11
|
require("../Entity.cjs");
|
|
@@ -23,7 +23,7 @@ function recursiveM2mBatchLoader(em, collection) {
|
|
|
23
23
|
const seedIds = require_keys.deTagIds(meta, entities.map((e) => e.idTagged));
|
|
24
24
|
const jt = require_utils.abbreviation(joinTableName);
|
|
25
25
|
const query = {
|
|
26
|
-
selects: [
|
|
26
|
+
selects: [require_queries_sql_keywords.kqStar(jt)],
|
|
27
27
|
tables: [{
|
|
28
28
|
alias: jt,
|
|
29
29
|
join: "primary",
|
|
@@ -39,9 +39,9 @@ function recursiveM2mBatchLoader(em, collection) {
|
|
|
39
39
|
query: {
|
|
40
40
|
kind: "raw",
|
|
41
41
|
sql: `
|
|
42
|
-
SELECT b.* FROM ${
|
|
42
|
+
SELECT b.* FROM ${require_queries_sql_keywords.kq(joinTableName)} b WHERE ${require_queries_sql_keywords.kqDot("b", thisColumn)} = ANY(?)
|
|
43
43
|
UNION
|
|
44
|
-
SELECT r.* FROM ${
|
|
44
|
+
SELECT r.* FROM ${require_queries_sql_keywords.kq(joinTableName)} r JOIN cte ON ${require_queries_sql_keywords.kqDot("r", thisColumn)} = cte.${require_queries_sql_keywords.kq(otherColumn)}
|
|
45
45
|
`,
|
|
46
46
|
bindings: [seedIds]
|
|
47
47
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveM2mBatchLoader.cjs","names":["getMetadataForField","deTagIds","abbreviation","kqStar","kq","kqDot","keyToTaggedId","getEmInternalApi","isLoadedCollection"],"sources":["../../src/batchloaders/recursiveM2mBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport {\n type ManyToManyField,\n type ParsedFindQuery,\n deTagIds,\n getMetadataForField,\n isLoadedCollection,\n keyToTaggedId,\n kq,\n kqDot,\n kqStar,\n} from \"../index.ts\";\nimport { type RecursiveM2mCollectionImpl } from \"../relations/RecursiveCollection.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const recursiveM2mOperation = \"m2m-recursive\";\n\nexport function recursiveM2mBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: RecursiveM2mCollectionImpl<T, U>,\n): BatchLoader<Entity> {\n let { meta, fieldName } = collection;\n meta = getMetadataForField(meta, collection.m2mFieldName);\n const batchKey = `${meta.tableName}-${fieldName}`;\n return em.getBatchLoader(recursiveM2mOperation, batchKey, async (entities) => {\n const m2mField = meta.allFields[collection.m2mFieldName] as ManyToManyField;\n const { joinTableName, columnNames } = m2mField;\n const thisColumn = columnNames[0];\n const otherColumn = columnNames[1];\n\n const seedIds = deTagIds(\n meta,\n entities.map((e) => e.idTagged),\n );\n\n // Use a recursive CTE to walk the join table and return all join rows for the seed\n // entities and all transitively-reachable entities. JoinRows.loadRows then calls\n // em.loadAll internally to hydrate the actual entities on both sides.\n const jt = abbreviation(joinTableName);\n const query: ParsedFindQuery = {\n selects: [kqStar(jt)],\n tables: [{ alias: jt, join: \"primary\", table: \"cte\" }],\n orderBys: [{ alias: jt, column: \"id\", order: \"ASC\" }],\n ctes: [\n {\n alias: \"cte\",\n query: {\n kind: \"raw\",\n // Base case returns full join rows for the seed entities; recursive case\n // follows otherColumn → thisColumn to discover transitively-reachable rows.\n sql: `\n SELECT b.* FROM ${kq(joinTableName)} b WHERE ${kqDot(\"b\", thisColumn)} = ANY(?)\n UNION\n SELECT r.* FROM ${kq(joinTableName)} r JOIN cte ON ${kqDot(\"r\", thisColumn)} = cte.${kq(otherColumn)}\n `,\n bindings: [seedIds],\n },\n recursive: true,\n },\n ],\n };\n\n const joinTableRows = await em[\"executeFind\"](\n meta,\n recursiveM2mOperation,\n query,\n // No LIMIT needed for join rows\n { limit: undefined },\n );\n\n // Collect all entity IDs from both sides of the join rows. Entities that only appear\n // on otherColumn (not thisColumn) are leaf nodes with no outgoing connections — since\n // the CTE transitively discovers everything reachable, we know their m2m is empty and\n // can mark it loaded here, avoiding a separate load via findUnloadedCollections.\n const uniqueIds = new Set(entities.map((e) => e.idTagged));\n for (const row of joinTableRows) {\n uniqueIds.add(keyToTaggedId(meta, row[thisColumn])!);\n uniqueIds.add(keyToTaggedId(meta, row[otherColumn])!);\n }\n\n const m2mCollection = (entities[0] as any)[collection.m2mFieldName];\n const joinRows = getEmInternalApi(em).joinRows(m2mCollection);\n\n // loadRows calls em.loadAll internally to hydrate all referenced entities\n const tuples: [string, string][] = [...uniqueIds].map((id) => [thisColumn, id]);\n await joinRows.loadRows(tuples, joinTableRows);\n\n // Set preloaded relations and call preload() for each entity's m2m collection\n const api = getEmInternalApi(em);\n for (const id of uniqueIds) {\n const entity = em.getEntity(id);\n if (!entity) continue;\n const others = joinRows.getOthers(thisColumn, entity);\n api.setPreloadedRelation(entity.idTagged!, m2mField.fieldName, others);\n (entity as any)[m2mField.fieldName].preload();\n }\n\n // Mark any entity whose m2m is still not loaded as having an empty collection (leaf nodes)\n for (const id of uniqueIds) {\n const entity = em.getEntity(id);\n if (!entity) continue;\n if (!isLoadedCollection((entity as any)[m2mField.fieldName])) {\n api.setPreloadedRelation(entity.idTagged!, m2mField.fieldName, []);\n (entity as any)[m2mField.fieldName].preload();\n }\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,wBAAwB;AAErC,SAAgB,wBACd,IACA,YACqB;CACrB,IAAI,EAAE,MAAM,cAAc;CAC1B,OAAOA,uBAAAA,oBAAoB,MAAM,WAAW,YAAY;CACxD,MAAM,WAAW,GAAG,KAAK,UAAU,GAAG;CACtC,OAAO,GAAG,eAAe,uBAAuB,UAAU,OAAO,aAAa;EAC5E,MAAM,WAAW,KAAK,UAAU,WAAW;EAC3C,MAAM,EAAE,eAAe,gBAAgB;EACvC,MAAM,aAAa,YAAY;EAC/B,MAAM,cAAc,YAAY;EAEhC,MAAM,UAAUC,aAAAA,SACd,MACA,SAAS,KAAK,MAAM,EAAE,QAAQ,CAChC;EAKA,MAAM,KAAKC,cAAAA,aAAa,aAAa;EACrC,MAAM,QAAyB;GAC7B,SAAS,CAACC,
|
|
1
|
+
{"version":3,"file":"recursiveM2mBatchLoader.cjs","names":["getMetadataForField","deTagIds","abbreviation","kqStar","kq","kqDot","keyToTaggedId","getEmInternalApi","isLoadedCollection"],"sources":["../../src/batchloaders/recursiveM2mBatchLoader.ts"],"sourcesContent":["import { type Entity } from \"../Entity.ts\";\nimport { type EntityManager, getEmInternalApi } from \"../EntityManager.ts\";\nimport {\n type ManyToManyField,\n type ParsedFindQuery,\n deTagIds,\n getMetadataForField,\n isLoadedCollection,\n keyToTaggedId,\n kq,\n kqDot,\n kqStar,\n} from \"../index.ts\";\nimport { type RecursiveM2mCollectionImpl } from \"../relations/RecursiveCollection.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const recursiveM2mOperation = \"m2m-recursive\";\n\nexport function recursiveM2mBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: RecursiveM2mCollectionImpl<T, U>,\n): BatchLoader<Entity> {\n let { meta, fieldName } = collection;\n meta = getMetadataForField(meta, collection.m2mFieldName);\n const batchKey = `${meta.tableName}-${fieldName}`;\n return em.getBatchLoader(recursiveM2mOperation, batchKey, async (entities) => {\n const m2mField = meta.allFields[collection.m2mFieldName] as ManyToManyField;\n const { joinTableName, columnNames } = m2mField;\n const thisColumn = columnNames[0];\n const otherColumn = columnNames[1];\n\n const seedIds = deTagIds(\n meta,\n entities.map((e) => e.idTagged),\n );\n\n // Use a recursive CTE to walk the join table and return all join rows for the seed\n // entities and all transitively-reachable entities. JoinRows.loadRows then calls\n // em.loadAll internally to hydrate the actual entities on both sides.\n const jt = abbreviation(joinTableName);\n const query: ParsedFindQuery = {\n selects: [kqStar(jt)],\n tables: [{ alias: jt, join: \"primary\", table: \"cte\" }],\n orderBys: [{ alias: jt, column: \"id\", order: \"ASC\" }],\n ctes: [\n {\n alias: \"cte\",\n query: {\n kind: \"raw\",\n // Base case returns full join rows for the seed entities; recursive case\n // follows otherColumn → thisColumn to discover transitively-reachable rows.\n sql: `\n SELECT b.* FROM ${kq(joinTableName)} b WHERE ${kqDot(\"b\", thisColumn)} = ANY(?)\n UNION\n SELECT r.* FROM ${kq(joinTableName)} r JOIN cte ON ${kqDot(\"r\", thisColumn)} = cte.${kq(otherColumn)}\n `,\n bindings: [seedIds],\n },\n recursive: true,\n },\n ],\n };\n\n const joinTableRows = await em[\"executeFind\"](\n meta,\n recursiveM2mOperation,\n query,\n // No LIMIT needed for join rows\n { limit: undefined },\n );\n\n // Collect all entity IDs from both sides of the join rows. Entities that only appear\n // on otherColumn (not thisColumn) are leaf nodes with no outgoing connections — since\n // the CTE transitively discovers everything reachable, we know their m2m is empty and\n // can mark it loaded here, avoiding a separate load via findUnloadedCollections.\n const uniqueIds = new Set(entities.map((e) => e.idTagged));\n for (const row of joinTableRows) {\n uniqueIds.add(keyToTaggedId(meta, row[thisColumn])!);\n uniqueIds.add(keyToTaggedId(meta, row[otherColumn])!);\n }\n\n const m2mCollection = (entities[0] as any)[collection.m2mFieldName];\n const joinRows = getEmInternalApi(em).joinRows(m2mCollection);\n\n // loadRows calls em.loadAll internally to hydrate all referenced entities\n const tuples: [string, string][] = [...uniqueIds].map((id) => [thisColumn, id]);\n await joinRows.loadRows(tuples, joinTableRows);\n\n // Set preloaded relations and call preload() for each entity's m2m collection\n const api = getEmInternalApi(em);\n for (const id of uniqueIds) {\n const entity = em.getEntity(id);\n if (!entity) continue;\n const others = joinRows.getOthers(thisColumn, entity);\n api.setPreloadedRelation(entity.idTagged!, m2mField.fieldName, others);\n (entity as any)[m2mField.fieldName].preload();\n }\n\n // Mark any entity whose m2m is still not loaded as having an empty collection (leaf nodes)\n for (const id of uniqueIds) {\n const entity = em.getEntity(id);\n if (!entity) continue;\n if (!isLoadedCollection((entity as any)[m2mField.fieldName])) {\n api.setPreloadedRelation(entity.idTagged!, m2mField.fieldName, []);\n (entity as any)[m2mField.fieldName].preload();\n }\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,wBAAwB;AAErC,SAAgB,wBACd,IACA,YACqB;CACrB,IAAI,EAAE,MAAM,cAAc;CAC1B,OAAOA,uBAAAA,oBAAoB,MAAM,WAAW,YAAY;CACxD,MAAM,WAAW,GAAG,KAAK,UAAU,GAAG;CACtC,OAAO,GAAG,eAAe,uBAAuB,UAAU,OAAO,aAAa;EAC5E,MAAM,WAAW,KAAK,UAAU,WAAW;EAC3C,MAAM,EAAE,eAAe,gBAAgB;EACvC,MAAM,aAAa,YAAY;EAC/B,MAAM,cAAc,YAAY;EAEhC,MAAM,UAAUC,aAAAA,SACd,MACA,SAAS,KAAK,MAAM,EAAE,QAAQ,CAChC;EAKA,MAAM,KAAKC,cAAAA,aAAa,aAAa;EACrC,MAAM,QAAyB;GAC7B,SAAS,CAACC,6BAAAA,OAAO,EAAE,CAAC;GACpB,QAAQ,CAAC;IAAE,OAAO;IAAI,MAAM;IAAW,OAAO;GAAM,CAAC;GACrD,UAAU,CAAC;IAAE,OAAO;IAAI,QA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AAI,CAAC,QAAQ;GACb,IAAI,CAACC,6BAAAA,mBAAoB,OAAe,SAAS,UAAU,GAAG;IAC5D,IAAI,qBAAqB,OAAO,UAAW,SAAS,WAAW,CAAC,CAAC;IACjE,OAAgB,SAAS,UAAU,CAAC,QAAQ;GAC9C;EACF;CACF,CAAC;AACH"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./BatchLoader.js";
|
|
2
|
-
import { kq, kqDot, kqStar } from "../keywords.js";
|
|
3
2
|
import { isLoadedCollection } from "../relations/Collection.js";
|
|
3
|
+
import { kq, kqDot, kqStar } from "../queries/sql/keywords.js";
|
|
4
4
|
import "../relations/RecursiveCollection.js";
|
|
5
|
+
import { abbreviation } from "../utils.js";
|
|
5
6
|
import { deTagIds, keyToTaggedId } from "../keys.js";
|
|
6
7
|
import { getMetadataForField } from "../EntityMetadata.js";
|
|
7
|
-
import { abbreviation } from "../utils.js";
|
|
8
8
|
import "../index.js";
|
|
9
9
|
import { getEmInternalApi } from "../EntityManager.js";
|
|
10
10
|
import "../Entity.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./BatchLoader.cjs");
|
|
3
|
-
const require_keywords = require("../keywords.cjs");
|
|
4
|
-
require("../relations/RecursiveCollection.cjs");
|
|
5
|
-
const require_keys = require("../keys.cjs");
|
|
6
3
|
const require_fields = require("../fields.cjs");
|
|
4
|
+
const require_queries_sql_keywords = require("../queries/sql/keywords.cjs");
|
|
5
|
+
const require_queries_find_QueryParser = require("../queries/find/QueryParser.cjs");
|
|
6
|
+
require("../relations/RecursiveCollection.cjs");
|
|
7
7
|
const require_utils = require("../utils.cjs");
|
|
8
|
+
const require_keys = require("../keys.cjs");
|
|
9
|
+
const require_configure = require("../configure.cjs");
|
|
8
10
|
require("../index.cjs");
|
|
9
11
|
require("../EntityManager.cjs");
|
|
10
12
|
require("../Entity.cjs");
|
|
11
|
-
const require_configure = require("../configure.cjs");
|
|
12
|
-
const require_QueryParser = require("../QueryParser.cjs");
|
|
13
13
|
//#region src/batchloaders/recursiveParentsBatchLoader.ts
|
|
14
14
|
const recursiveParentsOperation = "m2o-recursive";
|
|
15
15
|
function recursiveParentsBatchLoader(em, collection) {
|
|
@@ -44,16 +44,16 @@ function recursiveParentsBatchLoader(em, collection) {
|
|
|
44
44
|
query: {
|
|
45
45
|
kind: "raw",
|
|
46
46
|
sql: `
|
|
47
|
-
SELECT b.id, b.${columnName} FROM ${
|
|
47
|
+
SELECT b.id, b.${columnName} FROM ${require_queries_sql_keywords.kq(meta.tableName)} b WHERE b.id = ANY(?)
|
|
48
48
|
UNION
|
|
49
|
-
SELECT r.id, r.${columnName} FROM ${
|
|
49
|
+
SELECT r.id, r.${columnName} FROM ${require_queries_sql_keywords.kq(meta.tableName)} r JOIN ${alias}_cte ON r.id = ${alias}_cte.${columnName}
|
|
50
50
|
`,
|
|
51
51
|
bindings: [require_keys.deTagIds(meta, immediateParentIds)]
|
|
52
52
|
},
|
|
53
53
|
recursive: true
|
|
54
54
|
}]
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
require_queries_find_QueryParser.addTablePerClassJoinsAndClassTag(query, meta, alias, true);
|
|
57
57
|
const rowData = await em["executeFindRowData"](meta, recursiveParentsOperation, query, {});
|
|
58
58
|
em["hydrateAndFinalize"](meta.cstr, rowData);
|
|
59
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recursiveParentsBatchLoader.cjs","names":["getMetadataForType","getField","abbreviation","kq","deTagIds"],"sources":["../../src/batchloaders/recursiveParentsBatchLoader.ts"],"sourcesContent":["import { getMetadataForType } from \"../configure.ts\";\nimport { type Entity } from \"../Entity.ts\";\nimport { type EntityManager } from \"../EntityManager.ts\";\nimport {\n type ManyToOneField,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n deTagIds,\n getField,\n kq,\n} from \"../index.ts\";\nimport { type RecursiveParentsCollectionImpl } from \"../relations/RecursiveCollection.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const recursiveParentsOperation = \"m2o-recursive\";\n\nexport function recursiveParentsBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: RecursiveParentsCollectionImpl<T, U>,\n): BatchLoader<Entity> {\n let { meta, fieldName } = collection;\n // This could be called from subtypes to get relations defined on the parent. So we need to make sure we are using the\n // correct meta by walking the inheritance tree until we find the meta that actually has the root m2o field\n // We intentionally don't use getMetadataForField here because CTI-specialized fields stay on the subtype metadata,\n // while these raw recursive CTEs need the metadata/table that physically owns the FK column.\n while (!(collection.m2oFieldName in meta.fields) && meta.baseType) meta = getMetadataForType(meta.baseType);\n const batchKey = `${meta.tableName}-${fieldName}`;\n return em.getBatchLoader(recursiveParentsOperation, batchKey, async (children) => {\n const m2o = meta.allFields[collection.m2oFieldName] as ManyToOneField;\n // ...can `getField` return a new entity? In theory, we shouldn't see new entities because\n // RecursiveParentsCollectionImpl.load/isLoaded will see the `ManyToOneReferenceImpl` as loaded.\n const immediateParentIds = children.map((c) => getField(c, m2o.fieldName)).filter((id: any) => id !== undefined);\n const { columnName } = m2o.serde.columns[0];\n\n const alias = abbreviation(meta.tableName);\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [\n // We still select directly from our table, and join into the CTE so that we\n // can use `addTablePerClassJoinsAndClassTag` to get inheritance added for free.\n { alias, join: \"primary\", table: meta.tableName },\n { alias: `${alias}_cte`, join: \"inner\", table: `${alias}_cte`, col1: `${alias}.id`, col2: `${alias}_cte.id` },\n ],\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n ctes: [\n {\n alias: `${alias}_cte`,\n query: {\n kind: \"raw\",\n // b is our base case, which is the immediate parents of the children we're loading,\n // and r is the recursive case of finding their parents.\n sql: `\n SELECT b.id, b.${columnName} FROM ${kq(meta.tableName)} b WHERE b.id = ANY(?)\n UNION\n SELECT r.id, r.${columnName} FROM ${kq(meta.tableName)} r JOIN ${alias}_cte ON r.id = ${alias}_cte.${columnName}\n `,\n bindings: [deTagIds(meta, immediateParentIds)],\n },\n recursive: true,\n },\n ],\n };\n\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](meta, recursiveParentsOperation, query, {});\n\n // Since we're preloading m2os up the tree, merely having the entities in the EM is enough\n // for the ManyToOneReferenceImpl to find them, so we don't need to map them back to the\n // keys, or push them into the preloader cache.\n em[\"hydrateAndFinalize\"](meta.cstr, rowData);\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,4BAA4B;AAEzC,SAAgB,4BACd,IACA,YACqB;CACrB,IAAI,EAAE,MAAM,cAAc;CAK1B,OAAO,EAAE,WAAW,gBAAgB,KAAK,WAAW,KAAK,UAAU,OAAOA,kBAAAA,mBAAmB,KAAK,QAAQ;CAC1G,MAAM,WAAW,GAAG,KAAK,UAAU,GAAG;CACtC,OAAO,GAAG,eAAe,2BAA2B,UAAU,OAAO,aAAa;EAChF,MAAM,MAAM,KAAK,UAAU,WAAW;EAGtC,MAAM,qBAAqB,SAAS,KAAK,MAAMC,eAAAA,SAAS,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,QAAQ,OAAY,OAAO,KAAA,CAAS;EAC/G,MAAM,EAAE,eAAe,IAAI,MAAM,QAAQ;EAEzC,MAAM,QAAQC,cAAAA,aAAa,KAAK,SAAS;EACzC,MAAM,QAAyB;GAC7B,SAAS,CAAC,IAAI,MAAM,IAAI;GACxB,QAAQ,CAGN;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,GAChD;IAAE,OAAO,GAAG,MAAM;IAAO,MAAM;IAAS,OAAO,GAAG,MAAM;IAAO,MAAM,GAAG,MAAM;IAAM,MAAM,GAAG,MAAM;GAAS,CAC9G;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;GAChD,MAAM,CACJ;IACE,OAAO,GAAG,MAAM;IAChB,OAAO;KACL,MAAM;KAGN,KAAK;+BACc,WAAW,QAAQC,
|
|
1
|
+
{"version":3,"file":"recursiveParentsBatchLoader.cjs","names":["getMetadataForType","getField","abbreviation","kq","deTagIds"],"sources":["../../src/batchloaders/recursiveParentsBatchLoader.ts"],"sourcesContent":["import { getMetadataForType } from \"../configure.ts\";\nimport { type Entity } from \"../Entity.ts\";\nimport { type EntityManager } from \"../EntityManager.ts\";\nimport {\n type ManyToOneField,\n type ParsedFindQuery,\n addTablePerClassJoinsAndClassTag,\n deTagIds,\n getField,\n kq,\n} from \"../index.ts\";\nimport { type RecursiveParentsCollectionImpl } from \"../relations/RecursiveCollection.ts\";\nimport { abbreviation } from \"../utils.ts\";\nimport { type BatchLoader } from \"./BatchLoader.ts\";\n\nexport const recursiveParentsOperation = \"m2o-recursive\";\n\nexport function recursiveParentsBatchLoader<T extends Entity, U extends Entity>(\n em: EntityManager,\n collection: RecursiveParentsCollectionImpl<T, U>,\n): BatchLoader<Entity> {\n let { meta, fieldName } = collection;\n // This could be called from subtypes to get relations defined on the parent. So we need to make sure we are using the\n // correct meta by walking the inheritance tree until we find the meta that actually has the root m2o field\n // We intentionally don't use getMetadataForField here because CTI-specialized fields stay on the subtype metadata,\n // while these raw recursive CTEs need the metadata/table that physically owns the FK column.\n while (!(collection.m2oFieldName in meta.fields) && meta.baseType) meta = getMetadataForType(meta.baseType);\n const batchKey = `${meta.tableName}-${fieldName}`;\n return em.getBatchLoader(recursiveParentsOperation, batchKey, async (children) => {\n const m2o = meta.allFields[collection.m2oFieldName] as ManyToOneField;\n // ...can `getField` return a new entity? In theory, we shouldn't see new entities because\n // RecursiveParentsCollectionImpl.load/isLoaded will see the `ManyToOneReferenceImpl` as loaded.\n const immediateParentIds = children.map((c) => getField(c, m2o.fieldName)).filter((id: any) => id !== undefined);\n const { columnName } = m2o.serde.columns[0];\n\n const alias = abbreviation(meta.tableName);\n const query: ParsedFindQuery = {\n selects: [`\"${alias}\".*`],\n tables: [\n // We still select directly from our table, and join into the CTE so that we\n // can use `addTablePerClassJoinsAndClassTag` to get inheritance added for free.\n { alias, join: \"primary\", table: meta.tableName },\n { alias: `${alias}_cte`, join: \"inner\", table: `${alias}_cte`, col1: `${alias}.id`, col2: `${alias}_cte.id` },\n ],\n orderBys: [{ alias, column: \"id\", order: \"ASC\" }],\n ctes: [\n {\n alias: `${alias}_cte`,\n query: {\n kind: \"raw\",\n // b is our base case, which is the immediate parents of the children we're loading,\n // and r is the recursive case of finding their parents.\n sql: `\n SELECT b.id, b.${columnName} FROM ${kq(meta.tableName)} b WHERE b.id = ANY(?)\n UNION\n SELECT r.id, r.${columnName} FROM ${kq(meta.tableName)} r JOIN ${alias}_cte ON r.id = ${alias}_cte.${columnName}\n `,\n bindings: [deTagIds(meta, immediateParentIds)],\n },\n recursive: true,\n },\n ],\n };\n\n addTablePerClassJoinsAndClassTag(query, meta, alias, true);\n\n const rowData = await em[\"executeFindRowData\"](meta, recursiveParentsOperation, query, {});\n\n // Since we're preloading m2os up the tree, merely having the entities in the EM is enough\n // for the ManyToOneReferenceImpl to find them, so we don't need to map them back to the\n // keys, or push them into the preloader cache.\n em[\"hydrateAndFinalize\"](meta.cstr, rowData);\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,4BAA4B;AAEzC,SAAgB,4BACd,IACA,YACqB;CACrB,IAAI,EAAE,MAAM,cAAc;CAK1B,OAAO,EAAE,WAAW,gBAAgB,KAAK,WAAW,KAAK,UAAU,OAAOA,kBAAAA,mBAAmB,KAAK,QAAQ;CAC1G,MAAM,WAAW,GAAG,KAAK,UAAU,GAAG;CACtC,OAAO,GAAG,eAAe,2BAA2B,UAAU,OAAO,aAAa;EAChF,MAAM,MAAM,KAAK,UAAU,WAAW;EAGtC,MAAM,qBAAqB,SAAS,KAAK,MAAMC,eAAAA,SAAS,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,QAAQ,OAAY,OAAO,KAAA,CAAS;EAC/G,MAAM,EAAE,eAAe,IAAI,MAAM,QAAQ;EAEzC,MAAM,QAAQC,cAAAA,aAAa,KAAK,SAAS;EACzC,MAAM,QAAyB;GAC7B,SAAS,CAAC,IAAI,MAAM,IAAI;GACxB,QAAQ,CAGN;IAAE;IAAO,MAAM;IAAW,OAAO,KAAK;GAAU,GAChD;IAAE,OAAO,GAAG,MAAM;IAAO,MAAM;IAAS,OAAO,GAAG,MAAM;IAAO,MAAM,GAAG,MAAM;IAAM,MAAM,GAAG,MAAM;GAAS,CAC9G;GACA,UAAU,CAAC;IAAE;IAAO,QAAQ;IAAM,OAAO;GAAM,CAAC;GAChD,MAAM,CACJ;IACE,OAAO,GAAG,MAAM;IAChB,OAAO;KACL,MAAM;KAGN,KAAK;+BACc,WAAW,QAAQC,6BAAAA,GAAG,KAAK,SAAS,EAAE;;+BAEtC,WAAW,QAAQA,6BAAAA,GAAG,KAAK,SAAS,EAAE,UAAU,MAAM,iBAAiB,MAAM,OAAO,WAAW;;KAElH,UAAU,CAACC,aAAAA,SAAS,MAAM,kBAAkB,CAAC;IAC/C;IACA,WAAW;GACb,CACF;EACF;EAEA,iCAAA,iCAAiC,OAAO,MAAM,OAAO,IAAI;EAEzD,MAAM,UAAU,MAAM,GAAG,qBAAqB,CAAC,MAAM,2BAA2B,OAAO,CAAC,CAAC;EAKzF,GAAG,qBAAqB,CAAC,KAAK,MAAM,OAAO;CAC7C,CAAC;AACH"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "./BatchLoader.js";
|
|
2
|
-
import { kq } from "../keywords.js";
|
|
3
|
-
import "../relations/RecursiveCollection.js";
|
|
4
|
-
import { deTagIds } from "../keys.js";
|
|
5
2
|
import { getField } from "../fields.js";
|
|
3
|
+
import { kq } from "../queries/sql/keywords.js";
|
|
4
|
+
import { addTablePerClassJoinsAndClassTag } from "../queries/find/QueryParser.js";
|
|
5
|
+
import "../relations/RecursiveCollection.js";
|
|
6
6
|
import { abbreviation } from "../utils.js";
|
|
7
|
+
import { deTagIds } from "../keys.js";
|
|
8
|
+
import { getMetadataForType } from "../configure.js";
|
|
7
9
|
import "../index.js";
|
|
8
10
|
import "../EntityManager.js";
|
|
9
11
|
import "../Entity.js";
|
|
10
|
-
import { getMetadataForType } from "../configure.js";
|
|
11
|
-
import { addTablePerClassJoinsAndClassTag } from "../QueryParser.js";
|
|
12
12
|
//#region src/batchloaders/recursiveParentsBatchLoader.ts
|
|
13
13
|
const recursiveParentsOperation = "m2o-recursive";
|
|
14
14
|
function recursiveParentsBatchLoader(em, collection) {
|
package/build/changes.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./
|
|
2
|
+
const require_fields = require("./fields.cjs");
|
|
3
|
+
require("./JoinRows.cjs");
|
|
3
4
|
require("./relations/EnumCollection.cjs");
|
|
4
5
|
const require_relations_LazyField = require("./relations/LazyField.cjs");
|
|
5
|
-
require("./
|
|
6
|
-
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
7
|
-
const require_fields = require("./fields.cjs");
|
|
6
|
+
require("./typeMap.cjs");
|
|
8
7
|
const require_utils = require("./utils.cjs");
|
|
8
|
+
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
9
9
|
require("./index.cjs");
|
|
10
10
|
const require_EntityManager = require("./EntityManager.cjs");
|
|
11
11
|
const require_Entity = require("./Entity.cjs");
|
package/build/changes.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import { getField, isChangeableField } from "./fields.js";
|
|
2
|
+
import "./JoinRows.js";
|
|
2
3
|
import "./relations/EnumCollection.js";
|
|
3
4
|
import { notLoadedValue } from "./relations/LazyField.js";
|
|
4
|
-
import "./
|
|
5
|
-
import { getMetadata } from "./EntityMetadata.js";
|
|
6
|
-
import { getField, isChangeableField } from "./fields.js";
|
|
5
|
+
import "./typeMap.js";
|
|
7
6
|
import { assertNever } from "./utils.js";
|
|
7
|
+
import { getMetadata } from "./EntityMetadata.js";
|
|
8
8
|
import "./index.js";
|
|
9
9
|
import { getEmInternalApi, isId } from "./EntityManager.js";
|
|
10
10
|
import { isEntity } from "./Entity.js";
|
package/build/config.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
3
2
|
const require_reactiveHints = require("./reactiveHints.cjs");
|
|
4
3
|
const require_utils = require("./utils.cjs");
|
|
5
4
|
require("./rules.cjs");
|
|
5
|
+
const require_configure = require("./configure.cjs");
|
|
6
|
+
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
7
|
+
const require_defaults = require("./defaults.cjs");
|
|
6
8
|
require("./index.cjs");
|
|
7
9
|
require("./Entity.cjs");
|
|
8
|
-
const require_defaults = require("./defaults.cjs");
|
|
9
|
-
const require_configure = require("./configure.cjs");
|
|
10
10
|
//#region src/config.ts
|
|
11
11
|
const constraintNameToValidationError = {};
|
|
12
12
|
let booted = false;
|
package/build/config.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getMetadata } from "./EntityMetadata.js";
|
|
2
1
|
import { convertToLoadHint } from "./reactiveHints.js";
|
|
3
2
|
import { fail } from "./utils.js";
|
|
4
3
|
import "./rules.js";
|
|
4
|
+
import { resetConstructorMap } from "./configure.js";
|
|
5
|
+
import { getMetadata } from "./EntityMetadata.js";
|
|
6
|
+
import { AsyncDefault } from "./defaults.js";
|
|
5
7
|
import "./index.js";
|
|
6
8
|
import "./Entity.js";
|
|
7
|
-
import { AsyncDefault } from "./defaults.js";
|
|
8
|
-
import { resetConstructorMap } from "./configure.js";
|
|
9
9
|
//#region src/config.ts
|
|
10
10
|
const constraintNameToValidationError = {};
|
|
11
11
|
let booted = false;
|
package/build/configure.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_reactiveHints = require("./reactiveHints.cjs");
|
|
3
|
+
const require_utils = require("./utils.cjs");
|
|
2
4
|
const require_getProperties = require("./getProperties.cjs");
|
|
3
5
|
require("./relations/ReactiveField.cjs");
|
|
4
6
|
const require_relations_AsyncReactiveField = require("./relations/AsyncReactiveField.cjs");
|
|
5
7
|
require("./relations/index.cjs");
|
|
6
8
|
const require_keys = require("./keys.cjs");
|
|
7
9
|
const require_fieldSerde = require("./fieldSerde.cjs");
|
|
8
|
-
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
9
|
-
const require_reactiveHints = require("./reactiveHints.cjs");
|
|
10
|
-
const require_utils = require("./utils.cjs");
|
|
11
|
-
const require_runtimeConfig = require("./runtimeConfig.cjs");
|
|
12
10
|
const require_rules = require("./rules.cjs");
|
|
11
|
+
const require_runtimeConfig = require("./runtimeConfig.cjs");
|
|
12
|
+
const require_config = require("./config.cjs");
|
|
13
|
+
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
14
|
+
const require_defaults = require("./defaults.cjs");
|
|
13
15
|
require("./EntityManager.cjs");
|
|
14
16
|
require("./Entity.cjs");
|
|
15
|
-
const require_defaults = require("./defaults.cjs");
|
|
16
|
-
const require_config = require("./config.cjs");
|
|
17
17
|
//#region src/configure.ts
|
|
18
18
|
const tagToConstructorMap = /* @__PURE__ */ new Map();
|
|
19
19
|
const tableToMetaMap = /* @__PURE__ */ new Map();
|
package/build/configure.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import { reverseReactiveHint } from "./reactiveHints.js";
|
|
2
|
+
import { defineLazyGetter, fail } from "./utils.js";
|
|
1
3
|
import { getProperties } from "./getProperties.js";
|
|
2
4
|
import "./relations/ReactiveField.js";
|
|
3
5
|
import { AsyncReactiveFieldImpl } from "./relations/AsyncReactiveField.js";
|
|
4
6
|
import "./relations/index.js";
|
|
5
7
|
import { maybeResolveReferenceToId, setTaggedIdDelimiter, tagFromId } from "./keys.js";
|
|
6
8
|
import { SimpleFieldSerde } from "./fieldSerde.js";
|
|
7
|
-
import { getBaseAndSelfMetas, getBaseSelfAndSubMetas, getMetadata } from "./EntityMetadata.js";
|
|
8
|
-
import { reverseReactiveHint } from "./reactiveHints.js";
|
|
9
|
-
import { defineLazyGetter, fail } from "./utils.js";
|
|
10
|
-
import { maybeGetRuntimeConfig } from "./runtimeConfig.js";
|
|
11
9
|
import { isCannotBeUpdatedRule } from "./rules.js";
|
|
10
|
+
import { maybeGetRuntimeConfig } from "./runtimeConfig.js";
|
|
11
|
+
import { setAfterMetadataLocked, setBooted } from "./config.js";
|
|
12
|
+
import { getBaseAndSelfMetas, getBaseSelfAndSubMetas, getMetadata } from "./EntityMetadata.js";
|
|
13
|
+
import { AsyncDefault } from "./defaults.js";
|
|
12
14
|
import "./EntityManager.js";
|
|
13
15
|
import "./Entity.js";
|
|
14
|
-
import { AsyncDefault } from "./defaults.js";
|
|
15
|
-
import { setAfterMetadataLocked, setBooted } from "./config.js";
|
|
16
16
|
//#region src/configure.ts
|
|
17
17
|
const tagToConstructorMap = /* @__PURE__ */ new Map();
|
|
18
18
|
const tableToMetaMap = /* @__PURE__ */ new Map();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_temporal = require("../temporal.cjs");
|
|
3
|
+
const require_queries_find_Aliases = require("../queries/find/Aliases.cjs");
|
|
2
4
|
const require_relations_Reference = require("../relations/Reference.cjs");
|
|
3
5
|
require("../relations/index.cjs");
|
|
4
|
-
const require_temporal = require("../temporal.cjs");
|
|
5
6
|
const require_temporalMappers = require("../temporalMappers.cjs");
|
|
6
7
|
const require_Entity = require("../Entity.cjs");
|
|
7
|
-
const require_Aliases = require("../Aliases.cjs");
|
|
8
8
|
//#region src/dataloaders/fastWhereFilterHash.ts
|
|
9
9
|
const Temporal = require_temporal.maybeRequireTemporal()?.Temporal;
|
|
10
10
|
/**
|
|
@@ -33,7 +33,7 @@ function appendStableValue(key, value, seen) {
|
|
|
33
33
|
case "boolean": return `${key}b${value ? 1 : 0};`;
|
|
34
34
|
case "bigint": return `${key}i${value.toString()};`;
|
|
35
35
|
case "object": return appendStableObject(key, value, seen);
|
|
36
|
-
case "function": return
|
|
36
|
+
case "function": return require_queries_find_Aliases.isAlias(value) ? `${key}xalias;` : void 0;
|
|
37
37
|
default: return;
|
|
38
38
|
}
|
|
39
39
|
}
|