joist-core 2.4.0-next.4 → 2.4.0-next.41
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 +64 -20
- package/build/EntityManager.cjs.map +1 -1
- package/build/EntityManager.d.cts +86 -53
- package/build/EntityManager.d.cts.map +1 -1
- package/build/EntityManager.d.mts +86 -53
- package/build/EntityManager.d.mts.map +1 -1
- package/build/EntityManager.js +64 -22
- 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 +39 -36
- package/build/EntityMetadata.d.cts.map +1 -1
- package/build/EntityMetadata.d.mts +39 -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 +23 -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 +23 -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.d.cts +2 -3
- package/build/batchloaders/oneToManyBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.d.mts +2 -3
- package/build/batchloaders/oneToManyBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.d.cts +2 -3
- package/build/batchloaders/oneToOneBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.d.mts +2 -3
- package/build/batchloaders/oneToOneBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/populateBatchLoader.cjs +2 -2
- 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/populateBatchLoader.js +2 -2
- 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.cjs +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/recursiveM2mBatchLoader.js +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.map +1 -1
- package/build/changes.d.cts +9 -10
- package/build/changes.d.cts.map +1 -1
- package/build/changes.d.mts +9 -10
- package/build/changes.d.mts.map +1 -1
- package/build/changes.js.map +1 -1
- package/build/config.cjs +75 -1
- package/build/config.cjs.map +1 -1
- package/build/config.d.cts +99 -17
- package/build/config.d.cts.map +1 -1
- package/build/config.d.mts +99 -17
- package/build/config.d.mts.map +1 -1
- package/build/config.js +75 -1
- package/build/config.js.map +1 -1
- package/build/configure.cjs +6 -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 +6 -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 +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 +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 +2 -2
- 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 +2 -2
- package/build/defaults.js.map +1 -1
- package/build/drivers/Driver.d.cts +2 -3
- package/build/drivers/Driver.d.cts.map +1 -1
- package/build/drivers/Driver.d.mts +2 -3
- package/build/drivers/Driver.d.mts.map +1 -1
- package/build/drivers/EntityWriter.d.cts +7 -7
- package/build/drivers/EntityWriter.d.cts.map +1 -1
- package/build/drivers/EntityWriter.d.mts +7 -7
- package/build/drivers/EntityWriter.d.mts.map +1 -1
- package/build/drivers/IdAssigner.cjs.map +1 -1
- package/build/drivers/IdAssigner.d.cts +5 -5
- package/build/drivers/IdAssigner.d.cts.map +1 -1
- package/build/drivers/IdAssigner.d.mts +5 -5
- package/build/drivers/IdAssigner.d.mts.map +1 -1
- package/build/drivers/IdAssigner.js.map +1 -1
- package/build/drivers/driverApi.d.cts +2 -3
- package/build/drivers/driverApi.d.cts.map +1 -1
- package/build/drivers/driverApi.d.mts +2 -3
- package/build/drivers/driverApi.d.mts.map +1 -1
- package/build/fields.cjs +1 -0
- package/build/fields.cjs.map +1 -1
- package/build/fields.d.cts +6 -7
- package/build/fields.d.cts.map +1 -1
- package/build/fields.d.mts +6 -7
- package/build/fields.d.mts.map +1 -1
- package/build/fields.js +1 -0
- 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/Todo.d.cts +5 -6
- package/build/flush/Todo.d.cts.map +1 -1
- package/build/flush/Todo.d.mts +5 -6
- package/build/flush/Todo.d.mts.map +1 -1
- package/build/getProperties.d.cts +3 -4
- package/build/getProperties.d.cts.map +1 -1
- package/build/getProperties.d.mts +3 -4
- package/build/getProperties.d.mts.map +1 -1
- package/build/index.cjs +14 -8
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +20 -19
- package/build/index.d.cts.map +1 -1
- package/build/index.d.mts +20 -19
- package/build/index.d.mts.map +1 -1
- package/build/index.js +14 -11
- package/build/index.js.map +1 -1
- package/build/json.cjs +3 -3
- 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/json.js +3 -3
- package/build/keys.d.cts +27 -27
- package/build/keys.d.cts.map +1 -1
- package/build/keys.d.mts +27 -27
- package/build/keys.d.mts.map +1 -1
- package/build/loading/HintTree.d.cts +3 -4
- package/build/loading/HintTree.d.cts.map +1 -1
- package/build/loading/HintTree.d.mts +3 -4
- package/build/loading/HintTree.d.mts.map +1 -1
- package/build/loading/IsLoadedCache.cjs.map +1 -1
- package/build/loading/IsLoadedCache.d.cts +2 -3
- package/build/loading/IsLoadedCache.d.cts.map +1 -1
- package/build/loading/IsLoadedCache.d.mts +2 -3
- package/build/loading/IsLoadedCache.d.mts.map +1 -1
- package/build/loading/IsLoadedCache.js.map +1 -1
- package/build/loading/loadHints.cjs +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/loadHints.js +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.cjs +2 -2
- 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/loading/withLoaded.js +2 -2
- package/build/logging/FactoryLogger.d.cts +3 -4
- package/build/logging/FactoryLogger.d.cts.map +1 -1
- package/build/logging/FactoryLogger.d.mts +3 -4
- package/build/logging/FactoryLogger.d.mts.map +1 -1
- package/build/logging/FieldLogger.cjs.map +1 -1
- package/build/logging/FieldLogger.d.cts +4 -5
- package/build/logging/FieldLogger.d.cts.map +1 -1
- package/build/logging/FieldLogger.d.mts +4 -5
- package/build/logging/FieldLogger.d.mts.map +1 -1
- package/build/logging/FieldLogger.js.map +1 -1
- package/build/logging/ReactionLogger.d.cts +7 -7
- package/build/logging/ReactionLogger.d.cts.map +1 -1
- package/build/logging/ReactionLogger.d.mts +7 -7
- package/build/logging/ReactionLogger.d.mts.map +1 -1
- package/build/newEntity.cjs.map +1 -1
- package/build/newEntity.d.cts +4 -5
- package/build/newEntity.d.cts.map +1 -1
- package/build/newEntity.d.mts +4 -5
- package/build/newEntity.d.mts.map +1 -1
- package/build/newEntity.js.map +1 -1
- package/build/newTestInstance.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.collectionJoins.d.cts +1 -2
- package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -1
- package/build/queries/find/QueryParser.collectionJoins.d.mts +1 -2
- package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -1
- package/build/queries/find/QueryParser.d.cts +18 -18
- package/build/queries/find/QueryParser.d.cts.map +1 -1
- package/build/queries/find/QueryParser.d.mts +18 -18
- package/build/queries/find/QueryParser.d.mts.map +1 -1
- package/build/queries/find/QueryParser.pruning.d.cts +2 -3
- package/build/queries/find/QueryParser.pruning.d.cts.map +1 -1
- package/build/queries/find/QueryParser.pruning.d.mts +2 -3
- package/build/queries/find/QueryParser.pruning.d.mts.map +1 -1
- package/build/queries/find/QueryVisitor.d.cts +4 -4
- package/build/queries/find/QueryVisitor.d.cts.map +1 -1
- package/build/queries/find/QueryVisitor.d.mts +4 -4
- package/build/queries/find/QueryVisitor.d.mts.map +1 -1
- package/build/queries/find/buildFindQuery.d.cts +3 -3
- package/build/queries/find/buildFindQuery.d.cts.map +1 -1
- package/build/queries/find/buildFindQuery.d.mts +3 -3
- package/build/queries/find/buildFindQuery.d.mts.map +1 -1
- package/build/queries/find/scopes.cjs.map +1 -1
- package/build/queries/find/scopes.d.cts +12 -13
- package/build/queries/find/scopes.d.cts.map +1 -1
- package/build/queries/find/scopes.d.mts +12 -13
- package/build/queries/find/scopes.d.mts.map +1 -1
- package/build/queries/find/scopes.js.map +1 -1
- package/build/queries/parsedConditions.d.cts +7 -8
- package/build/queries/parsedConditions.d.cts.map +1 -1
- package/build/queries/parsedConditions.d.mts +7 -8
- package/build/queries/parsedConditions.d.mts.map +1 -1
- package/build/queries/renderConditions.d.cts +3 -4
- package/build/queries/renderConditions.d.cts.map +1 -1
- package/build/queries/renderConditions.d.mts +3 -4
- package/build/queries/renderConditions.d.mts.map +1 -1
- package/build/queries/skipCondition.d.cts +1 -2
- package/build/queries/skipCondition.d.cts.map +1 -1
- package/build/queries/skipCondition.d.mts +1 -2
- package/build/queries/skipCondition.d.mts.map +1 -1
- package/build/queries/sql/AliasAssigner.cjs.map +1 -1
- package/build/queries/sql/AliasAssigner.d.cts +1 -2
- package/build/queries/sql/AliasAssigner.d.cts.map +1 -1
- package/build/queries/sql/AliasAssigner.d.mts +1 -2
- package/build/queries/sql/AliasAssigner.d.mts.map +1 -1
- package/build/queries/sql/AliasAssigner.js.map +1 -1
- package/build/queries/sql/Expr.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 +4 -9
- package/build/queries/sql/execute.cjs.map +1 -1
- package/build/queries/sql/execute.d.cts +45 -28
- package/build/queries/sql/execute.d.cts.map +1 -1
- package/build/queries/sql/execute.d.mts +45 -28
- package/build/queries/sql/execute.d.mts.map +1 -1
- package/build/queries/sql/execute.js +5 -10
- 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 +59 -23
- package/build/queries/sql/query.cjs.map +1 -1
- package/build/queries/sql/query.d.cts +108 -77
- package/build/queries/sql/query.d.cts.map +1 -1
- package/build/queries/sql/query.d.mts +108 -77
- package/build/queries/sql/query.d.mts.map +1 -1
- package/build/queries/sql/query.js +58 -23
- package/build/queries/sql/query.js.map +1 -1
- package/build/queries/unnest.d.cts +2 -3
- package/build/queries/unnest.d.cts.map +1 -1
- package/build/queries/unnest.d.mts +2 -3
- package/build/queries/unnest.d.mts.map +1 -1
- package/build/queries/valueFilters.d.cts +5 -6
- package/build/queries/valueFilters.d.cts.map +1 -1
- package/build/queries/valueFilters.d.mts +5 -6
- package/build/queries/valueFilters.d.mts.map +1 -1
- package/build/reactivity/ReactionsManager.cjs +168 -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 +169 -3
- package/build/reactivity/ReactionsManager.js.map +1 -1
- package/build/reactivity/reactiveHints.cjs +3 -3
- package/build/reactivity/reactiveHints.cjs.map +1 -1
- package/build/reactivity/reactiveHints.d.cts +18 -18
- package/build/reactivity/reactiveHints.d.cts.map +1 -1
- package/build/reactivity/reactiveHints.d.mts +18 -18
- package/build/reactivity/reactiveHints.d.mts.map +1 -1
- package/build/reactivity/reactiveHints.js +3 -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.map +1 -1
- package/build/relations/AsyncProperty.d.cts +5 -6
- package/build/relations/AsyncProperty.d.cts.map +1 -1
- package/build/relations/AsyncProperty.d.mts +5 -6
- package/build/relations/AsyncProperty.d.mts.map +1 -1
- package/build/relations/AsyncProperty.js.map +1 -1
- package/build/relations/AsyncReactiveField.cjs +3 -3
- package/build/relations/AsyncReactiveField.cjs.map +1 -1
- package/build/relations/AsyncReactiveField.d.cts +4 -5
- package/build/relations/AsyncReactiveField.d.cts.map +1 -1
- package/build/relations/AsyncReactiveField.d.mts +4 -5
- package/build/relations/AsyncReactiveField.d.mts.map +1 -1
- package/build/relations/AsyncReactiveField.js +3 -3
- package/build/relations/AsyncReactiveField.js.map +1 -1
- package/build/relations/Collection.d.cts +4 -5
- package/build/relations/Collection.d.cts.map +1 -1
- package/build/relations/Collection.d.mts +4 -5
- package/build/relations/Collection.d.mts.map +1 -1
- package/build/relations/CustomCollection.cjs.map +1 -1
- package/build/relations/CustomCollection.d.cts +3 -4
- package/build/relations/CustomCollection.d.cts.map +1 -1
- package/build/relations/CustomCollection.d.mts +3 -4
- package/build/relations/CustomCollection.d.mts.map +1 -1
- package/build/relations/CustomCollection.js.map +1 -1
- package/build/relations/CustomReference.cjs.map +1 -1
- package/build/relations/CustomReference.d.cts +3 -4
- package/build/relations/CustomReference.d.cts.map +1 -1
- package/build/relations/CustomReference.d.mts +3 -4
- package/build/relations/CustomReference.d.mts.map +1 -1
- package/build/relations/CustomReference.js.map +1 -1
- package/build/relations/EnumCollection.cjs.map +1 -1
- package/build/relations/EnumCollection.d.cts +5 -5
- package/build/relations/EnumCollection.d.cts.map +1 -1
- package/build/relations/EnumCollection.d.mts +5 -5
- package/build/relations/EnumCollection.d.mts.map +1 -1
- package/build/relations/EnumCollection.js.map +1 -1
- package/build/relations/LargeCollection.d.cts +1 -2
- package/build/relations/LargeCollection.d.cts.map +1 -1
- package/build/relations/LargeCollection.d.mts +1 -2
- package/build/relations/LargeCollection.d.mts.map +1 -1
- package/build/relations/LazyField.cjs +14 -0
- 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 +14 -0
- package/build/relations/LazyField.js.map +1 -1
- package/build/relations/ManyToManyCollection.cjs.map +1 -1
- package/build/relations/ManyToManyCollection.d.cts +2 -3
- package/build/relations/ManyToManyCollection.d.cts.map +1 -1
- package/build/relations/ManyToManyCollection.d.mts +2 -3
- package/build/relations/ManyToManyCollection.d.mts.map +1 -1
- package/build/relations/ManyToManyCollection.js.map +1 -1
- package/build/relations/ManyToManyLargeCollection.d.cts +2 -3
- package/build/relations/ManyToManyLargeCollection.d.cts.map +1 -1
- package/build/relations/ManyToManyLargeCollection.d.mts +2 -3
- package/build/relations/ManyToManyLargeCollection.d.mts.map +1 -1
- package/build/relations/ManyToOneReference.cjs.map +1 -1
- package/build/relations/ManyToOneReference.d.cts +6 -7
- package/build/relations/ManyToOneReference.d.cts.map +1 -1
- package/build/relations/ManyToOneReference.d.mts +6 -7
- package/build/relations/ManyToOneReference.d.mts.map +1 -1
- package/build/relations/ManyToOneReference.js.map +1 -1
- package/build/relations/OneToManyCollection.cjs.map +1 -1
- package/build/relations/OneToManyCollection.d.cts +2 -3
- package/build/relations/OneToManyCollection.d.cts.map +1 -1
- package/build/relations/OneToManyCollection.d.mts +2 -3
- package/build/relations/OneToManyCollection.d.mts.map +1 -1
- package/build/relations/OneToManyCollection.js.map +1 -1
- package/build/relations/OneToManyLargeCollection.cjs.map +1 -1
- package/build/relations/OneToManyLargeCollection.d.cts +2 -3
- package/build/relations/OneToManyLargeCollection.d.cts.map +1 -1
- package/build/relations/OneToManyLargeCollection.d.mts +2 -3
- package/build/relations/OneToManyLargeCollection.d.mts.map +1 -1
- package/build/relations/OneToManyLargeCollection.js.map +1 -1
- package/build/relations/OneToOneReference.cjs.map +1 -1
- package/build/relations/OneToOneReference.d.cts +7 -7
- package/build/relations/OneToOneReference.d.cts.map +1 -1
- package/build/relations/OneToOneReference.d.mts +7 -7
- package/build/relations/OneToOneReference.d.mts.map +1 -1
- package/build/relations/OneToOneReference.js.map +1 -1
- package/build/relations/PolymorphicReference.cjs.map +1 -1
- package/build/relations/PolymorphicReference.d.cts +4 -5
- package/build/relations/PolymorphicReference.d.cts.map +1 -1
- package/build/relations/PolymorphicReference.d.mts +4 -5
- package/build/relations/PolymorphicReference.d.mts.map +1 -1
- package/build/relations/PolymorphicReference.js.map +1 -1
- package/build/relations/PropertySymbols.d.cts +1 -2
- package/build/relations/PropertySymbols.d.cts.map +1 -1
- package/build/relations/PropertySymbols.d.mts +1 -2
- package/build/relations/PropertySymbols.d.mts.map +1 -1
- package/build/relations/ReactiveField.cjs +2 -2
- package/build/relations/ReactiveField.cjs.map +1 -1
- package/build/relations/ReactiveField.d.cts +4 -5
- package/build/relations/ReactiveField.d.cts.map +1 -1
- package/build/relations/ReactiveField.d.mts +4 -5
- package/build/relations/ReactiveField.d.mts.map +1 -1
- package/build/relations/ReactiveField.js +2 -2
- package/build/relations/ReactiveField.js.map +1 -1
- package/build/relations/ReactiveGetter.cjs.map +1 -1
- package/build/relations/ReactiveGetter.d.cts +4 -5
- package/build/relations/ReactiveGetter.d.cts.map +1 -1
- package/build/relations/ReactiveGetter.d.mts +4 -5
- package/build/relations/ReactiveGetter.d.mts.map +1 -1
- package/build/relations/ReactiveGetter.js.map +1 -1
- package/build/relations/ReactiveManyToMany.cjs +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.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.cts +4 -5
- package/build/relations/ReactiveManyToManyOtherSide.d.cts.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.mts +4 -5
- package/build/relations/ReactiveManyToManyOtherSide.d.mts.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.js.map +1 -1
- package/build/relations/ReactiveReference.cjs +1 -1
- package/build/relations/ReactiveReference.cjs.map +1 -1
- package/build/relations/ReactiveReference.d.cts +5 -6
- package/build/relations/ReactiveReference.d.cts.map +1 -1
- package/build/relations/ReactiveReference.d.mts +5 -6
- package/build/relations/ReactiveReference.d.mts.map +1 -1
- package/build/relations/ReactiveReference.js +1 -1
- package/build/relations/ReactiveReference.js.map +1 -1
- package/build/relations/ReadOnlyCollection.d.cts +4 -5
- package/build/relations/ReadOnlyCollection.d.cts.map +1 -1
- package/build/relations/ReadOnlyCollection.d.mts +4 -5
- package/build/relations/ReadOnlyCollection.d.mts.map +1 -1
- package/build/relations/RecursiveCollection.cjs +3 -3
- 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 +3 -3
- package/build/relations/RecursiveCollection.js.map +1 -1
- package/build/relations/RecursiveCycleError.d.cts +2 -2
- package/build/relations/RecursiveCycleError.d.cts.map +1 -1
- package/build/relations/RecursiveCycleError.d.mts +2 -2
- package/build/relations/RecursiveCycleError.d.mts.map +1 -1
- package/build/relations/Reference.d.cts +5 -5
- package/build/relations/Reference.d.cts.map +1 -1
- package/build/relations/Reference.d.mts +5 -5
- package/build/relations/Reference.d.mts.map +1 -1
- package/build/relations/ReferenceSymbols.d.cts +1 -2
- package/build/relations/ReferenceSymbols.d.cts.map +1 -1
- package/build/relations/ReferenceSymbols.d.mts +1 -2
- package/build/relations/ReferenceSymbols.d.mts.map +1 -1
- package/build/relations/Relation.d.cts +3 -3
- package/build/relations/Relation.d.cts.map +1 -1
- package/build/relations/Relation.d.mts +3 -3
- package/build/relations/Relation.d.mts.map +1 -1
- package/build/relations/RelationSymbols.d.cts +2 -3
- package/build/relations/RelationSymbols.d.cts.map +1 -1
- package/build/relations/RelationSymbols.d.mts +2 -3
- package/build/relations/RelationSymbols.d.mts.map +1 -1
- package/build/relations/hasAsyncMethod.cjs.map +1 -1
- package/build/relations/hasAsyncMethod.d.cts +6 -6
- package/build/relations/hasAsyncMethod.d.cts.map +1 -1
- package/build/relations/hasAsyncMethod.d.mts +6 -6
- package/build/relations/hasAsyncMethod.d.mts.map +1 -1
- package/build/relations/hasAsyncMethod.js.map +1 -1
- package/build/relations/hasManyDerived.d.cts +2 -2
- package/build/relations/hasManyDerived.d.cts.map +1 -1
- package/build/relations/hasManyDerived.d.mts +2 -2
- package/build/relations/hasManyDerived.d.mts.map +1 -1
- package/build/relations/hasManyThrough.d.cts +1 -2
- package/build/relations/hasManyThrough.d.cts.map +1 -1
- package/build/relations/hasManyThrough.d.mts +1 -2
- package/build/relations/hasManyThrough.d.mts.map +1 -1
- package/build/relations/hasOneDerived.d.cts +1 -2
- package/build/relations/hasOneDerived.d.cts.map +1 -1
- package/build/relations/hasOneDerived.d.mts +1 -2
- package/build/relations/hasOneDerived.d.mts.map +1 -1
- package/build/relations/hasOneThrough.d.cts +1 -2
- package/build/relations/hasOneThrough.d.cts.map +1 -1
- package/build/relations/hasOneThrough.d.mts +1 -2
- package/build/relations/hasOneThrough.d.mts.map +1 -1
- package/build/relations/hasProperty.cjs +2 -2
- 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 +2 -2
- package/build/relations/hasProperty.js.map +1 -1
- package/build/relations/index.cjs +5 -5
- package/build/relations/index.js +5 -5
- 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.d.cts +20 -20
- package/build/rules.d.cts.map +1 -1
- package/build/rules.d.mts +20 -20
- package/build/rules.d.mts.map +1 -1
- package/build/runtimeConfig.d.cts +4 -5
- package/build/runtimeConfig.d.cts.map +1 -1
- package/build/runtimeConfig.d.mts +4 -5
- package/build/runtimeConfig.d.mts.map +1 -1
- package/build/serde/TypeInfo.d.cts +3 -4
- package/build/serde/TypeInfo.d.cts.map +1 -1
- package/build/serde/TypeInfo.d.mts +3 -4
- package/build/serde/TypeInfo.d.mts.map +1 -1
- package/build/serde/columns.d.cts +2 -3
- package/build/serde/columns.d.cts.map +1 -1
- package/build/serde/columns.d.mts +2 -3
- package/build/serde/columns.d.mts.map +1 -1
- package/build/serde/fieldSerde.d.cts +9 -9
- package/build/serde/fieldSerde.d.cts.map +1 -1
- package/build/serde/fieldSerde.d.mts +9 -9
- package/build/serde/fieldSerde.d.mts.map +1 -1
- package/build/serde/serde.cjs +35 -0
- package/build/serde/serde.cjs.map +1 -1
- package/build/serde/serde.d.cts +37 -19
- package/build/serde/serde.d.cts.map +1 -1
- package/build/serde/serde.d.mts +37 -19
- package/build/serde/serde.d.mts.map +1 -1
- package/build/serde/serde.js +35 -1
- package/build/serde/serde.js.map +1 -1
- package/build/serde/temporal.d.cts +5 -5
- package/build/serde/temporal.d.cts.map +1 -1
- package/build/serde/temporal.d.mts +5 -5
- package/build/serde/temporal.d.mts.map +1 -1
- package/build/serde/temporalMappers.d.cts +4 -5
- package/build/serde/temporalMappers.d.cts.map +1 -1
- package/build/serde/temporalMappers.d.mts +4 -5
- package/build/serde/temporalMappers.d.mts.map +1 -1
- package/build/transitions.cjs +89 -0
- package/build/transitions.cjs.map +1 -0
- package/build/transitions.d.cts +109 -0
- package/build/transitions.d.cts.map +1 -0
- package/build/transitions.d.mts +109 -0
- package/build/transitions.d.mts.map +1 -0
- package/build/transitions.js +84 -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.d.cts +4 -4
- package/build/upsert.d.cts.map +1 -1
- package/build/upsert.d.mts +4 -4
- package/build/upsert.d.mts.map +1 -1
- package/build/utils.d.cts +27 -28
- package/build/utils.d.cts.map +1 -1
- package/build/utils.d.mts +27 -28
- package/build/utils.d.mts.map +1 -1
- package/package.json +6 -6
package/build/EntityMetadata.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_configure = require("./configure.cjs");
|
|
3
|
-
require("./config.cjs");
|
|
4
3
|
require("./EntityManager.cjs");
|
|
5
4
|
const require_Entity = require("./Entity.cjs");
|
|
6
5
|
const require_BaseEntity = require("./BaseEntity.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityMetadata.cjs","names":["getInstanceData","getMetadataForType","isEntity"],"sources":["../src/EntityMetadata.ts"],"sourcesContent":["import { getInstanceData } from \"src/BaseEntity.ts\";\nimport { type ConfigApi, type Reactable, type ReactiveRule } from \"src/config.ts\";\nimport { getMetadataForType } from \"src/configure.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, type TimestampFields } from \"src/EntityManager.ts\";\nimport { type EnumMetadata } from \"src/EnumMetadata.ts\";\nimport type { DeepNew } from \"src/loading/loadHints.ts\";\nimport type { Column, ColumnDescriptors } from \"src/serde/columns.ts\";\nimport type { FieldSerde, PolymorphicKeySerde } from \"src/serde/fieldSerde.ts\";\n\nexport function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;\nexport function getMetadata<T extends Entity>(\n param: T | MaybeAbstractEntityConstructor<T> | EntityMetadata,\n): EntityMetadata {\n if (!param) throw new Error(`Cannot getMetadata of ${param}`);\n return (\n typeof param === \"function\" ? (param as any).metadata : \"cstr\" in param ? param : getInstanceData(param).metadata\n ) as EntityMetadata;\n}\n\n/** Returns the metadata layer that declares `fieldName`, i.e. `Task.tags` for `TaskOld.tags`. */\nexport function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata {\n if (!meta.allFields[fieldName]) throw new Error(`Field '${fieldName}' not found on ${meta.type}`);\n // I.e. `TaskOld.tags` is an STI-inherited `Task.tags` and should walk up, but `SmallPublisherGroup.publishers`\n // is a CTI-specialized `PublisherGroup.publishers` and should stay on `SmallPublisherGroup`.\n while (!(fieldName in meta.fields) && meta.allFields[fieldName]?.specialized !== true && meta.baseType) {\n meta = getMetadataForType(meta.baseType);\n }\n return meta;\n}\n\n/**\n * Runtime metadata about an entity.\n *\n * The `joist-codegen` step will generate this by reading the database schema at build/codegen\n * time, along with any customizations in `joist-config.json`.\n *\n * Note: This has no generic, like `T extends Entity`, because `Entity<IdType>` i.e. with\n * an unknown string/id type, causes issues when we want to generically mix `EntityMetadata`\n * of different types, that even liberally using `EntityMetadata<any>` did not avoid.\n */\nexport interface EntityMetadata<T extends Entity = any> {\n cstr: MaybeAbstractEntityConstructor<T>;\n type: string;\n /** How the domain entity's id is represented. */\n idType: \"tagged-string\" | \"untagged-string\" | \"number\";\n /** The database column type, i.e. used to do `::type` casts in Postgres. */\n idDbType: \"bigint\" | \"int\" | \"uuid\" | \"text\";\n tableName: string;\n /** Whether codegen verified this table is a supported SQL mutation target; does not gate reads. */\n supportsEmExecute?: boolean;\n /** If we're a subtype, our immediate base type's name, e.g. for `SmallPublisher` this would be `Publisher`. */\n baseType: string | undefined;\n inheritanceType?: \"sti\" | \"cti\" | undefined;\n /** Indicates the field to use to derive which subtype to instantiate; only set on the base meta. */\n stiDiscriminatorField?: string;\n /** The discriminator enum value for this subtype; only set on sub metas. */\n stiDiscriminatorValue?: number;\n /** Whether this type is abstract (cannot be instantiated directly). */\n ctiAbstract?: boolean;\n tagName: string;\n fields: Record<string, Field>;\n /** Physical storage descriptors, without CTI base columns; STI metadata shares its base table. */\n columns: ColumnDescriptors;\n allFields: Record<string, Field & { aliasSuffix: string; specialized?: true }>;\n /** Usually polys are in `allFields`, but we pull the components out for comp-specific finds, like `parentBook`. */\n polyComponentFields?: Record<string, Field & { aliasSuffix: string }>;\n // Using `any` to avoid type errors between BaseType.metadata & SubType.metadata static fields\n config: ConfigApi<any, any>;\n /** The lazy list of non-read-only reactables for this metadata and its base types. */\n reactables?: Reactable[];\n /** The lazy lookup of non-read-only reactables by source field name. */\n reactablesByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of all reactables for this metadata and its base types. */\n reactablesIncludingReadOnly?: Reactable[];\n /** The lazy lookup of all reactables by source field name. */\n reactablesIncludingReadOnlyByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of reactive validation rules for this metadata and its subtypes. */\n reactiveRules?: ReactiveRule[];\n /** The lazy list of reactive *commit* rules (post-flush/pre-commit) for this metadata and its subtypes. */\n reactiveCommitRules?: ReactiveRule[];\n /** Lazily-cached: whether flushing an entity of this type could trigger any `addCommitRule` work. */\n hasCommitRules?: boolean;\n /** The lazily-cached set of own `lazy` primitive field names, i.e. columns excluded from the default SELECT. */\n lazyFieldNames?: ReadonlySet<string>;\n /** The lazily-cached list of sync-derived (`hasReactiveField`-less) field names, recalced during flush. */\n syncDerivedFields?: string[];\n /** Lazily-cached: whether this entity has any `lazy` columns, i.e. so the default SELECT lists columns explicitly. */\n hasLazyColumns?: boolean;\n orderBy: string | undefined;\n /** Flat field names that can be used to find existing rows before creating. I.e. [[\"email\"], [\"author\", \"title\"]]. */\n uniqueBy?: string[][];\n timestampFields: TimestampFields | undefined;\n // Ideally this would be the application-specific EntityManager (to avoid anys), but it doesn't really matter\n factory: (em: EntityManager<any, any, any>, opts?: any) => DeepNew<T>;\n /** The list of base types for this subtype, e.g. for Dog it'd be [Animal, Mammal]. */\n baseTypes: EntityMetadata[];\n /** The list of subtypes for this base type, e.g. for Animal it'd be `[Mammal, Dog]`. */\n subTypes: EntityMetadata[];\n /** Cached `[...baseTypes, this]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfMetas?: EntityMetadata[];\n /** Cached `[...baseTypes, this, ...subTypes]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfAndSubMetas?: EntityMetadata[];\n /** The lazy lookup of subtypes by type name, i.e. `Animal.metadata.subTypesByType.get(\"Dog\")`. */\n subTypesByType?: ReadonlyMap<string, EntityMetadata>;\n /** The lazy lookup of STI subtypes by discriminator value, i.e. `Task.metadata.subTypesByStiValue.get(1)`. */\n subTypesByStiValue?: ReadonlyMap<unknown, EntityMetadata>;\n /** The lazy STI discriminator column name, i.e. `Task.metadata.stiDiscriminatorColumnName`. */\n stiDiscriminatorColumnName?: string;\n /** If the schema is lacking deferred FKs, this is our insertion order. */\n nonDeferredFkOrder?: number;\n}\n\nexport type Field =\n | PrimaryKeyField\n | PrimitiveField\n | EnumField\n | OneToManyField\n | LargeOneToManyField\n | ManyToOneField\n | ManyToManyField\n | ManyToManyEnumField\n | OneToOneField\n | PolymorphicField;\n\n// Only the fields that have defined `serde` keys; should be a mapped type of Field\nexport type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;\n\nexport type PrimaryKeyField = {\n kind: \"primaryKey\";\n fieldName: string;\n fieldIdName: undefined;\n required: true;\n serde: FieldSerde;\n immutable: true;\n};\n\nexport type PrimitiveField = {\n kind: \"primitive\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"orm\" | \"sync\" | \"async\" | false;\n protected: boolean;\n type: string | Function;\n serde: FieldSerde;\n immutable: boolean;\n citext?: boolean;\n default?: \"schema\" | \"config\";\n sanitize?: boolean;\n /** When true, this column is excluded from the entity's default SELECT and lazy-loaded via a `LazyField`. */\n lazy?: boolean;\n};\n\nexport type EnumField = {\n kind: \"enum\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"sync\" | \"async\" | false;\n enumDetailType: { getValues(): ReadonlyArray<unknown>; findById(id: any): unknown };\n serde: FieldSerde;\n immutable: boolean;\n default?: \"schema\" | \"config\";\n};\n\nexport type OneToManyField = {\n kind: \"o2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n orderBy?: { field: string; direction: \"ASC\" | \"DESC\" };\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\nexport type LargeOneToManyField = {\n kind: \"lo2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type ManyToOneField = {\n kind: \"m2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: FieldSerde;\n immutable: boolean;\n derived: \"async\" | false;\n default?: \"schema\" | \"config\";\n};\n\nexport type ManyToManyField = {\n kind: \"m2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n derived: \"async\" | \"otherSide\" | false;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\n/**\n * A many-to-many between an entity and an enum \"table\", e.g. `Publisher.logoColors` backed by a\n * `publisher_logo_colors` join table joining `publishers` to the `color` enum table.\n *\n * To the user this looks like an array of enum codes (`Color[]`), but unlike an enum-array column it\n * is lazy (needs a load hint) because it lives in its own join table.\n */\nexport type ManyToManyEnumField = {\n kind: \"m2mEnum\";\n fieldName: string;\n fieldIdName: undefined;\n required: false;\n derived: false;\n /** The enum's metadata, used to map enum codes <-> their numeric ids. */\n enumDetailType: EnumMetadata<any, any, number>;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n /** `[entityColumn, enumColumn]`, e.g. `[\"publisher_id\", \"color_id\"]`. */\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n};\n\nexport type OneToOneField = {\n kind: \"o2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type PolymorphicField = {\n kind: \"poly\";\n fieldName: string; // eg `parent`\n fieldIdName: string; // `parentId`\n required: boolean;\n components: PolymorphicFieldComponent[];\n serde: PolymorphicKeySerde;\n immutable: boolean;\n};\n\nexport type PolymorphicFieldComponent = {\n otherMetadata: () => EntityMetadata;\n otherFieldName: string; // eg `comment` or `comments`\n columnName: string; // eg `parent_book_id` or `parent_book_review_id`\n column: Column;\n};\n\nexport function isOneToManyField(ormField: Field): ormField is OneToManyField {\n return ormField.kind === \"o2m\";\n}\n\nexport function isManyToOneField(ormField: Field): ormField is ManyToOneField {\n return ormField.kind === \"m2o\";\n}\n\nexport function isManyToManyField(ormField: Field): ormField is ManyToManyField {\n return ormField.kind === \"m2m\";\n}\n\nexport function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField {\n return ormField.kind === \"m2mEnum\";\n}\n\nexport function isOneToOneField(ormField: Field): ormField is OneToOneField {\n return ormField.kind === \"o2o\";\n}\n\nexport function isPolymorphicField(ormField: Field): ormField is PolymorphicField {\n return ormField.kind === \"poly\";\n}\n\nexport function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField {\n return ormField.kind === \"m2o\" || ormField.kind === \"o2o\" || ormField.kind === \"poly\";\n}\n\nexport function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField {\n return ormField.kind === \"o2m\" || ormField.kind === \"m2m\";\n}\n\nexport function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];\nexport function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];\nexport function getBaseAndSelfMetas(param: Entity | EntityMetadata): EntityMetadata[] {\n return isEntity(param)\n ? getBaseSelfAndSubMetas(getMetadata(param))\n : (param.baseSelfMetas ?? [...param.baseTypes, param]);\n}\n\nexport function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[] {\n return meta.baseSelfAndSubMetas ?? [...meta.baseTypes, meta, ...meta.subTypes];\n}\n\nexport function getSubMetas(meta: EntityMetadata): EntityMetadata[] {\n // We should do recursion at some point\n return meta.subTypes;\n}\n\nexport function getBaseMeta(meta: EntityMetadata): EntityMetadata {\n if (!meta.baseType) {\n return meta;\n } else {\n return meta.baseTypes[0];\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,YACd,OACgB;CAChB,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,yBAAyB,OAAO;CAC5D,OACE,OAAO,UAAU,aAAc,MAAc,WAAW,UAAU,QAAQ,QAAQA,mBAAAA,gBAAgB,KAAK,CAAC,CAAC;AAE7G;;AAGA,SAAgB,oBAAoB,MAAsB,WAAmC;CAC3F,IAAI,CAAC,KAAK,UAAU,YAAY,MAAM,IAAI,MAAM,UAAU,UAAU,iBAAiB,KAAK,MAAM;CAGhG,OAAO,EAAE,aAAa,KAAK,WAAW,KAAK,UAAU,UAAU,EAAE,gBAAgB,QAAQ,KAAK,UAC5F,OAAOC,kBAAAA,mBAAmB,KAAK,QAAQ;CAEzC,OAAO;AACT;AA2PA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,kBAAkB,UAA8C;CAC9E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,sBAAsB,UAAkD;CACtF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,gBAAgB,UAA4C;CAC1E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,mBAAmB,UAA+C;CAChF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAAgF;CAC/G,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS;AACjF;AAEA,SAAgB,kBAAkB,UAA+D;CAC/F,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS;AACtD;AAIA,SAAgB,oBAAoB,OAAkD;CACpF,OAAOC,eAAAA,SAAS,KAAK,IACjB,uBAAuB,YAAY,KAAK,CAAC,IACxC,MAAM,iBAAiB,CAAC,GAAG,MAAM,WAAW,KAAK;AACxD;AAEA,SAAgB,uBAAuB,MAAwC;CAC7E,OAAO,KAAK,uBAAuB;EAAC,GAAG,KAAK;EAAW;EAAM,GAAG,KAAK;CAAQ;AAC/E;AAEA,SAAgB,YAAY,MAAwC;CAElE,OAAO,KAAK;AACd;AAEA,SAAgB,YAAY,MAAsC;CAChE,IAAI,CAAC,KAAK,UACR,OAAO;MAEP,OAAO,KAAK,UAAU;AAE1B"}
|
|
1
|
+
{"version":3,"file":"EntityMetadata.cjs","names":["getInstanceData","getMetadataForType","isEntity"],"sources":["../src/EntityMetadata.ts"],"sourcesContent":["import { getInstanceData } from \"src/BaseEntity.ts\";\nimport type { ConfigApi, Reactable, ReactiveRule } from \"src/config.ts\";\nimport { getMetadataForType } from \"src/configure.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, type TimestampFields } from \"src/EntityManager.ts\";\nimport { type EnumMetadata } from \"src/EnumMetadata.ts\";\nimport type { DeepNew } from \"src/loading/loadHints.ts\";\nimport type { Column, ColumnDescriptors } from \"src/serde/columns.ts\";\nimport type { FieldSerde, PolymorphicKeySerde } from \"src/serde/fieldSerde.ts\";\nimport type { FieldTransitions } from \"src/transitions.ts\";\n\nexport function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;\nexport function getMetadata<T extends Entity>(\n param: T | MaybeAbstractEntityConstructor<T> | EntityMetadata,\n): EntityMetadata {\n if (!param) throw new Error(`Cannot getMetadata of ${param}`);\n return (\n typeof param === \"function\" ? (param as any).metadata : \"cstr\" in param ? param : getInstanceData(param).metadata\n ) as EntityMetadata;\n}\n\n/** Returns the metadata layer that declares `fieldName`, i.e. `Task.tags` for `TaskOld.tags`. */\nexport function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata {\n if (!meta.allFields[fieldName]) throw new Error(`Field '${fieldName}' not found on ${meta.type}`);\n // I.e. `TaskOld.tags` is an STI-inherited `Task.tags` and should walk up, but `SmallPublisherGroup.publishers`\n // is a CTI-specialized `PublisherGroup.publishers` and should stay on `SmallPublisherGroup`.\n while (!(fieldName in meta.fields) && meta.allFields[fieldName]?.specialized !== true && meta.baseType) {\n meta = getMetadataForType(meta.baseType);\n }\n return meta;\n}\n\n/**\n * Runtime metadata about an entity.\n *\n * The `joist-codegen` step will generate this by reading the database schema at build/codegen\n * time, along with any customizations in `joist-config.json`.\n *\n * Note: This has no generic, like `T extends Entity`, because `Entity<IdType>` i.e. with\n * an unknown string/id type, causes issues when we want to generically mix `EntityMetadata`\n * of different types, that even liberally using `EntityMetadata<any>` did not avoid.\n */\nexport interface EntityMetadata<T extends Entity = any> {\n cstr: MaybeAbstractEntityConstructor<T>;\n type: string;\n /** How the domain entity's id is represented. */\n idType: \"tagged-string\" | \"untagged-string\" | \"number\";\n /** The database column type, i.e. used to do `::type` casts in Postgres. */\n idDbType: \"bigint\" | \"int\" | \"uuid\" | \"text\";\n tableName: string;\n /** Whether codegen verified this table is a supported SQL mutation target; does not gate reads. */\n supportsEmExecute?: boolean;\n /** If we're a subtype, our immediate base type's name, e.g. for `SmallPublisher` this would be `Publisher`. */\n baseType: string | undefined;\n inheritanceType?: \"sti\" | \"cti\" | undefined;\n /** Indicates the field to use to derive which subtype to instantiate; only set on the base meta. */\n stiDiscriminatorField?: string;\n /** The discriminator enum value for this subtype; only set on sub metas. */\n stiDiscriminatorValue?: number;\n /** Whether this type is abstract (cannot be instantiated directly). */\n ctiAbstract?: boolean;\n tagName: string;\n fields: Record<string, Field>;\n /** Physical storage descriptors, without CTI base columns; STI metadata shares its base table. */\n columns: ColumnDescriptors;\n allFields: Record<string, Field & { aliasSuffix: string; specialized?: true }>;\n /** Usually polys are in `allFields`, but we pull the components out for comp-specific finds, like `parentBook`. */\n polyComponentFields?: Record<string, Field & { aliasSuffix: string }>;\n // Using `any` to avoid type errors between BaseType.metadata & SubType.metadata static fields\n config: ConfigApi<any, any>;\n /** The lazy lookup of transition config by field, including config from base types. */\n transitions?: ReadonlyMap<string, FieldTransitions>;\n /** The lazy list of non-read-only reactables for this metadata and its base types. */\n reactables?: Reactable[];\n /** The lazy lookup of non-read-only reactables by source field name. */\n reactablesByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of all reactables for this metadata and its base types. */\n reactablesIncludingReadOnly?: Reactable[];\n /** The lazy lookup of all reactables by source field name. */\n reactablesIncludingReadOnlyByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of reactive validation rules for this metadata and its subtypes. */\n reactiveRules?: ReactiveRule[];\n /** The lazy list of reactive *commit* rules (post-flush/pre-commit) for this metadata and its subtypes. */\n reactiveCommitRules?: ReactiveRule[];\n /** Lazily-cached: whether flushing an entity of this type could trigger any `addCommitRule` work. */\n hasCommitRules?: boolean;\n /** The lazily-cached set of own `lazy` primitive field names, i.e. columns excluded from the default SELECT. */\n lazyFieldNames?: ReadonlySet<string>;\n /** The lazily-cached list of sync-derived (`hasReactiveField`-less) field names, recalced during flush. */\n syncDerivedFields?: string[];\n /** Lazily-cached: whether this entity has any `lazy` columns, i.e. so the default SELECT lists columns explicitly. */\n hasLazyColumns?: boolean;\n orderBy: string | undefined;\n /** Flat field names that can be used to find existing rows before creating. I.e. [[\"email\"], [\"author\", \"title\"]]. */\n uniqueBy?: string[][];\n timestampFields: TimestampFields | undefined;\n // Ideally this would be the application-specific EntityManager (to avoid anys), but it doesn't really matter\n factory: (em: EntityManager<any, any, any>, opts?: any) => DeepNew<T>;\n /** The list of base types for this subtype, e.g. for Dog it'd be [Animal, Mammal]. */\n baseTypes: EntityMetadata[];\n /** The list of subtypes for this base type, e.g. for Animal it'd be `[Mammal, Dog]`. */\n subTypes: EntityMetadata[];\n /** Cached `[...baseTypes, this]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfMetas?: EntityMetadata[];\n /** Cached `[...baseTypes, this, ...subTypes]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfAndSubMetas?: EntityMetadata[];\n /** The lazy lookup of subtypes by type name, i.e. `Animal.metadata.subTypesByType.get(\"Dog\")`. */\n subTypesByType?: ReadonlyMap<string, EntityMetadata>;\n /** The lazy lookup of STI subtypes by discriminator value, i.e. `Task.metadata.subTypesByStiValue.get(1)`. */\n subTypesByStiValue?: ReadonlyMap<unknown, EntityMetadata>;\n /** The lazy STI discriminator column name, i.e. `Task.metadata.stiDiscriminatorColumnName`. */\n stiDiscriminatorColumnName?: string;\n /** If the schema is lacking deferred FKs, this is our insertion order. */\n nonDeferredFkOrder?: number;\n}\n\nexport type Field =\n | PrimaryKeyField\n | PrimitiveField\n | EnumField\n | OneToManyField\n | LargeOneToManyField\n | ManyToOneField\n | ManyToManyField\n | ManyToManyEnumField\n | OneToOneField\n | PolymorphicField;\n\n// Only the fields that have defined `serde` keys; should be a mapped type of Field\nexport type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;\n\nexport type PrimaryKeyField = {\n kind: \"primaryKey\";\n fieldName: string;\n fieldIdName: undefined;\n required: true;\n serde: FieldSerde;\n immutable: true;\n};\n\nexport type PrimitiveField = {\n kind: \"primitive\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"orm\" | \"sync\" | \"async\" | false;\n protected: boolean;\n type: string | Function;\n serde: FieldSerde;\n immutable: boolean;\n citext?: boolean;\n default?: \"schema\" | \"config\";\n sanitize?: boolean;\n /** When true, this column is excluded from the entity's default SELECT and lazy-loaded via a `LazyField`. */\n lazy?: boolean;\n};\n\nexport type EnumField = {\n kind: \"enum\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"sync\" | \"async\" | false;\n enumDetailType: EnumMetadata<any, { name: string }>;\n /** The enum object, i.e. `{ Draft: \"DRAFT\" }`. */\n enumType: Record<string, unknown>;\n serde: FieldSerde;\n immutable: boolean;\n default?: \"schema\" | \"config\";\n};\n\nexport type OneToManyField = {\n kind: \"o2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n orderBy?: { field: string; direction: \"ASC\" | \"DESC\" };\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\nexport type LargeOneToManyField = {\n kind: \"lo2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type ManyToOneField = {\n kind: \"m2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: FieldSerde;\n immutable: boolean;\n derived: \"async\" | false;\n default?: \"schema\" | \"config\";\n};\n\nexport type ManyToManyField = {\n kind: \"m2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n derived: \"async\" | \"otherSide\" | false;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\n/**\n * A many-to-many between an entity and an enum \"table\", e.g. `Publisher.logoColors` backed by a\n * `publisher_logo_colors` join table joining `publishers` to the `color` enum table.\n *\n * To the user this looks like an array of enum codes (`Color[]`), but unlike an enum-array column it\n * is lazy (needs a load hint) because it lives in its own join table.\n */\nexport type ManyToManyEnumField = {\n kind: \"m2mEnum\";\n fieldName: string;\n fieldIdName: undefined;\n required: false;\n derived: false;\n /** The enum's metadata, used to map enum codes <-> their numeric ids. */\n enumDetailType: EnumMetadata<any, any, number>;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n /** `[entityColumn, enumColumn]`, e.g. `[\"publisher_id\", \"color_id\"]`. */\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n};\n\nexport type OneToOneField = {\n kind: \"o2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type PolymorphicField = {\n kind: \"poly\";\n fieldName: string; // eg `parent`\n fieldIdName: string; // `parentId`\n required: boolean;\n components: PolymorphicFieldComponent[];\n serde: PolymorphicKeySerde;\n immutable: boolean;\n};\n\nexport type PolymorphicFieldComponent = {\n otherMetadata: () => EntityMetadata;\n otherFieldName: string; // eg `comment` or `comments`\n columnName: string; // eg `parent_book_id` or `parent_book_review_id`\n column: Column;\n};\n\nexport function isOneToManyField(ormField: Field): ormField is OneToManyField {\n return ormField.kind === \"o2m\";\n}\n\nexport function isManyToOneField(ormField: Field): ormField is ManyToOneField {\n return ormField.kind === \"m2o\";\n}\n\nexport function isManyToManyField(ormField: Field): ormField is ManyToManyField {\n return ormField.kind === \"m2m\";\n}\n\nexport function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField {\n return ormField.kind === \"m2mEnum\";\n}\n\nexport function isOneToOneField(ormField: Field): ormField is OneToOneField {\n return ormField.kind === \"o2o\";\n}\n\nexport function isPolymorphicField(ormField: Field): ormField is PolymorphicField {\n return ormField.kind === \"poly\";\n}\n\nexport function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField {\n return ormField.kind === \"m2o\" || ormField.kind === \"o2o\" || ormField.kind === \"poly\";\n}\n\nexport function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField {\n return ormField.kind === \"o2m\" || ormField.kind === \"m2m\";\n}\n\nexport function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];\nexport function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];\nexport function getBaseAndSelfMetas(param: Entity | EntityMetadata): EntityMetadata[] {\n return isEntity(param)\n ? getBaseSelfAndSubMetas(getMetadata(param))\n : (param.baseSelfMetas ?? [...param.baseTypes, param]);\n}\n\nexport function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[] {\n return meta.baseSelfAndSubMetas ?? [...meta.baseTypes, meta, ...meta.subTypes];\n}\n\nexport function getSubMetas(meta: EntityMetadata): EntityMetadata[] {\n // We should do recursion at some point\n return meta.subTypes;\n}\n\nexport function getBaseMeta(meta: EntityMetadata): EntityMetadata {\n if (!meta.baseType) {\n return meta;\n } else {\n return meta.baseTypes[0];\n }\n}\n"],"mappings":";;;;;;AAcA,SAAgB,YACd,OACgB;CAChB,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,yBAAyB,OAAO;CAC5D,OACE,OAAO,UAAU,aAAc,MAAc,WAAW,UAAU,QAAQ,QAAQA,mBAAAA,gBAAgB,KAAK,CAAC,CAAC;AAE7G;;AAGA,SAAgB,oBAAoB,MAAsB,WAAmC;CAC3F,IAAI,CAAC,KAAK,UAAU,YAAY,MAAM,IAAI,MAAM,UAAU,UAAU,iBAAiB,KAAK,MAAM;CAGhG,OAAO,EAAE,aAAa,KAAK,WAAW,KAAK,UAAU,UAAU,EAAE,gBAAgB,QAAQ,KAAK,UAC5F,OAAOC,kBAAAA,mBAAmB,KAAK,QAAQ;CAEzC,OAAO;AACT;AA+PA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,kBAAkB,UAA8C;CAC9E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,sBAAsB,UAAkD;CACtF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,gBAAgB,UAA4C;CAC1E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,mBAAmB,UAA+C;CAChF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAAgF;CAC/G,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS;AACjF;AAEA,SAAgB,kBAAkB,UAA+D;CAC/F,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS;AACtD;AAIA,SAAgB,oBAAoB,OAAkD;CACpF,OAAOC,eAAAA,SAAS,KAAK,IACjB,uBAAuB,YAAY,KAAK,CAAC,IACxC,MAAM,iBAAiB,CAAC,GAAG,MAAM,WAAW,KAAK;AACxD;AAEA,SAAgB,uBAAuB,MAAwC;CAC7E,OAAO,KAAK,uBAAuB;EAAC,GAAG,KAAK;EAAW;EAAM,GAAG,KAAK;CAAQ;AAC/E;AAEA,SAAgB,YAAY,MAAwC;CAElE,OAAO,KAAK;AACd;AAEA,SAAgB,YAAY,MAAsC;CAChE,IAAI,CAAC,KAAK,UACR,OAAO;MAEP,OAAO,KAAK,UAAU;AAE1B"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { EnumMetadata } from "./EnumMetadata.cjs";
|
|
2
2
|
import { DeepNew } from "./loading/loadHints.cjs";
|
|
3
|
+
import { FieldTransitions } from "./transitions.cjs";
|
|
3
4
|
import { ConfigApi, Reactable, ReactiveRule } from "./config.cjs";
|
|
4
5
|
import { Column, ColumnDescriptors } from "./serde/columns.cjs";
|
|
5
6
|
import { FieldSerde, PolymorphicKeySerde } from "./serde/fieldSerde.cjs";
|
|
6
7
|
import { EntityManager, MaybeAbstractEntityConstructor, TimestampFields } from "./EntityManager.cjs";
|
|
7
8
|
import { Entity } from "./Entity.cjs";
|
|
8
9
|
//#region src/EntityMetadata.d.ts
|
|
9
|
-
declare function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;
|
|
10
|
-
declare function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;
|
|
11
|
-
declare function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;
|
|
10
|
+
export declare function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;
|
|
11
|
+
export declare function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;
|
|
12
|
+
export declare function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;
|
|
12
13
|
/** Returns the metadata layer that declares `fieldName`, i.e. `Task.tags` for `TaskOld.tags`. */
|
|
13
|
-
declare function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata;
|
|
14
|
+
export declare function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata;
|
|
14
15
|
/**
|
|
15
16
|
* Runtime metadata about an entity.
|
|
16
17
|
*
|
|
@@ -21,7 +22,7 @@ declare function getMetadataForField(meta: EntityMetadata, fieldName: string): E
|
|
|
21
22
|
* an unknown string/id type, causes issues when we want to generically mix `EntityMetadata`
|
|
22
23
|
* of different types, that even liberally using `EntityMetadata<any>` did not avoid.
|
|
23
24
|
*/
|
|
24
|
-
interface EntityMetadata<T extends Entity = any> {
|
|
25
|
+
export interface EntityMetadata<T extends Entity = any> {
|
|
25
26
|
cstr: MaybeAbstractEntityConstructor<T>;
|
|
26
27
|
type: string;
|
|
27
28
|
/** How the domain entity's id is represented. */
|
|
@@ -53,6 +54,8 @@ interface EntityMetadata<T extends Entity = any> {
|
|
|
53
54
|
aliasSuffix: string;
|
|
54
55
|
}>;
|
|
55
56
|
config: ConfigApi<any, any>;
|
|
57
|
+
/** The lazy lookup of transition config by field, including config from base types. */
|
|
58
|
+
transitions?: ReadonlyMap<string, FieldTransitions>;
|
|
56
59
|
/** The lazy list of non-read-only reactables for this metadata and its base types. */
|
|
57
60
|
reactables?: Reactable[];
|
|
58
61
|
/** The lazy lookup of non-read-only reactables by source field name. */
|
|
@@ -95,9 +98,9 @@ interface EntityMetadata<T extends Entity = any> {
|
|
|
95
98
|
/** If the schema is lacking deferred FKs, this is our insertion order. */
|
|
96
99
|
nonDeferredFkOrder?: number;
|
|
97
100
|
}
|
|
98
|
-
type Field = PrimaryKeyField | PrimitiveField | EnumField | OneToManyField | LargeOneToManyField | ManyToOneField | ManyToManyField | ManyToManyEnumField | OneToOneField | PolymorphicField;
|
|
99
|
-
type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;
|
|
100
|
-
type PrimaryKeyField = {
|
|
101
|
+
export type Field = PrimaryKeyField | PrimitiveField | EnumField | OneToManyField | LargeOneToManyField | ManyToOneField | ManyToManyField | ManyToManyEnumField | OneToOneField | PolymorphicField;
|
|
102
|
+
export type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;
|
|
103
|
+
export type PrimaryKeyField = {
|
|
101
104
|
kind: "primaryKey";
|
|
102
105
|
fieldName: string;
|
|
103
106
|
fieldIdName: undefined;
|
|
@@ -105,7 +108,7 @@ type PrimaryKeyField = {
|
|
|
105
108
|
serde: FieldSerde;
|
|
106
109
|
immutable: true;
|
|
107
110
|
};
|
|
108
|
-
type PrimitiveField = {
|
|
111
|
+
export type PrimitiveField = {
|
|
109
112
|
kind: "primitive";
|
|
110
113
|
fieldName: string;
|
|
111
114
|
fieldIdName: undefined;
|
|
@@ -121,21 +124,22 @@ type PrimitiveField = {
|
|
|
121
124
|
/** When true, this column is excluded from the entity's default SELECT and lazy-loaded via a `LazyField`. */
|
|
122
125
|
lazy?: boolean;
|
|
123
126
|
};
|
|
124
|
-
type EnumField = {
|
|
127
|
+
export type EnumField = {
|
|
125
128
|
kind: "enum";
|
|
126
129
|
fieldName: string;
|
|
127
130
|
fieldIdName: undefined;
|
|
128
131
|
required: boolean;
|
|
129
132
|
derived: "sync" | "async" | false;
|
|
130
|
-
enumDetailType: {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
133
|
+
enumDetailType: EnumMetadata<any, {
|
|
134
|
+
name: string;
|
|
135
|
+
}>;
|
|
136
|
+
/** The enum object, i.e. `{ Draft: "DRAFT" }`. */
|
|
137
|
+
enumType: Record<string, unknown>;
|
|
134
138
|
serde: FieldSerde;
|
|
135
139
|
immutable: boolean;
|
|
136
140
|
default?: "schema" | "config";
|
|
137
141
|
};
|
|
138
|
-
type OneToManyField = {
|
|
142
|
+
export type OneToManyField = {
|
|
139
143
|
kind: "o2m";
|
|
140
144
|
fieldName: string;
|
|
141
145
|
fieldIdName: string;
|
|
@@ -153,7 +157,7 @@ type OneToManyField = {
|
|
|
153
157
|
/** When `"include"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */
|
|
154
158
|
softDeletes?: "include" | "exclude";
|
|
155
159
|
};
|
|
156
|
-
type LargeOneToManyField = {
|
|
160
|
+
export type LargeOneToManyField = {
|
|
157
161
|
kind: "lo2m";
|
|
158
162
|
fieldName: string;
|
|
159
163
|
fieldIdName: string;
|
|
@@ -165,7 +169,7 @@ type LargeOneToManyField = {
|
|
|
165
169
|
serde: undefined;
|
|
166
170
|
immutable: false;
|
|
167
171
|
};
|
|
168
|
-
type ManyToOneField = {
|
|
172
|
+
export type ManyToOneField = {
|
|
169
173
|
kind: "m2o";
|
|
170
174
|
fieldName: string;
|
|
171
175
|
fieldIdName: string;
|
|
@@ -177,7 +181,7 @@ type ManyToOneField = {
|
|
|
177
181
|
derived: "async" | false;
|
|
178
182
|
default?: "schema" | "config";
|
|
179
183
|
};
|
|
180
|
-
type ManyToManyField = {
|
|
184
|
+
export type ManyToManyField = {
|
|
181
185
|
kind: "m2m";
|
|
182
186
|
fieldName: string;
|
|
183
187
|
fieldIdName: string;
|
|
@@ -201,7 +205,7 @@ type ManyToManyField = {
|
|
|
201
205
|
* To the user this looks like an array of enum codes (`Color[]`), but unlike an enum-array column it
|
|
202
206
|
* is lazy (needs a load hint) because it lives in its own join table.
|
|
203
207
|
*/
|
|
204
|
-
type ManyToManyEnumField = {
|
|
208
|
+
export type ManyToManyEnumField = {
|
|
205
209
|
kind: "m2mEnum";
|
|
206
210
|
fieldName: string;
|
|
207
211
|
fieldIdName: undefined;
|
|
@@ -217,7 +221,7 @@ type ManyToManyEnumField = {
|
|
|
217
221
|
/** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */
|
|
218
222
|
hasJoinTableId: boolean;
|
|
219
223
|
};
|
|
220
|
-
type OneToOneField = {
|
|
224
|
+
export type OneToOneField = {
|
|
221
225
|
kind: "o2o";
|
|
222
226
|
fieldName: string;
|
|
223
227
|
fieldIdName: string;
|
|
@@ -229,7 +233,7 @@ type OneToOneField = {
|
|
|
229
233
|
serde: undefined;
|
|
230
234
|
immutable: false;
|
|
231
235
|
};
|
|
232
|
-
type PolymorphicField = {
|
|
236
|
+
export type PolymorphicField = {
|
|
233
237
|
kind: "poly";
|
|
234
238
|
fieldName: string;
|
|
235
239
|
fieldIdName: string;
|
|
@@ -238,25 +242,24 @@ type PolymorphicField = {
|
|
|
238
242
|
serde: PolymorphicKeySerde;
|
|
239
243
|
immutable: boolean;
|
|
240
244
|
};
|
|
241
|
-
type PolymorphicFieldComponent = {
|
|
245
|
+
export type PolymorphicFieldComponent = {
|
|
242
246
|
otherMetadata: () => EntityMetadata;
|
|
243
247
|
otherFieldName: string;
|
|
244
248
|
columnName: string;
|
|
245
249
|
column: Column;
|
|
246
250
|
};
|
|
247
|
-
declare function isOneToManyField(ormField: Field): ormField is OneToManyField;
|
|
248
|
-
declare function isManyToOneField(ormField: Field): ormField is ManyToOneField;
|
|
249
|
-
declare function isManyToManyField(ormField: Field): ormField is ManyToManyField;
|
|
250
|
-
declare function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField;
|
|
251
|
-
declare function isOneToOneField(ormField: Field): ormField is OneToOneField;
|
|
252
|
-
declare function isPolymorphicField(ormField: Field): ormField is PolymorphicField;
|
|
253
|
-
declare function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField;
|
|
254
|
-
declare function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField;
|
|
255
|
-
declare function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];
|
|
256
|
-
declare function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];
|
|
257
|
-
declare function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
258
|
-
declare function getSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
259
|
-
declare function getBaseMeta(meta: EntityMetadata): EntityMetadata;
|
|
251
|
+
export declare function isOneToManyField(ormField: Field): ormField is OneToManyField;
|
|
252
|
+
export declare function isManyToOneField(ormField: Field): ormField is ManyToOneField;
|
|
253
|
+
export declare function isManyToManyField(ormField: Field): ormField is ManyToManyField;
|
|
254
|
+
export declare function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField;
|
|
255
|
+
export declare function isOneToOneField(ormField: Field): ormField is OneToOneField;
|
|
256
|
+
export declare function isPolymorphicField(ormField: Field): ormField is PolymorphicField;
|
|
257
|
+
export declare function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField;
|
|
258
|
+
export declare function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField;
|
|
259
|
+
export declare function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];
|
|
260
|
+
export declare function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];
|
|
261
|
+
export declare function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
262
|
+
export declare function getSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
263
|
+
export declare function getBaseMeta(meta: EntityMetadata): EntityMetadata;
|
|
260
264
|
//#endregion
|
|
261
|
-
export { EntityMetadata, EnumField, Field, LargeOneToManyField, ManyToManyEnumField, ManyToManyField, ManyToOneField, OneToManyField, OneToOneField, PolymorphicField, PolymorphicFieldComponent, PrimaryKeyField, PrimitiveField, SerdeField, getBaseAndSelfMetas, getBaseMeta, getBaseSelfAndSubMetas, getMetadata, getMetadataForField, getSubMetas, isCollectionField, isManyToManyEnumField, isManyToManyField, isManyToOneField, isOneToManyField, isOneToOneField, isPolymorphicField, isReferenceField };
|
|
262
265
|
//# sourceMappingURL=EntityMetadata.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityMetadata.d.cts","names":[],"sources":["../src/EntityMetadata.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityMetadata.d.cts","names":[],"sources":["../src/EntityMetadata.ts"],"mappings":";;;;;;;;;wBAWgB,YAAY,UAAU,QAAQ,QAAQ,IAAI,eAAe;wBACzD,YAAY,UAAU,QAAQ,MAAM,+BAA+B,KAAK,eAAe;wBACvF,YAAY,UAAU,QAAQ,MAAM,iBAAiB;;wBAWrD,oBAAoB,MAAM,gBAAgB,oBAAoB;;;;;;;;;;;iBAoB7D,eAAe,UAAU;EACxC,MAAM,+BAA+B;EACrC;;EAEA;;EAEA;EACA;;EAEA;;EAEA;EACA;;EAEA;;EAEA;;EAEA;EACA;EACA,QAAQ,eAAe;;EAEvB,SAAS;EACT,WAAW,eAAe;IAAU;IAAqB;;;EAEzD,sBAAsB,eAAe;IAAU;;EAE/C,QAAQ;;EAER,cAAc,oBAAoB;;EAElC,aAAa;;EAEb,oBAAoB,oBAAoB;;EAExC,8BAA8B;;EAE9B,qCAAqC,oBAAoB;;EAEzD,gBAAgB;;EAEhB,sBAAsB;;EAEtB;;EAEA,iBAAiB;;EAEjB;;EAEA;EACA;;EAEA;EACA,iBAAiB;EAEjB,UAAU,IAAI,8BAA8B,eAAe,QAAQ;;EAEnE,WAAW;;EAEX,UAAU;;EAEV,gBAAgB;;EAEhB,sBAAsB;;EAEtB,iBAAiB,oBAAoB;;EAErC,qBAAqB,qBAAqB;;EAE1C;;EAEA;;YAGU,QACR,kBACA,iBACA,YACA,iBACA,sBACA,iBACA,kBACA,sBACA,gBACA;YAGQ,aAAa,kBAAkB,iBAAiB,YAAY,iBAAiB;YAE7E;EACV;EACA;EACA;EACA;EACA,OAAO;EACP;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,OAAO;EACP;EACA;EACA;EACA;;EAEA;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA,gBAAgB;IAAoB;;;EAEpC,UAAU;EACV,OAAO;EACP;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;;EAEA;EACA;EACA;EACA;IAAY;IAAe;;;EAE3B;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;;EAEA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA,OAAO;EACP;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA;EACA;EACA;EACA;;EAEA;;EAEA;;;;;;;;;YAUU;EACV;EACA;EACA;EACA;EACA;;EAEA,gBAAgB;EAChB;EACA;EACA;;EAEA;;EAEA;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;;EAEA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,YAAY;EACZ,OAAO;EACP;;YAGU;EACV,qBAAqB;EACrB;EACA;EACA,QAAQ;;wBAGM,iBAAiB,UAAU,QAAQ,YAAY;wBAI/C,iBAAiB,UAAU,QAAQ,YAAY;wBAI/C,kBAAkB,UAAU,QAAQ,YAAY;wBAIhD,sBAAsB,UAAU,QAAQ,YAAY;wBAIpD,gBAAgB,UAAU,QAAQ,YAAY;wBAI9C,mBAAmB,UAAU,QAAQ,YAAY;wBAIjD,iBAAiB,UAAU,QAAQ,YAAY,iBAAiB,gBAAgB;wBAIhF,kBAAkB,UAAU,QAAQ,YAAY,iBAAiB;wBAIjE,oBAAoB,MAAM,iBAAiB;wBAC3C,oBAAoB,QAAQ,SAAS;wBAOrC,uBAAuB,MAAM,iBAAiB;wBAI9C,YAAY,MAAM,iBAAiB;wBAKnC,YAAY,MAAM,iBAAiB"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { EnumMetadata } from "./EnumMetadata.mjs";
|
|
2
2
|
import { DeepNew } from "./loading/loadHints.mjs";
|
|
3
|
+
import { FieldTransitions } from "./transitions.mjs";
|
|
3
4
|
import { ConfigApi, Reactable, ReactiveRule } from "./config.mjs";
|
|
4
5
|
import { Column, ColumnDescriptors } from "./serde/columns.mjs";
|
|
5
6
|
import { FieldSerde, PolymorphicKeySerde } from "./serde/fieldSerde.mjs";
|
|
6
7
|
import { EntityManager, MaybeAbstractEntityConstructor, TimestampFields } from "./EntityManager.mjs";
|
|
7
8
|
import { Entity } from "./Entity.mjs";
|
|
8
9
|
//#region src/EntityMetadata.d.ts
|
|
9
|
-
declare function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;
|
|
10
|
-
declare function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;
|
|
11
|
-
declare function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;
|
|
10
|
+
export declare function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;
|
|
11
|
+
export declare function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;
|
|
12
|
+
export declare function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;
|
|
12
13
|
/** Returns the metadata layer that declares `fieldName`, i.e. `Task.tags` for `TaskOld.tags`. */
|
|
13
|
-
declare function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata;
|
|
14
|
+
export declare function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata;
|
|
14
15
|
/**
|
|
15
16
|
* Runtime metadata about an entity.
|
|
16
17
|
*
|
|
@@ -21,7 +22,7 @@ declare function getMetadataForField(meta: EntityMetadata, fieldName: string): E
|
|
|
21
22
|
* an unknown string/id type, causes issues when we want to generically mix `EntityMetadata`
|
|
22
23
|
* of different types, that even liberally using `EntityMetadata<any>` did not avoid.
|
|
23
24
|
*/
|
|
24
|
-
interface EntityMetadata<T extends Entity = any> {
|
|
25
|
+
export interface EntityMetadata<T extends Entity = any> {
|
|
25
26
|
cstr: MaybeAbstractEntityConstructor<T>;
|
|
26
27
|
type: string;
|
|
27
28
|
/** How the domain entity's id is represented. */
|
|
@@ -53,6 +54,8 @@ interface EntityMetadata<T extends Entity = any> {
|
|
|
53
54
|
aliasSuffix: string;
|
|
54
55
|
}>;
|
|
55
56
|
config: ConfigApi<any, any>;
|
|
57
|
+
/** The lazy lookup of transition config by field, including config from base types. */
|
|
58
|
+
transitions?: ReadonlyMap<string, FieldTransitions>;
|
|
56
59
|
/** The lazy list of non-read-only reactables for this metadata and its base types. */
|
|
57
60
|
reactables?: Reactable[];
|
|
58
61
|
/** The lazy lookup of non-read-only reactables by source field name. */
|
|
@@ -95,9 +98,9 @@ interface EntityMetadata<T extends Entity = any> {
|
|
|
95
98
|
/** If the schema is lacking deferred FKs, this is our insertion order. */
|
|
96
99
|
nonDeferredFkOrder?: number;
|
|
97
100
|
}
|
|
98
|
-
type Field = PrimaryKeyField | PrimitiveField | EnumField | OneToManyField | LargeOneToManyField | ManyToOneField | ManyToManyField | ManyToManyEnumField | OneToOneField | PolymorphicField;
|
|
99
|
-
type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;
|
|
100
|
-
type PrimaryKeyField = {
|
|
101
|
+
export type Field = PrimaryKeyField | PrimitiveField | EnumField | OneToManyField | LargeOneToManyField | ManyToOneField | ManyToManyField | ManyToManyEnumField | OneToOneField | PolymorphicField;
|
|
102
|
+
export type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;
|
|
103
|
+
export type PrimaryKeyField = {
|
|
101
104
|
kind: "primaryKey";
|
|
102
105
|
fieldName: string;
|
|
103
106
|
fieldIdName: undefined;
|
|
@@ -105,7 +108,7 @@ type PrimaryKeyField = {
|
|
|
105
108
|
serde: FieldSerde;
|
|
106
109
|
immutable: true;
|
|
107
110
|
};
|
|
108
|
-
type PrimitiveField = {
|
|
111
|
+
export type PrimitiveField = {
|
|
109
112
|
kind: "primitive";
|
|
110
113
|
fieldName: string;
|
|
111
114
|
fieldIdName: undefined;
|
|
@@ -121,21 +124,22 @@ type PrimitiveField = {
|
|
|
121
124
|
/** When true, this column is excluded from the entity's default SELECT and lazy-loaded via a `LazyField`. */
|
|
122
125
|
lazy?: boolean;
|
|
123
126
|
};
|
|
124
|
-
type EnumField = {
|
|
127
|
+
export type EnumField = {
|
|
125
128
|
kind: "enum";
|
|
126
129
|
fieldName: string;
|
|
127
130
|
fieldIdName: undefined;
|
|
128
131
|
required: boolean;
|
|
129
132
|
derived: "sync" | "async" | false;
|
|
130
|
-
enumDetailType: {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
133
|
+
enumDetailType: EnumMetadata<any, {
|
|
134
|
+
name: string;
|
|
135
|
+
}>;
|
|
136
|
+
/** The enum object, i.e. `{ Draft: "DRAFT" }`. */
|
|
137
|
+
enumType: Record<string, unknown>;
|
|
134
138
|
serde: FieldSerde;
|
|
135
139
|
immutable: boolean;
|
|
136
140
|
default?: "schema" | "config";
|
|
137
141
|
};
|
|
138
|
-
type OneToManyField = {
|
|
142
|
+
export type OneToManyField = {
|
|
139
143
|
kind: "o2m";
|
|
140
144
|
fieldName: string;
|
|
141
145
|
fieldIdName: string;
|
|
@@ -153,7 +157,7 @@ type OneToManyField = {
|
|
|
153
157
|
/** When `"include"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */
|
|
154
158
|
softDeletes?: "include" | "exclude";
|
|
155
159
|
};
|
|
156
|
-
type LargeOneToManyField = {
|
|
160
|
+
export type LargeOneToManyField = {
|
|
157
161
|
kind: "lo2m";
|
|
158
162
|
fieldName: string;
|
|
159
163
|
fieldIdName: string;
|
|
@@ -165,7 +169,7 @@ type LargeOneToManyField = {
|
|
|
165
169
|
serde: undefined;
|
|
166
170
|
immutable: false;
|
|
167
171
|
};
|
|
168
|
-
type ManyToOneField = {
|
|
172
|
+
export type ManyToOneField = {
|
|
169
173
|
kind: "m2o";
|
|
170
174
|
fieldName: string;
|
|
171
175
|
fieldIdName: string;
|
|
@@ -177,7 +181,7 @@ type ManyToOneField = {
|
|
|
177
181
|
derived: "async" | false;
|
|
178
182
|
default?: "schema" | "config";
|
|
179
183
|
};
|
|
180
|
-
type ManyToManyField = {
|
|
184
|
+
export type ManyToManyField = {
|
|
181
185
|
kind: "m2m";
|
|
182
186
|
fieldName: string;
|
|
183
187
|
fieldIdName: string;
|
|
@@ -201,7 +205,7 @@ type ManyToManyField = {
|
|
|
201
205
|
* To the user this looks like an array of enum codes (`Color[]`), but unlike an enum-array column it
|
|
202
206
|
* is lazy (needs a load hint) because it lives in its own join table.
|
|
203
207
|
*/
|
|
204
|
-
type ManyToManyEnumField = {
|
|
208
|
+
export type ManyToManyEnumField = {
|
|
205
209
|
kind: "m2mEnum";
|
|
206
210
|
fieldName: string;
|
|
207
211
|
fieldIdName: undefined;
|
|
@@ -217,7 +221,7 @@ type ManyToManyEnumField = {
|
|
|
217
221
|
/** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */
|
|
218
222
|
hasJoinTableId: boolean;
|
|
219
223
|
};
|
|
220
|
-
type OneToOneField = {
|
|
224
|
+
export type OneToOneField = {
|
|
221
225
|
kind: "o2o";
|
|
222
226
|
fieldName: string;
|
|
223
227
|
fieldIdName: string;
|
|
@@ -229,7 +233,7 @@ type OneToOneField = {
|
|
|
229
233
|
serde: undefined;
|
|
230
234
|
immutable: false;
|
|
231
235
|
};
|
|
232
|
-
type PolymorphicField = {
|
|
236
|
+
export type PolymorphicField = {
|
|
233
237
|
kind: "poly";
|
|
234
238
|
fieldName: string;
|
|
235
239
|
fieldIdName: string;
|
|
@@ -238,25 +242,24 @@ type PolymorphicField = {
|
|
|
238
242
|
serde: PolymorphicKeySerde;
|
|
239
243
|
immutable: boolean;
|
|
240
244
|
};
|
|
241
|
-
type PolymorphicFieldComponent = {
|
|
245
|
+
export type PolymorphicFieldComponent = {
|
|
242
246
|
otherMetadata: () => EntityMetadata;
|
|
243
247
|
otherFieldName: string;
|
|
244
248
|
columnName: string;
|
|
245
249
|
column: Column;
|
|
246
250
|
};
|
|
247
|
-
declare function isOneToManyField(ormField: Field): ormField is OneToManyField;
|
|
248
|
-
declare function isManyToOneField(ormField: Field): ormField is ManyToOneField;
|
|
249
|
-
declare function isManyToManyField(ormField: Field): ormField is ManyToManyField;
|
|
250
|
-
declare function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField;
|
|
251
|
-
declare function isOneToOneField(ormField: Field): ormField is OneToOneField;
|
|
252
|
-
declare function isPolymorphicField(ormField: Field): ormField is PolymorphicField;
|
|
253
|
-
declare function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField;
|
|
254
|
-
declare function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField;
|
|
255
|
-
declare function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];
|
|
256
|
-
declare function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];
|
|
257
|
-
declare function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
258
|
-
declare function getSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
259
|
-
declare function getBaseMeta(meta: EntityMetadata): EntityMetadata;
|
|
251
|
+
export declare function isOneToManyField(ormField: Field): ormField is OneToManyField;
|
|
252
|
+
export declare function isManyToOneField(ormField: Field): ormField is ManyToOneField;
|
|
253
|
+
export declare function isManyToManyField(ormField: Field): ormField is ManyToManyField;
|
|
254
|
+
export declare function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField;
|
|
255
|
+
export declare function isOneToOneField(ormField: Field): ormField is OneToOneField;
|
|
256
|
+
export declare function isPolymorphicField(ormField: Field): ormField is PolymorphicField;
|
|
257
|
+
export declare function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField;
|
|
258
|
+
export declare function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField;
|
|
259
|
+
export declare function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];
|
|
260
|
+
export declare function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];
|
|
261
|
+
export declare function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
262
|
+
export declare function getSubMetas(meta: EntityMetadata): EntityMetadata[];
|
|
263
|
+
export declare function getBaseMeta(meta: EntityMetadata): EntityMetadata;
|
|
260
264
|
//#endregion
|
|
261
|
-
export { EntityMetadata, EnumField, Field, LargeOneToManyField, ManyToManyEnumField, ManyToManyField, ManyToOneField, OneToManyField, OneToOneField, PolymorphicField, PolymorphicFieldComponent, PrimaryKeyField, PrimitiveField, SerdeField, getBaseAndSelfMetas, getBaseMeta, getBaseSelfAndSubMetas, getMetadata, getMetadataForField, getSubMetas, isCollectionField, isManyToManyEnumField, isManyToManyField, isManyToOneField, isOneToManyField, isOneToOneField, isPolymorphicField, isReferenceField };
|
|
262
265
|
//# sourceMappingURL=EntityMetadata.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityMetadata.d.mts","names":[],"sources":["../src/EntityMetadata.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityMetadata.d.mts","names":[],"sources":["../src/EntityMetadata.ts"],"mappings":";;;;;;;;;wBAWgB,YAAY,UAAU,QAAQ,QAAQ,IAAI,eAAe;wBACzD,YAAY,UAAU,QAAQ,MAAM,+BAA+B,KAAK,eAAe;wBACvF,YAAY,UAAU,QAAQ,MAAM,iBAAiB;;wBAWrD,oBAAoB,MAAM,gBAAgB,oBAAoB;;;;;;;;;;;iBAoB7D,eAAe,UAAU;EACxC,MAAM,+BAA+B;EACrC;;EAEA;;EAEA;EACA;;EAEA;;EAEA;EACA;;EAEA;;EAEA;;EAEA;EACA;EACA,QAAQ,eAAe;;EAEvB,SAAS;EACT,WAAW,eAAe;IAAU;IAAqB;;;EAEzD,sBAAsB,eAAe;IAAU;;EAE/C,QAAQ;;EAER,cAAc,oBAAoB;;EAElC,aAAa;;EAEb,oBAAoB,oBAAoB;;EAExC,8BAA8B;;EAE9B,qCAAqC,oBAAoB;;EAEzD,gBAAgB;;EAEhB,sBAAsB;;EAEtB;;EAEA,iBAAiB;;EAEjB;;EAEA;EACA;;EAEA;EACA,iBAAiB;EAEjB,UAAU,IAAI,8BAA8B,eAAe,QAAQ;;EAEnE,WAAW;;EAEX,UAAU;;EAEV,gBAAgB;;EAEhB,sBAAsB;;EAEtB,iBAAiB,oBAAoB;;EAErC,qBAAqB,qBAAqB;;EAE1C;;EAEA;;YAGU,QACR,kBACA,iBACA,YACA,iBACA,sBACA,iBACA,kBACA,sBACA,gBACA;YAGQ,aAAa,kBAAkB,iBAAiB,YAAY,iBAAiB;YAE7E;EACV;EACA;EACA;EACA;EACA,OAAO;EACP;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,OAAO;EACP;EACA;EACA;EACA;;EAEA;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA,gBAAgB;IAAoB;;;EAEpC,UAAU;EACV,OAAO;EACP;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;;EAEA;EACA;EACA;EACA;IAAY;IAAe;;;EAE3B;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;;EAEA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA,OAAO;EACP;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA;EACA;EACA;EACA;;EAEA;;EAEA;;;;;;;;;YAUU;EACV;EACA;EACA;EACA;EACA;;EAEA,gBAAgB;EAChB;EACA;EACA;;EAEA;;EAEA;;YAGU;EACV;EACA;EACA;EACA;EACA,qBAAqB;EACrB;;EAEA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,YAAY;EACZ,OAAO;EACP;;YAGU;EACV,qBAAqB;EACrB;EACA;EACA,QAAQ;;wBAGM,iBAAiB,UAAU,QAAQ,YAAY;wBAI/C,iBAAiB,UAAU,QAAQ,YAAY;wBAI/C,kBAAkB,UAAU,QAAQ,YAAY;wBAIhD,sBAAsB,UAAU,QAAQ,YAAY;wBAIpD,gBAAgB,UAAU,QAAQ,YAAY;wBAI9C,mBAAmB,UAAU,QAAQ,YAAY;wBAIjD,iBAAiB,UAAU,QAAQ,YAAY,iBAAiB,gBAAgB;wBAIhF,kBAAkB,UAAU,QAAQ,YAAY,iBAAiB;wBAIjE,oBAAoB,MAAM,iBAAiB;wBAC3C,oBAAoB,QAAQ,SAAS;wBAOrC,uBAAuB,MAAM,iBAAiB;wBAI9C,YAAY,MAAM,iBAAiB;wBAKnC,YAAY,MAAM,iBAAiB"}
|
package/build/EntityMetadata.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityMetadata.js","names":[],"sources":["../src/EntityMetadata.ts"],"sourcesContent":["import { getInstanceData } from \"src/BaseEntity.ts\";\nimport { type ConfigApi, type Reactable, type ReactiveRule } from \"src/config.ts\";\nimport { getMetadataForType } from \"src/configure.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, type TimestampFields } from \"src/EntityManager.ts\";\nimport { type EnumMetadata } from \"src/EnumMetadata.ts\";\nimport type { DeepNew } from \"src/loading/loadHints.ts\";\nimport type { Column, ColumnDescriptors } from \"src/serde/columns.ts\";\nimport type { FieldSerde, PolymorphicKeySerde } from \"src/serde/fieldSerde.ts\";\n\nexport function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;\nexport function getMetadata<T extends Entity>(\n param: T | MaybeAbstractEntityConstructor<T> | EntityMetadata,\n): EntityMetadata {\n if (!param) throw new Error(`Cannot getMetadata of ${param}`);\n return (\n typeof param === \"function\" ? (param as any).metadata : \"cstr\" in param ? param : getInstanceData(param).metadata\n ) as EntityMetadata;\n}\n\n/** Returns the metadata layer that declares `fieldName`, i.e. `Task.tags` for `TaskOld.tags`. */\nexport function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata {\n if (!meta.allFields[fieldName]) throw new Error(`Field '${fieldName}' not found on ${meta.type}`);\n // I.e. `TaskOld.tags` is an STI-inherited `Task.tags` and should walk up, but `SmallPublisherGroup.publishers`\n // is a CTI-specialized `PublisherGroup.publishers` and should stay on `SmallPublisherGroup`.\n while (!(fieldName in meta.fields) && meta.allFields[fieldName]?.specialized !== true && meta.baseType) {\n meta = getMetadataForType(meta.baseType);\n }\n return meta;\n}\n\n/**\n * Runtime metadata about an entity.\n *\n * The `joist-codegen` step will generate this by reading the database schema at build/codegen\n * time, along with any customizations in `joist-config.json`.\n *\n * Note: This has no generic, like `T extends Entity`, because `Entity<IdType>` i.e. with\n * an unknown string/id type, causes issues when we want to generically mix `EntityMetadata`\n * of different types, that even liberally using `EntityMetadata<any>` did not avoid.\n */\nexport interface EntityMetadata<T extends Entity = any> {\n cstr: MaybeAbstractEntityConstructor<T>;\n type: string;\n /** How the domain entity's id is represented. */\n idType: \"tagged-string\" | \"untagged-string\" | \"number\";\n /** The database column type, i.e. used to do `::type` casts in Postgres. */\n idDbType: \"bigint\" | \"int\" | \"uuid\" | \"text\";\n tableName: string;\n /** Whether codegen verified this table is a supported SQL mutation target; does not gate reads. */\n supportsEmExecute?: boolean;\n /** If we're a subtype, our immediate base type's name, e.g. for `SmallPublisher` this would be `Publisher`. */\n baseType: string | undefined;\n inheritanceType?: \"sti\" | \"cti\" | undefined;\n /** Indicates the field to use to derive which subtype to instantiate; only set on the base meta. */\n stiDiscriminatorField?: string;\n /** The discriminator enum value for this subtype; only set on sub metas. */\n stiDiscriminatorValue?: number;\n /** Whether this type is abstract (cannot be instantiated directly). */\n ctiAbstract?: boolean;\n tagName: string;\n fields: Record<string, Field>;\n /** Physical storage descriptors, without CTI base columns; STI metadata shares its base table. */\n columns: ColumnDescriptors;\n allFields: Record<string, Field & { aliasSuffix: string; specialized?: true }>;\n /** Usually polys are in `allFields`, but we pull the components out for comp-specific finds, like `parentBook`. */\n polyComponentFields?: Record<string, Field & { aliasSuffix: string }>;\n // Using `any` to avoid type errors between BaseType.metadata & SubType.metadata static fields\n config: ConfigApi<any, any>;\n /** The lazy list of non-read-only reactables for this metadata and its base types. */\n reactables?: Reactable[];\n /** The lazy lookup of non-read-only reactables by source field name. */\n reactablesByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of all reactables for this metadata and its base types. */\n reactablesIncludingReadOnly?: Reactable[];\n /** The lazy lookup of all reactables by source field name. */\n reactablesIncludingReadOnlyByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of reactive validation rules for this metadata and its subtypes. */\n reactiveRules?: ReactiveRule[];\n /** The lazy list of reactive *commit* rules (post-flush/pre-commit) for this metadata and its subtypes. */\n reactiveCommitRules?: ReactiveRule[];\n /** Lazily-cached: whether flushing an entity of this type could trigger any `addCommitRule` work. */\n hasCommitRules?: boolean;\n /** The lazily-cached set of own `lazy` primitive field names, i.e. columns excluded from the default SELECT. */\n lazyFieldNames?: ReadonlySet<string>;\n /** The lazily-cached list of sync-derived (`hasReactiveField`-less) field names, recalced during flush. */\n syncDerivedFields?: string[];\n /** Lazily-cached: whether this entity has any `lazy` columns, i.e. so the default SELECT lists columns explicitly. */\n hasLazyColumns?: boolean;\n orderBy: string | undefined;\n /** Flat field names that can be used to find existing rows before creating. I.e. [[\"email\"], [\"author\", \"title\"]]. */\n uniqueBy?: string[][];\n timestampFields: TimestampFields | undefined;\n // Ideally this would be the application-specific EntityManager (to avoid anys), but it doesn't really matter\n factory: (em: EntityManager<any, any, any>, opts?: any) => DeepNew<T>;\n /** The list of base types for this subtype, e.g. for Dog it'd be [Animal, Mammal]. */\n baseTypes: EntityMetadata[];\n /** The list of subtypes for this base type, e.g. for Animal it'd be `[Mammal, Dog]`. */\n subTypes: EntityMetadata[];\n /** Cached `[...baseTypes, this]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfMetas?: EntityMetadata[];\n /** Cached `[...baseTypes, this, ...subTypes]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfAndSubMetas?: EntityMetadata[];\n /** The lazy lookup of subtypes by type name, i.e. `Animal.metadata.subTypesByType.get(\"Dog\")`. */\n subTypesByType?: ReadonlyMap<string, EntityMetadata>;\n /** The lazy lookup of STI subtypes by discriminator value, i.e. `Task.metadata.subTypesByStiValue.get(1)`. */\n subTypesByStiValue?: ReadonlyMap<unknown, EntityMetadata>;\n /** The lazy STI discriminator column name, i.e. `Task.metadata.stiDiscriminatorColumnName`. */\n stiDiscriminatorColumnName?: string;\n /** If the schema is lacking deferred FKs, this is our insertion order. */\n nonDeferredFkOrder?: number;\n}\n\nexport type Field =\n | PrimaryKeyField\n | PrimitiveField\n | EnumField\n | OneToManyField\n | LargeOneToManyField\n | ManyToOneField\n | ManyToManyField\n | ManyToManyEnumField\n | OneToOneField\n | PolymorphicField;\n\n// Only the fields that have defined `serde` keys; should be a mapped type of Field\nexport type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;\n\nexport type PrimaryKeyField = {\n kind: \"primaryKey\";\n fieldName: string;\n fieldIdName: undefined;\n required: true;\n serde: FieldSerde;\n immutable: true;\n};\n\nexport type PrimitiveField = {\n kind: \"primitive\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"orm\" | \"sync\" | \"async\" | false;\n protected: boolean;\n type: string | Function;\n serde: FieldSerde;\n immutable: boolean;\n citext?: boolean;\n default?: \"schema\" | \"config\";\n sanitize?: boolean;\n /** When true, this column is excluded from the entity's default SELECT and lazy-loaded via a `LazyField`. */\n lazy?: boolean;\n};\n\nexport type EnumField = {\n kind: \"enum\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"sync\" | \"async\" | false;\n enumDetailType: { getValues(): ReadonlyArray<unknown>; findById(id: any): unknown };\n serde: FieldSerde;\n immutable: boolean;\n default?: \"schema\" | \"config\";\n};\n\nexport type OneToManyField = {\n kind: \"o2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n orderBy?: { field: string; direction: \"ASC\" | \"DESC\" };\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\nexport type LargeOneToManyField = {\n kind: \"lo2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type ManyToOneField = {\n kind: \"m2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: FieldSerde;\n immutable: boolean;\n derived: \"async\" | false;\n default?: \"schema\" | \"config\";\n};\n\nexport type ManyToManyField = {\n kind: \"m2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n derived: \"async\" | \"otherSide\" | false;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\n/**\n * A many-to-many between an entity and an enum \"table\", e.g. `Publisher.logoColors` backed by a\n * `publisher_logo_colors` join table joining `publishers` to the `color` enum table.\n *\n * To the user this looks like an array of enum codes (`Color[]`), but unlike an enum-array column it\n * is lazy (needs a load hint) because it lives in its own join table.\n */\nexport type ManyToManyEnumField = {\n kind: \"m2mEnum\";\n fieldName: string;\n fieldIdName: undefined;\n required: false;\n derived: false;\n /** The enum's metadata, used to map enum codes <-> their numeric ids. */\n enumDetailType: EnumMetadata<any, any, number>;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n /** `[entityColumn, enumColumn]`, e.g. `[\"publisher_id\", \"color_id\"]`. */\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n};\n\nexport type OneToOneField = {\n kind: \"o2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type PolymorphicField = {\n kind: \"poly\";\n fieldName: string; // eg `parent`\n fieldIdName: string; // `parentId`\n required: boolean;\n components: PolymorphicFieldComponent[];\n serde: PolymorphicKeySerde;\n immutable: boolean;\n};\n\nexport type PolymorphicFieldComponent = {\n otherMetadata: () => EntityMetadata;\n otherFieldName: string; // eg `comment` or `comments`\n columnName: string; // eg `parent_book_id` or `parent_book_review_id`\n column: Column;\n};\n\nexport function isOneToManyField(ormField: Field): ormField is OneToManyField {\n return ormField.kind === \"o2m\";\n}\n\nexport function isManyToOneField(ormField: Field): ormField is ManyToOneField {\n return ormField.kind === \"m2o\";\n}\n\nexport function isManyToManyField(ormField: Field): ormField is ManyToManyField {\n return ormField.kind === \"m2m\";\n}\n\nexport function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField {\n return ormField.kind === \"m2mEnum\";\n}\n\nexport function isOneToOneField(ormField: Field): ormField is OneToOneField {\n return ormField.kind === \"o2o\";\n}\n\nexport function isPolymorphicField(ormField: Field): ormField is PolymorphicField {\n return ormField.kind === \"poly\";\n}\n\nexport function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField {\n return ormField.kind === \"m2o\" || ormField.kind === \"o2o\" || ormField.kind === \"poly\";\n}\n\nexport function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField {\n return ormField.kind === \"o2m\" || ormField.kind === \"m2m\";\n}\n\nexport function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];\nexport function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];\nexport function getBaseAndSelfMetas(param: Entity | EntityMetadata): EntityMetadata[] {\n return isEntity(param)\n ? getBaseSelfAndSubMetas(getMetadata(param))\n : (param.baseSelfMetas ?? [...param.baseTypes, param]);\n}\n\nexport function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[] {\n return meta.baseSelfAndSubMetas ?? [...meta.baseTypes, meta, ...meta.subTypes];\n}\n\nexport function getSubMetas(meta: EntityMetadata): EntityMetadata[] {\n // We should do recursion at some point\n return meta.subTypes;\n}\n\nexport function getBaseMeta(meta: EntityMetadata): EntityMetadata {\n if (!meta.baseType) {\n return meta;\n } else {\n return meta.baseTypes[0];\n }\n}\n"],"mappings":";;;;;;AAaA,SAAgB,YACd,OACgB;CAChB,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,yBAAyB,OAAO;CAC5D,OACE,OAAO,UAAU,aAAc,MAAc,WAAW,UAAU,QAAQ,QAAQ,gBAAgB,KAAK,CAAC,CAAC;AAE7G;;AAGA,SAAgB,oBAAoB,MAAsB,WAAmC;CAC3F,IAAI,CAAC,KAAK,UAAU,YAAY,MAAM,IAAI,MAAM,UAAU,UAAU,iBAAiB,KAAK,MAAM;CAGhG,OAAO,EAAE,aAAa,KAAK,WAAW,KAAK,UAAU,UAAU,EAAE,gBAAgB,QAAQ,KAAK,UAC5F,OAAO,mBAAmB,KAAK,QAAQ;CAEzC,OAAO;AACT;AA2PA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,kBAAkB,UAA8C;CAC9E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,sBAAsB,UAAkD;CACtF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,gBAAgB,UAA4C;CAC1E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,mBAAmB,UAA+C;CAChF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAAgF;CAC/G,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS;AACjF;AAEA,SAAgB,kBAAkB,UAA+D;CAC/F,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS;AACtD;AAIA,SAAgB,oBAAoB,OAAkD;CACpF,OAAO,SAAS,KAAK,IACjB,uBAAuB,YAAY,KAAK,CAAC,IACxC,MAAM,iBAAiB,CAAC,GAAG,MAAM,WAAW,KAAK;AACxD;AAEA,SAAgB,uBAAuB,MAAwC;CAC7E,OAAO,KAAK,uBAAuB;EAAC,GAAG,KAAK;EAAW;EAAM,GAAG,KAAK;CAAQ;AAC/E;AAEA,SAAgB,YAAY,MAAwC;CAElE,OAAO,KAAK;AACd;AAEA,SAAgB,YAAY,MAAsC;CAChE,IAAI,CAAC,KAAK,UACR,OAAO;MAEP,OAAO,KAAK,UAAU;AAE1B"}
|
|
1
|
+
{"version":3,"file":"EntityMetadata.js","names":[],"sources":["../src/EntityMetadata.ts"],"sourcesContent":["import { getInstanceData } from \"src/BaseEntity.ts\";\nimport type { ConfigApi, Reactable, ReactiveRule } from \"src/config.ts\";\nimport { getMetadataForType } from \"src/configure.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\nimport { type EntityManager, type MaybeAbstractEntityConstructor, type TimestampFields } from \"src/EntityManager.ts\";\nimport { type EnumMetadata } from \"src/EnumMetadata.ts\";\nimport type { DeepNew } from \"src/loading/loadHints.ts\";\nimport type { Column, ColumnDescriptors } from \"src/serde/columns.ts\";\nimport type { FieldSerde, PolymorphicKeySerde } from \"src/serde/fieldSerde.ts\";\nimport type { FieldTransitions } from \"src/transitions.ts\";\n\nexport function getMetadata<T extends Entity>(entity: T): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(type: MaybeAbstractEntityConstructor<T>): EntityMetadata<T>;\nexport function getMetadata<T extends Entity>(meta: EntityMetadata): EntityMetadata;\nexport function getMetadata<T extends Entity>(\n param: T | MaybeAbstractEntityConstructor<T> | EntityMetadata,\n): EntityMetadata {\n if (!param) throw new Error(`Cannot getMetadata of ${param}`);\n return (\n typeof param === \"function\" ? (param as any).metadata : \"cstr\" in param ? param : getInstanceData(param).metadata\n ) as EntityMetadata;\n}\n\n/** Returns the metadata layer that declares `fieldName`, i.e. `Task.tags` for `TaskOld.tags`. */\nexport function getMetadataForField(meta: EntityMetadata, fieldName: string): EntityMetadata {\n if (!meta.allFields[fieldName]) throw new Error(`Field '${fieldName}' not found on ${meta.type}`);\n // I.e. `TaskOld.tags` is an STI-inherited `Task.tags` and should walk up, but `SmallPublisherGroup.publishers`\n // is a CTI-specialized `PublisherGroup.publishers` and should stay on `SmallPublisherGroup`.\n while (!(fieldName in meta.fields) && meta.allFields[fieldName]?.specialized !== true && meta.baseType) {\n meta = getMetadataForType(meta.baseType);\n }\n return meta;\n}\n\n/**\n * Runtime metadata about an entity.\n *\n * The `joist-codegen` step will generate this by reading the database schema at build/codegen\n * time, along with any customizations in `joist-config.json`.\n *\n * Note: This has no generic, like `T extends Entity`, because `Entity<IdType>` i.e. with\n * an unknown string/id type, causes issues when we want to generically mix `EntityMetadata`\n * of different types, that even liberally using `EntityMetadata<any>` did not avoid.\n */\nexport interface EntityMetadata<T extends Entity = any> {\n cstr: MaybeAbstractEntityConstructor<T>;\n type: string;\n /** How the domain entity's id is represented. */\n idType: \"tagged-string\" | \"untagged-string\" | \"number\";\n /** The database column type, i.e. used to do `::type` casts in Postgres. */\n idDbType: \"bigint\" | \"int\" | \"uuid\" | \"text\";\n tableName: string;\n /** Whether codegen verified this table is a supported SQL mutation target; does not gate reads. */\n supportsEmExecute?: boolean;\n /** If we're a subtype, our immediate base type's name, e.g. for `SmallPublisher` this would be `Publisher`. */\n baseType: string | undefined;\n inheritanceType?: \"sti\" | \"cti\" | undefined;\n /** Indicates the field to use to derive which subtype to instantiate; only set on the base meta. */\n stiDiscriminatorField?: string;\n /** The discriminator enum value for this subtype; only set on sub metas. */\n stiDiscriminatorValue?: number;\n /** Whether this type is abstract (cannot be instantiated directly). */\n ctiAbstract?: boolean;\n tagName: string;\n fields: Record<string, Field>;\n /** Physical storage descriptors, without CTI base columns; STI metadata shares its base table. */\n columns: ColumnDescriptors;\n allFields: Record<string, Field & { aliasSuffix: string; specialized?: true }>;\n /** Usually polys are in `allFields`, but we pull the components out for comp-specific finds, like `parentBook`. */\n polyComponentFields?: Record<string, Field & { aliasSuffix: string }>;\n // Using `any` to avoid type errors between BaseType.metadata & SubType.metadata static fields\n config: ConfigApi<any, any>;\n /** The lazy lookup of transition config by field, including config from base types. */\n transitions?: ReadonlyMap<string, FieldTransitions>;\n /** The lazy list of non-read-only reactables for this metadata and its base types. */\n reactables?: Reactable[];\n /** The lazy lookup of non-read-only reactables by source field name. */\n reactablesByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of all reactables for this metadata and its base types. */\n reactablesIncludingReadOnly?: Reactable[];\n /** The lazy lookup of all reactables by source field name. */\n reactablesIncludingReadOnlyByField?: ReadonlyMap<string, Reactable[]>;\n /** The lazy list of reactive validation rules for this metadata and its subtypes. */\n reactiveRules?: ReactiveRule[];\n /** The lazy list of reactive *commit* rules (post-flush/pre-commit) for this metadata and its subtypes. */\n reactiveCommitRules?: ReactiveRule[];\n /** Lazily-cached: whether flushing an entity of this type could trigger any `addCommitRule` work. */\n hasCommitRules?: boolean;\n /** The lazily-cached set of own `lazy` primitive field names, i.e. columns excluded from the default SELECT. */\n lazyFieldNames?: ReadonlySet<string>;\n /** The lazily-cached list of sync-derived (`hasReactiveField`-less) field names, recalced during flush. */\n syncDerivedFields?: string[];\n /** Lazily-cached: whether this entity has any `lazy` columns, i.e. so the default SELECT lists columns explicitly. */\n hasLazyColumns?: boolean;\n orderBy: string | undefined;\n /** Flat field names that can be used to find existing rows before creating. I.e. [[\"email\"], [\"author\", \"title\"]]. */\n uniqueBy?: string[][];\n timestampFields: TimestampFields | undefined;\n // Ideally this would be the application-specific EntityManager (to avoid anys), but it doesn't really matter\n factory: (em: EntityManager<any, any, any>, opts?: any) => DeepNew<T>;\n /** The list of base types for this subtype, e.g. for Dog it'd be [Animal, Mammal]. */\n baseTypes: EntityMetadata[];\n /** The list of subtypes for this base type, e.g. for Animal it'd be `[Mammal, Dog]`. */\n subTypes: EntityMetadata[];\n /** Cached `[...baseTypes, this]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfMetas?: EntityMetadata[];\n /** Cached `[...baseTypes, this, ...subTypes]` set up by `configureMetadata`, so hot paths avoid re-allocating it. */\n baseSelfAndSubMetas?: EntityMetadata[];\n /** The lazy lookup of subtypes by type name, i.e. `Animal.metadata.subTypesByType.get(\"Dog\")`. */\n subTypesByType?: ReadonlyMap<string, EntityMetadata>;\n /** The lazy lookup of STI subtypes by discriminator value, i.e. `Task.metadata.subTypesByStiValue.get(1)`. */\n subTypesByStiValue?: ReadonlyMap<unknown, EntityMetadata>;\n /** The lazy STI discriminator column name, i.e. `Task.metadata.stiDiscriminatorColumnName`. */\n stiDiscriminatorColumnName?: string;\n /** If the schema is lacking deferred FKs, this is our insertion order. */\n nonDeferredFkOrder?: number;\n}\n\nexport type Field =\n | PrimaryKeyField\n | PrimitiveField\n | EnumField\n | OneToManyField\n | LargeOneToManyField\n | ManyToOneField\n | ManyToManyField\n | ManyToManyEnumField\n | OneToOneField\n | PolymorphicField;\n\n// Only the fields that have defined `serde` keys; should be a mapped type of Field\nexport type SerdeField = PrimaryKeyField | PrimitiveField | EnumField | ManyToOneField | PolymorphicField;\n\nexport type PrimaryKeyField = {\n kind: \"primaryKey\";\n fieldName: string;\n fieldIdName: undefined;\n required: true;\n serde: FieldSerde;\n immutable: true;\n};\n\nexport type PrimitiveField = {\n kind: \"primitive\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"orm\" | \"sync\" | \"async\" | false;\n protected: boolean;\n type: string | Function;\n serde: FieldSerde;\n immutable: boolean;\n citext?: boolean;\n default?: \"schema\" | \"config\";\n sanitize?: boolean;\n /** When true, this column is excluded from the entity's default SELECT and lazy-loaded via a `LazyField`. */\n lazy?: boolean;\n};\n\nexport type EnumField = {\n kind: \"enum\";\n fieldName: string;\n fieldIdName: undefined;\n required: boolean;\n derived: \"sync\" | \"async\" | false;\n enumDetailType: EnumMetadata<any, { name: string }>;\n /** The enum object, i.e. `{ Draft: \"DRAFT\" }`. */\n enumType: Record<string, unknown>;\n serde: FieldSerde;\n immutable: boolean;\n default?: \"schema\" | \"config\";\n};\n\nexport type OneToManyField = {\n kind: \"o2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n orderBy?: { field: string; direction: \"ASC\" | \"DESC\" };\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\nexport type LargeOneToManyField = {\n kind: \"lo2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type ManyToOneField = {\n kind: \"m2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: FieldSerde;\n immutable: boolean;\n derived: \"async\" | false;\n default?: \"schema\" | \"config\";\n};\n\nexport type ManyToManyField = {\n kind: \"m2m\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n derived: \"async\" | \"otherSide\" | false;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n /** When `\"include\"`, this collection's `.get`/`.load` returns soft-deleted entities instead of hiding them. */\n softDeletes?: \"include\" | \"exclude\";\n};\n\n/**\n * A many-to-many between an entity and an enum \"table\", e.g. `Publisher.logoColors` backed by a\n * `publisher_logo_colors` join table joining `publishers` to the `color` enum table.\n *\n * To the user this looks like an array of enum codes (`Color[]`), but unlike an enum-array column it\n * is lazy (needs a load hint) because it lives in its own join table.\n */\nexport type ManyToManyEnumField = {\n kind: \"m2mEnum\";\n fieldName: string;\n fieldIdName: undefined;\n required: false;\n derived: false;\n /** The enum's metadata, used to map enum codes <-> their numeric ids. */\n enumDetailType: EnumMetadata<any, any, number>;\n serde: undefined;\n immutable: false;\n joinTableName: string;\n /** `[entityColumn, enumColumn]`, e.g. `[\"publisher_id\", \"color_id\"]`. */\n columnNames: [string, string];\n /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */\n hasJoinTableId: boolean;\n};\n\nexport type OneToOneField = {\n kind: \"o2o\";\n fieldName: string;\n fieldIdName: string;\n required: boolean;\n otherMetadata: () => EntityMetadata;\n otherFieldName: string;\n /** Useful when our other side is a poly, to find which component points back to us. */\n otherColumnName: string;\n serde: undefined;\n immutable: false;\n};\n\nexport type PolymorphicField = {\n kind: \"poly\";\n fieldName: string; // eg `parent`\n fieldIdName: string; // `parentId`\n required: boolean;\n components: PolymorphicFieldComponent[];\n serde: PolymorphicKeySerde;\n immutable: boolean;\n};\n\nexport type PolymorphicFieldComponent = {\n otherMetadata: () => EntityMetadata;\n otherFieldName: string; // eg `comment` or `comments`\n columnName: string; // eg `parent_book_id` or `parent_book_review_id`\n column: Column;\n};\n\nexport function isOneToManyField(ormField: Field): ormField is OneToManyField {\n return ormField.kind === \"o2m\";\n}\n\nexport function isManyToOneField(ormField: Field): ormField is ManyToOneField {\n return ormField.kind === \"m2o\";\n}\n\nexport function isManyToManyField(ormField: Field): ormField is ManyToManyField {\n return ormField.kind === \"m2m\";\n}\n\nexport function isManyToManyEnumField(ormField: Field): ormField is ManyToManyEnumField {\n return ormField.kind === \"m2mEnum\";\n}\n\nexport function isOneToOneField(ormField: Field): ormField is OneToOneField {\n return ormField.kind === \"o2o\";\n}\n\nexport function isPolymorphicField(ormField: Field): ormField is PolymorphicField {\n return ormField.kind === \"poly\";\n}\n\nexport function isReferenceField(ormField: Field): ormField is ManyToOneField | OneToOneField | PolymorphicField {\n return ormField.kind === \"m2o\" || ormField.kind === \"o2o\" || ormField.kind === \"poly\";\n}\n\nexport function isCollectionField(ormField: Field): ormField is OneToManyField | ManyToManyField {\n return ormField.kind === \"o2m\" || ormField.kind === \"m2m\";\n}\n\nexport function getBaseAndSelfMetas(meta: EntityMetadata): EntityMetadata[];\nexport function getBaseAndSelfMetas(entity: Entity): EntityMetadata[];\nexport function getBaseAndSelfMetas(param: Entity | EntityMetadata): EntityMetadata[] {\n return isEntity(param)\n ? getBaseSelfAndSubMetas(getMetadata(param))\n : (param.baseSelfMetas ?? [...param.baseTypes, param]);\n}\n\nexport function getBaseSelfAndSubMetas(meta: EntityMetadata): EntityMetadata[] {\n return meta.baseSelfAndSubMetas ?? [...meta.baseTypes, meta, ...meta.subTypes];\n}\n\nexport function getSubMetas(meta: EntityMetadata): EntityMetadata[] {\n // We should do recursion at some point\n return meta.subTypes;\n}\n\nexport function getBaseMeta(meta: EntityMetadata): EntityMetadata {\n if (!meta.baseType) {\n return meta;\n } else {\n return meta.baseTypes[0];\n }\n}\n"],"mappings":";;;;;AAcA,SAAgB,YACd,OACgB;CAChB,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,yBAAyB,OAAO;CAC5D,OACE,OAAO,UAAU,aAAc,MAAc,WAAW,UAAU,QAAQ,QAAQ,gBAAgB,KAAK,CAAC,CAAC;AAE7G;;AAGA,SAAgB,oBAAoB,MAAsB,WAAmC;CAC3F,IAAI,CAAC,KAAK,UAAU,YAAY,MAAM,IAAI,MAAM,UAAU,UAAU,iBAAiB,KAAK,MAAM;CAGhG,OAAO,EAAE,aAAa,KAAK,WAAW,KAAK,UAAU,UAAU,EAAE,gBAAgB,QAAQ,KAAK,UAC5F,OAAO,mBAAmB,KAAK,QAAQ;CAEzC,OAAO;AACT;AA+PA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAA6C;CAC5E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,kBAAkB,UAA8C;CAC9E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,sBAAsB,UAAkD;CACtF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,gBAAgB,UAA4C;CAC1E,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,mBAAmB,UAA+C;CAChF,OAAO,SAAS,SAAS;AAC3B;AAEA,SAAgB,iBAAiB,UAAgF;CAC/G,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS;AACjF;AAEA,SAAgB,kBAAkB,UAA+D;CAC/F,OAAO,SAAS,SAAS,SAAS,SAAS,SAAS;AACtD;AAIA,SAAgB,oBAAoB,OAAkD;CACpF,OAAO,SAAS,KAAK,IACjB,uBAAuB,YAAY,KAAK,CAAC,IACxC,MAAM,iBAAiB,CAAC,GAAG,MAAM,WAAW,KAAK;AACxD;AAEA,SAAgB,uBAAuB,MAAwC;CAC7E,OAAO,KAAK,uBAAuB;EAAC,GAAG,KAAK;EAAW;EAAM,GAAG,KAAK;CAAQ;AAC/E;AAEA,SAAgB,YAAY,MAAwC;CAElE,OAAO,KAAK;AACd;AAEA,SAAgB,YAAY,MAAsC;CAChE,IAAI,CAAC,KAAK,UACR,OAAO;MAEP,OAAO,KAAK,UAAU;AAE1B"}
|
package/build/EnumMetadata.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/EnumMetadata.d.ts
|
|
2
|
-
interface EnumMetadata<C, D, I extends number | string = number | string> {
|
|
2
|
+
export interface EnumMetadata<C, D, I extends number | string = number | string> {
|
|
3
3
|
/** Returns the enum type's name, i.e. `AuthorStatus`. */
|
|
4
4
|
name: string;
|
|
5
5
|
/** Gets the `code` details, i.e. `Statuses.getByCode(Status.DRAFT)`. */
|
|
@@ -14,5 +14,4 @@ interface EnumMetadata<C, D, I extends number | string = number | string> {
|
|
|
14
14
|
getDetails(): ReadonlyArray<D>;
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
|
-
export { EnumMetadata };
|
|
18
17
|
//# sourceMappingURL=EnumMetadata.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumMetadata.d.cts","names":[],"sources":["../src/EnumMetadata.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"EnumMetadata.d.cts","names":[],"sources":["../src/EnumMetadata.ts"],"mappings":";iBAAiB,aAAa,GAAG,GAAG;;EAElC;;EAGA,UAAU,MAAM,IAAI;;EAGpB,WAAW,eAAe;;EAG1B,SAAS,IAAI,IAAI;;EAGjB,aAAa,cAAc;;EAG3B,cAAc,cAAc"}
|
package/build/EnumMetadata.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/EnumMetadata.d.ts
|
|
2
|
-
interface EnumMetadata<C, D, I extends number | string = number | string> {
|
|
2
|
+
export interface EnumMetadata<C, D, I extends number | string = number | string> {
|
|
3
3
|
/** Returns the enum type's name, i.e. `AuthorStatus`. */
|
|
4
4
|
name: string;
|
|
5
5
|
/** Gets the `code` details, i.e. `Statuses.getByCode(Status.DRAFT)`. */
|
|
@@ -14,5 +14,4 @@ interface EnumMetadata<C, D, I extends number | string = number | string> {
|
|
|
14
14
|
getDetails(): ReadonlyArray<D>;
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
|
-
export { EnumMetadata };
|
|
18
17
|
//# sourceMappingURL=EnumMetadata.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumMetadata.d.mts","names":[],"sources":["../src/EnumMetadata.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"EnumMetadata.d.mts","names":[],"sources":["../src/EnumMetadata.ts"],"mappings":";iBAAiB,aAAa,GAAG,GAAG;;EAElC;;EAGA,UAAU,MAAM,IAAI;;EAGpB,WAAW,eAAe;;EAG1B,SAAS,IAAI,IAAI;;EAGjB,aAAa,cAAc;;EAG3B,cAAc,cAAc"}
|