joist-core 2.4.0 → 2.5.0-next.2
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 +102 -22
- package/build/EntityManager.cjs.map +1 -1
- package/build/EntityManager.d.cts +99 -54
- package/build/EntityManager.d.cts.map +1 -1
- package/build/EntityManager.d.mts +99 -54
- package/build/EntityManager.d.mts.map +1 -1
- package/build/EntityManager.js +102 -24
- package/build/EntityManager.js.map +1 -1
- package/build/EntityMetadata.cjs +0 -1
- package/build/EntityMetadata.cjs.map +1 -1
- package/build/EntityMetadata.d.cts +47 -36
- package/build/EntityMetadata.d.cts.map +1 -1
- package/build/EntityMetadata.d.mts +47 -36
- package/build/EntityMetadata.d.mts.map +1 -1
- package/build/EntityMetadata.js +0 -1
- package/build/EntityMetadata.js.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 +25 -5
- 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 +25 -5
- 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.cjs +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/oneToManyBatchLoader.js +1 -1
- package/build/batchloaders/oneToOneBatchLoader.cjs +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/oneToOneBatchLoader.js +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.cjs +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/recursiveChildrenBatchLoader.js +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.cjs +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/batchloaders/recursiveParentsBatchLoader.js +1 -1
- package/build/changes.cjs +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 +1 -1
- package/build/changes.js.map +1 -1
- package/build/config.cjs +165 -26
- package/build/config.cjs.map +1 -1
- package/build/config.d.cts +111 -19
- package/build/config.d.cts.map +1 -1
- package/build/config.d.mts +111 -19
- package/build/config.d.mts.map +1 -1
- package/build/config.js +165 -26
- package/build/config.js.map +1 -1
- package/build/configure.cjs +32 -2
- package/build/configure.cjs.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/configure.js +32 -2
- package/build/configure.js.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.cjs +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/findDataLoader.js +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.cjs +6 -2
- package/build/dataloaders/findOrCreateDataLoader.cjs.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/findOrCreateDataLoader.js +7 -3
- package/build/dataloaders/findOrCreateDataLoader.js.map +1 -1
- package/build/dataloaders/findPaginatedDataLoader.cjs +10 -12
- package/build/dataloaders/findPaginatedDataLoader.cjs.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/findPaginatedDataLoader.js +10 -12
- package/build/dataloaders/findPaginatedDataLoader.js.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 +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 +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.cjs +4 -3
- package/build/drivers/EntityWriter.cjs.map +1 -1
- package/build/drivers/EntityWriter.d.cts +19 -7
- package/build/drivers/EntityWriter.d.cts.map +1 -1
- package/build/drivers/EntityWriter.d.mts +19 -7
- package/build/drivers/EntityWriter.d.mts.map +1 -1
- package/build/drivers/EntityWriter.js +5 -4
- package/build/drivers/EntityWriter.js.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.cjs +12 -9
- package/build/fields.cjs.map +1 -1
- package/build/fields.d.cts +10 -11
- package/build/fields.d.cts.map +1 -1
- package/build/fields.d.mts +10 -11
- package/build/fields.d.mts.map +1 -1
- package/build/fields.js +12 -9
- package/build/fields.js.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/ReadDrift.cjs +90 -0
- package/build/flush/ReadDrift.cjs.map +1 -0
- package/build/flush/ReadDrift.d.cts +25 -0
- package/build/flush/ReadDrift.d.cts.map +1 -0
- package/build/flush/ReadDrift.d.mts +25 -0
- package/build/flush/ReadDrift.d.mts.map +1 -0
- package/build/flush/ReadDrift.js +87 -0
- package/build/flush/ReadDrift.js.map +1 -0
- 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.cjs +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/getProperties.js +1 -1
- package/build/index.cjs +20 -7
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +23 -19
- package/build/index.d.cts.map +1 -1
- package/build/index.d.mts +23 -19
- package/build/index.d.mts.map +1 -1
- package/build/index.js +17 -10
- package/build/index.js.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 +2 -2
- package/build/loading/IsLoadedCache.cjs.map +1 -1
- package/build/loading/IsLoadedCache.d.cts +3 -4
- package/build/loading/IsLoadedCache.d.cts.map +1 -1
- package/build/loading/IsLoadedCache.d.mts +3 -4
- package/build/loading/IsLoadedCache.d.mts.map +1 -1
- package/build/loading/IsLoadedCache.js +2 -2
- 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.cjs +1 -1
- package/build/logging/FactoryLogger.cjs.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/FactoryLogger.js +2 -2
- package/build/logging/FactoryLogger.js.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/metrics/EntityMetrics.cjs +81 -0
- package/build/metrics/EntityMetrics.cjs.map +1 -0
- package/build/metrics/EntityMetrics.d.cts +55 -0
- package/build/metrics/EntityMetrics.d.cts.map +1 -0
- package/build/metrics/EntityMetrics.d.mts +55 -0
- package/build/metrics/EntityMetrics.d.mts.map +1 -0
- package/build/metrics/EntityMetrics.js +79 -0
- package/build/metrics/EntityMetrics.js.map +1 -0
- package/build/newEntity.cjs +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 +1 -1
- package/build/newEntity.js.map +1 -1
- package/build/newTestInstance.cjs +1 -0
- package/build/newTestInstance.cjs.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/newTestInstance.js +1 -0
- package/build/newTestInstance.js.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.cjs +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/preloading/partitionHint.js +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.cjs +18 -7
- package/build/queries/find/QueryParser.cjs.map +1 -1
- package/build/queries/find/QueryParser.collectionJoins.cjs +2 -1
- package/build/queries/find/QueryParser.collectionJoins.cjs.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.collectionJoins.js +2 -1
- package/build/queries/find/QueryParser.collectionJoins.js.map +1 -1
- package/build/queries/find/QueryParser.d.cts +39 -18
- package/build/queries/find/QueryParser.d.cts.map +1 -1
- package/build/queries/find/QueryParser.d.mts +39 -18
- package/build/queries/find/QueryParser.d.mts.map +1 -1
- package/build/queries/find/QueryParser.js +18 -7
- package/build/queries/find/QueryParser.js.map +1 -1
- package/build/queries/find/QueryParser.pruning.cjs +50 -1
- package/build/queries/find/QueryParser.pruning.cjs.map +1 -1
- package/build/queries/find/QueryParser.pruning.d.cts +15 -3
- package/build/queries/find/QueryParser.pruning.d.cts.map +1 -1
- package/build/queries/find/QueryParser.pruning.d.mts +15 -3
- package/build/queries/find/QueryParser.pruning.d.mts.map +1 -1
- package/build/queries/find/QueryParser.pruning.js +50 -1
- package/build/queries/find/QueryParser.pruning.js.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.cjs +38 -0
- package/build/queries/sql/Expr.cjs.map +1 -1
- package/build/queries/sql/Expr.d.cts +45 -27
- package/build/queries/sql/Expr.d.cts.map +1 -1
- package/build/queries/sql/Expr.d.mts +45 -27
- package/build/queries/sql/Expr.d.mts.map +1 -1
- package/build/queries/sql/Expr.js +38 -1
- package/build/queries/sql/Expr.js.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.cjs +9 -0
- package/build/queries/sql/Tables.cjs.map +1 -1
- package/build/queries/sql/Tables.d.cts +46 -39
- package/build/queries/sql/Tables.d.cts.map +1 -1
- package/build/queries/sql/Tables.d.mts +46 -39
- package/build/queries/sql/Tables.d.mts.map +1 -1
- package/build/queries/sql/Tables.js +10 -1
- package/build/queries/sql/Tables.js.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.cjs +68 -89
- package/build/queries/sql/execute.cjs.map +1 -1
- package/build/queries/sql/execute.d.cts +49 -32
- package/build/queries/sql/execute.d.cts.map +1 -1
- package/build/queries/sql/execute.d.mts +49 -32
- package/build/queries/sql/execute.d.mts.map +1 -1
- package/build/queries/sql/execute.js +70 -91
- package/build/queries/sql/execute.js.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 +77 -30
- package/build/queries/sql/query.cjs.map +1 -1
- package/build/queries/sql/query.d.cts +119 -76
- package/build/queries/sql/query.d.cts.map +1 -1
- package/build/queries/sql/query.d.mts +119 -76
- package/build/queries/sql/query.d.mts.map +1 -1
- package/build/queries/sql/query.js +75 -30
- package/build/queries/sql/query.js.map +1 -1
- package/build/queries/unnest.cjs +4 -5
- package/build/queries/unnest.cjs.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/unnest.js +4 -5
- package/build/queries/unnest.js.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 +171 -2
- package/build/reactivity/ReactionsManager.cjs.map +1 -1
- package/build/reactivity/ReactionsManager.d.cts +56 -4
- package/build/reactivity/ReactionsManager.d.cts.map +1 -1
- package/build/reactivity/ReactionsManager.d.mts +56 -4
- package/build/reactivity/ReactionsManager.d.mts.map +1 -1
- package/build/reactivity/ReactionsManager.js +172 -3
- package/build/reactivity/ReactionsManager.js.map +1 -1
- package/build/reactivity/reactiveHints.cjs +9 -3
- package/build/reactivity/reactiveHints.cjs.map +1 -1
- package/build/reactivity/reactiveHints.d.cts +19 -18
- package/build/reactivity/reactiveHints.d.cts.map +1 -1
- package/build/reactivity/reactiveHints.d.mts +19 -18
- package/build/reactivity/reactiveHints.d.mts.map +1 -1
- package/build/reactivity/reactiveHints.js +9 -3
- package/build/reactivity/reactiveHints.js.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 +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 +1 -1
- package/build/relations/AsyncProperty.js.map +1 -1
- package/build/relations/AsyncReactiveField.cjs +23 -5
- package/build/relations/AsyncReactiveField.cjs.map +1 -1
- package/build/relations/AsyncReactiveField.d.cts +7 -6
- package/build/relations/AsyncReactiveField.d.cts.map +1 -1
- package/build/relations/AsyncReactiveField.d.mts +7 -6
- package/build/relations/AsyncReactiveField.d.mts.map +1 -1
- package/build/relations/AsyncReactiveField.js +23 -5
- 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 +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 +1 -1
- package/build/relations/CustomCollection.js.map +1 -1
- package/build/relations/CustomReference.cjs +2 -2
- 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 +2 -2
- package/build/relations/CustomReference.js.map +1 -1
- package/build/relations/EnumCollection.cjs +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 +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 +16 -2
- package/build/relations/LazyField.cjs.map +1 -1
- package/build/relations/LazyField.d.cts +13 -8
- package/build/relations/LazyField.d.cts.map +1 -1
- package/build/relations/LazyField.d.mts +13 -8
- package/build/relations/LazyField.d.mts.map +1 -1
- package/build/relations/LazyField.js +16 -2
- package/build/relations/LazyField.js.map +1 -1
- package/build/relations/ManyToManyCollection.cjs +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 +1 -1
- package/build/relations/ManyToManyCollection.js.map +1 -1
- package/build/relations/ManyToManyLargeCollection.cjs +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/ManyToManyLargeCollection.js +1 -1
- package/build/relations/ManyToOneReference.cjs +2 -2
- 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 +2 -2
- package/build/relations/ManyToOneReference.js.map +1 -1
- package/build/relations/OneToManyCollection.cjs +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 +1 -1
- package/build/relations/OneToManyCollection.js.map +1 -1
- package/build/relations/OneToManyLargeCollection.cjs +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 +1 -1
- package/build/relations/OneToManyLargeCollection.js.map +1 -1
- package/build/relations/OneToOneReference.cjs +2 -2
- 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 +2 -2
- package/build/relations/OneToOneReference.js.map +1 -1
- package/build/relations/PolymorphicReference.cjs +2 -2
- 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 +2 -2
- 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 +27 -6
- package/build/relations/ReactiveField.cjs.map +1 -1
- package/build/relations/ReactiveField.d.cts +11 -7
- package/build/relations/ReactiveField.d.cts.map +1 -1
- package/build/relations/ReactiveField.d.mts +11 -7
- package/build/relations/ReactiveField.d.mts.map +1 -1
- package/build/relations/ReactiveField.js +27 -6
- package/build/relations/ReactiveField.js.map +1 -1
- package/build/relations/ReactiveGetter.cjs +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 +1 -1
- package/build/relations/ReactiveGetter.js.map +1 -1
- package/build/relations/ReactiveManyToMany.cjs +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 +1 -1
- package/build/relations/ReactiveManyToMany.js.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.cjs +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 +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.js.map +1 -1
- package/build/relations/ReactiveReference.cjs +2 -2
- package/build/relations/ReactiveReference.cjs.map +1 -1
- package/build/relations/ReactiveReference.d.cts +6 -7
- package/build/relations/ReactiveReference.d.cts.map +1 -1
- package/build/relations/ReactiveReference.d.mts +6 -7
- package/build/relations/ReactiveReference.d.mts.map +1 -1
- package/build/relations/ReactiveReference.js +2 -2
- 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 +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 +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 +24 -5
- package/build/relations/hasAsyncMethod.cjs.map +1 -1
- package/build/relations/hasAsyncMethod.d.cts +9 -8
- package/build/relations/hasAsyncMethod.d.cts.map +1 -1
- package/build/relations/hasAsyncMethod.d.mts +9 -8
- package/build/relations/hasAsyncMethod.d.mts.map +1 -1
- package/build/relations/hasAsyncMethod.js +24 -6
- package/build/relations/hasAsyncMethod.js.map +1 -1
- package/build/relations/hasManyDerived.cjs +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/hasManyDerived.js +1 -1
- package/build/relations/hasManyThrough.cjs +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/hasManyThrough.js +1 -1
- package/build/relations/hasOneDerived.cjs +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/hasOneDerived.js +1 -1
- package/build/relations/hasOneThrough.cjs +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/hasOneThrough.js +1 -1
- package/build/relations/hasProperty.cjs +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 +1 -1
- package/build/relations/hasProperty.js.map +1 -1
- package/build/relations/hasReactiveAsyncMethod.cjs +87 -0
- package/build/relations/hasReactiveAsyncMethod.cjs.map +1 -0
- package/build/relations/hasReactiveAsyncMethod.d.cts +32 -0
- package/build/relations/hasReactiveAsyncMethod.d.cts.map +1 -0
- package/build/relations/hasReactiveAsyncMethod.d.mts +32 -0
- package/build/relations/hasReactiveAsyncMethod.d.mts.map +1 -0
- package/build/relations/hasReactiveAsyncMethod.js +85 -0
- package/build/relations/hasReactiveAsyncMethod.js.map +1 -0
- package/build/relations/index.cjs +2 -0
- package/build/relations/index.d.cts +2 -1
- package/build/relations/index.d.mts +2 -1
- package/build/relations/index.js +2 -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.cjs +11 -1
- package/build/resurrection.cjs.map +1 -1
- package/build/resurrection.d.cts +5 -3
- package/build/resurrection.d.cts.map +1 -1
- package/build/resurrection.d.mts +5 -3
- package/build/resurrection.d.mts.map +1 -1
- package/build/resurrection.js +11 -2
- package/build/resurrection.js.map +1 -1
- package/build/rules.cjs +1 -1
- package/build/rules.cjs.map +1 -1
- package/build/rules.d.cts +25 -20
- package/build/rules.d.cts.map +1 -1
- package/build/rules.d.mts +25 -20
- package/build/rules.d.mts.map +1 -1
- package/build/rules.js +1 -1
- package/build/rules.js.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.cjs +3 -0
- package/build/serde/columns.cjs.map +1 -1
- package/build/serde/columns.d.cts +3 -3
- package/build/serde/columns.d.cts.map +1 -1
- package/build/serde/columns.d.mts +3 -3
- package/build/serde/columns.d.mts.map +1 -1
- package/build/serde/columns.js +3 -0
- package/build/serde/columns.js.map +1 -1
- package/build/serde/fieldSerde.cjs +3 -0
- package/build/serde/fieldSerde.cjs.map +1 -1
- package/build/serde/fieldSerde.d.cts +10 -9
- package/build/serde/fieldSerde.d.cts.map +1 -1
- package/build/serde/fieldSerde.d.mts +10 -9
- package/build/serde/fieldSerde.d.mts.map +1 -1
- package/build/serde/fieldSerde.js +3 -0
- package/build/serde/fieldSerde.js.map +1 -1
- package/build/serde/serde.cjs +60 -0
- package/build/serde/serde.cjs.map +1 -1
- package/build/serde/serde.d.cts +58 -19
- package/build/serde/serde.d.cts.map +1 -1
- package/build/serde/serde.d.mts +58 -19
- package/build/serde/serde.d.mts.map +1 -1
- package/build/serde/serde.js +60 -1
- package/build/serde/serde.js.map +1 -1
- package/build/serde/temporal.cjs +7 -12
- package/build/serde/temporal.cjs.map +1 -1
- package/build/serde/temporal.d.cts +6 -6
- package/build/serde/temporal.d.cts.map +1 -1
- package/build/serde/temporal.d.mts +6 -6
- package/build/serde/temporal.d.mts.map +1 -1
- package/build/serde/temporal.js +7 -12
- package/build/serde/temporal.js.map +1 -1
- package/build/serde/temporalMappers.cjs +8 -4
- package/build/serde/temporalMappers.cjs.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/serde/temporalMappers.js +8 -4
- package/build/serde/temporalMappers.js.map +1 -1
- package/build/transitions.cjs +91 -0
- package/build/transitions.cjs.map +1 -0
- package/build/transitions.d.cts +115 -0
- package/build/transitions.d.cts.map +1 -0
- package/build/transitions.d.mts +115 -0
- package/build/transitions.d.mts.map +1 -0
- package/build/transitions.js +86 -0
- package/build/transitions.js.map +1 -0
- 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.cjs +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/upsert.js +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 +6 -6
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_metrics_EntityMetrics = require("./metrics/EntityMetrics.cjs");
|
|
3
|
+
const require_utils = require("./utils.cjs");
|
|
4
|
+
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
5
|
+
//#region src/transitions.ts
|
|
6
|
+
/** The "from" state of a just-created entity, because `undefined` can be a real field value. */
|
|
7
|
+
const created = Symbol("created");
|
|
8
|
+
/** Converts an internal step to the `Transition` that guards and reactions receive. */
|
|
9
|
+
function toTransition(step) {
|
|
10
|
+
return {
|
|
11
|
+
from: step.from === created ? void 0 : step.from,
|
|
12
|
+
to: step.to
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Merges the transition config of `meta` and its base types by field, converting accessors to codes.
|
|
17
|
+
*
|
|
18
|
+
* This runs after boot, because the config is written before the enum metadata exists.
|
|
19
|
+
*/
|
|
20
|
+
function buildFieldTransitions(meta) {
|
|
21
|
+
const byField = /* @__PURE__ */ new Map();
|
|
22
|
+
for (const m of require_EntityMetadata.getBaseAndSelfMetas(meta)) for (const [fieldName, config] of Object.entries(m.config.__data.transitions)) {
|
|
23
|
+
let merged = byField.get(fieldName);
|
|
24
|
+
if (!merged) byField.set(fieldName, merged = {
|
|
25
|
+
tables: [],
|
|
26
|
+
guards: [],
|
|
27
|
+
callbacks: []
|
|
28
|
+
});
|
|
29
|
+
if (config.table) merged.tables.push(toCodesTable(meta, fieldName, config.table));
|
|
30
|
+
for (const { match, run } of config.guards) merged.guards.push({
|
|
31
|
+
matcher: toMatcher(meta, fieldName, match),
|
|
32
|
+
run
|
|
33
|
+
});
|
|
34
|
+
for (const { name, match, run } of config.callbacks) {
|
|
35
|
+
const matcher = toMatcher(meta, fieldName, match);
|
|
36
|
+
merged.callbacks.push({
|
|
37
|
+
name,
|
|
38
|
+
phase: match.phase ?? "flush",
|
|
39
|
+
matcher,
|
|
40
|
+
evaluation: new require_metrics_EntityMetrics.EvaluationSlot(`${meta.type}.${name}`),
|
|
41
|
+
run
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return byField;
|
|
46
|
+
}
|
|
47
|
+
/** Returns whether `step` matches `matcher`'s `from`, `to`, and `onCreate` settings. */
|
|
48
|
+
function matchesTransition(matcher, step) {
|
|
49
|
+
if (step.from === created) {
|
|
50
|
+
if (!matcher.onCreate) return false;
|
|
51
|
+
} else if (matcher.from && !matcher.from.includes(step.from)) return false;
|
|
52
|
+
return !matcher.to || matcher.to.includes(step.to);
|
|
53
|
+
}
|
|
54
|
+
/** Uses the enum's display name in error messages when there is one, i.e. `Approved` instead of `APPROVED`. */
|
|
55
|
+
function describeValue(meta, fieldName, value) {
|
|
56
|
+
if (value === void 0) return "unset";
|
|
57
|
+
const field = meta.allFields[fieldName];
|
|
58
|
+
return field?.kind === "enum" ? field.enumDetailType.getByCode(value)?.name ?? String(value) : String(value);
|
|
59
|
+
}
|
|
60
|
+
/** Converts a `transitions` table's keys and values to codes, so it can be compared to field values. */
|
|
61
|
+
function toCodesTable(meta, fieldName, table) {
|
|
62
|
+
return new Map(Object.entries(table).map(([from, tos]) => [accessorToCode(meta, fieldName, from), toCodes(meta, fieldName, tos ?? [])]));
|
|
63
|
+
}
|
|
64
|
+
/** Converts a `match`'s accessors to codes. */
|
|
65
|
+
function toMatcher(meta, fieldName, match) {
|
|
66
|
+
return {
|
|
67
|
+
from: toCodes(meta, fieldName, match.from),
|
|
68
|
+
to: toCodes(meta, fieldName, match.to),
|
|
69
|
+
onCreate: match.onCreate !== false && match.from === void 0
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Converts an enum accessor, i.e. `Rejected`, to its code, i.e. `REJECTED`, and fails on anything else. */
|
|
73
|
+
function accessorToCode(meta, fieldName, value) {
|
|
74
|
+
const field = meta.allFields[fieldName];
|
|
75
|
+
if (field?.kind !== "enum") require_utils.fail(`${meta.type}.${fieldName} is not an enum field, so it can't have transitions`);
|
|
76
|
+
if (typeof value !== "string" || !Object.hasOwn(field.enumType, value)) require_utils.fail(`Unknown ${meta.type}.${fieldName} accessor ${String(value)}, i.e. use "Draft" for AuthorStatus.Draft`);
|
|
77
|
+
return field.enumType[value];
|
|
78
|
+
}
|
|
79
|
+
/** Converts one or more enum accessors to an array of codes, preserving an omitted match. */
|
|
80
|
+
function toCodes(meta, fieldName, values) {
|
|
81
|
+
if (values === void 0) return void 0;
|
|
82
|
+
return typeof values === "string" ? [accessorToCode(meta, fieldName, values)] : values.map((v) => accessorToCode(meta, fieldName, v));
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
exports.buildFieldTransitions = buildFieldTransitions;
|
|
86
|
+
exports.created = created;
|
|
87
|
+
exports.describeValue = describeValue;
|
|
88
|
+
exports.matchesTransition = matchesTransition;
|
|
89
|
+
exports.toTransition = toTransition;
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=transitions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.cjs","names":["getBaseAndSelfMetas","EvaluationSlot"],"sources":["../src/transitions.ts"],"sourcesContent":["import type { Entity } from \"src/Entity.ts\";\nimport { type EntityMetadata, getBaseAndSelfMetas } from \"src/EntityMetadata.ts\";\nimport { EvaluationSlot } from \"src/metrics/EntityMetrics.ts\";\nimport type { ValidationRuleResult } from \"src/rules.ts\";\nimport { type MaybePromise, fail } from \"src/utils.ts\";\n\n/**\n * Which state transitions of an enum field an `addTransitionRule` cares about.\n *\n * Omitting `from` or `to` matches any state. Guards never run on creation.\n */\nexport interface GuardTransitionMatch<V> {\n from?: V | readonly V[];\n to?: V | readonly V[];\n}\n\n/**\n * Which state transitions of an enum field an `addTransitionReaction` callback handles.\n *\n * Creating an entity with a matching `to` state also matches, unless `from` is set or `onCreate` is `false`.\n */\nexport interface OnTransitionMatch<V> extends GuardTransitionMatch<V> {\n /**\n * Whether `addTransitionReaction` fires when an entity is created with a matching `to` state, defaults to `true`.\n *\n * Entering a state by creation usually needs the same side effects as entering it by a transition, and\n * forgetting them is easy to miss. Set `false` for reactions that only make sense for a transition.\n */\n onCreate?: boolean;\n /** `commit` runs in `beforeCommit`, i.e. to enqueue jobs; `flush` (the default) runs as a reaction. */\n phase?: \"flush\" | \"commit\";\n}\n\n/** Maps each state to the states it may transition to, i.e. `{ Draft: [\"Open\"], Open: [\"Closed\"] }`. */\nexport type TransitionTable<V extends PropertyKey> = Partial<Record<V, readonly V[]>>;\n\n/**\n * The transition a guard or reaction is handling, i.e. `{ from: \"DRAFT\", to: \"OPEN\" }`.\n *\n * Guards and callbacks run during reaction passes, after the assignment, so the entity may already be in a\n * later state. This tells them which transition they're handling. `from` is `undefined` for creation.\n */\nexport interface Transition<V> {\n from: V | undefined;\n to: V;\n}\n\n/** The \"from\" state of a just-created entity, because `undefined` can be a real field value. */\nexport const created: unique symbol = Symbol(\"created\");\n\n/** A single recorded transition of a field, with `from` as `created` for creation. */\nexport interface TransitionStep {\n from: unknown;\n to: unknown;\n}\n\n/** An `addTransitionRule` as registered in config, with its `match` still using accessors. */\nexport interface TransitionGuardConfig<T extends Entity = Entity> {\n match: GuardTransitionMatch<string>;\n run(entity: T, step: TransitionStep): MaybePromise<ValidationRuleResult>;\n}\n\n/**\n * An `addTransitionReaction` as registered in config, with its `match` still using accessors.\n *\n * @internal Joist invokes `run`; the application callback does not receive the metrics slot.\n */\nexport interface TransitionCallbackConfig<T extends Entity = Entity, C = unknown> {\n name: string;\n match: OnTransitionMatch<string>;\n run(entity: T, ctx: C, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;\n}\n\n/** One field's `setTransitions`, `addTransitionRule`, and `addTransitionReaction` config on a single entity type. */\nexport interface FieldTransitionsConfig<T extends Entity = Entity, C = unknown> {\n /** The `transitions` table, if any; subtypes add their own tables on their own configs. */\n table?: TransitionTable<string>;\n guards: TransitionGuardConfig<T>[];\n callbacks: TransitionCallbackConfig<T, C>[];\n}\n\n/** A `match` with accessors converted to codes, so it can be compared to recorded steps. */\nexport interface TransitionMatcher {\n /** The allowed previous states, or `undefined` for any state. */\n from: readonly unknown[] | undefined;\n /** The allowed new states, or `undefined` for any state. */\n to: readonly unknown[] | undefined;\n /** Whether creation matches, which is never true when `from` is set. */\n onCreate: boolean;\n}\n\n/** A guard with its `match` converted to codes. */\nexport interface TransitionGuard {\n matcher: TransitionMatcher;\n run(entity: Entity, step: TransitionStep): MaybePromise<ValidationRuleResult>;\n}\n\n/** A callback with its `match` converted to codes, dispatched only after its transition's guards pass. */\nexport interface TransitionCallback {\n name: string;\n phase: \"flush\" | \"commit\";\n matcher: TransitionMatcher;\n evaluation: EvaluationSlot;\n run(entity: Entity, ctx: unknown, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;\n}\n\n/** One field's transition config from an entity type and its base types, with accessors converted to codes. */\nexport interface FieldTransitions {\n /** Each table maps a `from` code to its allowed `to` codes; every table must allow a change. */\n tables: ReadonlyMap<unknown, readonly unknown[]>[];\n guards: TransitionGuard[];\n callbacks: TransitionCallback[];\n}\n\n/** Converts an internal step to the `Transition` that guards and reactions receive. */\nexport function toTransition(step: TransitionStep): Transition<any> {\n return { from: step.from === created ? undefined : step.from, to: step.to };\n}\n\n/**\n * Merges the transition config of `meta` and its base types by field, converting accessors to codes.\n *\n * This runs after boot, because the config is written before the enum metadata exists.\n */\nexport function buildFieldTransitions(meta: EntityMetadata): Map<string, FieldTransitions> {\n const byField = new Map<string, FieldTransitions>();\n for (const m of getBaseAndSelfMetas(meta)) {\n for (const [fieldName, config] of Object.entries(m.config.__data.transitions)) {\n let merged = byField.get(fieldName);\n if (!merged) byField.set(fieldName, (merged = { tables: [], guards: [], callbacks: [] }));\n if (config.table) merged.tables.push(toCodesTable(meta, fieldName, config.table));\n for (const { match, run } of config.guards) {\n merged.guards.push({ matcher: toMatcher(meta, fieldName, match), run });\n }\n for (const { name, match, run } of config.callbacks) {\n const matcher = toMatcher(meta, fieldName, match);\n merged.callbacks.push({\n name,\n phase: match.phase ?? \"flush\",\n matcher,\n evaluation: new EvaluationSlot(`${meta.type}.${name}`),\n run,\n });\n }\n }\n }\n return byField;\n}\n\n/** Returns whether `step` matches `matcher`'s `from`, `to`, and `onCreate` settings. */\nexport function matchesTransition(matcher: TransitionMatcher, step: TransitionStep): boolean {\n if (step.from === created) {\n if (!matcher.onCreate) return false;\n } else if (matcher.from && !matcher.from.includes(step.from)) {\n return false;\n }\n return !matcher.to || matcher.to.includes(step.to);\n}\n\n/** Uses the enum's display name in error messages when there is one, i.e. `Approved` instead of `APPROVED`. */\nexport function describeValue(meta: EntityMetadata, fieldName: string, value: unknown): string {\n if (value === undefined) return \"unset\";\n const field = meta.allFields[fieldName];\n return field?.kind === \"enum\" ? (field.enumDetailType.getByCode(value)?.name ?? String(value)) : String(value);\n}\n\n/** Converts a `transitions` table's keys and values to codes, so it can be compared to field values. */\nfunction toCodesTable(\n meta: EntityMetadata,\n fieldName: string,\n table: TransitionTable<string>,\n): Map<unknown, readonly unknown[]> {\n return new Map(\n Object.entries(table).map(([from, tos]) => [\n accessorToCode(meta, fieldName, from),\n toCodes(meta, fieldName, tos ?? [])!,\n ]),\n );\n}\n\n/** Converts a `match`'s accessors to codes. */\nfunction toMatcher(meta: EntityMetadata, fieldName: string, match: OnTransitionMatch<string>): TransitionMatcher {\n return {\n from: toCodes(meta, fieldName, match.from),\n to: toCodes(meta, fieldName, match.to),\n // `from` describes a previous state, which a new entity doesn't have\n onCreate: match.onCreate !== false && match.from === undefined,\n };\n}\n\n/** Converts an enum accessor, i.e. `Rejected`, to its code, i.e. `REJECTED`, and fails on anything else. */\nfunction accessorToCode(meta: EntityMetadata, fieldName: string, value: unknown): unknown {\n const field = meta.allFields[fieldName];\n if (field?.kind !== \"enum\") fail(`${meta.type}.${fieldName} is not an enum field, so it can't have transitions`);\n // Only accessors are accepted, even from untyped callers, so every table reads the same way\n if (typeof value !== \"string\" || !Object.hasOwn(field.enumType, value)) {\n fail(`Unknown ${meta.type}.${fieldName} accessor ${String(value)}, i.e. use \"Draft\" for AuthorStatus.Draft`);\n }\n return field.enumType[value];\n}\n\n/** Converts one or more enum accessors to an array of codes, preserving an omitted match. */\nfunction toCodes(\n meta: EntityMetadata,\n fieldName: string,\n values: string | readonly string[] | undefined,\n): unknown[] | undefined {\n if (values === undefined) return undefined;\n return typeof values === \"string\"\n ? [accessorToCode(meta, fieldName, values)]\n : values.map((v) => accessorToCode(meta, fieldName, v));\n}\n"],"mappings":";;;;;;AAgDA,MAAa,UAAyB,OAAO,SAAS;;AAmEtD,SAAgB,aAAa,MAAuC;CAClE,OAAO;EAAE,MAAM,KAAK,SAAS,UAAU,KAAA,IAAY,KAAK;EAAM,IAAI,KAAK;CAAG;AAC5E;;;;;;AAOA,SAAgB,sBAAsB,MAAqD;CACzF,MAAM,0BAAU,IAAI,IAA8B;CAClD,KAAK,MAAM,KAAKA,uBAAAA,oBAAoB,IAAI,GACtC,KAAK,MAAM,CAAC,WAAW,WAAW,OAAO,QAAQ,EAAE,OAAO,OAAO,WAAW,GAAG;EAC7E,IAAI,SAAS,QAAQ,IAAI,SAAS;EAClC,IAAI,CAAC,QAAQ,QAAQ,IAAI,WAAY,SAAS;GAAE,QAAQ,CAAC;GAAG,QAAQ,CAAC;GAAG,WAAW,CAAC;EAAE,CAAE;EACxF,IAAI,OAAO,OAAO,OAAO,OAAO,KAAK,aAAa,MAAM,WAAW,OAAO,KAAK,CAAC;EAChF,KAAK,MAAM,EAAE,OAAO,SAAS,OAAO,QAClC,OAAO,OAAO,KAAK;GAAE,SAAS,UAAU,MAAM,WAAW,KAAK;GAAG;EAAI,CAAC;EAExE,KAAK,MAAM,EAAE,MAAM,OAAO,SAAS,OAAO,WAAW;GACnD,MAAM,UAAU,UAAU,MAAM,WAAW,KAAK;GAChD,OAAO,UAAU,KAAK;IACpB;IACA,OAAO,MAAM,SAAS;IACtB;IACA,YAAY,IAAIC,8BAAAA,eAAe,GAAG,KAAK,KAAK,GAAG,MAAM;IACrD;GACF,CAAC;EACH;CACF;CAEF,OAAO;AACT;;AAGA,SAAgB,kBAAkB,SAA4B,MAA+B;CAC3F,IAAI,KAAK,SAAS,SACZ;MAAA,CAAC,QAAQ,UAAU,OAAO;CAAA,OACzB,IAAI,QAAQ,QAAQ,CAAC,QAAQ,KAAK,SAAS,KAAK,IAAI,GACzD,OAAO;CAET,OAAO,CAAC,QAAQ,MAAM,QAAQ,GAAG,SAAS,KAAK,EAAE;AACnD;;AAGA,SAAgB,cAAc,MAAsB,WAAmB,OAAwB;CAC7F,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,QAAQ,KAAK,UAAU;CAC7B,OAAO,OAAO,SAAS,SAAU,MAAM,eAAe,UAAU,KAAK,CAAC,EAAE,QAAQ,OAAO,KAAK,IAAK,OAAO,KAAK;AAC/G;;AAGA,SAAS,aACP,MACA,WACA,OACkC;CAClC,OAAO,IAAI,IACT,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,SAAS,CACzC,eAAe,MAAM,WAAW,IAAI,GACpC,QAAQ,MAAM,WAAW,OAAO,CAAC,CAAC,CACpC,CAAC,CACH;AACF;;AAGA,SAAS,UAAU,MAAsB,WAAmB,OAAqD;CAC/G,OAAO;EACL,MAAM,QAAQ,MAAM,WAAW,MAAM,IAAI;EACzC,IAAI,QAAQ,MAAM,WAAW,MAAM,EAAE;EAErC,UAAU,MAAM,aAAa,SAAS,MAAM,SAAS,KAAA;CACvD;AACF;;AAGA,SAAS,eAAe,MAAsB,WAAmB,OAAyB;CACxF,MAAM,QAAQ,KAAK,UAAU;CAC7B,IAAI,OAAO,SAAS,QAAQ,cAAA,KAAK,GAAG,KAAK,KAAK,GAAG,UAAU,oDAAoD;CAE/G,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,OAAO,MAAM,UAAU,KAAK,GACnE,cAAA,KAAK,WAAW,KAAK,KAAK,GAAG,UAAU,YAAY,OAAO,KAAK,EAAE,0CAA0C;CAE7G,OAAO,MAAM,SAAS;AACxB;;AAGA,SAAS,QACP,MACA,WACA,QACuB;CACvB,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;CACjC,OAAO,OAAO,WAAW,WACrB,CAAC,eAAe,MAAM,WAAW,MAAM,CAAC,IACxC,OAAO,KAAK,MAAM,eAAe,MAAM,WAAW,CAAC,CAAC;AAC1D"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { EvaluationSlot } from "./metrics/EntityMetrics.cjs";
|
|
2
|
+
import { MaybePromise } from "./utils.cjs";
|
|
3
|
+
import { ValidationRuleResult } from "./rules.cjs";
|
|
4
|
+
import { EntityMetadata } from "./EntityMetadata.cjs";
|
|
5
|
+
import { Entity } from "./Entity.cjs";
|
|
6
|
+
//#region src/transitions.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Which state transitions of an enum field an `addTransitionRule` cares about.
|
|
9
|
+
*
|
|
10
|
+
* Omitting `from` or `to` matches any state. Guards never run on creation.
|
|
11
|
+
*/
|
|
12
|
+
export interface GuardTransitionMatch<V> {
|
|
13
|
+
from?: V | readonly V[];
|
|
14
|
+
to?: V | readonly V[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Which state transitions of an enum field an `addTransitionReaction` callback handles.
|
|
18
|
+
*
|
|
19
|
+
* Creating an entity with a matching `to` state also matches, unless `from` is set or `onCreate` is `false`.
|
|
20
|
+
*/
|
|
21
|
+
export interface OnTransitionMatch<V> extends GuardTransitionMatch<V> {
|
|
22
|
+
/**
|
|
23
|
+
* Whether `addTransitionReaction` fires when an entity is created with a matching `to` state, defaults to `true`.
|
|
24
|
+
*
|
|
25
|
+
* Entering a state by creation usually needs the same side effects as entering it by a transition, and
|
|
26
|
+
* forgetting them is easy to miss. Set `false` for reactions that only make sense for a transition.
|
|
27
|
+
*/
|
|
28
|
+
onCreate?: boolean;
|
|
29
|
+
/** `commit` runs in `beforeCommit`, i.e. to enqueue jobs; `flush` (the default) runs as a reaction. */
|
|
30
|
+
phase?: "flush" | "commit";
|
|
31
|
+
}
|
|
32
|
+
/** Maps each state to the states it may transition to, i.e. `{ Draft: ["Open"], Open: ["Closed"] }`. */
|
|
33
|
+
export type TransitionTable<V extends PropertyKey> = Partial<Record<V, readonly V[]>>;
|
|
34
|
+
/**
|
|
35
|
+
* The transition a guard or reaction is handling, i.e. `{ from: "DRAFT", to: "OPEN" }`.
|
|
36
|
+
*
|
|
37
|
+
* Guards and callbacks run during reaction passes, after the assignment, so the entity may already be in a
|
|
38
|
+
* later state. This tells them which transition they're handling. `from` is `undefined` for creation.
|
|
39
|
+
*/
|
|
40
|
+
export interface Transition<V> {
|
|
41
|
+
from: V | undefined;
|
|
42
|
+
to: V;
|
|
43
|
+
}
|
|
44
|
+
/** The "from" state of a just-created entity, because `undefined` can be a real field value. */
|
|
45
|
+
export declare const created: unique symbol;
|
|
46
|
+
/** A single recorded transition of a field, with `from` as `created` for creation. */
|
|
47
|
+
export interface TransitionStep {
|
|
48
|
+
from: unknown;
|
|
49
|
+
to: unknown;
|
|
50
|
+
}
|
|
51
|
+
/** An `addTransitionRule` as registered in config, with its `match` still using accessors. */
|
|
52
|
+
export interface TransitionGuardConfig<T extends Entity = Entity> {
|
|
53
|
+
match: GuardTransitionMatch<string>;
|
|
54
|
+
run(entity: T, step: TransitionStep): MaybePromise<ValidationRuleResult>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* An `addTransitionReaction` as registered in config, with its `match` still using accessors.
|
|
58
|
+
*
|
|
59
|
+
* @internal Joist invokes `run`; the application callback does not receive the metrics slot.
|
|
60
|
+
*/
|
|
61
|
+
export interface TransitionCallbackConfig<T extends Entity = Entity, C = unknown> {
|
|
62
|
+
name: string;
|
|
63
|
+
match: OnTransitionMatch<string>;
|
|
64
|
+
run(entity: T, ctx: C, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;
|
|
65
|
+
}
|
|
66
|
+
/** One field's `setTransitions`, `addTransitionRule`, and `addTransitionReaction` config on a single entity type. */
|
|
67
|
+
export interface FieldTransitionsConfig<T extends Entity = Entity, C = unknown> {
|
|
68
|
+
/** The `transitions` table, if any; subtypes add their own tables on their own configs. */
|
|
69
|
+
table?: TransitionTable<string>;
|
|
70
|
+
guards: TransitionGuardConfig<T>[];
|
|
71
|
+
callbacks: TransitionCallbackConfig<T, C>[];
|
|
72
|
+
}
|
|
73
|
+
/** A `match` with accessors converted to codes, so it can be compared to recorded steps. */
|
|
74
|
+
export interface TransitionMatcher {
|
|
75
|
+
/** The allowed previous states, or `undefined` for any state. */
|
|
76
|
+
from: readonly unknown[] | undefined;
|
|
77
|
+
/** The allowed new states, or `undefined` for any state. */
|
|
78
|
+
to: readonly unknown[] | undefined;
|
|
79
|
+
/** Whether creation matches, which is never true when `from` is set. */
|
|
80
|
+
onCreate: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** A guard with its `match` converted to codes. */
|
|
83
|
+
export interface TransitionGuard {
|
|
84
|
+
matcher: TransitionMatcher;
|
|
85
|
+
run(entity: Entity, step: TransitionStep): MaybePromise<ValidationRuleResult>;
|
|
86
|
+
}
|
|
87
|
+
/** A callback with its `match` converted to codes, dispatched only after its transition's guards pass. */
|
|
88
|
+
export interface TransitionCallback {
|
|
89
|
+
name: string;
|
|
90
|
+
phase: "flush" | "commit";
|
|
91
|
+
matcher: TransitionMatcher;
|
|
92
|
+
evaluation: EvaluationSlot;
|
|
93
|
+
run(entity: Entity, ctx: unknown, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;
|
|
94
|
+
}
|
|
95
|
+
/** One field's transition config from an entity type and its base types, with accessors converted to codes. */
|
|
96
|
+
export interface FieldTransitions {
|
|
97
|
+
/** Each table maps a `from` code to its allowed `to` codes; every table must allow a change. */
|
|
98
|
+
tables: ReadonlyMap<unknown, readonly unknown[]>[];
|
|
99
|
+
guards: TransitionGuard[];
|
|
100
|
+
callbacks: TransitionCallback[];
|
|
101
|
+
}
|
|
102
|
+
/** Converts an internal step to the `Transition` that guards and reactions receive. */
|
|
103
|
+
export declare function toTransition(step: TransitionStep): Transition<any>;
|
|
104
|
+
/**
|
|
105
|
+
* Merges the transition config of `meta` and its base types by field, converting accessors to codes.
|
|
106
|
+
*
|
|
107
|
+
* This runs after boot, because the config is written before the enum metadata exists.
|
|
108
|
+
*/
|
|
109
|
+
export declare function buildFieldTransitions(meta: EntityMetadata): Map<string, FieldTransitions>;
|
|
110
|
+
/** Returns whether `step` matches `matcher`'s `from`, `to`, and `onCreate` settings. */
|
|
111
|
+
export declare function matchesTransition(matcher: TransitionMatcher, step: TransitionStep): boolean;
|
|
112
|
+
/** Uses the enum's display name in error messages when there is one, i.e. `Approved` instead of `APPROVED`. */
|
|
113
|
+
export declare function describeValue(meta: EntityMetadata, fieldName: string, value: unknown): string;
|
|
114
|
+
//#endregion
|
|
115
|
+
//# sourceMappingURL=transitions.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.d.cts","names":[],"sources":["../src/transitions.ts"],"mappings":";;;;;;;;;;;iBAWiB,qBAAqB;EACpC,OAAO,aAAa;EACpB,KAAK,aAAa;;;;;;;iBAQH,kBAAkB,WAAW,qBAAqB;;;;;;;EAOjE;;EAEA;;;YAIU,gBAAgB,UAAU,eAAe,QAAQ,OAAO,YAAY;;;;;;;iBAQ/D,WAAW;EAC1B,MAAM;EACN,IAAI;;;qBAIO;;iBAGI;EACf;EACA;;;iBAIe,sBAAsB,UAAU,SAAS;EACxD,OAAO;EACP,IAAI,QAAQ,GAAG,MAAM,iBAAiB,aAAa;;;;;;;iBAQpC,yBAAyB,UAAU,SAAS,QAAQ;EACnE;EACA,OAAO;EACP,IAAI,QAAQ,GAAG,KAAK,GAAG,MAAM,gBAAgB,YAAY,iBAAiB;;;iBAI3D,uBAAuB,UAAU,SAAS,QAAQ;;EAEjE,QAAQ;EACR,QAAQ,sBAAsB;EAC9B,WAAW,yBAAyB,GAAG;;;iBAIxB;;EAEf;;EAEA;;EAEA;;;iBAIe;EACf,SAAS;EACT,IAAI,QAAQ,QAAQ,MAAM,iBAAiB,aAAa;;;iBAIzC;EACf;EACA;EACA,SAAS;EACT,YAAY;EACZ,IAAI,QAAQ,QAAQ,cAAc,MAAM,gBAAgB,YAAY,iBAAiB;;;iBAItE;;EAEf,QAAQ;EACR,QAAQ;EACR,WAAW;;;wBAIG,aAAa,MAAM,iBAAiB;;;;;;wBASpC,sBAAsB,MAAM,iBAAiB,YAAY;;wBA0BzD,kBAAkB,SAAS,mBAAmB,MAAM;;wBAUpD,cAAc,MAAM,gBAAgB,mBAAmB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { EvaluationSlot } from "./metrics/EntityMetrics.mjs";
|
|
2
|
+
import { MaybePromise } from "./utils.mjs";
|
|
3
|
+
import { ValidationRuleResult } from "./rules.mjs";
|
|
4
|
+
import { EntityMetadata } from "./EntityMetadata.mjs";
|
|
5
|
+
import { Entity } from "./Entity.mjs";
|
|
6
|
+
//#region src/transitions.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Which state transitions of an enum field an `addTransitionRule` cares about.
|
|
9
|
+
*
|
|
10
|
+
* Omitting `from` or `to` matches any state. Guards never run on creation.
|
|
11
|
+
*/
|
|
12
|
+
export interface GuardTransitionMatch<V> {
|
|
13
|
+
from?: V | readonly V[];
|
|
14
|
+
to?: V | readonly V[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Which state transitions of an enum field an `addTransitionReaction` callback handles.
|
|
18
|
+
*
|
|
19
|
+
* Creating an entity with a matching `to` state also matches, unless `from` is set or `onCreate` is `false`.
|
|
20
|
+
*/
|
|
21
|
+
export interface OnTransitionMatch<V> extends GuardTransitionMatch<V> {
|
|
22
|
+
/**
|
|
23
|
+
* Whether `addTransitionReaction` fires when an entity is created with a matching `to` state, defaults to `true`.
|
|
24
|
+
*
|
|
25
|
+
* Entering a state by creation usually needs the same side effects as entering it by a transition, and
|
|
26
|
+
* forgetting them is easy to miss. Set `false` for reactions that only make sense for a transition.
|
|
27
|
+
*/
|
|
28
|
+
onCreate?: boolean;
|
|
29
|
+
/** `commit` runs in `beforeCommit`, i.e. to enqueue jobs; `flush` (the default) runs as a reaction. */
|
|
30
|
+
phase?: "flush" | "commit";
|
|
31
|
+
}
|
|
32
|
+
/** Maps each state to the states it may transition to, i.e. `{ Draft: ["Open"], Open: ["Closed"] }`. */
|
|
33
|
+
export type TransitionTable<V extends PropertyKey> = Partial<Record<V, readonly V[]>>;
|
|
34
|
+
/**
|
|
35
|
+
* The transition a guard or reaction is handling, i.e. `{ from: "DRAFT", to: "OPEN" }`.
|
|
36
|
+
*
|
|
37
|
+
* Guards and callbacks run during reaction passes, after the assignment, so the entity may already be in a
|
|
38
|
+
* later state. This tells them which transition they're handling. `from` is `undefined` for creation.
|
|
39
|
+
*/
|
|
40
|
+
export interface Transition<V> {
|
|
41
|
+
from: V | undefined;
|
|
42
|
+
to: V;
|
|
43
|
+
}
|
|
44
|
+
/** The "from" state of a just-created entity, because `undefined` can be a real field value. */
|
|
45
|
+
export declare const created: unique symbol;
|
|
46
|
+
/** A single recorded transition of a field, with `from` as `created` for creation. */
|
|
47
|
+
export interface TransitionStep {
|
|
48
|
+
from: unknown;
|
|
49
|
+
to: unknown;
|
|
50
|
+
}
|
|
51
|
+
/** An `addTransitionRule` as registered in config, with its `match` still using accessors. */
|
|
52
|
+
export interface TransitionGuardConfig<T extends Entity = Entity> {
|
|
53
|
+
match: GuardTransitionMatch<string>;
|
|
54
|
+
run(entity: T, step: TransitionStep): MaybePromise<ValidationRuleResult>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* An `addTransitionReaction` as registered in config, with its `match` still using accessors.
|
|
58
|
+
*
|
|
59
|
+
* @internal Joist invokes `run`; the application callback does not receive the metrics slot.
|
|
60
|
+
*/
|
|
61
|
+
export interface TransitionCallbackConfig<T extends Entity = Entity, C = unknown> {
|
|
62
|
+
name: string;
|
|
63
|
+
match: OnTransitionMatch<string>;
|
|
64
|
+
run(entity: T, ctx: C, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;
|
|
65
|
+
}
|
|
66
|
+
/** One field's `setTransitions`, `addTransitionRule`, and `addTransitionReaction` config on a single entity type. */
|
|
67
|
+
export interface FieldTransitionsConfig<T extends Entity = Entity, C = unknown> {
|
|
68
|
+
/** The `transitions` table, if any; subtypes add their own tables on their own configs. */
|
|
69
|
+
table?: TransitionTable<string>;
|
|
70
|
+
guards: TransitionGuardConfig<T>[];
|
|
71
|
+
callbacks: TransitionCallbackConfig<T, C>[];
|
|
72
|
+
}
|
|
73
|
+
/** A `match` with accessors converted to codes, so it can be compared to recorded steps. */
|
|
74
|
+
export interface TransitionMatcher {
|
|
75
|
+
/** The allowed previous states, or `undefined` for any state. */
|
|
76
|
+
from: readonly unknown[] | undefined;
|
|
77
|
+
/** The allowed new states, or `undefined` for any state. */
|
|
78
|
+
to: readonly unknown[] | undefined;
|
|
79
|
+
/** Whether creation matches, which is never true when `from` is set. */
|
|
80
|
+
onCreate: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** A guard with its `match` converted to codes. */
|
|
83
|
+
export interface TransitionGuard {
|
|
84
|
+
matcher: TransitionMatcher;
|
|
85
|
+
run(entity: Entity, step: TransitionStep): MaybePromise<ValidationRuleResult>;
|
|
86
|
+
}
|
|
87
|
+
/** A callback with its `match` converted to codes, dispatched only after its transition's guards pass. */
|
|
88
|
+
export interface TransitionCallback {
|
|
89
|
+
name: string;
|
|
90
|
+
phase: "flush" | "commit";
|
|
91
|
+
matcher: TransitionMatcher;
|
|
92
|
+
evaluation: EvaluationSlot;
|
|
93
|
+
run(entity: Entity, ctx: unknown, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;
|
|
94
|
+
}
|
|
95
|
+
/** One field's transition config from an entity type and its base types, with accessors converted to codes. */
|
|
96
|
+
export interface FieldTransitions {
|
|
97
|
+
/** Each table maps a `from` code to its allowed `to` codes; every table must allow a change. */
|
|
98
|
+
tables: ReadonlyMap<unknown, readonly unknown[]>[];
|
|
99
|
+
guards: TransitionGuard[];
|
|
100
|
+
callbacks: TransitionCallback[];
|
|
101
|
+
}
|
|
102
|
+
/** Converts an internal step to the `Transition` that guards and reactions receive. */
|
|
103
|
+
export declare function toTransition(step: TransitionStep): Transition<any>;
|
|
104
|
+
/**
|
|
105
|
+
* Merges the transition config of `meta` and its base types by field, converting accessors to codes.
|
|
106
|
+
*
|
|
107
|
+
* This runs after boot, because the config is written before the enum metadata exists.
|
|
108
|
+
*/
|
|
109
|
+
export declare function buildFieldTransitions(meta: EntityMetadata): Map<string, FieldTransitions>;
|
|
110
|
+
/** Returns whether `step` matches `matcher`'s `from`, `to`, and `onCreate` settings. */
|
|
111
|
+
export declare function matchesTransition(matcher: TransitionMatcher, step: TransitionStep): boolean;
|
|
112
|
+
/** Uses the enum's display name in error messages when there is one, i.e. `Approved` instead of `APPROVED`. */
|
|
113
|
+
export declare function describeValue(meta: EntityMetadata, fieldName: string, value: unknown): string;
|
|
114
|
+
//#endregion
|
|
115
|
+
//# sourceMappingURL=transitions.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.d.mts","names":[],"sources":["../src/transitions.ts"],"mappings":";;;;;;;;;;;iBAWiB,qBAAqB;EACpC,OAAO,aAAa;EACpB,KAAK,aAAa;;;;;;;iBAQH,kBAAkB,WAAW,qBAAqB;;;;;;;EAOjE;;EAEA;;;YAIU,gBAAgB,UAAU,eAAe,QAAQ,OAAO,YAAY;;;;;;;iBAQ/D,WAAW;EAC1B,MAAM;EACN,IAAI;;;qBAIO;;iBAGI;EACf;EACA;;;iBAIe,sBAAsB,UAAU,SAAS;EACxD,OAAO;EACP,IAAI,QAAQ,GAAG,MAAM,iBAAiB,aAAa;;;;;;;iBAQpC,yBAAyB,UAAU,SAAS,QAAQ;EACnE;EACA,OAAO;EACP,IAAI,QAAQ,GAAG,KAAK,GAAG,MAAM,gBAAgB,YAAY,iBAAiB;;;iBAI3D,uBAAuB,UAAU,SAAS,QAAQ;;EAEjE,QAAQ;EACR,QAAQ,sBAAsB;EAC9B,WAAW,yBAAyB,GAAG;;;iBAIxB;;EAEf;;EAEA;;EAEA;;;iBAIe;EACf,SAAS;EACT,IAAI,QAAQ,QAAQ,MAAM,iBAAiB,aAAa;;;iBAIzC;EACf;EACA;EACA,SAAS;EACT,YAAY;EACZ,IAAI,QAAQ,QAAQ,cAAc,MAAM,gBAAgB,YAAY,iBAAiB;;;iBAItE;;EAEf,QAAQ;EACR,QAAQ;EACR,WAAW;;;wBAIG,aAAa,MAAM,iBAAiB;;;;;;wBASpC,sBAAsB,MAAM,iBAAiB,YAAY;;wBA0BzD,kBAAkB,SAAS,mBAAmB,MAAM;;wBAUpD,cAAc,MAAM,gBAAgB,mBAAmB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { EvaluationSlot } from "./metrics/EntityMetrics.js";
|
|
2
|
+
import { fail } from "./utils.js";
|
|
3
|
+
import { getBaseAndSelfMetas } from "./EntityMetadata.js";
|
|
4
|
+
//#region src/transitions.ts
|
|
5
|
+
/** The "from" state of a just-created entity, because `undefined` can be a real field value. */
|
|
6
|
+
const created = Symbol("created");
|
|
7
|
+
/** Converts an internal step to the `Transition` that guards and reactions receive. */
|
|
8
|
+
function toTransition(step) {
|
|
9
|
+
return {
|
|
10
|
+
from: step.from === created ? void 0 : step.from,
|
|
11
|
+
to: step.to
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Merges the transition config of `meta` and its base types by field, converting accessors to codes.
|
|
16
|
+
*
|
|
17
|
+
* This runs after boot, because the config is written before the enum metadata exists.
|
|
18
|
+
*/
|
|
19
|
+
function buildFieldTransitions(meta) {
|
|
20
|
+
const byField = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const m of getBaseAndSelfMetas(meta)) for (const [fieldName, config] of Object.entries(m.config.__data.transitions)) {
|
|
22
|
+
let merged = byField.get(fieldName);
|
|
23
|
+
if (!merged) byField.set(fieldName, merged = {
|
|
24
|
+
tables: [],
|
|
25
|
+
guards: [],
|
|
26
|
+
callbacks: []
|
|
27
|
+
});
|
|
28
|
+
if (config.table) merged.tables.push(toCodesTable(meta, fieldName, config.table));
|
|
29
|
+
for (const { match, run } of config.guards) merged.guards.push({
|
|
30
|
+
matcher: toMatcher(meta, fieldName, match),
|
|
31
|
+
run
|
|
32
|
+
});
|
|
33
|
+
for (const { name, match, run } of config.callbacks) {
|
|
34
|
+
const matcher = toMatcher(meta, fieldName, match);
|
|
35
|
+
merged.callbacks.push({
|
|
36
|
+
name,
|
|
37
|
+
phase: match.phase ?? "flush",
|
|
38
|
+
matcher,
|
|
39
|
+
evaluation: new EvaluationSlot(`${meta.type}.${name}`),
|
|
40
|
+
run
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return byField;
|
|
45
|
+
}
|
|
46
|
+
/** Returns whether `step` matches `matcher`'s `from`, `to`, and `onCreate` settings. */
|
|
47
|
+
function matchesTransition(matcher, step) {
|
|
48
|
+
if (step.from === created) {
|
|
49
|
+
if (!matcher.onCreate) return false;
|
|
50
|
+
} else if (matcher.from && !matcher.from.includes(step.from)) return false;
|
|
51
|
+
return !matcher.to || matcher.to.includes(step.to);
|
|
52
|
+
}
|
|
53
|
+
/** Uses the enum's display name in error messages when there is one, i.e. `Approved` instead of `APPROVED`. */
|
|
54
|
+
function describeValue(meta, fieldName, value) {
|
|
55
|
+
if (value === void 0) return "unset";
|
|
56
|
+
const field = meta.allFields[fieldName];
|
|
57
|
+
return field?.kind === "enum" ? field.enumDetailType.getByCode(value)?.name ?? String(value) : String(value);
|
|
58
|
+
}
|
|
59
|
+
/** Converts a `transitions` table's keys and values to codes, so it can be compared to field values. */
|
|
60
|
+
function toCodesTable(meta, fieldName, table) {
|
|
61
|
+
return new Map(Object.entries(table).map(([from, tos]) => [accessorToCode(meta, fieldName, from), toCodes(meta, fieldName, tos ?? [])]));
|
|
62
|
+
}
|
|
63
|
+
/** Converts a `match`'s accessors to codes. */
|
|
64
|
+
function toMatcher(meta, fieldName, match) {
|
|
65
|
+
return {
|
|
66
|
+
from: toCodes(meta, fieldName, match.from),
|
|
67
|
+
to: toCodes(meta, fieldName, match.to),
|
|
68
|
+
onCreate: match.onCreate !== false && match.from === void 0
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Converts an enum accessor, i.e. `Rejected`, to its code, i.e. `REJECTED`, and fails on anything else. */
|
|
72
|
+
function accessorToCode(meta, fieldName, value) {
|
|
73
|
+
const field = meta.allFields[fieldName];
|
|
74
|
+
if (field?.kind !== "enum") fail(`${meta.type}.${fieldName} is not an enum field, so it can't have transitions`);
|
|
75
|
+
if (typeof value !== "string" || !Object.hasOwn(field.enumType, value)) fail(`Unknown ${meta.type}.${fieldName} accessor ${String(value)}, i.e. use "Draft" for AuthorStatus.Draft`);
|
|
76
|
+
return field.enumType[value];
|
|
77
|
+
}
|
|
78
|
+
/** Converts one or more enum accessors to an array of codes, preserving an omitted match. */
|
|
79
|
+
function toCodes(meta, fieldName, values) {
|
|
80
|
+
if (values === void 0) return void 0;
|
|
81
|
+
return typeof values === "string" ? [accessorToCode(meta, fieldName, values)] : values.map((v) => accessorToCode(meta, fieldName, v));
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { buildFieldTransitions, created, describeValue, matchesTransition, toTransition };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=transitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.js","names":[],"sources":["../src/transitions.ts"],"sourcesContent":["import type { Entity } from \"src/Entity.ts\";\nimport { type EntityMetadata, getBaseAndSelfMetas } from \"src/EntityMetadata.ts\";\nimport { EvaluationSlot } from \"src/metrics/EntityMetrics.ts\";\nimport type { ValidationRuleResult } from \"src/rules.ts\";\nimport { type MaybePromise, fail } from \"src/utils.ts\";\n\n/**\n * Which state transitions of an enum field an `addTransitionRule` cares about.\n *\n * Omitting `from` or `to` matches any state. Guards never run on creation.\n */\nexport interface GuardTransitionMatch<V> {\n from?: V | readonly V[];\n to?: V | readonly V[];\n}\n\n/**\n * Which state transitions of an enum field an `addTransitionReaction` callback handles.\n *\n * Creating an entity with a matching `to` state also matches, unless `from` is set or `onCreate` is `false`.\n */\nexport interface OnTransitionMatch<V> extends GuardTransitionMatch<V> {\n /**\n * Whether `addTransitionReaction` fires when an entity is created with a matching `to` state, defaults to `true`.\n *\n * Entering a state by creation usually needs the same side effects as entering it by a transition, and\n * forgetting them is easy to miss. Set `false` for reactions that only make sense for a transition.\n */\n onCreate?: boolean;\n /** `commit` runs in `beforeCommit`, i.e. to enqueue jobs; `flush` (the default) runs as a reaction. */\n phase?: \"flush\" | \"commit\";\n}\n\n/** Maps each state to the states it may transition to, i.e. `{ Draft: [\"Open\"], Open: [\"Closed\"] }`. */\nexport type TransitionTable<V extends PropertyKey> = Partial<Record<V, readonly V[]>>;\n\n/**\n * The transition a guard or reaction is handling, i.e. `{ from: \"DRAFT\", to: \"OPEN\" }`.\n *\n * Guards and callbacks run during reaction passes, after the assignment, so the entity may already be in a\n * later state. This tells them which transition they're handling. `from` is `undefined` for creation.\n */\nexport interface Transition<V> {\n from: V | undefined;\n to: V;\n}\n\n/** The \"from\" state of a just-created entity, because `undefined` can be a real field value. */\nexport const created: unique symbol = Symbol(\"created\");\n\n/** A single recorded transition of a field, with `from` as `created` for creation. */\nexport interface TransitionStep {\n from: unknown;\n to: unknown;\n}\n\n/** An `addTransitionRule` as registered in config, with its `match` still using accessors. */\nexport interface TransitionGuardConfig<T extends Entity = Entity> {\n match: GuardTransitionMatch<string>;\n run(entity: T, step: TransitionStep): MaybePromise<ValidationRuleResult>;\n}\n\n/**\n * An `addTransitionReaction` as registered in config, with its `match` still using accessors.\n *\n * @internal Joist invokes `run`; the application callback does not receive the metrics slot.\n */\nexport interface TransitionCallbackConfig<T extends Entity = Entity, C = unknown> {\n name: string;\n match: OnTransitionMatch<string>;\n run(entity: T, ctx: C, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;\n}\n\n/** One field's `setTransitions`, `addTransitionRule`, and `addTransitionReaction` config on a single entity type. */\nexport interface FieldTransitionsConfig<T extends Entity = Entity, C = unknown> {\n /** The `transitions` table, if any; subtypes add their own tables on their own configs. */\n table?: TransitionTable<string>;\n guards: TransitionGuardConfig<T>[];\n callbacks: TransitionCallbackConfig<T, C>[];\n}\n\n/** A `match` with accessors converted to codes, so it can be compared to recorded steps. */\nexport interface TransitionMatcher {\n /** The allowed previous states, or `undefined` for any state. */\n from: readonly unknown[] | undefined;\n /** The allowed new states, or `undefined` for any state. */\n to: readonly unknown[] | undefined;\n /** Whether creation matches, which is never true when `from` is set. */\n onCreate: boolean;\n}\n\n/** A guard with its `match` converted to codes. */\nexport interface TransitionGuard {\n matcher: TransitionMatcher;\n run(entity: Entity, step: TransitionStep): MaybePromise<ValidationRuleResult>;\n}\n\n/** A callback with its `match` converted to codes, dispatched only after its transition's guards pass. */\nexport interface TransitionCallback {\n name: string;\n phase: \"flush\" | \"commit\";\n matcher: TransitionMatcher;\n evaluation: EvaluationSlot;\n run(entity: Entity, ctx: unknown, step: TransitionStep, evaluation: EvaluationSlot): MaybePromise<unknown>;\n}\n\n/** One field's transition config from an entity type and its base types, with accessors converted to codes. */\nexport interface FieldTransitions {\n /** Each table maps a `from` code to its allowed `to` codes; every table must allow a change. */\n tables: ReadonlyMap<unknown, readonly unknown[]>[];\n guards: TransitionGuard[];\n callbacks: TransitionCallback[];\n}\n\n/** Converts an internal step to the `Transition` that guards and reactions receive. */\nexport function toTransition(step: TransitionStep): Transition<any> {\n return { from: step.from === created ? undefined : step.from, to: step.to };\n}\n\n/**\n * Merges the transition config of `meta` and its base types by field, converting accessors to codes.\n *\n * This runs after boot, because the config is written before the enum metadata exists.\n */\nexport function buildFieldTransitions(meta: EntityMetadata): Map<string, FieldTransitions> {\n const byField = new Map<string, FieldTransitions>();\n for (const m of getBaseAndSelfMetas(meta)) {\n for (const [fieldName, config] of Object.entries(m.config.__data.transitions)) {\n let merged = byField.get(fieldName);\n if (!merged) byField.set(fieldName, (merged = { tables: [], guards: [], callbacks: [] }));\n if (config.table) merged.tables.push(toCodesTable(meta, fieldName, config.table));\n for (const { match, run } of config.guards) {\n merged.guards.push({ matcher: toMatcher(meta, fieldName, match), run });\n }\n for (const { name, match, run } of config.callbacks) {\n const matcher = toMatcher(meta, fieldName, match);\n merged.callbacks.push({\n name,\n phase: match.phase ?? \"flush\",\n matcher,\n evaluation: new EvaluationSlot(`${meta.type}.${name}`),\n run,\n });\n }\n }\n }\n return byField;\n}\n\n/** Returns whether `step` matches `matcher`'s `from`, `to`, and `onCreate` settings. */\nexport function matchesTransition(matcher: TransitionMatcher, step: TransitionStep): boolean {\n if (step.from === created) {\n if (!matcher.onCreate) return false;\n } else if (matcher.from && !matcher.from.includes(step.from)) {\n return false;\n }\n return !matcher.to || matcher.to.includes(step.to);\n}\n\n/** Uses the enum's display name in error messages when there is one, i.e. `Approved` instead of `APPROVED`. */\nexport function describeValue(meta: EntityMetadata, fieldName: string, value: unknown): string {\n if (value === undefined) return \"unset\";\n const field = meta.allFields[fieldName];\n return field?.kind === \"enum\" ? (field.enumDetailType.getByCode(value)?.name ?? String(value)) : String(value);\n}\n\n/** Converts a `transitions` table's keys and values to codes, so it can be compared to field values. */\nfunction toCodesTable(\n meta: EntityMetadata,\n fieldName: string,\n table: TransitionTable<string>,\n): Map<unknown, readonly unknown[]> {\n return new Map(\n Object.entries(table).map(([from, tos]) => [\n accessorToCode(meta, fieldName, from),\n toCodes(meta, fieldName, tos ?? [])!,\n ]),\n );\n}\n\n/** Converts a `match`'s accessors to codes. */\nfunction toMatcher(meta: EntityMetadata, fieldName: string, match: OnTransitionMatch<string>): TransitionMatcher {\n return {\n from: toCodes(meta, fieldName, match.from),\n to: toCodes(meta, fieldName, match.to),\n // `from` describes a previous state, which a new entity doesn't have\n onCreate: match.onCreate !== false && match.from === undefined,\n };\n}\n\n/** Converts an enum accessor, i.e. `Rejected`, to its code, i.e. `REJECTED`, and fails on anything else. */\nfunction accessorToCode(meta: EntityMetadata, fieldName: string, value: unknown): unknown {\n const field = meta.allFields[fieldName];\n if (field?.kind !== \"enum\") fail(`${meta.type}.${fieldName} is not an enum field, so it can't have transitions`);\n // Only accessors are accepted, even from untyped callers, so every table reads the same way\n if (typeof value !== \"string\" || !Object.hasOwn(field.enumType, value)) {\n fail(`Unknown ${meta.type}.${fieldName} accessor ${String(value)}, i.e. use \"Draft\" for AuthorStatus.Draft`);\n }\n return field.enumType[value];\n}\n\n/** Converts one or more enum accessors to an array of codes, preserving an omitted match. */\nfunction toCodes(\n meta: EntityMetadata,\n fieldName: string,\n values: string | readonly string[] | undefined,\n): unknown[] | undefined {\n if (values === undefined) return undefined;\n return typeof values === \"string\"\n ? [accessorToCode(meta, fieldName, values)]\n : values.map((v) => accessorToCode(meta, fieldName, v));\n}\n"],"mappings":";;;;;AAgDA,MAAa,UAAyB,OAAO,SAAS;;AAmEtD,SAAgB,aAAa,MAAuC;CAClE,OAAO;EAAE,MAAM,KAAK,SAAS,UAAU,KAAA,IAAY,KAAK;EAAM,IAAI,KAAK;CAAG;AAC5E;;;;;;AAOA,SAAgB,sBAAsB,MAAqD;CACzF,MAAM,0BAAU,IAAI,IAA8B;CAClD,KAAK,MAAM,KAAK,oBAAoB,IAAI,GACtC,KAAK,MAAM,CAAC,WAAW,WAAW,OAAO,QAAQ,EAAE,OAAO,OAAO,WAAW,GAAG;EAC7E,IAAI,SAAS,QAAQ,IAAI,SAAS;EAClC,IAAI,CAAC,QAAQ,QAAQ,IAAI,WAAY,SAAS;GAAE,QAAQ,CAAC;GAAG,QAAQ,CAAC;GAAG,WAAW,CAAC;EAAE,CAAE;EACxF,IAAI,OAAO,OAAO,OAAO,OAAO,KAAK,aAAa,MAAM,WAAW,OAAO,KAAK,CAAC;EAChF,KAAK,MAAM,EAAE,OAAO,SAAS,OAAO,QAClC,OAAO,OAAO,KAAK;GAAE,SAAS,UAAU,MAAM,WAAW,KAAK;GAAG;EAAI,CAAC;EAExE,KAAK,MAAM,EAAE,MAAM,OAAO,SAAS,OAAO,WAAW;GACnD,MAAM,UAAU,UAAU,MAAM,WAAW,KAAK;GAChD,OAAO,UAAU,KAAK;IACpB;IACA,OAAO,MAAM,SAAS;IACtB;IACA,YAAY,IAAI,eAAe,GAAG,KAAK,KAAK,GAAG,MAAM;IACrD;GACF,CAAC;EACH;CACF;CAEF,OAAO;AACT;;AAGA,SAAgB,kBAAkB,SAA4B,MAA+B;CAC3F,IAAI,KAAK,SAAS,SACZ;MAAA,CAAC,QAAQ,UAAU,OAAO;CAAA,OACzB,IAAI,QAAQ,QAAQ,CAAC,QAAQ,KAAK,SAAS,KAAK,IAAI,GACzD,OAAO;CAET,OAAO,CAAC,QAAQ,MAAM,QAAQ,GAAG,SAAS,KAAK,EAAE;AACnD;;AAGA,SAAgB,cAAc,MAAsB,WAAmB,OAAwB;CAC7F,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,QAAQ,KAAK,UAAU;CAC7B,OAAO,OAAO,SAAS,SAAU,MAAM,eAAe,UAAU,KAAK,CAAC,EAAE,QAAQ,OAAO,KAAK,IAAK,OAAO,KAAK;AAC/G;;AAGA,SAAS,aACP,MACA,WACA,OACkC;CAClC,OAAO,IAAI,IACT,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,SAAS,CACzC,eAAe,MAAM,WAAW,IAAI,GACpC,QAAQ,MAAM,WAAW,OAAO,CAAC,CAAC,CACpC,CAAC,CACH;AACF;;AAGA,SAAS,UAAU,MAAsB,WAAmB,OAAqD;CAC/G,OAAO;EACL,MAAM,QAAQ,MAAM,WAAW,MAAM,IAAI;EACzC,IAAI,QAAQ,MAAM,WAAW,MAAM,EAAE;EAErC,UAAU,MAAM,aAAa,SAAS,MAAM,SAAS,KAAA;CACvD;AACF;;AAGA,SAAS,eAAe,MAAsB,WAAmB,OAAyB;CACxF,MAAM,QAAQ,KAAK,UAAU;CAC7B,IAAI,OAAO,SAAS,QAAQ,KAAK,GAAG,KAAK,KAAK,GAAG,UAAU,oDAAoD;CAE/G,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,OAAO,MAAM,UAAU,KAAK,GACnE,KAAK,WAAW,KAAK,KAAK,GAAG,UAAU,YAAY,OAAO,KAAK,EAAE,0CAA0C;CAE7G,OAAO,MAAM,SAAS;AACxB;;AAGA,SAAS,QACP,MACA,WACA,QACuB;CACvB,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;CACjC,OAAO,OAAO,WAAW,WACrB,CAAC,eAAe,MAAM,WAAW,MAAM,CAAC,IACxC,OAAO,KAAK,MAAM,eAAe,MAAM,WAAW,CAAC,CAAC;AAC1D"}
|
package/build/trusted.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//#region src/trusted.d.ts
|
|
2
2
|
/** Returns true if we're inside a trusted context, i.e. hooks, reactions, validations, or defaults. */
|
|
3
|
-
declare function isInTrustedContext(): boolean;
|
|
3
|
+
export declare function isInTrustedContext(): boolean;
|
|
4
4
|
/** Runs the given function within a trusted context. */
|
|
5
|
-
declare function runInTrustedContext<T>(fn: () => T): T;
|
|
5
|
+
export declare function runInTrustedContext<T>(fn: () => T): T;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { isInTrustedContext, runInTrustedContext };
|
|
8
7
|
//# sourceMappingURL=trusted.d.cts.map
|
package/build/trusted.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted.d.cts","names":[],"sources":["../src/trusted.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"trusted.d.cts","names":[],"sources":["../src/trusted.ts"],"mappings":";;wBAKgB;;wBAKA,oBAAoB,GAAG,UAAU,IAAI"}
|
package/build/trusted.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//#region src/trusted.d.ts
|
|
2
2
|
/** Returns true if we're inside a trusted context, i.e. hooks, reactions, validations, or defaults. */
|
|
3
|
-
declare function isInTrustedContext(): boolean;
|
|
3
|
+
export declare function isInTrustedContext(): boolean;
|
|
4
4
|
/** Runs the given function within a trusted context. */
|
|
5
|
-
declare function runInTrustedContext<T>(fn: () => T): T;
|
|
5
|
+
export declare function runInTrustedContext<T>(fn: () => T): T;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { isInTrustedContext, runInTrustedContext };
|
|
8
7
|
//# sourceMappingURL=trusted.d.mts.map
|
package/build/trusted.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted.d.mts","names":[],"sources":["../src/trusted.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"trusted.d.mts","names":[],"sources":["../src/trusted.ts"],"mappings":";;wBAKgB;;wBAKA,oBAAoB,GAAG,UAAU,IAAI"}
|
package/build/typeMap.d.cts
CHANGED
|
@@ -18,7 +18,7 @@ import { Entity } from "./Entity.cjs";
|
|
|
18
18
|
*
|
|
19
19
|
* Inspired by Tanstack Router, which uses a similar `declare module` approach.
|
|
20
20
|
*/
|
|
21
|
-
interface TypeMap {}
|
|
21
|
+
export interface TypeMap {}
|
|
22
22
|
/**
|
|
23
23
|
* Returns a key like `"Author"` or `"SmallPublisher"` for looking up types in the `TypeMap`.
|
|
24
24
|
*
|
|
@@ -35,7 +35,7 @@ type TypeMapKey<T> = T extends {
|
|
|
35
35
|
};
|
|
36
36
|
} ? K : never;
|
|
37
37
|
/** The literal type name of an entity, i.e. `"Author"` or `"SmallPublisher"`. */
|
|
38
|
-
type TypeNameOf<T> = TypeMapKey<T>;
|
|
38
|
+
export type TypeNameOf<T> = TypeMapKey<T>;
|
|
39
39
|
/**
|
|
40
40
|
* The literal type name of an entity's root type, i.e. `"Publisher"` for both `Publisher` and
|
|
41
41
|
* `SmallPublisher`.
|
|
@@ -48,41 +48,41 @@ type TypeNameOf<T> = TypeMapKey<T>;
|
|
|
48
48
|
* untracked key `string`, not `never`: `never` means "source-less" and also broke the comparability of
|
|
49
49
|
* `Alias<T>` with `Alias<Entity>`.
|
|
50
50
|
*/
|
|
51
|
-
type RootTypeNameOf<T> = T extends {
|
|
51
|
+
export type RootTypeNameOf<T> = T extends {
|
|
52
52
|
__type: {
|
|
53
53
|
0: infer K extends string;
|
|
54
54
|
};
|
|
55
55
|
} ? K : string;
|
|
56
56
|
/** A helper type to look up `U` in the `TypeMap` for a given entity type `T`. */
|
|
57
|
-
type TypeMapEntry<T, U extends string> = TypeMapKey<T> extends (infer K) ? K extends keyof TypeMap ? U extends keyof TypeMap[K] ? TypeMap[K][U] : unknown : unknown : unknown;
|
|
57
|
+
export type TypeMapEntry<T, U extends string> = TypeMapKey<T> extends (infer K) ? K extends keyof TypeMap ? U extends keyof TypeMap[K] ? TypeMap[K][U] : unknown : unknown : unknown;
|
|
58
58
|
/** Return the `FooOpts` type for the given `Foo` entity. */
|
|
59
|
-
type OptsOf<T> = TypeMapEntry<T, "optsType">;
|
|
59
|
+
export type OptsOf<T> = TypeMapEntry<T, "optsType">;
|
|
60
60
|
/** Return the `FooFields` type for the given `Foo` entity. */
|
|
61
|
-
type FieldsOf<T> = TypeMapEntry<T, "fieldsType">;
|
|
61
|
+
export type FieldsOf<T> = TypeMapEntry<T, "fieldsType">;
|
|
62
62
|
/** Return the physical `FooColumns` type for the given `Foo` entity. */
|
|
63
|
-
type ColumnsOf<T> = TypeMapEntry<T, "columnsType">;
|
|
63
|
+
export type ColumnsOf<T> = TypeMapEntry<T, "columnsType">;
|
|
64
64
|
/** Returns the inheritance strategy, or never for non-inherited entities. */
|
|
65
|
-
type InheritanceTypeOf<T> = TypeMapEntry<T, "inheritanceType">;
|
|
66
|
-
type OptIdsOf<T> = TypeMapEntry<T, "optIdsType">;
|
|
65
|
+
export type InheritanceTypeOf<T> = TypeMapEntry<T, "inheritanceType">;
|
|
66
|
+
export type OptIdsOf<T> = TypeMapEntry<T, "optIdsType">;
|
|
67
67
|
/** Pulls the entity query type out of a given entity type T. */
|
|
68
|
-
type FilterOf<T> = TypeMapEntry<T, "filterType">;
|
|
68
|
+
export type FilterOf<T> = TypeMapEntry<T, "filterType">;
|
|
69
69
|
/** Pulls the entity GraphQL query type out of a given entity type T. */
|
|
70
|
-
type GraphQLFilterOf<T> = TypeMapEntry<T, "gqlFilterType">;
|
|
70
|
+
export type GraphQLFilterOf<T> = TypeMapEntry<T, "gqlFilterType">;
|
|
71
71
|
/** Pulls the entity order type out of a given entity type T. */
|
|
72
|
-
type OrderOf<T> = TypeMapEntry<T, "orderType">;
|
|
72
|
+
export type OrderOf<T> = TypeMapEntry<T, "orderType">;
|
|
73
73
|
/** Returns the factory "extras" type, like `withDerivedField`. */
|
|
74
|
-
type FactoryExtrasOf<T> = TypeMapEntry<T, "factoryExtrasType">;
|
|
74
|
+
export type FactoryExtrasOf<T> = TypeMapEntry<T, "factoryExtrasType">;
|
|
75
75
|
/**
|
|
76
76
|
* Returns the opts of the entity's `newEntity` factory method, as exists in the actual file.
|
|
77
77
|
*
|
|
78
78
|
* This is because `FactoryOpts` is a set of defaults, but the user can customize it if they want.
|
|
79
79
|
*/
|
|
80
|
-
type ActualFactoryOpts<T> = TypeMapEntry<T, "factoryOptsType">;
|
|
80
|
+
export type ActualFactoryOpts<T> = TypeMapEntry<T, "factoryOptsType">;
|
|
81
81
|
/** Return the `Foo` type for a given `Foo` entity constructor. */
|
|
82
|
-
type EntityOf<C> = C extends (new (em: EntityManager, opts: any) => infer T) ? T : never;
|
|
82
|
+
export type EntityOf<C> = C extends (new (em: EntityManager, opts: any) => infer T) ? T : never;
|
|
83
83
|
type RelationsKeysOf<T> = { [K in keyof OptsOf<T>]: OptsOf<T>[K] extends Entity[] | undefined ? K : never; }[keyof OptsOf<T>];
|
|
84
84
|
/** Return the Relation keys from `FooOpt` type, given a `Foo` entity */
|
|
85
|
-
type RelationsOf<T extends Entity> = { [K in RelationsKeysOf<T>]: NonNullable<OptsOf<T>[K]>; };
|
|
85
|
+
export type RelationsOf<T extends Entity> = { [K in RelationsKeysOf<T>]: NonNullable<OptsOf<T>[K]>; };
|
|
86
86
|
//#endregion
|
|
87
|
-
export {
|
|
87
|
+
export {};
|
|
88
88
|
//# sourceMappingURL=typeMap.d.cts.map
|
package/build/typeMap.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeMap.d.cts","names":[],"sources":["../src/typeMap.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"typeMap.d.cts","names":[],"sources":["../src/typeMap.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAoBiB;;;;;;;KAQZ,WAAW,KAAK;EAAY;IAAU,SAAS;;IAAQ,IAAI;EAAY;IAAU,SAAS;;IAAQ;;YAG3F,WAAW,KAAK,WAAW;;;;;;;;;;;;;YAc3B,eAAe,KAAK;EAAY;IAAU,SAAS;;IAAuB;;YAG1E,aAAa,GAAG,oBAC1B,WAAW,kBAAiB,KACxB,gBAAgB,UACd,gBAAgB,QAAQ,KACtB,QAAQ,GAAG;;YAMT,OAAO,KAAK,aAAa;;YAGzB,SAAS,KAAK,aAAa;;YAG3B,UAAU,KAAK,aAAa;;YAG5B,kBAAkB,KAAK,aAAa;YAEpC,SAAS,KAAK,aAAa;;YAG3B,SAAS,KAAK,aAAa;;YAG3B,gBAAgB,KAAK,aAAa;;YAGlC,QAAQ,KAAK,aAAa;;YAG1B,gBAAgB,KAAK,aAAa;;;;;;YAOlC,kBAAkB,KAAK,aAAa;;YAGpC,SAAS,KAAK,gBAAe,IAAI,eAAe,oBAAoB,KAAI;KAE/E,gBAAgB,QAClB,WAAW,OAAO,KAAK,OAAO,GAAG,WAAW,uBAAuB,mBAC9D,OAAO;;YAGH,YAAY,UAAU,aAC/B,KAAK,gBAAgB,KAAK,YAAY,OAAO,GAAG"}
|