joist-core 2.4.0-next.37 → 2.4.0-next.39
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/BaseEntity.d.cts +3 -4
- package/build/BaseEntity.d.cts.map +1 -1
- package/build/BaseEntity.d.mts +3 -4
- package/build/BaseEntity.d.mts.map +1 -1
- package/build/Entity.d.cts +3 -4
- package/build/Entity.d.cts.map +1 -1
- package/build/Entity.d.mts +3 -4
- package/build/Entity.d.mts.map +1 -1
- package/build/EntityFields.d.cts +3 -4
- package/build/EntityFields.d.cts.map +1 -1
- package/build/EntityFields.d.mts +3 -4
- package/build/EntityFields.d.mts.map +1 -1
- package/build/EntityManager.cjs +11 -3
- package/build/EntityManager.cjs.map +1 -1
- package/build/EntityManager.d.cts +47 -41
- package/build/EntityManager.d.cts.map +1 -1
- package/build/EntityManager.d.mts +47 -41
- package/build/EntityManager.d.mts.map +1 -1
- package/build/EntityManager.js +11 -3
- package/build/EntityManager.js.map +1 -1
- package/build/EntityMetadata.d.cts +31 -32
- package/build/EntityMetadata.d.cts.map +1 -1
- package/build/EntityMetadata.d.mts +31 -32
- package/build/EntityMetadata.d.mts.map +1 -1
- package/build/EnumMetadata.d.cts +1 -2
- package/build/EnumMetadata.d.cts.map +1 -1
- package/build/EnumMetadata.d.mts +1 -2
- package/build/EnumMetadata.d.mts.map +1 -1
- package/build/IndexManager.cjs.map +1 -1
- package/build/IndexManager.d.cts +2 -3
- package/build/IndexManager.d.cts.map +1 -1
- package/build/IndexManager.d.mts +2 -3
- package/build/IndexManager.d.mts.map +1 -1
- package/build/IndexManager.js.map +1 -1
- package/build/InstanceData.cjs.map +1 -1
- package/build/InstanceData.d.cts +1 -2
- package/build/InstanceData.d.cts.map +1 -1
- package/build/InstanceData.d.mts +1 -2
- package/build/InstanceData.d.mts.map +1 -1
- package/build/InstanceData.js.map +1 -1
- package/build/PluginManager.cjs.map +1 -1
- package/build/PluginManager.d.cts +4 -4
- package/build/PluginManager.d.cts.map +1 -1
- package/build/PluginManager.d.mts +4 -4
- package/build/PluginManager.d.mts.map +1 -1
- package/build/PluginManager.js.map +1 -1
- package/build/RowData.d.cts +3 -4
- package/build/RowData.d.cts.map +1 -1
- package/build/RowData.d.mts +3 -4
- package/build/RowData.d.mts.map +1 -1
- package/build/batchloaders/BatchLoader.cjs.map +1 -1
- package/build/batchloaders/BatchLoader.d.cts +1 -2
- package/build/batchloaders/BatchLoader.d.cts.map +1 -1
- package/build/batchloaders/BatchLoader.d.mts +1 -2
- package/build/batchloaders/BatchLoader.d.mts.map +1 -1
- package/build/batchloaders/BatchLoader.js.map +1 -1
- package/build/batchloaders/enumCollectionBatchLoader.d.cts +2 -3
- package/build/batchloaders/enumCollectionBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/enumCollectionBatchLoader.d.mts +2 -3
- package/build/batchloaders/enumCollectionBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/loadBatchLoader.d.cts +2 -3
- package/build/batchloaders/loadBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/loadBatchLoader.d.mts +2 -3
- package/build/batchloaders/loadBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/manyToManyBatchLoader.d.cts +2 -3
- package/build/batchloaders/manyToManyBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/manyToManyBatchLoader.d.mts +2 -3
- package/build/batchloaders/manyToManyBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.d.cts +2 -3
- package/build/batchloaders/oneToManyBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.d.mts +2 -3
- package/build/batchloaders/oneToManyBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.d.cts +2 -3
- package/build/batchloaders/oneToOneBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.d.mts +2 -3
- package/build/batchloaders/oneToOneBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/populateBatchLoader.d.cts +2 -3
- package/build/batchloaders/populateBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/populateBatchLoader.d.mts +2 -3
- package/build/batchloaders/populateBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/recursiveChildrenBatchLoader.d.cts +2 -3
- package/build/batchloaders/recursiveChildrenBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/recursiveChildrenBatchLoader.d.mts +2 -3
- package/build/batchloaders/recursiveChildrenBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/recursiveM2mBatchLoader.d.cts +2 -3
- package/build/batchloaders/recursiveM2mBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/recursiveM2mBatchLoader.d.mts +2 -3
- package/build/batchloaders/recursiveM2mBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/recursiveParentsBatchLoader.d.cts +2 -3
- package/build/batchloaders/recursiveParentsBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/recursiveParentsBatchLoader.d.mts +2 -3
- package/build/batchloaders/recursiveParentsBatchLoader.d.mts.map +1 -1
- package/build/changes.cjs.map +1 -1
- package/build/changes.d.cts +9 -10
- package/build/changes.d.cts.map +1 -1
- package/build/changes.d.mts +9 -10
- package/build/changes.d.mts.map +1 -1
- package/build/changes.js.map +1 -1
- package/build/config.d.cts +17 -17
- package/build/config.d.cts.map +1 -1
- package/build/config.d.mts +17 -17
- package/build/config.d.mts.map +1 -1
- package/build/configure.d.cts +8 -9
- package/build/configure.d.cts.map +1 -1
- package/build/configure.d.mts +8 -9
- package/build/configure.d.mts.map +1 -1
- package/build/dataloaders/fastWhereFilterHash.d.cts +1 -2
- package/build/dataloaders/fastWhereFilterHash.d.cts.map +1 -1
- package/build/dataloaders/fastWhereFilterHash.d.mts +1 -2
- package/build/dataloaders/fastWhereFilterHash.d.mts.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.d.cts +2 -3
- package/build/dataloaders/findByUniqueDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.d.mts +2 -3
- package/build/dataloaders/findByUniqueDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findCountDataLoader.d.cts +4 -5
- package/build/dataloaders/findCountDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findCountDataLoader.d.mts +4 -5
- package/build/dataloaders/findCountDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findDataLoader.d.cts +11 -12
- package/build/dataloaders/findDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findDataLoader.d.mts +11 -12
- package/build/dataloaders/findDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findIdsDataLoader.d.cts +2 -3
- package/build/dataloaders/findIdsDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findIdsDataLoader.d.mts +2 -3
- package/build/dataloaders/findIdsDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findOrCreateDataLoader.d.cts +3 -3
- package/build/dataloaders/findOrCreateDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findOrCreateDataLoader.d.mts +3 -3
- package/build/dataloaders/findOrCreateDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findPaginatedDataLoader.d.cts +1 -2
- package/build/dataloaders/findPaginatedDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findPaginatedDataLoader.d.mts +1 -2
- package/build/dataloaders/findPaginatedDataLoader.d.mts.map +1 -1
- package/build/dataloaders/lensDataLoader.d.cts +2 -3
- package/build/dataloaders/lensDataLoader.d.cts.map +1 -1
- package/build/dataloaders/lensDataLoader.d.mts +2 -3
- package/build/dataloaders/lensDataLoader.d.mts.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.cts +2 -3
- package/build/dataloaders/manyToManyFindDataLoader.d.cts.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.mts +2 -3
- package/build/dataloaders/manyToManyFindDataLoader.d.mts.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.cts +2 -3
- package/build/dataloaders/oneToManyFindDataLoader.d.cts.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.mts +2 -3
- package/build/dataloaders/oneToManyFindDataLoader.d.mts.map +1 -1
- package/build/defaults.cjs.map +1 -1
- package/build/defaults.d.cts +7 -7
- package/build/defaults.d.cts.map +1 -1
- package/build/defaults.d.mts +7 -7
- package/build/defaults.d.mts.map +1 -1
- package/build/defaults.js.map +1 -1
- package/build/drivers/Driver.d.cts +2 -3
- package/build/drivers/Driver.d.cts.map +1 -1
- package/build/drivers/Driver.d.mts +2 -3
- package/build/drivers/Driver.d.mts.map +1 -1
- package/build/drivers/EntityWriter.d.cts +7 -7
- package/build/drivers/EntityWriter.d.cts.map +1 -1
- package/build/drivers/EntityWriter.d.mts +7 -7
- package/build/drivers/EntityWriter.d.mts.map +1 -1
- package/build/drivers/IdAssigner.cjs.map +1 -1
- package/build/drivers/IdAssigner.d.cts +5 -5
- package/build/drivers/IdAssigner.d.cts.map +1 -1
- package/build/drivers/IdAssigner.d.mts +5 -5
- package/build/drivers/IdAssigner.d.mts.map +1 -1
- package/build/drivers/IdAssigner.js.map +1 -1
- package/build/drivers/driverApi.d.cts +2 -3
- package/build/drivers/driverApi.d.cts.map +1 -1
- package/build/drivers/driverApi.d.mts +2 -3
- package/build/drivers/driverApi.d.mts.map +1 -1
- package/build/fields.d.cts +6 -7
- package/build/fields.d.cts.map +1 -1
- package/build/fields.d.mts +6 -7
- package/build/fields.d.mts.map +1 -1
- package/build/flush/FlushLock.cjs.map +1 -1
- package/build/flush/FlushLock.d.cts +1 -2
- package/build/flush/FlushLock.d.cts.map +1 -1
- package/build/flush/FlushLock.d.mts +1 -2
- package/build/flush/FlushLock.d.mts.map +1 -1
- package/build/flush/FlushLock.js.map +1 -1
- package/build/flush/JoinRows.cjs.map +1 -1
- package/build/flush/JoinRows.d.cts +5 -6
- package/build/flush/JoinRows.d.cts.map +1 -1
- package/build/flush/JoinRows.d.mts +5 -6
- package/build/flush/JoinRows.d.mts.map +1 -1
- package/build/flush/JoinRows.js.map +1 -1
- package/build/flush/PendingChanges.d.cts +5 -6
- package/build/flush/PendingChanges.d.cts.map +1 -1
- package/build/flush/PendingChanges.d.mts +5 -6
- package/build/flush/PendingChanges.d.mts.map +1 -1
- package/build/flush/Todo.d.cts +5 -6
- package/build/flush/Todo.d.cts.map +1 -1
- package/build/flush/Todo.d.mts +5 -6
- package/build/flush/Todo.d.mts.map +1 -1
- package/build/getProperties.d.cts +3 -4
- package/build/getProperties.d.cts.map +1 -1
- package/build/getProperties.d.mts +3 -4
- package/build/getProperties.d.mts.map +1 -1
- package/build/index.d.cts +17 -17
- package/build/index.d.cts.map +1 -1
- package/build/index.d.mts +17 -17
- package/build/index.d.mts.map +1 -1
- package/build/json.d.cts +11 -11
- package/build/json.d.cts.map +1 -1
- package/build/json.d.mts +11 -11
- package/build/json.d.mts.map +1 -1
- package/build/keys.d.cts +27 -27
- package/build/keys.d.cts.map +1 -1
- package/build/keys.d.mts +27 -27
- package/build/keys.d.mts.map +1 -1
- package/build/loading/HintTree.d.cts +3 -4
- package/build/loading/HintTree.d.cts.map +1 -1
- package/build/loading/HintTree.d.mts +3 -4
- package/build/loading/HintTree.d.mts.map +1 -1
- package/build/loading/IsLoadedCache.cjs.map +1 -1
- package/build/loading/IsLoadedCache.d.cts +2 -3
- package/build/loading/IsLoadedCache.d.cts.map +1 -1
- package/build/loading/IsLoadedCache.d.mts +2 -3
- package/build/loading/IsLoadedCache.d.mts.map +1 -1
- package/build/loading/IsLoadedCache.js.map +1 -1
- package/build/loading/loadHints.d.cts +17 -17
- package/build/loading/loadHints.d.cts.map +1 -1
- package/build/loading/loadHints.d.mts +17 -17
- package/build/loading/loadHints.d.mts.map +1 -1
- package/build/loading/loadLens.d.cts +13 -13
- package/build/loading/loadLens.d.cts.map +1 -1
- package/build/loading/loadLens.d.mts +13 -13
- package/build/loading/loadLens.d.mts.map +1 -1
- package/build/loading/withLoaded.d.cts +5 -6
- package/build/loading/withLoaded.d.cts.map +1 -1
- package/build/loading/withLoaded.d.mts +5 -6
- package/build/loading/withLoaded.d.mts.map +1 -1
- package/build/logging/FactoryLogger.d.cts +3 -4
- package/build/logging/FactoryLogger.d.cts.map +1 -1
- package/build/logging/FactoryLogger.d.mts +3 -4
- package/build/logging/FactoryLogger.d.mts.map +1 -1
- package/build/logging/FieldLogger.cjs.map +1 -1
- package/build/logging/FieldLogger.d.cts +4 -5
- package/build/logging/FieldLogger.d.cts.map +1 -1
- package/build/logging/FieldLogger.d.mts +4 -5
- package/build/logging/FieldLogger.d.mts.map +1 -1
- package/build/logging/FieldLogger.js.map +1 -1
- package/build/logging/ReactionLogger.d.cts +7 -7
- package/build/logging/ReactionLogger.d.cts.map +1 -1
- package/build/logging/ReactionLogger.d.mts +7 -7
- package/build/logging/ReactionLogger.d.mts.map +1 -1
- package/build/newEntity.cjs.map +1 -1
- package/build/newEntity.d.cts +4 -5
- package/build/newEntity.d.cts.map +1 -1
- package/build/newEntity.d.mts +4 -5
- package/build/newEntity.d.mts.map +1 -1
- package/build/newEntity.js.map +1 -1
- package/build/newTestInstance.d.cts +21 -21
- package/build/newTestInstance.d.cts.map +1 -1
- package/build/newTestInstance.d.mts +21 -21
- package/build/newTestInstance.d.mts.map +1 -1
- package/build/normalizeHints.d.cts +7 -8
- package/build/normalizeHints.d.cts.map +1 -1
- package/build/normalizeHints.d.mts +7 -8
- package/build/normalizeHints.d.mts.map +1 -1
- package/build/nowUTC.d.cts +4 -5
- package/build/nowUTC.d.cts.map +1 -1
- package/build/nowUTC.d.mts +4 -5
- package/build/nowUTC.d.mts.map +1 -1
- package/build/plugins/ImmutableEntitiesPlugin.d.cts +1 -2
- package/build/plugins/ImmutableEntitiesPlugin.d.cts.map +1 -1
- package/build/plugins/ImmutableEntitiesPlugin.d.mts +1 -2
- package/build/plugins/ImmutableEntitiesPlugin.d.mts.map +1 -1
- package/build/plugins/PreloadPlugin.d.cts +3 -4
- package/build/plugins/PreloadPlugin.d.cts.map +1 -1
- package/build/plugins/PreloadPlugin.d.mts +3 -4
- package/build/plugins/PreloadPlugin.d.mts.map +1 -1
- package/build/preloading/JsonAggregatePreloader.d.cts +1 -2
- package/build/preloading/JsonAggregatePreloader.d.cts.map +1 -1
- package/build/preloading/JsonAggregatePreloader.d.mts +1 -2
- package/build/preloading/JsonAggregatePreloader.d.mts.map +1 -1
- package/build/preloading/canPreload.d.cts +1 -2
- package/build/preloading/canPreload.d.cts.map +1 -1
- package/build/preloading/canPreload.d.mts +1 -2
- package/build/preloading/canPreload.d.mts.map +1 -1
- package/build/preloading/partitionHint.d.cts +1 -2
- package/build/preloading/partitionHint.d.cts.map +1 -1
- package/build/preloading/partitionHint.d.mts +1 -2
- package/build/preloading/partitionHint.d.mts.map +1 -1
- package/build/queries/ConditionBuilder.d.cts +2 -2
- package/build/queries/ConditionBuilder.d.cts.map +1 -1
- package/build/queries/ConditionBuilder.d.mts +2 -2
- package/build/queries/ConditionBuilder.d.mts.map +1 -1
- package/build/queries/conditions.d.cts +11 -12
- package/build/queries/conditions.d.cts.map +1 -1
- package/build/queries/conditions.d.mts +11 -12
- package/build/queries/conditions.d.mts.map +1 -1
- package/build/queries/entityQueryUtils.d.cts +4 -5
- package/build/queries/entityQueryUtils.d.cts.map +1 -1
- package/build/queries/entityQueryUtils.d.mts +4 -5
- package/build/queries/entityQueryUtils.d.mts.map +1 -1
- package/build/queries/find/Aliases.d.cts +16 -16
- package/build/queries/find/Aliases.d.cts.map +1 -1
- package/build/queries/find/Aliases.d.mts +16 -16
- package/build/queries/find/Aliases.d.mts.map +1 -1
- package/build/queries/find/DeferredAlias.d.cts +5 -6
- package/build/queries/find/DeferredAlias.d.cts.map +1 -1
- package/build/queries/find/DeferredAlias.d.mts +5 -6
- package/build/queries/find/DeferredAlias.d.mts.map +1 -1
- package/build/queries/find/EntityFilter.d.cts +12 -13
- package/build/queries/find/EntityFilter.d.cts.map +1 -1
- package/build/queries/find/EntityFilter.d.mts +12 -13
- package/build/queries/find/EntityFilter.d.mts.map +1 -1
- package/build/queries/find/EntityGraphQLFilter.d.cts +8 -9
- package/build/queries/find/EntityGraphQLFilter.d.cts.map +1 -1
- package/build/queries/find/EntityGraphQLFilter.d.mts +8 -9
- package/build/queries/find/EntityGraphQLFilter.d.mts.map +1 -1
- package/build/queries/find/QueryParser.collectionJoins.d.cts +1 -2
- package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -1
- package/build/queries/find/QueryParser.collectionJoins.d.mts +1 -2
- package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -1
- package/build/queries/find/QueryParser.d.cts +18 -18
- package/build/queries/find/QueryParser.d.cts.map +1 -1
- package/build/queries/find/QueryParser.d.mts +18 -18
- package/build/queries/find/QueryParser.d.mts.map +1 -1
- package/build/queries/find/QueryParser.pruning.d.cts +2 -3
- package/build/queries/find/QueryParser.pruning.d.cts.map +1 -1
- package/build/queries/find/QueryParser.pruning.d.mts +2 -3
- package/build/queries/find/QueryParser.pruning.d.mts.map +1 -1
- package/build/queries/find/QueryVisitor.d.cts +4 -4
- package/build/queries/find/QueryVisitor.d.cts.map +1 -1
- package/build/queries/find/QueryVisitor.d.mts +4 -4
- package/build/queries/find/QueryVisitor.d.mts.map +1 -1
- package/build/queries/find/buildFindQuery.d.cts +3 -3
- package/build/queries/find/buildFindQuery.d.cts.map +1 -1
- package/build/queries/find/buildFindQuery.d.mts +3 -3
- package/build/queries/find/buildFindQuery.d.mts.map +1 -1
- package/build/queries/find/scopes.cjs.map +1 -1
- package/build/queries/find/scopes.d.cts +12 -13
- package/build/queries/find/scopes.d.cts.map +1 -1
- package/build/queries/find/scopes.d.mts +12 -13
- package/build/queries/find/scopes.d.mts.map +1 -1
- package/build/queries/find/scopes.js.map +1 -1
- package/build/queries/parsedConditions.d.cts +7 -8
- package/build/queries/parsedConditions.d.cts.map +1 -1
- package/build/queries/parsedConditions.d.mts +7 -8
- package/build/queries/parsedConditions.d.mts.map +1 -1
- package/build/queries/renderConditions.d.cts +3 -4
- package/build/queries/renderConditions.d.cts.map +1 -1
- package/build/queries/renderConditions.d.mts +3 -4
- package/build/queries/renderConditions.d.mts.map +1 -1
- package/build/queries/skipCondition.d.cts +1 -2
- package/build/queries/skipCondition.d.cts.map +1 -1
- package/build/queries/skipCondition.d.mts +1 -2
- package/build/queries/skipCondition.d.mts.map +1 -1
- package/build/queries/sql/AliasAssigner.cjs.map +1 -1
- package/build/queries/sql/AliasAssigner.d.cts +1 -2
- package/build/queries/sql/AliasAssigner.d.cts.map +1 -1
- package/build/queries/sql/AliasAssigner.d.mts +1 -2
- package/build/queries/sql/AliasAssigner.d.mts.map +1 -1
- package/build/queries/sql/AliasAssigner.js.map +1 -1
- package/build/queries/sql/Expr.d.cts +26 -27
- package/build/queries/sql/Expr.d.cts.map +1 -1
- package/build/queries/sql/Expr.d.mts +26 -27
- package/build/queries/sql/Expr.d.mts.map +1 -1
- package/build/queries/sql/JoinTree.d.cts +5 -5
- package/build/queries/sql/JoinTree.d.cts.map +1 -1
- package/build/queries/sql/JoinTree.d.mts +5 -5
- package/build/queries/sql/JoinTree.d.mts.map +1 -1
- package/build/queries/sql/Tables.d.cts +39 -39
- package/build/queries/sql/Tables.d.cts.map +1 -1
- package/build/queries/sql/Tables.d.mts +39 -39
- package/build/queries/sql/Tables.d.mts.map +1 -1
- package/build/queries/sql/custom.d.cts +14 -14
- package/build/queries/sql/custom.d.cts.map +1 -1
- package/build/queries/sql/custom.d.mts +14 -14
- package/build/queries/sql/custom.d.mts.map +1 -1
- package/build/queries/sql/execute.d.cts +15 -15
- package/build/queries/sql/execute.d.cts.map +1 -1
- package/build/queries/sql/execute.d.mts +15 -15
- package/build/queries/sql/execute.d.mts.map +1 -1
- package/build/queries/sql/expressions/arrayAgg.d.cts +5 -6
- package/build/queries/sql/expressions/arrayAgg.d.cts.map +1 -1
- package/build/queries/sql/expressions/arrayAgg.d.mts +5 -6
- package/build/queries/sql/expressions/arrayAgg.d.mts.map +1 -1
- package/build/queries/sql/expressions/case.d.cts +10 -10
- package/build/queries/sql/expressions/case.d.cts.map +1 -1
- package/build/queries/sql/expressions/case.d.mts +10 -10
- package/build/queries/sql/expressions/case.d.mts.map +1 -1
- package/build/queries/sql/expressions/coalesce.d.cts +5 -6
- package/build/queries/sql/expressions/coalesce.d.cts.map +1 -1
- package/build/queries/sql/expressions/coalesce.d.mts +5 -6
- package/build/queries/sql/expressions/coalesce.d.mts.map +1 -1
- package/build/queries/sql/expressions/codecs.d.cts +1 -2
- package/build/queries/sql/expressions/codecs.d.cts.map +1 -1
- package/build/queries/sql/expressions/codecs.d.mts +1 -2
- package/build/queries/sql/expressions/codecs.d.mts.map +1 -1
- package/build/queries/sql/expressions/expression.d.cts +6 -6
- package/build/queries/sql/expressions/expression.d.cts.map +1 -1
- package/build/queries/sql/expressions/expression.d.mts +6 -6
- package/build/queries/sql/expressions/expression.d.mts.map +1 -1
- package/build/queries/sql/expressions/greatest.d.cts +5 -6
- package/build/queries/sql/expressions/greatest.d.cts.map +1 -1
- package/build/queries/sql/expressions/greatest.d.mts +5 -6
- package/build/queries/sql/expressions/greatest.d.mts.map +1 -1
- package/build/queries/sql/expressions/least.d.cts +5 -6
- package/build/queries/sql/expressions/least.d.cts.map +1 -1
- package/build/queries/sql/expressions/least.d.mts +5 -6
- package/build/queries/sql/expressions/least.d.mts.map +1 -1
- package/build/queries/sql/expressions/nullIf.d.cts +5 -6
- package/build/queries/sql/expressions/nullIf.d.cts.map +1 -1
- package/build/queries/sql/expressions/nullIf.d.mts +5 -6
- package/build/queries/sql/expressions/nullIf.d.mts.map +1 -1
- package/build/queries/sql/expressions/parseExpression.d.cts +5 -6
- package/build/queries/sql/expressions/parseExpression.d.cts.map +1 -1
- package/build/queries/sql/expressions/parseExpression.d.mts +5 -6
- package/build/queries/sql/expressions/parseExpression.d.mts.map +1 -1
- package/build/queries/sql/expressions/types.d.cts +11 -11
- package/build/queries/sql/expressions/types.d.cts.map +1 -1
- package/build/queries/sql/expressions/types.d.mts +11 -11
- package/build/queries/sql/expressions/types.d.mts.map +1 -1
- package/build/queries/sql/keywords.d.cts +4 -5
- package/build/queries/sql/keywords.d.cts.map +1 -1
- package/build/queries/sql/keywords.d.mts +4 -5
- package/build/queries/sql/keywords.d.mts.map +1 -1
- package/build/queries/sql/query.cjs.map +1 -1
- package/build/queries/sql/query.d.cts +67 -67
- package/build/queries/sql/query.d.cts.map +1 -1
- package/build/queries/sql/query.d.mts +67 -67
- package/build/queries/sql/query.d.mts.map +1 -1
- package/build/queries/sql/query.js.map +1 -1
- package/build/queries/unnest.d.cts +2 -3
- package/build/queries/unnest.d.cts.map +1 -1
- package/build/queries/unnest.d.mts +2 -3
- package/build/queries/unnest.d.mts.map +1 -1
- package/build/queries/valueFilters.d.cts +5 -6
- package/build/queries/valueFilters.d.cts.map +1 -1
- package/build/queries/valueFilters.d.mts +5 -6
- package/build/queries/valueFilters.d.mts.map +1 -1
- package/build/reactivity/ReactionsManager.cjs.map +1 -1
- package/build/reactivity/ReactionsManager.d.cts +2 -3
- package/build/reactivity/ReactionsManager.d.cts.map +1 -1
- package/build/reactivity/ReactionsManager.d.mts +2 -3
- package/build/reactivity/ReactionsManager.d.mts.map +1 -1
- package/build/reactivity/ReactionsManager.js.map +1 -1
- package/build/reactivity/reactiveHints.d.cts +18 -18
- package/build/reactivity/reactiveHints.d.cts.map +1 -1
- package/build/reactivity/reactiveHints.d.mts +18 -18
- package/build/reactivity/reactiveHints.d.mts.map +1 -1
- package/build/relations/AbstractPropertyImpl.cjs.map +1 -1
- package/build/relations/AbstractPropertyImpl.d.cts +1 -2
- package/build/relations/AbstractPropertyImpl.d.cts.map +1 -1
- package/build/relations/AbstractPropertyImpl.d.mts +1 -2
- package/build/relations/AbstractPropertyImpl.d.mts.map +1 -1
- package/build/relations/AbstractPropertyImpl.js.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/AsyncProperty.cjs.map +1 -1
- package/build/relations/AsyncProperty.d.cts +5 -6
- package/build/relations/AsyncProperty.d.cts.map +1 -1
- package/build/relations/AsyncProperty.d.mts +5 -6
- package/build/relations/AsyncProperty.d.mts.map +1 -1
- package/build/relations/AsyncProperty.js.map +1 -1
- package/build/relations/AsyncReactiveField.cjs.map +1 -1
- package/build/relations/AsyncReactiveField.d.cts +4 -5
- package/build/relations/AsyncReactiveField.d.cts.map +1 -1
- package/build/relations/AsyncReactiveField.d.mts +4 -5
- package/build/relations/AsyncReactiveField.d.mts.map +1 -1
- package/build/relations/AsyncReactiveField.js.map +1 -1
- package/build/relations/Collection.d.cts +4 -5
- package/build/relations/Collection.d.cts.map +1 -1
- package/build/relations/Collection.d.mts +4 -5
- package/build/relations/Collection.d.mts.map +1 -1
- package/build/relations/CustomCollection.cjs.map +1 -1
- package/build/relations/CustomCollection.d.cts +3 -4
- package/build/relations/CustomCollection.d.cts.map +1 -1
- package/build/relations/CustomCollection.d.mts +3 -4
- package/build/relations/CustomCollection.d.mts.map +1 -1
- package/build/relations/CustomCollection.js.map +1 -1
- package/build/relations/CustomReference.cjs.map +1 -1
- package/build/relations/CustomReference.d.cts +3 -4
- package/build/relations/CustomReference.d.cts.map +1 -1
- package/build/relations/CustomReference.d.mts +3 -4
- package/build/relations/CustomReference.d.mts.map +1 -1
- package/build/relations/CustomReference.js.map +1 -1
- package/build/relations/EnumCollection.cjs.map +1 -1
- package/build/relations/EnumCollection.d.cts +5 -5
- package/build/relations/EnumCollection.d.cts.map +1 -1
- package/build/relations/EnumCollection.d.mts +5 -5
- package/build/relations/EnumCollection.d.mts.map +1 -1
- package/build/relations/EnumCollection.js.map +1 -1
- package/build/relations/LargeCollection.d.cts +1 -2
- package/build/relations/LargeCollection.d.cts.map +1 -1
- package/build/relations/LargeCollection.d.mts +1 -2
- package/build/relations/LargeCollection.d.mts.map +1 -1
- package/build/relations/LazyField.cjs.map +1 -1
- package/build/relations/LazyField.d.cts +7 -8
- package/build/relations/LazyField.d.cts.map +1 -1
- package/build/relations/LazyField.d.mts +7 -8
- package/build/relations/LazyField.d.mts.map +1 -1
- package/build/relations/LazyField.js.map +1 -1
- package/build/relations/ManyToManyCollection.cjs.map +1 -1
- package/build/relations/ManyToManyCollection.d.cts +2 -3
- package/build/relations/ManyToManyCollection.d.cts.map +1 -1
- package/build/relations/ManyToManyCollection.d.mts +2 -3
- package/build/relations/ManyToManyCollection.d.mts.map +1 -1
- package/build/relations/ManyToManyCollection.js.map +1 -1
- package/build/relations/ManyToManyLargeCollection.d.cts +2 -3
- package/build/relations/ManyToManyLargeCollection.d.cts.map +1 -1
- package/build/relations/ManyToManyLargeCollection.d.mts +2 -3
- package/build/relations/ManyToManyLargeCollection.d.mts.map +1 -1
- package/build/relations/ManyToOneReference.cjs.map +1 -1
- package/build/relations/ManyToOneReference.d.cts +6 -7
- package/build/relations/ManyToOneReference.d.cts.map +1 -1
- package/build/relations/ManyToOneReference.d.mts +6 -7
- package/build/relations/ManyToOneReference.d.mts.map +1 -1
- package/build/relations/ManyToOneReference.js.map +1 -1
- package/build/relations/OneToManyCollection.cjs.map +1 -1
- package/build/relations/OneToManyCollection.d.cts +2 -3
- package/build/relations/OneToManyCollection.d.cts.map +1 -1
- package/build/relations/OneToManyCollection.d.mts +2 -3
- package/build/relations/OneToManyCollection.d.mts.map +1 -1
- package/build/relations/OneToManyCollection.js.map +1 -1
- package/build/relations/OneToManyLargeCollection.cjs.map +1 -1
- package/build/relations/OneToManyLargeCollection.d.cts +2 -3
- package/build/relations/OneToManyLargeCollection.d.cts.map +1 -1
- package/build/relations/OneToManyLargeCollection.d.mts +2 -3
- package/build/relations/OneToManyLargeCollection.d.mts.map +1 -1
- package/build/relations/OneToManyLargeCollection.js.map +1 -1
- package/build/relations/OneToOneReference.cjs.map +1 -1
- package/build/relations/OneToOneReference.d.cts +7 -7
- package/build/relations/OneToOneReference.d.cts.map +1 -1
- package/build/relations/OneToOneReference.d.mts +7 -7
- package/build/relations/OneToOneReference.d.mts.map +1 -1
- package/build/relations/OneToOneReference.js.map +1 -1
- package/build/relations/PolymorphicReference.cjs.map +1 -1
- package/build/relations/PolymorphicReference.d.cts +4 -5
- package/build/relations/PolymorphicReference.d.cts.map +1 -1
- package/build/relations/PolymorphicReference.d.mts +4 -5
- package/build/relations/PolymorphicReference.d.mts.map +1 -1
- package/build/relations/PolymorphicReference.js.map +1 -1
- package/build/relations/PropertySymbols.d.cts +1 -2
- package/build/relations/PropertySymbols.d.cts.map +1 -1
- package/build/relations/PropertySymbols.d.mts +1 -2
- package/build/relations/PropertySymbols.d.mts.map +1 -1
- package/build/relations/ReactiveField.cjs.map +1 -1
- package/build/relations/ReactiveField.d.cts +4 -5
- package/build/relations/ReactiveField.d.cts.map +1 -1
- package/build/relations/ReactiveField.d.mts +4 -5
- package/build/relations/ReactiveField.d.mts.map +1 -1
- package/build/relations/ReactiveField.js.map +1 -1
- package/build/relations/ReactiveGetter.cjs.map +1 -1
- package/build/relations/ReactiveGetter.d.cts +4 -5
- package/build/relations/ReactiveGetter.d.cts.map +1 -1
- package/build/relations/ReactiveGetter.d.mts +4 -5
- package/build/relations/ReactiveGetter.d.mts.map +1 -1
- package/build/relations/ReactiveGetter.js.map +1 -1
- package/build/relations/ReactiveManyToMany.cjs.map +1 -1
- package/build/relations/ReactiveManyToMany.d.cts +4 -5
- package/build/relations/ReactiveManyToMany.d.cts.map +1 -1
- package/build/relations/ReactiveManyToMany.d.mts +4 -5
- package/build/relations/ReactiveManyToMany.d.mts.map +1 -1
- package/build/relations/ReactiveManyToMany.js.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.cjs.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.cts +4 -5
- package/build/relations/ReactiveManyToManyOtherSide.d.cts.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.mts +4 -5
- package/build/relations/ReactiveManyToManyOtherSide.d.mts.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.js.map +1 -1
- package/build/relations/ReactiveReference.cjs.map +1 -1
- package/build/relations/ReactiveReference.d.cts +5 -6
- package/build/relations/ReactiveReference.d.cts.map +1 -1
- package/build/relations/ReactiveReference.d.mts +5 -6
- package/build/relations/ReactiveReference.d.mts.map +1 -1
- package/build/relations/ReactiveReference.js.map +1 -1
- package/build/relations/ReadOnlyCollection.d.cts +4 -5
- package/build/relations/ReadOnlyCollection.d.cts.map +1 -1
- package/build/relations/ReadOnlyCollection.d.mts +4 -5
- package/build/relations/ReadOnlyCollection.d.mts.map +1 -1
- package/build/relations/RecursiveCollection.cjs.map +1 -1
- package/build/relations/RecursiveCollection.d.cts +10 -10
- package/build/relations/RecursiveCollection.d.cts.map +1 -1
- package/build/relations/RecursiveCollection.d.mts +10 -10
- package/build/relations/RecursiveCollection.d.mts.map +1 -1
- package/build/relations/RecursiveCollection.js.map +1 -1
- package/build/relations/RecursiveCycleError.d.cts +2 -2
- package/build/relations/RecursiveCycleError.d.cts.map +1 -1
- package/build/relations/RecursiveCycleError.d.mts +2 -2
- package/build/relations/RecursiveCycleError.d.mts.map +1 -1
- package/build/relations/Reference.d.cts +5 -5
- package/build/relations/Reference.d.cts.map +1 -1
- package/build/relations/Reference.d.mts +5 -5
- package/build/relations/Reference.d.mts.map +1 -1
- package/build/relations/ReferenceSymbols.d.cts +1 -2
- package/build/relations/ReferenceSymbols.d.cts.map +1 -1
- package/build/relations/ReferenceSymbols.d.mts +1 -2
- package/build/relations/ReferenceSymbols.d.mts.map +1 -1
- package/build/relations/Relation.d.cts +3 -3
- package/build/relations/Relation.d.cts.map +1 -1
- package/build/relations/Relation.d.mts +3 -3
- package/build/relations/Relation.d.mts.map +1 -1
- package/build/relations/RelationSymbols.d.cts +2 -3
- package/build/relations/RelationSymbols.d.cts.map +1 -1
- package/build/relations/RelationSymbols.d.mts +2 -3
- package/build/relations/RelationSymbols.d.mts.map +1 -1
- package/build/relations/hasAsyncMethod.cjs.map +1 -1
- package/build/relations/hasAsyncMethod.d.cts +6 -6
- package/build/relations/hasAsyncMethod.d.cts.map +1 -1
- package/build/relations/hasAsyncMethod.d.mts +6 -6
- package/build/relations/hasAsyncMethod.d.mts.map +1 -1
- package/build/relations/hasAsyncMethod.js.map +1 -1
- package/build/relations/hasManyDerived.d.cts +2 -2
- package/build/relations/hasManyDerived.d.cts.map +1 -1
- package/build/relations/hasManyDerived.d.mts +2 -2
- package/build/relations/hasManyDerived.d.mts.map +1 -1
- package/build/relations/hasManyThrough.d.cts +1 -2
- package/build/relations/hasManyThrough.d.cts.map +1 -1
- package/build/relations/hasManyThrough.d.mts +1 -2
- package/build/relations/hasManyThrough.d.mts.map +1 -1
- package/build/relations/hasOneDerived.d.cts +1 -2
- package/build/relations/hasOneDerived.d.cts.map +1 -1
- package/build/relations/hasOneDerived.d.mts +1 -2
- package/build/relations/hasOneDerived.d.mts.map +1 -1
- package/build/relations/hasOneThrough.d.cts +1 -2
- package/build/relations/hasOneThrough.d.cts.map +1 -1
- package/build/relations/hasOneThrough.d.mts +1 -2
- package/build/relations/hasOneThrough.d.mts.map +1 -1
- package/build/relations/hasProperty.cjs.map +1 -1
- package/build/relations/hasProperty.d.cts +8 -8
- package/build/relations/hasProperty.d.cts.map +1 -1
- package/build/relations/hasProperty.d.mts +8 -8
- package/build/relations/hasProperty.d.mts.map +1 -1
- package/build/relations/hasProperty.js.map +1 -1
- package/build/relations/isCascadeDelete.d.cts +1 -2
- package/build/relations/isCascadeDelete.d.cts.map +1 -1
- package/build/relations/isCascadeDelete.d.mts +1 -2
- package/build/relations/isCascadeDelete.d.mts.map +1 -1
- package/build/resurrection.d.cts +3 -4
- package/build/resurrection.d.cts.map +1 -1
- package/build/resurrection.d.mts +3 -4
- package/build/resurrection.d.mts.map +1 -1
- package/build/rules.d.cts +20 -20
- package/build/rules.d.cts.map +1 -1
- package/build/rules.d.mts +20 -20
- package/build/rules.d.mts.map +1 -1
- package/build/runtimeConfig.d.cts +4 -5
- package/build/runtimeConfig.d.cts.map +1 -1
- package/build/runtimeConfig.d.mts +4 -5
- package/build/runtimeConfig.d.mts.map +1 -1
- package/build/serde/TypeInfo.d.cts +3 -4
- package/build/serde/TypeInfo.d.cts.map +1 -1
- package/build/serde/TypeInfo.d.mts +3 -4
- package/build/serde/TypeInfo.d.mts.map +1 -1
- package/build/serde/columns.d.cts +2 -3
- package/build/serde/columns.d.cts.map +1 -1
- package/build/serde/columns.d.mts +2 -3
- package/build/serde/columns.d.mts.map +1 -1
- package/build/serde/fieldSerde.d.cts +9 -9
- package/build/serde/fieldSerde.d.cts.map +1 -1
- package/build/serde/fieldSerde.d.mts +9 -9
- package/build/serde/fieldSerde.d.mts.map +1 -1
- package/build/serde/serde.d.cts +18 -19
- package/build/serde/serde.d.cts.map +1 -1
- package/build/serde/serde.d.mts +18 -19
- package/build/serde/serde.d.mts.map +1 -1
- package/build/serde/temporal.d.cts +5 -5
- package/build/serde/temporal.d.cts.map +1 -1
- package/build/serde/temporal.d.mts +5 -5
- package/build/serde/temporal.d.mts.map +1 -1
- package/build/serde/temporalMappers.d.cts +4 -5
- package/build/serde/temporalMappers.d.cts.map +1 -1
- package/build/serde/temporalMappers.d.mts +4 -5
- package/build/serde/temporalMappers.d.mts.map +1 -1
- package/build/transitions.d.cts +17 -18
- package/build/transitions.d.cts.map +1 -1
- package/build/transitions.d.mts +17 -18
- package/build/transitions.d.mts.map +1 -1
- package/build/trusted.d.cts +2 -3
- package/build/trusted.d.cts.map +1 -1
- package/build/trusted.d.mts +2 -3
- package/build/trusted.d.mts.map +1 -1
- package/build/typeMap.d.cts +17 -17
- package/build/typeMap.d.cts.map +1 -1
- package/build/typeMap.d.mts +17 -17
- package/build/typeMap.d.mts.map +1 -1
- package/build/upsert.d.cts +4 -4
- package/build/upsert.d.cts.map +1 -1
- package/build/upsert.d.mts +4 -4
- package/build/upsert.d.mts.map +1 -1
- package/build/utils.d.cts +27 -28
- package/build/utils.d.cts.map +1 -1
- package/build/utils.d.mts +27 -28
- package/build/utils.d.mts.map +1 -1
- package/package.json +4 -4
package/build/changes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changes.js","names":["#entity","#m2m","#joinRows","#added","#removed","#collection","#toCodes","#o2m"],"sources":["../src/changes.ts"],"sourcesContent":["import { getInstanceData } from \"src/BaseEntity.ts\";\nimport { type Entity } from \"src/Entity.ts\";\nimport { type IdOf } from \"src/EntityManager.ts\";\nimport { getField, isChangeableField } from \"src/fields.ts\";\nimport type { JoinColumnValue, JoinRows } from \"src/flush/JoinRows.ts\";\nimport {\n type Field,\n type ManyToManyCollection,\n type OneToManyCollection,\n type RelationsOf,\n assertNever,\n getEmInternalApi,\n getMetadata,\n isEntity,\n isId,\n} from \"src/index.ts\";\nimport { type EnumCollectionImpl } from \"src/relations/EnumCollection.ts\";\nimport { notLoadedValue } from \"src/relations/LazyField.ts\";\nimport { type FieldsOf, type OptsOf } from \"src/typeMap.ts\";\n\n/** Exposes a field's changed/original value in each entity's `this.changes` property. */\nexport interface FieldStatus<T> {\n /** True if the field has been changed on either create or update. */\n hasChanged: boolean;\n /** True only if the field has been updated i.e. not on the initial create. */\n hasUpdated: boolean;\n /** The original value, will be `undefined` if the entity new. */\n originalValue?: T;\n}\n\n/**\n * Provides a base class for field/primitive & m2o status impls.\n *\n * We use a separate base class so that the primitive & m2o subtypes can have their own\n * `kind: ...` consts, that if the m2o just subtyped the primitive directly, wouldn't be\n * allowed.\n */\nabstract class BaseFieldStatusImpl<T> {\n entity: Entity;\n fieldName: string;\n\n constructor(entity: Entity, fieldName: string) {\n this.entity = entity;\n this.fieldName = fieldName;\n }\n\n get originalValue(): T | undefined {\n const { originalData, data } = getInstanceData(this.entity);\n // If `p` is in originalData, always respect that, even if it's undefined\n const value =\n this.fieldName in originalData ? originalData[this.fieldName] : getField(this.entity, this.fieldName as any);\n // An unloaded lazy column's original value is unknown\n return value === notLoadedValue ? undefined : value;\n }\n\n get hasChanged(): boolean {\n const { originalData, data } = getInstanceData(this.entity);\n // Use `__orm.data[p] !== undefined` instead of `p in entity.__orm.data` because if a new (or cloned) entity\n // sets-then-unsets a value, it will return to `undefined` but still be present in `__orm.data`.\n return this.entity.isNewEntity ? data[this.fieldName] !== undefined : this.fieldName in originalData;\n }\n\n get hasUpdated(): boolean {\n const { originalData } = getInstanceData(this.entity);\n return !this.entity.isNewEntity && this.fieldName in originalData;\n }\n}\n\n/** Field status for primitive, enum, & primary key columns. */\nexport interface PrimitiveFieldStatus<T> extends FieldStatus<T> {\n kind: \"field\";\n}\n\n/** Implements the primitive field status, by extend base & just adding our `kind` const. */\nclass PrimitiveFieldStatusImpl<T> extends BaseFieldStatusImpl<T> implements PrimitiveFieldStatus<T> {\n kind = \"field\" as const;\n}\n\n/** Implements the m2o field status, by extend base, & adding `originalEntity`. */\nclass ManyToOneFieldStatusImpl<T extends Entity>\n extends BaseFieldStatusImpl<IdOf<T>>\n implements ManyToOneFieldStatus<T>\n{\n kind = \"m2o\" as const;\n\n /**\n * Returns our original entity's `id`.\n *\n * We can know `originalValue` has an `id` available (i.e. is not new), b/c original values defacto\n * came from the database.\n *\n * We also return the id so that `entity.changes.m2oField.originalValue` has a consistent API,\n * regardless of whether the `entity.m2oField` itself is loaded or unloaded.\n */\n get originalValue() {\n const originalValue = super.originalValue;\n return isEntity(originalValue) ? (originalValue.id as IdOf<T>) : originalValue;\n }\n\n /** Returns the original entity instance, which may not be loaded into memory yet, or undefined. */\n get originalEntity(): Promise<T | undefined> {\n const originalValue = this.originalValue;\n if (isId(originalValue)) {\n return this.entity.em.load(originalValue) as Promise<T>;\n } else {\n return Promise.resolve(undefined);\n }\n }\n}\n\n/** Provides a m2o/reference field's changed/original value in the entity's `this.changes` property. */\nexport interface ManyToOneFieldStatus<T extends Entity> extends FieldStatus<IdOf<T>> {\n kind: \"m2o\";\n /** The original entity, will be `undefined` if the entity new or the m2o was `null`. */\n originalEntity: Promise<T | undefined>;\n}\n\n/** Provides a m2m relation's added/removed/changed/original values. */\nexport interface ManyToManyFieldStatus<U extends Entity> {\n kind: \"m2m\";\n added: U[];\n removed: U[];\n changed: U[];\n hasChanged: boolean;\n hasUpdated: boolean;\n originalEntities: Promise<readonly U[]>;\n}\n\nclass ManyToManyFieldStatusImpl<T extends Entity, U extends Entity> implements ManyToManyFieldStatus<U> {\n readonly kind = \"m2m\";\n readonly #entity: T;\n readonly #m2m: ManyToManyCollection<T, any>;\n readonly #joinRows: JoinRows;\n\n constructor(entity: T, fieldName: keyof T) {\n this.#entity = entity;\n this.#m2m = entity[fieldName] as ManyToManyCollection<T, any>;\n this.#joinRows = getEmInternalApi(entity.em).joinRows(this.#m2m);\n }\n\n // Similar to the o2m.added/removed methods, these don't have to be async because currently\n // any m2m mutation requires having both entities in-memory anyway, i.e. we can't do id-only/unloaded\n // mutation of m2m relations.\n get added(): U[] {\n return this.#added.sort(entityCompare);\n }\n\n get removed(): U[] {\n return this.#removed.sort(entityCompare);\n }\n\n get changed(): U[] {\n return [...this.#added, ...this.#removed].sort(entityCompare);\n }\n\n get hasChanged(): boolean {\n // Calculating `changed: U[]` can be expensive if we sort, so just look at added/removed\n return this.#added.length > 0 || this.#removed.length > 0;\n }\n\n get hasUpdated(): boolean {\n return !this.#entity.isNewEntity && this.hasChanged;\n }\n\n get originalEntities(): Promise<readonly U[]> {\n return this.#m2m.load().then((list) => {\n const set = new Set(this.added);\n const copy = list.filter((e) => !set.has(e));\n copy.push(...this.removed);\n return copy.sort(entityCompare);\n });\n }\n\n get #added(): U[] {\n return this.#joinRows.addedFor(this.#m2m, this.#entity) as U[];\n }\n\n get #removed(): U[] {\n return this.#joinRows.removedFor(this.#m2m, this.#entity) as U[];\n }\n}\n\n/** Provides an enum m2m's added/removed/changed/original codes (e.g. `Publisher.logoColors`). */\nexport interface EnumCollectionFieldStatus<E> {\n kind: \"m2mEnum\";\n added: E[];\n removed: E[];\n changed: E[];\n hasChanged: boolean;\n hasUpdated: boolean;\n originalValues: Promise<readonly E[]>;\n}\n\nclass EnumCollectionFieldStatusImpl<T extends Entity, E> implements EnumCollectionFieldStatus<E> {\n readonly kind = \"m2mEnum\";\n readonly #entity: T;\n readonly #collection: EnumCollectionImpl<T, E>;\n readonly #joinRows: JoinRows;\n\n constructor(entity: T, fieldName: keyof T) {\n this.#entity = entity;\n this.#collection = entity[fieldName] as EnumCollectionImpl<T, E>;\n this.#joinRows = getEmInternalApi(entity.em).joinRows(this.#collection);\n }\n\n get added(): E[] {\n return this.#toCodes(this.#joinRows.addedFor(this.#collection, this.#entity));\n }\n\n get removed(): E[] {\n return this.#toCodes(this.#joinRows.removedFor(this.#collection, this.#entity));\n }\n\n get changed(): E[] {\n return [...this.added, ...this.removed];\n }\n\n get hasChanged(): boolean {\n return this.added.length > 0 || this.removed.length > 0;\n }\n\n get hasUpdated(): boolean {\n return !this.#entity.isNewEntity && this.hasChanged;\n }\n\n get originalValues(): Promise<readonly E[]> {\n // `load()` ensures the persisted (db) rows are in memory, then diff out our pending changes.\n return this.#collection.load().then((codes) => {\n const added = new Set(this.added);\n const enumDetail = this.#collection.otherEnum;\n return [...codes.filter((c) => !added.has(c)), ...this.removed].sort(\n (a, b) => enumDetail.getByCode(a).id - enumDetail.getByCode(b).id,\n );\n });\n }\n\n /** Maps the join rows' enum ids to codes, sorted by enum id for a stable order. */\n #toCodes(ids: JoinColumnValue[]): E[] {\n const enumDetail = this.#collection.otherEnum;\n return (ids as number[]).sort((a, b) => a - b).map((id) => enumDetail.findById(id)!.code as E);\n }\n}\n\nexport interface OneToManyFieldStatus<U extends Entity> {\n kind: \"o2m\";\n added: U[];\n removed: U[];\n changed: U[];\n hasChanged: boolean;\n hasUpdated: boolean;\n originalEntities: Promise<readonly U[]>;\n}\n\n/** Provides access to an o2m relation's added/removed/changed entities. */\nclass OneToManyFieldStatusImpl<T extends Entity, U extends Entity> implements OneToManyFieldStatus<U> {\n readonly kind = \"o2m\";\n readonly #entity: T;\n readonly #o2m: OneToManyCollection<T, U>;\n\n constructor(entity: T, fieldName: keyof T) {\n this.#entity = entity;\n this.#o2m = entity[fieldName] as OneToManyCollection<T, U>;\n }\n\n // This doesn't have to be a promise, b/c even if o2m is unloaded, to mutate\n // the o2m (calling `add(other)` or `remove(other)` or `other.otherField = me`), all\n // require having the \"other entity\" in memory.\n get added(): U[] {\n return this.#added.sort(entityCompare);\n }\n\n get removed(): U[] {\n return this.#removed.sort(entityCompare);\n }\n\n get changed(): U[] {\n return [...this.added, ...this.removed].sort(entityCompare);\n }\n\n get hasChanged(): boolean {\n // Calculating `changed: U[]` can be expensive if we sort, so just look at added/removed\n return this.#added.length > 0 || this.#removed.length > 0;\n }\n\n get hasUpdated(): boolean {\n return !this.#entity.isNewEntity && this.hasChanged;\n }\n\n get originalEntities(): Promise<readonly U[]> {\n return this.#o2m.load().then((list) => {\n const set = new Set(this.added);\n const copy = list.filter((e) => !set.has(e));\n copy.push(...this.removed);\n return copy.sort(entityCompare);\n });\n }\n\n // This doesn't have to be a promise, b/c even if o2m is unloaded, to mutate\n // the o2m (calling `add(other)` or `remove(other)` or `other.otherField = me`), all\n // require having the \"other entity\" in memory.\n get #added(): U[] {\n return [\n ...this.#o2m.added(),\n ...(this.#entity.isNewEntity\n ? []\n : ((getEmInternalApi(this.#entity.em).pendingPercolate.get(this.#entity.idTagged)?.get(this.#o2m.fieldName)\n ?.adds as U[]) ?? [])),\n ];\n }\n\n get #removed(): U[] {\n return [\n ...this.#o2m.removed(),\n ...(this.#entity.isNewEntity\n ? []\n : ((getEmInternalApi(this.#entity.em).pendingPercolate.get(this.#entity.idTagged)?.get(this.#o2m.fieldName)\n ?.removes as U[]) ?? [])),\n ];\n }\n}\n\n/**\n * Creates the `this.changes.firstName` changes API for a given entity `T`.\n *\n * We use `FieldsOf` because that already excludes collection, and then also\n * convert reference fields to `ManyToOneFieldStatus` to be the id type\n * because the reference may not be loaded.\n *\n * @typeParam K The fields of the entity, or potentially the union of the entity and its subtypes,\n * i.e. `Publisher.changes` is typed as `Changes<Publisher, keyof Publisher | keyof SmallPub | keyof LargePub>`\n * @typeParam R An optional list of restrictions, i.e for `Reacted` for to provide `changes` to its subset of fields.\n */\nexport type Changes<T extends Entity, K = keyof (FieldsOf<T> & RelationsOf<T>), R = K> = {\n /** Array of changed field names. */\n fields: NonNullable<K>[];\n /** Array of changed field names w/o o2m & m2m relations (which can be expensive). */\n fieldsWithoutRelations: NonNullable<K>[];\n} & {\n // The o2o branch is `never`: the FK lives on the other entity, so changes never track o2o fields.\n // (The exclusion must stay in the value position: a conditional in the `[P in ...]` clause defers on\n // a generic `T` and collapses `keyof Changes<T>` at inference time, i.e. in `cannotBeUpdated` calls.)\n [P in keyof FieldsOf<T> & R]: FieldsOf<T>[P] extends { kind: \"m2m\"; type: infer U extends Entity }\n ? ManyToManyFieldStatus<U>\n : FieldsOf<T>[P] extends { kind: \"m2mEnum\"; type: infer E }\n ? EnumCollectionFieldStatus<E>\n : FieldsOf<T>[P] extends { kind: \"o2m\"; type: infer U extends Entity }\n ? OneToManyFieldStatus<U>\n : FieldsOf<T>[P] extends { kind: \"o2o\" }\n ? never\n : FieldsOf<T>[P] extends { type: (infer U) | undefined }\n ? U extends Entity\n ? ManyToOneFieldStatus<U>\n : PrimitiveFieldStatus<U>\n : never;\n};\n\n// type A1 = never extends string ? 1 : 2;\n// type A2 = Book extends Entity | undefined ? 1 : 2;\n// type A2a = string extends Entity | string | undefined ? 1 : 2;\n// type A3 = Book | undefined extends Entity ? 1 : 2;\n// type A4 = Book | undefined | null extends (infer E extends Entity) | undefined | null ? E : 2;\n\n/**\n * A strongly-typed Entity with its changes field.\n *\n * Ideally this would live on `Entity` directly, but results in circular type issues.\n */\nexport interface EntityChanges<T extends Entity> {\n changes: Changes<T>;\n}\n\nexport function newChangesProxy<T extends Entity>(entity: T): Changes<T> {\n return new Proxy(entity, {\n get(\n target,\n p: PropertyKey & string,\n ):\n | FieldStatus<any>\n | ManyToOneFieldStatus<any>\n | ManyToManyFieldStatus<any>\n | OneToManyFieldStatus<any>\n | (keyof OptsOf<T>)[] {\n if (p === \"fields\") {\n return getChangedFieldNames(entity, true);\n } else if (p === \"fieldsWithoutRelations\") {\n return getChangedFieldNames(entity, false);\n } else if (typeof p === \"symbol\") {\n throw new Error(`Unsupported call to ${String(p)}`);\n }\n const kind = getMetadata(entity).allFields[p]?.kind;\n if (kind === \"m2m\") {\n return new ManyToManyFieldStatusImpl(entity, p as keyof T);\n } else if (kind === \"m2mEnum\") {\n return new EnumCollectionFieldStatusImpl(entity, p as keyof T);\n } else if (kind === \"o2m\") {\n return new OneToManyFieldStatusImpl(entity, p as keyof T);\n } else if (!isChangeableField(entity, p as any)) {\n throw new Error(`Invalid changes field ${p}`);\n } else if (kind === \"m2o\" || kind === \"poly\") {\n return new ManyToOneFieldStatusImpl(entity, p);\n } else if (kind === \"enum\" || kind === \"primitive\" || kind === \"primaryKey\") {\n return new PrimitiveFieldStatusImpl(entity, p);\n } else if (kind === \"lo2m\" || kind === \"o2o\") {\n throw new Error(`changes are not supported for ${kind} ${p}`);\n } else {\n return assertNever(kind);\n }\n },\n }) as any;\n}\n\nconst addOriginalEntity: Record<Field[\"kind\"], boolean> = {\n m2o: true,\n poly: true,\n m2mEnum: false,\n enum: false,\n lo2m: false,\n m2m: false,\n o2m: false,\n o2o: false,\n primaryKey: false,\n primitive: false,\n};\n\n/** Scans `entity` for changes primitive + m2m/o2m fields. */\nfunction getChangedFieldNames<T extends Entity>(entity: T, includeRelations: boolean): (keyof OptsOf<T>)[] {\n const fieldsChanged = entity.isNewEntity\n ? // Cloning sometimes leaves unset keys in data as undefined, so drop them\n Object.entries(getInstanceData(entity).data)\n .filter(([, value]) => value !== undefined)\n .map(([key]) => key)\n : Object.keys(getInstanceData(entity).originalData);\n\n // Calling `hasChanged` on these can be expensive, and we call this in a loop during em.flush\n if (includeRelations) {\n for (const field of Object.values(getMetadata(entity).allFields)) {\n if (field.kind === \"m2m\") {\n const status = new ManyToManyFieldStatusImpl(entity, field.fieldName as keyof T);\n if (status.hasChanged) {\n fieldsChanged.push(field.fieldName);\n }\n } else if (field.kind === \"o2m\") {\n const status = new OneToManyFieldStatusImpl(entity, field.fieldName as keyof T);\n if (status.hasChanged) {\n fieldsChanged.push(field.fieldName);\n }\n } else if (field.kind === \"m2mEnum\") {\n const status = new EnumCollectionFieldStatusImpl(entity, field.fieldName as keyof T);\n if (status.hasChanged) {\n fieldsChanged.push(field.fieldName);\n }\n }\n }\n }\n\n return fieldsChanged as any;\n}\n\nconst entityCompare: (a: Entity, b: Entity) => number = (a, b) => {\n return a.toString().localeCompare(b.toString());\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,IAAe,sBAAf,MAAsC;CACpC;CACA;CAEA,YAAY,QAAgB,WAAmB;EAC7C,KAAK,SAAS;EACd,KAAK,YAAY;CACnB;CAEA,IAAI,gBAA+B;EACjC,MAAM,EAAE,cAAc,SAAS,gBAAgB,KAAK,MAAM;EAE1D,MAAM,QACJ,KAAK,aAAa,eAAe,aAAa,KAAK,aAAa,SAAS,KAAK,QAAQ,KAAK,SAAgB;EAE7G,OAAO,UAAU,iBAAiB,KAAA,IAAY;CAChD;CAEA,IAAI,aAAsB;EACxB,MAAM,EAAE,cAAc,SAAS,gBAAgB,KAAK,MAAM;EAG1D,OAAO,KAAK,OAAO,cAAc,KAAK,KAAK,eAAe,KAAA,IAAY,KAAK,aAAa;CAC1F;CAEA,IAAI,aAAsB;EACxB,MAAM,EAAE,iBAAiB,gBAAgB,KAAK,MAAM;EACpD,OAAO,CAAC,KAAK,OAAO,eAAe,KAAK,aAAa;CACvD;AACF;;AAQA,IAAM,2BAAN,cAA0C,oBAA0D;CAClG,OAAO;AACT;;AAGA,IAAM,2BAAN,cACU,oBAEV;CACE,OAAO;;;;;;;;;;CAWP,IAAI,gBAAgB;EAClB,MAAM,gBAAgB,MAAM;EAC5B,OAAO,SAAS,aAAa,IAAK,cAAc,KAAiB;CACnE;;CAGA,IAAI,iBAAyC;EAC3C,MAAM,gBAAgB,KAAK;EAC3B,IAAI,KAAK,aAAa,GACpB,OAAO,KA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;OAAA,IADe,yBAAyB,QAAQ,MAAM,SACjD,CAAC,CAAC,YACT,cAAc,KAAK,MAAM,SAAS;EAAA,OAE/B,IAAI,MAAM,SAAS,WAEpB;OAAA,IADe,8BAA8B,QAAQ,MAAM,SACtD,CAAC,CAAC,YACT,cAAc,KAAK,MAAM,SAAS;EAAA;CACpC;CAKN,OAAO;AACT;AAEA,MAAM,iBAAmD,GAAG,MAAM;CAChE,OAAO,EAAE,SAAS,CAAC,CAAC,cAAc,EAAE,SAAS,CAAC;AAChD"}
|
|
1
|
+
{"version":3,"file":"changes.js","names":[],"sources":["../src/changes.ts"],"sourcesContent":["import { getInstanceData } from \"src/BaseEntity.ts\";\nimport { type Entity } from \"src/Entity.ts\";\nimport { type IdOf } from \"src/EntityManager.ts\";\nimport { getField, isChangeableField } from \"src/fields.ts\";\nimport type { JoinColumnValue, JoinRows } from \"src/flush/JoinRows.ts\";\nimport {\n type Field,\n type ManyToManyCollection,\n type OneToManyCollection,\n type RelationsOf,\n assertNever,\n getEmInternalApi,\n getMetadata,\n isEntity,\n isId,\n} from \"src/index.ts\";\nimport { type EnumCollectionImpl } from \"src/relations/EnumCollection.ts\";\nimport { notLoadedValue } from \"src/relations/LazyField.ts\";\nimport { type FieldsOf, type OptsOf } from \"src/typeMap.ts\";\n\n/** Exposes a field's changed/original value in each entity's `this.changes` property. */\nexport interface FieldStatus<T> {\n /** True if the field has been changed on either create or update. */\n hasChanged: boolean;\n /** True only if the field has been updated i.e. not on the initial create. */\n hasUpdated: boolean;\n /** The original value, will be `undefined` if the entity new. */\n originalValue?: T;\n}\n\n/**\n * Provides a base class for field/primitive & m2o status impls.\n *\n * We use a separate base class so that the primitive & m2o subtypes can have their own\n * `kind: ...` consts, that if the m2o just subtyped the primitive directly, wouldn't be\n * allowed.\n */\nabstract class BaseFieldStatusImpl<T> {\n entity: Entity;\n fieldName: string;\n\n constructor(entity: Entity, fieldName: string) {\n this.entity = entity;\n this.fieldName = fieldName;\n }\n\n get originalValue(): T | undefined {\n const { originalData, data } = getInstanceData(this.entity);\n // If `p` is in originalData, always respect that, even if it's undefined\n const value =\n this.fieldName in originalData ? originalData[this.fieldName] : getField(this.entity, this.fieldName as any);\n // An unloaded lazy column's original value is unknown\n return value === notLoadedValue ? undefined : value;\n }\n\n get hasChanged(): boolean {\n const { originalData, data } = getInstanceData(this.entity);\n // Use `__orm.data[p] !== undefined` instead of `p in entity.__orm.data` because if a new (or cloned) entity\n // sets-then-unsets a value, it will return to `undefined` but still be present in `__orm.data`.\n return this.entity.isNewEntity ? data[this.fieldName] !== undefined : this.fieldName in originalData;\n }\n\n get hasUpdated(): boolean {\n const { originalData } = getInstanceData(this.entity);\n return !this.entity.isNewEntity && this.fieldName in originalData;\n }\n}\n\n/** Field status for primitive, enum, & primary key columns. */\nexport interface PrimitiveFieldStatus<T> extends FieldStatus<T> {\n kind: \"field\";\n}\n\n/** Implements the primitive field status, by extend base & just adding our `kind` const. */\nclass PrimitiveFieldStatusImpl<T> extends BaseFieldStatusImpl<T> implements PrimitiveFieldStatus<T> {\n kind = \"field\" as const;\n}\n\n/** Implements the m2o field status, by extend base, & adding `originalEntity`. */\nclass ManyToOneFieldStatusImpl<T extends Entity>\n extends BaseFieldStatusImpl<IdOf<T>>\n implements ManyToOneFieldStatus<T>\n{\n kind = \"m2o\" as const;\n\n /**\n * Returns our original entity's `id`.\n *\n * We can know `originalValue` has an `id` available (i.e. is not new), b/c original values defacto\n * came from the database.\n *\n * We also return the id so that `entity.changes.m2oField.originalValue` has a consistent API,\n * regardless of whether the `entity.m2oField` itself is loaded or unloaded.\n */\n get originalValue() {\n const originalValue = super.originalValue;\n return isEntity(originalValue) ? (originalValue.id as IdOf<T>) : originalValue;\n }\n\n /** Returns the original entity instance, which may not be loaded into memory yet, or undefined. */\n get originalEntity(): Promise<T | undefined> {\n const originalValue = this.originalValue;\n if (isId(originalValue)) {\n return this.entity.em.load(originalValue) as Promise<T>;\n } else {\n return Promise.resolve(undefined);\n }\n }\n}\n\n/** Provides a m2o/reference field's changed/original value in the entity's `this.changes` property. */\nexport interface ManyToOneFieldStatus<T extends Entity> extends FieldStatus<IdOf<T>> {\n kind: \"m2o\";\n /** The original entity, will be `undefined` if the entity new or the m2o was `null`. */\n originalEntity: Promise<T | undefined>;\n}\n\n/** Provides a m2m relation's added/removed/changed/original values. */\nexport interface ManyToManyFieldStatus<U extends Entity> {\n kind: \"m2m\";\n added: U[];\n removed: U[];\n changed: U[];\n hasChanged: boolean;\n hasUpdated: boolean;\n originalEntities: Promise<readonly U[]>;\n}\n\nclass ManyToManyFieldStatusImpl<T extends Entity, U extends Entity> implements ManyToManyFieldStatus<U> {\n readonly kind = \"m2m\";\n readonly #entity: T;\n readonly #m2m: ManyToManyCollection<T, any>;\n readonly #joinRows: JoinRows;\n\n constructor(entity: T, fieldName: keyof T) {\n this.#entity = entity;\n this.#m2m = entity[fieldName] as ManyToManyCollection<T, any>;\n this.#joinRows = getEmInternalApi(entity.em).joinRows(this.#m2m);\n }\n\n // Similar to the o2m.added/removed methods, these don't have to be async because currently\n // any m2m mutation requires having both entities in-memory anyway, i.e. we can't do id-only/unloaded\n // mutation of m2m relations.\n get added(): U[] {\n return this.#added.sort(entityCompare);\n }\n\n get removed(): U[] {\n return this.#removed.sort(entityCompare);\n }\n\n get changed(): U[] {\n return [...this.#added, ...this.#removed].sort(entityCompare);\n }\n\n get hasChanged(): boolean {\n // Calculating `changed: U[]` can be expensive if we sort, so just look at added/removed\n return this.#added.length > 0 || this.#removed.length > 0;\n }\n\n get hasUpdated(): boolean {\n return !this.#entity.isNewEntity && this.hasChanged;\n }\n\n get originalEntities(): Promise<readonly U[]> {\n return this.#m2m.load().then((list) => {\n const set = new Set(this.added);\n const copy = list.filter((e) => !set.has(e));\n copy.push(...this.removed);\n return copy.sort(entityCompare);\n });\n }\n\n get #added(): U[] {\n return this.#joinRows.addedFor(this.#m2m, this.#entity) as U[];\n }\n\n get #removed(): U[] {\n return this.#joinRows.removedFor(this.#m2m, this.#entity) as U[];\n }\n}\n\n/** Provides an enum m2m's added/removed/changed/original codes (e.g. `Publisher.logoColors`). */\nexport interface EnumCollectionFieldStatus<E> {\n kind: \"m2mEnum\";\n added: E[];\n removed: E[];\n changed: E[];\n hasChanged: boolean;\n hasUpdated: boolean;\n originalValues: Promise<readonly E[]>;\n}\n\nclass EnumCollectionFieldStatusImpl<T extends Entity, E> implements EnumCollectionFieldStatus<E> {\n readonly kind = \"m2mEnum\";\n readonly #entity: T;\n readonly #collection: EnumCollectionImpl<T, E>;\n readonly #joinRows: JoinRows;\n\n constructor(entity: T, fieldName: keyof T) {\n this.#entity = entity;\n this.#collection = entity[fieldName] as EnumCollectionImpl<T, E>;\n this.#joinRows = getEmInternalApi(entity.em).joinRows(this.#collection);\n }\n\n get added(): E[] {\n return this.#toCodes(this.#joinRows.addedFor(this.#collection, this.#entity));\n }\n\n get removed(): E[] {\n return this.#toCodes(this.#joinRows.removedFor(this.#collection, this.#entity));\n }\n\n get changed(): E[] {\n return [...this.added, ...this.removed];\n }\n\n get hasChanged(): boolean {\n return this.added.length > 0 || this.removed.length > 0;\n }\n\n get hasUpdated(): boolean {\n return !this.#entity.isNewEntity && this.hasChanged;\n }\n\n get originalValues(): Promise<readonly E[]> {\n // `load()` ensures the persisted (db) rows are in memory, then diff out our pending changes.\n return this.#collection.load().then((codes) => {\n const added = new Set(this.added);\n const enumDetail = this.#collection.otherEnum;\n return [...codes.filter((c) => !added.has(c)), ...this.removed].sort(\n (a, b) => enumDetail.getByCode(a).id - enumDetail.getByCode(b).id,\n );\n });\n }\n\n /** Maps the join rows' enum ids to codes, sorted by enum id for a stable order. */\n #toCodes(ids: JoinColumnValue[]): E[] {\n const enumDetail = this.#collection.otherEnum;\n return (ids as number[]).sort((a, b) => a - b).map((id) => enumDetail.findById(id)!.code as E);\n }\n}\n\nexport interface OneToManyFieldStatus<U extends Entity> {\n kind: \"o2m\";\n added: U[];\n removed: U[];\n changed: U[];\n hasChanged: boolean;\n hasUpdated: boolean;\n originalEntities: Promise<readonly U[]>;\n}\n\n/** Provides access to an o2m relation's added/removed/changed entities. */\nclass OneToManyFieldStatusImpl<T extends Entity, U extends Entity> implements OneToManyFieldStatus<U> {\n readonly kind = \"o2m\";\n readonly #entity: T;\n readonly #o2m: OneToManyCollection<T, U>;\n\n constructor(entity: T, fieldName: keyof T) {\n this.#entity = entity;\n this.#o2m = entity[fieldName] as OneToManyCollection<T, U>;\n }\n\n // This doesn't have to be a promise, b/c even if o2m is unloaded, to mutate\n // the o2m (calling `add(other)` or `remove(other)` or `other.otherField = me`), all\n // require having the \"other entity\" in memory.\n get added(): U[] {\n return this.#added.sort(entityCompare);\n }\n\n get removed(): U[] {\n return this.#removed.sort(entityCompare);\n }\n\n get changed(): U[] {\n return [...this.added, ...this.removed].sort(entityCompare);\n }\n\n get hasChanged(): boolean {\n // Calculating `changed: U[]` can be expensive if we sort, so just look at added/removed\n return this.#added.length > 0 || this.#removed.length > 0;\n }\n\n get hasUpdated(): boolean {\n return !this.#entity.isNewEntity && this.hasChanged;\n }\n\n get originalEntities(): Promise<readonly U[]> {\n return this.#o2m.load().then((list) => {\n const set = new Set(this.added);\n const copy = list.filter((e) => !set.has(e));\n copy.push(...this.removed);\n return copy.sort(entityCompare);\n });\n }\n\n // This doesn't have to be a promise, b/c even if o2m is unloaded, to mutate\n // the o2m (calling `add(other)` or `remove(other)` or `other.otherField = me`), all\n // require having the \"other entity\" in memory.\n get #added(): U[] {\n return [\n ...this.#o2m.added(),\n ...(this.#entity.isNewEntity\n ? []\n : ((getEmInternalApi(this.#entity.em).pendingPercolate.get(this.#entity.idTagged)?.get(this.#o2m.fieldName)\n ?.adds as U[]) ?? [])),\n ];\n }\n\n get #removed(): U[] {\n return [\n ...this.#o2m.removed(),\n ...(this.#entity.isNewEntity\n ? []\n : ((getEmInternalApi(this.#entity.em).pendingPercolate.get(this.#entity.idTagged)?.get(this.#o2m.fieldName)\n ?.removes as U[]) ?? [])),\n ];\n }\n}\n\n/**\n * Creates the `this.changes.firstName` changes API for a given entity `T`.\n *\n * We use `FieldsOf` because that already excludes collection, and then also\n * convert reference fields to `ManyToOneFieldStatus` to be the id type\n * because the reference may not be loaded.\n *\n * @typeParam K The fields of the entity, or potentially the union of the entity and its subtypes,\n * i.e. `Publisher.changes` is typed as `Changes<Publisher, keyof Publisher | keyof SmallPub | keyof LargePub>`\n * @typeParam R An optional list of restrictions, i.e for `Reacted` for to provide `changes` to its subset of fields.\n */\nexport type Changes<T extends Entity, K = keyof (FieldsOf<T> & RelationsOf<T>), R = K> = {\n /** Array of changed field names. */\n fields: NonNullable<K>[];\n /** Array of changed field names w/o o2m & m2m relations (which can be expensive). */\n fieldsWithoutRelations: NonNullable<K>[];\n} & {\n // The o2o branch is `never`: the FK lives on the other entity, so changes never track o2o fields.\n // (The exclusion must stay in the value position: a conditional in the `[P in ...]` clause defers on\n // a generic `T` and collapses `keyof Changes<T>` at inference time, i.e. in `cannotBeUpdated` calls.)\n [P in keyof FieldsOf<T> & R]: FieldsOf<T>[P] extends { kind: \"m2m\"; type: infer U extends Entity }\n ? ManyToManyFieldStatus<U>\n : FieldsOf<T>[P] extends { kind: \"m2mEnum\"; type: infer E }\n ? EnumCollectionFieldStatus<E>\n : FieldsOf<T>[P] extends { kind: \"o2m\"; type: infer U extends Entity }\n ? OneToManyFieldStatus<U>\n : FieldsOf<T>[P] extends { kind: \"o2o\" }\n ? never\n : FieldsOf<T>[P] extends { type: (infer U) | undefined }\n ? U extends Entity\n ? ManyToOneFieldStatus<U>\n : PrimitiveFieldStatus<U>\n : never;\n};\n\n// type A1 = never extends string ? 1 : 2;\n// type A2 = Book extends Entity | undefined ? 1 : 2;\n// type A2a = string extends Entity | string | undefined ? 1 : 2;\n// type A3 = Book | undefined extends Entity ? 1 : 2;\n// type A4 = Book | undefined | null extends (infer E extends Entity) | undefined | null ? E : 2;\n\n/**\n * A strongly-typed Entity with its changes field.\n *\n * Ideally this would live on `Entity` directly, but results in circular type issues.\n */\nexport interface EntityChanges<T extends Entity> {\n changes: Changes<T>;\n}\n\nexport function newChangesProxy<T extends Entity>(entity: T): Changes<T> {\n return new Proxy(entity, {\n get(\n target,\n p: PropertyKey & string,\n ):\n | FieldStatus<any>\n | ManyToOneFieldStatus<any>\n | ManyToManyFieldStatus<any>\n | OneToManyFieldStatus<any>\n | (keyof OptsOf<T>)[] {\n if (p === \"fields\") {\n return getChangedFieldNames(entity, true);\n } else if (p === \"fieldsWithoutRelations\") {\n return getChangedFieldNames(entity, false);\n } else if (typeof p === \"symbol\") {\n throw new Error(`Unsupported call to ${String(p)}`);\n }\n const kind = getMetadata(entity).allFields[p]?.kind;\n if (kind === \"m2m\") {\n return new ManyToManyFieldStatusImpl(entity, p as keyof T);\n } else if (kind === \"m2mEnum\") {\n return new EnumCollectionFieldStatusImpl(entity, p as keyof T);\n } else if (kind === \"o2m\") {\n return new OneToManyFieldStatusImpl(entity, p as keyof T);\n } else if (!isChangeableField(entity, p as any)) {\n throw new Error(`Invalid changes field ${p}`);\n } else if (kind === \"m2o\" || kind === \"poly\") {\n return new ManyToOneFieldStatusImpl(entity, p);\n } else if (kind === \"enum\" || kind === \"primitive\" || kind === \"primaryKey\") {\n return new PrimitiveFieldStatusImpl(entity, p);\n } else if (kind === \"lo2m\" || kind === \"o2o\") {\n throw new Error(`changes are not supported for ${kind} ${p}`);\n } else {\n return assertNever(kind);\n }\n },\n }) as any;\n}\n\nconst addOriginalEntity: Record<Field[\"kind\"], boolean> = {\n m2o: true,\n poly: true,\n m2mEnum: false,\n enum: false,\n lo2m: false,\n m2m: false,\n o2m: false,\n o2o: false,\n primaryKey: false,\n primitive: false,\n};\n\n/** Scans `entity` for changes primitive + m2m/o2m fields. */\nfunction getChangedFieldNames<T extends Entity>(entity: T, includeRelations: boolean): (keyof OptsOf<T>)[] {\n const fieldsChanged = entity.isNewEntity\n ? // Cloning sometimes leaves unset keys in data as undefined, so drop them\n Object.entries(getInstanceData(entity).data)\n .filter(([, value]) => value !== undefined)\n .map(([key]) => key)\n : Object.keys(getInstanceData(entity).originalData);\n\n // Calling `hasChanged` on these can be expensive, and we call this in a loop during em.flush\n if (includeRelations) {\n for (const field of Object.values(getMetadata(entity).allFields)) {\n if (field.kind === \"m2m\") {\n const status = new ManyToManyFieldStatusImpl(entity, field.fieldName as keyof T);\n if (status.hasChanged) {\n fieldsChanged.push(field.fieldName);\n }\n } else if (field.kind === \"o2m\") {\n const status = new OneToManyFieldStatusImpl(entity, field.fieldName as keyof T);\n if (status.hasChanged) {\n fieldsChanged.push(field.fieldName);\n }\n } else if (field.kind === \"m2mEnum\") {\n const status = new EnumCollectionFieldStatusImpl(entity, field.fieldName as keyof T);\n if (status.hasChanged) {\n fieldsChanged.push(field.fieldName);\n }\n }\n }\n }\n\n return fieldsChanged as any;\n}\n\nconst entityCompare: (a: Entity, b: Entity) => number = (a, b) => {\n return a.toString().localeCompare(b.toString());\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,IAAe,sBAAf,MAAsC;CACpC;CACA;CAEA,YAAY,QAAgB,WAAmB;EAC7C,KAAK,SAAS;EACd,KAAK,YAAY;CACnB;CAEA,IAAI,gBAA+B;EACjC,MAAM,EAAE,cAAc,SAAS,gBAAgB,KAAK,MAAM;EAE1D,MAAM,QACJ,KAAK,aAAa,eAAe,aAAa,KAAK,aAAa,SAAS,KAAK,QAAQ,KAAK,SAAgB;EAE7G,OAAO,UAAU,iBAAiB,KAAA,IAAY;CAChD;CAEA,IAAI,aAAsB;EACxB,MAAM,EAAE,cAAc,SAAS,gBAAgB,KAAK,MAAM;EAG1D,OAAO,KAAK,OAAO,cAAc,KAAK,KAAK,eAAe,KAAA,IAAY,KAAK,aAAa;CAC1F;CAEA,IAAI,aAAsB;EACxB,MAAM,EAAE,iBAAiB,gBAAgB,KAAK,MAAM;EACpD,OAAO,CAAC,KAAK,OAAO,eAAe,KAAK,aAAa;CACvD;AACF;;AAQA,IAAM,2BAAN,cAA0C,oBAA0D;CAClG,OAAO;AACT;;AAGA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,CAAC,SAAS,GAC7D,IAAI,MAAM,SAAS,OAEb;OAAA,IADe,0BAA0B,QAAQ,MAAM,SAClD,CAAC,CAAC,YACT,cAAc,KAAK,MAAM,SAAS;EAAA,OAE/B,IAAI,MAAM,SAAS,OAEpB;OAAA,IADe,yBAAyB,QAAQ,MAAM,SACjD,CAAC,CAAC,YACT,cAAc,KAAK,MAAM,SAAS;EAAA,OAE/B,IAAI,MAAM,SAAS,WAEpB;OAAA,IADe,8BAA8B,QAAQ,MAAM,SACtD,CAAC,CAAC,YACT,cAAc,KAAK,MAAM,SAAS;EAAA;CACpC;CAKN,OAAO;AACT;AAEA,MAAM,iBAAmD,GAAG,MAAM;CAChE,OAAO,EAAE,SAAS,CAAC,CAAC,cAAc,EAAE,SAAS,CAAC;AAChD"}
|
package/build/config.d.cts
CHANGED
|
@@ -11,14 +11,14 @@ import "./index.cjs";
|
|
|
11
11
|
import { EntityConstructor, MaybeAbstractEntityConstructor } from "./EntityManager.cjs";
|
|
12
12
|
import { Entity } from "./Entity.cjs";
|
|
13
13
|
//#region src/config.d.ts
|
|
14
|
-
type EntityHook = "beforeFlush" | "beforeCreate" | "beforeUpdate" | "beforeDelete" | "afterValidation" | "beforeCommit" | "afterCommit";
|
|
14
|
+
export type EntityHook = "beforeFlush" | "beforeCreate" | "beforeUpdate" | "beforeDelete" | "afterValidation" | "beforeCommit" | "afterCommit";
|
|
15
15
|
type HookFn<T extends Entity, C> = (entity: T, ctx: C) => MaybePromise<unknown>;
|
|
16
16
|
type AddReactionOpts = {
|
|
17
17
|
runOnce?: boolean;
|
|
18
18
|
name?: string;
|
|
19
19
|
};
|
|
20
20
|
/** An `addTransitionRule` rule, which also gets the transition it is checking, since the entity may have moved on. */
|
|
21
|
-
type TransitionGuardFn<T extends Entity, V> = (entity: T, transition: Transition<V>) => MaybePromise<ValidationRuleResult>;
|
|
21
|
+
export type TransitionGuardFn<T extends Entity, V> = (entity: T, transition: Transition<V>) => MaybePromise<ValidationRuleResult>;
|
|
22
22
|
/** An `addTransitionReaction` function, which also gets the transition it is handling, since the entity may have moved on. */
|
|
23
23
|
type TransitionFn<T extends Entity, C, V> = (entity: T, ctx: C, transition: Transition<V>) => MaybePromise<unknown>;
|
|
24
24
|
/** The enum type of a transition field, i.e. `PublisherStatus`. */
|
|
@@ -32,7 +32,7 @@ type TransitionType<T extends Entity, K extends keyof FieldsOf<T>> = FieldsOf<T>
|
|
|
32
32
|
type TransitionStates<T extends Entity, K extends keyof FieldsOf<T>> = FieldsOf<T>[K] extends {
|
|
33
33
|
accessors: infer A extends string;
|
|
34
34
|
} ? A : never;
|
|
35
|
-
declare const constraintNameToValidationError: Record<string, string>;
|
|
35
|
+
export declare const constraintNameToValidationError: Record<string, string>;
|
|
36
36
|
type Settable<T extends Entity> = keyof SettableFields<FieldsOf<T>> & string;
|
|
37
37
|
/**
|
|
38
38
|
* Called at the end of `configureMetadata` to indicate the boot process is complete.
|
|
@@ -41,10 +41,10 @@ type Settable<T extends Entity> = keyof SettableFields<FieldsOf<T>> & string;
|
|
|
41
41
|
* process is complete, i.e. from hooks or other post-boot invocations, where the calls are
|
|
42
42
|
* not guaranteed to work because Joist's reactivity graph has already been initialized.
|
|
43
43
|
*/
|
|
44
|
-
declare function setBooted(): void;
|
|
45
|
-
declare function setAfterMetadataLocked(): void;
|
|
44
|
+
export declare function setBooted(): void;
|
|
45
|
+
export declare function setAfterMetadataLocked(): void;
|
|
46
46
|
/** The public API to configure an Entity's hooks & validation rules. */
|
|
47
|
-
declare class ConfigApi<T extends Entity, C> {
|
|
47
|
+
export declare class ConfigApi<T extends Entity, C> {
|
|
48
48
|
__data: ConfigData<T, C>;
|
|
49
49
|
/**
|
|
50
50
|
* Maps a given `constraintName`, i.e. `authors_publisher_id_unique_index`, to a hard-coded-but-pretty validation errors.
|
|
@@ -242,14 +242,14 @@ declare class ConfigApi<T extends Entity, C> {
|
|
|
242
242
|
* to call this, but if Joist is used in a framework that does actual-hot-reloading, this
|
|
243
243
|
* it will be necessary.
|
|
244
244
|
*/
|
|
245
|
-
declare function resetBootFlag(): void;
|
|
245
|
+
export declare function resetBootFlag(): void;
|
|
246
246
|
/**
|
|
247
247
|
* Stores a path back to a reactive rule.
|
|
248
248
|
*
|
|
249
249
|
* I.e. if `Book` has a `ruleFn` that reacts to `Author.title`, then `Author`'s config will have
|
|
250
250
|
* a `ReactiveRule` with fields `["title"]`, path `books`, and rule `ruleFn`.
|
|
251
251
|
*/
|
|
252
|
-
interface ReactiveRule {
|
|
252
|
+
export interface ReactiveRule {
|
|
253
253
|
/** The source we're reacting to, specifically which base/subtype cstr. */
|
|
254
254
|
source: MaybeAbstractEntityConstructor<any>;
|
|
255
255
|
/** The fields on this source entity that would trigger the downstream rule's eval. */
|
|
@@ -269,7 +269,7 @@ interface ReactiveRule {
|
|
|
269
269
|
* I.e. if `Book.displayName` is an `asyncField` that reacts to `Author.title`, then `Author`'s config will have
|
|
270
270
|
* a `ReactiveFields` with fields `["title"]`, path `books`, and name `displayName`.
|
|
271
271
|
*/
|
|
272
|
-
interface ReactiveField {
|
|
272
|
+
export interface ReactiveField {
|
|
273
273
|
kind: "populate" | "query";
|
|
274
274
|
/** The fields on this source entity that would trigger the downstream field's recalc. */
|
|
275
275
|
fields: string[];
|
|
@@ -283,7 +283,7 @@ interface ReactiveField {
|
|
|
283
283
|
name: string;
|
|
284
284
|
runOnce: false;
|
|
285
285
|
}
|
|
286
|
-
interface Reaction {
|
|
286
|
+
export interface Reaction {
|
|
287
287
|
kind: "reaction";
|
|
288
288
|
/** The source we're reacting to, specifically which base/subtype cstr. */
|
|
289
289
|
source: MaybeAbstractEntityConstructor<any>;
|
|
@@ -302,7 +302,7 @@ interface Reaction {
|
|
|
302
302
|
/** If true, the reaction should only run once per flush, not every time the hint changes. */
|
|
303
303
|
runOnce: boolean;
|
|
304
304
|
}
|
|
305
|
-
type Reactable = ReactiveField | Reaction;
|
|
305
|
+
export type Reactable = ReactiveField | Reaction;
|
|
306
306
|
interface ReactionInternal<T extends Entity, H extends ReactiveHint<T>, C> {
|
|
307
307
|
name: string;
|
|
308
308
|
fn: HookFn<T, C>;
|
|
@@ -311,7 +311,7 @@ interface ReactionInternal<T extends Entity, H extends ReactiveHint<T>, C> {
|
|
|
311
311
|
}
|
|
312
312
|
type AfterMetadataCallback<T extends Entity> = (meta: EntityMetadata<T>) => void;
|
|
313
313
|
/** The internal state of an entity's configuration data, i.e. validation rules/hooks. */
|
|
314
|
-
declare class ConfigData<T extends Entity, C> {
|
|
314
|
+
export declare class ConfigData<T extends Entity, C> {
|
|
315
315
|
afterMetadataCallbacks: AfterMetadataCallback<T>[];
|
|
316
316
|
runHooksBefore: EntityConstructor<any>[];
|
|
317
317
|
/** The validation rules for this entity type. */
|
|
@@ -344,16 +344,16 @@ declare class ConfigData<T extends Entity, C> {
|
|
|
344
344
|
/** Maps recursive collection fieldNames to custom cycle error message functions. */
|
|
345
345
|
cycleMessages: Record<string, (entity: T, cyclePath: Entity[]) => string>;
|
|
346
346
|
}
|
|
347
|
-
declare function getCallerName(extraFrames?: number): string;
|
|
348
|
-
declare function getFuzzyCallerName(): string;
|
|
347
|
+
export declare function getCallerName(extraFrames?: number): string;
|
|
348
|
+
export declare function getFuzzyCallerName(): string;
|
|
349
349
|
/**
|
|
350
350
|
* Given a callstack line return the file name.
|
|
351
351
|
*
|
|
352
352
|
* I.e. `at Object.<anonymous> (/home/stephen/homebound/graphql-service/src/entities/Activity.ts:86:8)`
|
|
353
353
|
*/
|
|
354
|
-
declare function getFilePath(line: string): string;
|
|
354
|
+
export declare function getFilePath(line: string): string;
|
|
355
355
|
/** Given a callstack, uses heuristics to find the first line that looks like user code. */
|
|
356
|
-
declare function findUserCodeLine(lines: string[]): string;
|
|
356
|
+
export declare function findUserCodeLine(lines: string[]): string;
|
|
357
357
|
//#endregion
|
|
358
|
-
export {
|
|
358
|
+
export {};
|
|
359
359
|
//# sourceMappingURL=config.d.cts.map
|
package/build/config.d.cts.map
CHANGED
|
@@ -1 +1 @@
|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9B,iBAAiB,UAAU,QAAQ,UAAU,aAAa,IAAI;EACtE;EACA,IAAI,OAAO,GAAG;EACd,MAAM;EACN;;KAGG,sBAAsB,UAAU,WAAW,MAAM,eAAe;;qBAGxD,WAAW,UAAU,QAAQ;EACxC,wBAAwB,sBAAsB;EAC9C,gBAAgB;;EAEhB,OAAO,uBAAuB;;EAE9B,aAAa,uBAAuB;;EAEpC,WAAW,iBAAiB,QAAQ;;EAEpC,eAAe;;;;;;;EAOf,aAAa,eAAe,uBAAuB,GAAG;;EAEtD,OAAO,OAAO,YAAY,OAAO,GAAG;;EAUpC,cAAc,iBAAiB,QAAQ;;EAEvC,eAAe,eAAe,aAAa;EAG3C,eAAe;EAEf,qBAAqB;EAErB,YAAY;EACZ,qBAAqB,YAAY,YAAY;EAC7C,eAAe,UAAU,YAAY;EAErC,yBAAyB;;EAEzB,eAAe,gBAAgB,QAAQ,GAAG,WAAW;;wBAGvC,cAAc;wBAWd;;;;;;wBAeA,YAAY;;wBAMZ,iBAAiB"}
|
package/build/config.d.mts
CHANGED
|
@@ -11,14 +11,14 @@ import "./index.mjs";
|
|
|
11
11
|
import { EntityConstructor, MaybeAbstractEntityConstructor } from "./EntityManager.mjs";
|
|
12
12
|
import { Entity } from "./Entity.mjs";
|
|
13
13
|
//#region src/config.d.ts
|
|
14
|
-
type EntityHook = "beforeFlush" | "beforeCreate" | "beforeUpdate" | "beforeDelete" | "afterValidation" | "beforeCommit" | "afterCommit";
|
|
14
|
+
export type EntityHook = "beforeFlush" | "beforeCreate" | "beforeUpdate" | "beforeDelete" | "afterValidation" | "beforeCommit" | "afterCommit";
|
|
15
15
|
type HookFn<T extends Entity, C> = (entity: T, ctx: C) => MaybePromise<unknown>;
|
|
16
16
|
type AddReactionOpts = {
|
|
17
17
|
runOnce?: boolean;
|
|
18
18
|
name?: string;
|
|
19
19
|
};
|
|
20
20
|
/** An `addTransitionRule` rule, which also gets the transition it is checking, since the entity may have moved on. */
|
|
21
|
-
type TransitionGuardFn<T extends Entity, V> = (entity: T, transition: Transition<V>) => MaybePromise<ValidationRuleResult>;
|
|
21
|
+
export type TransitionGuardFn<T extends Entity, V> = (entity: T, transition: Transition<V>) => MaybePromise<ValidationRuleResult>;
|
|
22
22
|
/** An `addTransitionReaction` function, which also gets the transition it is handling, since the entity may have moved on. */
|
|
23
23
|
type TransitionFn<T extends Entity, C, V> = (entity: T, ctx: C, transition: Transition<V>) => MaybePromise<unknown>;
|
|
24
24
|
/** The enum type of a transition field, i.e. `PublisherStatus`. */
|
|
@@ -32,7 +32,7 @@ type TransitionType<T extends Entity, K extends keyof FieldsOf<T>> = FieldsOf<T>
|
|
|
32
32
|
type TransitionStates<T extends Entity, K extends keyof FieldsOf<T>> = FieldsOf<T>[K] extends {
|
|
33
33
|
accessors: infer A extends string;
|
|
34
34
|
} ? A : never;
|
|
35
|
-
declare const constraintNameToValidationError: Record<string, string>;
|
|
35
|
+
export declare const constraintNameToValidationError: Record<string, string>;
|
|
36
36
|
type Settable<T extends Entity> = keyof SettableFields<FieldsOf<T>> & string;
|
|
37
37
|
/**
|
|
38
38
|
* Called at the end of `configureMetadata` to indicate the boot process is complete.
|
|
@@ -41,10 +41,10 @@ type Settable<T extends Entity> = keyof SettableFields<FieldsOf<T>> & string;
|
|
|
41
41
|
* process is complete, i.e. from hooks or other post-boot invocations, where the calls are
|
|
42
42
|
* not guaranteed to work because Joist's reactivity graph has already been initialized.
|
|
43
43
|
*/
|
|
44
|
-
declare function setBooted(): void;
|
|
45
|
-
declare function setAfterMetadataLocked(): void;
|
|
44
|
+
export declare function setBooted(): void;
|
|
45
|
+
export declare function setAfterMetadataLocked(): void;
|
|
46
46
|
/** The public API to configure an Entity's hooks & validation rules. */
|
|
47
|
-
declare class ConfigApi<T extends Entity, C> {
|
|
47
|
+
export declare class ConfigApi<T extends Entity, C> {
|
|
48
48
|
__data: ConfigData<T, C>;
|
|
49
49
|
/**
|
|
50
50
|
* Maps a given `constraintName`, i.e. `authors_publisher_id_unique_index`, to a hard-coded-but-pretty validation errors.
|
|
@@ -242,14 +242,14 @@ declare class ConfigApi<T extends Entity, C> {
|
|
|
242
242
|
* to call this, but if Joist is used in a framework that does actual-hot-reloading, this
|
|
243
243
|
* it will be necessary.
|
|
244
244
|
*/
|
|
245
|
-
declare function resetBootFlag(): void;
|
|
245
|
+
export declare function resetBootFlag(): void;
|
|
246
246
|
/**
|
|
247
247
|
* Stores a path back to a reactive rule.
|
|
248
248
|
*
|
|
249
249
|
* I.e. if `Book` has a `ruleFn` that reacts to `Author.title`, then `Author`'s config will have
|
|
250
250
|
* a `ReactiveRule` with fields `["title"]`, path `books`, and rule `ruleFn`.
|
|
251
251
|
*/
|
|
252
|
-
interface ReactiveRule {
|
|
252
|
+
export interface ReactiveRule {
|
|
253
253
|
/** The source we're reacting to, specifically which base/subtype cstr. */
|
|
254
254
|
source: MaybeAbstractEntityConstructor<any>;
|
|
255
255
|
/** The fields on this source entity that would trigger the downstream rule's eval. */
|
|
@@ -269,7 +269,7 @@ interface ReactiveRule {
|
|
|
269
269
|
* I.e. if `Book.displayName` is an `asyncField` that reacts to `Author.title`, then `Author`'s config will have
|
|
270
270
|
* a `ReactiveFields` with fields `["title"]`, path `books`, and name `displayName`.
|
|
271
271
|
*/
|
|
272
|
-
interface ReactiveField {
|
|
272
|
+
export interface ReactiveField {
|
|
273
273
|
kind: "populate" | "query";
|
|
274
274
|
/** The fields on this source entity that would trigger the downstream field's recalc. */
|
|
275
275
|
fields: string[];
|
|
@@ -283,7 +283,7 @@ interface ReactiveField {
|
|
|
283
283
|
name: string;
|
|
284
284
|
runOnce: false;
|
|
285
285
|
}
|
|
286
|
-
interface Reaction {
|
|
286
|
+
export interface Reaction {
|
|
287
287
|
kind: "reaction";
|
|
288
288
|
/** The source we're reacting to, specifically which base/subtype cstr. */
|
|
289
289
|
source: MaybeAbstractEntityConstructor<any>;
|
|
@@ -302,7 +302,7 @@ interface Reaction {
|
|
|
302
302
|
/** If true, the reaction should only run once per flush, not every time the hint changes. */
|
|
303
303
|
runOnce: boolean;
|
|
304
304
|
}
|
|
305
|
-
type Reactable = ReactiveField | Reaction;
|
|
305
|
+
export type Reactable = ReactiveField | Reaction;
|
|
306
306
|
interface ReactionInternal<T extends Entity, H extends ReactiveHint<T>, C> {
|
|
307
307
|
name: string;
|
|
308
308
|
fn: HookFn<T, C>;
|
|
@@ -311,7 +311,7 @@ interface ReactionInternal<T extends Entity, H extends ReactiveHint<T>, C> {
|
|
|
311
311
|
}
|
|
312
312
|
type AfterMetadataCallback<T extends Entity> = (meta: EntityMetadata<T>) => void;
|
|
313
313
|
/** The internal state of an entity's configuration data, i.e. validation rules/hooks. */
|
|
314
|
-
declare class ConfigData<T extends Entity, C> {
|
|
314
|
+
export declare class ConfigData<T extends Entity, C> {
|
|
315
315
|
afterMetadataCallbacks: AfterMetadataCallback<T>[];
|
|
316
316
|
runHooksBefore: EntityConstructor<any>[];
|
|
317
317
|
/** The validation rules for this entity type. */
|
|
@@ -344,16 +344,16 @@ declare class ConfigData<T extends Entity, C> {
|
|
|
344
344
|
/** Maps recursive collection fieldNames to custom cycle error message functions. */
|
|
345
345
|
cycleMessages: Record<string, (entity: T, cyclePath: Entity[]) => string>;
|
|
346
346
|
}
|
|
347
|
-
declare function getCallerName(extraFrames?: number): string;
|
|
348
|
-
declare function getFuzzyCallerName(): string;
|
|
347
|
+
export declare function getCallerName(extraFrames?: number): string;
|
|
348
|
+
export declare function getFuzzyCallerName(): string;
|
|
349
349
|
/**
|
|
350
350
|
* Given a callstack line return the file name.
|
|
351
351
|
*
|
|
352
352
|
* I.e. `at Object.<anonymous> (/home/stephen/homebound/graphql-service/src/entities/Activity.ts:86:8)`
|
|
353
353
|
*/
|
|
354
|
-
declare function getFilePath(line: string): string;
|
|
354
|
+
export declare function getFilePath(line: string): string;
|
|
355
355
|
/** Given a callstack, uses heuristics to find the first line that looks like user code. */
|
|
356
|
-
declare function findUserCodeLine(lines: string[]): string;
|
|
356
|
+
export declare function findUserCodeLine(lines: string[]): string;
|
|
357
357
|
//#endregion
|
|
358
|
-
export {
|
|
358
|
+
export {};
|
|
359
359
|
//# sourceMappingURL=config.d.mts.map
|
package/build/config.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;YA8BY;KAQP,OAAO,UAAU,QAAQ,MAAM,QAAQ,GAAG,KAAK,MAAM;KAErD;EAAoB;EAAmB;;;YAGhC,kBAAkB,UAAU,QAAQ,MAC9C,QAAQ,GACR,YAAY,WAAW,OACpB,aAAa;;KAGb,aAAa,UAAU,QAAQ,GAAG,MAAM,QAAQ,GAAG,KAAK,GAAG,YAAY,WAAW,OAAO;;KAGzF,eAAe,UAAU,QAAQ,gBAAgB,SAAS,MAAM,SAAS,GAAG,WAAW,cACxF,YAAY,SAAS,GAAG;;;;;;;KASvB,iBAAiB,UAAU,QAAQ,gBAAgB,SAAS,MAAM,SAAS,GAAG;EACjF,iBAAiB;IAEf;qBAGS,iCAAiC;KAEzC,SAAS,UAAU,gBAAgB,eAAe,SAAS;;;;;;;;wBAYhD;wBAIA;;qBAKH,UAAU,UAAU,QAAQ;EACvC,QAAM,WAAA,GAAA;;;;;;;;EASN,qBAAqB,wBAAwB;;;;;;;;;;;EAe7C,aAAa,0BAA0B,GAAG,YAAY,QAAQ,GAAG,WAAW;;;;;;;;;;;;EAyB5E,QAAQ,UAAU,aAAa,IAAI,MAAM,GAAG,MAAM,eAAe,QAAQ,GAAG;EAC5E,QAAQ,MAAM,eAAe;;;;;;;;;;;;;;;EAsB7B,cAAc,UAAU,aAAa,IAAI,MAAM,GAAG,MAAM,eAAe,QAAQ,GAAG;EAClF,cAAc,MAAM,eAAe;;EASnC,eAAe,MAAM;;EAKrB,cAAc,gBAAgB,YAAY,KAAK,SAAS;EAKxD,cAA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MAAM;;EAEN;;EAEA;EACA;;iBAGe;EACf;;EAEA,QAAQ;;EAER;;EAEA;;EAEA,MAAM;;EAEN;;EAEA;;EAEA,IAAI;;EAEJ;;YAGU,YAAY,gBAAgB;UAE9B,iBAAiB,UAAU,QAAQ,UAAU,aAAa,IAAI;EACtE;EACA,IAAI,OAAO,GAAG;EACd,MAAM;EACN;;KAGG,sBAAsB,UAAU,WAAW,MAAM,eAAe;;qBAGxD,WAAW,UAAU,QAAQ;EACxC,wBAAwB,sBAAsB;EAC9C,gBAAgB;;EAEhB,OAAO,uBAAuB;;EAE9B,aAAa,uBAAuB;;EAEpC,WAAW,iBAAiB,QAAQ;;EAEpC,eAAe;;;;;;;EAOf,aAAa,eAAe,uBAAuB,GAAG;;EAEtD,OAAO,OAAO,YAAY,OAAO,GAAG;;EAUpC,cAAc,iBAAiB,QAAQ;;EAEvC,eAAe,eAAe,aAAa;EAG3C,eAAe;EAEf,qBAAqB;EAErB,YAAY;EACZ,qBAAqB,YAAY,YAAY;EAC7C,eAAe,UAAU,YAAY;EAErC,yBAAyB;;EAEzB,eAAe,gBAAgB,QAAQ,GAAG,WAAW;;wBAGvC,cAAc;wBAWd;;;;;;wBAeA,YAAY;;wBAMZ,iBAAiB"}
|
package/build/configure.d.cts
CHANGED
|
@@ -5,15 +5,14 @@ import { MaybeAbstractEntityConstructor, TaggedId } from "./EntityManager.cjs";
|
|
|
5
5
|
import { Entity } from "./Entity.cjs";
|
|
6
6
|
//#region src/configure.d.ts
|
|
7
7
|
/** Performs our boot-time initialization, i.e. hooking up reactivity. */
|
|
8
|
-
declare function configureMetadata(metas: EntityMetadata[]): void;
|
|
9
|
-
declare function resetConstructorMap(): void;
|
|
10
|
-
declare function getConstructorFromTag(tag: string): MaybeAbstractEntityConstructor<any>;
|
|
11
|
-
declare function getConstructorFromTaggedId(id: TaggedId): MaybeAbstractEntityConstructor<any>;
|
|
12
|
-
declare function getMetadataForTable(tableName: string): EntityMetadata;
|
|
13
|
-
declare function getMetadataForType(typeName: string): EntityMetadata;
|
|
8
|
+
export declare function configureMetadata(metas: EntityMetadata[]): void;
|
|
9
|
+
export declare function resetConstructorMap(): void;
|
|
10
|
+
export declare function getConstructorFromTag(tag: string): MaybeAbstractEntityConstructor<any>;
|
|
11
|
+
export declare function getConstructorFromTaggedId(id: TaggedId): MaybeAbstractEntityConstructor<any>;
|
|
12
|
+
export declare function getMetadataForTable(tableName: string): EntityMetadata;
|
|
13
|
+
export declare function getMetadataForType(typeName: string): EntityMetadata;
|
|
14
14
|
/** Returns metadata for `typeName`, if `configureMetadata` has populated the type map. */
|
|
15
|
-
declare function maybeGetMetadataForType<T extends Entity = Entity>(typeName: string): EntityMetadata<T> | undefined;
|
|
16
|
-
declare function maybeGetConstructorFromReference(value: string | Entity | Reference<any, any, any> | undefined): MaybeAbstractEntityConstructor<any> | undefined;
|
|
15
|
+
export declare function maybeGetMetadataForType<T extends Entity = Entity>(typeName: string): EntityMetadata<T> | undefined;
|
|
16
|
+
export declare function maybeGetConstructorFromReference(value: string | Entity | Reference<any, any, any> | undefined): MaybeAbstractEntityConstructor<any> | undefined;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { configureMetadata, getConstructorFromTag, getConstructorFromTaggedId, getMetadataForTable, getMetadataForType, maybeGetConstructorFromReference, maybeGetMetadataForType, resetConstructorMap };
|
|
19
18
|
//# sourceMappingURL=configure.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.cts","names":[],"sources":["../src/configure.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"configure.d.cts","names":[],"sources":["../src/configure.ts"],"mappings":";;;;;;;wBAgCgB,kBAAkB,OAAO;wBA4IzB;wBAKA,sBAAsB,cAAc;wBAIpC,2BAA2B,IAAI,WAAW;wBAI1C,oBAAoB,oBAAoB;wBAIxC,mBAAmB,mBAAmB;;wBAKtC,wBAAwB,UAAU,SAAS,QAAQ,mBAAmB,eAAe;wBAIrF,iCACd,gBAAgB,SAAS,uCACxB"}
|
package/build/configure.d.mts
CHANGED
|
@@ -5,15 +5,14 @@ import { MaybeAbstractEntityConstructor, TaggedId } from "./EntityManager.mjs";
|
|
|
5
5
|
import { Entity } from "./Entity.mjs";
|
|
6
6
|
//#region src/configure.d.ts
|
|
7
7
|
/** Performs our boot-time initialization, i.e. hooking up reactivity. */
|
|
8
|
-
declare function configureMetadata(metas: EntityMetadata[]): void;
|
|
9
|
-
declare function resetConstructorMap(): void;
|
|
10
|
-
declare function getConstructorFromTag(tag: string): MaybeAbstractEntityConstructor<any>;
|
|
11
|
-
declare function getConstructorFromTaggedId(id: TaggedId): MaybeAbstractEntityConstructor<any>;
|
|
12
|
-
declare function getMetadataForTable(tableName: string): EntityMetadata;
|
|
13
|
-
declare function getMetadataForType(typeName: string): EntityMetadata;
|
|
8
|
+
export declare function configureMetadata(metas: EntityMetadata[]): void;
|
|
9
|
+
export declare function resetConstructorMap(): void;
|
|
10
|
+
export declare function getConstructorFromTag(tag: string): MaybeAbstractEntityConstructor<any>;
|
|
11
|
+
export declare function getConstructorFromTaggedId(id: TaggedId): MaybeAbstractEntityConstructor<any>;
|
|
12
|
+
export declare function getMetadataForTable(tableName: string): EntityMetadata;
|
|
13
|
+
export declare function getMetadataForType(typeName: string): EntityMetadata;
|
|
14
14
|
/** Returns metadata for `typeName`, if `configureMetadata` has populated the type map. */
|
|
15
|
-
declare function maybeGetMetadataForType<T extends Entity = Entity>(typeName: string): EntityMetadata<T> | undefined;
|
|
16
|
-
declare function maybeGetConstructorFromReference(value: string | Entity | Reference<any, any, any> | undefined): MaybeAbstractEntityConstructor<any> | undefined;
|
|
15
|
+
export declare function maybeGetMetadataForType<T extends Entity = Entity>(typeName: string): EntityMetadata<T> | undefined;
|
|
16
|
+
export declare function maybeGetConstructorFromReference(value: string | Entity | Reference<any, any, any> | undefined): MaybeAbstractEntityConstructor<any> | undefined;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { configureMetadata, getConstructorFromTag, getConstructorFromTaggedId, getMetadataForTable, getMetadataForType, maybeGetConstructorFromReference, maybeGetMetadataForType, resetConstructorMap };
|
|
19
18
|
//# sourceMappingURL=configure.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.mts","names":[],"sources":["../src/configure.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"configure.d.mts","names":[],"sources":["../src/configure.ts"],"mappings":";;;;;;;wBAgCgB,kBAAkB,OAAO;wBA4IzB;wBAKA,sBAAsB,cAAc;wBAIpC,2BAA2B,IAAI,WAAW;wBAI1C,oBAAoB,oBAAoB;wBAIxC,mBAAmB,mBAAmB;;wBAKtC,wBAAwB,UAAU,SAAS,QAAQ,mBAAmB,eAAe;wBAIrF,iCACd,gBAAgB,SAAS,uCACxB"}
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* XXH128 at 1.031/1.078/1.348ms. So the stable serialization is the necessary work, and keeping it as the cache
|
|
13
13
|
* key avoids extra native-call/digest overhead and avoids introducing probabilistic hash collisions.
|
|
14
14
|
*/
|
|
15
|
-
declare function fastWhereFilterHash(value: unknown): string | undefined;
|
|
15
|
+
export declare function fastWhereFilterHash(value: unknown): string | undefined;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { fastWhereFilterHash };
|
|
18
17
|
//# sourceMappingURL=fastWhereFilterHash.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastWhereFilterHash.d.cts","names":[],"sources":["../../src/dataloaders/fastWhereFilterHash.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"fastWhereFilterHash.d.cts","names":[],"sources":["../../src/dataloaders/fastWhereFilterHash.ts"],"mappings":";;;;;;;;;;;;;;wBA0BgB,oBAAoB"}
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* XXH128 at 1.031/1.078/1.348ms. So the stable serialization is the necessary work, and keeping it as the cache
|
|
13
13
|
* key avoids extra native-call/digest overhead and avoids introducing probabilistic hash collisions.
|
|
14
14
|
*/
|
|
15
|
-
declare function fastWhereFilterHash(value: unknown): string | undefined;
|
|
15
|
+
export declare function fastWhereFilterHash(value: unknown): string | undefined;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { fastWhereFilterHash };
|
|
18
17
|
//# sourceMappingURL=fastWhereFilterHash.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastWhereFilterHash.d.mts","names":[],"sources":["../../src/dataloaders/fastWhereFilterHash.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"fastWhereFilterHash.d.mts","names":[],"sources":["../../src/dataloaders/fastWhereFilterHash.ts"],"mappings":";;;;;;;;;;;;;;wBA0BgB,oBAAoB"}
|
|
@@ -3,8 +3,7 @@ import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.
|
|
|
3
3
|
import { Entity } from "../Entity.cjs";
|
|
4
4
|
import DataLoader from "dataloader";
|
|
5
5
|
//#region src/dataloaders/findByUniqueDataLoader.d.ts
|
|
6
|
-
declare const findByUniqueOperation = "find-by-unique";
|
|
7
|
-
declare function findByUniqueDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, field: Field, softDeletes: "include" | "exclude"): DataLoader<any, unknown | undefined>;
|
|
6
|
+
export declare const findByUniqueOperation = "find-by-unique";
|
|
7
|
+
export declare function findByUniqueDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, field: Field, softDeletes: "include" | "exclude"): DataLoader<any, unknown | undefined>;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { findByUniqueDataLoader, findByUniqueOperation };
|
|
10
9
|
//# sourceMappingURL=findByUniqueDataLoader.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findByUniqueDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findByUniqueDataLoader.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"findByUniqueDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findByUniqueDataLoader.ts"],"mappings":";;;;;qBAUa;wBAEG,uBAAuB,UAAU,QAC/C,IAAI,eACJ,MAAM,+BAA+B,IACrC,OAAO,OACP,qCACC"}
|
|
@@ -3,8 +3,7 @@ import { EntityManager, MaybeAbstractEntityConstructor } from "../EntityManager.
|
|
|
3
3
|
import { Entity } from "../Entity.mjs";
|
|
4
4
|
import DataLoader from "dataloader";
|
|
5
5
|
//#region src/dataloaders/findByUniqueDataLoader.d.ts
|
|
6
|
-
declare const findByUniqueOperation = "find-by-unique";
|
|
7
|
-
declare function findByUniqueDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, field: Field, softDeletes: "include" | "exclude"): DataLoader<any, unknown | undefined>;
|
|
6
|
+
export declare const findByUniqueOperation = "find-by-unique";
|
|
7
|
+
export declare function findByUniqueDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, field: Field, softDeletes: "include" | "exclude"): DataLoader<any, unknown | undefined>;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { findByUniqueDataLoader, findByUniqueOperation };
|
|
10
9
|
//# sourceMappingURL=findByUniqueDataLoader.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findByUniqueDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/findByUniqueDataLoader.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"findByUniqueDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/findByUniqueDataLoader.ts"],"mappings":";;;;;qBAUa;wBAEG,uBAAuB,UAAU,QAC/C,IAAI,eACJ,MAAM,+BAA+B,IACrC,OAAO,OACP,qCACC"}
|
|
@@ -3,17 +3,16 @@ import { FilterAndSettings, FindFilter } from "../queries/find/EntityFilter.cjs"
|
|
|
3
3
|
import { EntityManager, FindCountFilterOptions, MaybeAbstractEntityConstructor } from "../EntityManager.cjs";
|
|
4
4
|
import { Entity } from "../Entity.cjs";
|
|
5
5
|
//#region src/dataloaders/findCountDataLoader.d.ts
|
|
6
|
-
declare const findCountOperation = "find-count";
|
|
7
|
-
declare function findCountDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>): Promise<number>;
|
|
6
|
+
export declare const findCountOperation = "find-count";
|
|
7
|
+
export declare function findCountDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>): Promise<number>;
|
|
8
8
|
/** Merges root-scope count/id settings with caller options, dropping pagination-only settings. */
|
|
9
|
-
declare function mergeCountOptions<T extends Entity>(where: FindFilter<T>, options: FindCountFilterOptions<T>): {
|
|
9
|
+
export declare function mergeCountOptions<T extends Entity>(where: FindFilter<T>, options: FindCountFilterOptions<T>): {
|
|
10
10
|
where: FindFilter<T>;
|
|
11
11
|
options: FindCountFilterOptions<T>;
|
|
12
12
|
};
|
|
13
|
-
declare function mergeCountOptions<T extends Entity>(where: FindFilter<T> | GraphQLFilterWithAlias<T>, options: FindCountFilterOptions<T>): {
|
|
13
|
+
export declare function mergeCountOptions<T extends Entity>(where: FindFilter<T> | GraphQLFilterWithAlias<T>, options: FindCountFilterOptions<T>): {
|
|
14
14
|
where: FindFilter<T> | GraphQLFilterWithAlias<T>;
|
|
15
15
|
options: FindCountFilterOptions<T>;
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
18
|
-
export { findCountDataLoader, findCountOperation, mergeCountOptions };
|
|
19
18
|
//# sourceMappingURL=findCountDataLoader.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findCountDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findCountDataLoader.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"findCountDataLoader.d.cts","names":[],"sources":["../../src/dataloaders/findCountDataLoader.ts"],"mappings":";;;;;qBAwBa;wBAEG,oBAAoB,UAAU,QAC5C,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,KACzB;;wBAmFa,kBAAkB,UAAU,QAC1C,OAAO,WAAW,IAClB,SAAS,uBAAuB;EAC7B,OAAO,WAAW;EAAI,SAAS,uBAAuB;;wBAC3C,kBAAkB,UAAU,QAC1C,OAAO,WAAW,KAAK,uBAAuB,IAC9C,SAAS,uBAAuB;EAC7B,OAAO,WAAW,KAAK,uBAAuB;EAAI,SAAS,uBAAuB"}
|
|
@@ -3,17 +3,16 @@ import { FilterAndSettings, FindFilter } from "../queries/find/EntityFilter.mjs"
|
|
|
3
3
|
import { EntityManager, FindCountFilterOptions, MaybeAbstractEntityConstructor } from "../EntityManager.mjs";
|
|
4
4
|
import { Entity } from "../Entity.mjs";
|
|
5
5
|
//#region src/dataloaders/findCountDataLoader.d.ts
|
|
6
|
-
declare const findCountOperation = "find-count";
|
|
7
|
-
declare function findCountDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>): Promise<number>;
|
|
6
|
+
export declare const findCountOperation = "find-count";
|
|
7
|
+
export declare function findCountDataLoader<T extends Entity>(em: EntityManager, type: MaybeAbstractEntityConstructor<T>, filter: FilterAndSettings<T>): Promise<number>;
|
|
8
8
|
/** Merges root-scope count/id settings with caller options, dropping pagination-only settings. */
|
|
9
|
-
declare function mergeCountOptions<T extends Entity>(where: FindFilter<T>, options: FindCountFilterOptions<T>): {
|
|
9
|
+
export declare function mergeCountOptions<T extends Entity>(where: FindFilter<T>, options: FindCountFilterOptions<T>): {
|
|
10
10
|
where: FindFilter<T>;
|
|
11
11
|
options: FindCountFilterOptions<T>;
|
|
12
12
|
};
|
|
13
|
-
declare function mergeCountOptions<T extends Entity>(where: FindFilter<T> | GraphQLFilterWithAlias<T>, options: FindCountFilterOptions<T>): {
|
|
13
|
+
export declare function mergeCountOptions<T extends Entity>(where: FindFilter<T> | GraphQLFilterWithAlias<T>, options: FindCountFilterOptions<T>): {
|
|
14
14
|
where: FindFilter<T> | GraphQLFilterWithAlias<T>;
|
|
15
15
|
options: FindCountFilterOptions<T>;
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
18
|
-
export { findCountDataLoader, findCountOperation, mergeCountOptions };
|
|
19
18
|
//# sourceMappingURL=findCountDataLoader.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findCountDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/findCountDataLoader.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"findCountDataLoader.d.mts","names":[],"sources":["../../src/dataloaders/findCountDataLoader.ts"],"mappings":";;;;;qBAwBa;wBAEG,oBAAoB,UAAU,QAC5C,IAAI,eACJ,MAAM,+BAA+B,IACrC,QAAQ,kBAAkB,KACzB;;wBAmFa,kBAAkB,UAAU,QAC1C,OAAO,WAAW,IAClB,SAAS,uBAAuB;EAC7B,OAAO,WAAW;EAAI,SAAS,uBAAuB;;wBAC3C,kBAAkB,UAAU,QAC1C,OAAO,WAAW,KAAK,uBAAuB,IAC9C,SAAS,uBAAuB;EAC7B,OAAO,WAAW,KAAK,uBAAuB;EAAI,SAAS,uBAAuB"}
|