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
|
@@ -8,7 +8,7 @@ import "../relations/index.cjs";
|
|
|
8
8
|
import { LoadHint, Loaded } from "./loadHints.cjs";
|
|
9
9
|
import { Entity } from "../Entity.cjs";
|
|
10
10
|
//#region src/loading/withLoaded.d.ts
|
|
11
|
-
type WithLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>> = { [K in keyof L as L[K] extends {
|
|
11
|
+
export type WithLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>> = { [K in keyof L as L[K] extends {
|
|
12
12
|
get: unknown;
|
|
13
13
|
} ? K : L[K] extends Relation<any, any> | Property<any, any> ? never : K]: L[K] extends PolymorphicReference<T, infer U, infer N> ? L[K] extends LoadedReference<T, U, N> ? U | N : L[K] : L[K] extends LoadedReference<T, infer U, never> ? U : L[K] extends LoadedReference<T, infer U, undefined> ? U | undefined : L[K] extends LoadedCollection<T, infer U> ? U[] : L[K] extends LoadedReadOnlyCollection<T, infer U> ? U[] : L[K] extends LoadedProperty<T, infer V> ? V : L[K]; };
|
|
14
14
|
/**
|
|
@@ -31,9 +31,9 @@ type WithLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>
|
|
|
31
31
|
* This is also why the function is not recursive, as returning nested proxies could result in
|
|
32
32
|
* them inadvertently being stored and passed to code that expects a real entity.
|
|
33
33
|
*/
|
|
34
|
-
declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(promise: Promise<L>): Promise<WithLoaded<T, H, L>>;
|
|
35
|
-
declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(loaded: L): WithLoaded<T, H, L>;
|
|
36
|
-
declare function ensureWithLoaded<T extends Entity, const H extends LoadHint<T>>(entity: T, hint: H): WithLoaded<T, H, Loaded<T, H>>;
|
|
34
|
+
export declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(promise: Promise<L>): Promise<WithLoaded<T, H, L>>;
|
|
35
|
+
export declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(loaded: L): WithLoaded<T, H, L>;
|
|
36
|
+
export declare function ensureWithLoaded<T extends Entity, const H extends LoadHint<T>>(entity: T, hint: H): WithLoaded<T, H, Loaded<T, H>>;
|
|
37
37
|
/**
|
|
38
38
|
* Allow stubbing of relations with dummy values.
|
|
39
39
|
*
|
|
@@ -53,7 +53,7 @@ declare function ensureWithLoaded<T extends Entity, const H extends LoadHint<T>>
|
|
|
53
53
|
* });
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
declare class StubbedRelation {
|
|
56
|
+
export declare class StubbedRelation {
|
|
57
57
|
private value;
|
|
58
58
|
constructor(value: any);
|
|
59
59
|
get get(): any;
|
|
@@ -61,5 +61,4 @@ declare class StubbedRelation {
|
|
|
61
61
|
load(): any;
|
|
62
62
|
}
|
|
63
63
|
//#endregion
|
|
64
|
-
export { StubbedRelation, WithLoaded, ensureWithLoaded, withLoaded };
|
|
65
64
|
//# sourceMappingURL=withLoaded.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLoaded.d.cts","names":[],"sources":["../../src/loading/withLoaded.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"withLoaded.d.cts","names":[],"sources":["../../src/loading/withLoaded.ts"],"mappings":";;;;;;;;;;YAwBY,WAAW,UAAU,QAAQ,UAAU,SAAS,IAAI,UAAU,OAAO,GAAG,SAEhF,WAAW,KAAK,EAAE;EAAa;IAAiB,IAAI,EAAE,WAAW,qBAAqB,6BAA6B,IAClH,EAAE,WAAW,qBAAqB,SAAS,SAAS,KACnD,EAAE,WAAW,gBAAgB,GAAG,GAAG,KACjC,IAAI,IACJ,EAAE,KACJ,EAAE,WAAW,gBAAgB,SAAS,YACpC,IACA,EAAE,WAAW,gBAAgB,SAAS,gBACpC,gBACA,EAAE,WAAW,iBAAiB,SAAS,KACrC,MACA,EAAE,WAAW,yBAAyB,SAAS,KAE7C,MACA,EAAE,WAAW,eAAe,SAAS,KACnC,IACA,EAAE;;;;;;;;;;;;;;;;;;;;;wBAuBF,WAAW,UAAU,QAAQ,UAAU,SAAS,IAAI,UAAU,OAAO,GAAG,IACtF,SAAS,QAAQ,KAChB,QAAQ,WAAW,GAAG,GAAG;wBACZ,WAAW,UAAU,QAAQ,UAAU,SAAS,IAAI,UAAU,OAAO,GAAG,IACtF,QAAQ,IACP,WAAW,GAAG,GAAG;wBAmCJ,iBAAiB,UAAU,cAAc,UAAU,SAAS,IAC1E,QAAQ,GACR,MAAM,IACL,WAAW,GAAG,GAAG,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;qBAwBjB;UACS;EAApB,YAAoB;MAEhB;MAIA;EAIJ"}
|
|
@@ -8,7 +8,7 @@ import "../relations/index.mjs";
|
|
|
8
8
|
import { LoadHint, Loaded } from "./loadHints.mjs";
|
|
9
9
|
import { Entity } from "../Entity.mjs";
|
|
10
10
|
//#region src/loading/withLoaded.d.ts
|
|
11
|
-
type WithLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>> = { [K in keyof L as L[K] extends {
|
|
11
|
+
export type WithLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>> = { [K in keyof L as L[K] extends {
|
|
12
12
|
get: unknown;
|
|
13
13
|
} ? K : L[K] extends Relation<any, any> | Property<any, any> ? never : K]: L[K] extends PolymorphicReference<T, infer U, infer N> ? L[K] extends LoadedReference<T, U, N> ? U | N : L[K] : L[K] extends LoadedReference<T, infer U, never> ? U : L[K] extends LoadedReference<T, infer U, undefined> ? U | undefined : L[K] extends LoadedCollection<T, infer U> ? U[] : L[K] extends LoadedReadOnlyCollection<T, infer U> ? U[] : L[K] extends LoadedProperty<T, infer V> ? V : L[K]; };
|
|
14
14
|
/**
|
|
@@ -31,9 +31,9 @@ type WithLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>
|
|
|
31
31
|
* This is also why the function is not recursive, as returning nested proxies could result in
|
|
32
32
|
* them inadvertently being stored and passed to code that expects a real entity.
|
|
33
33
|
*/
|
|
34
|
-
declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(promise: Promise<L>): Promise<WithLoaded<T, H, L>>;
|
|
35
|
-
declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(loaded: L): WithLoaded<T, H, L>;
|
|
36
|
-
declare function ensureWithLoaded<T extends Entity, const H extends LoadHint<T>>(entity: T, hint: H): WithLoaded<T, H, Loaded<T, H>>;
|
|
34
|
+
export declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(promise: Promise<L>): Promise<WithLoaded<T, H, L>>;
|
|
35
|
+
export declare function withLoaded<T extends Entity, H extends LoadHint<T>, L extends Loaded<T, H>>(loaded: L): WithLoaded<T, H, L>;
|
|
36
|
+
export declare function ensureWithLoaded<T extends Entity, const H extends LoadHint<T>>(entity: T, hint: H): WithLoaded<T, H, Loaded<T, H>>;
|
|
37
37
|
/**
|
|
38
38
|
* Allow stubbing of relations with dummy values.
|
|
39
39
|
*
|
|
@@ -53,7 +53,7 @@ declare function ensureWithLoaded<T extends Entity, const H extends LoadHint<T>>
|
|
|
53
53
|
* });
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
declare class StubbedRelation {
|
|
56
|
+
export declare class StubbedRelation {
|
|
57
57
|
private value;
|
|
58
58
|
constructor(value: any);
|
|
59
59
|
get get(): any;
|
|
@@ -61,5 +61,4 @@ declare class StubbedRelation {
|
|
|
61
61
|
load(): any;
|
|
62
62
|
}
|
|
63
63
|
//#endregion
|
|
64
|
-
export { StubbedRelation, WithLoaded, ensureWithLoaded, withLoaded };
|
|
65
64
|
//# sourceMappingURL=withLoaded.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLoaded.d.mts","names":[],"sources":["../../src/loading/withLoaded.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"withLoaded.d.mts","names":[],"sources":["../../src/loading/withLoaded.ts"],"mappings":";;;;;;;;;;YAwBY,WAAW,UAAU,QAAQ,UAAU,SAAS,IAAI,UAAU,OAAO,GAAG,SAEhF,WAAW,KAAK,EAAE;EAAa;IAAiB,IAAI,EAAE,WAAW,qBAAqB,6BAA6B,IAClH,EAAE,WAAW,qBAAqB,SAAS,SAAS,KACnD,EAAE,WAAW,gBAAgB,GAAG,GAAG,KACjC,IAAI,IACJ,EAAE,KACJ,EAAE,WAAW,gBAAgB,SAAS,YACpC,IACA,EAAE,WAAW,gBAAgB,SAAS,gBACpC,gBACA,EAAE,WAAW,iBAAiB,SAAS,KACrC,MACA,EAAE,WAAW,yBAAyB,SAAS,KAE7C,MACA,EAAE,WAAW,eAAe,SAAS,KACnC,IACA,EAAE;;;;;;;;;;;;;;;;;;;;;wBAuBF,WAAW,UAAU,QAAQ,UAAU,SAAS,IAAI,UAAU,OAAO,GAAG,IACtF,SAAS,QAAQ,KAChB,QAAQ,WAAW,GAAG,GAAG;wBACZ,WAAW,UAAU,QAAQ,UAAU,SAAS,IAAI,UAAU,OAAO,GAAG,IACtF,QAAQ,IACP,WAAW,GAAG,GAAG;wBAmCJ,iBAAiB,UAAU,cAAc,UAAU,SAAS,IAC1E,QAAQ,GACR,MAAM,IACL,WAAW,GAAG,GAAG,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;qBAwBjB;UACS;EAApB,YAAoB;MAEhB;MAIA;EAIJ"}
|
|
@@ -2,8 +2,8 @@ import { EntityMetadata } from "../EntityMetadata.cjs";
|
|
|
2
2
|
import { UseMapSource } from "../newTestInstance.cjs";
|
|
3
3
|
import { Entity } from "../Entity.cjs";
|
|
4
4
|
//#region src/logging/FactoryLogger.d.ts
|
|
5
|
-
type WriteFn = (line: string) => void;
|
|
6
|
-
declare class FactoryLogger {
|
|
5
|
+
export type WriteFn = (line: string) => void;
|
|
6
|
+
export declare class FactoryLogger {
|
|
7
7
|
private level;
|
|
8
8
|
private writeFn;
|
|
9
9
|
private skipNextLogCreating;
|
|
@@ -21,7 +21,6 @@ declare class FactoryLogger {
|
|
|
21
21
|
private write;
|
|
22
22
|
private prefix;
|
|
23
23
|
}
|
|
24
|
-
declare function setFactoryWriter(write: WriteFn | undefined): void;
|
|
24
|
+
export declare function setFactoryWriter(write: WriteFn | undefined): void;
|
|
25
25
|
//#endregion
|
|
26
|
-
export { FactoryLogger, WriteFn, setFactoryWriter };
|
|
27
26
|
//# sourceMappingURL=FactoryLogger.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryLogger.d.cts","names":[],"sources":["../../src/logging/FactoryLogger.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"FactoryLogger.d.cts","names":[],"sources":["../../src/logging/FactoryLogger.ts"],"mappings":";;;;YAOY,WAAW;qBAIV;UACH;UACA;UACA;EAIR;EAIA,YAAY;EASZ,eAAe,GAAG,QAAQ,QAAQ;EAQlC,WAAW,GAAG;EAKd,iBAAiB,GAAG;EAKpB,YAAY,mBAAmB,GAAG;EAIlC,uBAAuB,mBAAmB,MAAM;EAKhD,iBAAiB,mBAAmB,GAAG;EAIvC,qBAAqB,mBAAmB,GAAG;EAI3C;EAIA;UAIQ;UAIA;;wBAMM,iBAAiB,OAAO"}
|
|
@@ -2,8 +2,8 @@ import { EntityMetadata } from "../EntityMetadata.mjs";
|
|
|
2
2
|
import { UseMapSource } from "../newTestInstance.mjs";
|
|
3
3
|
import { Entity } from "../Entity.mjs";
|
|
4
4
|
//#region src/logging/FactoryLogger.d.ts
|
|
5
|
-
type WriteFn = (line: string) => void;
|
|
6
|
-
declare class FactoryLogger {
|
|
5
|
+
export type WriteFn = (line: string) => void;
|
|
6
|
+
export declare class FactoryLogger {
|
|
7
7
|
private level;
|
|
8
8
|
private writeFn;
|
|
9
9
|
private skipNextLogCreating;
|
|
@@ -21,7 +21,6 @@ declare class FactoryLogger {
|
|
|
21
21
|
private write;
|
|
22
22
|
private prefix;
|
|
23
23
|
}
|
|
24
|
-
declare function setFactoryWriter(write: WriteFn | undefined): void;
|
|
24
|
+
export declare function setFactoryWriter(write: WriteFn | undefined): void;
|
|
25
25
|
//#endregion
|
|
26
|
-
export { FactoryLogger, WriteFn, setFactoryWriter };
|
|
27
26
|
//# sourceMappingURL=FactoryLogger.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryLogger.d.mts","names":[],"sources":["../../src/logging/FactoryLogger.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"FactoryLogger.d.mts","names":[],"sources":["../../src/logging/FactoryLogger.ts"],"mappings":";;;;YAOY,WAAW;qBAIV;UACH;UACA;UACA;EAIR;EAIA,YAAY;EASZ,eAAe,GAAG,QAAQ,QAAQ;EAQlC,WAAW,GAAG;EAKd,iBAAiB,GAAG;EAKpB,YAAY,mBAAmB,GAAG;EAIlC,uBAAuB,mBAAmB,MAAM;EAKhD,iBAAiB,mBAAmB,GAAG;EAIvC,qBAAqB,mBAAmB,GAAG;EAI3C;EAIA;UAIQ;UAIA;;wBAMM,iBAAiB,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLogger.cjs","names":["
|
|
1
|
+
{"version":3,"file":"FieldLogger.cjs","names":["getFuzzyCallerName","isEntity"],"sources":["../../src/logging/FieldLogger.ts"],"sourcesContent":["import ansis from \"ansis\";\nimport { getFuzzyCallerName } from \"src/config.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\n\nconst { gray, green, yellow, blue, red } = ansis;\nexport type WriteFn = (line: string) => void;\n\nexport type FieldLoggerWatch = {\n /** The entity name, i.e. `Author` */\n entity: string;\n /** The fields, i.e. `[\"firstName\", \"lastName\"]`. */\n fieldNames?: string[];\n /** Whether to stop a debugger when the field is set. */\n breakpoint?: boolean;\n};\n\n/**\n * Logs the setting of fields on entities to a `writeFn`, which defaults to `process.stdout`.\n */\nexport class FieldLogger {\n readonly #writeFn: WriteFn;\n readonly #watching: FieldLoggerWatch[] = [];\n\n constructor(\n /** The fields to watch, defaults to all fields. */\n watching: FieldLoggerWatch[],\n /** An optional/semi-internal write function, mostly for testing. */\n writeFn?: WriteFn,\n ) {\n // We default to process.stdout.write to side-step around Jest's console.log instrumentation\n this.#writeFn = writeFn ?? ((line) => process.stdout.write(`${line}\\n`));\n this.#watching = watching ?? [];\n }\n\n logCreate(entity: Entity): void {\n const log = this.shouldLog(entity, \"constructor\");\n if (!log) return;\n this.log(green.bold(`${entity.toTaggedString()}`) + \" \" + yellow(`created`), gray(`at ${getFuzzyCallerName()}`));\n if (log === \"breakpoint\") debugger;\n }\n\n logSet(entity: Entity, fieldName: string, value: unknown): void {\n const log = this.shouldLog(entity, fieldName);\n if (!log) return;\n const color = this.getColor(value);\n this.log(\n green.bold(`${entity.toTaggedString()}`) + yellow(`.${fieldName}`),\n gray(`=`),\n color(`${value}`),\n // We don't know if we'll be called from getField or M2O.set+getField, i.e. how many stack frames to skip\n // to really get \"the caller's location\", so use `getFuzzyCallerName` instead of `getCallerName`.\n gray(`at ${getFuzzyCallerName()}`),\n );\n if (log === \"breakpoint\") debugger;\n }\n\n private log(...line: string[]): void {\n this.#writeFn(`${line.join(\" \")}`);\n }\n\n private shouldLog(entity: Entity, fieldName: string): boolean | \"breakpoint\" {\n if (this.#watching.length === 0) return true;\n for (const { entity: entityName, fieldNames, breakpoint } of this.#watching) {\n if (entity.constructor.name === entityName && (fieldNames === undefined || fieldNames.includes(fieldName))) {\n return breakpoint ? \"breakpoint\" : true;\n }\n }\n return false;\n }\n\n // Do some `typeof` -> color\n private getColor(value: unknown): typeof red {\n return typeof value === \"boolean\"\n ? red // boolean => red\n : isEntity(value)\n ? green // entity => green (matches other logging)\n : blue; // otherwise strings/dates/numbers are blue;\n }\n}\n\nclass NoopFieldLogger extends FieldLogger {\n constructor() {\n super([]);\n }\n\n logCreate(entity: Entity): void {}\n\n logSet(entity: Entity, fieldName: string, value: unknown): void {}\n}\n\n/** A shared no-op logger that avoids optional chaining in hot field access paths. */\nexport const noopFieldLogger: FieldLogger = new NoopFieldLogger();\n"],"mappings":";;;;;;;AAIA,MAAM,EAAE,MAAM,OAAO,QAAQ,MAAM,QAAQ,MAAA;;;;AAe3C,IAAa,cAAb,MAAyB;CACvB;CACA,YAAyC,CAAC;CAE1C,YAEE,UAEA,SACA;EAEA,KAAK,WAAW,aAAa,SAAS,QAAQ,OAAO,MAAM,GAAG,KAAK,GAAG;EACtE,KAAK,YAAY,YAAY,CAAC;CAChC;CAEA,UAAU,QAAsB;EAC9B,MAAM,MAAM,KAAK,UAAU,QAAQ,aAAa;EAChD,IAAI,CAAC,KAAK;EACV,KAAK,IAAI,MAAM,KAAK,GAAG,OAAO,eAAe,GAAG,IAAI,MAAM,OAAO,SAAS,GAAG,KAAK,MAAMA,eAAAA,mBAAmB,GAAG,CAAC;EAC/G,IAAI,QAAQ,cAAc;CAC5B;CAEA,OAAO,QAAgB,WAAmB,OAAsB;EAC9D,MAAM,MAAM,KAAK,UAAU,QAAQ,SAAS;EAC5C,IAAI,CAAC,KAAK;EACV,MAAM,QAAQ,KAAK,SAAS,KAAK;EACjC,KAAK,IACH,MAAM,KAAK,GAAG,OAAO,eAAe,GAAG,IAAI,OAAO,IAAI,WAAW,GACjE,KAAK,GAAG,GACR,MAAM,GAAG,OAAO,GAGhB,KAAK,MAAMA,eAAAA,mBAAmB,GAAG,CACnC;EACA,IAAI,QAAQ,cAAc;CAC5B;CAEA,IAAY,GAAG,MAAsB;EACnC,KAAK,SAAS,GAAG,KAAK,KAAK,GAAG,GAAG;CACnC;CAEA,UAAkB,QAAgB,WAA2C;EAC3E,IAAI,KAAK,UAAU,WAAW,GAAG,OAAO;EACxC,KAAK,MAAM,EAAE,QAAQ,YAAY,YAAY,gBAAgB,KAAK,WAChE,IAAI,OAAO,YAAY,SAAS,eAAe,eAAe,KAAA,KAAa,WAAW,SAAS,SAAS,IACtG,OAAO,aAAa,eAAe;EAGvC,OAAO;CACT;CAGA,SAAiB,OAA4B;EAC3C,OAAO,OAAO,UAAU,YACpB,MACAC,eAAAA,SAAS,KAAK,IACZ,QACA;CACR;AACF;AAEA,IAAM,kBAAN,cAA8B,YAAY;CACxC,cAAc;EACZ,MAAM,CAAC,CAAC;CACV;CAEA,UAAU,QAAsB,CAAC;CAEjC,OAAO,QAAgB,WAAmB,OAAsB,CAAC;AACnE;;AAGA,MAAa,kBAA+B,IAAI,gBAAgB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Entity } from "../Entity.cjs";
|
|
2
2
|
//#region src/logging/FieldLogger.d.ts
|
|
3
|
-
type WriteFn = (line: string) => void;
|
|
4
|
-
type FieldLoggerWatch = {
|
|
3
|
+
export type WriteFn = (line: string) => void;
|
|
4
|
+
export type FieldLoggerWatch = {
|
|
5
5
|
/** The entity name, i.e. `Author` */
|
|
6
6
|
entity: string;
|
|
7
7
|
/** The fields, i.e. `["firstName", "lastName"]`. */
|
|
@@ -12,7 +12,7 @@ type FieldLoggerWatch = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Logs the setting of fields on entities to a `writeFn`, which defaults to `process.stdout`.
|
|
14
14
|
*/
|
|
15
|
-
declare class FieldLogger {
|
|
15
|
+
export declare class FieldLogger {
|
|
16
16
|
#private;
|
|
17
17
|
constructor(
|
|
18
18
|
/** The fields to watch, defaults to all fields. */
|
|
@@ -26,7 +26,6 @@ declare class FieldLogger {
|
|
|
26
26
|
private getColor;
|
|
27
27
|
}
|
|
28
28
|
/** A shared no-op logger that avoids optional chaining in hot field access paths. */
|
|
29
|
-
declare const noopFieldLogger: FieldLogger;
|
|
29
|
+
export declare const noopFieldLogger: FieldLogger;
|
|
30
30
|
//#endregion
|
|
31
|
-
export { FieldLogger, FieldLoggerWatch, WriteFn, noopFieldLogger };
|
|
32
31
|
//# sourceMappingURL=FieldLogger.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLogger.d.cts","names":[],"sources":["../../src/logging/FieldLogger.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"FieldLogger.d.cts","names":[],"sources":["../../src/logging/FieldLogger.ts"],"mappings":";;YAKY,WAAW;YAEX;;EAEV;;EAEA;;EAEA;;;;;qBAMW;;EAIX;;EAEE,UAAU;;EAEV,UAAU;EAOZ,UAAU,QAAQ;EAOlB,OAAO,QAAQ,QAAQ,mBAAmB;UAelC;UAIA;UAWA;;;qBAoBG,iBAAiB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Entity } from "../Entity.mjs";
|
|
2
2
|
//#region src/logging/FieldLogger.d.ts
|
|
3
|
-
type WriteFn = (line: string) => void;
|
|
4
|
-
type FieldLoggerWatch = {
|
|
3
|
+
export type WriteFn = (line: string) => void;
|
|
4
|
+
export type FieldLoggerWatch = {
|
|
5
5
|
/** The entity name, i.e. `Author` */
|
|
6
6
|
entity: string;
|
|
7
7
|
/** The fields, i.e. `["firstName", "lastName"]`. */
|
|
@@ -12,7 +12,7 @@ type FieldLoggerWatch = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Logs the setting of fields on entities to a `writeFn`, which defaults to `process.stdout`.
|
|
14
14
|
*/
|
|
15
|
-
declare class FieldLogger {
|
|
15
|
+
export declare class FieldLogger {
|
|
16
16
|
#private;
|
|
17
17
|
constructor(
|
|
18
18
|
/** The fields to watch, defaults to all fields. */
|
|
@@ -26,7 +26,6 @@ declare class FieldLogger {
|
|
|
26
26
|
private getColor;
|
|
27
27
|
}
|
|
28
28
|
/** A shared no-op logger that avoids optional chaining in hot field access paths. */
|
|
29
|
-
declare const noopFieldLogger: FieldLogger;
|
|
29
|
+
export declare const noopFieldLogger: FieldLogger;
|
|
30
30
|
//#endregion
|
|
31
|
-
export { FieldLogger, FieldLoggerWatch, WriteFn, noopFieldLogger };
|
|
32
31
|
//# sourceMappingURL=FieldLogger.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLogger.d.mts","names":[],"sources":["../../src/logging/FieldLogger.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"FieldLogger.d.mts","names":[],"sources":["../../src/logging/FieldLogger.ts"],"mappings":";;YAKY,WAAW;YAEX;;EAEV;;EAEA;;EAEA;;;;;qBAMW;;EAIX;;EAEE,UAAU;;EAEV,UAAU;EAOZ,UAAU,QAAQ;EAOlB,OAAO,QAAQ,QAAQ,mBAAmB;UAelC;UAIA;UAWA;;;qBAoBG,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLogger.js","names":[
|
|
1
|
+
{"version":3,"file":"FieldLogger.js","names":[],"sources":["../../src/logging/FieldLogger.ts"],"sourcesContent":["import ansis from \"ansis\";\nimport { getFuzzyCallerName } from \"src/config.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\n\nconst { gray, green, yellow, blue, red } = ansis;\nexport type WriteFn = (line: string) => void;\n\nexport type FieldLoggerWatch = {\n /** The entity name, i.e. `Author` */\n entity: string;\n /** The fields, i.e. `[\"firstName\", \"lastName\"]`. */\n fieldNames?: string[];\n /** Whether to stop a debugger when the field is set. */\n breakpoint?: boolean;\n};\n\n/**\n * Logs the setting of fields on entities to a `writeFn`, which defaults to `process.stdout`.\n */\nexport class FieldLogger {\n readonly #writeFn: WriteFn;\n readonly #watching: FieldLoggerWatch[] = [];\n\n constructor(\n /** The fields to watch, defaults to all fields. */\n watching: FieldLoggerWatch[],\n /** An optional/semi-internal write function, mostly for testing. */\n writeFn?: WriteFn,\n ) {\n // We default to process.stdout.write to side-step around Jest's console.log instrumentation\n this.#writeFn = writeFn ?? ((line) => process.stdout.write(`${line}\\n`));\n this.#watching = watching ?? [];\n }\n\n logCreate(entity: Entity): void {\n const log = this.shouldLog(entity, \"constructor\");\n if (!log) return;\n this.log(green.bold(`${entity.toTaggedString()}`) + \" \" + yellow(`created`), gray(`at ${getFuzzyCallerName()}`));\n if (log === \"breakpoint\") debugger;\n }\n\n logSet(entity: Entity, fieldName: string, value: unknown): void {\n const log = this.shouldLog(entity, fieldName);\n if (!log) return;\n const color = this.getColor(value);\n this.log(\n green.bold(`${entity.toTaggedString()}`) + yellow(`.${fieldName}`),\n gray(`=`),\n color(`${value}`),\n // We don't know if we'll be called from getField or M2O.set+getField, i.e. how many stack frames to skip\n // to really get \"the caller's location\", so use `getFuzzyCallerName` instead of `getCallerName`.\n gray(`at ${getFuzzyCallerName()}`),\n );\n if (log === \"breakpoint\") debugger;\n }\n\n private log(...line: string[]): void {\n this.#writeFn(`${line.join(\" \")}`);\n }\n\n private shouldLog(entity: Entity, fieldName: string): boolean | \"breakpoint\" {\n if (this.#watching.length === 0) return true;\n for (const { entity: entityName, fieldNames, breakpoint } of this.#watching) {\n if (entity.constructor.name === entityName && (fieldNames === undefined || fieldNames.includes(fieldName))) {\n return breakpoint ? \"breakpoint\" : true;\n }\n }\n return false;\n }\n\n // Do some `typeof` -> color\n private getColor(value: unknown): typeof red {\n return typeof value === \"boolean\"\n ? red // boolean => red\n : isEntity(value)\n ? green // entity => green (matches other logging)\n : blue; // otherwise strings/dates/numbers are blue;\n }\n}\n\nclass NoopFieldLogger extends FieldLogger {\n constructor() {\n super([]);\n }\n\n logCreate(entity: Entity): void {}\n\n logSet(entity: Entity, fieldName: string, value: unknown): void {}\n}\n\n/** A shared no-op logger that avoids optional chaining in hot field access paths. */\nexport const noopFieldLogger: FieldLogger = new NoopFieldLogger();\n"],"mappings":";;;;AAIA,MAAM,EAAE,MAAM,OAAO,QAAQ,MAAM,QAAQ;;;;AAe3C,IAAa,cAAb,MAAyB;CACvB;CACA,YAAyC,CAAC;CAE1C,YAEE,UAEA,SACA;EAEA,KAAK,WAAW,aAAa,SAAS,QAAQ,OAAO,MAAM,GAAG,KAAK,GAAG;EACtE,KAAK,YAAY,YAAY,CAAC;CAChC;CAEA,UAAU,QAAsB;EAC9B,MAAM,MAAM,KAAK,UAAU,QAAQ,aAAa;EAChD,IAAI,CAAC,KAAK;EACV,KAAK,IAAI,MAAM,KAAK,GAAG,OAAO,eAAe,GAAG,IAAI,MAAM,OAAO,SAAS,GAAG,KAAK,MAAM,mBAAmB,GAAG,CAAC;EAC/G,IAAI,QAAQ,cAAc;CAC5B;CAEA,OAAO,QAAgB,WAAmB,OAAsB;EAC9D,MAAM,MAAM,KAAK,UAAU,QAAQ,SAAS;EAC5C,IAAI,CAAC,KAAK;EACV,MAAM,QAAQ,KAAK,SAAS,KAAK;EACjC,KAAK,IACH,MAAM,KAAK,GAAG,OAAO,eAAe,GAAG,IAAI,OAAO,IAAI,WAAW,GACjE,KAAK,GAAG,GACR,MAAM,GAAG,OAAO,GAGhB,KAAK,MAAM,mBAAmB,GAAG,CACnC;EACA,IAAI,QAAQ,cAAc;CAC5B;CAEA,IAAY,GAAG,MAAsB;EACnC,KAAK,SAAS,GAAG,KAAK,KAAK,GAAG,GAAG;CACnC;CAEA,UAAkB,QAAgB,WAA2C;EAC3E,IAAI,KAAK,UAAU,WAAW,GAAG,OAAO;EACxC,KAAK,MAAM,EAAE,QAAQ,YAAY,YAAY,gBAAgB,KAAK,WAChE,IAAI,OAAO,YAAY,SAAS,eAAe,eAAe,KAAA,KAAa,WAAW,SAAS,SAAS,IACtG,OAAO,aAAa,eAAe;EAGvC,OAAO;CACT;CAGA,SAAiB,OAA4B;EAC3C,OAAO,OAAO,UAAU,YACpB,MACA,SAAS,KAAK,IACZ,QACA;CACR;AACF;AAEA,IAAM,kBAAN,cAA8B,YAAY;CACxC,cAAc;EACZ,MAAM,CAAC,CAAC;CACV;CAEA,UAAU,QAAsB,CAAC;CAEjC,OAAO,QAAgB,WAAmB,OAAsB,CAAC;AACnE;;AAGA,MAAa,kBAA+B,IAAI,gBAAgB"}
|
|
@@ -4,14 +4,14 @@ import { Reactable, ReactiveRule } from "../config.cjs";
|
|
|
4
4
|
import { EntityManager } from "../EntityManager.cjs";
|
|
5
5
|
import { Entity } from "../Entity.cjs";
|
|
6
6
|
//#region src/logging/ReactionLogger.d.ts
|
|
7
|
-
declare let globalLogger: ReactionLogger | undefined;
|
|
7
|
+
export declare let globalLogger: ReactionLogger | undefined;
|
|
8
8
|
type WriteFn = (line: string) => void;
|
|
9
|
-
type ReactionWalk = {
|
|
9
|
+
export type ReactionWalk = {
|
|
10
10
|
todo: Entity[];
|
|
11
11
|
r: Reactable | ReactiveRule;
|
|
12
12
|
entities: Entity[];
|
|
13
13
|
};
|
|
14
|
-
declare class ReactionLogger {
|
|
14
|
+
export declare class ReactionLogger {
|
|
15
15
|
private writeFn;
|
|
16
16
|
constructor(writeFn?: WriteFn);
|
|
17
17
|
now(): number;
|
|
@@ -28,10 +28,10 @@ declare class ReactionLogger {
|
|
|
28
28
|
private entityCount;
|
|
29
29
|
private log;
|
|
30
30
|
}
|
|
31
|
-
declare function setReactionLogging(enabled: boolean): void;
|
|
32
|
-
declare function setReactionLogging(logger: ReactionLogger): void;
|
|
31
|
+
export declare function setReactionLogging(enabled: boolean): void;
|
|
32
|
+
export declare function setReactionLogging(logger: ReactionLogger): void;
|
|
33
33
|
/** A shared no-op logger that avoids optional chaining in hot reaction paths. */
|
|
34
|
-
declare const noopReactionLogger: ReactionLogger;
|
|
34
|
+
export declare const noopReactionLogger: ReactionLogger;
|
|
35
35
|
//#endregion
|
|
36
|
-
export {
|
|
36
|
+
export {};
|
|
37
37
|
//# sourceMappingURL=ReactionLogger.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionLogger.d.cts","names":[],"sources":["../../src/logging/ReactionLogger.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ReactionLogger.d.cts","names":[],"sources":["../../src/logging/ReactionLogger.ts"],"mappings":";;;;;;mBAUW,cAAc;KACpB,WAAW;YACJ;EACV,MAAM;EACN,GAAG,YAAY;EACf,UAAU;;qBAGC;UACH;EAGR,YAAY,UAAS;EAIrB;EAIA,UAAU,QAAQ,QAAQ,mBAAmB,GAAG;EAQhD,aAAa,QAAQ,QAAQ,gBAAgB,GAAG;EAQhD,kBAAkB,IAAI,eAAe;EAOrC,oBAAoB,IAAI,eAAe,OAAO,eAAe;;EAS7D,SAAS,iBAAiB,6BAA6B;;EA4BvD,gBAAgB,IAAI,eAAe,SAAS;;EAgB5C,cAAc,IAAI,eAAe;UAIzB;UAIA;;wBAKM,mBAAmB;wBACnB,mBAAmB,QAAQ;;qBA8B9B,oBAAoB"}
|
|
@@ -4,14 +4,14 @@ import { Reactable, ReactiveRule } from "../config.mjs";
|
|
|
4
4
|
import { EntityManager } from "../EntityManager.mjs";
|
|
5
5
|
import { Entity } from "../Entity.mjs";
|
|
6
6
|
//#region src/logging/ReactionLogger.d.ts
|
|
7
|
-
declare let globalLogger: ReactionLogger | undefined;
|
|
7
|
+
export declare let globalLogger: ReactionLogger | undefined;
|
|
8
8
|
type WriteFn = (line: string) => void;
|
|
9
|
-
type ReactionWalk = {
|
|
9
|
+
export type ReactionWalk = {
|
|
10
10
|
todo: Entity[];
|
|
11
11
|
r: Reactable | ReactiveRule;
|
|
12
12
|
entities: Entity[];
|
|
13
13
|
};
|
|
14
|
-
declare class ReactionLogger {
|
|
14
|
+
export declare class ReactionLogger {
|
|
15
15
|
private writeFn;
|
|
16
16
|
constructor(writeFn?: WriteFn);
|
|
17
17
|
now(): number;
|
|
@@ -28,10 +28,10 @@ declare class ReactionLogger {
|
|
|
28
28
|
private entityCount;
|
|
29
29
|
private log;
|
|
30
30
|
}
|
|
31
|
-
declare function setReactionLogging(enabled: boolean): void;
|
|
32
|
-
declare function setReactionLogging(logger: ReactionLogger): void;
|
|
31
|
+
export declare function setReactionLogging(enabled: boolean): void;
|
|
32
|
+
export declare function setReactionLogging(logger: ReactionLogger): void;
|
|
33
33
|
/** A shared no-op logger that avoids optional chaining in hot reaction paths. */
|
|
34
|
-
declare const noopReactionLogger: ReactionLogger;
|
|
34
|
+
export declare const noopReactionLogger: ReactionLogger;
|
|
35
35
|
//#endregion
|
|
36
|
-
export {
|
|
36
|
+
export {};
|
|
37
37
|
//# sourceMappingURL=ReactionLogger.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionLogger.d.mts","names":[],"sources":["../../src/logging/ReactionLogger.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ReactionLogger.d.mts","names":[],"sources":["../../src/logging/ReactionLogger.ts"],"mappings":";;;;;;mBAUW,cAAc;KACpB,WAAW;YACJ;EACV,MAAM;EACN,GAAG,YAAY;EACf,UAAU;;qBAGC;UACH;EAGR,YAAY,UAAS;EAIrB;EAIA,UAAU,QAAQ,QAAQ,mBAAmB,GAAG;EAQhD,aAAa,QAAQ,QAAQ,gBAAgB,GAAG;EAQhD,kBAAkB,IAAI,eAAe;EAOrC,oBAAoB,IAAI,eAAe,OAAO,eAAe;;EAS7D,SAAS,iBAAiB,6BAA6B;;EA4BvD,gBAAgB,IAAI,eAAe,SAAS;;EAgB5C,cAAc,IAAI,eAAe;UAIzB;UAIA;;wBAKM,mBAAmB;wBACnB,mBAAmB,QAAQ;;qBA8B9B,oBAAoB"}
|
package/build/newEntity.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newEntity.cjs","names":["getMetadata","getLazyFields","hasAnyKey","fail"
|
|
1
|
+
{"version":3,"file":"newEntity.cjs","names":["getMetadata","getLazyFields","hasAnyKey","fail"],"sources":["../src/newEntity.ts"],"sourcesContent":["import { baseEntityCstr } from \"src/BaseEntity.ts\";\nimport { type Entity } from \"src/Entity.ts\";\nimport { type EntityConstructor, type EntityManager } from \"src/EntityManager.ts\";\nimport { type EntityMetadata, getMetadata } from \"src/EntityMetadata.ts\";\nimport { getLazyFields } from \"src/getProperties.ts\";\nimport { fail, hasAnyKey } from \"src/utils.ts\";\n\n// Marks a constructor like Author has having had our relation getters installed\nconst lazySymbol = Symbol(\"lazy\");\n\n/**\n * Constructs an instance of `cstr` but with relations all made lazy.\n *\n * Specifically we avoid going through `new` b/c that invokes the `constructor` which instantiates\n * the instance-level class fields/relations like `books = hasMany`.\n *\n * Instead, we just call `Object.create`, which does not make any constructor/super calls, and instead\n * let any `this.books` accesses resolve to the getters we've installed on the prototype.\n */\nexport function newEntity<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>, isNew: boolean): T {\n if (!Object.hasOwn(cstr, lazySymbol)) {\n moveRelationsToGetters(cstr);\n (cstr as any)[lazySymbol] = true;\n }\n const meta = getMetadata(cstr);\n if (meta.ctiAbstract) fail(`Cannot create an instance of abstract entity ${meta.type}`);\n // This side-steps the `Author` constructor that initializes fields instance-level fields, which instead\n // we've shoved up to be getters on the prototype, and the only instance field we expect to have is `__data`,\n // which is set by the `baseEntityCstr` call.\n const entity = Object.create(cstr.prototype) as T;\n baseEntityCstr(em, entity as any, isNew);\n return entity;\n}\n\nfunction moveRelationsToGetters(cstr: EntityConstructor<any>): void {\n let transientFieldsValue: any = {};\n for (const [fieldName, value] of getLazyFields(getMetadata(cstr))) {\n if (value instanceof LazyRelation) {\n Object.defineProperty(cstr.prototype, fieldName, {\n get(this: any) {\n return ((this.__data.relations ??= {})[fieldName] ??= value.create(this, fieldName));\n },\n });\n } else if (fieldName === \"transientFields\") {\n // We'll define transientFields for all entities outside the loop\n transientFieldsValue = value;\n }\n }\n // Most entities have no transientFields, so skip the structuredClone for the empty default\n const needsClone = hasAnyKey(transientFieldsValue);\n Object.defineProperty(cstr.prototype, \"transientFields\", {\n get(this: any) {\n // This prototype-level `get` will only ever be called once per instance, b/c when we're\n // called for the first/only time, we set an instance-level `this.transientFields` that, for\n // all future calls, will resolve to the instance's own copy of the fields.\n //\n // This has the pleasant upshot of making the instance-level `transientFields` lazy, and\n // they will not be created on an instance until they're actually asked for.\n const copy = needsClone ? structuredClone(transientFieldsValue) : {};\n Object.defineProperty(this, \"transientFields\", { value: copy });\n return copy;\n },\n });\n}\n\n/**\n * A function for `has...` methods to integrate with the `newEntity` lazy field system.\n *\n * We need TypeScript to still see `books = hasMany(...)` as being typed as `Many<Book>`,\n * so this method's return type is `R` i.e. the `Many<Book>` relation type.\n *\n * But at runtime we actually want this to be a `LazyRelation` that can be rewritten\n * into a getter, and only invoked when the relation is actually accessed.\n */\nexport function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: string) => R): R {\n return new LazyRelation(fn) as R;\n}\n\n/**\n * Easily resolves `otherMetadata` fields for lazy relations.\n *\n * When `lazyRelation`s are initialized for their first/only time, i.e. the `books = hasBooks(authorMetadata)`\n * call that `getFakeInstance` does, it's when the class bodies are still being evaled, which is before the\n * `metadata.ts` file has run.\n *\n * This means that any `authorMetadata` consts would still be undefined.\n *\n * So instead we just do not bother passing metadata consts to `has...` methods, and instead let the methods\n * one-time resolve `otherMetadata` on their first invocation, which will be after the `metadata.ts` file has\n * finished importing, and the consts are all defined.\n */\nexport function resolveOtherMeta(entity: Entity, fieldName: string): EntityMetadata {\n const meta = getMetadata(entity);\n const field: any = meta.allFields[fieldName] ?? fail(`Could not find field ${meta.type}.${fieldName}`);\n return field.otherMetadata();\n}\n\n/** Wraps `has...` relation constructors in an easily-identifiable container. */\nexport class LazyRelation<T extends Entity> {\n #fn: (entity: T, fieldName: string) => any;\n constructor(fn: (entity: T, fieldName: string) => any) {\n this.#fn = fn;\n }\n\n /** Called by our getters to lazily create the relation on first access. */\n create(entity: T, fieldName: string) {\n return this.#fn(entity, fieldName);\n }\n}\n"],"mappings":";;;;;;;;AAQA,MAAM,aAAa,OAAO,MAAM;;;;;;;;;;AAWhC,SAAgB,UAA4B,IAAmB,MAA4B,OAAmB;CAC5G,IAAI,CAAC,OAAO,OAAO,MAAM,UAAU,GAAG;EACpC,uBAAuB,IAAI;EAC3B,KAAc,cAAc;CAC9B;CACA,MAAM,OAAOA,uBAAAA,YAAY,IAAI;CAC7B,IAAI,KAAK,aAAa,cAAA,KAAK,gDAAgD,KAAK,MAAM;CAItF,MAAM,SAAS,OAAO,OAAO,KAAK,SAAS;CAC3C,mBAAA,eAAe,IAAI,QAAe,KAAK;CACvC,OAAO;AACT;AAEA,SAAS,uBAAuB,MAAoC;CAClE,IAAI,uBAA4B,CAAC;CACjC,KAAK,MAAM,CAAC,WAAW,UAAUC,sBAAAA,cAAcD,uBAAAA,YAAY,IAAI,CAAC,GAC9D,IAAI,iBAAiB,cACnB,OAAO,eAAe,KAAK,WAAW,WAAW,EAC/C,MAAe;EACb,OAAQ,CAAC,KAAK,OAAO,cAAc,CAAC,EAAA,CAAG,eAAe,MAAM,OAAO,MAAM,SAAS;CACpF,EACF,CAAC;MACI,IAAI,cAAc,mBAEvB,uBAAuB;CAI3B,MAAM,aAAaE,cAAAA,UAAU,oBAAoB;CACjD,OAAO,eAAe,KAAK,WAAW,mBAAmB,EACvD,MAAe;EAOb,MAAM,OAAO,aAAa,gBAAgB,oBAAoB,IAAI,CAAC;EACnE,OAAO,eAAe,MAAM,mBAAmB,EAAE,OAAO,KAAK,CAAC;EAC9D,OAAO;CACT,EACF,CAAC;AACH;;;;;;;;;;AAWA,SAAgB,UAA+B,IAA4C;CACzF,OAAO,IAAI,aAAa,EAAE;AAC5B;;;;;;;;;;;;;;AAeA,SAAgB,iBAAiB,QAAgB,WAAmC;CAClF,MAAM,OAAOF,uBAAAA,YAAY,MAAM;CAE/B,QADmB,KAAK,UAAU,cAAcG,cAAAA,KAAK,wBAAwB,KAAK,KAAK,GAAG,WAAW,EAAA,CACxF,cAAc;AAC7B;;AAGA,IAAa,eAAb,MAA4C;CAC1C;CACA,YAAY,IAA2C;EACrD,KAAK,MAAM;CACb;;CAGA,OAAO,QAAW,WAAmB;EACnC,OAAO,KAAK,IAAI,QAAQ,SAAS;CACnC;AACF"}
|
package/build/newEntity.d.cts
CHANGED
|
@@ -11,7 +11,7 @@ import { Entity } from "./Entity.cjs";
|
|
|
11
11
|
* Instead, we just call `Object.create`, which does not make any constructor/super calls, and instead
|
|
12
12
|
* let any `this.books` accesses resolve to the getters we've installed on the prototype.
|
|
13
13
|
*/
|
|
14
|
-
declare function newEntity<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>, isNew: boolean): T;
|
|
14
|
+
export declare function newEntity<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>, isNew: boolean): T;
|
|
15
15
|
/**
|
|
16
16
|
* A function for `has...` methods to integrate with the `newEntity` lazy field system.
|
|
17
17
|
*
|
|
@@ -21,7 +21,7 @@ declare function newEntity<T extends Entity>(em: EntityManager, cstr: EntityCons
|
|
|
21
21
|
* But at runtime we actually want this to be a `LazyRelation` that can be rewritten
|
|
22
22
|
* into a getter, and only invoked when the relation is actually accessed.
|
|
23
23
|
*/
|
|
24
|
-
declare function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: string) => R): R;
|
|
24
|
+
export declare function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: string) => R): R;
|
|
25
25
|
/**
|
|
26
26
|
* Easily resolves `otherMetadata` fields for lazy relations.
|
|
27
27
|
*
|
|
@@ -35,14 +35,13 @@ declare function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: strin
|
|
|
35
35
|
* one-time resolve `otherMetadata` on their first invocation, which will be after the `metadata.ts` file has
|
|
36
36
|
* finished importing, and the consts are all defined.
|
|
37
37
|
*/
|
|
38
|
-
declare function resolveOtherMeta(entity: Entity, fieldName: string): EntityMetadata;
|
|
38
|
+
export declare function resolveOtherMeta(entity: Entity, fieldName: string): EntityMetadata;
|
|
39
39
|
/** Wraps `has...` relation constructors in an easily-identifiable container. */
|
|
40
|
-
declare class LazyRelation<T extends Entity> {
|
|
40
|
+
export declare class LazyRelation<T extends Entity> {
|
|
41
41
|
#private;
|
|
42
42
|
constructor(fn: (entity: T, fieldName: string) => any);
|
|
43
43
|
/** Called by our getters to lazily create the relation on first access. */
|
|
44
44
|
create(entity: T, fieldName: string): any;
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
-
export { LazyRelation, lazyField, newEntity, resolveOtherMeta };
|
|
48
47
|
//# sourceMappingURL=newEntity.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newEntity.d.cts","names":[],"sources":["../src/newEntity.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"newEntity.d.cts","names":[],"sources":["../src/newEntity.ts"],"mappings":";;;;;;;;;;;;;wBAmBgB,UAAU,UAAU,QAAQ,IAAI,eAAe,MAAM,kBAAkB,IAAI,iBAAiB;;;;;;;;;;wBAuD5F,UAAU,UAAU,QAAQ,GAAG,KAAK,QAAQ,GAAG,sBAAsB,IAAI;;;;;;;;;;;;;;wBAiBzE,iBAAiB,QAAQ,QAAQ,oBAAoB;;qBAOxD,aAAa,UAAU;;EAElC,YAAY,KAAK,QAAQ,GAAG;;EAK5B,OAAO,QAAQ,GAAG"}
|
package/build/newEntity.d.mts
CHANGED
|
@@ -11,7 +11,7 @@ import { Entity } from "./Entity.mjs";
|
|
|
11
11
|
* Instead, we just call `Object.create`, which does not make any constructor/super calls, and instead
|
|
12
12
|
* let any `this.books` accesses resolve to the getters we've installed on the prototype.
|
|
13
13
|
*/
|
|
14
|
-
declare function newEntity<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>, isNew: boolean): T;
|
|
14
|
+
export declare function newEntity<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>, isNew: boolean): T;
|
|
15
15
|
/**
|
|
16
16
|
* A function for `has...` methods to integrate with the `newEntity` lazy field system.
|
|
17
17
|
*
|
|
@@ -21,7 +21,7 @@ declare function newEntity<T extends Entity>(em: EntityManager, cstr: EntityCons
|
|
|
21
21
|
* But at runtime we actually want this to be a `LazyRelation` that can be rewritten
|
|
22
22
|
* into a getter, and only invoked when the relation is actually accessed.
|
|
23
23
|
*/
|
|
24
|
-
declare function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: string) => R): R;
|
|
24
|
+
export declare function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: string) => R): R;
|
|
25
25
|
/**
|
|
26
26
|
* Easily resolves `otherMetadata` fields for lazy relations.
|
|
27
27
|
*
|
|
@@ -35,14 +35,13 @@ declare function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: strin
|
|
|
35
35
|
* one-time resolve `otherMetadata` on their first invocation, which will be after the `metadata.ts` file has
|
|
36
36
|
* finished importing, and the consts are all defined.
|
|
37
37
|
*/
|
|
38
|
-
declare function resolveOtherMeta(entity: Entity, fieldName: string): EntityMetadata;
|
|
38
|
+
export declare function resolveOtherMeta(entity: Entity, fieldName: string): EntityMetadata;
|
|
39
39
|
/** Wraps `has...` relation constructors in an easily-identifiable container. */
|
|
40
|
-
declare class LazyRelation<T extends Entity> {
|
|
40
|
+
export declare class LazyRelation<T extends Entity> {
|
|
41
41
|
#private;
|
|
42
42
|
constructor(fn: (entity: T, fieldName: string) => any);
|
|
43
43
|
/** Called by our getters to lazily create the relation on first access. */
|
|
44
44
|
create(entity: T, fieldName: string): any;
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
-
export { LazyRelation, lazyField, newEntity, resolveOtherMeta };
|
|
48
47
|
//# sourceMappingURL=newEntity.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newEntity.d.mts","names":[],"sources":["../src/newEntity.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"newEntity.d.mts","names":[],"sources":["../src/newEntity.ts"],"mappings":";;;;;;;;;;;;;wBAmBgB,UAAU,UAAU,QAAQ,IAAI,eAAe,MAAM,kBAAkB,IAAI,iBAAiB;;;;;;;;;;wBAuD5F,UAAU,UAAU,QAAQ,GAAG,KAAK,QAAQ,GAAG,sBAAsB,IAAI;;;;;;;;;;;;;;wBAiBzE,iBAAiB,QAAQ,QAAQ,oBAAoB;;qBAOxD,aAAa,UAAU;;EAElC,YAAY,KAAK,QAAQ,GAAG;;EAK5B,OAAO,QAAQ,GAAG"}
|
package/build/newEntity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newEntity.js","names":[
|
|
1
|
+
{"version":3,"file":"newEntity.js","names":[],"sources":["../src/newEntity.ts"],"sourcesContent":["import { baseEntityCstr } from \"src/BaseEntity.ts\";\nimport { type Entity } from \"src/Entity.ts\";\nimport { type EntityConstructor, type EntityManager } from \"src/EntityManager.ts\";\nimport { type EntityMetadata, getMetadata } from \"src/EntityMetadata.ts\";\nimport { getLazyFields } from \"src/getProperties.ts\";\nimport { fail, hasAnyKey } from \"src/utils.ts\";\n\n// Marks a constructor like Author has having had our relation getters installed\nconst lazySymbol = Symbol(\"lazy\");\n\n/**\n * Constructs an instance of `cstr` but with relations all made lazy.\n *\n * Specifically we avoid going through `new` b/c that invokes the `constructor` which instantiates\n * the instance-level class fields/relations like `books = hasMany`.\n *\n * Instead, we just call `Object.create`, which does not make any constructor/super calls, and instead\n * let any `this.books` accesses resolve to the getters we've installed on the prototype.\n */\nexport function newEntity<T extends Entity>(em: EntityManager, cstr: EntityConstructor<T>, isNew: boolean): T {\n if (!Object.hasOwn(cstr, lazySymbol)) {\n moveRelationsToGetters(cstr);\n (cstr as any)[lazySymbol] = true;\n }\n const meta = getMetadata(cstr);\n if (meta.ctiAbstract) fail(`Cannot create an instance of abstract entity ${meta.type}`);\n // This side-steps the `Author` constructor that initializes fields instance-level fields, which instead\n // we've shoved up to be getters on the prototype, and the only instance field we expect to have is `__data`,\n // which is set by the `baseEntityCstr` call.\n const entity = Object.create(cstr.prototype) as T;\n baseEntityCstr(em, entity as any, isNew);\n return entity;\n}\n\nfunction moveRelationsToGetters(cstr: EntityConstructor<any>): void {\n let transientFieldsValue: any = {};\n for (const [fieldName, value] of getLazyFields(getMetadata(cstr))) {\n if (value instanceof LazyRelation) {\n Object.defineProperty(cstr.prototype, fieldName, {\n get(this: any) {\n return ((this.__data.relations ??= {})[fieldName] ??= value.create(this, fieldName));\n },\n });\n } else if (fieldName === \"transientFields\") {\n // We'll define transientFields for all entities outside the loop\n transientFieldsValue = value;\n }\n }\n // Most entities have no transientFields, so skip the structuredClone for the empty default\n const needsClone = hasAnyKey(transientFieldsValue);\n Object.defineProperty(cstr.prototype, \"transientFields\", {\n get(this: any) {\n // This prototype-level `get` will only ever be called once per instance, b/c when we're\n // called for the first/only time, we set an instance-level `this.transientFields` that, for\n // all future calls, will resolve to the instance's own copy of the fields.\n //\n // This has the pleasant upshot of making the instance-level `transientFields` lazy, and\n // they will not be created on an instance until they're actually asked for.\n const copy = needsClone ? structuredClone(transientFieldsValue) : {};\n Object.defineProperty(this, \"transientFields\", { value: copy });\n return copy;\n },\n });\n}\n\n/**\n * A function for `has...` methods to integrate with the `newEntity` lazy field system.\n *\n * We need TypeScript to still see `books = hasMany(...)` as being typed as `Many<Book>`,\n * so this method's return type is `R` i.e. the `Many<Book>` relation type.\n *\n * But at runtime we actually want this to be a `LazyRelation` that can be rewritten\n * into a getter, and only invoked when the relation is actually accessed.\n */\nexport function lazyField<T extends Entity, R>(fn: (entity: T, fieldName: string) => R): R {\n return new LazyRelation(fn) as R;\n}\n\n/**\n * Easily resolves `otherMetadata` fields for lazy relations.\n *\n * When `lazyRelation`s are initialized for their first/only time, i.e. the `books = hasBooks(authorMetadata)`\n * call that `getFakeInstance` does, it's when the class bodies are still being evaled, which is before the\n * `metadata.ts` file has run.\n *\n * This means that any `authorMetadata` consts would still be undefined.\n *\n * So instead we just do not bother passing metadata consts to `has...` methods, and instead let the methods\n * one-time resolve `otherMetadata` on their first invocation, which will be after the `metadata.ts` file has\n * finished importing, and the consts are all defined.\n */\nexport function resolveOtherMeta(entity: Entity, fieldName: string): EntityMetadata {\n const meta = getMetadata(entity);\n const field: any = meta.allFields[fieldName] ?? fail(`Could not find field ${meta.type}.${fieldName}`);\n return field.otherMetadata();\n}\n\n/** Wraps `has...` relation constructors in an easily-identifiable container. */\nexport class LazyRelation<T extends Entity> {\n #fn: (entity: T, fieldName: string) => any;\n constructor(fn: (entity: T, fieldName: string) => any) {\n this.#fn = fn;\n }\n\n /** Called by our getters to lazily create the relation on first access. */\n create(entity: T, fieldName: string) {\n return this.#fn(entity, fieldName);\n }\n}\n"],"mappings":";;;;;;;AAQA,MAAM,aAAa,OAAO,MAAM;;;;;;;;;;AAWhC,SAAgB,UAA4B,IAAmB,MAA4B,OAAmB;CAC5G,IAAI,CAAC,OAAO,OAAO,MAAM,UAAU,GAAG;EACpC,uBAAuB,IAAI;EAC3B,KAAc,cAAc;CAC9B;CACA,MAAM,OAAO,YAAY,IAAI;CAC7B,IAAI,KAAK,aAAa,KAAK,gDAAgD,KAAK,MAAM;CAItF,MAAM,SAAS,OAAO,OAAO,KAAK,SAAS;CAC3C,eAAe,IAAI,QAAe,KAAK;CACvC,OAAO;AACT;AAEA,SAAS,uBAAuB,MAAoC;CAClE,IAAI,uBAA4B,CAAC;CACjC,KAAK,MAAM,CAAC,WAAW,UAAU,cAAc,YAAY,IAAI,CAAC,GAC9D,IAAI,iBAAiB,cACnB,OAAO,eAAe,KAAK,WAAW,WAAW,EAC/C,MAAe;EACb,OAAQ,CAAC,KAAK,OAAO,cAAc,CAAC,EAAA,CAAG,eAAe,MAAM,OAAO,MAAM,SAAS;CACpF,EACF,CAAC;MACI,IAAI,cAAc,mBAEvB,uBAAuB;CAI3B,MAAM,aAAa,UAAU,oBAAoB;CACjD,OAAO,eAAe,KAAK,WAAW,mBAAmB,EACvD,MAAe;EAOb,MAAM,OAAO,aAAa,gBAAgB,oBAAoB,IAAI,CAAC;EACnE,OAAO,eAAe,MAAM,mBAAmB,EAAE,OAAO,KAAK,CAAC;EAC9D,OAAO;CACT,EACF,CAAC;AACH;;;;;;;;;;AAWA,SAAgB,UAA+B,IAA4C;CACzF,OAAO,IAAI,aAAa,EAAE;AAC5B;;;;;;;;;;;;;;AAeA,SAAgB,iBAAiB,QAAgB,WAAmC;CAClF,MAAM,OAAO,YAAY,MAAM;CAE/B,QADmB,KAAK,UAAU,cAAc,KAAK,wBAAwB,KAAK,KAAK,GAAG,WAAW,EAAA,CACxF,cAAc;AAC7B;;AAGA,IAAa,eAAb,MAA4C;CAC1C;CACA,YAAY,IAA2C;EACrD,KAAK,MAAM;CACb;;CAGA,OAAO,QAAW,WAAmB;EACnC,OAAO,KAAK,IAAI,QAAQ,SAAS;CACnC;AACF"}
|