@expo/entity 0.40.0 → 0.42.0
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/AuthorizationResultBasedEntityAssociationLoader.d.ts +16 -16
- package/build/AuthorizationResultBasedEntityAssociationLoader.js +2 -4
- package/build/AuthorizationResultBasedEntityAssociationLoader.js.map +1 -1
- package/build/AuthorizationResultBasedEntityLoader.d.ts +39 -67
- package/build/AuthorizationResultBasedEntityLoader.js +85 -62
- package/build/AuthorizationResultBasedEntityLoader.js.map +1 -1
- package/build/AuthorizationResultBasedEntityMutator.d.ts +16 -16
- package/build/AuthorizationResultBasedEntityMutator.js.map +1 -1
- package/build/ComposedEntityCacheAdapter.d.ts +7 -6
- package/build/ComposedEntityCacheAdapter.js +28 -28
- package/build/ComposedEntityCacheAdapter.js.map +1 -1
- package/build/ComposedSecondaryEntityCache.d.ts +1 -1
- package/build/ComposedSecondaryEntityCache.js.map +1 -1
- package/build/EnforcingEntityAssociationLoader.d.ts +15 -15
- package/build/EnforcingEntityAssociationLoader.js.map +1 -1
- package/build/EnforcingEntityCreator.d.ts +2 -2
- package/build/EnforcingEntityDeleter.d.ts +2 -2
- package/build/EnforcingEntityLoader.d.ts +104 -18
- package/build/EnforcingEntityLoader.js +113 -12
- package/build/EnforcingEntityLoader.js.map +1 -1
- package/build/EnforcingEntityUpdater.d.ts +2 -2
- package/build/Entity.d.ts +32 -10
- package/build/Entity.js +41 -3
- package/build/Entity.js.map +1 -1
- package/build/EntityAssociationLoader.d.ts +3 -3
- package/build/EntityCompanion.d.ts +5 -5
- package/build/EntityCompanion.js.map +1 -1
- package/build/EntityCompanionProvider.d.ts +6 -6
- package/build/EntityCompanionProvider.js.map +1 -1
- package/build/EntityConfiguration.d.ts +46 -5
- package/build/EntityConfiguration.js +39 -1
- package/build/EntityConfiguration.js.map +1 -1
- package/build/EntityCreator.d.ts +4 -4
- package/build/EntityDatabaseAdapter.d.ts +15 -14
- package/build/EntityDatabaseAdapter.js +20 -12
- package/build/EntityDatabaseAdapter.js.map +1 -1
- package/build/EntityDeleter.d.ts +4 -4
- package/build/EntityFieldDefinition.d.ts +20 -10
- package/build/EntityFieldDefinition.js +3 -1
- package/build/EntityFieldDefinition.js.map +1 -1
- package/build/EntityFields.d.ts +14 -12
- package/build/EntityFields.js.map +1 -1
- package/build/EntityLoader.d.ts +5 -5
- package/build/EntityLoaderFactory.d.ts +3 -3
- package/build/EntityLoaderFactory.js.map +1 -1
- package/build/EntityLoaderUtils.d.ts +2 -2
- package/build/EntityLoaderUtils.js +27 -1
- package/build/EntityLoaderUtils.js.map +1 -1
- package/build/EntityMutationInfo.d.ts +2 -2
- package/build/EntityMutationTriggerConfiguration.d.ts +14 -14
- package/build/EntityMutationTriggerConfiguration.js.map +1 -1
- package/build/EntityMutationValidator.d.ts +2 -2
- package/build/EntityMutatorFactory.d.ts +5 -5
- package/build/EntityMutatorFactory.js.map +1 -1
- package/build/EntityPrivacyPolicy.d.ts +14 -14
- package/build/EntityPrivacyPolicy.js.map +1 -1
- package/build/EntitySecondaryCacheLoader.d.ts +4 -4
- package/build/EntityUpdater.d.ts +4 -4
- package/build/GenericEntityCacheAdapter.d.ts +7 -6
- package/build/GenericEntityCacheAdapter.js +13 -14
- package/build/GenericEntityCacheAdapter.js.map +1 -1
- package/build/GenericSecondaryEntityCache.d.ts +3 -3
- package/build/GenericSecondaryEntityCache.js.map +1 -1
- package/build/IEntityCacheAdapter.d.ts +17 -16
- package/build/IEntityCacheAdapterProvider.d.ts +1 -1
- package/build/IEntityDatabaseAdapterProvider.d.ts +1 -1
- package/build/IEntityGenericCacher.d.ts +15 -5
- package/build/ReadonlyEntity.d.ts +27 -8
- package/build/ReadonlyEntity.js +31 -3
- package/build/ReadonlyEntity.js.map +1 -1
- package/build/ViewerContext.d.ts +1 -1
- package/build/ViewerScopedEntityCompanion.d.ts +5 -5
- package/build/ViewerScopedEntityCompanionProvider.d.ts +1 -1
- package/build/ViewerScopedEntityLoaderFactory.d.ts +3 -3
- package/build/ViewerScopedEntityMutatorFactory.d.ts +5 -5
- package/build/entityUtils.d.ts +1 -1
- package/build/entityUtils.js.map +1 -1
- package/build/errors/EntityInvalidFieldValueError.d.ts +2 -2
- package/build/errors/EntityNotAuthorizedError.d.ts +1 -1
- package/build/errors/EntityNotFoundError.d.ts +2 -2
- package/build/index.d.ts +7 -7
- package/build/index.js +8 -13
- package/build/index.js.map +1 -1
- package/build/internal/CompositeFieldHolder.d.ts +48 -0
- package/build/internal/CompositeFieldHolder.js +116 -0
- package/build/internal/CompositeFieldHolder.js.map +1 -0
- package/build/internal/CompositeFieldValueMap.d.ts +15 -0
- package/build/internal/CompositeFieldValueMap.js +51 -0
- package/build/internal/CompositeFieldValueMap.js.map +1 -0
- package/build/internal/EntityDataManager.d.ts +16 -16
- package/build/internal/EntityDataManager.js +42 -45
- package/build/internal/EntityDataManager.js.map +1 -1
- package/build/internal/EntityFieldTransformationUtils.d.ts +5 -5
- package/build/internal/EntityFieldTransformationUtils.js.map +1 -1
- package/build/internal/EntityLoadInterfaces.d.ts +104 -0
- package/build/internal/EntityLoadInterfaces.js +25 -0
- package/build/internal/EntityLoadInterfaces.js.map +1 -0
- package/build/internal/EntityTableDataCoordinator.d.ts +6 -6
- package/build/internal/EntityTableDataCoordinator.js.map +1 -1
- package/build/internal/ReadThroughEntityCache.d.ts +17 -16
- package/build/internal/ReadThroughEntityCache.js +36 -36
- package/build/internal/ReadThroughEntityCache.js.map +1 -1
- package/build/internal/SingleFieldHolder.d.ts +34 -0
- package/build/internal/SingleFieldHolder.js +90 -0
- package/build/internal/SingleFieldHolder.js.map +1 -0
- package/build/metrics/EntityMetricsUtils.d.ts +2 -1
- package/build/metrics/EntityMetricsUtils.js.map +1 -1
- package/build/metrics/IEntityMetricsAdapter.d.ts +5 -0
- package/build/metrics/IEntityMetricsAdapter.js.map +1 -1
- package/build/rules/AlwaysAllowPrivacyPolicyRule.d.ts +2 -2
- package/build/rules/AlwaysAllowPrivacyPolicyRule.js.map +1 -1
- package/build/rules/AlwaysDenyPrivacyPolicyRule.d.ts +2 -2
- package/build/rules/AlwaysDenyPrivacyPolicyRule.js.map +1 -1
- package/build/rules/AlwaysSkipPrivacyPolicyRule.d.ts +2 -2
- package/build/rules/AlwaysSkipPrivacyPolicyRule.js.map +1 -1
- package/build/rules/PrivacyPolicyRule.d.ts +2 -2
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/build/utils/EntityPrivacyUtils.d.ts +4 -4
- package/build/utils/EntityPrivacyUtils.js.map +1 -1
- package/build/utils/collections/SerializableKeyMap.d.ts +27 -0
- package/build/utils/collections/SerializableKeyMap.js +60 -0
- package/build/utils/collections/SerializableKeyMap.js.map +1 -0
- package/build/utils/collections/maps.js +1 -2
- package/build/utils/collections/maps.js.map +1 -1
- package/build/utils/collections/sets.d.ts +1 -0
- package/build/utils/collections/sets.js +7 -0
- package/build/utils/collections/sets.js.map +1 -0
- package/build/utils/mergeEntityMutationTriggerConfigurations.d.ts +1 -1
- package/package.json +8 -5
- package/src/AuthorizationResultBasedEntityAssociationLoader.ts +58 -53
- package/src/AuthorizationResultBasedEntityLoader.ts +194 -81
- package/src/AuthorizationResultBasedEntityMutator.ts +71 -45
- package/src/ComposedEntityCacheAdapter.ts +55 -46
- package/src/ComposedSecondaryEntityCache.ts +5 -2
- package/src/EnforcingEntityAssociationLoader.ts +52 -44
- package/src/EnforcingEntityCreator.ts +5 -5
- package/src/EnforcingEntityDeleter.ts +5 -5
- package/src/EnforcingEntityLoader.ts +158 -21
- package/src/EnforcingEntityUpdater.ts +5 -5
- package/src/Entity.ts +185 -29
- package/src/EntityAssociationLoader.ts +6 -6
- package/src/EntityCompanion.ts +11 -11
- package/src/EntityCompanionProvider.ts +21 -18
- package/src/EntityConfiguration.ts +123 -9
- package/src/EntityCreator.ts +7 -7
- package/src/EntityDatabaseAdapter.ts +51 -28
- package/src/EntityDeleter.ts +7 -7
- package/src/EntityFieldDefinition.ts +32 -12
- package/src/EntityFields.ts +49 -12
- package/src/EntityLoader.ts +8 -8
- package/src/EntityLoaderFactory.ts +8 -8
- package/src/EntityLoaderUtils.ts +39 -10
- package/src/EntityMutationInfo.ts +6 -6
- package/src/EntityMutationTriggerConfiguration.ts +68 -20
- package/src/EntityMutationValidator.ts +4 -4
- package/src/EntityMutatorFactory.ts +13 -13
- package/src/EntityPrivacyPolicy.ts +50 -26
- package/src/EntitySecondaryCacheLoader.ts +6 -6
- package/src/EntityUpdater.ts +7 -7
- package/src/GenericEntityCacheAdapter.ts +39 -28
- package/src/GenericSecondaryEntityCache.ts +6 -3
- package/src/IEntityCacheAdapter.ts +45 -25
- package/src/IEntityCacheAdapterProvider.ts +3 -3
- package/src/IEntityDatabaseAdapterProvider.ts +3 -3
- package/src/IEntityGenericCacher.ts +33 -5
- package/src/ReadonlyEntity.ts +129 -16
- package/src/ViewerContext.ts +5 -5
- package/src/ViewerScopedEntityCompanion.ts +7 -7
- package/src/ViewerScopedEntityCompanionProvider.ts +6 -6
- package/src/ViewerScopedEntityLoaderFactory.ts +7 -7
- package/src/ViewerScopedEntityMutatorFactory.ts +8 -8
- package/src/__tests__/AuthorizationResultBasedEntityAssociationLoader-test.ts +41 -72
- package/src/__tests__/AuthorizationResultBasedEntityLoader-constructor-test.ts +14 -13
- package/src/__tests__/AuthorizationResultBasedEntityLoader-test.ts +367 -69
- package/src/__tests__/ComposedCacheAdapter-test.ts +235 -117
- package/src/__tests__/EnforcingEntityLoader-test.ts +135 -1
- package/src/__tests__/Entity-test.ts +64 -11
- package/src/__tests__/EntityAssociationLoader-test.ts +6 -8
- package/src/__tests__/EntityCommonUseCases-test.ts +25 -28
- package/src/__tests__/EntityCompanion-test.ts +4 -4
- package/src/__tests__/EntityCompanionProvider-test.ts +9 -8
- package/src/__tests__/EntityConfiguration-test.ts +85 -6
- package/src/__tests__/EntityDatabaseAdapter-test.ts +113 -17
- package/src/__tests__/EntityEdges-test.ts +135 -138
- package/src/__tests__/EntityFields-test.ts +2 -2
- package/src/__tests__/EntityLoader-test.ts +5 -7
- package/src/__tests__/EntityMutator-MutationCacheConsistency-test.ts +17 -19
- package/src/__tests__/EntityMutator-SingleCompositeFieldCacheConsistency-test.ts +73 -0
- package/src/__tests__/EntityMutator-test.ts +74 -46
- package/src/__tests__/EntityPrivacyPolicy-test.ts +51 -74
- package/src/__tests__/EntityQueryContext-test.ts +1 -1
- package/src/__tests__/EntitySecondaryCacheLoader-test.ts +9 -9
- package/src/__tests__/EntitySelfReferentialEdges-test.ts +119 -122
- package/src/__tests__/GenericEntityCacheAdapter-test.ts +83 -28
- package/src/__tests__/ReadonlyEntity-test.ts +49 -9
- package/src/__tests__/ViewerContext-test.ts +1 -1
- package/src/__tests__/ViewerScopedEntityCompanion-test.ts +5 -2
- package/src/__tests__/ViewerScopedEntityCompanionProvider-test.ts +1 -1
- package/src/__tests__/ViewerScopedEntityMutatorFactory-test.ts +12 -3
- package/src/__tests__/cases/TwoEntitySameTableDisjointRows-test.ts +25 -27
- package/src/__tests__/cases/TwoEntitySameTableOverlappingRows-test.ts +28 -34
- package/src/entityUtils.ts +4 -1
- package/src/errors/EntityInvalidFieldValueError.ts +5 -5
- package/src/errors/EntityNotAuthorizedError.ts +3 -3
- package/src/errors/EntityNotFoundError.ts +5 -5
- package/src/index.ts +7 -7
- package/src/internal/CompositeFieldHolder.ts +218 -0
- package/src/internal/CompositeFieldValueMap.ts +78 -0
- package/src/internal/EntityDataManager.ts +107 -96
- package/src/internal/EntityFieldTransformationUtils.ts +33 -14
- package/src/internal/EntityLoadInterfaces.ts +143 -0
- package/src/internal/EntityTableDataCoordinator.ts +8 -5
- package/src/internal/ReadThroughEntityCache.ts +63 -50
- package/src/internal/SingleFieldHolder.ts +131 -0
- package/src/internal/__tests__/CompositeFieldHolder-test.ts +25 -0
- package/src/internal/__tests__/CompositeFieldValueMap-test.ts +43 -0
- package/src/internal/__tests__/EntityDataManager-test.ts +308 -91
- package/src/internal/__tests__/EntityFieldTransformationUtils-test.ts +3 -2
- package/src/internal/__tests__/ReadThroughEntityCache-test.ts +315 -107
- package/src/metrics/EntityMetricsUtils.ts +7 -2
- package/src/metrics/IEntityMetricsAdapter.ts +6 -0
- package/src/rules/AlwaysAllowPrivacyPolicyRule.ts +5 -5
- package/src/rules/AlwaysDenyPrivacyPolicyRule.ts +5 -5
- package/src/rules/AlwaysSkipPrivacyPolicyRule.ts +5 -5
- package/src/rules/PrivacyPolicyRule.ts +4 -4
- package/src/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.ts +1 -1
- package/src/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.ts +1 -1
- package/src/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.ts +1 -1
- package/src/utils/EntityPrivacyUtils.ts +72 -30
- package/src/utils/{testing → __testfixtures__}/PrivacyPolicyRuleTestUtils.ts +26 -26
- package/src/{testfixtures → utils/__testfixtures__}/SimpleTestEntity.ts +16 -15
- package/src/utils/__testfixtures__/StubCacheAdapter.ts +164 -0
- package/src/utils/{testing → __testfixtures__}/StubDatabaseAdapter.ts +19 -12
- package/src/utils/{testing → __testfixtures__}/StubDatabaseAdapterProvider.ts +4 -4
- package/src/utils/__testfixtures__/TSMockitoExtensions.ts +69 -0
- package/src/{testfixtures → utils/__testfixtures__}/TestEntity.ts +21 -15
- package/src/{testfixtures → utils/__testfixtures__}/TestEntity2.ts +16 -15
- package/src/{testfixtures → utils/__testfixtures__}/TestEntityWithMutationTriggers.ts +23 -22
- package/src/{testfixtures → utils/__testfixtures__}/TestViewerContext.ts +1 -1
- package/src/utils/{testing → __testfixtures__}/describeFieldTestCase.ts +1 -1
- package/src/utils/__tests__/EntityPrivacyUtils-test.ts +81 -113
- package/src/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.ts +31 -30
- package/src/utils/__tests__/mergeEntityMutationTriggerConfigurations-test.ts +1 -1
- package/src/utils/collections/SerializableKeyMap.ts +84 -0
- package/src/utils/collections/__tests__/SerializableKeyMap-test.ts +119 -0
- package/src/utils/collections/__tests__/sets-test.ts +17 -0
- package/src/utils/collections/maps.ts +7 -8
- package/src/utils/collections/sets.ts +3 -0
- package/src/utils/mergeEntityMutationTriggerConfigurations.ts +5 -5
- package/build/__tests__/AuthorizationResultBasedEntityAssociationLoader-test.d.ts +0 -1
- package/build/__tests__/AuthorizationResultBasedEntityAssociationLoader-test.js +0 -273
- package/build/__tests__/AuthorizationResultBasedEntityAssociationLoader-test.js.map +0 -1
- package/build/__tests__/AuthorizationResultBasedEntityLoader-constructor-test.d.ts +0 -26
- package/build/__tests__/AuthorizationResultBasedEntityLoader-constructor-test.js +0 -110
- package/build/__tests__/AuthorizationResultBasedEntityLoader-constructor-test.js.map +0 -1
- package/build/__tests__/AuthorizationResultBasedEntityLoader-test.d.ts +0 -1
- package/build/__tests__/AuthorizationResultBasedEntityLoader-test.js +0 -401
- package/build/__tests__/AuthorizationResultBasedEntityLoader-test.js.map +0 -1
- package/build/__tests__/ComposedCacheAdapter-test.d.ts +0 -1
- package/build/__tests__/ComposedCacheAdapter-test.js +0 -229
- package/build/__tests__/ComposedCacheAdapter-test.js.map +0 -1
- package/build/__tests__/ComposedSecondaryEntityCache-test.d.ts +0 -1
- package/build/__tests__/ComposedSecondaryEntityCache-test.js +0 -66
- package/build/__tests__/ComposedSecondaryEntityCache-test.js.map +0 -1
- package/build/__tests__/EnforcingEntityAssociationLoader-test.d.ts +0 -1
- package/build/__tests__/EnforcingEntityAssociationLoader-test.js +0 -115
- package/build/__tests__/EnforcingEntityAssociationLoader-test.js.map +0 -1
- package/build/__tests__/EnforcingEntityLoader-test.d.ts +0 -1
- package/build/__tests__/EnforcingEntityLoader-test.js +0 -253
- package/build/__tests__/EnforcingEntityLoader-test.js.map +0 -1
- package/build/__tests__/Entity-test.d.ts +0 -1
- package/build/__tests__/Entity-test.js +0 -54
- package/build/__tests__/Entity-test.js.map +0 -1
- package/build/__tests__/EntityAssociationLoader-test.d.ts +0 -1
- package/build/__tests__/EntityAssociationLoader-test.js +0 -30
- package/build/__tests__/EntityAssociationLoader-test.js.map +0 -1
- package/build/__tests__/EntityCommonUseCases-test.d.ts +0 -1
- package/build/__tests__/EntityCommonUseCases-test.js +0 -154
- package/build/__tests__/EntityCommonUseCases-test.js.map +0 -1
- package/build/__tests__/EntityCompanion-test.d.ts +0 -1
- package/build/__tests__/EntityCompanion-test.js +0 -77
- package/build/__tests__/EntityCompanion-test.js.map +0 -1
- package/build/__tests__/EntityCompanionProvider-test.d.ts +0 -1
- package/build/__tests__/EntityCompanionProvider-test.js +0 -54
- package/build/__tests__/EntityCompanionProvider-test.js.map +0 -1
- package/build/__tests__/EntityConfiguration-test.d.ts +0 -1
- package/build/__tests__/EntityConfiguration-test.js +0 -103
- package/build/__tests__/EntityConfiguration-test.js.map +0 -1
- package/build/__tests__/EntityDatabaseAdapter-test.d.ts +0 -1
- package/build/__tests__/EntityDatabaseAdapter-test.js +0 -146
- package/build/__tests__/EntityDatabaseAdapter-test.js.map +0 -1
- package/build/__tests__/EntityEdges-test.d.ts +0 -1
- package/build/__tests__/EntityEdges-test.js +0 -755
- package/build/__tests__/EntityEdges-test.js.map +0 -1
- package/build/__tests__/EntityFields-test.d.ts +0 -1
- package/build/__tests__/EntityFields-test.js +0 -63
- package/build/__tests__/EntityFields-test.js.map +0 -1
- package/build/__tests__/EntityLoader-test.d.ts +0 -1
- package/build/__tests__/EntityLoader-test.js +0 -36
- package/build/__tests__/EntityLoader-test.js.map +0 -1
- package/build/__tests__/EntityMutator-MutationCacheConsistency-test.d.ts +0 -1
- package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js +0 -77
- package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js.map +0 -1
- package/build/__tests__/EntityMutator-test.d.ts +0 -1
- package/build/__tests__/EntityMutator-test.js +0 -741
- package/build/__tests__/EntityMutator-test.js.map +0 -1
- package/build/__tests__/EntityPrivacyPolicy-test.d.ts +0 -1
- package/build/__tests__/EntityPrivacyPolicy-test.js +0 -463
- package/build/__tests__/EntityPrivacyPolicy-test.js.map +0 -1
- package/build/__tests__/EntityQueryContext-test.d.ts +0 -1
- package/build/__tests__/EntityQueryContext-test.js +0 -116
- package/build/__tests__/EntityQueryContext-test.js.map +0 -1
- package/build/__tests__/EntitySecondaryCacheLoader-test.d.ts +0 -1
- package/build/__tests__/EntitySecondaryCacheLoader-test.js +0 -60
- package/build/__tests__/EntitySecondaryCacheLoader-test.js.map +0 -1
- package/build/__tests__/EntitySelfReferentialEdges-test.d.ts +0 -1
- package/build/__tests__/EntitySelfReferentialEdges-test.js +0 -247
- package/build/__tests__/EntitySelfReferentialEdges-test.js.map +0 -1
- package/build/__tests__/GenericEntityCacheAdapter-test.d.ts +0 -1
- package/build/__tests__/GenericEntityCacheAdapter-test.js +0 -80
- package/build/__tests__/GenericEntityCacheAdapter-test.js.map +0 -1
- package/build/__tests__/ReadonlyEntity-test.d.ts +0 -1
- package/build/__tests__/ReadonlyEntity-test.js +0 -178
- package/build/__tests__/ReadonlyEntity-test.js.map +0 -1
- package/build/__tests__/ViewerContext-test.d.ts +0 -1
- package/build/__tests__/ViewerContext-test.js +0 -30
- package/build/__tests__/ViewerContext-test.js.map +0 -1
- package/build/__tests__/ViewerScopedEntityCompanion-test.d.ts +0 -1
- package/build/__tests__/ViewerScopedEntityCompanion-test.js +0 -20
- package/build/__tests__/ViewerScopedEntityCompanion-test.js.map +0 -1
- package/build/__tests__/ViewerScopedEntityCompanionProvider-test.d.ts +0 -1
- package/build/__tests__/ViewerScopedEntityCompanionProvider-test.js +0 -20
- package/build/__tests__/ViewerScopedEntityCompanionProvider-test.js.map +0 -1
- package/build/__tests__/ViewerScopedEntityLoaderFactory-test.d.ts +0 -1
- package/build/__tests__/ViewerScopedEntityLoaderFactory-test.js +0 -23
- package/build/__tests__/ViewerScopedEntityLoaderFactory-test.js.map +0 -1
- package/build/__tests__/ViewerScopedEntityMutatorFactory-test.d.ts +0 -1
- package/build/__tests__/ViewerScopedEntityMutatorFactory-test.js +0 -22
- package/build/__tests__/ViewerScopedEntityMutatorFactory-test.js.map +0 -1
- package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.d.ts +0 -1
- package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js +0 -129
- package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js.map +0 -1
- package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.d.ts +0 -1
- package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js +0 -136
- package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js.map +0 -1
- package/build/__tests__/entityUtils-test.d.ts +0 -1
- package/build/__tests__/entityUtils-test.js +0 -87
- package/build/__tests__/entityUtils-test.js.map +0 -1
- package/build/internal/__tests__/EntityDataManager-test.d.ts +0 -1
- package/build/internal/__tests__/EntityDataManager-test.js +0 -373
- package/build/internal/__tests__/EntityDataManager-test.js.map +0 -1
- package/build/internal/__tests__/EntityFieldTransformationUtils-test.d.ts +0 -1
- package/build/internal/__tests__/EntityFieldTransformationUtils-test.js +0 -136
- package/build/internal/__tests__/EntityFieldTransformationUtils-test.js.map +0 -1
- package/build/internal/__tests__/ReadThroughEntityCache-test.d.ts +0 -1
- package/build/internal/__tests__/ReadThroughEntityCache-test.js +0 -206
- package/build/internal/__tests__/ReadThroughEntityCache-test.js.map +0 -1
- package/build/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.d.ts +0 -1
- package/build/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.js +0 -21
- package/build/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.js.map +0 -1
- package/build/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.d.ts +0 -1
- package/build/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.js +0 -21
- package/build/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.js.map +0 -1
- package/build/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.d.ts +0 -1
- package/build/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.js +0 -21
- package/build/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.js.map +0 -1
- package/build/testfixtures/DateIDTestEntity.d.ts +0 -19
- package/build/testfixtures/DateIDTestEntity.js +0 -48
- package/build/testfixtures/DateIDTestEntity.js.map +0 -1
- package/build/testfixtures/SimpleTestEntity.d.ts +0 -20
- package/build/testfixtures/SimpleTestEntity.js +0 -48
- package/build/testfixtures/SimpleTestEntity.js.map +0 -1
- package/build/testfixtures/TestEntity.d.ts +0 -30
- package/build/testfixtures/TestEntity.js +0 -93
- package/build/testfixtures/TestEntity.js.map +0 -1
- package/build/testfixtures/TestEntity2.d.ts +0 -20
- package/build/testfixtures/TestEntity2.js +0 -51
- package/build/testfixtures/TestEntity2.js.map +0 -1
- package/build/testfixtures/TestEntityNumberKey.d.ts +0 -19
- package/build/testfixtures/TestEntityNumberKey.js +0 -48
- package/build/testfixtures/TestEntityNumberKey.js.map +0 -1
- package/build/testfixtures/TestEntityWithMutationTriggers.d.ts +0 -36
- package/build/testfixtures/TestEntityWithMutationTriggers.js +0 -82
- package/build/testfixtures/TestEntityWithMutationTriggers.js.map +0 -1
- package/build/testfixtures/TestViewerContext.d.ts +0 -3
- package/build/testfixtures/TestViewerContext.js +0 -10
- package/build/testfixtures/TestViewerContext.js.map +0 -1
- package/build/utils/__tests__/EntityPrivacyUtils-test.d.ts +0 -1
- package/build/utils/__tests__/EntityPrivacyUtils-test.js +0 -520
- package/build/utils/__tests__/EntityPrivacyUtils-test.js.map +0 -1
- package/build/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.d.ts +0 -1
- package/build/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.js +0 -181
- package/build/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.js.map +0 -1
- package/build/utils/__tests__/mergeEntityMutationTriggerConfigurations-test.d.ts +0 -1
- package/build/utils/__tests__/mergeEntityMutationTriggerConfigurations-test.js +0 -26
- package/build/utils/__tests__/mergeEntityMutationTriggerConfigurations-test.js.map +0 -1
- package/build/utils/collections/__tests__/maps-test.d.ts +0 -1
- package/build/utils/collections/__tests__/maps-test.js +0 -120
- package/build/utils/collections/__tests__/maps-test.js.map +0 -1
- package/build/utils/testing/PrivacyPolicyRuleTestUtils.d.ts +0 -28
- package/build/utils/testing/PrivacyPolicyRuleTestUtils.js +0 -52
- package/build/utils/testing/PrivacyPolicyRuleTestUtils.js.map +0 -1
- package/build/utils/testing/StubCacheAdapter.d.ts +0 -27
- package/build/utils/testing/StubCacheAdapter.js +0 -86
- package/build/utils/testing/StubCacheAdapter.js.map +0 -1
- package/build/utils/testing/StubDatabaseAdapter.d.ts +0 -25
- package/build/utils/testing/StubDatabaseAdapter.js +0 -191
- package/build/utils/testing/StubDatabaseAdapter.js.map +0 -1
- package/build/utils/testing/StubDatabaseAdapterProvider.d.ts +0 -7
- package/build/utils/testing/StubDatabaseAdapterProvider.js +0 -14
- package/build/utils/testing/StubDatabaseAdapterProvider.js.map +0 -1
- package/build/utils/testing/StubQueryContextProvider.d.ts +0 -7
- package/build/utils/testing/StubQueryContextProvider.js +0 -19
- package/build/utils/testing/StubQueryContextProvider.js.map +0 -1
- package/build/utils/testing/__tests__/PrivacyPolicyRuleTestUtils-test.d.ts +0 -1
- package/build/utils/testing/__tests__/PrivacyPolicyRuleTestUtils-test.js +0 -42
- package/build/utils/testing/__tests__/PrivacyPolicyRuleTestUtils-test.js.map +0 -1
- package/build/utils/testing/__tests__/StubDatabaseAdapter-test.d.ts +0 -1
- package/build/utils/testing/__tests__/StubDatabaseAdapter-test.js +0 -402
- package/build/utils/testing/__tests__/StubDatabaseAdapter-test.js.map +0 -1
- package/build/utils/testing/createUnitTestEntityCompanionProvider.d.ts +0 -7
- package/build/utils/testing/createUnitTestEntityCompanionProvider.js +0 -36
- package/build/utils/testing/createUnitTestEntityCompanionProvider.js.map +0 -1
- package/build/utils/testing/describeFieldTestCase.d.ts +0 -2
- package/build/utils/testing/describeFieldTestCase.js +0 -18
- package/build/utils/testing/describeFieldTestCase.js.map +0 -1
- package/src/testfixtures/DateIDTestEntity.ts +0 -59
- package/src/testfixtures/TestEntityNumberKey.ts +0 -59
- package/src/utils/testing/StubCacheAdapter.ts +0 -122
- package/src/utils/testing/__tests__/PrivacyPolicyRuleTestUtils-test.ts +0 -42
- package/src/utils/testing/__tests__/StubDatabaseAdapter-test.ts +0 -548
- /package/src/utils/{testing → __testfixtures__}/StubQueryContextProvider.ts +0 -0
- /package/src/utils/{testing → __testfixtures__}/createUnitTestEntityCompanionProvider.ts +0 -0
|
@@ -3,10 +3,10 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
3
3
|
|
|
4
4
|
import AuthorizationResultBasedEntityAssociationLoader from '../AuthorizationResultBasedEntityAssociationLoader';
|
|
5
5
|
import { enforceResultsAsync } from '../entityUtils';
|
|
6
|
-
import TestEntity from '../
|
|
7
|
-
import TestEntity2 from '../
|
|
8
|
-
import TestViewerContext from '../
|
|
9
|
-
import { createUnitTestEntityCompanionProvider } from '../utils/
|
|
6
|
+
import TestEntity from '../utils/__testfixtures__/TestEntity';
|
|
7
|
+
import TestEntity2 from '../utils/__testfixtures__/TestEntity2';
|
|
8
|
+
import TestViewerContext from '../utils/__testfixtures__/TestViewerContext';
|
|
9
|
+
import { createUnitTestEntityCompanionProvider } from '../utils/__testfixtures__/createUnitTestEntityCompanionProvider';
|
|
10
10
|
|
|
11
11
|
describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
12
12
|
describe('loadAssociatedEntityAsync', () => {
|
|
@@ -14,26 +14,23 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
14
14
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
15
15
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
16
16
|
const testOtherEntity = await enforceAsyncResult(
|
|
17
|
-
TestEntity.
|
|
17
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext).createAsync(),
|
|
18
18
|
);
|
|
19
19
|
const testEntity = await enforceAsyncResult(
|
|
20
|
-
TestEntity.
|
|
21
|
-
.withAuthorizationResults()
|
|
20
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
22
21
|
.setField('stringField', testOtherEntity.getID())
|
|
23
22
|
.createAsync(),
|
|
24
23
|
);
|
|
25
24
|
const loadedOther = await enforceAsyncResult(
|
|
26
25
|
testEntity
|
|
27
|
-
.
|
|
28
|
-
.withAuthorizationResults()
|
|
26
|
+
.associationLoaderWithAuthorizationResults()
|
|
29
27
|
.loadAssociatedEntityAsync('stringField', TestEntity),
|
|
30
28
|
);
|
|
31
29
|
expect(loadedOther.getID()).toEqual(testOtherEntity.getID());
|
|
32
30
|
|
|
33
31
|
const loadedOther2 = await enforceAsyncResult(
|
|
34
32
|
testEntity
|
|
35
|
-
.
|
|
36
|
-
.withAuthorizationResults()
|
|
33
|
+
.associationLoaderWithAuthorizationResults()
|
|
37
34
|
.loadAssociatedEntityAsync('nullableField', TestEntity),
|
|
38
35
|
);
|
|
39
36
|
expect(loadedOther2).toBeNull();
|
|
@@ -45,24 +42,21 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
45
42
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
46
43
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
47
44
|
const testEntity = await enforceAsyncResult(
|
|
48
|
-
TestEntity.
|
|
45
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext).createAsync(),
|
|
49
46
|
);
|
|
50
47
|
const testOtherEntity1 = await enforceAsyncResult(
|
|
51
|
-
TestEntity.
|
|
52
|
-
.withAuthorizationResults()
|
|
48
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
53
49
|
.setField('stringField', testEntity.getID())
|
|
54
50
|
.createAsync(),
|
|
55
51
|
);
|
|
56
52
|
const testOtherEntity2 = await enforceAsyncResult(
|
|
57
|
-
TestEntity.
|
|
58
|
-
.withAuthorizationResults()
|
|
53
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
59
54
|
.setField('stringField', testEntity.getID())
|
|
60
55
|
.createAsync(),
|
|
61
56
|
);
|
|
62
57
|
const loaded = await enforceResultsAsync(
|
|
63
58
|
testEntity
|
|
64
|
-
.
|
|
65
|
-
.withAuthorizationResults()
|
|
59
|
+
.associationLoaderWithAuthorizationResults()
|
|
66
60
|
.loadManyAssociatedEntitiesAsync(TestEntity, 'stringField'),
|
|
67
61
|
);
|
|
68
62
|
expect(loaded).toHaveLength(2);
|
|
@@ -76,17 +70,15 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
76
70
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
77
71
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
78
72
|
const testOtherEntity = await enforceAsyncResult(
|
|
79
|
-
TestEntity.
|
|
73
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext).createAsync(),
|
|
80
74
|
);
|
|
81
75
|
const testEntity = await enforceAsyncResult(
|
|
82
|
-
TestEntity.
|
|
83
|
-
.withAuthorizationResults()
|
|
76
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
84
77
|
.setField('stringField', testOtherEntity.getID())
|
|
85
78
|
.createAsync(),
|
|
86
79
|
);
|
|
87
80
|
const loadedOtherResult = await testEntity
|
|
88
|
-
.
|
|
89
|
-
.withAuthorizationResults()
|
|
81
|
+
.associationLoaderWithAuthorizationResults()
|
|
90
82
|
.loadAssociatedEntityByFieldEqualingAsync('stringField', TestEntity, 'customIdField');
|
|
91
83
|
expect(loadedOtherResult?.enforceValue().getID()).toEqual(testOtherEntity.getID());
|
|
92
84
|
});
|
|
@@ -95,14 +87,12 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
95
87
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
96
88
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
97
89
|
const testEntity = await enforceAsyncResult(
|
|
98
|
-
TestEntity.
|
|
99
|
-
.withAuthorizationResults()
|
|
90
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
100
91
|
.setField('stringField', uuidv4())
|
|
101
92
|
.createAsync(),
|
|
102
93
|
);
|
|
103
94
|
const loadedOtherResult = await testEntity
|
|
104
|
-
.
|
|
105
|
-
.withAuthorizationResults()
|
|
95
|
+
.associationLoaderWithAuthorizationResults()
|
|
106
96
|
.loadAssociatedEntityByFieldEqualingAsync('stringField', TestEntity, 'customIdField');
|
|
107
97
|
expect(loadedOtherResult).toBeNull();
|
|
108
98
|
});
|
|
@@ -111,14 +101,12 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
111
101
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
112
102
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
113
103
|
const testEntity = await enforceAsyncResult(
|
|
114
|
-
TestEntity.
|
|
115
|
-
.withAuthorizationResults()
|
|
104
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
116
105
|
.setField('stringField', 'blah')
|
|
117
106
|
.createAsync(),
|
|
118
107
|
);
|
|
119
108
|
const loadedOtherResult = await testEntity
|
|
120
|
-
.
|
|
121
|
-
.withAuthorizationResults()
|
|
109
|
+
.associationLoaderWithAuthorizationResults()
|
|
122
110
|
.loadAssociatedEntityByFieldEqualingAsync('nullableField', TestEntity, 'customIdField');
|
|
123
111
|
expect(loadedOtherResult).toBeNull();
|
|
124
112
|
});
|
|
@@ -129,24 +117,21 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
129
117
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
130
118
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
131
119
|
const testEntity = await enforceAsyncResult(
|
|
132
|
-
TestEntity.
|
|
120
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext).createAsync(),
|
|
133
121
|
);
|
|
134
122
|
const testOtherEntity1 = await enforceAsyncResult(
|
|
135
|
-
TestEntity.
|
|
136
|
-
.withAuthorizationResults()
|
|
123
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
137
124
|
.setField('stringField', testEntity.getID())
|
|
138
125
|
.createAsync(),
|
|
139
126
|
);
|
|
140
127
|
const testOtherEntity2 = await enforceAsyncResult(
|
|
141
|
-
TestEntity.
|
|
142
|
-
.withAuthorizationResults()
|
|
128
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
143
129
|
.setField('stringField', testEntity.getID())
|
|
144
130
|
.createAsync(),
|
|
145
131
|
);
|
|
146
132
|
const loaded = await enforceResultsAsync(
|
|
147
133
|
testEntity
|
|
148
|
-
.
|
|
149
|
-
.withAuthorizationResults()
|
|
134
|
+
.associationLoaderWithAuthorizationResults()
|
|
150
135
|
.loadManyAssociatedEntitiesByFieldEqualingAsync(
|
|
151
136
|
'customIdField',
|
|
152
137
|
TestEntity,
|
|
@@ -162,12 +147,11 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
162
147
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
163
148
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
164
149
|
const testEntity = await enforceAsyncResult(
|
|
165
|
-
TestEntity.
|
|
150
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext).createAsync(),
|
|
166
151
|
);
|
|
167
152
|
const loaded = await enforceResultsAsync(
|
|
168
153
|
testEntity
|
|
169
|
-
.
|
|
170
|
-
.withAuthorizationResults()
|
|
154
|
+
.associationLoaderWithAuthorizationResults()
|
|
171
155
|
.loadManyAssociatedEntitiesByFieldEqualingAsync(
|
|
172
156
|
'nullableField',
|
|
173
157
|
TestEntity,
|
|
@@ -183,30 +167,26 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
183
167
|
const companionProvider = createUnitTestEntityCompanionProvider();
|
|
184
168
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
185
169
|
const testEntity4 = await enforceAsyncResult(
|
|
186
|
-
TestEntity.
|
|
170
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext).createAsync(),
|
|
187
171
|
);
|
|
188
172
|
const testEntity3 = await enforceAsyncResult(
|
|
189
|
-
TestEntity2.
|
|
190
|
-
.withAuthorizationResults()
|
|
173
|
+
TestEntity2.creatorWithAuthorizationResults(viewerContext)
|
|
191
174
|
.setField('foreignKey', testEntity4.getID())
|
|
192
175
|
.createAsync(),
|
|
193
176
|
);
|
|
194
177
|
const testEntity2 = await enforceAsyncResult(
|
|
195
|
-
TestEntity.
|
|
196
|
-
.withAuthorizationResults()
|
|
178
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
197
179
|
.setField('testIndexedField', testEntity3.getID())
|
|
198
180
|
.createAsync(),
|
|
199
181
|
);
|
|
200
182
|
const testEntity = await enforceAsyncResult(
|
|
201
|
-
TestEntity2.
|
|
202
|
-
.withAuthorizationResults()
|
|
183
|
+
TestEntity2.creatorWithAuthorizationResults(viewerContext)
|
|
203
184
|
.setField('foreignKey', testEntity2.getID())
|
|
204
185
|
.createAsync(),
|
|
205
186
|
);
|
|
206
187
|
|
|
207
188
|
const loaded2Result = await testEntity
|
|
208
|
-
.
|
|
209
|
-
.withAuthorizationResults()
|
|
189
|
+
.associationLoaderWithAuthorizationResults()
|
|
210
190
|
.loadAssociatedEntityThroughAsync([
|
|
211
191
|
{
|
|
212
192
|
associatedEntityClass: TestEntity,
|
|
@@ -216,8 +196,7 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
216
196
|
expect(loaded2Result?.enforceValue().getID()).toEqual(testEntity2.getID());
|
|
217
197
|
|
|
218
198
|
const loaded3Result = await testEntity
|
|
219
|
-
.
|
|
220
|
-
.withAuthorizationResults()
|
|
199
|
+
.associationLoaderWithAuthorizationResults()
|
|
221
200
|
.loadAssociatedEntityThroughAsync([
|
|
222
201
|
{
|
|
223
202
|
associatedEntityClass: TestEntity,
|
|
@@ -231,8 +210,7 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
231
210
|
expect(loaded3Result?.enforceValue().getID()).toEqual(testEntity3.getID());
|
|
232
211
|
|
|
233
212
|
const loaded4Result = await testEntity
|
|
234
|
-
.
|
|
235
|
-
.withAuthorizationResults()
|
|
213
|
+
.associationLoaderWithAuthorizationResults()
|
|
236
214
|
.loadAssociatedEntityThroughAsync([
|
|
237
215
|
{
|
|
238
216
|
associatedEntityClass: TestEntity,
|
|
@@ -255,15 +233,13 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
255
233
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
256
234
|
|
|
257
235
|
const testEntity = await enforceAsyncResult(
|
|
258
|
-
TestEntity2.
|
|
259
|
-
.withAuthorizationResults()
|
|
236
|
+
TestEntity2.creatorWithAuthorizationResults(viewerContext)
|
|
260
237
|
.setField('foreignKey', uuidv4())
|
|
261
238
|
.createAsync(),
|
|
262
239
|
);
|
|
263
240
|
|
|
264
241
|
const loadResult = await testEntity
|
|
265
|
-
.
|
|
266
|
-
.withAuthorizationResults()
|
|
242
|
+
.associationLoaderWithAuthorizationResults()
|
|
267
243
|
.loadAssociatedEntityThroughAsync([
|
|
268
244
|
{
|
|
269
245
|
associatedEntityClass: TestEntity,
|
|
@@ -279,21 +255,18 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
279
255
|
|
|
280
256
|
const fieldValue = uuidv4();
|
|
281
257
|
const testEntity2 = await enforceAsyncResult(
|
|
282
|
-
TestEntity.
|
|
283
|
-
.withAuthorizationResults()
|
|
258
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
284
259
|
.setField('stringField', fieldValue)
|
|
285
260
|
.createAsync(),
|
|
286
261
|
);
|
|
287
262
|
const testEntity = await enforceAsyncResult(
|
|
288
|
-
TestEntity2.
|
|
289
|
-
.withAuthorizationResults()
|
|
263
|
+
TestEntity2.creatorWithAuthorizationResults(viewerContext)
|
|
290
264
|
.setField('foreignKey', fieldValue)
|
|
291
265
|
.createAsync(),
|
|
292
266
|
);
|
|
293
267
|
|
|
294
268
|
const loaded2Result = await testEntity
|
|
295
|
-
.
|
|
296
|
-
.withAuthorizationResults()
|
|
269
|
+
.associationLoaderWithAuthorizationResults()
|
|
297
270
|
.loadAssociatedEntityThroughAsync([
|
|
298
271
|
{
|
|
299
272
|
associatedEntityClass: TestEntity,
|
|
@@ -309,15 +282,13 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
309
282
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
310
283
|
|
|
311
284
|
const testEntity = await enforceAsyncResult(
|
|
312
|
-
TestEntity2.
|
|
313
|
-
.withAuthorizationResults()
|
|
285
|
+
TestEntity2.creatorWithAuthorizationResults(viewerContext)
|
|
314
286
|
.setField('foreignKey', uuidv4())
|
|
315
287
|
.createAsync(),
|
|
316
288
|
);
|
|
317
289
|
|
|
318
290
|
const loaded2Result = await testEntity
|
|
319
|
-
.
|
|
320
|
-
.withAuthorizationResults()
|
|
291
|
+
.associationLoaderWithAuthorizationResults()
|
|
321
292
|
.loadAssociatedEntityThroughAsync([
|
|
322
293
|
{
|
|
323
294
|
associatedEntityClass: TestEntity,
|
|
@@ -333,15 +304,13 @@ describe(AuthorizationResultBasedEntityAssociationLoader, () => {
|
|
|
333
304
|
const viewerContext = new TestViewerContext(companionProvider);
|
|
334
305
|
|
|
335
306
|
const testEntity = await enforceAsyncResult(
|
|
336
|
-
TestEntity.
|
|
337
|
-
.withAuthorizationResults()
|
|
307
|
+
TestEntity.creatorWithAuthorizationResults(viewerContext)
|
|
338
308
|
.setField('nullableField', null)
|
|
339
309
|
.createAsync(),
|
|
340
310
|
);
|
|
341
311
|
|
|
342
312
|
const loadedResult = await testEntity
|
|
343
|
-
.
|
|
344
|
-
.withAuthorizationResults()
|
|
313
|
+
.associationLoaderWithAuthorizationResults()
|
|
345
314
|
.loadAssociatedEntityThroughAsync([
|
|
346
315
|
{
|
|
347
316
|
associatedEntityClass: TestEntity,
|
|
@@ -12,9 +12,9 @@ import EntityDataManager from '../internal/EntityDataManager';
|
|
|
12
12
|
import ReadThroughEntityCache from '../internal/ReadThroughEntityCache';
|
|
13
13
|
import IEntityMetricsAdapter from '../metrics/IEntityMetricsAdapter';
|
|
14
14
|
import AlwaysAllowPrivacyPolicyRule from '../rules/AlwaysAllowPrivacyPolicyRule';
|
|
15
|
-
import { NoCacheStubCacheAdapterProvider } from '../utils/
|
|
16
|
-
import StubDatabaseAdapter from '../utils/
|
|
17
|
-
import StubQueryContextProvider from '../utils/
|
|
15
|
+
import { NoCacheStubCacheAdapterProvider } from '../utils/__testfixtures__/StubCacheAdapter';
|
|
16
|
+
import StubDatabaseAdapter from '../utils/__testfixtures__/StubDatabaseAdapter';
|
|
17
|
+
import StubQueryContextProvider from '../utils/__testfixtures__/StubQueryContextProvider';
|
|
18
18
|
|
|
19
19
|
export type TestFields = {
|
|
20
20
|
id: string;
|
|
@@ -22,12 +22,13 @@ export type TestFields = {
|
|
|
22
22
|
|
|
23
23
|
export type TestFieldSelection = keyof TestFields;
|
|
24
24
|
|
|
25
|
-
export const testEntityConfiguration = new EntityConfiguration<TestFields>({
|
|
25
|
+
export const testEntityConfiguration = new EntityConfiguration<TestFields, 'id'>({
|
|
26
26
|
idField: 'id',
|
|
27
27
|
tableName: 'test_entity_should_not_write_to_db',
|
|
28
28
|
schema: {
|
|
29
29
|
id: new StringField({
|
|
30
30
|
columnName: 'id',
|
|
31
|
+
cache: false,
|
|
31
32
|
}),
|
|
32
33
|
},
|
|
33
34
|
databaseAdapterFlavor: 'postgres',
|
|
@@ -36,7 +37,7 @@ export const testEntityConfiguration = new EntityConfiguration<TestFields>({
|
|
|
36
37
|
|
|
37
38
|
export class TestEntityPrivacyPolicy extends EntityPrivacyPolicy<
|
|
38
39
|
TestFields,
|
|
39
|
-
|
|
40
|
+
'id',
|
|
40
41
|
ViewerContext,
|
|
41
42
|
TestEntity,
|
|
42
43
|
TestFieldSelection
|
|
@@ -44,7 +45,7 @@ export class TestEntityPrivacyPolicy extends EntityPrivacyPolicy<
|
|
|
44
45
|
protected override readonly readRules = [
|
|
45
46
|
new AlwaysAllowPrivacyPolicyRule<
|
|
46
47
|
TestFields,
|
|
47
|
-
|
|
48
|
+
'id',
|
|
48
49
|
ViewerContext,
|
|
49
50
|
TestEntity,
|
|
50
51
|
TestFieldSelection
|
|
@@ -53,7 +54,7 @@ export class TestEntityPrivacyPolicy extends EntityPrivacyPolicy<
|
|
|
53
54
|
protected override readonly createRules = [
|
|
54
55
|
new AlwaysAllowPrivacyPolicyRule<
|
|
55
56
|
TestFields,
|
|
56
|
-
|
|
57
|
+
'id',
|
|
57
58
|
ViewerContext,
|
|
58
59
|
TestEntity,
|
|
59
60
|
TestFieldSelection
|
|
@@ -62,7 +63,7 @@ export class TestEntityPrivacyPolicy extends EntityPrivacyPolicy<
|
|
|
62
63
|
protected override readonly updateRules = [
|
|
63
64
|
new AlwaysAllowPrivacyPolicyRule<
|
|
64
65
|
TestFields,
|
|
65
|
-
|
|
66
|
+
'id',
|
|
66
67
|
ViewerContext,
|
|
67
68
|
TestEntity,
|
|
68
69
|
TestFieldSelection
|
|
@@ -71,7 +72,7 @@ export class TestEntityPrivacyPolicy extends EntityPrivacyPolicy<
|
|
|
71
72
|
protected override readonly deleteRules = [
|
|
72
73
|
new AlwaysAllowPrivacyPolicyRule<
|
|
73
74
|
TestFields,
|
|
74
|
-
|
|
75
|
+
'id',
|
|
75
76
|
ViewerContext,
|
|
76
77
|
TestEntity,
|
|
77
78
|
TestFieldSelection
|
|
@@ -84,7 +85,7 @@ const ID_SENTINEL_THROW_ERROR = 'throw_error';
|
|
|
84
85
|
|
|
85
86
|
export default class TestEntity extends Entity<
|
|
86
87
|
TestFields,
|
|
87
|
-
|
|
88
|
+
'id',
|
|
88
89
|
ViewerContext,
|
|
89
90
|
TestFieldSelection
|
|
90
91
|
> {
|
|
@@ -105,7 +106,7 @@ export default class TestEntity extends Entity<
|
|
|
105
106
|
|
|
106
107
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
107
108
|
TestFields,
|
|
108
|
-
|
|
109
|
+
'id',
|
|
109
110
|
ViewerContext,
|
|
110
111
|
TestEntity,
|
|
111
112
|
TestEntityPrivacyPolicy,
|
|
@@ -127,7 +128,7 @@ describe(AuthorizationResultBasedEntityLoader, () => {
|
|
|
127
128
|
mock<
|
|
128
129
|
EntityPrivacyPolicyEvaluationContext<
|
|
129
130
|
TestFields,
|
|
130
|
-
|
|
131
|
+
'id',
|
|
131
132
|
ViewerContext,
|
|
132
133
|
TestEntity,
|
|
133
134
|
TestFieldSelection
|
|
@@ -137,7 +138,7 @@ describe(AuthorizationResultBasedEntityLoader, () => {
|
|
|
137
138
|
const metricsAdapter = instance(mock<IEntityMetricsAdapter>());
|
|
138
139
|
const queryContext = new StubQueryContextProvider().getQueryContext();
|
|
139
140
|
|
|
140
|
-
const databaseAdapter = new StubDatabaseAdapter<TestFields>(
|
|
141
|
+
const databaseAdapter = new StubDatabaseAdapter<TestFields, 'id'>(
|
|
141
142
|
testEntityConfiguration,
|
|
142
143
|
StubDatabaseAdapter.convertFieldObjectsToDataStore(
|
|
143
144
|
testEntityConfiguration,
|