joist-orm 1.294.0 → 2.0.1
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/codegen.d.ts +2 -0
- package/build/codegen.d.ts.map +1 -0
- package/build/codegen.js +29 -0
- package/build/codegen.js.map +1 -0
- package/build/drivers/PostgresDriver.d.ts +1 -4
- package/build/drivers/PostgresDriver.d.ts.map +1 -1
- package/build/drivers/PostgresDriver.js +49 -58
- package/build/drivers/PostgresDriver.js.map +1 -1
- package/build/graphql-codegen-export.d.ts +2 -0
- package/build/graphql-codegen-export.d.ts.map +1 -0
- package/build/{drivers/index.js → graphql-codegen-export.js} +3 -5
- package/build/graphql-codegen-export.js.map +1 -0
- package/build/graphql-export.d.ts +2 -0
- package/build/graphql-export.d.ts.map +1 -0
- package/build/graphql-export.js +19 -0
- package/build/graphql-export.js.map +1 -0
- package/build/index.d.ts +3 -128
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -284
- package/build/index.js.map +1 -1
- package/build/knex-export.d.ts +2 -0
- package/build/knex-export.d.ts.map +1 -0
- package/build/knex-export.js +19 -0
- package/build/knex-export.js.map +1 -0
- package/build/pg-export.d.ts +2 -0
- package/build/pg-export.d.ts.map +1 -0
- package/build/pg-export.js +7 -0
- package/build/pg-export.js.map +1 -0
- package/build/pg-migrate.d.ts +2 -0
- package/build/pg-migrate.d.ts.map +1 -0
- package/build/pg-migrate.js +30 -0
- package/build/pg-migrate.js.map +1 -0
- package/build/tests-export.d.ts +2 -0
- package/build/tests-export.d.ts.map +1 -0
- package/build/tests-export.js +19 -0
- package/build/tests-export.js.map +1 -0
- package/package.json +94 -16
- package/build/AliasAssigner.d.ts +0 -7
- package/build/AliasAssigner.d.ts.map +0 -1
- package/build/AliasAssigner.js +0 -30
- package/build/AliasAssigner.js.map +0 -1
- package/build/Aliases.d.ts +0 -110
- package/build/Aliases.d.ts.map +0 -1
- package/build/Aliases.js +0 -456
- package/build/Aliases.js.map +0 -1
- package/build/BaseEntity.d.ts +0 -66
- package/build/BaseEntity.d.ts.map +0 -1
- package/build/BaseEntity.js +0 -120
- package/build/BaseEntity.js.map +0 -1
- package/build/ConditionBuilder.d.ts +0 -50
- package/build/ConditionBuilder.d.ts.map +0 -1
- package/build/ConditionBuilder.js +0 -178
- package/build/ConditionBuilder.js.map +0 -1
- package/build/Entity.d.ts +0 -38
- package/build/Entity.d.ts.map +0 -1
- package/build/Entity.js +0 -8
- package/build/Entity.js.map +0 -1
- package/build/EntityFields.d.ts +0 -37
- package/build/EntityFields.d.ts.map +0 -1
- package/build/EntityFields.js +0 -3
- package/build/EntityFields.js.map +0 -1
- package/build/EntityFilter.d.ts +0 -113
- package/build/EntityFilter.d.ts.map +0 -1
- package/build/EntityFilter.js +0 -3
- package/build/EntityFilter.js.map +0 -1
- package/build/EntityGraphQLFilter.d.ts +0 -51
- package/build/EntityGraphQLFilter.d.ts.map +0 -1
- package/build/EntityGraphQLFilter.js +0 -54
- package/build/EntityGraphQLFilter.js.map +0 -1
- package/build/EntityManager.d.ts +0 -734
- package/build/EntityManager.d.ts.map +0 -1
- package/build/EntityManager.js +0 -2075
- package/build/EntityManager.js.map +0 -1
- package/build/EntityMetadata.d.ts +0 -185
- package/build/EntityMetadata.d.ts.map +0 -1
- package/build/EntityMetadata.js +0 -61
- package/build/EntityMetadata.js.map +0 -1
- package/build/EnumMetadata.d.ts +0 -15
- package/build/EnumMetadata.d.ts.map +0 -1
- package/build/EnumMetadata.js +0 -3
- package/build/EnumMetadata.js.map +0 -1
- package/build/FlushLock.d.ts +0 -26
- package/build/FlushLock.d.ts.map +0 -1
- package/build/FlushLock.js +0 -57
- package/build/FlushLock.js.map +0 -1
- package/build/HintTree.d.ts +0 -42
- package/build/HintTree.d.ts.map +0 -1
- package/build/HintTree.js +0 -64
- package/build/HintTree.js.map +0 -1
- package/build/IndexManager.d.ts +0 -30
- package/build/IndexManager.d.ts.map +0 -1
- package/build/IndexManager.js +0 -206
- package/build/IndexManager.js.map +0 -1
- package/build/InstanceData.d.ts +0 -59
- package/build/InstanceData.d.ts.map +0 -1
- package/build/InstanceData.js +0 -162
- package/build/InstanceData.js.map +0 -1
- package/build/IsLoadedCache.d.ts +0 -32
- package/build/IsLoadedCache.d.ts.map +0 -1
- package/build/IsLoadedCache.js +0 -80
- package/build/IsLoadedCache.js.map +0 -1
- package/build/JoinRows.d.ts +0 -75
- package/build/JoinRows.d.ts.map +0 -1
- package/build/JoinRows.js +0 -246
- package/build/JoinRows.js.map +0 -1
- package/build/PluginManager.d.ts +0 -90
- package/build/PluginManager.d.ts.map +0 -1
- package/build/PluginManager.js +0 -97
- package/build/PluginManager.js.map +0 -1
- package/build/QueryParser.d.ts +0 -271
- package/build/QueryParser.d.ts.map +0 -1
- package/build/QueryParser.js +0 -853
- package/build/QueryParser.js.map +0 -1
- package/build/QueryParser.pruning.d.ts +0 -5
- package/build/QueryParser.pruning.d.ts.map +0 -1
- package/build/QueryParser.pruning.js +0 -118
- package/build/QueryParser.pruning.js.map +0 -1
- package/build/QueryVisitor.d.ts +0 -19
- package/build/QueryVisitor.d.ts.map +0 -1
- package/build/QueryVisitor.js +0 -84
- package/build/QueryVisitor.js.map +0 -1
- package/build/ReactionsManager.d.ts +0 -84
- package/build/ReactionsManager.d.ts.map +0 -1
- package/build/ReactionsManager.js +0 -308
- package/build/ReactionsManager.js.map +0 -1
- package/build/Todo.d.ts +0 -31
- package/build/Todo.d.ts.map +0 -1
- package/build/Todo.js +0 -73
- package/build/Todo.js.map +0 -1
- package/build/caches.d.ts +0 -6
- package/build/caches.d.ts.map +0 -1
- package/build/caches.js +0 -42
- package/build/caches.js.map +0 -1
- package/build/changes.d.ts +0 -79
- package/build/changes.d.ts.map +0 -1
- package/build/changes.js +0 -251
- package/build/changes.js.map +0 -1
- package/build/config.d.ts +0 -237
- package/build/config.d.ts.map +0 -1
- package/build/config.js +0 -298
- package/build/config.js.map +0 -1
- package/build/config.test.d.ts +0 -2
- package/build/config.test.d.ts.map +0 -1
- package/build/config.test.js +0 -53
- package/build/config.test.js.map +0 -1
- package/build/configure.d.ts +0 -13
- package/build/configure.d.ts.map +0 -1
- package/build/configure.js +0 -329
- package/build/configure.js.map +0 -1
- package/build/dataloaders/findByUniqueDataLoader.d.ts +0 -7
- package/build/dataloaders/findByUniqueDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findByUniqueDataLoader.js +0 -47
- package/build/dataloaders/findByUniqueDataLoader.js.map +0 -1
- package/build/dataloaders/findCountDataLoader.d.ts +0 -7
- package/build/dataloaders/findCountDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findCountDataLoader.js +0 -74
- package/build/dataloaders/findCountDataLoader.js.map +0 -1
- package/build/dataloaders/findDataLoader.d.ts +0 -37
- package/build/dataloaders/findDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findDataLoader.js +0 -337
- package/build/dataloaders/findDataLoader.js.map +0 -1
- package/build/dataloaders/findIdsDataLoader.d.ts +0 -7
- package/build/dataloaders/findIdsDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findIdsDataLoader.js +0 -74
- package/build/dataloaders/findIdsDataLoader.js.map +0 -1
- package/build/dataloaders/findOrCreateDataLoader.d.ts +0 -13
- package/build/dataloaders/findOrCreateDataLoader.d.ts.map +0 -1
- package/build/dataloaders/findOrCreateDataLoader.js +0 -174
- package/build/dataloaders/findOrCreateDataLoader.js.map +0 -1
- package/build/dataloaders/lensDataLoader.d.ts +0 -12
- package/build/dataloaders/lensDataLoader.d.ts.map +0 -1
- package/build/dataloaders/lensDataLoader.js +0 -180
- package/build/dataloaders/lensDataLoader.js.map +0 -1
- package/build/dataloaders/loadDataLoader.d.ts +0 -11
- package/build/dataloaders/loadDataLoader.d.ts.map +0 -1
- package/build/dataloaders/loadDataLoader.js +0 -54
- package/build/dataloaders/loadDataLoader.js.map +0 -1
- package/build/dataloaders/manyToManyDataLoader.d.ts +0 -8
- package/build/dataloaders/manyToManyDataLoader.d.ts.map +0 -1
- package/build/dataloaders/manyToManyDataLoader.js +0 -74
- package/build/dataloaders/manyToManyDataLoader.js.map +0 -1
- package/build/dataloaders/manyToManyFindDataLoader.d.ts +0 -8
- package/build/dataloaders/manyToManyFindDataLoader.d.ts.map +0 -1
- package/build/dataloaders/manyToManyFindDataLoader.js +0 -70
- package/build/dataloaders/manyToManyFindDataLoader.js.map +0 -1
- package/build/dataloaders/oneToManyDataLoader.d.ts +0 -7
- package/build/dataloaders/oneToManyDataLoader.d.ts.map +0 -1
- package/build/dataloaders/oneToManyDataLoader.js +0 -60
- package/build/dataloaders/oneToManyDataLoader.js.map +0 -1
- package/build/dataloaders/oneToManyFindDataLoader.d.ts +0 -8
- package/build/dataloaders/oneToManyFindDataLoader.d.ts.map +0 -1
- package/build/dataloaders/oneToManyFindDataLoader.js +0 -71
- package/build/dataloaders/oneToManyFindDataLoader.js.map +0 -1
- package/build/dataloaders/oneToOneDataLoader.d.ts +0 -7
- package/build/dataloaders/oneToOneDataLoader.d.ts.map +0 -1
- package/build/dataloaders/oneToOneDataLoader.js +0 -59
- package/build/dataloaders/oneToOneDataLoader.js.map +0 -1
- package/build/dataloaders/populateDataLoader.d.ts +0 -13
- package/build/dataloaders/populateDataLoader.d.ts.map +0 -1
- package/build/dataloaders/populateDataLoader.js +0 -148
- package/build/dataloaders/populateDataLoader.js.map +0 -1
- package/build/dataloaders/recursiveChildrenDataLoader.d.ts +0 -7
- package/build/dataloaders/recursiveChildrenDataLoader.d.ts.map +0 -1
- package/build/dataloaders/recursiveChildrenDataLoader.js +0 -77
- package/build/dataloaders/recursiveChildrenDataLoader.js.map +0 -1
- package/build/dataloaders/recursiveParentsDataLoader.d.ts +0 -7
- package/build/dataloaders/recursiveParentsDataLoader.d.ts.map +0 -1
- package/build/dataloaders/recursiveParentsDataLoader.js +0 -59
- package/build/dataloaders/recursiveParentsDataLoader.js.map +0 -1
- package/build/defaults.d.ts +0 -54
- package/build/defaults.d.ts.map +0 -1
- package/build/defaults.js +0 -282
- package/build/defaults.js.map +0 -1
- package/build/driverApi.d.ts +0 -19
- package/build/driverApi.d.ts.map +0 -1
- package/build/driverApi.js +0 -17
- package/build/driverApi.js.map +0 -1
- package/build/drivers/Driver.d.ts +0 -26
- package/build/drivers/Driver.d.ts.map +0 -1
- package/build/drivers/Driver.js +0 -3
- package/build/drivers/Driver.js.map +0 -1
- package/build/drivers/EntityWriter.d.ts +0 -64
- package/build/drivers/EntityWriter.d.ts.map +0 -1
- package/build/drivers/EntityWriter.js +0 -237
- package/build/drivers/EntityWriter.js.map +0 -1
- package/build/drivers/IdAssigner.d.ts +0 -50
- package/build/drivers/IdAssigner.d.ts.map +0 -1
- package/build/drivers/IdAssigner.js +0 -133
- package/build/drivers/IdAssigner.js.map +0 -1
- package/build/drivers/buildRawQuery.d.ts +0 -20
- package/build/drivers/buildRawQuery.d.ts.map +0 -1
- package/build/drivers/buildRawQuery.js +0 -148
- package/build/drivers/buildRawQuery.js.map +0 -1
- package/build/drivers/buildUtils.d.ts +0 -4
- package/build/drivers/buildUtils.d.ts.map +0 -1
- package/build/drivers/buildUtils.js +0 -79
- package/build/drivers/buildUtils.js.map +0 -1
- package/build/drivers/index.d.ts +0 -5
- package/build/drivers/index.d.ts.map +0 -1
- package/build/drivers/index.js.map +0 -1
- package/build/fields.d.ts +0 -24
- package/build/fields.d.ts.map +0 -1
- package/build/fields.js +0 -162
- package/build/fields.js.map +0 -1
- package/build/getProperties.d.ts +0 -28
- package/build/getProperties.d.ts.map +0 -1
- package/build/getProperties.js +0 -141
- package/build/getProperties.js.map +0 -1
- package/build/json.d.ts +0 -77
- package/build/json.d.ts.map +0 -1
- package/build/json.js +0 -116
- package/build/json.js.map +0 -1
- package/build/k.d.ts +0 -2
- package/build/k.d.ts.map +0 -1
- package/build/k.js +0 -9
- package/build/k.js.map +0 -1
- package/build/keys.d.ts +0 -49
- package/build/keys.d.ts.map +0 -1
- package/build/keys.js +0 -195
- package/build/keys.js.map +0 -1
- package/build/keywords.d.ts +0 -5
- package/build/keywords.d.ts.map +0 -1
- package/build/keywords.js +0 -124
- package/build/keywords.js.map +0 -1
- package/build/loadHints.d.ts +0 -112
- package/build/loadHints.d.ts.map +0 -1
- package/build/loadHints.js +0 -75
- package/build/loadHints.js.map +0 -1
- package/build/loadLens.d.ts +0 -66
- package/build/loadLens.d.ts.map +0 -1
- package/build/loadLens.js +0 -287
- package/build/loadLens.js.map +0 -1
- package/build/logging/FactoryLogger.d.ts +0 -24
- package/build/logging/FactoryLogger.d.ts.map +0 -1
- package/build/logging/FactoryLogger.js +0 -77
- package/build/logging/FactoryLogger.js.map +0 -1
- package/build/logging/FieldLogger.d.ts +0 -27
- package/build/logging/FieldLogger.d.ts.map +0 -1
- package/build/logging/FieldLogger.js +0 -69
- package/build/logging/FieldLogger.js.map +0 -1
- package/build/logging/ReactionLogger.d.ts +0 -23
- package/build/logging/ReactionLogger.d.ts.map +0 -1
- package/build/logging/ReactionLogger.js +0 -65
- package/build/logging/ReactionLogger.js.map +0 -1
- package/build/newEntity.d.ts +0 -45
- package/build/newEntity.d.ts.map +0 -1
- package/build/newEntity.js +0 -106
- package/build/newEntity.js.map +0 -1
- package/build/newTestInstance.d.ts +0 -193
- package/build/newTestInstance.d.ts.map +0 -1
- package/build/newTestInstance.js +0 -738
- package/build/newTestInstance.js.map +0 -1
- package/build/normalizeHints.d.ts +0 -16
- package/build/normalizeHints.d.ts.map +0 -1
- package/build/normalizeHints.js +0 -31
- package/build/normalizeHints.js.map +0 -1
- package/build/plugins/ImmutableEntitiesPlugin.d.ts +0 -9
- package/build/plugins/ImmutableEntitiesPlugin.d.ts.map +0 -1
- package/build/plugins/ImmutableEntitiesPlugin.js +0 -21
- package/build/plugins/ImmutableEntitiesPlugin.js.map +0 -1
- package/build/plugins/PreloadPlugin.d.ts +0 -69
- package/build/plugins/PreloadPlugin.d.ts.map +0 -1
- package/build/plugins/PreloadPlugin.js +0 -3
- package/build/plugins/PreloadPlugin.js.map +0 -1
- package/build/preloading/JsonAggregatePreloader.d.ts +0 -16
- package/build/preloading/JsonAggregatePreloader.d.ts.map +0 -1
- package/build/preloading/JsonAggregatePreloader.js +0 -238
- package/build/preloading/JsonAggregatePreloader.js.map +0 -1
- package/build/preloading/canPreload.d.ts +0 -3
- package/build/preloading/canPreload.d.ts.map +0 -1
- package/build/preloading/canPreload.js +0 -21
- package/build/preloading/canPreload.js.map +0 -1
- package/build/preloading/partitionHint.d.ts +0 -5
- package/build/preloading/partitionHint.d.ts.map +0 -1
- package/build/preloading/partitionHint.js +0 -56
- package/build/preloading/partitionHint.js.map +0 -1
- package/build/reactiveHints.d.ts +0 -129
- package/build/reactiveHints.d.ts.map +0 -1
- package/build/reactiveHints.js +0 -458
- package/build/reactiveHints.js.map +0 -1
- package/build/relations/AbstractPropertyImpl.d.ts +0 -8
- package/build/relations/AbstractPropertyImpl.d.ts.map +0 -1
- package/build/relations/AbstractPropertyImpl.js +0 -15
- package/build/relations/AbstractPropertyImpl.js.map +0 -1
- package/build/relations/AbstractRelationImpl.d.ts +0 -36
- package/build/relations/AbstractRelationImpl.d.ts.map +0 -1
- package/build/relations/AbstractRelationImpl.js +0 -19
- package/build/relations/AbstractRelationImpl.js.map +0 -1
- package/build/relations/Collection.d.ts +0 -28
- package/build/relations/Collection.d.ts.map +0 -1
- package/build/relations/Collection.js +0 -18
- package/build/relations/Collection.js.map +0 -1
- package/build/relations/CustomCollection.d.ts +0 -69
- package/build/relations/CustomCollection.d.ts.map +0 -1
- package/build/relations/CustomCollection.js +0 -166
- package/build/relations/CustomCollection.js.map +0 -1
- package/build/relations/CustomReference.d.ts +0 -71
- package/build/relations/CustomReference.d.ts.map +0 -1
- package/build/relations/CustomReference.js +0 -152
- package/build/relations/CustomReference.js.map +0 -1
- package/build/relations/LargeCollection.d.ts +0 -19
- package/build/relations/LargeCollection.d.ts.map +0 -1
- package/build/relations/LargeCollection.js +0 -3
- package/build/relations/LargeCollection.js.map +0 -1
- package/build/relations/ManyToManyCollection.d.ts +0 -44
- package/build/relations/ManyToManyCollection.d.ts.map +0 -1
- package/build/relations/ManyToManyCollection.js +0 -268
- package/build/relations/ManyToManyCollection.js.map +0 -1
- package/build/relations/ManyToManyLargeCollection.d.ts +0 -30
- package/build/relations/ManyToManyLargeCollection.d.ts.map +0 -1
- package/build/relations/ManyToManyLargeCollection.js +0 -119
- package/build/relations/ManyToManyLargeCollection.js.map +0 -1
- package/build/relations/ManyToOneReference.d.ts +0 -121
- package/build/relations/ManyToOneReference.d.ts.map +0 -1
- package/build/relations/ManyToOneReference.js +0 -389
- package/build/relations/ManyToOneReference.js.map +0 -1
- package/build/relations/OneToManyCollection.d.ts +0 -58
- package/build/relations/OneToManyCollection.d.ts.map +0 -1
- package/build/relations/OneToManyCollection.js +0 -347
- package/build/relations/OneToManyCollection.js.map +0 -1
- package/build/relations/OneToManyLargeCollection.d.ts +0 -26
- package/build/relations/OneToManyLargeCollection.d.ts.map +0 -1
- package/build/relations/OneToManyLargeCollection.js +0 -102
- package/build/relations/OneToManyLargeCollection.js.map +0 -1
- package/build/relations/OneToOneReference.d.ts +0 -93
- package/build/relations/OneToOneReference.d.ts.map +0 -1
- package/build/relations/OneToOneReference.js +0 -228
- package/build/relations/OneToOneReference.js.map +0 -1
- package/build/relations/PolymorphicReference.d.ts +0 -89
- package/build/relations/PolymorphicReference.d.ts.map +0 -1
- package/build/relations/PolymorphicReference.js +0 -244
- package/build/relations/PolymorphicReference.js.map +0 -1
- package/build/relations/ReactiveField.d.ts +0 -87
- package/build/relations/ReactiveField.d.ts.map +0 -1
- package/build/relations/ReactiveField.js +0 -149
- package/build/relations/ReactiveField.js.map +0 -1
- package/build/relations/ReactiveGetter.d.ts +0 -30
- package/build/relations/ReactiveGetter.d.ts.map +0 -1
- package/build/relations/ReactiveGetter.js +0 -38
- package/build/relations/ReactiveGetter.js.map +0 -1
- package/build/relations/ReactiveManyToMany.d.ts +0 -56
- package/build/relations/ReactiveManyToMany.d.ts.map +0 -1
- package/build/relations/ReactiveManyToMany.js +0 -243
- package/build/relations/ReactiveManyToMany.js.map +0 -1
- package/build/relations/ReactiveManyToManyOtherSide.d.ts +0 -47
- package/build/relations/ReactiveManyToManyOtherSide.d.ts.map +0 -1
- package/build/relations/ReactiveManyToManyOtherSide.js +0 -155
- package/build/relations/ReactiveManyToManyOtherSide.js.map +0 -1
- package/build/relations/ReactiveQueryField.d.ts +0 -41
- package/build/relations/ReactiveQueryField.d.ts.map +0 -1
- package/build/relations/ReactiveQueryField.js +0 -125
- package/build/relations/ReactiveQueryField.js.map +0 -1
- package/build/relations/ReactiveReference.d.ts +0 -119
- package/build/relations/ReactiveReference.d.ts.map +0 -1
- package/build/relations/ReactiveReference.js +0 -333
- package/build/relations/ReactiveReference.js.map +0 -1
- package/build/relations/ReadOnlyCollection.d.ts +0 -19
- package/build/relations/ReadOnlyCollection.d.ts.map +0 -1
- package/build/relations/ReadOnlyCollection.js +0 -15
- package/build/relations/ReadOnlyCollection.js.map +0 -1
- package/build/relations/RecursiveCollection.d.ts +0 -84
- package/build/relations/RecursiveCollection.d.ts.map +0 -1
- package/build/relations/RecursiveCollection.js +0 -296
- package/build/relations/RecursiveCollection.js.map +0 -1
- package/build/relations/Reference.d.ts +0 -35
- package/build/relations/Reference.d.ts.map +0 -1
- package/build/relations/Reference.js +0 -21
- package/build/relations/Reference.js.map +0 -1
- package/build/relations/Relation.d.ts +0 -14
- package/build/relations/Relation.d.ts.map +0 -1
- package/build/relations/Relation.js +0 -12
- package/build/relations/Relation.js.map +0 -1
- package/build/relations/hasAsyncMethod.d.ts +0 -27
- package/build/relations/hasAsyncMethod.d.ts.map +0 -1
- package/build/relations/hasAsyncMethod.js +0 -47
- package/build/relations/hasAsyncMethod.js.map +0 -1
- package/build/relations/hasAsyncProperty.d.ts +0 -49
- package/build/relations/hasAsyncProperty.d.ts.map +0 -1
- package/build/relations/hasAsyncProperty.js +0 -98
- package/build/relations/hasAsyncProperty.js.map +0 -1
- package/build/relations/hasManyDerived.d.ts +0 -22
- package/build/relations/hasManyDerived.d.ts.map +0 -1
- package/build/relations/hasManyDerived.js +0 -32
- package/build/relations/hasManyDerived.js.map +0 -1
- package/build/relations/hasManyThrough.d.ts +0 -10
- package/build/relations/hasManyThrough.d.ts.map +0 -1
- package/build/relations/hasManyThrough.js +0 -24
- package/build/relations/hasManyThrough.js.map +0 -1
- package/build/relations/hasOneDerived.d.ts +0 -12
- package/build/relations/hasOneDerived.d.ts.map +0 -1
- package/build/relations/hasOneDerived.js +0 -24
- package/build/relations/hasOneDerived.js.map +0 -1
- package/build/relations/hasOneThrough.d.ts +0 -10
- package/build/relations/hasOneThrough.d.ts.map +0 -1
- package/build/relations/hasOneThrough.js +0 -24
- package/build/relations/hasOneThrough.js.map +0 -1
- package/build/relations/index.d.ts +0 -28
- package/build/relations/index.d.ts.map +0 -1
- package/build/relations/index.js +0 -88
- package/build/relations/index.js.map +0 -1
- package/build/rules.d.ts +0 -123
- package/build/rules.d.ts.map +0 -1
- package/build/rules.js +0 -231
- package/build/rules.js.map +0 -1
- package/build/runtimeConfig.d.ts +0 -17
- package/build/runtimeConfig.d.ts.map +0 -1
- package/build/runtimeConfig.js +0 -18
- package/build/runtimeConfig.js.map +0 -1
- package/build/serde.d.ts +0 -277
- package/build/serde.d.ts.map +0 -1
- package/build/serde.js +0 -517
- package/build/serde.js.map +0 -1
- package/build/temporal.d.ts +0 -16
- package/build/temporal.d.ts.map +0 -1
- package/build/temporal.js +0 -48
- package/build/temporal.js.map +0 -1
- package/build/temporalMappers.d.ts +0 -25
- package/build/temporalMappers.d.ts.map +0 -1
- package/build/temporalMappers.js +0 -59
- package/build/temporalMappers.js.map +0 -1
- package/build/trusted.d.ts +0 -5
- package/build/trusted.d.ts.map +0 -1
- package/build/trusted.js +0 -15
- package/build/trusted.js.map +0 -1
- package/build/typeMap.d.ts +0 -68
- package/build/typeMap.d.ts.map +0 -1
- package/build/typeMap.js +0 -3
- package/build/typeMap.js.map +0 -1
- package/build/unnest.d.ts +0 -13
- package/build/unnest.d.ts.map +0 -1
- package/build/unnest.js +0 -85
- package/build/unnest.js.map +0 -1
- package/build/upsert.d.ts +0 -42
- package/build/upsert.d.ts.map +0 -1
- package/build/upsert.js +0 -265
- package/build/upsert.js.map +0 -1
- package/build/utils.d.ts +0 -58
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js +0 -236
- package/build/utils.js.map +0 -1
- package/build/withLoaded.d.ts +0 -56
- package/build/withLoaded.d.ts.map +0 -1
- package/build/withLoaded.js +0 -76
- package/build/withLoaded.js.map +0 -1
package/build/newTestInstance.js
DELETED
|
@@ -1,738 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FactoryInitialValue = exports.testIndex = exports.testZonedDateTime = exports.testPlainDateTime = exports.testPlainDate = exports.testDate = void 0;
|
|
4
|
-
exports.newTestInstance = newTestInstance;
|
|
5
|
-
exports.defaultValue = defaultValue;
|
|
6
|
-
exports.noValue = noValue;
|
|
7
|
-
exports.maybeBranchValue = maybeBranchValue;
|
|
8
|
-
exports.maybeNew = maybeNew;
|
|
9
|
-
exports.maybeNewPoly = maybeNewPoly;
|
|
10
|
-
exports.getTestIndex = getTestIndex;
|
|
11
|
-
exports.setFactoryLogging = setFactoryLogging;
|
|
12
|
-
exports.isFactoryCreation = isFactoryCreation;
|
|
13
|
-
exports.resetFactoryCreated = resetFactoryCreated;
|
|
14
|
-
const joist_utils_1 = require("joist-utils");
|
|
15
|
-
const Entity_1 = require("./Entity");
|
|
16
|
-
const EntityManager_1 = require("./EntityManager");
|
|
17
|
-
const EntityMetadata_1 = require("./EntityMetadata");
|
|
18
|
-
const defaults_1 = require("./defaults");
|
|
19
|
-
const keys_1 = require("./keys");
|
|
20
|
-
const FactoryLogger_1 = require("./logging/FactoryLogger");
|
|
21
|
-
const temporal_1 = require("./temporal");
|
|
22
|
-
const utils_1 = require("./utils");
|
|
23
|
-
let logger = undefined;
|
|
24
|
-
// Maybe we should scope this per-em, but assuming tests are single-threaded for now
|
|
25
|
-
let factoryCreated = new WeakSet();
|
|
26
|
-
// Chosen b/c it's a monday https://www.timeanddate.com/calendar/monthly.html?year=2018&month=1&country=1
|
|
27
|
-
const jan1 = new Date(2018, 0, 1);
|
|
28
|
-
exports.testDate = jan1;
|
|
29
|
-
const Temporal = (0, temporal_1.maybeRequireTemporal)()?.Temporal;
|
|
30
|
-
exports.testPlainDate = Temporal?.PlainDate.from("2018-01-01");
|
|
31
|
-
exports.testPlainDateTime = exports.testPlainDate?.toPlainDateTime("00:00:00");
|
|
32
|
-
exports.testZonedDateTime = exports.testPlainDate?.toZonedDateTime("UTC");
|
|
33
|
-
const knownUseKeys = ["use", "useLogging", "useExistingCheck", "useFactoryDefaults"];
|
|
34
|
-
/**
|
|
35
|
-
* Creates a test instance of `T`.
|
|
36
|
-
*
|
|
37
|
-
* If the factory code passes factoryOpts.useExisting, they can "intercept" the `em.create`
|
|
38
|
-
* to try and resolve "already created" / singleton instances. The `useExisting` callback is
|
|
39
|
-
* useful b/c the `opts` will be the "resolved-to-entity" opts, and not the raw "maybe object
|
|
40
|
-
* literal, maybe object instance" opts that tests pass into the factory.
|
|
41
|
-
*/
|
|
42
|
-
function newTestInstance(em, cstr,
|
|
43
|
-
/** The test's test-specific override opts. */
|
|
44
|
-
testOpts = {},
|
|
45
|
-
/** The factory file's default opts. */
|
|
46
|
-
factoryOpts = {}) {
|
|
47
|
-
// The first factory that is asked to debug, without one in place, will create+unset the logger.
|
|
48
|
-
let ownsTheLogger = !logger && testOpts.useLogging;
|
|
49
|
-
if (ownsTheLogger)
|
|
50
|
-
logger = new FactoryLogger_1.FactoryLogger();
|
|
51
|
-
logger?.logCreating(cstr);
|
|
52
|
-
logger?.indent();
|
|
53
|
-
const meta = (0, EntityMetadata_1.getMetadata)(cstr);
|
|
54
|
-
const opts = mergeOpts(meta, testOpts, factoryOpts);
|
|
55
|
-
const use = getOrCreateUseMap(opts);
|
|
56
|
-
const selfFields = [];
|
|
57
|
-
// Create just the primitive and m2o fields 1st, so we can create a minimal/valid
|
|
58
|
-
// instance of the entity. We'll do the o2m/other fields as a second pass.
|
|
59
|
-
const initialOpts = Object.values(meta.allFields)
|
|
60
|
-
.map((field) => {
|
|
61
|
-
const { fieldName } = field;
|
|
62
|
-
// Don't fill in required fields if told not to
|
|
63
|
-
const ignoreAllDefaults = "useFactoryDefaults" in opts && opts.useFactoryDefaults === "none";
|
|
64
|
-
// If the field has a default value, don't force fill it, even if passed `author: undefined`
|
|
65
|
-
const required = field.required && !ignoreAllDefaults && !(0, defaults_1.hasDefaultValue)(meta, fieldName);
|
|
66
|
-
// Use the opts value if they passed one in
|
|
67
|
-
if (fieldName in opts && opts[fieldName] !== defaultValueMarker) {
|
|
68
|
-
const optValue = opts[fieldName];
|
|
69
|
-
// We don't explicitly support null (callers should pass undefined), but we accept it
|
|
70
|
-
// because the factory might have done `const { author, ... } = opts` and is accidentally
|
|
71
|
-
// passing an `author: undefined` without meaning too.
|
|
72
|
-
const shouldRespectUndefined = !required;
|
|
73
|
-
if (optValue === null || (optValue === undefined && shouldRespectUndefined)) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
switch (field.kind) {
|
|
77
|
-
case "m2o":
|
|
78
|
-
case "poly":
|
|
79
|
-
return [fieldName, resolveFactoryOpt(em, opts, field, optValue, undefined, undefined)];
|
|
80
|
-
case "o2o":
|
|
81
|
-
case "o2m":
|
|
82
|
-
case "m2m":
|
|
83
|
-
// We do these in the 2nd pass after `entity` exists (see additionalOpts)
|
|
84
|
-
return [];
|
|
85
|
-
case "lo2m":
|
|
86
|
-
// If a child is passing themselves into a parent that is a large collection, just ignore it
|
|
87
|
-
return [];
|
|
88
|
-
case "primitive":
|
|
89
|
-
case "enum":
|
|
90
|
-
case "primaryKey":
|
|
91
|
-
// Look for strings that want to use the test index
|
|
92
|
-
if (typeof optValue === "string" && optValue.includes(testIndexString)) {
|
|
93
|
-
const actualIndex = getTestIndex(em, meta.cstr);
|
|
94
|
-
const value = optValue.replace(testIndexString, String(actualIndex));
|
|
95
|
-
return [fieldName, value];
|
|
96
|
-
}
|
|
97
|
-
else if (typeof optValue === "number" && optValue === exports.testIndex) {
|
|
98
|
-
const actualIndex = getTestIndex(em, meta.cstr);
|
|
99
|
-
return [fieldName, actualIndex];
|
|
100
|
-
}
|
|
101
|
-
// Otherwise just use the user's opt value as-is
|
|
102
|
-
return [fieldName, optValue];
|
|
103
|
-
default:
|
|
104
|
-
return (0, utils_1.assertNever)(field);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (field.kind === "primitive" &&
|
|
108
|
-
(required || opts[fieldName] === defaultValueMarker) &&
|
|
109
|
-
!field.derived &&
|
|
110
|
-
!field.protected) {
|
|
111
|
-
return [fieldName, defaultValueForField(em, cstr, field)];
|
|
112
|
-
}
|
|
113
|
-
else if (field.kind === "m2o" && !field.derived) {
|
|
114
|
-
// If neither the user nor the factory (i.e. for an explicit "fan out" case) set this field,
|
|
115
|
-
// then look in `use` and for an "obvious" there-is-only-one default (even for optional fields)
|
|
116
|
-
const [existing, loggerKey] = getObviousDefault(em, field.otherMetadata(), use);
|
|
117
|
-
// If this is a m2o pointing to an o2o, i.e. that as a unique constraint, make sure the
|
|
118
|
-
// existing entity we found isn't already claimed
|
|
119
|
-
const isUniqueAndAlreadyUsed = existing &&
|
|
120
|
-
(0, EntityMetadata_1.isOneToOneField)(field.otherMetadata().allFields[field.otherFieldName]) &&
|
|
121
|
-
existing[field.otherFieldName].isLoaded &&
|
|
122
|
-
existing[field.otherFieldName].isSet;
|
|
123
|
-
if (existing && !isUniqueAndAlreadyUsed && !ignoreAllDefaults) {
|
|
124
|
-
logger?.[loggerKey](fieldName, existing);
|
|
125
|
-
return [fieldName, existing];
|
|
126
|
-
}
|
|
127
|
-
// Otherwise, only make a new entity only if the field is required
|
|
128
|
-
if (required) {
|
|
129
|
-
// ...unless this is a self-referential key, in which case avoid infinite looping.
|
|
130
|
-
if (field.otherMetadata() === meta) {
|
|
131
|
-
selfFields.push(fieldName);
|
|
132
|
-
return [];
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
return [fieldName, resolveFactoryOpt(em, opts, field, undefined, undefined, undefined)];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else if (field.kind === "enum" && required && !field.derived) {
|
|
140
|
-
return [fieldName, field.enumDetailType.getValues()[0]];
|
|
141
|
-
}
|
|
142
|
-
else if (field.kind === "poly" && required) {
|
|
143
|
-
return [fieldName, resolveFactoryOpt(em, opts, field, undefined, undefined, undefined)];
|
|
144
|
-
}
|
|
145
|
-
return [];
|
|
146
|
-
})
|
|
147
|
-
.filter((t) => t.length > 0);
|
|
148
|
-
const createOpts = Object.fromEntries(initialOpts);
|
|
149
|
-
if (factoryOpts.useExisting && testOpts.useExistingCheck !== false) {
|
|
150
|
-
const existing = em.entities
|
|
151
|
-
.filter((e) => e instanceof meta.cstr)
|
|
152
|
-
.find((e) => factoryOpts.useExisting(createOpts, e));
|
|
153
|
-
if (existing) {
|
|
154
|
-
logger?.logFoundExisting(existing);
|
|
155
|
-
logger?.dedent();
|
|
156
|
-
if (ownsTheLogger)
|
|
157
|
-
logger = undefined;
|
|
158
|
-
return existing;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const entity = em.create(cstr, createOpts);
|
|
162
|
-
// Report this as factory-created until the next em.flush
|
|
163
|
-
factoryCreated.add(entity);
|
|
164
|
-
// If the type we just made doesn't exist in `use` yet, remember it. This works better than
|
|
165
|
-
// looking at the values in `fullOpts`, because instead of waiting until the end of the
|
|
166
|
-
// `build fullOpts` loop, we're also invoking `newTestInstance` as we go through the loop itself,
|
|
167
|
-
// creating each test instance within nested/recursive `newTestInstance` calls.
|
|
168
|
-
if (!use.has(entity.constructor) || use.get(entity.constructor)[1] === "diffBranch") {
|
|
169
|
-
addToUseMap(use, entity, "sameBranch");
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
// The `addToUseMap` does its own 'created & added to scope'
|
|
173
|
-
logger?.logCreated(entity);
|
|
174
|
-
}
|
|
175
|
-
// Now that we've got the entity, do a 2nd pass for o2m/m2m where we pass
|
|
176
|
-
// `{ parent: entity }` down to children (i.e. to replace our original
|
|
177
|
-
// null marker approach).
|
|
178
|
-
const additionalOpts = Object.entries(opts).map(([fieldName, optValue]) => {
|
|
179
|
-
const field = meta.allFields[fieldName];
|
|
180
|
-
// Look for `use` / etc
|
|
181
|
-
if (knownUseKeys.includes(fieldName))
|
|
182
|
-
return [];
|
|
183
|
-
if (!field) {
|
|
184
|
-
// Look for extra/derived fields
|
|
185
|
-
if (fieldName.startsWith("with")) {
|
|
186
|
-
const realName = fieldName[4].toLowerCase() + fieldName.substring(5);
|
|
187
|
-
const realField = meta.allFields[realName];
|
|
188
|
-
if (realField && "derived" in realField && realField.derived === "async") {
|
|
189
|
-
return [realName, new FactoryInitialValue(optValue)];
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
throw new Error(`Unknown field ${fieldName}`);
|
|
193
|
-
}
|
|
194
|
-
if (optValue === null || optValue === undefined)
|
|
195
|
-
return [];
|
|
196
|
-
if (field.kind === "o2m") {
|
|
197
|
-
// If this is a list of children, i.e. book.authors, handle partials to newTestInstance'd
|
|
198
|
-
return [
|
|
199
|
-
fieldName,
|
|
200
|
-
optValue.map((opt, i) => {
|
|
201
|
-
// console.log(`${field.fieldName}`, i);
|
|
202
|
-
return resolveFactoryOpt(em, withBranchMap(opts), field, opt, entity, i);
|
|
203
|
-
}),
|
|
204
|
-
];
|
|
205
|
-
}
|
|
206
|
-
else if (field.kind == "m2m") {
|
|
207
|
-
return [
|
|
208
|
-
fieldName,
|
|
209
|
-
optValue.map((opt, i) => resolveFactoryOpt(em, withBranchMap(opts), field, opt, [entity], i)),
|
|
210
|
-
];
|
|
211
|
-
}
|
|
212
|
-
else if (field.kind === "o2o") {
|
|
213
|
-
const otherField = field.otherMetadata().allFields[field.otherFieldName];
|
|
214
|
-
const isReactiveReference = "derived" in otherField && otherField.derived === "async";
|
|
215
|
-
if (isReactiveReference)
|
|
216
|
-
return [];
|
|
217
|
-
// If this is an o2o, i.e. author.image, just pass the optValue (i.e. it won't be a list)
|
|
218
|
-
return [fieldName, resolveFactoryOpt(em, opts, field, optValue, entity, undefined)];
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
return []; // Assume createOpts handled this
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
for (const fieldName of selfFields) {
|
|
225
|
-
additionalOpts.push([fieldName, entity]);
|
|
226
|
-
}
|
|
227
|
-
entity.set(Object.fromEntries(additionalOpts.filter((t) => t.length > 0)));
|
|
228
|
-
// em.create applied synchronous defaults automatically; since we're a factory with likely
|
|
229
|
-
// deeply-loaded instances, go ahead and synchronously invoke the async defaults, at least
|
|
230
|
-
// the ones that just use load hints + a synchronous lambda.
|
|
231
|
-
// (...would be nice to log these in the setFactoryLogging output)
|
|
232
|
-
(0, defaults_1.setAsyncDefaultsSynchronously)(em.ctx, entity);
|
|
233
|
-
// Set it back to undefined
|
|
234
|
-
logger?.dedent();
|
|
235
|
-
if (ownsTheLogger)
|
|
236
|
-
logger = undefined;
|
|
237
|
-
return entity;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Resolves a `FactoryEntityOpt` (i.e. maybe an existing entity, maybe an id, maybe a hash of opts) to an entity.
|
|
241
|
-
*
|
|
242
|
-
* If `opt` is `undefined`, then the usual factory semantics of "check use", "look for only one instance" are
|
|
243
|
-
* checked before finally creating a brand new entity.
|
|
244
|
-
*
|
|
245
|
-
* We also accept an optional `otherFieldName` so that, if we do create a new entity, we pass along the null
|
|
246
|
-
* marker for them to know not to create their own version of us.
|
|
247
|
-
*
|
|
248
|
-
* (This was originally intended to be a public API, but the use case ended up being handled
|
|
249
|
-
* by the more-ergonomic `maybeNew` feature; we could explore making this public if another
|
|
250
|
-
* similar use case comes up in the future.)
|
|
251
|
-
*/
|
|
252
|
-
function resolveFactoryOpt(em, opts, field, opt, maybeEntity, fieldIndex) {
|
|
253
|
-
const use = getOrCreateUseMap(opts);
|
|
254
|
-
const { meta, otherFieldName } = metaFromFieldAndOpt(field, opt);
|
|
255
|
-
// const meta = field.kind === "poly" ? field.components[0].otherMetadata() : field.otherMetadata();
|
|
256
|
-
// const otherFieldName = field.kind === "poly" ? field.components[0].otherFieldName : field.otherFieldName;
|
|
257
|
-
const fieldWithIndex = `${field.fieldName}${fieldIndex !== undefined ? `[${fieldIndex}]` : ""}`;
|
|
258
|
-
if ((0, Entity_1.isEntity)(opt)) {
|
|
259
|
-
logger?.logFoundOpt(fieldWithIndex, opt);
|
|
260
|
-
return opt;
|
|
261
|
-
}
|
|
262
|
-
else if ((0, EntityManager_1.isId)(opt)) {
|
|
263
|
-
// Try finding the entity in the UoW, otherwise fallback on just setting it as the id (which we support that now)
|
|
264
|
-
const found = em.entities.find((e) => e.idTaggedMaybe === opt || getTestId(em, e) === opt) || opt;
|
|
265
|
-
logger?.logFoundOpt(fieldWithIndex, found);
|
|
266
|
-
return found;
|
|
267
|
-
}
|
|
268
|
-
else if (opt && !(0, joist_utils_1.isPlainObject)(opt) && !(opt instanceof MaybeNew)) {
|
|
269
|
-
// If opt isn't a POJO, assume this is a completely-custom factory
|
|
270
|
-
logger?.logNotFoundAndCreating(fieldWithIndex, meta);
|
|
271
|
-
return meta.factory(em, opt);
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
// Look for an obvious default
|
|
275
|
-
if (opt === undefined || opt instanceof MaybeNew) {
|
|
276
|
-
if (field.kind === "poly" ||
|
|
277
|
-
(field.otherMetadata().subTypes.length > 0 && opt instanceof MaybeNew && opt.polyRefPreferredOrder.length > 0)) {
|
|
278
|
-
// We have a polymorphic maybeNew to sort through
|
|
279
|
-
const [existing, loggerKey] = (opt instanceof MaybeNew
|
|
280
|
-
? opt.polyRefPreferredOrder.map((cstr) => (0, EntityMetadata_1.getMetadata)(cstr))
|
|
281
|
-
: field.kind === "poly"
|
|
282
|
-
? field.components.map((c) => c.otherMetadata())
|
|
283
|
-
: [meta])
|
|
284
|
-
.map((meta) => getObviousDefault(em, meta, use))
|
|
285
|
-
.find((existing) => !!existing[0]) || [undefined, undefined];
|
|
286
|
-
if (existing) {
|
|
287
|
-
logger?.[loggerKey](fieldWithIndex, existing);
|
|
288
|
-
return existing;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
// Otherwise fall though to making a new entity via the factory
|
|
293
|
-
const [existing, loggerKey] = getObviousDefault(em, meta, use);
|
|
294
|
-
if (existing) {
|
|
295
|
-
logger?.[loggerKey](fieldWithIndex, existing);
|
|
296
|
-
return existing;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
// If this is image.author (m2o) but the other-side is an o2o, pass null instead of []
|
|
301
|
-
maybeEntity ??= (meta.allFields[otherFieldName].kind === "o2o" ? null : []);
|
|
302
|
-
logger?.logNotFoundAndCreating(fieldWithIndex, meta);
|
|
303
|
-
return meta.factory(em, {
|
|
304
|
-
// Because of the `!isPlainObject` above, opt will either be undefined or an object here
|
|
305
|
-
...applyUse(opt || {}, use, meta),
|
|
306
|
-
...(opt instanceof MaybeNew && opt.opts),
|
|
307
|
-
[otherFieldName]: maybeEntity,
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
/** Determines the metadata and otherFieldName to use in resolveFactoryOpt to account for polymorphic fields */
|
|
312
|
-
function metaFromFieldAndOpt(field, opt) {
|
|
313
|
-
if (field.kind === "poly") {
|
|
314
|
-
let componentToUse =
|
|
315
|
-
// Otherwise, we check if the `opt` specifies a particular component to use, and if not fall back to the first one
|
|
316
|
-
field.components.find((component) => opt instanceof MaybeNew &&
|
|
317
|
-
(0, EntityMetadata_1.getBaseSelfAndSubMetas)(component.otherMetadata())
|
|
318
|
-
.map((m) => m.cstr)
|
|
319
|
-
.includes(opt.polyRefPreferredOrder[0])) ?? field.components[0];
|
|
320
|
-
return { meta: componentToUse.otherMetadata(), otherFieldName: componentToUse.otherFieldName };
|
|
321
|
-
}
|
|
322
|
-
else if (field.otherMetadata().subTypes.length > 0 &&
|
|
323
|
-
opt instanceof MaybeNew &&
|
|
324
|
-
opt.polyRefPreferredOrder.length > 0) {
|
|
325
|
-
const otherMeta = field.otherMetadata();
|
|
326
|
-
const types = (0, EntityMetadata_1.getBaseSelfAndSubMetas)(otherMeta);
|
|
327
|
-
const typeToUse = types.find((subType) => subType.cstr === opt.polyRefPreferredOrder[0]) ?? otherMeta;
|
|
328
|
-
return { meta: typeToUse, otherFieldName: field.otherFieldName };
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
// If it isn't a poly field, then the field itself can tell us everything we need to know
|
|
332
|
-
return { meta: field.otherMetadata(), otherFieldName: field.otherFieldName };
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
/** We look for `use`-cached entities, which are either those we created, or had "if-only-one" defaults. */
|
|
336
|
-
function getObviousDefault(em, metadata, use) {
|
|
337
|
-
if (use.has(metadata.cstr)) {
|
|
338
|
-
return [use.get(metadata.cstr)[0], "logFoundInUseMap"];
|
|
339
|
-
}
|
|
340
|
-
// If there is a single existing instance of this type, assume the caller is fine with that.
|
|
341
|
-
// ...in theory seeding our `use` map with the only-one entities was supposed to prevent the
|
|
342
|
-
// need for doing this (the entities would already be in the use map that we just checked),
|
|
343
|
-
// but that approach doesn't catch created-as-side-effect entities.
|
|
344
|
-
const existing = em.getEntities(metadata.cstr);
|
|
345
|
-
if (existing.length === 1) {
|
|
346
|
-
return [existing[0], "logFoundSingleEntity"];
|
|
347
|
-
}
|
|
348
|
-
return [undefined, undefined];
|
|
349
|
-
}
|
|
350
|
-
// When a factory is called, i.e. `newAuthor`, opts will:
|
|
351
|
-
//
|
|
352
|
-
// - Have values explicitly passed by the user/other factories
|
|
353
|
-
// - Have values from the user's explicit `use` parameter
|
|
354
|
-
// - NOT have guessed (i.e. "only existing entity") or an implicitly-created `use` parameter
|
|
355
|
-
//
|
|
356
|
-
// This allows the factory to "fan out" by default, i.e. newInternalUser creating its own User
|
|
357
|
-
// and Market creating its own ProductAttribute, which originally we couldn't do when
|
|
358
|
-
// guessed/implicit opts were passed directly to `newAuthor`.
|
|
359
|
-
//
|
|
360
|
-
// Now, if the `newAuthor` factory doesn't explicitly "fan out" (by passing `user: {}` to
|
|
361
|
-
// `newTestInstance`), we still "fan in" by having `newTestInstance` sneak in the guessed/implicit
|
|
362
|
-
// opts of only-one-existing or factory-created instances.
|
|
363
|
-
/** Given we're going to call a factory, make sure any `use`s are put into `opts`. */
|
|
364
|
-
function applyUse(optsMaybeNew, use, metadata) {
|
|
365
|
-
const opts = optsMaybeNew instanceof MaybeNew ? optsMaybeNew.opts : optsMaybeNew;
|
|
366
|
-
// Find any unset fields
|
|
367
|
-
Object.values(metadata.fields)
|
|
368
|
-
.filter((f) => !(f.fieldName in opts))
|
|
369
|
-
.forEach((f) => {
|
|
370
|
-
// And set them to the current `use` entity for their type, if it exists
|
|
371
|
-
if ((((0, EntityMetadata_1.isManyToOneField)(f) && !f.derived) || (0, EntityMetadata_1.isOneToOneField)(f)) && use.has(f.otherMetadata().cstr)) {
|
|
372
|
-
const def = use.get(f.otherMetadata().cstr);
|
|
373
|
-
// Only pass explicit/user-defined `use` entities, so that factories can "fan out" if they want,
|
|
374
|
-
// and not see other factory-created entities look like user-specific values.
|
|
375
|
-
if (def[1] === "useOpt") {
|
|
376
|
-
opts[f.fieldName] = def[0];
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
// Make a copy so that we don't leak `use` onto opts that tests might later use in assertions.
|
|
381
|
-
return { ...opts, use };
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* A marker value for later replacement with the test instance's "unique-ish" index.
|
|
385
|
-
*
|
|
386
|
-
* This is meant to just be a helpful identifier in fields like entity names/descriptions for
|
|
387
|
-
* debugging purposes.
|
|
388
|
-
*/
|
|
389
|
-
exports.testIndex = -1_111_111_222;
|
|
390
|
-
const testIndexString = String(exports.testIndex);
|
|
391
|
-
const defaultValueMarker = {};
|
|
392
|
-
const branchValueSym = Symbol("branchValue");
|
|
393
|
-
/**
|
|
394
|
-
* A marker value for the default `newTestInstance` behavior.
|
|
395
|
-
*
|
|
396
|
-
* Useful for passing arguments to `newTestInstance` where you sometimes want to
|
|
397
|
-
* provide a specific value, and other times ask for the "pick a default" behavior
|
|
398
|
-
* (i.e. you don't want to pass `undefined` b/c that means explicitly "leave this
|
|
399
|
-
* key unset").
|
|
400
|
-
*
|
|
401
|
-
* Note that this is a function so that we can infer the return type as basically
|
|
402
|
-
* `any` without really using `any` (which would disable type-checking in the rest
|
|
403
|
-
* of the expression).
|
|
404
|
-
*/
|
|
405
|
-
function defaultValue() {
|
|
406
|
-
return defaultValueMarker;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* A marker value to never set a field, even if it's required.
|
|
410
|
-
*
|
|
411
|
-
* The factories treat `{ author: undefined }` as "still set the author", because of how easy
|
|
412
|
-
* it is for destructuring/restructuring opts to implicitly set `undefined` values.
|
|
413
|
-
*
|
|
414
|
-
* If you want to force a field to not be set, you can use `{ author: noValue() }`.
|
|
415
|
-
*/
|
|
416
|
-
function noValue() {
|
|
417
|
-
return null;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* A marker value to accept values only if explicitly created-or-passed within the current,
|
|
421
|
-
* unique "branch" of a factory call.
|
|
422
|
-
*
|
|
423
|
-
* This is useful for "diamond-shape" entity models like:
|
|
424
|
-
*
|
|
425
|
-
* ```
|
|
426
|
-
* ParentGroup <-- ParentItem
|
|
427
|
-
* | |
|
|
428
|
-
* ChildGroup <-- ChildItem
|
|
429
|
-
* ```
|
|
430
|
-
*
|
|
431
|
-
* Where it's important that the `ChildItem -> ParentItem -> ParentGroup` path matches
|
|
432
|
-
* the `ChildItem -> ChildGroup -> ParentGroup` path.
|
|
433
|
-
*
|
|
434
|
-
* This can be hard to achieve in normal factory behavior, i.e. for a call like:
|
|
435
|
-
*
|
|
436
|
-
* ```ts
|
|
437
|
-
* const c = newChild(em, {
|
|
438
|
-
* groups: [
|
|
439
|
-
* { childItems: [{}, {}] },
|
|
440
|
-
* { childItems: [{}, {}] },
|
|
441
|
-
* ],
|
|
442
|
-
* });
|
|
443
|
-
* ```
|
|
444
|
-
*
|
|
445
|
-
* The first `ChildGroup` will create a new `ParentGroup` that is used by everything, which
|
|
446
|
-
* is not our intent, as both `ChildGroup`s, and all four `ParentItem`s, will live in a single
|
|
447
|
-
* `ParentGroup`.
|
|
448
|
-
*
|
|
449
|
-
* An initial idea is to pass `parentGroup: {}` in the factories, because that turns off "reusing
|
|
450
|
-
* existing instances", but for this problem the `{}` approach is "too good" at creating new
|
|
451
|
-
* instances, b/c the above diamond pattern will be disconnected.
|
|
452
|
-
*
|
|
453
|
-
* So `branchValue` provides a middle ground, where _usually_ it will be a new entity, unless
|
|
454
|
-
* it was explicitly created within the same "branch" of a factory call.
|
|
455
|
-
*/
|
|
456
|
-
function maybeBranchValue(opts) {
|
|
457
|
-
// opts get mutated, so we have to return a new value
|
|
458
|
-
return { [branchValueSym]: true, ...(opts ? opts : undefined) };
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Allows a factory to declare that an optional relation should be filled in with an
|
|
462
|
-
* "obvious default", or a new entity if one doesn't exist.
|
|
463
|
-
*
|
|
464
|
-
* This "obvious default or new entity" is what Joist already does for _required_ relations,
|
|
465
|
-
* and so `maybeNew` lets the factory tell Joist to apply the same behavior to an optional
|
|
466
|
-
* field.
|
|
467
|
-
*
|
|
468
|
-
* I.e.:
|
|
469
|
-
*
|
|
470
|
-
* ```typescript
|
|
471
|
-
* export function newAuthor(em: Entity, opts: FactoryOpts<Author>) {
|
|
472
|
-
* return newTestInstance(em, Author, {
|
|
473
|
-
* // this always make a new publisher, unless explicitly overridden by the test,
|
|
474
|
-
* // i.e. when each author really needs "their own" publisher.
|
|
475
|
-
* publisher: {},
|
|
476
|
-
* // this will make a new publisher but first looks for "good defaults" in the
|
|
477
|
-
* // test, i.e. an already-created publisher. This is the default behavior of
|
|
478
|
-
* // required fields ("look for a good default"), and `maybeNew` lets you tell
|
|
479
|
-
* // Joist to invoke that same "maybe new" behavior for an optional field.
|
|
480
|
-
* publisher: maybeNew<Publisher>({}),
|
|
481
|
-
* ...opts,
|
|
482
|
-
* });
|
|
483
|
-
* }
|
|
484
|
-
* ```
|
|
485
|
-
*/
|
|
486
|
-
function maybeNew(opts) {
|
|
487
|
-
// Return a marker that resolveFactoryOpt will look for
|
|
488
|
-
return new MaybeNew((opts || {}));
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Similar to `maybeNew` in behaviour/use but with enhancements to support polymorphic fields:
|
|
492
|
-
* 1) Allows you to specify which entity type to create, if it is found a new one is needed
|
|
493
|
-
* 2) Allows you to prioritize which existing entities to select
|
|
494
|
-
*
|
|
495
|
-
* For example below, we are specifying that an Author should be created if needed (and optionally it's default opts
|
|
496
|
-
* in the `ifNewOpts` field), and also that the priority order for choosing existing entities is Author, Book, and then Publisher.
|
|
497
|
-
* Note since BookReview is excluded from `existingSearchOrder`, an existing BookReview will never be chosen.
|
|
498
|
-
*
|
|
499
|
-
* ```typescript
|
|
500
|
-
* export function newComment(em: EntityManager, opts: FactoryOpts<Comment> = {}): New<Comment> {
|
|
501
|
-
* return newTestInstance(em, Comment, {
|
|
502
|
-
* parent: maybeNewPoly<CommentParent, Author>(
|
|
503
|
-
* Author, {
|
|
504
|
-
* ifNewOpts: { firstName: "optional"},
|
|
505
|
-
* existingSearchOrder: [Author, Book, Publisher]
|
|
506
|
-
* }),
|
|
507
|
-
* ...opts,
|
|
508
|
-
* });
|
|
509
|
-
* }
|
|
510
|
-
* ```
|
|
511
|
-
*/
|
|
512
|
-
function maybeNewPoly(ifNewCstr, opts) {
|
|
513
|
-
// Return a marker that resolveFactoryOpt will look for
|
|
514
|
-
return new MaybeNew((opts?.ifNewOpts || {}), opts?.existingSearchOrder ?? [ifNewCstr]);
|
|
515
|
-
}
|
|
516
|
-
class MaybeNew {
|
|
517
|
-
opts;
|
|
518
|
-
polyRefPreferredOrder;
|
|
519
|
-
constructor(opts, polyRefPreferredOrder = []) {
|
|
520
|
-
this.opts = opts;
|
|
521
|
-
this.polyRefPreferredOrder = polyRefPreferredOrder;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Returns a unique-ish test index for putting in `name` fields.
|
|
526
|
-
*
|
|
527
|
-
* Note that `testIndex` is easier to just include in a string, because it doesn't require passing
|
|
528
|
-
* the `EntityManger` and `type`. But if a factory really wants the test index as a number, they can
|
|
529
|
-
* call this method.
|
|
530
|
-
*
|
|
531
|
-
* Despite the name, these are 1-based, i.e. the first `Author` is `a1`.
|
|
532
|
-
*/
|
|
533
|
-
function getTestIndex(em, type) {
|
|
534
|
-
const existing = em.getEntities(type);
|
|
535
|
-
return existing.length + 1;
|
|
536
|
-
}
|
|
537
|
-
/** Fakes a probably-right id for un-persisted entities. Solely used for quick lookups in tests/factories. */
|
|
538
|
-
function getTestId(em, entity) {
|
|
539
|
-
const meta = (0, EntityMetadata_1.getMetadata)(entity);
|
|
540
|
-
const sameType = em.getEntities(meta.cstr);
|
|
541
|
-
return (0, keys_1.tagId)(meta, String(sameType.indexOf(entity) + 1));
|
|
542
|
-
}
|
|
543
|
-
// We keep a local copy of `global.Date`, in case a faking library
|
|
544
|
-
// like @sinonjs/fake-timers is used and rewrites `global.Date` to
|
|
545
|
-
// their own `ClockDate`, which would make our `===` check below fail.
|
|
546
|
-
const globalDate = global.Date;
|
|
547
|
-
function defaultValueForField(em, cstr, field) {
|
|
548
|
-
if (field.serde.columns[0].isArray)
|
|
549
|
-
return [];
|
|
550
|
-
if (field.type === "string") {
|
|
551
|
-
if (field.fieldName === "name") {
|
|
552
|
-
return `${cstr.name} ${getTestIndex(em, cstr)}`;
|
|
553
|
-
}
|
|
554
|
-
return field.fieldName;
|
|
555
|
-
}
|
|
556
|
-
else if (field.type === "number") {
|
|
557
|
-
return 0;
|
|
558
|
-
}
|
|
559
|
-
else if (field.type === "bigint") {
|
|
560
|
-
return 0n;
|
|
561
|
-
}
|
|
562
|
-
else if (field.type === globalDate) {
|
|
563
|
-
return exports.testDate;
|
|
564
|
-
}
|
|
565
|
-
else if (field.type === "boolean") {
|
|
566
|
-
return false;
|
|
567
|
-
}
|
|
568
|
-
else if (Temporal) {
|
|
569
|
-
if (field.type === Temporal.PlainDate) {
|
|
570
|
-
return exports.testPlainDate;
|
|
571
|
-
}
|
|
572
|
-
else if (field.type === Temporal.PlainDateTime) {
|
|
573
|
-
return exports.testPlainDateTime;
|
|
574
|
-
}
|
|
575
|
-
else if (field.type === Temporal.ZonedDateTime) {
|
|
576
|
-
return exports.testZonedDateTime;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
return null;
|
|
580
|
-
}
|
|
581
|
-
// Do a one-time conversion of the user's `use` array into a map for internal use, which we'll
|
|
582
|
-
// then re-use across all `newTestInstance` calls within a given `new<Entity>` call.
|
|
583
|
-
function getOrCreateUseMap(opts) {
|
|
584
|
-
const use = opts.use;
|
|
585
|
-
let map;
|
|
586
|
-
if (use instanceof Map) {
|
|
587
|
-
// it's already a map
|
|
588
|
-
map = use;
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
map = new Map();
|
|
592
|
-
if (use instanceof Array) {
|
|
593
|
-
// it's a top-level `newAuthor` with a user-passed `use: array`
|
|
594
|
-
use.forEach((e) => addToUseMap(map, e, "useOpt"));
|
|
595
|
-
}
|
|
596
|
-
else if (use) {
|
|
597
|
-
// it's a top-level `newAuthor` w/o a `use: entity` param
|
|
598
|
-
addToUseMap(map, use, "useOpt");
|
|
599
|
-
}
|
|
600
|
-
// Scan opts for entities to add to the map, i.e. if the user calls `newAuthor(em, { book: b1 })`,
|
|
601
|
-
// we'll use `b1` for any other books we might happen to create.
|
|
602
|
-
const todo = [opts];
|
|
603
|
-
while (todo.length > 0) {
|
|
604
|
-
const opts = todo.pop();
|
|
605
|
-
for (const opt of Object.values(opts || {})) {
|
|
606
|
-
if ((0, Entity_1.isEntity)(opt) && !map.has(opt.constructor)) {
|
|
607
|
-
addToUseMap(map, opt, "testOpts");
|
|
608
|
-
}
|
|
609
|
-
else if (opt instanceof Array) {
|
|
610
|
-
// Push the array as-is, because it will be `Object.value`-d on the next iteration
|
|
611
|
-
todo.push(opt);
|
|
612
|
-
}
|
|
613
|
-
else if ((0, joist_utils_1.isPlainObject)(opt)) {
|
|
614
|
-
todo.push(opt);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
// Store our potentially-massaged map back into opts i.e. in case resolveFactoryOpt needs it.
|
|
620
|
-
// Use as any b/c UseMap is our internal impl detail and not public.
|
|
621
|
-
opts.use = map;
|
|
622
|
-
return map;
|
|
623
|
-
}
|
|
624
|
-
// If e is a subtype like SmallPublisher, register it for the base Publisher as well
|
|
625
|
-
function addToUseMap(map, e, source) {
|
|
626
|
-
logger?.logAddToUseMap(e, source);
|
|
627
|
-
const meta = (0, EntityMetadata_1.getMetadata)(e);
|
|
628
|
-
if (meta.baseType || meta.subTypes.length) {
|
|
629
|
-
(0, EntityMetadata_1.getBaseAndSelfMetas)(meta).forEach((m) => {
|
|
630
|
-
// console.log(`Putting ${e.toString()} into ${objectId(map)} as ${source}`);
|
|
631
|
-
map.set(m.cstr, [e, source]);
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
// console.log(`Putting ${e.toString()} into ${objectId(map)} as ${source}`);
|
|
636
|
-
map.set(meta.cstr, [e, source]);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
/** Merge the factory's opts and the test's opts so that `{ age: 40 }` and `{ firstName: "b1" }` get merged. */
|
|
640
|
-
function mergeOpts(meta, testOpts, factoryOpts) {
|
|
641
|
-
// Merge the factory's opts and the test's opts so that `{ age: 40 }` and `{ firstName: "b1" }` get merged
|
|
642
|
-
if (testOpts.useFactoryDefaults === false || testOpts.useFactoryDefaults === "none") {
|
|
643
|
-
return testOpts;
|
|
644
|
-
}
|
|
645
|
-
const opts = { ...testOpts };
|
|
646
|
-
Object.entries(factoryOpts).forEach(([key, factoryValue]) => {
|
|
647
|
-
// Skip special opts
|
|
648
|
-
if (key === "useExisting")
|
|
649
|
-
return;
|
|
650
|
-
const testValue = testOpts[key];
|
|
651
|
-
if (testOpts[key] === undefined) {
|
|
652
|
-
// If the test doesn't define an opt, we have nothing to merge...unless
|
|
653
|
-
// they literally passed `foo: undefined`, in which case they win.
|
|
654
|
-
if (!(key in testOpts)) {
|
|
655
|
-
opts[key] = factoryValue;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
else if ((0, joist_utils_1.isPlainObject)(factoryValue) && (0, joist_utils_1.isPlainObject)(testValue)) {
|
|
659
|
-
// Should this deep merge? Probably?
|
|
660
|
-
opts[key] = mergeOpts(meta, testValue, factoryValue);
|
|
661
|
-
}
|
|
662
|
-
else if (factoryValue instanceof MaybeNew && (0, joist_utils_1.isPlainObject)(testValue)) {
|
|
663
|
-
opts[key] = mergeOpts(meta, testValue, factoryValue.opts);
|
|
664
|
-
}
|
|
665
|
-
else if (factoryValue instanceof MaybeNew && testValue instanceof MaybeNew) {
|
|
666
|
-
opts[key] = new MaybeNew(mergeOpts(meta, testValue.opts, factoryValue.opts), testValue.polyRefPreferredOrder ?? factoryValue.polyRefPreferredOrder);
|
|
667
|
-
}
|
|
668
|
-
// This seemed like a good idea
|
|
669
|
-
if (opts[key]?.[branchValueSym]) {
|
|
670
|
-
const field = meta.allFields[key];
|
|
671
|
-
if (field.kind === "m2o") {
|
|
672
|
-
const use = testOpts.use;
|
|
673
|
-
const inTree = use?.get(field.otherMetadata().cstr);
|
|
674
|
-
if (inTree && (inTree[1] === "sameBranch" || inTree[1] === "testOpts")) {
|
|
675
|
-
// console.log(`Putting ${field.fieldName} to`, inTree[0]);
|
|
676
|
-
opts[key] = inTree[0];
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
else {
|
|
680
|
-
throw new Error(`branchValue is not implemented for ${field.kind}`);
|
|
681
|
-
}
|
|
682
|
-
delete opts[key]?.[branchValueSym];
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
return opts;
|
|
686
|
-
}
|
|
687
|
-
// As we branch out to children, going down the tree, give each branch its own playground of entities
|
|
688
|
-
function withBranchMap(opts) {
|
|
689
|
-
const oldMap = opts.use;
|
|
690
|
-
const newMap = new CopyMap(oldMap);
|
|
691
|
-
return { ...opts, use: newMap };
|
|
692
|
-
}
|
|
693
|
-
/** Writes new entities into our branch's map (this map), as well as the root we came from. */
|
|
694
|
-
class CopyMap extends Map {
|
|
695
|
-
root;
|
|
696
|
-
constructor(root) {
|
|
697
|
-
super(root);
|
|
698
|
-
this.root = root;
|
|
699
|
-
}
|
|
700
|
-
set(k, v) {
|
|
701
|
-
// Purposefully downgrade this to source=diffBranch so that it will not be used by `branchValue()`
|
|
702
|
-
// calls that override `{}`, but can still be used to in-fan, i.e. if making multiple books by
|
|
703
|
-
// default they get the same author.
|
|
704
|
-
// ...also use `root?` because the `super(root)` will call `set` while copying the other map
|
|
705
|
-
// but our `this.root` has not been set yet; which is fine, we want to ignore those anyway.
|
|
706
|
-
this.root?.set(k, [v[0], "diffBranch"]);
|
|
707
|
-
return super.set(k, v);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
// const objectId = (() => {
|
|
711
|
-
// let currentId = 0;
|
|
712
|
-
// const map = new WeakMap();
|
|
713
|
-
// return (object: object): number => {
|
|
714
|
-
// if (!map.has(object)) {
|
|
715
|
-
// map.set(object, ++currentId);
|
|
716
|
-
// }
|
|
717
|
-
// return map.get(object)!;
|
|
718
|
-
// };
|
|
719
|
-
// })();
|
|
720
|
-
/** Enables factory logging for all factories. */
|
|
721
|
-
function setFactoryLogging(enabled) {
|
|
722
|
-
logger = enabled ? new FactoryLogger_1.FactoryLogger() : undefined;
|
|
723
|
-
}
|
|
724
|
-
/** Marker for tests setting derived values during test setup. */
|
|
725
|
-
class FactoryInitialValue {
|
|
726
|
-
value;
|
|
727
|
-
constructor(value) {
|
|
728
|
-
this.value = value;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
exports.FactoryInitialValue = FactoryInitialValue;
|
|
732
|
-
function isFactoryCreation(entity) {
|
|
733
|
-
return factoryCreated.has(entity);
|
|
734
|
-
}
|
|
735
|
-
function resetFactoryCreated() {
|
|
736
|
-
factoryCreated = new WeakSet();
|
|
737
|
-
}
|
|
738
|
-
//# sourceMappingURL=newTestInstance.js.map
|