joist-core 2.5.0-next.2 → 2.5.0-next.21
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.cjs +33 -3
- package/build/BaseEntity.cjs.map +1 -1
- package/build/BaseEntity.d.cts +6 -4
- package/build/BaseEntity.d.cts.map +1 -1
- package/build/BaseEntity.d.mts +6 -4
- package/build/BaseEntity.d.mts.map +1 -1
- package/build/BaseEntity.js +33 -4
- package/build/BaseEntity.js.map +1 -1
- package/build/Entity.cjs +2 -3
- package/build/Entity.d.cts +0 -2
- package/build/Entity.d.cts.map +1 -1
- package/build/Entity.d.mts +0 -2
- package/build/Entity.d.mts.map +1 -1
- package/build/Entity.js +2 -3
- package/build/EntityFields.d.cts +0 -2
- package/build/EntityFields.d.cts.map +1 -1
- package/build/EntityFields.d.mts +0 -2
- package/build/EntityFields.d.mts.map +1 -1
- package/build/EntityManager.cjs +185 -103
- package/build/EntityManager.cjs.map +1 -1
- package/build/EntityManager.d.cts +50 -37
- package/build/EntityManager.d.cts.map +1 -1
- package/build/EntityManager.d.mts +50 -37
- package/build/EntityManager.d.mts.map +1 -1
- package/build/EntityManager.js +185 -104
- package/build/EntityManager.js.map +1 -1
- package/build/EntityMetadata.cjs +3 -4
- package/build/EntityMetadata.cjs.map +1 -1
- package/build/EntityMetadata.d.cts +8 -6
- package/build/EntityMetadata.d.cts.map +1 -1
- package/build/EntityMetadata.d.mts +8 -6
- package/build/EntityMetadata.d.mts.map +1 -1
- package/build/EntityMetadata.js +3 -4
- package/build/EntityMetadata.js.map +1 -1
- package/build/EnumMetadata.d.cts +0 -2
- package/build/EnumMetadata.d.cts.map +1 -1
- package/build/EnumMetadata.d.mts +0 -2
- package/build/EnumMetadata.d.mts.map +1 -1
- package/build/IndexManager.cjs +4 -5
- package/build/IndexManager.d.cts +1 -3
- package/build/IndexManager.d.cts.map +1 -1
- package/build/IndexManager.d.mts +1 -3
- package/build/IndexManager.d.mts.map +1 -1
- package/build/IndexManager.js +4 -5
- package/build/InstanceData.cjs +12 -6
- package/build/InstanceData.cjs.map +1 -1
- package/build/InstanceData.d.cts +9 -5
- package/build/InstanceData.d.cts.map +1 -1
- package/build/InstanceData.d.mts +9 -5
- package/build/InstanceData.d.mts.map +1 -1
- package/build/InstanceData.js +12 -6
- package/build/InstanceData.js.map +1 -1
- package/build/PluginManager.cjs +21 -8
- package/build/PluginManager.cjs.map +1 -1
- package/build/PluginManager.d.cts +19 -7
- package/build/PluginManager.d.cts.map +1 -1
- package/build/PluginManager.d.mts +19 -7
- package/build/PluginManager.d.mts.map +1 -1
- package/build/PluginManager.js +21 -8
- package/build/PluginManager.js.map +1 -1
- package/build/RowData.cjs +1 -2
- package/build/RowData.d.cts +0 -2
- package/build/RowData.d.cts.map +1 -1
- package/build/RowData.d.mts +0 -2
- package/build/RowData.d.mts.map +1 -1
- package/build/RowData.js +1 -2
- package/build/_virtual/_rolldown/runtime.cjs +1 -2
- package/build/batchloaders/BatchLoader.cjs +1 -2
- package/build/batchloaders/BatchLoader.d.cts +0 -2
- package/build/batchloaders/BatchLoader.d.cts.map +1 -1
- package/build/batchloaders/BatchLoader.d.mts +0 -2
- package/build/batchloaders/BatchLoader.d.mts.map +1 -1
- package/build/batchloaders/BatchLoader.js +1 -2
- package/build/batchloaders/enumCollectionBatchLoader.cjs +4 -5
- package/build/batchloaders/enumCollectionBatchLoader.cjs.map +1 -1
- package/build/batchloaders/enumCollectionBatchLoader.d.cts +1 -3
- package/build/batchloaders/enumCollectionBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/enumCollectionBatchLoader.d.mts +1 -3
- package/build/batchloaders/enumCollectionBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/enumCollectionBatchLoader.js +4 -5
- package/build/batchloaders/enumCollectionBatchLoader.js.map +1 -1
- package/build/batchloaders/loadBatchLoader.cjs +9 -9
- package/build/batchloaders/loadBatchLoader.cjs.map +1 -1
- package/build/batchloaders/loadBatchLoader.d.cts +3 -5
- package/build/batchloaders/loadBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/loadBatchLoader.d.mts +3 -5
- package/build/batchloaders/loadBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/loadBatchLoader.js +9 -9
- package/build/batchloaders/loadBatchLoader.js.map +1 -1
- package/build/batchloaders/manyToManyBatchLoader.cjs +5 -6
- package/build/batchloaders/manyToManyBatchLoader.cjs.map +1 -1
- package/build/batchloaders/manyToManyBatchLoader.d.cts +1 -3
- package/build/batchloaders/manyToManyBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/manyToManyBatchLoader.d.mts +1 -3
- package/build/batchloaders/manyToManyBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/manyToManyBatchLoader.js +5 -6
- package/build/batchloaders/manyToManyBatchLoader.js.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.cjs +5 -6
- package/build/batchloaders/oneToManyBatchLoader.cjs.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.d.cts +2 -4
- package/build/batchloaders/oneToManyBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.d.mts +2 -4
- package/build/batchloaders/oneToManyBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/oneToManyBatchLoader.js +6 -7
- package/build/batchloaders/oneToManyBatchLoader.js.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.cjs +7 -8
- package/build/batchloaders/oneToOneBatchLoader.cjs.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.d.cts +2 -4
- package/build/batchloaders/oneToOneBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.d.mts +2 -4
- package/build/batchloaders/oneToOneBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/oneToOneBatchLoader.js +7 -8
- package/build/batchloaders/oneToOneBatchLoader.js.map +1 -1
- package/build/batchloaders/populateBatchLoader.cjs +14 -18
- package/build/batchloaders/populateBatchLoader.cjs.map +1 -1
- package/build/batchloaders/populateBatchLoader.d.cts +2 -4
- package/build/batchloaders/populateBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/populateBatchLoader.d.mts +2 -4
- package/build/batchloaders/populateBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/populateBatchLoader.js +14 -18
- package/build/batchloaders/populateBatchLoader.js.map +1 -1
- package/build/batchloaders/recursiveChildrenBatchLoader.cjs +11 -11
- package/build/batchloaders/recursiveChildrenBatchLoader.cjs.map +1 -1
- package/build/batchloaders/recursiveChildrenBatchLoader.d.cts +2 -4
- package/build/batchloaders/recursiveChildrenBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/recursiveChildrenBatchLoader.d.mts +2 -4
- package/build/batchloaders/recursiveChildrenBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/recursiveChildrenBatchLoader.js +11 -11
- package/build/batchloaders/recursiveChildrenBatchLoader.js.map +1 -1
- package/build/batchloaders/recursiveM2mBatchLoader.cjs +7 -8
- package/build/batchloaders/recursiveM2mBatchLoader.cjs.map +1 -1
- package/build/batchloaders/recursiveM2mBatchLoader.d.cts +2 -4
- package/build/batchloaders/recursiveM2mBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/recursiveM2mBatchLoader.d.mts +2 -4
- package/build/batchloaders/recursiveM2mBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/recursiveM2mBatchLoader.js +7 -8
- package/build/batchloaders/recursiveM2mBatchLoader.js.map +1 -1
- package/build/batchloaders/recursiveParentsBatchLoader.cjs +7 -8
- package/build/batchloaders/recursiveParentsBatchLoader.cjs.map +1 -1
- package/build/batchloaders/recursiveParentsBatchLoader.d.cts +2 -4
- package/build/batchloaders/recursiveParentsBatchLoader.d.cts.map +1 -1
- package/build/batchloaders/recursiveParentsBatchLoader.d.mts +2 -4
- package/build/batchloaders/recursiveParentsBatchLoader.d.mts.map +1 -1
- package/build/batchloaders/recursiveParentsBatchLoader.js +7 -8
- package/build/batchloaders/recursiveParentsBatchLoader.js.map +1 -1
- package/build/changes.cjs +7 -8
- package/build/changes.d.cts +3 -5
- package/build/changes.d.cts.map +1 -1
- package/build/changes.d.mts +3 -5
- package/build/changes.d.mts.map +1 -1
- package/build/changes.js +7 -8
- package/build/config.cjs +9 -10
- package/build/config.d.cts +6 -8
- package/build/config.d.cts.map +1 -1
- package/build/config.d.mts +6 -8
- package/build/config.d.mts.map +1 -1
- package/build/config.js +9 -10
- package/build/configure.cjs +11 -12
- package/build/configure.d.cts +3 -5
- package/build/configure.d.cts.map +1 -1
- package/build/configure.d.mts +3 -5
- package/build/configure.d.mts.map +1 -1
- package/build/configure.js +11 -12
- package/build/dataloaders/buildCandidateBatchQuery.cjs +499 -0
- package/build/dataloaders/buildCandidateBatchQuery.cjs.map +1 -0
- package/build/dataloaders/buildCandidateBatchQuery.d.cts +57 -0
- package/build/dataloaders/buildCandidateBatchQuery.d.cts.map +1 -0
- package/build/dataloaders/buildCandidateBatchQuery.d.mts +57 -0
- package/build/dataloaders/buildCandidateBatchQuery.d.mts.map +1 -0
- package/build/dataloaders/buildCandidateBatchQuery.js +498 -0
- package/build/dataloaders/buildCandidateBatchQuery.js.map +1 -0
- package/build/dataloaders/collectFindArguments.cjs +48 -0
- package/build/dataloaders/collectFindArguments.cjs.map +1 -0
- package/build/dataloaders/collectFindArguments.d.cts +31 -0
- package/build/dataloaders/collectFindArguments.d.cts.map +1 -0
- package/build/dataloaders/collectFindArguments.d.mts +31 -0
- package/build/dataloaders/collectFindArguments.d.mts.map +1 -0
- package/build/dataloaders/collectFindArguments.js +47 -0
- package/build/dataloaders/collectFindArguments.js.map +1 -0
- package/build/dataloaders/fastWhereFilterHash.cjs +3 -4
- package/build/dataloaders/fastWhereFilterHash.d.cts +0 -2
- package/build/dataloaders/fastWhereFilterHash.d.cts.map +1 -1
- package/build/dataloaders/fastWhereFilterHash.d.mts +0 -2
- package/build/dataloaders/fastWhereFilterHash.d.mts.map +1 -1
- package/build/dataloaders/fastWhereFilterHash.js +3 -4
- package/build/dataloaders/findByUniqueDataLoader.cjs +2 -3
- package/build/dataloaders/findByUniqueDataLoader.d.cts +2 -4
- package/build/dataloaders/findByUniqueDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.d.mts +2 -4
- package/build/dataloaders/findByUniqueDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findByUniqueDataLoader.js +2 -3
- package/build/dataloaders/findCountDataLoader.cjs +8 -9
- package/build/dataloaders/findCountDataLoader.d.cts +3 -5
- package/build/dataloaders/findCountDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findCountDataLoader.d.mts +3 -5
- package/build/dataloaders/findCountDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findCountDataLoader.js +8 -9
- package/build/dataloaders/findDataLoader.cjs +48 -77
- package/build/dataloaders/findDataLoader.cjs.map +1 -1
- package/build/dataloaders/findDataLoader.d.cts +5 -7
- package/build/dataloaders/findDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findDataLoader.d.mts +5 -7
- package/build/dataloaders/findDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findDataLoader.js +48 -77
- package/build/dataloaders/findDataLoader.js.map +1 -1
- package/build/dataloaders/findIdsDataLoader.cjs +6 -7
- package/build/dataloaders/findIdsDataLoader.d.cts +2 -4
- package/build/dataloaders/findIdsDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findIdsDataLoader.d.mts +2 -4
- package/build/dataloaders/findIdsDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findIdsDataLoader.js +6 -7
- package/build/dataloaders/findOrCreateDataLoader.cjs +7 -8
- package/build/dataloaders/findOrCreateDataLoader.d.cts +2 -4
- package/build/dataloaders/findOrCreateDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findOrCreateDataLoader.d.mts +2 -4
- package/build/dataloaders/findOrCreateDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findOrCreateDataLoader.js +7 -8
- package/build/dataloaders/findPaginatedDataLoader.cjs +6 -7
- package/build/dataloaders/findPaginatedDataLoader.d.cts +3 -5
- package/build/dataloaders/findPaginatedDataLoader.d.cts.map +1 -1
- package/build/dataloaders/findPaginatedDataLoader.d.mts +3 -5
- package/build/dataloaders/findPaginatedDataLoader.d.mts.map +1 -1
- package/build/dataloaders/findPaginatedDataLoader.js +6 -7
- package/build/dataloaders/lensDataLoader.cjs +5 -6
- package/build/dataloaders/lensDataLoader.d.cts +1 -3
- package/build/dataloaders/lensDataLoader.d.cts.map +1 -1
- package/build/dataloaders/lensDataLoader.d.mts +1 -3
- package/build/dataloaders/lensDataLoader.d.mts.map +1 -1
- package/build/dataloaders/lensDataLoader.js +5 -6
- package/build/dataloaders/manyToManyFindDataLoader.cjs +1 -2
- package/build/dataloaders/manyToManyFindDataLoader.d.cts +2 -4
- package/build/dataloaders/manyToManyFindDataLoader.d.cts.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.mts +2 -4
- package/build/dataloaders/manyToManyFindDataLoader.d.mts.map +1 -1
- package/build/dataloaders/manyToManyFindDataLoader.js +1 -2
- package/build/dataloaders/oneToManyFindDataLoader.cjs +7 -5
- package/build/dataloaders/oneToManyFindDataLoader.cjs.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.cts +2 -4
- package/build/dataloaders/oneToManyFindDataLoader.d.cts.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.mts +2 -4
- package/build/dataloaders/oneToManyFindDataLoader.d.mts.map +1 -1
- package/build/dataloaders/oneToManyFindDataLoader.js +8 -6
- package/build/dataloaders/oneToManyFindDataLoader.js.map +1 -1
- package/build/defaults.cjs +7 -8
- package/build/defaults.d.cts +2 -4
- package/build/defaults.d.cts.map +1 -1
- package/build/defaults.d.mts +2 -4
- package/build/defaults.d.mts.map +1 -1
- package/build/defaults.js +7 -8
- package/build/drivers/Driver.cjs +1 -1
- package/build/drivers/Driver.d.cts +2 -4
- package/build/drivers/Driver.d.cts.map +1 -1
- package/build/drivers/Driver.d.mts +2 -4
- package/build/drivers/Driver.d.mts.map +1 -1
- package/build/drivers/Driver.js +1 -1
- package/build/drivers/EntityWriter.cjs +6 -7
- package/build/drivers/EntityWriter.d.cts +1 -3
- package/build/drivers/EntityWriter.d.cts.map +1 -1
- package/build/drivers/EntityWriter.d.mts +1 -3
- package/build/drivers/EntityWriter.d.mts.map +1 -1
- package/build/drivers/EntityWriter.js +6 -7
- package/build/drivers/IdAssigner.cjs +7 -4
- package/build/drivers/IdAssigner.cjs.map +1 -1
- package/build/drivers/IdAssigner.d.cts +1 -2
- package/build/drivers/IdAssigner.d.cts.map +1 -1
- package/build/drivers/IdAssigner.d.mts +1 -2
- package/build/drivers/IdAssigner.d.mts.map +1 -1
- package/build/drivers/IdAssigner.js +7 -4
- package/build/drivers/IdAssigner.js.map +1 -1
- package/build/drivers/driverApi.cjs +4 -5
- package/build/drivers/driverApi.d.cts +2 -4
- package/build/drivers/driverApi.d.cts.map +1 -1
- package/build/drivers/driverApi.d.mts +2 -4
- package/build/drivers/driverApi.d.mts.map +1 -1
- package/build/drivers/driverApi.js +4 -5
- package/build/drivers/index.d.cts +1 -1
- package/build/drivers/index.d.mts +1 -1
- package/build/fields.cjs +87 -17
- package/build/fields.cjs.map +1 -1
- package/build/fields.d.cts +8 -2
- package/build/fields.d.cts.map +1 -1
- package/build/fields.d.mts +8 -2
- package/build/fields.d.mts.map +1 -1
- package/build/fields.js +87 -19
- package/build/fields.js.map +1 -1
- package/build/flush/FlushLock.cjs +1 -2
- package/build/flush/FlushLock.cjs.map +1 -1
- package/build/flush/FlushLock.d.cts +0 -2
- package/build/flush/FlushLock.d.cts.map +1 -1
- package/build/flush/FlushLock.d.mts +0 -2
- package/build/flush/FlushLock.d.mts.map +1 -1
- package/build/flush/FlushLock.js +1 -2
- package/build/flush/JoinRows.cjs +10 -10
- package/build/flush/JoinRows.cjs.map +1 -1
- package/build/flush/JoinRows.d.cts +2 -4
- package/build/flush/JoinRows.d.cts.map +1 -1
- package/build/flush/JoinRows.d.mts +2 -4
- package/build/flush/JoinRows.d.mts.map +1 -1
- package/build/flush/JoinRows.js +10 -10
- package/build/flush/JoinRows.js.map +1 -1
- package/build/flush/PendingChanges.d.cts +0 -2
- package/build/flush/PendingChanges.d.cts.map +1 -1
- package/build/flush/PendingChanges.d.mts +0 -2
- package/build/flush/PendingChanges.d.mts.map +1 -1
- package/build/flush/ReadDrift.cjs +7 -8
- package/build/flush/ReadDrift.cjs.map +1 -1
- package/build/flush/ReadDrift.d.cts +2 -4
- package/build/flush/ReadDrift.d.cts.map +1 -1
- package/build/flush/ReadDrift.d.mts +2 -4
- package/build/flush/ReadDrift.d.mts.map +1 -1
- package/build/flush/ReadDrift.js +7 -8
- package/build/flush/ReadDrift.js.map +1 -1
- package/build/flush/Todo.cjs +3 -4
- package/build/flush/Todo.d.cts +2 -4
- package/build/flush/Todo.d.cts.map +1 -1
- package/build/flush/Todo.d.mts +2 -4
- package/build/flush/Todo.d.mts.map +1 -1
- package/build/flush/Todo.js +3 -4
- package/build/getProperties.cjs +3 -4
- package/build/getProperties.d.cts +0 -2
- package/build/getProperties.d.cts.map +1 -1
- package/build/getProperties.d.mts +0 -2
- package/build/getProperties.d.mts.map +1 -1
- package/build/getProperties.js +3 -4
- package/build/index.cjs +59 -57
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +51 -53
- package/build/index.d.cts.map +1 -1
- package/build/index.d.mts +51 -53
- package/build/index.d.mts.map +1 -1
- package/build/index.js +59 -58
- package/build/index.js.map +1 -1
- package/build/json.cjs +12 -13
- package/build/json.cjs.map +1 -1
- package/build/json.d.cts +5 -7
- package/build/json.d.cts.map +1 -1
- package/build/json.d.mts +5 -7
- package/build/json.d.mts.map +1 -1
- package/build/json.js +12 -13
- package/build/json.js.map +1 -1
- package/build/k.cjs +1 -2
- package/build/k.js +1 -2
- package/build/keys.cjs +5 -6
- package/build/keys.d.cts +3 -5
- package/build/keys.d.cts.map +1 -1
- package/build/keys.d.mts +3 -5
- package/build/keys.d.mts.map +1 -1
- package/build/keys.js +5 -6
- package/build/loading/HintTree.cjs +1 -2
- package/build/loading/HintTree.d.cts +2 -4
- package/build/loading/HintTree.d.cts.map +1 -1
- package/build/loading/HintTree.d.mts +2 -4
- package/build/loading/HintTree.d.mts.map +1 -1
- package/build/loading/HintTree.js +1 -2
- package/build/loading/IsLoadedCache.cjs +1 -2
- package/build/loading/IsLoadedCache.d.cts +0 -2
- package/build/loading/IsLoadedCache.d.cts.map +1 -1
- package/build/loading/IsLoadedCache.d.mts +0 -2
- package/build/loading/IsLoadedCache.d.mts.map +1 -1
- package/build/loading/IsLoadedCache.js +1 -2
- package/build/loading/loadHints.cjs +1 -2
- package/build/loading/loadHints.d.cts +4 -6
- package/build/loading/loadHints.d.cts.map +1 -1
- package/build/loading/loadHints.d.mts +4 -6
- package/build/loading/loadHints.d.mts.map +1 -1
- package/build/loading/loadHints.js +1 -2
- package/build/loading/loadLens.cjs +11 -8
- package/build/loading/loadLens.cjs.map +1 -1
- package/build/loading/loadLens.d.cts +2 -4
- package/build/loading/loadLens.d.cts.map +1 -1
- package/build/loading/loadLens.d.mts +2 -4
- package/build/loading/loadLens.d.mts.map +1 -1
- package/build/loading/loadLens.js +11 -8
- package/build/loading/loadLens.js.map +1 -1
- package/build/loading/withLoaded.cjs +1 -2
- package/build/loading/withLoaded.d.cts +2 -4
- package/build/loading/withLoaded.d.cts.map +1 -1
- package/build/loading/withLoaded.d.mts +2 -4
- package/build/loading/withLoaded.d.mts.map +1 -1
- package/build/loading/withLoaded.js +1 -2
- package/build/logging/FactoryLogger.cjs +2 -3
- package/build/logging/FactoryLogger.d.cts +1 -3
- package/build/logging/FactoryLogger.d.cts.map +1 -1
- package/build/logging/FactoryLogger.d.mts +1 -3
- package/build/logging/FactoryLogger.d.mts.map +1 -1
- package/build/logging/FactoryLogger.js +2 -3
- package/build/logging/FieldLogger.cjs +1 -2
- package/build/logging/FieldLogger.d.cts +0 -2
- package/build/logging/FieldLogger.d.cts.map +1 -1
- package/build/logging/FieldLogger.d.mts +0 -2
- package/build/logging/FieldLogger.d.mts.map +1 -1
- package/build/logging/FieldLogger.js +1 -2
- package/build/logging/ReactionLogger.cjs +3 -4
- package/build/logging/ReactionLogger.d.cts +3 -5
- package/build/logging/ReactionLogger.d.cts.map +1 -1
- package/build/logging/ReactionLogger.d.mts +3 -5
- package/build/logging/ReactionLogger.d.mts.map +1 -1
- package/build/logging/ReactionLogger.js +3 -4
- package/build/metrics/EntityMetrics.cjs +1 -2
- package/build/metrics/EntityMetrics.d.cts +0 -2
- package/build/metrics/EntityMetrics.d.cts.map +1 -1
- package/build/metrics/EntityMetrics.d.mts +0 -2
- package/build/metrics/EntityMetrics.d.mts.map +1 -1
- package/build/metrics/EntityMetrics.js +1 -2
- package/build/newEntity.cjs +5 -6
- package/build/newEntity.cjs.map +1 -1
- package/build/newEntity.d.cts +2 -4
- package/build/newEntity.d.cts.map +1 -1
- package/build/newEntity.d.mts +2 -4
- package/build/newEntity.d.mts.map +1 -1
- package/build/newEntity.js +5 -6
- package/build/newEntity.js.map +1 -1
- package/build/newTestInstance.cjs +9 -10
- package/build/newTestInstance.d.cts +3 -5
- package/build/newTestInstance.d.cts.map +1 -1
- package/build/newTestInstance.d.mts +3 -5
- package/build/newTestInstance.d.mts.map +1 -1
- package/build/newTestInstance.js +9 -10
- package/build/normalizeHints.cjs +1 -2
- package/build/normalizeHints.d.cts +1 -3
- package/build/normalizeHints.d.cts.map +1 -1
- package/build/normalizeHints.d.mts +1 -3
- package/build/normalizeHints.d.mts.map +1 -1
- package/build/normalizeHints.js +1 -2
- package/build/nowUTC.cjs +1 -2
- package/build/nowUTC.d.cts +0 -2
- package/build/nowUTC.d.cts.map +1 -1
- package/build/nowUTC.d.mts +0 -2
- package/build/nowUTC.d.mts.map +1 -1
- package/build/nowUTC.js +1 -2
- package/build/plugins/ImmutableEntitiesPlugin.cjs +3 -4
- package/build/plugins/ImmutableEntitiesPlugin.d.cts +1 -3
- package/build/plugins/ImmutableEntitiesPlugin.d.cts.map +1 -1
- package/build/plugins/ImmutableEntitiesPlugin.d.mts +1 -3
- package/build/plugins/ImmutableEntitiesPlugin.d.mts.map +1 -1
- package/build/plugins/ImmutableEntitiesPlugin.js +3 -4
- package/build/plugins/PreloadPlugin.cjs +1 -1
- package/build/plugins/PreloadPlugin.d.cts +4 -6
- package/build/plugins/PreloadPlugin.d.cts.map +1 -1
- package/build/plugins/PreloadPlugin.d.mts +4 -6
- package/build/plugins/PreloadPlugin.d.mts.map +1 -1
- package/build/plugins/PreloadPlugin.js +1 -1
- package/build/preloading/JsonAggregatePreloader.cjs +13 -13
- package/build/preloading/JsonAggregatePreloader.cjs.map +1 -1
- package/build/preloading/JsonAggregatePreloader.d.cts +3 -5
- package/build/preloading/JsonAggregatePreloader.d.cts.map +1 -1
- package/build/preloading/JsonAggregatePreloader.d.mts +3 -5
- package/build/preloading/JsonAggregatePreloader.d.mts.map +1 -1
- package/build/preloading/JsonAggregatePreloader.js +13 -13
- package/build/preloading/JsonAggregatePreloader.js.map +1 -1
- package/build/preloading/canPreload.cjs +1 -2
- package/build/preloading/canPreload.d.cts +0 -2
- package/build/preloading/canPreload.d.cts.map +1 -1
- package/build/preloading/canPreload.d.mts +0 -2
- package/build/preloading/canPreload.d.mts.map +1 -1
- package/build/preloading/canPreload.js +1 -2
- package/build/preloading/partitionHint.cjs +4 -5
- package/build/preloading/partitionHint.d.cts +1 -3
- package/build/preloading/partitionHint.d.cts.map +1 -1
- package/build/preloading/partitionHint.d.mts +1 -3
- package/build/preloading/partitionHint.d.mts.map +1 -1
- package/build/preloading/partitionHint.js +4 -5
- package/build/queries/ConditionBuilder.cjs +2 -3
- package/build/queries/ConditionBuilder.d.cts +1 -3
- package/build/queries/ConditionBuilder.d.cts.map +1 -1
- package/build/queries/ConditionBuilder.d.mts +1 -3
- package/build/queries/ConditionBuilder.d.mts.map +1 -1
- package/build/queries/ConditionBuilder.js +2 -3
- package/build/queries/conditions.cjs +1 -2
- package/build/queries/conditions.d.cts +0 -2
- package/build/queries/conditions.d.cts.map +1 -1
- package/build/queries/conditions.d.mts +0 -2
- package/build/queries/conditions.d.mts.map +1 -1
- package/build/queries/conditions.js +1 -2
- package/build/queries/entityQueryUtils.cjs +2 -3
- package/build/queries/entityQueryUtils.d.cts +1 -3
- package/build/queries/entityQueryUtils.d.cts.map +1 -1
- package/build/queries/entityQueryUtils.d.mts +1 -3
- package/build/queries/entityQueryUtils.d.mts.map +1 -1
- package/build/queries/entityQueryUtils.js +2 -3
- package/build/queries/find/Aliases.cjs +4 -5
- package/build/queries/find/Aliases.d.cts +5 -7
- package/build/queries/find/Aliases.d.cts.map +1 -1
- package/build/queries/find/Aliases.d.mts +5 -7
- package/build/queries/find/Aliases.d.mts.map +1 -1
- package/build/queries/find/Aliases.js +4 -5
- package/build/queries/find/DeferredAlias.cjs +1 -2
- package/build/queries/find/DeferredAlias.d.cts +2 -4
- package/build/queries/find/DeferredAlias.d.cts.map +1 -1
- package/build/queries/find/DeferredAlias.d.mts +2 -4
- package/build/queries/find/DeferredAlias.d.mts.map +1 -1
- package/build/queries/find/DeferredAlias.js +1 -2
- package/build/queries/find/EntityFilter.cjs +1 -2
- package/build/queries/find/EntityFilter.d.cts +3 -5
- package/build/queries/find/EntityFilter.d.cts.map +1 -1
- package/build/queries/find/EntityFilter.d.mts +3 -5
- package/build/queries/find/EntityFilter.d.mts.map +1 -1
- package/build/queries/find/EntityFilter.js +1 -2
- package/build/queries/find/EntityGraphQLFilter.cjs +1 -2
- package/build/queries/find/EntityGraphQLFilter.d.cts +2 -4
- package/build/queries/find/EntityGraphQLFilter.d.cts.map +1 -1
- package/build/queries/find/EntityGraphQLFilter.d.mts +2 -4
- package/build/queries/find/EntityGraphQLFilter.d.mts.map +1 -1
- package/build/queries/find/EntityGraphQLFilter.js +1 -2
- package/build/queries/find/QueryParser.cjs +9 -10
- package/build/queries/find/QueryParser.cjs.map +1 -1
- package/build/queries/find/QueryParser.collectionJoins.cjs +1 -2
- package/build/queries/find/QueryParser.collectionJoins.d.cts +0 -2
- package/build/queries/find/QueryParser.collectionJoins.d.cts.map +1 -1
- package/build/queries/find/QueryParser.collectionJoins.d.mts +0 -2
- package/build/queries/find/QueryParser.collectionJoins.d.mts.map +1 -1
- package/build/queries/find/QueryParser.collectionJoins.js +1 -2
- package/build/queries/find/QueryParser.d.cts +4 -4
- package/build/queries/find/QueryParser.d.cts.map +1 -1
- package/build/queries/find/QueryParser.d.mts +4 -4
- package/build/queries/find/QueryParser.d.mts.map +1 -1
- package/build/queries/find/QueryParser.js +9 -10
- package/build/queries/find/QueryParser.js.map +1 -1
- package/build/queries/find/QueryParser.pruning.cjs +2 -3
- package/build/queries/find/QueryParser.pruning.d.cts +0 -2
- package/build/queries/find/QueryParser.pruning.d.cts.map +1 -1
- package/build/queries/find/QueryParser.pruning.d.mts +0 -2
- package/build/queries/find/QueryParser.pruning.d.mts.map +1 -1
- package/build/queries/find/QueryParser.pruning.js +2 -3
- package/build/queries/find/QueryVisitor.cjs +1 -2
- package/build/queries/find/QueryVisitor.d.cts +0 -2
- package/build/queries/find/QueryVisitor.d.cts.map +1 -1
- package/build/queries/find/QueryVisitor.d.mts +0 -2
- package/build/queries/find/QueryVisitor.d.mts.map +1 -1
- package/build/queries/find/QueryVisitor.js +1 -2
- package/build/queries/find/buildFindQuery.cjs +5 -6
- package/build/queries/find/buildFindQuery.cjs.map +1 -1
- package/build/queries/find/buildFindQuery.d.cts +0 -2
- package/build/queries/find/buildFindQuery.d.cts.map +1 -1
- package/build/queries/find/buildFindQuery.d.mts +0 -2
- package/build/queries/find/buildFindQuery.d.mts.map +1 -1
- package/build/queries/find/buildFindQuery.js +5 -6
- package/build/queries/find/buildFindQuery.js.map +1 -1
- package/build/queries/find/scopes.cjs +1 -2
- package/build/queries/find/scopes.d.cts +5 -7
- package/build/queries/find/scopes.d.cts.map +1 -1
- package/build/queries/find/scopes.d.mts +5 -7
- package/build/queries/find/scopes.d.mts.map +1 -1
- package/build/queries/find/scopes.js +1 -2
- package/build/queries/parsedConditions.cjs +1 -2
- package/build/queries/parsedConditions.d.cts +0 -2
- package/build/queries/parsedConditions.d.cts.map +1 -1
- package/build/queries/parsedConditions.d.mts +0 -2
- package/build/queries/parsedConditions.d.mts.map +1 -1
- package/build/queries/parsedConditions.js +1 -2
- package/build/queries/renderConditions.cjs +3 -4
- package/build/queries/renderConditions.d.cts +0 -2
- package/build/queries/renderConditions.d.cts.map +1 -1
- package/build/queries/renderConditions.d.mts +0 -2
- package/build/queries/renderConditions.d.mts.map +1 -1
- package/build/queries/renderConditions.js +3 -4
- package/build/queries/skipCondition.cjs +1 -2
- package/build/queries/skipCondition.d.cts +0 -2
- package/build/queries/skipCondition.d.cts.map +1 -1
- package/build/queries/skipCondition.d.mts +0 -2
- package/build/queries/skipCondition.d.mts.map +1 -1
- package/build/queries/skipCondition.js +1 -2
- package/build/queries/sql/AliasAssigner.cjs +1 -2
- package/build/queries/sql/AliasAssigner.d.cts +0 -2
- package/build/queries/sql/AliasAssigner.d.cts.map +1 -1
- package/build/queries/sql/AliasAssigner.d.mts +0 -2
- package/build/queries/sql/AliasAssigner.d.mts.map +1 -1
- package/build/queries/sql/AliasAssigner.js +1 -2
- package/build/queries/sql/Expr.cjs +3 -4
- package/build/queries/sql/Expr.d.cts +2 -4
- package/build/queries/sql/Expr.d.cts.map +1 -1
- package/build/queries/sql/Expr.d.mts +2 -4
- package/build/queries/sql/Expr.d.mts.map +1 -1
- package/build/queries/sql/Expr.js +3 -4
- package/build/queries/sql/JoinTree.cjs +3 -4
- package/build/queries/sql/JoinTree.d.cts +5 -7
- package/build/queries/sql/JoinTree.d.cts.map +1 -1
- package/build/queries/sql/JoinTree.d.mts +5 -7
- package/build/queries/sql/JoinTree.d.mts.map +1 -1
- package/build/queries/sql/JoinTree.js +3 -4
- package/build/queries/sql/Tables.cjs +8 -9
- package/build/queries/sql/Tables.d.cts +5 -7
- package/build/queries/sql/Tables.d.cts.map +1 -1
- package/build/queries/sql/Tables.d.mts +5 -7
- package/build/queries/sql/Tables.d.mts.map +1 -1
- package/build/queries/sql/Tables.js +8 -9
- package/build/queries/sql/custom.cjs +1 -2
- package/build/queries/sql/custom.d.cts +2 -4
- package/build/queries/sql/custom.d.cts.map +1 -1
- package/build/queries/sql/custom.d.mts +2 -4
- package/build/queries/sql/custom.d.mts.map +1 -1
- package/build/queries/sql/custom.js +1 -2
- package/build/queries/sql/execute.cjs +6 -7
- package/build/queries/sql/execute.d.cts +6 -8
- package/build/queries/sql/execute.d.cts.map +1 -1
- package/build/queries/sql/execute.d.mts +6 -8
- package/build/queries/sql/execute.d.mts.map +1 -1
- package/build/queries/sql/execute.js +6 -7
- package/build/queries/sql/expressions/arrayAgg.cjs +2 -3
- package/build/queries/sql/expressions/arrayAgg.d.cts +1 -3
- package/build/queries/sql/expressions/arrayAgg.d.cts.map +1 -1
- package/build/queries/sql/expressions/arrayAgg.d.mts +1 -3
- package/build/queries/sql/expressions/arrayAgg.d.mts.map +1 -1
- package/build/queries/sql/expressions/arrayAgg.js +2 -3
- package/build/queries/sql/expressions/case.cjs +2 -3
- package/build/queries/sql/expressions/case.d.cts +1 -3
- package/build/queries/sql/expressions/case.d.cts.map +1 -1
- package/build/queries/sql/expressions/case.d.mts +1 -3
- package/build/queries/sql/expressions/case.d.mts.map +1 -1
- package/build/queries/sql/expressions/case.js +2 -3
- package/build/queries/sql/expressions/coalesce.cjs +2 -3
- package/build/queries/sql/expressions/coalesce.d.cts +1 -3
- package/build/queries/sql/expressions/coalesce.d.cts.map +1 -1
- package/build/queries/sql/expressions/coalesce.d.mts +1 -3
- package/build/queries/sql/expressions/coalesce.d.mts.map +1 -1
- package/build/queries/sql/expressions/coalesce.js +2 -3
- package/build/queries/sql/expressions/codecs.cjs +2 -3
- package/build/queries/sql/expressions/codecs.d.cts +0 -2
- package/build/queries/sql/expressions/codecs.d.cts.map +1 -1
- package/build/queries/sql/expressions/codecs.d.mts +0 -2
- package/build/queries/sql/expressions/codecs.d.mts.map +1 -1
- package/build/queries/sql/expressions/codecs.js +2 -3
- package/build/queries/sql/expressions/expression.cjs +4 -5
- package/build/queries/sql/expressions/expression.d.cts +2 -4
- package/build/queries/sql/expressions/expression.d.cts.map +1 -1
- package/build/queries/sql/expressions/expression.d.mts +2 -4
- package/build/queries/sql/expressions/expression.d.mts.map +1 -1
- package/build/queries/sql/expressions/expression.js +4 -5
- package/build/queries/sql/expressions/greatest.cjs +2 -3
- package/build/queries/sql/expressions/greatest.d.cts +1 -3
- package/build/queries/sql/expressions/greatest.d.cts.map +1 -1
- package/build/queries/sql/expressions/greatest.d.mts +1 -3
- package/build/queries/sql/expressions/greatest.d.mts.map +1 -1
- package/build/queries/sql/expressions/greatest.js +2 -3
- package/build/queries/sql/expressions/least.cjs +2 -3
- package/build/queries/sql/expressions/least.d.cts +1 -3
- package/build/queries/sql/expressions/least.d.cts.map +1 -1
- package/build/queries/sql/expressions/least.d.mts +1 -3
- package/build/queries/sql/expressions/least.d.mts.map +1 -1
- package/build/queries/sql/expressions/least.js +2 -3
- package/build/queries/sql/expressions/nullIf.cjs +2 -3
- package/build/queries/sql/expressions/nullIf.d.cts +1 -3
- package/build/queries/sql/expressions/nullIf.d.cts.map +1 -1
- package/build/queries/sql/expressions/nullIf.d.mts +1 -3
- package/build/queries/sql/expressions/nullIf.d.mts.map +1 -1
- package/build/queries/sql/expressions/nullIf.js +2 -3
- package/build/queries/sql/expressions/parseExpression.cjs +3 -4
- package/build/queries/sql/expressions/parseExpression.d.cts +0 -2
- package/build/queries/sql/expressions/parseExpression.d.cts.map +1 -1
- package/build/queries/sql/expressions/parseExpression.d.mts +0 -2
- package/build/queries/sql/expressions/parseExpression.d.mts.map +1 -1
- package/build/queries/sql/expressions/parseExpression.js +3 -4
- package/build/queries/sql/expressions/types.d.cts +1 -3
- package/build/queries/sql/expressions/types.d.cts.map +1 -1
- package/build/queries/sql/expressions/types.d.mts +1 -3
- package/build/queries/sql/expressions/types.d.mts.map +1 -1
- package/build/queries/sql/keywords.cjs +1 -2
- package/build/queries/sql/keywords.d.cts +0 -2
- package/build/queries/sql/keywords.d.cts.map +1 -1
- package/build/queries/sql/keywords.d.mts +0 -2
- package/build/queries/sql/keywords.d.mts.map +1 -1
- package/build/queries/sql/keywords.js +1 -2
- package/build/queries/sql/query.cjs +9 -10
- package/build/queries/sql/query.d.cts +6 -8
- package/build/queries/sql/query.d.cts.map +1 -1
- package/build/queries/sql/query.d.mts +6 -8
- package/build/queries/sql/query.d.mts.map +1 -1
- package/build/queries/sql/query.js +9 -10
- package/build/queries/unnest.cjs +1 -2
- package/build/queries/unnest.d.cts +1 -3
- package/build/queries/unnest.d.cts.map +1 -1
- package/build/queries/unnest.d.mts +1 -3
- package/build/queries/unnest.d.mts.map +1 -1
- package/build/queries/unnest.js +1 -2
- package/build/queries/valueFilters.cjs +3 -4
- package/build/queries/valueFilters.d.cts +2 -4
- package/build/queries/valueFilters.d.cts.map +1 -1
- package/build/queries/valueFilters.d.mts +2 -4
- package/build/queries/valueFilters.d.mts.map +1 -1
- package/build/queries/valueFilters.js +3 -4
- package/build/reactivity/ReactionsManager.cjs +6 -7
- package/build/reactivity/ReactionsManager.d.cts +2 -4
- package/build/reactivity/ReactionsManager.d.cts.map +1 -1
- package/build/reactivity/ReactionsManager.d.mts +2 -4
- package/build/reactivity/ReactionsManager.d.mts.map +1 -1
- package/build/reactivity/ReactionsManager.js +6 -7
- package/build/reactivity/reactiveHints.cjs +8 -9
- package/build/reactivity/reactiveHints.d.cts +8 -10
- package/build/reactivity/reactiveHints.d.cts.map +1 -1
- package/build/reactivity/reactiveHints.d.mts +8 -10
- package/build/reactivity/reactiveHints.d.mts.map +1 -1
- package/build/reactivity/reactiveHints.js +8 -9
- package/build/relations/AbstractPropertyImpl.cjs +1 -2
- package/build/relations/AbstractPropertyImpl.d.cts +0 -2
- package/build/relations/AbstractPropertyImpl.d.cts.map +1 -1
- package/build/relations/AbstractPropertyImpl.d.mts +0 -2
- package/build/relations/AbstractPropertyImpl.d.mts.map +1 -1
- package/build/relations/AbstractPropertyImpl.js +1 -2
- package/build/relations/AbstractRelationImpl.cjs +1 -2
- package/build/relations/AbstractRelationImpl.d.cts +0 -2
- package/build/relations/AbstractRelationImpl.d.cts.map +1 -1
- package/build/relations/AbstractRelationImpl.d.mts +0 -2
- package/build/relations/AbstractRelationImpl.d.mts.map +1 -1
- package/build/relations/AbstractRelationImpl.js +1 -2
- package/build/relations/AsyncProperty.cjs +3 -4
- package/build/relations/AsyncProperty.d.cts +2 -4
- package/build/relations/AsyncProperty.d.cts.map +1 -1
- package/build/relations/AsyncProperty.d.mts +2 -4
- package/build/relations/AsyncProperty.d.mts.map +1 -1
- package/build/relations/AsyncProperty.js +3 -4
- package/build/relations/AsyncReactiveField.cjs +10 -11
- package/build/relations/AsyncReactiveField.d.cts +4 -6
- package/build/relations/AsyncReactiveField.d.cts.map +1 -1
- package/build/relations/AsyncReactiveField.d.mts +4 -6
- package/build/relations/AsyncReactiveField.d.mts.map +1 -1
- package/build/relations/AsyncReactiveField.js +10 -11
- package/build/relations/Collection.cjs +3 -4
- package/build/relations/Collection.d.cts +2 -4
- package/build/relations/Collection.d.cts.map +1 -1
- package/build/relations/Collection.d.mts +2 -4
- package/build/relations/Collection.d.mts.map +1 -1
- package/build/relations/Collection.js +3 -4
- package/build/relations/CustomCollection.cjs +40 -8
- package/build/relations/CustomCollection.cjs.map +1 -1
- package/build/relations/CustomCollection.d.cts +6 -6
- package/build/relations/CustomCollection.d.cts.map +1 -1
- package/build/relations/CustomCollection.d.mts +6 -6
- package/build/relations/CustomCollection.d.mts.map +1 -1
- package/build/relations/CustomCollection.js +40 -8
- package/build/relations/CustomCollection.js.map +1 -1
- package/build/relations/CustomReference.cjs +36 -8
- package/build/relations/CustomReference.cjs.map +1 -1
- package/build/relations/CustomReference.d.cts +8 -8
- package/build/relations/CustomReference.d.cts.map +1 -1
- package/build/relations/CustomReference.d.mts +8 -8
- package/build/relations/CustomReference.d.mts.map +1 -1
- package/build/relations/CustomReference.js +36 -8
- package/build/relations/CustomReference.js.map +1 -1
- package/build/relations/EnumCollection.cjs +4 -5
- package/build/relations/EnumCollection.d.cts +3 -5
- package/build/relations/EnumCollection.d.cts.map +1 -1
- package/build/relations/EnumCollection.d.mts +3 -5
- package/build/relations/EnumCollection.d.mts.map +1 -1
- package/build/relations/EnumCollection.js +4 -5
- package/build/relations/LargeCollection.cjs +2 -2
- package/build/relations/LargeCollection.d.cts +2 -4
- package/build/relations/LargeCollection.d.cts.map +1 -1
- package/build/relations/LargeCollection.d.mts +2 -4
- package/build/relations/LargeCollection.d.mts.map +1 -1
- package/build/relations/LargeCollection.js +2 -2
- package/build/relations/LazyField.cjs +14 -15
- package/build/relations/LazyField.cjs.map +1 -1
- package/build/relations/LazyField.d.cts +2 -4
- package/build/relations/LazyField.d.cts.map +1 -1
- package/build/relations/LazyField.d.mts +2 -4
- package/build/relations/LazyField.d.mts.map +1 -1
- package/build/relations/LazyField.js +14 -15
- package/build/relations/LazyField.js.map +1 -1
- package/build/relations/ManyToManyCollection.cjs +68 -13
- package/build/relations/ManyToManyCollection.cjs.map +1 -1
- package/build/relations/ManyToManyCollection.d.cts +2 -4
- package/build/relations/ManyToManyCollection.d.cts.map +1 -1
- package/build/relations/ManyToManyCollection.d.mts +2 -4
- package/build/relations/ManyToManyCollection.d.mts.map +1 -1
- package/build/relations/ManyToManyCollection.js +68 -13
- package/build/relations/ManyToManyCollection.js.map +1 -1
- package/build/relations/ManyToManyLargeCollection.cjs +35 -13
- package/build/relations/ManyToManyLargeCollection.cjs.map +1 -1
- package/build/relations/ManyToManyLargeCollection.d.cts +6 -8
- package/build/relations/ManyToManyLargeCollection.d.cts.map +1 -1
- package/build/relations/ManyToManyLargeCollection.d.mts +6 -8
- package/build/relations/ManyToManyLargeCollection.d.mts.map +1 -1
- package/build/relations/ManyToManyLargeCollection.js +35 -13
- package/build/relations/ManyToManyLargeCollection.js.map +1 -1
- package/build/relations/ManyToOneReference.cjs +35 -19
- package/build/relations/ManyToOneReference.cjs.map +1 -1
- package/build/relations/ManyToOneReference.d.cts +6 -8
- package/build/relations/ManyToOneReference.d.cts.map +1 -1
- package/build/relations/ManyToOneReference.d.mts +6 -8
- package/build/relations/ManyToOneReference.d.mts.map +1 -1
- package/build/relations/ManyToOneReference.js +35 -19
- package/build/relations/ManyToOneReference.js.map +1 -1
- package/build/relations/OneToManyCollection.cjs +71 -15
- package/build/relations/OneToManyCollection.cjs.map +1 -1
- package/build/relations/OneToManyCollection.d.cts +3 -5
- package/build/relations/OneToManyCollection.d.cts.map +1 -1
- package/build/relations/OneToManyCollection.d.mts +3 -5
- package/build/relations/OneToManyCollection.d.mts.map +1 -1
- package/build/relations/OneToManyCollection.js +71 -15
- package/build/relations/OneToManyCollection.js.map +1 -1
- package/build/relations/OneToManyLargeCollection.cjs +25 -10
- package/build/relations/OneToManyLargeCollection.cjs.map +1 -1
- package/build/relations/OneToManyLargeCollection.d.cts +4 -6
- package/build/relations/OneToManyLargeCollection.d.cts.map +1 -1
- package/build/relations/OneToManyLargeCollection.d.mts +4 -6
- package/build/relations/OneToManyLargeCollection.d.mts.map +1 -1
- package/build/relations/OneToManyLargeCollection.js +25 -10
- package/build/relations/OneToManyLargeCollection.js.map +1 -1
- package/build/relations/OneToOneReference.cjs +41 -13
- package/build/relations/OneToOneReference.cjs.map +1 -1
- package/build/relations/OneToOneReference.d.cts +6 -8
- package/build/relations/OneToOneReference.d.cts.map +1 -1
- package/build/relations/OneToOneReference.d.mts +6 -8
- package/build/relations/OneToOneReference.d.mts.map +1 -1
- package/build/relations/OneToOneReference.js +41 -13
- package/build/relations/OneToOneReference.js.map +1 -1
- package/build/relations/PolymorphicReference.cjs +33 -17
- package/build/relations/PolymorphicReference.cjs.map +1 -1
- package/build/relations/PolymorphicReference.d.cts +5 -7
- package/build/relations/PolymorphicReference.d.cts.map +1 -1
- package/build/relations/PolymorphicReference.d.mts +5 -7
- package/build/relations/PolymorphicReference.d.mts.map +1 -1
- package/build/relations/PolymorphicReference.js +33 -17
- package/build/relations/PolymorphicReference.js.map +1 -1
- package/build/relations/PropertySymbols.cjs +1 -2
- package/build/relations/PropertySymbols.d.cts +0 -2
- package/build/relations/PropertySymbols.d.cts.map +1 -1
- package/build/relations/PropertySymbols.d.mts +0 -2
- package/build/relations/PropertySymbols.d.mts.map +1 -1
- package/build/relations/PropertySymbols.js +1 -2
- package/build/relations/ReactiveField.cjs +9 -10
- package/build/relations/ReactiveField.d.cts +4 -6
- package/build/relations/ReactiveField.d.cts.map +1 -1
- package/build/relations/ReactiveField.d.mts +4 -6
- package/build/relations/ReactiveField.d.mts.map +1 -1
- package/build/relations/ReactiveField.js +9 -10
- package/build/relations/ReactiveGetter.cjs +2 -3
- package/build/relations/ReactiveGetter.d.cts +2 -4
- package/build/relations/ReactiveGetter.d.cts.map +1 -1
- package/build/relations/ReactiveGetter.d.mts +2 -4
- package/build/relations/ReactiveGetter.d.mts.map +1 -1
- package/build/relations/ReactiveGetter.js +2 -3
- package/build/relations/ReactiveManyToMany.cjs +59 -17
- package/build/relations/ReactiveManyToMany.cjs.map +1 -1
- package/build/relations/ReactiveManyToMany.d.cts +7 -6
- package/build/relations/ReactiveManyToMany.d.cts.map +1 -1
- package/build/relations/ReactiveManyToMany.d.mts +7 -6
- package/build/relations/ReactiveManyToMany.d.mts.map +1 -1
- package/build/relations/ReactiveManyToMany.js +59 -17
- package/build/relations/ReactiveManyToMany.js.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.cjs +41 -10
- package/build/relations/ReactiveManyToManyOtherSide.cjs.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.cts +4 -6
- package/build/relations/ReactiveManyToManyOtherSide.d.cts.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.mts +4 -6
- package/build/relations/ReactiveManyToManyOtherSide.d.mts.map +1 -1
- package/build/relations/ReactiveManyToManyOtherSide.js +41 -10
- package/build/relations/ReactiveManyToManyOtherSide.js.map +1 -1
- package/build/relations/ReactiveReference.cjs +29 -12
- package/build/relations/ReactiveReference.cjs.map +1 -1
- package/build/relations/ReactiveReference.d.cts +7 -9
- package/build/relations/ReactiveReference.d.cts.map +1 -1
- package/build/relations/ReactiveReference.d.mts +7 -9
- package/build/relations/ReactiveReference.d.mts.map +1 -1
- package/build/relations/ReactiveReference.js +29 -12
- package/build/relations/ReactiveReference.js.map +1 -1
- package/build/relations/ReadOnlyCollection.cjs +3 -4
- package/build/relations/ReadOnlyCollection.d.cts +1 -3
- package/build/relations/ReadOnlyCollection.d.cts.map +1 -1
- package/build/relations/ReadOnlyCollection.d.mts +1 -3
- package/build/relations/ReadOnlyCollection.d.mts.map +1 -1
- package/build/relations/ReadOnlyCollection.js +3 -4
- package/build/relations/RecursiveCollection.cjs +60 -11
- package/build/relations/RecursiveCollection.cjs.map +1 -1
- package/build/relations/RecursiveCollection.d.cts +3 -5
- package/build/relations/RecursiveCollection.d.cts.map +1 -1
- package/build/relations/RecursiveCollection.d.mts +3 -5
- package/build/relations/RecursiveCollection.d.mts.map +1 -1
- package/build/relations/RecursiveCollection.js +60 -11
- package/build/relations/RecursiveCollection.js.map +1 -1
- package/build/relations/RecursiveCycleError.cjs +1 -2
- package/build/relations/RecursiveCycleError.d.cts +0 -2
- package/build/relations/RecursiveCycleError.d.cts.map +1 -1
- package/build/relations/RecursiveCycleError.d.mts +0 -2
- package/build/relations/RecursiveCycleError.d.mts.map +1 -1
- package/build/relations/RecursiveCycleError.js +1 -2
- package/build/relations/Reference.cjs +4 -5
- package/build/relations/Reference.d.cts +3 -5
- package/build/relations/Reference.d.cts.map +1 -1
- package/build/relations/Reference.d.mts +3 -5
- package/build/relations/Reference.d.mts.map +1 -1
- package/build/relations/Reference.js +4 -5
- package/build/relations/ReferenceSymbols.cjs +1 -2
- package/build/relations/ReferenceSymbols.d.cts +0 -2
- package/build/relations/ReferenceSymbols.d.cts.map +1 -1
- package/build/relations/ReferenceSymbols.d.mts +0 -2
- package/build/relations/ReferenceSymbols.d.mts.map +1 -1
- package/build/relations/ReferenceSymbols.js +1 -2
- package/build/relations/Relation.cjs +3 -4
- package/build/relations/Relation.d.cts +1 -3
- package/build/relations/Relation.d.cts.map +1 -1
- package/build/relations/Relation.d.mts +1 -3
- package/build/relations/Relation.d.mts.map +1 -1
- package/build/relations/Relation.js +3 -4
- package/build/relations/RelationSymbols.cjs +1 -2
- package/build/relations/RelationSymbols.d.cts +0 -2
- package/build/relations/RelationSymbols.d.cts.map +1 -1
- package/build/relations/RelationSymbols.d.mts +0 -2
- package/build/relations/RelationSymbols.d.mts.map +1 -1
- package/build/relations/RelationSymbols.js +1 -2
- package/build/relations/hasAsyncMethod.cjs +6 -7
- package/build/relations/hasAsyncMethod.d.cts +2 -4
- package/build/relations/hasAsyncMethod.d.cts.map +1 -1
- package/build/relations/hasAsyncMethod.d.mts +2 -4
- package/build/relations/hasAsyncMethod.d.mts.map +1 -1
- package/build/relations/hasAsyncMethod.js +6 -7
- package/build/relations/hasManyDerived.cjs +5 -6
- package/build/relations/hasManyDerived.cjs.map +1 -1
- package/build/relations/hasManyDerived.d.cts +2 -4
- package/build/relations/hasManyDerived.d.cts.map +1 -1
- package/build/relations/hasManyDerived.d.mts +2 -4
- package/build/relations/hasManyDerived.d.mts.map +1 -1
- package/build/relations/hasManyDerived.js +5 -6
- package/build/relations/hasManyDerived.js.map +1 -1
- package/build/relations/hasManyThrough.cjs +4 -5
- package/build/relations/hasManyThrough.cjs.map +1 -1
- package/build/relations/hasManyThrough.d.cts +0 -2
- package/build/relations/hasManyThrough.d.cts.map +1 -1
- package/build/relations/hasManyThrough.d.mts +0 -2
- package/build/relations/hasManyThrough.d.mts.map +1 -1
- package/build/relations/hasManyThrough.js +4 -5
- package/build/relations/hasManyThrough.js.map +1 -1
- package/build/relations/hasOneDerived.cjs +5 -6
- package/build/relations/hasOneDerived.cjs.map +1 -1
- package/build/relations/hasOneDerived.d.cts +2 -4
- package/build/relations/hasOneDerived.d.cts.map +1 -1
- package/build/relations/hasOneDerived.d.mts +2 -4
- package/build/relations/hasOneDerived.d.mts.map +1 -1
- package/build/relations/hasOneDerived.js +5 -6
- package/build/relations/hasOneDerived.js.map +1 -1
- package/build/relations/hasOneThrough.cjs +4 -5
- package/build/relations/hasOneThrough.cjs.map +1 -1
- package/build/relations/hasOneThrough.d.cts +0 -2
- package/build/relations/hasOneThrough.d.cts.map +1 -1
- package/build/relations/hasOneThrough.d.mts +0 -2
- package/build/relations/hasOneThrough.d.mts.map +1 -1
- package/build/relations/hasOneThrough.js +4 -5
- package/build/relations/hasOneThrough.js.map +1 -1
- package/build/relations/hasProperty.cjs +5 -6
- package/build/relations/hasProperty.d.cts +2 -4
- package/build/relations/hasProperty.d.cts.map +1 -1
- package/build/relations/hasProperty.d.mts +2 -4
- package/build/relations/hasProperty.d.mts.map +1 -1
- package/build/relations/hasProperty.js +5 -6
- package/build/relations/hasReactiveAsyncMethod.cjs +5 -6
- package/build/relations/hasReactiveAsyncMethod.d.cts +3 -5
- package/build/relations/hasReactiveAsyncMethod.d.cts.map +1 -1
- package/build/relations/hasReactiveAsyncMethod.d.mts +3 -5
- package/build/relations/hasReactiveAsyncMethod.d.mts.map +1 -1
- package/build/relations/hasReactiveAsyncMethod.js +5 -6
- package/build/relations/index.cjs +9 -9
- package/build/relations/index.d.cts +3 -3
- package/build/relations/index.d.mts +3 -3
- package/build/relations/index.js +9 -9
- package/build/relations/isCascadeDelete.cjs +1 -2
- package/build/relations/isCascadeDelete.d.cts +0 -2
- package/build/relations/isCascadeDelete.d.cts.map +1 -1
- package/build/relations/isCascadeDelete.d.mts +0 -2
- package/build/relations/isCascadeDelete.d.mts.map +1 -1
- package/build/relations/isCascadeDelete.js +1 -2
- package/build/relations/relationVisibility.cjs +51 -0
- package/build/relations/relationVisibility.cjs.map +1 -0
- package/build/relations/relationVisibility.d.cts +10 -0
- package/build/relations/relationVisibility.d.cts.map +1 -0
- package/build/relations/relationVisibility.d.mts +10 -0
- package/build/relations/relationVisibility.d.mts.map +1 -0
- package/build/relations/relationVisibility.js +47 -0
- package/build/relations/relationVisibility.js.map +1 -0
- package/build/resurrection.cjs +4 -5
- package/build/resurrection.d.cts +2 -4
- package/build/resurrection.d.cts.map +1 -1
- package/build/resurrection.d.mts +2 -4
- package/build/resurrection.d.mts.map +1 -1
- package/build/resurrection.js +4 -5
- package/build/rules.cjs +6 -7
- package/build/rules.d.cts +3 -5
- package/build/rules.d.cts.map +1 -1
- package/build/rules.d.mts +3 -5
- package/build/rules.d.mts.map +1 -1
- package/build/rules.js +6 -7
- package/build/runtimeConfig.cjs +1 -2
- package/build/runtimeConfig.d.cts +0 -2
- package/build/runtimeConfig.d.cts.map +1 -1
- package/build/runtimeConfig.d.mts +0 -2
- package/build/runtimeConfig.d.mts.map +1 -1
- package/build/runtimeConfig.js +1 -2
- package/build/serde/TypeInfo.cjs +1 -2
- package/build/serde/TypeInfo.d.cts +0 -2
- package/build/serde/TypeInfo.d.cts.map +1 -1
- package/build/serde/TypeInfo.d.mts +0 -2
- package/build/serde/TypeInfo.d.mts.map +1 -1
- package/build/serde/TypeInfo.js +1 -2
- package/build/serde/columns.cjs +1 -2
- package/build/serde/columns.d.cts +2 -4
- package/build/serde/columns.d.cts.map +1 -1
- package/build/serde/columns.d.mts +2 -4
- package/build/serde/columns.d.mts.map +1 -1
- package/build/serde/columns.js +1 -2
- package/build/serde/fieldSerde.cjs +4 -5
- package/build/serde/fieldSerde.d.cts +4 -6
- package/build/serde/fieldSerde.d.cts.map +1 -1
- package/build/serde/fieldSerde.d.mts +4 -6
- package/build/serde/fieldSerde.d.mts.map +1 -1
- package/build/serde/fieldSerde.js +4 -5
- package/build/serde/serde.cjs +4 -5
- package/build/serde/serde.cjs.map +1 -1
- package/build/serde/serde.d.cts +0 -2
- package/build/serde/serde.d.cts.map +1 -1
- package/build/serde/serde.d.mts +0 -2
- package/build/serde/serde.d.mts.map +1 -1
- package/build/serde/serde.js +4 -5
- package/build/serde/temporal.cjs +1 -2
- package/build/serde/temporal.cjs.map +1 -1
- package/build/serde/temporal.d.cts +0 -2
- package/build/serde/temporal.d.cts.map +1 -1
- package/build/serde/temporal.d.mts +0 -2
- package/build/serde/temporal.d.mts.map +1 -1
- package/build/serde/temporal.js +1 -2
- package/build/serde/temporalMappers.cjs +1 -2
- package/build/serde/temporalMappers.d.cts +1 -3
- package/build/serde/temporalMappers.d.cts.map +1 -1
- package/build/serde/temporalMappers.d.mts +1 -3
- package/build/serde/temporalMappers.d.mts.map +1 -1
- package/build/serde/temporalMappers.js +1 -2
- package/build/transitions.cjs +2 -3
- package/build/transitions.d.cts +3 -5
- package/build/transitions.d.cts.map +1 -1
- package/build/transitions.d.mts +3 -5
- package/build/transitions.d.mts.map +1 -1
- package/build/transitions.js +2 -3
- package/build/trusted.cjs +1 -2
- package/build/trusted.cjs.map +1 -1
- package/build/trusted.d.cts +0 -2
- package/build/trusted.d.cts.map +1 -1
- package/build/trusted.d.mts +0 -2
- package/build/trusted.d.mts.map +1 -1
- package/build/trusted.js +1 -2
- package/build/typeMap.cjs +1 -1
- package/build/typeMap.d.cts +1 -3
- package/build/typeMap.d.cts.map +1 -1
- package/build/typeMap.d.mts +1 -3
- package/build/typeMap.d.mts.map +1 -1
- package/build/typeMap.js +1 -1
- package/build/upsert.cjs +7 -8
- package/build/upsert.d.cts +3 -5
- package/build/upsert.d.cts.map +1 -1
- package/build/upsert.d.mts +3 -5
- package/build/upsert.d.mts.map +1 -1
- package/build/upsert.js +7 -8
- package/build/utils.cjs +3 -4
- package/build/utils.d.cts +2 -4
- package/build/utils.d.cts.map +1 -1
- package/build/utils.d.mts +2 -4
- package/build/utils.d.mts.map +1 -1
- package/build/utils.js +3 -4
- package/package.json +6 -6
package/build/json.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","names":[],"sources":["../src/json.ts"],"sourcesContent":["import { type Entity, isEntity } from \"src/Entity.ts\";\nimport { type IdOf } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { normalizeHint } from \"src/normalizeHints.ts\";\nimport { convertToLoadHint } from \"src/reactivity/reactiveHints.ts\";\nimport { AbstractRelationImpl } from \"src/relations/AbstractRelationImpl.ts\";\nimport { AsyncReactiveFieldImpl } from \"src/relations/AsyncReactiveField.ts\";\nimport { PropertyImpl } from \"src/relations/hasProperty.ts\";\nimport {\n type AsyncMethod,\n type Collection,\n type Property,\n type ReactiveGetter,\n type Reference,\n} from \"src/relations/index.ts\";\nimport { ReactiveFieldImpl } from \"src/relations/ReactiveField.ts\";\nimport { ReactiveGetterImpl } from \"src/relations/ReactiveGetter.ts\";\n\n/**\n * A JSON hint of a single key, multiple keys, or nested keys and sub-hints.\n *\n * JSON hints are much like load hints/reactive hints:\n *\n * - Similar to load hints, they specify which relations should be loaded from the database\n * - Similar to reactive hints, they include specific fields to output\n * - Unlike either, they can include completely custom keys that are lambdas to generate custom values\n */\nexport type JsonHint<T extends Entity> =\n | (keyof Jsonable<T> & string)\n | ReadonlyArray<keyof Jsonable<T> & string>\n | NestedJsonHint<T>;\n\n/** For object literal/nested hints, we allow mapping both entity keys 1:1 & custom keys via a lambdas. */\nexport type NestedJsonHint<T extends Entity> = EntityKeyJsonHint<T> | CustomJsonKeyHint<T>;\n\n/** Foreach `Jsonable` key, we can provide a sub-hint, or just a boolean to include/exclude. */\nexport type EntityKeyJsonHint<T extends Entity> = {\n // The `as K` makes `bookIds` as a hint work...\n [K in keyof Jsonable<T> as `${K}`]?: (Jsonable<T>[K] extends infer U extends Entity ? JsonHint<U> : {}) | boolean;\n};\n\nexport type CustomJsonKeyHint<T> = {\n [key: string]: (entity: T) => any;\n};\n\n/**\n * Describes the JSON payload for `Entity.toJSON` to produce.\n *\n * - `[\"firstName\", \"lastName\"]` will produce a JSON payload with just those fields\n * - `{ author: { books: \"title\" } }` will produce a JSON payload with the author's books' titles\n *\n * We only accept object literals & arrays to `toJSON` to avoid a `JSON.stringify` oddity.\n */\nexport type ToJsonHint<T extends Entity> = NestedJsonHint<T> | ReadonlyArray<keyof Jsonable<T> & string>;\n\n/** The keys in `T` that we can put into a JSON payload. */\nexport type Jsonable<T extends Entity> = {\n -readonly [K in keyof T as JsonableValue<T[K]> extends never ? never : K]: JsonableValue<T[K]>;\n};\n\n// this should probably be `keyof T` as long as they aren't methods/AsyncMethods.\n// so primitives, enums, references, collections, async properties, but also random getters.\nexport type JsonableValue<V> =\n V extends Reference<any, infer U, any>\n ? U\n : V extends Collection<any, infer U>\n ? U\n : V extends AsyncMethod<any, any, any>\n ? never\n : V extends Property<any, infer P>\n ? DropUndefined<P>\n : V extends ReactiveGetter<any, infer P>\n ? P\n : V;\n\n/**\n * Provides an API to put an entity, or list of entities, into a JSON payload.\n *\n * The `hint` parameter is a JSON hint that describes what to include in the payload,\n *\n * - fields like `id`, `name`, etc.\n * - relations like m2o, o2m, m2m, and o2o\n * - relations are allowed to provide nested hints, just like nested load hints\n * - custom fields like `fullName: (entity) => entity.firstName + ' ' + entity.lastName`\n */\nexport async function toJSON<T extends Entity, const H extends JsonHint<T>>(\n entity: T,\n hint: H,\n): Promise<JsonPayload<T, H>>;\n\n/**\n * Provides an API to put an entity, or list of entities, into a JSON payload.\n *\n * The `hint` parameter is a JSON hint that describes what to include in the payload,\n *\n * - fields like `id`, `name`, etc.\n * - relations like m2o, o2m, m2m, and o2o\n * - relations are allowed to provide nested hints, just like nested load hints\n * - custom fields like `fullName: (entity) => entity.firstName + ' ' + entity.lastName`\n */\nexport async function toJSON<T extends Entity, const H extends JsonHint<T>>(\n entities: readonly T[],\n hint: H,\n): Promise<JsonPayload<T, H>[]>;\nexport async function toJSON<T extends Entity, const H extends JsonHint<T>>(\n entityOrList: T | readonly T[],\n hint: H,\n): Promise<JsonPayload<T, H> | JsonPayload<T, H>[]> {\n // If called with a list, and nothing there, just early return\n if (Array.isArray(entityOrList) && entityOrList.length === 0) return [];\n\n // Otherwise probe to get our first entity\n const entity = Array.isArray(entityOrList) ? entityOrList[0] : entityOrList;\n const loadHint = convertToLoadHint(getMetadata(entity), hint as any, true);\n await entity.em.populate(entityOrList, loadHint);\n const normHint = normalizeHint(hint as any);\n\n if (Array.isArray(entityOrList)) {\n const list = [] as any;\n await Promise.all(\n entityOrList.map((entity) => {\n const json = {};\n list.push(json);\n return copyToPayload(json, entity, normHint);\n }),\n );\n return list;\n } else {\n const json = {};\n await copyToPayload(json, entity, normHint);\n return json as any;\n }\n}\n\n/**\n * Statically types the return value of `toJSON` based on the given `hint`.\n */\nexport type JsonPayload<T, H> = {\n [HK in keyof NormalizeHint<H> & string]: HK extends keyof T\n ? JsonPayloadKey<T, H, HK, HK>\n : HK extends `${infer TK extends string & keyof T}Id`\n ? JsonPayloadKey<T, H, TK, HK>\n : HK extends `${infer SK extends string}Ids` // bookIds -> books\n ? // Very naive singularization to see if the guessed bookIds -> books actually exists on T to map 1:1\n `${SK}s` extends keyof T\n ? JsonPayloadKey<T, H, `${SK}s`, HK>\n : JsonPayloadCustom<NormalizeHint<H>[HK]>\n : JsonPayloadCustom<NormalizeHint<H>[HK]>;\n};\n\ntype JsonPayloadKey<T, H, TK extends keyof T, HK extends keyof NormalizeHint<H>> =\n T[TK] extends Reference<any, infer U, any>\n ? JsonPayloadReference<U, NormalizeHint<H>[HK]>\n : T[TK] extends Collection<any, infer U>\n ? JsonPayloadCollection<U, NormalizeHint<H>[HK]>\n : T[TK] extends Property<any, infer U>\n ? JsonPayloadProperty<U, NormalizeHint<H>[HK]>\n : T[TK] extends ReactiveGetter<any, infer V>\n ? V\n : T[TK];\n\n// If the hint is empty, we just output the id as a string.\ntype JsonPayloadReference<U, H> = IsEmpty<H> extends true ? string : JsonPayload<U, H>;\n\ntype JsonPayloadCollection<U extends Entity, H> =\n // If this is `books: true`, use the id\n H extends true\n ? IdOf<U>[]\n : // If this is `{}`, use the id\n IsEmpty<H> extends true\n ? IdOf<U>[]\n : // Otherwise it's a nested hint\n JsonPayload<U, H>[];\n\ntype JsonPayloadProperty<P, H> =\n // If an async property returns an entity, treat it like a reference\n P extends Entity | undefined\n ? JsonPayloadReference<P, H>\n : // If an async property returns an entity[], treat it like a collection\n P extends (infer U extends Entity)[] | undefined\n ? JsonPayloadCollection<U, H>\n : // Otherwise leave it as-is\n P;\n\ntype JsonPayloadCustom<H> = H extends (...args: any) => infer V ? UnwrapPromise<V> : H;\n\ntype UnwrapPromise<T> = T extends Promise<infer U> ? U : T;\n\n/** Recursively copies the fields of `hint` from `entity` into the `payload`. */\nasync function copyToPayload(payload: Record<string, {}>, entity: any, hint: object): Promise<void> {\n // Look at each key in the hint and determine\n for (const [payloadKey, nestedHint] of Object.entries(hint)) {\n const nextHint = normalizeHint(nestedHint);\n // Watch for `companyId`\n let entityKey = payloadKey;\n if (!(entityKey in entity)) {\n const field = Object.values(getMetadata(entity).allFields).find((f) => f.fieldIdName === payloadKey);\n if (field) {\n entityKey = field.fieldName;\n }\n }\n // Look for custom props\n if (!(entityKey in entity)) {\n if (typeof nestedHint !== \"function\") {\n throw new Error(`Entity does not have a property ${payloadKey}`);\n }\n payload[payloadKey] = await nestedHint(entity);\n } else {\n const value = entity[entityKey];\n if (isPrimitive(value)) {\n payload[payloadKey] = value;\n } else if (\n value instanceof AbstractRelationImpl ||\n value instanceof ReactiveFieldImpl ||\n value instanceof ReactiveGetterImpl ||\n value instanceof AsyncReactiveFieldImpl ||\n value instanceof PropertyImpl\n ) {\n await copyToPayloadValue(payload, payloadKey, value.get, nextHint);\n } else {\n throw new Error(`Unable to encode value ${value} to JSON`);\n }\n }\n }\n}\n\nfunction copyToPayloadValue(payload: any, key: any, value: any, nextHint: any): Promise<unknown> | undefined {\n if (value === undefined || value === null || isPrimitive(value)) {\n payload[key] = value;\n } else if (isEntity(value)) {\n if (nextHint && Object.keys(nextHint).length > 0) {\n payload[key] = {};\n return copyToPayload(payload[key], value, nextHint);\n } else {\n payload[key] = value.id;\n }\n } else if (Array.isArray(value)) {\n const list = [] as any[];\n payload[key] = list;\n if (nextHint && Object.keys(nextHint).length > 0) {\n return Promise.all(\n value.map(async (item, i) => {\n if (isEntity(item)) {\n list[i] = {};\n return copyToPayload(list[i], item, nextHint);\n } else {\n // This is probably undefined\n list[i] = item;\n }\n }),\n );\n } else {\n // This is assuming an array of entities...\n for (const item of value) list.push(item.id);\n }\n } else {\n payload[key] = value;\n }\n}\n\nfunction isPrimitive(value: any): boolean {\n return value === null || typeof value !== \"object\";\n}\n\ntype DropUndefined<T> = T extends infer U extends Entity | undefined ? U : T;\n\n// A copy/paste of NormalizeHint w/o the `DropSuffix` stuff\ntype NormalizeHint<H> = H extends string\n ? Record<H, {}>\n : H extends ReadonlyArray<any>\n ? Record<H[number], {}>\n : { [K in keyof H]: H[K] };\n\ntype IsEmpty<T> = keyof T extends never ? true : false;\n"],"mappings":";;;;;;;;;;;;AAwGA,eAAsB,OACpB,cACA,MACkD;CAElD,IAAI,MAAM,QAAQ,YAAY,KAAK,aAAa,WAAW,GAAG,OAAO,CAAC;CAGtE,MAAM,SAAS,MAAM,QAAQ,YAAY,IAAI,aAAa,KAAK;CAC/D,MAAM,WAAW,kBAAkB,YAAY,MAAM,GAAG,MAAa,IAAI;CACzE,MAAM,OAAO,GAAG,SAAS,cAAc,QAAQ;CAC/C,MAAM,WAAW,cAAc,IAAW;CAE1C,IAAI,MAAM,QAAQ,YAAY,GAAG;EAC/B,MAAM,OAAO,CAAC;EACd,MAAM,QAAQ,IACZ,aAAa,KAAK,WAAW;GAC3B,MAAM,OAAO,CAAC;GACd,KAAK,KAAK,IAAI;GACd,OAAO,cAAc,MAAM,QAAQ,QAAQ;EAC7C,CAAC,CACH;EACA,OAAO;CACT,OAAO;EACL,MAAM,OAAO,CAAC;EACd,MAAM,cAAc,MAAM,QAAQ,QAAQ;EAC1C,OAAO;CACT;AACF;;AAyDA,eAAe,cAAc,SAA6B,QAAa,MAA6B;CAElG,KAAK,MAAM,CAAC,YAAY,eAAe,OAAO,QAAQ,IAAI,GAAG;EAC3D,MAAM,WAAW,cAAc,UAAU;EAEzC,IAAI,YAAY;EAChB,IAAI,EAAE,aAAa,SAAS;GAC1B,MA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KAAK,KAAK,EAAE;CAE/C,OACE,QAAQ,OAAO;AAEnB;AAEA,SAAS,YAAY,OAAqB;CACxC,OAAO,UAAU,QAAQ,OAAO,UAAU;AAC5C"}
|
|
1
|
+
{"version":3,"file":"json.js","names":[],"sources":["../src/json.ts"],"sourcesContent":["import { type Entity, isEntity } from \"src/Entity.ts\";\nimport { type IdOf } from \"src/EntityManager.ts\";\nimport { getMetadata } from \"src/EntityMetadata.ts\";\nimport { normalizeHint } from \"src/normalizeHints.ts\";\nimport { convertToLoadHint } from \"src/reactivity/reactiveHints.ts\";\nimport { AbstractRelationImpl } from \"src/relations/AbstractRelationImpl.ts\";\nimport { AsyncReactiveFieldImpl } from \"src/relations/AsyncReactiveField.ts\";\nimport { PropertyImpl } from \"src/relations/hasProperty.ts\";\nimport {\n type AsyncMethod,\n type Collection,\n type Property,\n type ReactiveGetter,\n type Reference,\n} from \"src/relations/index.ts\";\nimport { ReactiveFieldImpl } from \"src/relations/ReactiveField.ts\";\nimport { ReactiveGetterImpl } from \"src/relations/ReactiveGetter.ts\";\n\n/**\n * A JSON hint of a single key, multiple keys, or nested keys and sub-hints.\n *\n * JSON hints are much like load hints/reactive hints:\n *\n * - Similar to load hints, they specify which relations should be loaded from the database\n * - Similar to reactive hints, they include specific fields to output\n * - Unlike either, they can include completely custom keys that are lambdas to generate custom values\n */\nexport type JsonHint<T extends Entity> =\n | (keyof Jsonable<T> & string)\n | ReadonlyArray<keyof Jsonable<T> & string>\n | NestedJsonHint<T>;\n\n/** For object literal/nested hints, we allow mapping both entity keys 1:1 & custom keys via a lambdas. */\nexport type NestedJsonHint<T extends Entity> = EntityKeyJsonHint<T> | CustomJsonKeyHint<T>;\n\n/** Foreach `Jsonable` key, we can provide a sub-hint, or just a boolean to include/exclude. */\nexport type EntityKeyJsonHint<T extends Entity> = {\n // The `as K` makes `bookIds` as a hint work...\n [K in keyof Jsonable<T> as `${K}`]?: (Jsonable<T>[K] extends infer U extends Entity ? JsonHint<U> : {}) | boolean;\n};\n\nexport type CustomJsonKeyHint<T> = {\n [key: string]: (entity: T) => any;\n};\n\n/**\n * Describes the JSON payload for `Entity.toJSON` to produce.\n *\n * - `[\"firstName\", \"lastName\"]` will produce a JSON payload with just those fields\n * - `{ author: { books: \"title\" } }` will produce a JSON payload with the author's books' titles\n *\n * We only accept object literals & arrays to `toJSON` to avoid a `JSON.stringify` oddity.\n */\nexport type ToJsonHint<T extends Entity> = NestedJsonHint<T> | ReadonlyArray<keyof Jsonable<T> & string>;\n\n/** The keys in `T` that we can put into a JSON payload. */\nexport type Jsonable<T extends Entity> = {\n -readonly [K in keyof T as JsonableValue<T[K]> extends never ? never : K]: JsonableValue<T[K]>;\n};\n\n// this should probably be `keyof T` as long as they aren't methods/AsyncMethods.\n// so primitives, enums, references, collections, async properties, but also random getters.\nexport type JsonableValue<V> =\n V extends Reference<any, infer U, any>\n ? U\n : V extends Collection<any, infer U>\n ? U\n : V extends AsyncMethod<any, any, any>\n ? never\n : V extends Property<any, infer P>\n ? DropUndefined<P>\n : V extends ReactiveGetter<any, infer P>\n ? P\n : V;\n\n/**\n * Provides an API to put an entity, or list of entities, into a JSON payload.\n *\n * The `hint` parameter is a JSON hint that describes what to include in the payload,\n *\n * - fields like `id`, `name`, etc.\n * - relations like m2o, o2m, m2m, and o2o\n * - relations are allowed to provide nested hints, just like nested load hints\n * - custom fields like `fullName: (entity) => entity.firstName + ' ' + entity.lastName`\n */\nexport async function toJSON<T extends Entity, const H extends JsonHint<T>>(\n entity: T,\n hint: H,\n): Promise<JsonPayload<T, H>>;\n\n/**\n * Provides an API to put an entity, or list of entities, into a JSON payload.\n *\n * The `hint` parameter is a JSON hint that describes what to include in the payload,\n *\n * - fields like `id`, `name`, etc.\n * - relations like m2o, o2m, m2m, and o2o\n * - relations are allowed to provide nested hints, just like nested load hints\n * - custom fields like `fullName: (entity) => entity.firstName + ' ' + entity.lastName`\n */\nexport async function toJSON<T extends Entity, const H extends JsonHint<T>>(\n entities: readonly T[],\n hint: H,\n): Promise<JsonPayload<T, H>[]>;\nexport async function toJSON<T extends Entity, const H extends JsonHint<T>>(\n entityOrList: T | readonly T[],\n hint: H,\n): Promise<JsonPayload<T, H> | JsonPayload<T, H>[]> {\n // If called with a list, and nothing there, just early return\n if (Array.isArray(entityOrList) && entityOrList.length === 0) return [];\n\n // Otherwise probe to get our first entity\n const entity = Array.isArray(entityOrList) ? entityOrList[0] : entityOrList;\n const loadHint = convertToLoadHint(getMetadata(entity), hint as any, true);\n await entity.em.populate(entityOrList, loadHint);\n const normHint = normalizeHint(hint as any);\n\n if (Array.isArray(entityOrList)) {\n const list = [] as any;\n await Promise.all(\n entityOrList.map((entity) => {\n const json = {};\n list.push(json);\n return copyToPayload(json, entity, normHint);\n }),\n );\n return list;\n } else {\n const json = {};\n await copyToPayload(json, entity, normHint);\n return json as any;\n }\n}\n\n/**\n * Statically types the return value of `toJSON` based on the given `hint`.\n */\nexport type JsonPayload<T, H> = {\n [HK in keyof NormalizeHint<H> & string]: HK extends keyof T\n ? JsonPayloadKey<T, H, HK, HK>\n : HK extends `${infer TK extends string & keyof T}Id`\n ? JsonPayloadKey<T, H, TK, HK>\n : HK extends `${infer SK extends string}Ids` // bookIds -> books\n ? // Very naive singularization to see if the guessed bookIds -> books actually exists on T to map 1:1\n `${SK}s` extends keyof T\n ? JsonPayloadKey<T, H, `${SK}s`, HK>\n : JsonPayloadCustom<NormalizeHint<H>[HK]>\n : JsonPayloadCustom<NormalizeHint<H>[HK]>;\n};\n\ntype JsonPayloadKey<T, H, TK extends keyof T, HK extends keyof NormalizeHint<H>> =\n T[TK] extends Reference<any, infer U, any>\n ? JsonPayloadReference<U, NormalizeHint<H>[HK]>\n : T[TK] extends Collection<any, infer U>\n ? JsonPayloadCollection<U, NormalizeHint<H>[HK]>\n : T[TK] extends Property<any, infer U>\n ? JsonPayloadProperty<U, NormalizeHint<H>[HK]>\n : T[TK] extends ReactiveGetter<any, infer V>\n ? V\n : TK extends \"id\"\n ? T[TK] | null\n : T[TK];\n\n// If the hint is true or empty, output the id, or null if no id has been assigned.\ntype JsonPayloadReference<U, H> = H extends true\n ? string | null\n : IsEmpty<H> extends true\n ? string | null\n : JsonPayload<U, H>;\n\ntype JsonPayloadCollection<U extends Entity, H> =\n // If this is `books: true`, use the id\n H extends true\n ? (IdOf<U> | null)[]\n : // If this is `{}`, use the id\n IsEmpty<H> extends true\n ? (IdOf<U> | null)[]\n : // Otherwise it's a nested hint\n JsonPayload<U, H>[];\n\ntype JsonPayloadProperty<P, H> =\n // If an async property returns an entity, treat it like a reference\n P extends Entity | undefined\n ? JsonPayloadReference<P, H>\n : // If an async property returns an entity[], treat it like a collection\n P extends (infer U extends Entity)[] | undefined\n ? JsonPayloadCollection<U, H>\n : // Otherwise leave it as-is\n P;\n\ntype JsonPayloadCustom<H> = H extends (...args: any) => infer V ? UnwrapPromise<V> : H;\n\ntype UnwrapPromise<T> = T extends Promise<infer U> ? U : T;\n\n/** Recursively copies the fields of `hint` from `entity` into the `payload`. */\nasync function copyToPayload(payload: Record<string, {}>, entity: any, hint: object): Promise<void> {\n // Look at each key in the hint and determine\n for (const [payloadKey, nestedHint] of Object.entries(hint)) {\n const nextHint = normalizeHint(nestedHint);\n // Watch for `companyId`\n let entityKey = payloadKey;\n if (!(entityKey in entity)) {\n const field = Object.values(getMetadata(entity).allFields).find((f) => f.fieldIdName === payloadKey);\n if (field) {\n entityKey = field.fieldName;\n }\n }\n // Look for custom props\n if (!(entityKey in entity)) {\n if (typeof nestedHint !== \"function\") {\n throw new Error(`Entity does not have a property ${payloadKey}`);\n }\n payload[payloadKey] = await nestedHint(entity);\n } else {\n // Match the safe no-hint default: a new entity has no id until it is flushed.\n const value = entityKey === \"id\" ? (entity.idMaybe ?? null) : entity[entityKey];\n if (isPrimitive(value) || value instanceof Date) {\n payload[payloadKey] = value;\n } else if (\n value instanceof AbstractRelationImpl ||\n value instanceof ReactiveFieldImpl ||\n value instanceof ReactiveGetterImpl ||\n value instanceof AsyncReactiveFieldImpl ||\n value instanceof PropertyImpl\n ) {\n await copyToPayloadValue(payload, payloadKey, value.get, nextHint);\n } else {\n throw new Error(`Unable to encode value ${value} to JSON`);\n }\n }\n }\n}\n\nfunction copyToPayloadValue(payload: any, key: any, value: any, nextHint: any): Promise<unknown> | undefined {\n if (value === undefined || value === null || isPrimitive(value)) {\n payload[key] = value;\n } else if (isEntity(value)) {\n if (nextHint && Object.keys(nextHint).length > 0) {\n payload[key] = {};\n return copyToPayload(payload[key], value, nextHint);\n } else {\n payload[key] = value.idMaybe ?? null;\n }\n } else if (Array.isArray(value)) {\n const list = [] as any[];\n payload[key] = list;\n if (nextHint && Object.keys(nextHint).length > 0) {\n return Promise.all(\n value.map(async (item, i) => {\n if (isEntity(item)) {\n list[i] = {};\n return copyToPayload(list[i], item, nextHint);\n } else {\n // This is probably undefined\n list[i] = item;\n }\n }),\n );\n } else {\n // This is assuming an array of entities...\n for (const item of value) list.push(item.idMaybe ?? null);\n }\n } else {\n payload[key] = value;\n }\n}\n\nfunction isPrimitive(value: any): boolean {\n return value === null || typeof value !== \"object\";\n}\n\ntype DropUndefined<T> = T extends infer U extends Entity | undefined ? U : T;\n\n// A copy/paste of NormalizeHint w/o the `DropSuffix` stuff\ntype NormalizeHint<H> = H extends string\n ? Record<H, {}>\n : H extends ReadonlyArray<any>\n ? Record<H[number], {}>\n : { [K in keyof H]: H[K] };\n\ntype IsEmpty<T> = keyof T extends never ? true : false;\n"],"mappings":";;;;;;;;;;;;AAwGA,eAAsB,OACpB,cACA,MACkD;CAElD,IAAI,MAAM,QAAQ,YAAY,KAAK,aAAa,WAAW,GAAG,OAAO,CAAC;CAGtE,MAAM,SAAS,MAAM,QAAQ,YAAY,IAAI,aAAa,KAAK;CAC/D,MAAM,WAAW,kBAAkB,YAAY,MAAM,GAAG,MAAa,IAAI;CACzE,MAAM,OAAO,GAAG,SAAS,cAAc,QAAQ;CAC/C,MAAM,WAAW,cAAc,IAAW;CAE1C,IAAI,MAAM,QAAQ,YA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I,YAAY,OAAO,KAAK,QAAQ,CAAC,CAAC,SAAS,GAAG;GAChD,QAAQ,OAAO,CAAC;GAChB,OAAO,cAAc,QAAQ,MAAM,OAAO,QAAQ;EACpD,OACE,QAAQ,OAAO,MAAM,WAAW;CAEpC,OAAO,IAAI,MAAM,QAAQ,KAAK,GAAG;EAC/B,MAAM,OAAO,CAAC;EACd,QAAQ,OAAO;EACf,IAAI,YAAY,OAAO,KAAK,QAAQ,CAAC,CAAC,SAAS,GAC7C,OAAO,QAAQ,IACb,MAAM,IAAI,OAAO,MAAM,MAAM;GAC3B,IAAI,SAAS,IAAI,GAAG;IAClB,KAAK,KAAK,CAAC;IACX,OAAO,cAAc,KAAK,IAAI,MAAM,QAAQ;GAC9C,OAEE,KAAK,KAAK;EAEd,CAAC,CACH;OAGA,KAAK,MAAM,QAAQ,OAAO,KAAK,KAAK,KAAK,WAAW,IAAI;CAE5D,OACE,QAAQ,OAAO;AAEnB;AAEA,SAAS,YAAY,OAAqB;CACxC,OAAO,UAAU,QAAQ,OAAO,UAAU;AAC5C"}
|
package/build/k.cjs
CHANGED
package/build/k.js
CHANGED
package/build/keys.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_BaseEntity = require("./BaseEntity.cjs");
|
|
3
|
+
const require_Entity = require("./Entity.cjs");
|
|
4
|
+
require("./EntityManager.cjs");
|
|
5
|
+
const require_EntityMetadata = require("./EntityMetadata.cjs");
|
|
2
6
|
require("./relations/index.cjs");
|
|
3
7
|
const require_utils = require("./utils.cjs");
|
|
4
|
-
|
|
5
|
-
require("./EntityManager.cjs");
|
|
6
|
-
const require_Entity = require("./Entity.cjs");
|
|
7
|
-
const require_BaseEntity = require("./BaseEntity.cjs");
|
|
8
|
-
//#region src/keys.ts
|
|
8
|
+
// src/keys.ts
|
|
9
9
|
let tagDelimiter = ":";
|
|
10
10
|
/** Sets the process-wide tagged-id format during metadata boot. */
|
|
11
11
|
function setTaggedIdDelimiter(delimiter) {
|
|
@@ -159,7 +159,6 @@ function hasTagDelimiter(id) {
|
|
|
159
159
|
const delimiterIndex = id.indexOf(tagDelimiter);
|
|
160
160
|
return delimiterIndex > 0 && delimiterIndex + tagDelimiter.length < id.length;
|
|
161
161
|
}
|
|
162
|
-
//#endregion
|
|
163
162
|
exports.assertIdIsTagged = assertIdIsTagged;
|
|
164
163
|
exports.assertIdsAreTagged = assertIdsAreTagged;
|
|
165
164
|
exports.deTagId = deTagId;
|
package/build/keys.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Reference } from "./relations/Reference.cjs";
|
|
2
|
-
import "./relations/index.cjs";
|
|
3
|
-
import { EntityMetadata } from "./EntityMetadata.cjs";
|
|
4
|
-
import { EntityConstructor, IdOf, TaggedId } from "./EntityManager.cjs";
|
|
5
2
|
import { Entity, IdType } from "./Entity.cjs";
|
|
6
|
-
|
|
3
|
+
import { EntityConstructor, IdOf, TaggedId } from "./EntityManager.cjs";
|
|
4
|
+
import { EntityMetadata } from "./EntityMetadata.cjs";
|
|
5
|
+
import "./relations/index.cjs";
|
|
7
6
|
/** Sets the process-wide tagged-id format during metadata boot. */
|
|
8
7
|
export declare function setTaggedIdDelimiter(delimiter: string | undefined): void;
|
|
9
8
|
type HasTagName = {
|
|
@@ -50,6 +49,5 @@ export declare function deTagIds(meta: HasTagName, keys: readonly string[]): rea
|
|
|
50
49
|
export declare function unsafeDeTagIds(keys: readonly string[]): readonly string[];
|
|
51
50
|
/** Given a tagged id, returns its tag. */
|
|
52
51
|
export declare function tagFromId(id: string): string;
|
|
53
|
-
//#endregion
|
|
54
52
|
export {};
|
|
55
53
|
//# sourceMappingURL=keys.d.cts.map
|
package/build/keys.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.cts","names":[],"sources":["../src/keys.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.d.cts","names":[],"sources":["../src/keys.ts"],"mappings":";;;;;;wBAUgB,qBAAqB;KAMhC;EACH;;EAEA;;;wBAIc,OAAO,UAAU,QAAQ,MAAM,eAAe,IAAI,IAAI,uBAAuB,KAAK;wBAgBlF,0BACd,OAAO,SAAS,gDACf;;wBAKa,YAAY,MAAM,YAAY;wBAC9B,YAAY,MAAM,YAAY;;wBAwC9B,cAAc,MAAM,YAAY,2BAA2B;;wBAM3D,eAAe,MAAM,KAAK;;wBAK1B,mBAAmB;;wBAWnB,WAAW;;wBAEX,WAAW,MAAM,gBAAgB;wBAcjC,iBAAiB;;wBAOjB,WAAW,MAAM,YAAY,IAAI,SAAS;wBAC1C,WAAW,MAAM,YAAY,IAAI,qBAAqB;;wBA0BtD,aAAa,UAAU,QACrC,MAAM,YACN,OAAO,kCACN,IAAI;;wBAKS,MAAM,MAAM,YAAY;wBACxB,MAAM,MAAM,wBAAwB;wBACpC,MAAM,MAAM,YAAY;wBACxB,MAAM,MAAM,wBAAwB;;wBAgCpC,OAAO,MAAM,YAAY;wBACzB,OAAO,MAAM,wBAAwB;wBAQrC,QAAQ,MAAM,YAAY;wBAC1B,QAAQ,MAAM,YAAY;wBAC1B,QAAQ,QAAQ;;wBAQhB,SAAS,MAAM,YAAY;;wBAO3B,eAAe;;wBAcf,UAAU"}
|
package/build/keys.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Reference } from "./relations/Reference.mjs";
|
|
2
|
-
import "./relations/index.mjs";
|
|
3
|
-
import { EntityMetadata } from "./EntityMetadata.mjs";
|
|
4
|
-
import { EntityConstructor, IdOf, TaggedId } from "./EntityManager.mjs";
|
|
5
2
|
import { Entity, IdType } from "./Entity.mjs";
|
|
6
|
-
|
|
3
|
+
import { EntityConstructor, IdOf, TaggedId } from "./EntityManager.mjs";
|
|
4
|
+
import { EntityMetadata } from "./EntityMetadata.mjs";
|
|
5
|
+
import "./relations/index.mjs";
|
|
7
6
|
/** Sets the process-wide tagged-id format during metadata boot. */
|
|
8
7
|
export declare function setTaggedIdDelimiter(delimiter: string | undefined): void;
|
|
9
8
|
type HasTagName = {
|
|
@@ -50,6 +49,5 @@ export declare function deTagIds(meta: HasTagName, keys: readonly string[]): rea
|
|
|
50
49
|
export declare function unsafeDeTagIds(keys: readonly string[]): readonly string[];
|
|
51
50
|
/** Given a tagged id, returns its tag. */
|
|
52
51
|
export declare function tagFromId(id: string): string;
|
|
53
|
-
//#endregion
|
|
54
52
|
export {};
|
|
55
53
|
//# sourceMappingURL=keys.d.mts.map
|
package/build/keys.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.mts","names":[],"sources":["../src/keys.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.d.mts","names":[],"sources":["../src/keys.ts"],"mappings":";;;;;;wBAUgB,qBAAqB;KAMhC;EACH;;EAEA;;;wBAIc,OAAO,UAAU,QAAQ,MAAM,eAAe,IAAI,IAAI,uBAAuB,KAAK;wBAgBlF,0BACd,OAAO,SAAS,gDACf;;wBAKa,YAAY,MAAM,YAAY;wBAC9B,YAAY,MAAM,YAAY;;wBAwC9B,cAAc,MAAM,YAAY,2BAA2B;;wBAM3D,eAAe,MAAM,KAAK;;wBAK1B,mBAAmB;;wBAWnB,WAAW;;wBAEX,WAAW,MAAM,gBAAgB;wBAcjC,iBAAiB;;wBAOjB,WAAW,MAAM,YAAY,IAAI,SAAS;wBAC1C,WAAW,MAAM,YAAY,IAAI,qBAAqB;;wBA0BtD,aAAa,UAAU,QACrC,MAAM,YACN,OAAO,kCACN,IAAI;;wBAKS,MAAM,MAAM,YAAY;wBACxB,MAAM,MAAM,wBAAwB;wBACpC,MAAM,MAAM,YAAY;wBACxB,MAAM,MAAM,wBAAwB;;wBAgCpC,OAAO,MAAM,YAAY;wBACzB,OAAO,MAAM,wBAAwB;wBAQrC,QAAQ,MAAM,YAAY;wBAC1B,QAAQ,MAAM,YAAY;wBAC1B,QAAQ,QAAQ;;wBAQhB,SAAS,MAAM,YAAY;;wBAO3B,eAAe;;wBAcf,UAAU"}
|
package/build/keys.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { BaseEntity } from "./BaseEntity.js";
|
|
2
|
+
import { isEntity } from "./Entity.js";
|
|
3
|
+
import "./EntityManager.js";
|
|
4
|
+
import { getMetadata } from "./EntityMetadata.js";
|
|
1
5
|
import "./relations/index.js";
|
|
2
6
|
import { assertNever, fail } from "./utils.js";
|
|
3
|
-
|
|
4
|
-
import "./EntityManager.js";
|
|
5
|
-
import { isEntity } from "./Entity.js";
|
|
6
|
-
import { BaseEntity } from "./BaseEntity.js";
|
|
7
|
-
//#region src/keys.ts
|
|
7
|
+
// src/keys.ts
|
|
8
8
|
let tagDelimiter = ":";
|
|
9
9
|
/** Sets the process-wide tagged-id format during metadata boot. */
|
|
10
10
|
function setTaggedIdDelimiter(delimiter) {
|
|
@@ -158,7 +158,6 @@ function hasTagDelimiter(id) {
|
|
|
158
158
|
const delimiterIndex = id.indexOf(tagDelimiter);
|
|
159
159
|
return delimiterIndex > 0 && delimiterIndex + tagDelimiter.length < id.length;
|
|
160
160
|
}
|
|
161
|
-
//#endregion
|
|
162
161
|
export { assertIdIsTagged, assertIdsAreTagged, deTagId, deTagIds, ensureTagged, isTaggedId, keyToNumber, keyToTaggedId, maybeResolveReferenceToId, setTaggedIdDelimiter, tagFromId, tagId, tagIds, taggedIdPrefix, toIdOf, toTaggedId, unsafeDeTagIds };
|
|
163
162
|
|
|
164
163
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_normalizeHints = require("../normalizeHints.cjs");
|
|
3
|
-
|
|
3
|
+
// src/loading/HintTree.ts
|
|
4
4
|
/**
|
|
5
5
|
* Given a number of potentially overlapping load hints, i.e. `{ authors: "books" }` and
|
|
6
6
|
* `{ authors: "reviews" }`, combines them into a single `HintNode` tree, with bookkeeping
|
|
@@ -61,7 +61,6 @@ function addHintNode(node, entity, hint) {
|
|
|
61
61
|
hints: {}
|
|
62
62
|
}, entity, nestedHint);
|
|
63
63
|
}
|
|
64
|
-
//#endregion
|
|
65
64
|
exports.buildHintTree = buildHintTree;
|
|
66
65
|
|
|
67
66
|
//# sourceMappingURL=HintTree.cjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { LoadHint } from "./loadHints.cjs";
|
|
2
|
-
import { TaggedId } from "../EntityManager.cjs";
|
|
3
1
|
import { Entity } from "../Entity.cjs";
|
|
4
|
-
|
|
2
|
+
import { TaggedId } from "../EntityManager.cjs";
|
|
3
|
+
import { LoadHint } from "./loadHints.cjs";
|
|
5
4
|
export type EntityOrId = Entity | TaggedId;
|
|
6
5
|
export type HintNode<E extends EntityOrId> = {
|
|
7
6
|
/** These entities are the root entities of our preload, i.e. we use them to trim the tree to prevent over-fetching. */
|
|
@@ -40,5 +39,4 @@ export declare function buildHintTree<E extends EntityOrId>(hints: readonly {
|
|
|
40
39
|
entity: E;
|
|
41
40
|
hint: LoadHint<any> | undefined;
|
|
42
41
|
}[] | LoadHint<any>): HintNode<E>;
|
|
43
|
-
//#endregion
|
|
44
42
|
//# sourceMappingURL=HintTree.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HintTree.d.cts","names":[],"sources":["../../src/loading/HintTree.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HintTree.d.cts","names":[],"sources":["../../src/loading/HintTree.ts"],"mappings":";;;YASY,aAAa,SAAS;YAEtB,SAAS,UAAU;;EAE7B,UAAU,IAAI;;EAEd;;EAEA;KAAU,cAAc,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BnB,cAAc,UAAU,YACtC;EAAkB,QAAQ;EAAG,MAAM;MAAgC,gBAClE,SAAS"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { LoadHint } from "./loadHints.mjs";
|
|
2
|
-
import { TaggedId } from "../EntityManager.mjs";
|
|
3
1
|
import { Entity } from "../Entity.mjs";
|
|
4
|
-
|
|
2
|
+
import { TaggedId } from "../EntityManager.mjs";
|
|
3
|
+
import { LoadHint } from "./loadHints.mjs";
|
|
5
4
|
export type EntityOrId = Entity | TaggedId;
|
|
6
5
|
export type HintNode<E extends EntityOrId> = {
|
|
7
6
|
/** These entities are the root entities of our preload, i.e. we use them to trim the tree to prevent over-fetching. */
|
|
@@ -40,5 +39,4 @@ export declare function buildHintTree<E extends EntityOrId>(hints: readonly {
|
|
|
40
39
|
entity: E;
|
|
41
40
|
hint: LoadHint<any> | undefined;
|
|
42
41
|
}[] | LoadHint<any>): HintNode<E>;
|
|
43
|
-
//#endregion
|
|
44
42
|
//# sourceMappingURL=HintTree.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HintTree.d.mts","names":[],"sources":["../../src/loading/HintTree.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HintTree.d.mts","names":[],"sources":["../../src/loading/HintTree.ts"],"mappings":";;;YASY,aAAa,SAAS;YAEtB,SAAS,UAAU;;EAE7B,UAAU,IAAI;;EAEd;;EAEA;KAAU,cAAc,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BnB,cAAc,UAAU,YACtC;EAAkB,QAAQ;EAAG,MAAM;MAAgC,gBAClE,SAAS"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeHint } from "../normalizeHints.js";
|
|
2
|
-
|
|
2
|
+
// src/loading/HintTree.ts
|
|
3
3
|
/**
|
|
4
4
|
* Given a number of potentially overlapping load hints, i.e. `{ authors: "books" }` and
|
|
5
5
|
* `{ authors: "reviews" }`, combines them into a single `HintNode` tree, with bookkeeping
|
|
@@ -60,7 +60,6 @@ function addHintNode(node, entity, hint) {
|
|
|
60
60
|
hints: {}
|
|
61
61
|
}, entity, nestedHint);
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { buildHintTree };
|
|
65
64
|
|
|
66
65
|
//# sourceMappingURL=HintTree.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_EntityMetadata = require("../EntityMetadata.cjs");
|
|
3
|
-
|
|
3
|
+
// src/loading/IsLoadedCache.ts
|
|
4
4
|
var IsLoadedCache = class {
|
|
5
5
|
#smartCache = {};
|
|
6
6
|
#naiveCache = /* @__PURE__ */ new Set();
|
|
@@ -52,7 +52,6 @@ var IsLoadedCache = class {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
//#endregion
|
|
56
55
|
exports.IsLoadedCache = IsLoadedCache;
|
|
57
56
|
|
|
58
57
|
//# sourceMappingURL=IsLoadedCache.cjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Entity } from "../Entity.cjs";
|
|
2
|
-
//#region src/loading/IsLoadedCache.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Interface for our relations that have dynamic & expensive `isLoaded` checks.
|
|
5
4
|
*
|
|
@@ -30,5 +29,4 @@ export declare class IsLoadedCache {
|
|
|
30
29
|
/** Resets any in-memory #isLoaded/#isCached caches that depend on `entity.fieldName`. */
|
|
31
30
|
resetIsLoaded(entity: Entity, fieldName: string): void;
|
|
32
31
|
}
|
|
33
|
-
//#endregion
|
|
34
32
|
//# sourceMappingURL=IsLoadedCache.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsLoadedCache.d.cts","names":[],"sources":["../../src/loading/IsLoadedCache.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IsLoadedCache.d.cts","names":[],"sources":["../../src/loading/IsLoadedCache.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAmBiB;EACf,QAAQ;EACR;EACA;EACA;;qBAGW;;;EAcX,IAAI,QAAQ;EASZ,SAAS,QAAQ;;EAMjB,cAAc,QAAQ,QAAQ"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Entity } from "../Entity.mjs";
|
|
2
|
-
//#region src/loading/IsLoadedCache.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Interface for our relations that have dynamic & expensive `isLoaded` checks.
|
|
5
4
|
*
|
|
@@ -30,5 +29,4 @@ export declare class IsLoadedCache {
|
|
|
30
29
|
/** Resets any in-memory #isLoaded/#isCached caches that depend on `entity.fieldName`. */
|
|
31
30
|
resetIsLoaded(entity: Entity, fieldName: string): void;
|
|
32
31
|
}
|
|
33
|
-
//#endregion
|
|
34
32
|
//# sourceMappingURL=IsLoadedCache.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsLoadedCache.d.mts","names":[],"sources":["../../src/loading/IsLoadedCache.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IsLoadedCache.d.mts","names":[],"sources":["../../src/loading/IsLoadedCache.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAmBiB;EACf,QAAQ;EACR;EACA;EACA;;qBAGW;;;EAcX,IAAI,QAAQ;EASZ,SAAS,QAAQ;;EAMjB,cAAc,QAAQ,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getMetadata } from "../EntityMetadata.js";
|
|
2
|
-
|
|
2
|
+
// src/loading/IsLoadedCache.ts
|
|
3
3
|
var IsLoadedCache = class {
|
|
4
4
|
#smartCache = {};
|
|
5
5
|
#naiveCache = /* @__PURE__ */ new Set();
|
|
@@ -51,7 +51,6 @@ var IsLoadedCache = class {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
//#endregion
|
|
55
54
|
export { IsLoadedCache };
|
|
56
55
|
|
|
57
56
|
//# sourceMappingURL=IsLoadedCache.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_reactivity_reactiveHints = require("../reactivity/reactiveHints.cjs");
|
|
3
3
|
const require_utils = require("../utils.cjs");
|
|
4
|
-
|
|
4
|
+
// src/loading/loadHints.ts
|
|
5
5
|
/** Detects whether an entity is newly created, and so we can treat all the relations as loaded. */
|
|
6
6
|
function isNew(e) {
|
|
7
7
|
return e.isNewEntity;
|
|
@@ -83,7 +83,6 @@ function ensureLoaded(entity, hint) {
|
|
|
83
83
|
function unsafeLoaded(entity, hint) {
|
|
84
84
|
return entity;
|
|
85
85
|
}
|
|
86
|
-
//#endregion
|
|
87
86
|
exports.assertLoaded = assertLoaded;
|
|
88
87
|
exports.ensureLoaded = ensureLoaded;
|
|
89
88
|
exports.isLoaded = isLoaded;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity } from "../Entity.cjs";
|
|
2
2
|
import { NormalizeHint } from "../normalizeHints.cjs";
|
|
3
3
|
import { Collection, LoadedCollection } from "../relations/Collection.cjs";
|
|
4
4
|
import { EnumCollection, LoadedEnumCollection } from "../relations/EnumCollection.cjs";
|
|
@@ -6,12 +6,11 @@ import { AsyncMethod, LoadedMethod } from "../relations/hasAsyncMethod.cjs";
|
|
|
6
6
|
import { LoadedProperty, Property } from "../relations/hasProperty.cjs";
|
|
7
7
|
import { LoadedReference, Reference } from "../relations/Reference.cjs";
|
|
8
8
|
import { Relation } from "../relations/Relation.cjs";
|
|
9
|
-
import { LoadedOneToOneReference, OneToOneReference } from "../relations/OneToOneReference.cjs";
|
|
10
|
-
import { LoadedReadOnlyCollection, ReadOnlyCollection } from "../relations/ReadOnlyCollection.cjs";
|
|
11
9
|
import "../relations/index.cjs";
|
|
10
|
+
import { LoadedReadOnlyCollection, ReadOnlyCollection } from "../relations/ReadOnlyCollection.cjs";
|
|
11
|
+
import { LoadedOneToOneReference, OneToOneReference } from "../relations/OneToOneReference.cjs";
|
|
12
|
+
import { OptsOf } from "../typeMap.cjs";
|
|
12
13
|
import { MaybePromise, NullOrDefinedOr } from "../utils.cjs";
|
|
13
|
-
import { Entity } from "../Entity.cjs";
|
|
14
|
-
//#region src/loading/loadHints.d.ts
|
|
15
14
|
declare const deepLoad: unique symbol;
|
|
16
15
|
type DeepLoadHint<T extends Entity> = NestedLoadHint<T> & {
|
|
17
16
|
[deepLoad]: true;
|
|
@@ -111,6 +110,5 @@ export declare function unsafeLoaded<T extends Entity, const H extends LoadHint<
|
|
|
111
110
|
/** From any `Relations` field in `T`, i.e. for loader hints. */
|
|
112
111
|
export type RelationsIn<T extends Entity> = SubType<T, Relation<any, any>>;
|
|
113
112
|
type SubType<T, C> = Pick<T, { [K in keyof T]: T[K] extends C ? K : never; }[keyof T]>;
|
|
114
|
-
//#endregion
|
|
115
113
|
export {};
|
|
116
114
|
//# sourceMappingURL=loadHints.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadHints.d.cts","names":[],"sources":["../../src/loading/loadHints.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadHints.d.cts","names":[],"sources":["../../src/loading/loadHints.ts"],"mappings":";;;;;;;;;;;;;cAuBM;KACD,aAAa,UAAU,UAAU,eAAe;GAAQ;;KAUxD;;YAGO,WAAW,UAAU,QAAQ,GAAG,WAC1C,UAAU,eAAe,qBAAqB,KAC1C,qBAAqB,GAAG,KACxB,UAAU,kBAAkB,qBAAqB,KAC/C,wBAAwB,GAAG,OAAO,GAAG,OACrC,UAAU,UAAU,qBAAqB,SAAS,KAChD,gBAAgB,GAAG,OAAO,GAAG,KAAK,KAClC,UAAU,WAAW,qBAAqB,KACxC,iBAAiB,GAAG,OAAO,GAAG,OAC9B,UAAU,mBAAmB,qBAAqB,KAChD,yBAAyB,GAAG,OAAO,GAAG,OACtC,UAAU,SAAS,qBAAqB,MAErC,mBAAmB,UAAU,uBACxC,eAAe,GAAG,OAAO,GAAG,MAAM,QAAQ,GAAG,MAC7C,0BAA0B,UAAU,YACpC,eAAe,GAAG,OAAO,GAAG,SAC5B,eAAe,GAAG,K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AI,EAAE,WAAW,IAAI,mBAAkB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Entity } from "../Entity.mjs";
|
|
2
2
|
import { NormalizeHint } from "../normalizeHints.mjs";
|
|
3
3
|
import { Collection, LoadedCollection } from "../relations/Collection.mjs";
|
|
4
4
|
import { EnumCollection, LoadedEnumCollection } from "../relations/EnumCollection.mjs";
|
|
@@ -6,12 +6,11 @@ import { AsyncMethod, LoadedMethod } from "../relations/hasAsyncMethod.mjs";
|
|
|
6
6
|
import { LoadedProperty, Property } from "../relations/hasProperty.mjs";
|
|
7
7
|
import { LoadedReference, Reference } from "../relations/Reference.mjs";
|
|
8
8
|
import { Relation } from "../relations/Relation.mjs";
|
|
9
|
-
import { LoadedOneToOneReference, OneToOneReference } from "../relations/OneToOneReference.mjs";
|
|
10
|
-
import { LoadedReadOnlyCollection, ReadOnlyCollection } from "../relations/ReadOnlyCollection.mjs";
|
|
11
9
|
import "../relations/index.mjs";
|
|
10
|
+
import { LoadedReadOnlyCollection, ReadOnlyCollection } from "../relations/ReadOnlyCollection.mjs";
|
|
11
|
+
import { LoadedOneToOneReference, OneToOneReference } from "../relations/OneToOneReference.mjs";
|
|
12
|
+
import { OptsOf } from "../typeMap.mjs";
|
|
12
13
|
import { MaybePromise, NullOrDefinedOr } from "../utils.mjs";
|
|
13
|
-
import { Entity } from "../Entity.mjs";
|
|
14
|
-
//#region src/loading/loadHints.d.ts
|
|
15
14
|
declare const deepLoad: unique symbol;
|
|
16
15
|
type DeepLoadHint<T extends Entity> = NestedLoadHint<T> & {
|
|
17
16
|
[deepLoad]: true;
|
|
@@ -111,6 +110,5 @@ export declare function unsafeLoaded<T extends Entity, const H extends LoadHint<
|
|
|
111
110
|
/** From any `Relations` field in `T`, i.e. for loader hints. */
|
|
112
111
|
export type RelationsIn<T extends Entity> = SubType<T, Relation<any, any>>;
|
|
113
112
|
type SubType<T, C> = Pick<T, { [K in keyof T]: T[K] extends C ? K : never; }[keyof T]>;
|
|
114
|
-
//#endregion
|
|
115
113
|
export {};
|
|
116
114
|
//# sourceMappingURL=loadHints.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadHints.d.mts","names":[],"sources":["../../src/loading/loadHints.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadHints.d.mts","names":[],"sources":["../../src/loading/loadHints.ts"],"mappings":";;;;;;;;;;;;;cAuBM;KACD,aAAa,UAAU,UAAU,eAAe;GAAQ;;KAUxD;;YAGO,WAAW,UAAU,QAAQ,GAAG,WAC1C,UAAU,eAAe,qBAAqB,KAC1C,qBAAqB,GAAG,KACxB,UAAU,kBAAkB,qBAAqB,KAC/C,wBAAwB,GAAG,OAAO,GAAG,OACrC,UAAU,UAAU,qBAAqB,SAAS,KAChD,gBAAgB,GAAG,OAAO,GAAG,KAAK,KAClC,UAAU,WAAW,qBAAqB,KACxC,iBAAiB,GAAG,OAAO,GAAG,OAC9B,UAAU,mBAAmB,qBAAqB,KAChD,yBAAyB,GAAG,OAAO,GAAG,OACtC,UAAU,SAAS,qBAAqB,MAErC,mBAAmB,UAAU,uBACxC,eAAe,GAAG,OAAO,GAAG,MAAM,QAAQ,GAAG,MAC7C,0BAA0B,UAAU,YACpC,eAAe,GAAG,OAAO,GAAG,SAC5B,eAAe,GAAG,KACR,UAAU,YAAY,SAAS,SAAS,KACtC,aAAa,GAAG,GAAG;;KAIhC,eAAe,UAAU,QAAQ,KACpC,UAAU,eAAe,qBAAqB,KAC1C,qBAAqB,GAAG,KACxB,UAAU,kBAAkB,qBAAqB,KAC/C,wBAAwB,GAAG,OAAO,GAAG,aAAa,OAClD,UAAU,UAAU,qBAAqB,SAAS,KAChD,gBAAgB,GAAG,OAAO,GAAG,aAAa,KAAK,KAC/C,UAAU,WAAW,qBAAqB,KACxC,iBAAiB,GAAG,OAAO,GAAG,aAAa,OAC3C,UAAU,mBAAmB,qBAAqB,KAChD,yBAAyB,GAAG,OAAO,GAAG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,kBAAiB,UAAU,UAAS,SAAS;;YAI1E,OAAO,UAAU,QAAQ,KAAK,OACvC,WAAW,UAAU,cAAc,KAAK,UAAU,aAAa,KAC5D,eAAe,GAAG,EAAE,MACpB,WAAW,GAAG,EAAE,IAAI,cAAc,GAAG;;wBAI3B,SAAS,UAAU,QAAQ,UAAU,SAAS,IAAI,QAAQ,GAAG,MAAM,IAAI,UAAU,OAAO,GAAG;;;;;;;;;wBAwC3F,oBAAoB,UAAU,QAAQ,UAAU,SAAS,IACvE,QAAQ,GACR,MAAM,IACL,UAAU,OAAO,GAAG;wBA6BP,kBAAkB,UAAU,QAAQ,UAAU,SAAS,IAAI,GACzE,QAAQ,GACR,MAAM,GACN,KAAK,QAAQ,OAAO,GAAG,OAAO,IAC7B,aAAa;;;;;;wBASA,aAAa,UAAU,cAAc,UAAU,SAAS,IACtE,QAAQ,GACR,MAAM,YACG,UAAU,OAAO,GAAG;;;;;;wBASf,aAAa,UAAU,cAAc,UAAU,SAAS,IAAI,QAAQ,GAAG,MAAM,IAAI,OAAO,GAAG;;;;;;wBAU3F,aAAa,UAAU,cAAc,UAAU,SAAS,IAAI,QAAQ,GAAG,MAAM,IAAI,OAAO,GAAG;;YAK/F,YAAY,UAAU,UAAU,QAAQ,GAAG;KAGlD,QAAQ,GAAG,KAAK,KAAK,MAAM,WAAW,IAAI,EAAE,WAAW,IAAI,mBAAkB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getRelationFromMaybePolyKey } from "../reactivity/reactiveHints.js";
|
|
2
2
|
import { fail } from "../utils.js";
|
|
3
|
-
|
|
3
|
+
// src/loading/loadHints.ts
|
|
4
4
|
/** Detects whether an entity is newly created, and so we can treat all the relations as loaded. */
|
|
5
5
|
function isNew(e) {
|
|
6
6
|
return e.isNewEntity;
|
|
@@ -82,7 +82,6 @@ function ensureLoaded(entity, hint) {
|
|
|
82
82
|
function unsafeLoaded(entity, hint) {
|
|
83
83
|
return entity;
|
|
84
84
|
}
|
|
85
|
-
//#endregion
|
|
86
85
|
export { assertLoaded, ensureLoaded, isLoaded, isLoadedForPopulate, isNew, maybePopulateThen, unsafeLoaded };
|
|
87
86
|
|
|
88
87
|
//# sourceMappingURL=loadHints.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_relations_AbstractRelationImpl = require("../relations/AbstractRelationImpl.cjs");
|
|
3
|
-
const require_relations_hasProperty = require("../relations/hasProperty.cjs");
|
|
4
|
-
require("../relations/index.cjs");
|
|
5
|
-
const require_EntityMetadata = require("../EntityMetadata.cjs");
|
|
6
2
|
const require_dataloaders_lensDataLoader = require("../dataloaders/lensDataLoader.cjs");
|
|
7
|
-
const require_EntityManager = require("../EntityManager.cjs");
|
|
8
3
|
const require_Entity = require("../Entity.cjs");
|
|
9
|
-
|
|
4
|
+
const require_relations_hasProperty = require("../relations/hasProperty.cjs");
|
|
5
|
+
const require_EntityManager = require("../EntityManager.cjs");
|
|
6
|
+
const require_EntityMetadata = require("../EntityMetadata.cjs");
|
|
7
|
+
const require_relations_AbstractRelationImpl = require("../relations/AbstractRelationImpl.cjs");
|
|
8
|
+
require("../relations/index.cjs");
|
|
9
|
+
const require_trusted = require("../trusted.cjs");
|
|
10
|
+
// src/loading/loadLens.ts
|
|
10
11
|
/**
|
|
11
12
|
* Allows declaratively loading/traversing several layers of references at once.
|
|
12
13
|
*
|
|
@@ -34,7 +35,10 @@ function loadLensPath(start, paths, opts = {}) {
|
|
|
34
35
|
async function loadLensPathAsync(meta, start, paths, opts) {
|
|
35
36
|
if (opts.sql) {
|
|
36
37
|
if (!isAllSqlPaths(meta, paths)) throw new Error("Cannot use loadLens opts.sql with non-SQL paths");
|
|
37
|
-
|
|
38
|
+
const em = (isReadOnlyArray(start) ? start[0] : start).em;
|
|
39
|
+
const plugins = require_EntityManager.getEmInternalApi(em).pluginManager;
|
|
40
|
+
const needsRelationChecks = !require_trusted.isInTrustedContext() && (plugins.hasHook("beforeGetField") || plugins.hasHook("canViewEntity"));
|
|
41
|
+
if (paths.length > 1 && !needsRelationChecks) {
|
|
38
42
|
if (isReadOnlyArray(start)) {
|
|
39
43
|
const em = start[0].em;
|
|
40
44
|
return await require_dataloaders_lensDataLoader.lensDataLoader(em, meta.cstr, true, paths).loadMany(start.map((e) => e.idTagged)).catch(function loadLens(err) {
|
|
@@ -196,7 +200,6 @@ function collectPaths(fn) {
|
|
|
196
200
|
function isReadOnlyArray(value) {
|
|
197
201
|
return Array.isArray(value);
|
|
198
202
|
}
|
|
199
|
-
//#endregion
|
|
200
203
|
exports.getLens = getLens;
|
|
201
204
|
exports.getLensPath = getLensPath;
|
|
202
205
|
exports.isAllSqlPaths = isAllSqlPaths;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadLens.cjs","names":["isEntity","getMetadata","lensDataLoader","appendStack","AbstractRelationImpl","isProperty"],"sources":["../../src/loading/loadLens.ts"],"sourcesContent":["import { lensDataLoader } from \"src/dataloaders/lensDataLoader.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\nimport { appendStack } from \"src/EntityManager.ts\";\nimport {\n type EntityMetadata,\n type Field,\n type ManyToManyField,\n type ManyToOneField,\n type OneToManyField,\n type OneToOneField,\n type PrimitiveField,\n getMetadata,\n} from \"src/EntityMetadata.ts\";\nimport type { LoadHint } from \"src/loading/loadHints.ts\";\nimport { AbstractRelationImpl } from \"src/relations/AbstractRelationImpl.ts\";\nimport { isProperty } from \"src/relations/index.ts\";\n\n/** Generically matches on a Reference/Collection's load method. */\ntype LoadLike<U> = { load(): Promise<U> };\n\n/** Generically matches a property or zero-arg method that returns a promise. */\ntype PromiseFnLike<U> = () => PromiseLike<U>;\n\n/**\n * Given a parent type `R` (that is our current lens \"return type\", i.e. `Author` or `Author | undefined` or `Author[]`),\n * and the type `V` of the \"next step\" of the traversal (i.e. itself `Book` or `Book | undefined` or `Book[]`, depending\n * on the relation being traversed), returns `V` mapped to \"the right format\" based on `R`.\n *\n * I.e.:\n *\n * - `Author | undefined` that navigates a `Book` will become `Book | undefined`\n * - `Author` that navigates a `Book | undefined` will also become `Book | undefined`\n * - `Author[]` that navigates a `Book | undefined` will become a `Book[]`\n * - `Author | undefined` that navigates a `Book[]` will become a `Book[]`\n */\n// The extra `[]` around `V` and `ReadonlyArray<any>` are to keep the type as `Array<Foo | undefined>`\n// instead of `Foo[] | undefined[]`.\n// When `P extends ReadonlyArray, i.e. we're in flatMap mode, we're also in filter undefined mode.\ntype MaybeArray<R, V> =\n R extends ReadonlyArray<any>\n ? [V] extends [ReadonlyArray<infer U>]\n ? DropUndefined<U>[]\n : DropUndefined<V>[]\n : V extends ReadonlyArray<any>\n ? V\n : [R] extends [undefined]\n ? V | undefined\n : V;\n\n// ([R] extends [undefined]) ? (V) : V;\n\n/** Given a type T that we come across in the path, de-array it to continue our flatMap-ish semantics. */\ntype MaybeDropArray<T> = T extends ReadonlyArray<infer U> ? U : T;\n\ntype DropUndefined<T> = Exclude<T, undefined>;\n\n/**\n * A type for declaratively walking the object graph.\n *\n * This is not technically a Lens that can `get/set`, but the idea is generally the same.\n *\n * `T` is the type we're on, i.e. when `T = Author` we can do `.firstName` or `.lastName.\n * `R` is either a `T` or `T[]` or `T | undefined` and just captures whether we've hit a\n * list at any point in the lens navigation path.\n */\nexport type Lens<T, R = T> = {\n [P in keyof T]: T[P] extends LoadLike<infer U>\n ? Lens<MaybeDropArray<DropUndefined<U>>, MaybeArray<R, U>>\n : T[P] extends PromiseFnLike<infer U>\n ? Lens<MaybeDropArray<DropUndefined<U>>, MaybeArray<R, U>>\n : Lens<MaybeDropArray<DropUndefined<T[P]>>, MaybeArray<R, T[P]>>;\n};\n\n/**\n * Allows declaratively loading/traversing several layers of references at once.\n *\n * I.e.:\n *\n * ```typescript\n * const publisher = await book.load(b => b.author.publisher);\n * ```\n */\n// For some reason accepting Lens<this, this> does not work when called from within the entity\n// subclass itself, so we use the codegen hammer in our subclass to force the right Lens type\n// in a .load stub that just calls us for the implementation.\nexport async function loadLens<T extends Entity, U, V>(\n start: T | readonly T[],\n fn: (lens: Lens<T>) => Lens<U, V>,\n opts: { forceReload?: boolean; sql?: boolean } = {},\n): Promise<V> {\n return loadLensPath(start, collectPaths(fn), opts);\n}\n\n/** Loads a precomputed lens path, avoiding repeated lambda/proxy evaluation for long-lived relation declarations. */\nexport function loadLensPath<T extends Entity, V>(\n start: T | readonly T[],\n paths: string[],\n opts: { forceReload?: boolean; sql?: boolean } = {},\n): Promise<V> {\n // Probe for the meta, so we can track when/if it needs to flip to a collection (even after hitting undefined)\n const meta = Array.isArray(start)\n ? isEntity(start[0]) && getMetadata(start[0])\n : isEntity(start) && getMetadata(start);\n // This should only happen for `start=[]`, which we know should return `[]`\n if (!meta) return [] as unknown as Promise<V>;\n\n // If we're already loaded, just return\n if (!opts.forceReload && isLensLoadedPath(start, paths)) {\n // Keep this synchronous to avoid adding a promise turn; this preserves nuanced hook timing in production code.\n return getLensPath(meta, start, paths) as Promise<V>;\n }\n\n return loadLensPathAsync(meta, start, paths, opts);\n}\n\n/**\n * Loads an unloaded lens path, keeping the already-loaded shortcut in `loadLensPath` synchronous.\n *\n * I.e. this avoids adding an extra promise turn for already-loaded paths during concurrent hooks.\n */\nasync function loadLensPathAsync<T extends Entity, V>(\n meta: EntityMetadata,\n start: T | readonly T[],\n paths: string[],\n opts: { forceReload?: boolean; sql?: boolean },\n): Promise<V> {\n // See if we can load this via SQL\n if (opts.sql) {\n // Are all paths SQL query-able?\n if (!isAllSqlPaths(meta, paths)) {\n throw new Error(\"Cannot use loadLens opts.sql with non-SQL paths\");\n }\n // If there is only 1 path, don't both with the fancy join\n if (paths.length > 1) {\n // TODO We can only do this is _none_ of the paths are loaded, otherwise we'll miss WIP mutations\n if (isReadOnlyArray(start)) {\n const em = start[0].em;\n return (await lensDataLoader(em, meta.cstr, true, paths)\n .loadMany(start.map((e) => e.idTagged))\n .catch(function loadLens(err) {\n throw appendStack(err, new Error());\n })) as V;\n } else {\n const em = start.em;\n return (await lensDataLoader(em, meta.cstr, false, paths)\n .load(start.idTagged)\n .catch(function loadLens(err) {\n throw appendStack(err, new Error());\n })) as V;\n }\n }\n }\n\n // This could be `Entity | Entity[] | undefined` as we keep walking\n let current: any = start;\n let currentMeta: EntityMetadata | undefined = meta;\n let seenSoftDeleted = false;\n // Now evaluate each step of the path\n for (const path of paths) {\n const field = currentMeta?.allFields[path] as\n | ManyToOneField\n | ManyToManyField\n | OneToManyField\n | OneToOneField\n | PrimitiveField\n | undefined;\n if (Array.isArray(current)) {\n current = (await Promise.all(current.map((c) => maybeLoad(c, path, opts)))).flat();\n current = [...new Set(current.filter((c: any) => c !== undefined && !c.isSoftDeletedEntity))];\n // As soon as we hit `current=[]`, we can early return (...`current=undefined` cannot b/c the next path might flip to a list)\n if (current.length === 0) return current!;\n } else if (current) {\n current = await maybeLoad(current, path, opts);\n seenSoftDeleted ||= (current as any)?.isSoftDeletedEntity;\n // If we had been traversing m2o -> m2o (i.e. book -> author) and just hit an o2m/m2m (i.e.\n // book -> author -> comments), and any of our prior m2os like `author` had been soft deleted,\n // just filter everything out.\n //\n // Otherwise, we keep `book -> author`, even if author is soft-deleted, b/c it changes the return\n // type from \"author\" to \"author | undefined\".\n if (Array.isArray(current) && seenSoftDeleted) {\n return [] as any;\n }\n } else {\n // current is undefined; see if we should flip to a list ... which means we can early return\n if (field?.kind === \"o2m\" || field?.kind === \"m2m\") return [] as any;\n }\n currentMeta = nextMeta(current, field);\n }\n return current!;\n}\n\nexport function isAllSqlPaths(meta: EntityMetadata, paths: string[]): boolean {\n for (let i = 0, current = meta; i < paths.length; i++) {\n const next = current.allFields[paths[i]];\n if (next && (next.kind === \"m2o\" || next.kind === \"m2m\" || next.kind === \"o2m\" || next.kind === \"o2o\")) {\n current = next.otherMetadata();\n } else {\n return false;\n }\n }\n return true;\n}\n\n// Given BookReview+[book, author] return [Author, books+bookReviews]\nexport function mapPathsToTarget(source: EntityMetadata, paths: string[]): [EntityMetadata, [EntityMetadata, Field][]] {\n let other = source;\n let fields: [EntityMetadata, Field][] = [];\n for (let i = 0; i < paths.length; i++) {\n const next = other.allFields[paths[i]];\n if (next && (next.kind === \"m2o\" || next.kind === \"m2m\" || next.kind === \"o2m\" || next.kind === \"o2o\")) {\n other = next.otherMetadata();\n fields.push([other, other.allFields[next.otherFieldName]]);\n } else {\n throw new Error(\"Either not an all-SQL path or not supported yet\");\n }\n }\n return [other, fields.reverse()];\n}\n\nfunction maybeLoad(object: any, path: string, opts: { forceReload?: boolean }): unknown {\n if (object === undefined || object === null) {\n return undefined;\n }\n const value = object[path];\n if (value && typeof value === \"object\" && \"load\" in value) {\n return value.load(opts);\n } else if (value && typeof value === \"function\") {\n return value.apply(object);\n } else {\n return value;\n }\n}\n\n/**\n * The synchronous version of `loadLens`.\n *\n * This assumes you've first evaluated the lens with `loadLens` and now can access it synchronously.\n */\nexport function getLens<T, U, V>(\n startMeta: EntityMetadata,\n start: T | readonly T[],\n fn: (lens: Lens<T>) => Lens<U, V>,\n): V {\n return getLensPath(startMeta, start, collectPaths(fn));\n}\n\n/** Synchronously traverses a precomputed lens path. */\nexport function getLensPath<T, V>(startMeta: EntityMetadata, start: T | readonly T[], paths: string[]): V {\n let currentMeta: EntityMetadata | undefined = startMeta;\n let current: any = start;\n let seenSoftDeleted = false;\n // Now evaluate each step of the path\n for (const path of paths) {\n // We might navigate into properties, at which point we won't know the currentMeta\n const field = currentMeta?.allFields[path] as\n | ManyToOneField\n | ManyToManyField\n | OneToManyField\n | OneToOneField\n | PrimitiveField\n | undefined;\n if (Array.isArray(current)) {\n // Use a set to dedup as we go\n const next = new Set();\n // This can be a hot path, so avoid `map` and `flat` and just loop\n for (const c of current) {\n const value = maybeGet(c, path);\n if (Array.isArray(value)) for (const v of value) maybeAdd(next, v);\n else maybeAdd(next, value);\n }\n current = [...next];\n } else if (current) {\n current = maybeGet(current, path);\n seenSoftDeleted ||= (current as any)?.isSoftDeletedEntity;\n // If we had been traversing m2o -> m2o and just hit an o2m/m2m, and any of our\n // prior m2os had been soft-deleted, just filter everything out.\n if (Array.isArray(current) && seenSoftDeleted) {\n return [] as any;\n }\n } else {\n // current is undefined; see if we should flip to a list ... which means we can early return\n if (field?.kind === \"o2m\" || field?.kind === \"m2m\") return [] as any;\n }\n currentMeta = nextMeta(current, field);\n }\n return current!;\n}\n\n/** Returns the next runtime metadata, preserving subtype-specific fields after base-typed traversals. */\nfunction nextMeta(current: unknown, field: Field | undefined): EntityMetadata | undefined {\n const entity = Array.isArray(current) ? current[0] : current;\n if (isEntity(entity)) return getMetadata(entity);\n return field && \"otherMetadata\" in field ? field.otherMetadata() : undefined;\n}\n\nfunction maybeAdd(set: Set<any>, value: any) {\n if (value !== undefined && !value.isSoftDeletedEntity) set.add(value);\n}\n\n/** Returns whether a lens is loaded; primarily for deeply loaded instances in tests. */\nexport function isLensLoaded<T, U, V>(start: T | readonly T[], fn: (lens: Lens<T>) => Lens<U, V>): boolean {\n return isLensLoadedPath(start, collectPaths(fn));\n}\n\n/** Returns whether a precomputed lens path is loaded; primarily for deeply loaded instances in tests. */\nexport function isLensLoadedPath<T>(start: T | readonly T[], paths: string[]): boolean {\n // This is a huge copy/paste of `getLens` but we check `isNotLoaded` and early return\n // as soon as we find any not-loaded relation\n let current: any = start;\n let seenSoftDeleted = false;\n // Now evaluate each step of the path\n for (const path of paths) {\n if (Array.isArray(current)) {\n // Use a set to dedup as we go\n const next = new Set();\n for (const c of current) {\n if (isNotLoaded(c, path)) return false;\n const value = maybeGet(c, path);\n if (Array.isArray(value)) for (const v of value) maybeAdd(next, v);\n else maybeAdd(next, value);\n }\n current = [...next];\n } else {\n if (isNotLoaded(current, path)) return false;\n current = maybeGet(current, path);\n seenSoftDeleted ||= (current as any)?.isSoftDeletedEntity;\n // If we had been traversing m2o -> m2o and just hit an o2m/m2m, and any of our\n // prior m2os had been soft deleted, just filter everything out.\n if (Array.isArray(current) && seenSoftDeleted) {\n return true;\n }\n }\n }\n return true;\n}\n\n/** Accepts a lens like `a => a.books.reviews` and returns a hint like `{ books: { reviews: {} } }`. */\nexport function lensToLoadHint<T extends Entity, U, V>(fn: (lens: Lens<T>) => Lens<U, V>): LoadHint<T> {\n return lensPathToLoadHint(collectPaths(fn));\n}\n\n/** Accepts lens paths like `[books, reviews]` and returns a hint like `{ books: { reviews: {} } }`. */\nexport function lensPathToLoadHint<T extends Entity>(paths: string[]): LoadHint<T> {\n let current = {};\n for (let i = paths.length - 1; i >= 0; i--) {\n const path = paths[i];\n current = { [path]: current };\n }\n return current as LoadHint<T>;\n}\n\n/** Accepts a lens like `a => a.books.reviews` and returns the paths like `[books, reviews]`. */\nexport function lensToPath<T extends Entity, U, V>(fn: (lens: Lens<T>) => Lens<U, V>): string[] {\n return [...collectPaths(fn)];\n}\n\nfunction isNotLoaded(object: any, path: string): boolean {\n const value = object && object[path];\n if (value instanceof AbstractRelationImpl || isProperty(value)) {\n return !value.isLoaded;\n }\n return false;\n}\n\nfunction maybeGet(object: any, path: string): unknown {\n if (object === undefined || object === null) {\n return undefined;\n }\n const value = object[path];\n if (typeof value === \"object\" && \"get\" in value) {\n return value.get;\n } else if (value && typeof value === \"function\") {\n return value.apply(object);\n } else {\n return value;\n }\n}\n\nfunction collectPaths(fn: Function): string[] {\n const paths: string[] = [];\n // The proxy collects the path navigations that the user's `fn` lambda invokes.\n const proxy = new Proxy(\n {},\n {\n get(_, property, receiver) {\n paths.push(String(property));\n return receiver;\n },\n },\n );\n // Invoke the lens function to record the navigation path on our proxy\n fn(proxy as any);\n return paths;\n}\n\n// Work around https://github.com/microsoft/TypeScript/issues/17002\nfunction isReadOnlyArray<T>(value: T | readonly T[]): value is readonly T[] {\n return Array.isArray(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqFA,eAAsB,SACpB,OACA,IACA,OAAiD,CAAC,GACtC;CACZ,OAAO,aAAa,OAAO,aAAa,EAAE,GAAG,IAAI;AACnD;;AAGA,SAAgB,aACd,OACA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AC/B,IAAI,iBAAiBG,uCAAAA,wBAAwBC,8BAAAA,WAAW,KAAK,GAC3D,OAAO,CAAC,MAAM;CAEhB,OAAO;AACT;AAEA,SAAS,SAAS,QAAa,MAAuB;CACpD,IAAI,WAAW,KAAA,KAAa,WAAW,MACrC;CAEF,MAAM,QAAQ,OAAO;CACrB,IAAI,OAAO,UAAU,YAAY,SAAS,OACxC,OAAO,MAAM;MACR,IAAI,SAAS,OAAO,UAAU,YACnC,OAAO,MAAM,MAAM,MAAM;MAEzB,OAAO;AAEX;AAEA,SAAS,aAAa,IAAwB;CAC5C,MAAM,QAAkB,CAAC;CAYzB,GAAG,IAVe,MAChB,CAAC,GACD,EACE,IAAI,GAAG,UAAU,UAAU;EACzB,MAAM,KAAK,OAAO,QAAQ,CAAC;EAC3B,OAAO;CACT,EACF,CAGK,CAAQ;CACf,OAAO;AACT;AAGA,SAAS,gBAAmB,OAAgD;CAC1E,OAAO,MAAM,QAAQ,KAAK;AAC5B"}
|
|
1
|
+
{"version":3,"file":"loadLens.cjs","names":["isEntity","getMetadata","getEmInternalApi","isInTrustedContext","lensDataLoader","appendStack","AbstractRelationImpl","isProperty"],"sources":["../../src/loading/loadLens.ts"],"sourcesContent":["import { lensDataLoader } from \"src/dataloaders/lensDataLoader.ts\";\nimport { type Entity, isEntity } from \"src/Entity.ts\";\nimport { appendStack, getEmInternalApi } from \"src/EntityManager.ts\";\nimport {\n type EntityMetadata,\n type Field,\n type ManyToManyField,\n type ManyToOneField,\n type OneToManyField,\n type OneToOneField,\n type PrimitiveField,\n getMetadata,\n} from \"src/EntityMetadata.ts\";\nimport type { LoadHint } from \"src/loading/loadHints.ts\";\nimport { AbstractRelationImpl } from \"src/relations/AbstractRelationImpl.ts\";\nimport { isProperty } from \"src/relations/index.ts\";\nimport { isInTrustedContext } from \"src/trusted.ts\";\n\n/** Generically matches on a Reference/Collection's load method. */\ntype LoadLike<U> = { load(): Promise<U> };\n\n/** Generically matches a property or zero-arg method that returns a promise. */\ntype PromiseFnLike<U> = () => PromiseLike<U>;\n\n/**\n * Given a parent type `R` (that is our current lens \"return type\", i.e. `Author` or `Author | undefined` or `Author[]`),\n * and the type `V` of the \"next step\" of the traversal (i.e. itself `Book` or `Book | undefined` or `Book[]`, depending\n * on the relation being traversed), returns `V` mapped to \"the right format\" based on `R`.\n *\n * I.e.:\n *\n * - `Author | undefined` that navigates a `Book` will become `Book | undefined`\n * - `Author` that navigates a `Book | undefined` will also become `Book | undefined`\n * - `Author[]` that navigates a `Book | undefined` will become a `Book[]`\n * - `Author | undefined` that navigates a `Book[]` will become a `Book[]`\n */\n// The extra `[]` around `V` and `ReadonlyArray<any>` are to keep the type as `Array<Foo | undefined>`\n// instead of `Foo[] | undefined[]`.\n// When `P extends ReadonlyArray, i.e. we're in flatMap mode, we're also in filter undefined mode.\ntype MaybeArray<R, V> =\n R extends ReadonlyArray<any>\n ? [V] extends [ReadonlyArray<infer U>]\n ? DropUndefined<U>[]\n : DropUndefined<V>[]\n : V extends ReadonlyArray<any>\n ? V\n : [R] extends [undefined]\n ? V | undefined\n : V;\n\n// ([R] extends [undefined]) ? (V) : V;\n\n/** Given a type T that we come across in the path, de-array it to continue our flatMap-ish semantics. */\ntype MaybeDropArray<T> = T extends ReadonlyArray<infer U> ? U : T;\n\ntype DropUndefined<T> = Exclude<T, undefined>;\n\n/**\n * A type for declaratively walking the object graph.\n *\n * This is not technically a Lens that can `get/set`, but the idea is generally the same.\n *\n * `T` is the type we're on, i.e. when `T = Author` we can do `.firstName` or `.lastName.\n * `R` is either a `T` or `T[]` or `T | undefined` and just captures whether we've hit a\n * list at any point in the lens navigation path.\n */\nexport type Lens<T, R = T> = {\n [P in keyof T]: T[P] extends LoadLike<infer U>\n ? Lens<MaybeDropArray<DropUndefined<U>>, MaybeArray<R, U>>\n : T[P] extends PromiseFnLike<infer U>\n ? Lens<MaybeDropArray<DropUndefined<U>>, MaybeArray<R, U>>\n : Lens<MaybeDropArray<DropUndefined<T[P]>>, MaybeArray<R, T[P]>>;\n};\n\n/**\n * Allows declaratively loading/traversing several layers of references at once.\n *\n * I.e.:\n *\n * ```typescript\n * const publisher = await book.load(b => b.author.publisher);\n * ```\n */\n// For some reason accepting Lens<this, this> does not work when called from within the entity\n// subclass itself, so we use the codegen hammer in our subclass to force the right Lens type\n// in a .load stub that just calls us for the implementation.\nexport async function loadLens<T extends Entity, U, V>(\n start: T | readonly T[],\n fn: (lens: Lens<T>) => Lens<U, V>,\n opts: { forceReload?: boolean; sql?: boolean } = {},\n): Promise<V> {\n return loadLensPath(start, collectPaths(fn), opts);\n}\n\n/** Loads a precomputed lens path, avoiding repeated lambda/proxy evaluation for long-lived relation declarations. */\nexport function loadLensPath<T extends Entity, V>(\n start: T | readonly T[],\n paths: string[],\n opts: { forceReload?: boolean; sql?: boolean } = {},\n): Promise<V> {\n // Probe for the meta, so we can track when/if it needs to flip to a collection (even after hitting undefined)\n const meta = Array.isArray(start)\n ? isEntity(start[0]) && getMetadata(start[0])\n : isEntity(start) && getMetadata(start);\n // This should only happen for `start=[]`, which we know should return `[]`\n if (!meta) return [] as unknown as Promise<V>;\n\n // If we're already loaded, just return\n if (!opts.forceReload && isLensLoadedPath(start, paths)) {\n // Keep this synchronous to avoid adding a promise turn; this preserves nuanced hook timing in production code.\n return getLensPath(meta, start, paths) as Promise<V>;\n }\n\n return loadLensPathAsync(meta, start, paths, opts);\n}\n\n/**\n * Loads an unloaded lens path, keeping the already-loaded shortcut in `loadLensPath` synchronous.\n *\n * I.e. this avoids adding an extra promise turn for already-loaded paths during concurrent hooks.\n */\nasync function loadLensPathAsync<T extends Entity, V>(\n meta: EntityMetadata,\n start: T | readonly T[],\n paths: string[],\n opts: { forceReload?: boolean; sql?: boolean },\n): Promise<V> {\n // See if we can load this via SQL\n if (opts.sql) {\n // Are all paths SQL query-able?\n if (!isAllSqlPaths(meta, paths)) {\n throw new Error(\"Cannot use loadLens opts.sql with non-SQL paths\");\n }\n // If there is only 1 path, don't both with the fancy join\n const em = (isReadOnlyArray(start) ? start[0] : start).em;\n const plugins = getEmInternalApi(em).pluginManager;\n // SQL joins skip intermediate relation getters, including their field and target permissions,\n // so we always walk the graph if either of these hooks are being used.\n const needsRelationChecks =\n !isInTrustedContext() && (plugins.hasHook(\"beforeGetField\") || plugins.hasHook(\"canViewEntity\"));\n if (paths.length > 1 && !needsRelationChecks) {\n // TODO We can only do this is _none_ of the paths are loaded, otherwise we'll miss WIP mutations\n if (isReadOnlyArray(start)) {\n const em = start[0].em;\n return (await lensDataLoader(em, meta.cstr, true, paths)\n .loadMany(start.map((e) => e.idTagged))\n .catch(function loadLens(err) {\n throw appendStack(err, new Error());\n })) as V;\n } else {\n const em = start.em;\n return (await lensDataLoader(em, meta.cstr, false, paths)\n .load(start.idTagged)\n .catch(function loadLens(err) {\n throw appendStack(err, new Error());\n })) as V;\n }\n }\n }\n\n // This could be `Entity | Entity[] | undefined` as we keep walking\n let current: any = start;\n let currentMeta: EntityMetadata | undefined = meta;\n let seenSoftDeleted = false;\n // Now evaluate each step of the path\n for (const path of paths) {\n const field = currentMeta?.allFields[path] as\n | ManyToOneField\n | ManyToManyField\n | OneToManyField\n | OneToOneField\n | PrimitiveField\n | undefined;\n if (Array.isArray(current)) {\n current = (await Promise.all(current.map((c) => maybeLoad(c, path, opts)))).flat();\n current = [...new Set(current.filter((c: any) => c !== undefined && !c.isSoftDeletedEntity))];\n // As soon as we hit `current=[]`, we can early return (...`current=undefined` cannot b/c the next path might flip to a list)\n if (current.length === 0) return current!;\n } else if (current) {\n current = await maybeLoad(current, path, opts);\n seenSoftDeleted ||= (current as any)?.isSoftDeletedEntity;\n // If we had been traversing m2o -> m2o (i.e. book -> author) and just hit an o2m/m2m (i.e.\n // book -> author -> comments), and any of our prior m2os like `author` had been soft deleted,\n // just filter everything out.\n //\n // Otherwise, we keep `book -> author`, even if author is soft-deleted, b/c it changes the return\n // type from \"author\" to \"author | undefined\".\n if (Array.isArray(current) && seenSoftDeleted) {\n return [] as any;\n }\n } else {\n // current is undefined; see if we should flip to a list ... which means we can early return\n if (field?.kind === \"o2m\" || field?.kind === \"m2m\") return [] as any;\n }\n currentMeta = nextMeta(current, field);\n }\n return current!;\n}\n\nexport function isAllSqlPaths(meta: EntityMetadata, paths: string[]): boolean {\n for (let i = 0, current = meta; i < paths.length; i++) {\n const next = current.allFields[paths[i]];\n if (next && (next.kind === \"m2o\" || next.kind === \"m2m\" || next.kind === \"o2m\" || next.kind === \"o2o\")) {\n current = next.otherMetadata();\n } else {\n return false;\n }\n }\n return true;\n}\n\n// Given BookReview+[book, author] return [Author, books+bookReviews]\nexport function mapPathsToTarget(source: EntityMetadata, paths: string[]): [EntityMetadata, [EntityMetadata, Field][]] {\n let other = source;\n let fields: [EntityMetadata, Field][] = [];\n for (let i = 0; i < paths.length; i++) {\n const next = other.allFields[paths[i]];\n if (next && (next.kind === \"m2o\" || next.kind === \"m2m\" || next.kind === \"o2m\" || next.kind === \"o2o\")) {\n other = next.otherMetadata();\n fields.push([other, other.allFields[next.otherFieldName]]);\n } else {\n throw new Error(\"Either not an all-SQL path or not supported yet\");\n }\n }\n return [other, fields.reverse()];\n}\n\nfunction maybeLoad(object: any, path: string, opts: { forceReload?: boolean }): unknown {\n if (object === undefined || object === null) {\n return undefined;\n }\n const value = object[path];\n if (value && typeof value === \"object\" && \"load\" in value) {\n return value.load(opts);\n } else if (value && typeof value === \"function\") {\n return value.apply(object);\n } else {\n return value;\n }\n}\n\n/**\n * The synchronous version of `loadLens`.\n *\n * This assumes you've first evaluated the lens with `loadLens` and now can access it synchronously.\n */\nexport function getLens<T, U, V>(\n startMeta: EntityMetadata,\n start: T | readonly T[],\n fn: (lens: Lens<T>) => Lens<U, V>,\n): V {\n return getLensPath(startMeta, start, collectPaths(fn));\n}\n\n/** Synchronously traverses a precomputed lens path. */\nexport function getLensPath<T, V>(startMeta: EntityMetadata, start: T | readonly T[], paths: string[]): V {\n let currentMeta: EntityMetadata | undefined = startMeta;\n let current: any = start;\n let seenSoftDeleted = false;\n // Now evaluate each step of the path\n for (const path of paths) {\n // We might navigate into properties, at which point we won't know the currentMeta\n const field = currentMeta?.allFields[path] as\n | ManyToOneField\n | ManyToManyField\n | OneToManyField\n | OneToOneField\n | PrimitiveField\n | undefined;\n if (Array.isArray(current)) {\n // Use a set to dedup as we go\n const next = new Set();\n // This can be a hot path, so avoid `map` and `flat` and just loop\n for (const c of current) {\n const value = maybeGet(c, path);\n if (Array.isArray(value)) for (const v of value) maybeAdd(next, v);\n else maybeAdd(next, value);\n }\n current = [...next];\n } else if (current) {\n current = maybeGet(current, path);\n seenSoftDeleted ||= (current as any)?.isSoftDeletedEntity;\n // If we had been traversing m2o -> m2o and just hit an o2m/m2m, and any of our\n // prior m2os had been soft-deleted, just filter everything out.\n if (Array.isArray(current) && seenSoftDeleted) {\n return [] as any;\n }\n } else {\n // current is undefined; see if we should flip to a list ... which means we can early return\n if (field?.kind === \"o2m\" || field?.kind === \"m2m\") return [] as any;\n }\n currentMeta = nextMeta(current, field);\n }\n return current!;\n}\n\n/** Returns the next runtime metadata, preserving subtype-specific fields after base-typed traversals. */\nfunction nextMeta(current: unknown, field: Field | undefined): EntityMetadata | undefined {\n const entity = Array.isArray(current) ? current[0] : current;\n if (isEntity(entity)) return getMetadata(entity);\n return field && \"otherMetadata\" in field ? field.otherMetadata() : undefined;\n}\n\nfunction maybeAdd(set: Set<any>, value: any) {\n if (value !== undefined && !value.isSoftDeletedEntity) set.add(value);\n}\n\n/** Returns whether a lens is loaded; primarily for deeply loaded instances in tests. */\nexport function isLensLoaded<T, U, V>(start: T | readonly T[], fn: (lens: Lens<T>) => Lens<U, V>): boolean {\n return isLensLoadedPath(start, collectPaths(fn));\n}\n\n/** Returns whether a precomputed lens path is loaded; primarily for deeply loaded instances in tests. */\nexport function isLensLoadedPath<T>(start: T | readonly T[], paths: string[]): boolean {\n // This is a huge copy/paste of `getLens` but we check `isNotLoaded` and early return\n // as soon as we find any not-loaded relation\n let current: any = start;\n let seenSoftDeleted = false;\n // Now evaluate each step of the path\n for (const path of paths) {\n if (Array.isArray(current)) {\n // Use a set to dedup as we go\n const next = new Set();\n for (const c of current) {\n if (isNotLoaded(c, path)) return false;\n const value = maybeGet(c, path);\n if (Array.isArray(value)) for (const v of value) maybeAdd(next, v);\n else maybeAdd(next, value);\n }\n current = [...next];\n } else {\n if (isNotLoaded(current, path)) return false;\n current = maybeGet(current, path);\n seenSoftDeleted ||= (current as any)?.isSoftDeletedEntity;\n // If we had been traversing m2o -> m2o and just hit an o2m/m2m, and any of our\n // prior m2os had been soft deleted, just filter everything out.\n if (Array.isArray(current) && seenSoftDeleted) {\n return true;\n }\n }\n }\n return true;\n}\n\n/** Accepts a lens like `a => a.books.reviews` and returns a hint like `{ books: { reviews: {} } }`. */\nexport function lensToLoadHint<T extends Entity, U, V>(fn: (lens: Lens<T>) => Lens<U, V>): LoadHint<T> {\n return lensPathToLoadHint(collectPaths(fn));\n}\n\n/** Accepts lens paths like `[books, reviews]` and returns a hint like `{ books: { reviews: {} } }`. */\nexport function lensPathToLoadHint<T extends Entity>(paths: string[]): LoadHint<T> {\n let current = {};\n for (let i = paths.length - 1; i >= 0; i--) {\n const path = paths[i];\n current = { [path]: current };\n }\n return current as LoadHint<T>;\n}\n\n/** Accepts a lens like `a => a.books.reviews` and returns the paths like `[books, reviews]`. */\nexport function lensToPath<T extends Entity, U, V>(fn: (lens: Lens<T>) => Lens<U, V>): string[] {\n return [...collectPaths(fn)];\n}\n\nfunction isNotLoaded(object: any, path: string): boolean {\n const value = object && object[path];\n if (value instanceof AbstractRelationImpl || isProperty(value)) {\n return !value.isLoaded;\n }\n return false;\n}\n\nfunction maybeGet(object: any, path: string): unknown {\n if (object === undefined || object === null) {\n return undefined;\n }\n const value = object[path];\n if (typeof value === \"object\" && \"get\" in value) {\n return value.get;\n } else if (value && typeof value === \"function\") {\n return value.apply(object);\n } else {\n return value;\n }\n}\n\nfunction collectPaths(fn: Function): string[] {\n const paths: string[] = [];\n // The proxy collects the path navigations that the user's `fn` lambda invokes.\n const proxy = new Proxy(\n {},\n {\n get(_, property, receiver) {\n paths.push(String(property));\n return receiver;\n },\n },\n );\n // Invoke the lens function to record the navigation path on our proxy\n fn(proxy as any);\n return paths;\n}\n\n// Work around https://github.com/microsoft/TypeScript/issues/17002\nfunction isReadOnlyArray<T>(value: T | readonly T[]): value is readonly T[] {\n return Array.isArray(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsFA,eAAsB,SACpB,OACA,IACA,OAAiD,CAAC,GACtC;CACZ,OAAO,aAAa,OAAO,aAAa,EAAE,GAAG,IAAI;AACnD;;AAGA,SAAgB,aACd,OACA,OACA,OAAiD,CAAC,GACtC;CAEZ,MAAM,OAAO,MAAM,QAAQ,KAAK,IAC5BA,eAAAA,SAAS,MAAM,EAAE,KAAKC,uBAAAA,YAAY,MAAM,EAAE,IAC1CD,eAAAA,SAAS,KAAK,KAAKC,uBAAAA,YAAY,KAAK;CAExC,IAAI,CAAC,MAAM,OAAO,CAAC;CAGnB,IAAI,CAAC,KAAK,eAAe,iBAAiB,OAAO,KAAK,GAEpD,OAAO,YAAY,MAAM,OAAO,KAAK;CAGvC,OAAO,kBAAkB,MAAM,OAAO,OAAO,IAAI;AACnD;;;;;;AAOA,eAAe,kBACb,MACA,OACA,OACA,MACY;CAEZ,IAAI,KAAK,KAAK;EAEZ,IAAI,CAAC,cAAc,MAAM,KAAK,GAC5B,MAAM,IAAI,MAAM,iDAAiD;EAGnE,MAAM,MAAM,gBAAgB,KAAK,IAAI,MAAM,KAAK,MAAA,CAAO;EACvD,MAAM,UAAUC,sBAAAA,iBAAiB,EAAE,CAAC,CAAC;EAGrC,MAAM,sBACJ,CAACC,gBAAAA,mBAAmB,MAAM,QAAQ,QAAQ,gBAAgB,KAAK,QAAQ,QAAQ,eAAe;EAChG,IAAI,MAAM,SAAS,KAAK,CAAC,qBAAqB;GAE5C,IAAI,gBAAgB,KAAK,GAAG;IAC1B,MAAM,KAAK,MAAM,EAAE,CAA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