@expo/entity 0.41.0 → 0.43.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.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 +10 -10
- 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 +8 -8
- 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 +56 -49
- 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 +39 -39
- 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 +24 -24
- 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 +4 -4
- 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 +2 -2
- package/src/__tests__/EntityAssociationLoader-test.ts +2 -2
- package/src/__tests__/EntityCommonUseCases-test.ts +11 -11
- 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 +97 -72
- package/src/__tests__/EntityFields-test.ts +2 -2
- package/src/__tests__/EntityLoader-test.ts +2 -2
- package/src/__tests__/EntityMutator-MutationCacheConsistency-test.ts +11 -11
- 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 +3 -3
- package/src/__tests__/EntitySelfReferentialEdges-test.ts +64 -39
- package/src/__tests__/GenericEntityCacheAdapter-test.ts +83 -28
- package/src/__tests__/ReadonlyEntity-test.ts +3 -3
- 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 +12 -12
- package/src/__tests__/cases/TwoEntitySameTableOverlappingRows-test.ts +12 -12
- 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 +62 -66
- package/src/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.ts +29 -25
- 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 -242
- 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 -94
- 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 -146
- 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 -723
- 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 -73
- 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 -201
- 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 -211
- 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 -123
- 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 -121
- 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 -486
- 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 -178
- 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
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
getCanViewerDeleteResultAsync,
|
|
24
24
|
getCanViewerUpdateResultAsync,
|
|
25
25
|
} from '../EntityPrivacyUtils';
|
|
26
|
-
import { createUnitTestEntityCompanionProvider } from '../
|
|
26
|
+
import { createUnitTestEntityCompanionProvider } from '../__testfixtures__/createUnitTestEntityCompanionProvider';
|
|
27
27
|
|
|
28
28
|
function assertEntityPrivacyEvaluationResultFailure(
|
|
29
29
|
evaluationResult: EntityPrivacyEvaluationResult,
|
|
@@ -296,54 +296,54 @@ type TestEntityThrowOtherErrorFields = {
|
|
|
296
296
|
};
|
|
297
297
|
|
|
298
298
|
class DenyUpdateEntityPrivacyPolicy<
|
|
299
|
-
TFields extends
|
|
300
|
-
|
|
299
|
+
TFields extends Record<'id', any>,
|
|
300
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
301
301
|
TViewerContext extends ViewerContext,
|
|
302
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
302
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
303
303
|
TSelectedFields extends keyof TFields = keyof TFields,
|
|
304
|
-
> extends EntityPrivacyPolicy<TFields,
|
|
304
|
+
> extends EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
305
305
|
protected override readonly readRules = [
|
|
306
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
306
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
307
307
|
];
|
|
308
308
|
protected override readonly createRules = [
|
|
309
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
309
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
310
310
|
];
|
|
311
311
|
protected override readonly updateRules = [
|
|
312
|
-
new AlwaysDenyPrivacyPolicyRule<TFields,
|
|
312
|
+
new AlwaysDenyPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
313
313
|
];
|
|
314
314
|
protected override readonly deleteRules = [
|
|
315
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
315
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
316
316
|
];
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
class DenyDeleteEntityPrivacyPolicy<
|
|
320
|
-
TFields extends
|
|
321
|
-
|
|
320
|
+
TFields extends Record<'id', any>,
|
|
321
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
322
322
|
TViewerContext extends ViewerContext,
|
|
323
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
323
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
324
324
|
TSelectedFields extends keyof TFields = keyof TFields,
|
|
325
|
-
> extends EntityPrivacyPolicy<TFields,
|
|
325
|
+
> extends EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
326
326
|
protected override readonly readRules = [
|
|
327
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
327
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
328
328
|
];
|
|
329
329
|
protected override readonly createRules = [
|
|
330
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
330
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
331
331
|
];
|
|
332
332
|
protected override readonly updateRules = [
|
|
333
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
333
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
334
334
|
];
|
|
335
335
|
protected override readonly deleteRules = [
|
|
336
|
-
new AlwaysDenyPrivacyPolicyRule<TFields,
|
|
336
|
+
new AlwaysDenyPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
337
337
|
];
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
class ThrowOtherErrorEntityPrivacyPolicy<
|
|
341
|
-
TFields extends
|
|
342
|
-
|
|
341
|
+
TFields extends Record<'id', any>,
|
|
342
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
343
343
|
TViewerContext extends ViewerContext,
|
|
344
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
344
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
345
345
|
TSelectedFields extends keyof TFields = keyof TFields,
|
|
346
|
-
> extends EntityPrivacyPolicy<TFields,
|
|
346
|
+
> extends EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
347
347
|
protected override readonly readRules = [
|
|
348
348
|
{
|
|
349
349
|
async evaluateAsync(
|
|
@@ -351,7 +351,7 @@ class ThrowOtherErrorEntityPrivacyPolicy<
|
|
|
351
351
|
_queryContext: EntityQueryContext,
|
|
352
352
|
evaluationContext: EntityPrivacyPolicyEvaluationContext<
|
|
353
353
|
TFields,
|
|
354
|
-
|
|
354
|
+
TIDField,
|
|
355
355
|
TViewerContext,
|
|
356
356
|
TEntity,
|
|
357
357
|
TSelectedFields
|
|
@@ -364,10 +364,10 @@ class ThrowOtherErrorEntityPrivacyPolicy<
|
|
|
364
364
|
return RuleEvaluationResult.SKIP;
|
|
365
365
|
},
|
|
366
366
|
},
|
|
367
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
367
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
368
368
|
];
|
|
369
369
|
protected override readonly createRules = [
|
|
370
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
370
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
371
371
|
];
|
|
372
372
|
protected override readonly updateRules = [
|
|
373
373
|
{
|
|
@@ -386,12 +386,12 @@ class ThrowOtherErrorEntityPrivacyPolicy<
|
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
class DenyReadEntityPrivacyPolicy<
|
|
389
|
-
TFields extends
|
|
390
|
-
|
|
389
|
+
TFields extends Record<'id', any>,
|
|
390
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
391
391
|
TViewerContext extends ViewerContext,
|
|
392
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
392
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
393
393
|
TSelectedFields extends keyof TFields = keyof TFields,
|
|
394
|
-
> extends EntityPrivacyPolicy<TFields,
|
|
394
|
+
> extends EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
395
395
|
protected override readonly readRules = [
|
|
396
396
|
{
|
|
397
397
|
async evaluateAsync(
|
|
@@ -399,7 +399,7 @@ class DenyReadEntityPrivacyPolicy<
|
|
|
399
399
|
queryContext: EntityQueryContext,
|
|
400
400
|
evaluationContext: EntityPrivacyPolicyEvaluationContext<
|
|
401
401
|
TFields,
|
|
402
|
-
|
|
402
|
+
TIDField,
|
|
403
403
|
TViewerContext,
|
|
404
404
|
TEntity,
|
|
405
405
|
TSelectedFields
|
|
@@ -416,37 +416,38 @@ class DenyReadEntityPrivacyPolicy<
|
|
|
416
416
|
},
|
|
417
417
|
];
|
|
418
418
|
protected override readonly createRules = [
|
|
419
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
419
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
420
420
|
];
|
|
421
421
|
protected override readonly updateRules = [
|
|
422
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
422
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
423
423
|
];
|
|
424
424
|
protected override readonly deleteRules = [
|
|
425
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
425
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
426
426
|
];
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
class LeafDenyUpdateEntity extends Entity<TestLeafDenyUpdateFields,
|
|
429
|
+
class LeafDenyUpdateEntity extends Entity<TestLeafDenyUpdateFields, 'id', ViewerContext> {
|
|
430
430
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
431
431
|
TestLeafDenyUpdateFields,
|
|
432
|
-
|
|
432
|
+
'id',
|
|
433
433
|
ViewerContext,
|
|
434
434
|
LeafDenyUpdateEntity,
|
|
435
435
|
DenyUpdateEntityPrivacyPolicy<
|
|
436
436
|
TestLeafDenyUpdateFields,
|
|
437
|
-
|
|
437
|
+
'id',
|
|
438
438
|
ViewerContext,
|
|
439
439
|
LeafDenyUpdateEntity
|
|
440
440
|
>
|
|
441
441
|
> {
|
|
442
442
|
return {
|
|
443
443
|
entityClass: LeafDenyUpdateEntity,
|
|
444
|
-
entityConfiguration: new EntityConfiguration<TestLeafDenyUpdateFields>({
|
|
444
|
+
entityConfiguration: new EntityConfiguration<TestLeafDenyUpdateFields, 'id'>({
|
|
445
445
|
idField: 'id',
|
|
446
446
|
tableName: 'leaf_1',
|
|
447
447
|
schema: {
|
|
448
448
|
id: new UUIDField({
|
|
449
449
|
columnName: 'custom_id',
|
|
450
|
+
cache: false,
|
|
450
451
|
}),
|
|
451
452
|
// to ensure edge traversal doesn't process other edges
|
|
452
453
|
unused_other_association: new UUIDField({
|
|
@@ -481,27 +482,28 @@ class LeafDenyUpdateEntity extends Entity<TestLeafDenyUpdateFields, string, View
|
|
|
481
482
|
}
|
|
482
483
|
}
|
|
483
484
|
|
|
484
|
-
class LeafDenyDeleteEntity extends Entity<TestLeafDenyDeleteFields,
|
|
485
|
+
class LeafDenyDeleteEntity extends Entity<TestLeafDenyDeleteFields, 'id', ViewerContext> {
|
|
485
486
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
486
487
|
TestLeafDenyDeleteFields,
|
|
487
|
-
|
|
488
|
+
'id',
|
|
488
489
|
ViewerContext,
|
|
489
490
|
LeafDenyDeleteEntity,
|
|
490
491
|
DenyDeleteEntityPrivacyPolicy<
|
|
491
492
|
TestLeafDenyDeleteFields,
|
|
492
|
-
|
|
493
|
+
'id',
|
|
493
494
|
ViewerContext,
|
|
494
495
|
LeafDenyDeleteEntity
|
|
495
496
|
>
|
|
496
497
|
> {
|
|
497
498
|
return {
|
|
498
499
|
entityClass: LeafDenyDeleteEntity,
|
|
499
|
-
entityConfiguration: new EntityConfiguration<TestLeafDenyDeleteFields>({
|
|
500
|
+
entityConfiguration: new EntityConfiguration<TestLeafDenyDeleteFields, 'id'>({
|
|
500
501
|
idField: 'id',
|
|
501
502
|
tableName: 'leaf_2',
|
|
502
503
|
schema: {
|
|
503
504
|
id: new UUIDField({
|
|
504
505
|
columnName: 'custom_id',
|
|
506
|
+
cache: false,
|
|
505
507
|
}),
|
|
506
508
|
// deletion behavior should fail since this entity can't be deleted
|
|
507
509
|
simple_test_deny_update_cascade_delete_id: new UUIDField({
|
|
@@ -528,23 +530,24 @@ class LeafDenyDeleteEntity extends Entity<TestLeafDenyDeleteFields, string, View
|
|
|
528
530
|
}
|
|
529
531
|
}
|
|
530
532
|
|
|
531
|
-
class LeafDenyReadEntity extends Entity<TestLeafDenyReadFields,
|
|
533
|
+
class LeafDenyReadEntity extends Entity<TestLeafDenyReadFields, 'id', ViewerContext> {
|
|
532
534
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
533
535
|
TestLeafDenyReadFields,
|
|
534
|
-
|
|
536
|
+
'id',
|
|
535
537
|
ViewerContext,
|
|
536
538
|
LeafDenyReadEntity,
|
|
537
|
-
DenyReadEntityPrivacyPolicy<TestLeafDenyReadFields,
|
|
539
|
+
DenyReadEntityPrivacyPolicy<TestLeafDenyReadFields, 'id', ViewerContext, LeafDenyReadEntity>
|
|
538
540
|
> {
|
|
539
541
|
return {
|
|
540
542
|
entityClass: LeafDenyReadEntity,
|
|
541
|
-
entityConfiguration: new EntityConfiguration<TestLeafDenyReadFields>({
|
|
543
|
+
entityConfiguration: new EntityConfiguration<TestLeafDenyReadFields, 'id'>({
|
|
542
544
|
idField: 'id',
|
|
543
545
|
tableName: 'leaf_4',
|
|
544
546
|
inboundEdges: [],
|
|
545
547
|
schema: {
|
|
546
548
|
id: new UUIDField({
|
|
547
549
|
columnName: 'custom_id',
|
|
550
|
+
cache: false,
|
|
548
551
|
}),
|
|
549
552
|
simple_test_id: new UUIDField({
|
|
550
553
|
columnName: 'simple_test_id',
|
|
@@ -563,22 +566,17 @@ class LeafDenyReadEntity extends Entity<TestLeafDenyReadFields, string, ViewerCo
|
|
|
563
566
|
}
|
|
564
567
|
}
|
|
565
568
|
|
|
566
|
-
class SimpleTestDenyUpdateEntity extends Entity<TestEntityFields,
|
|
569
|
+
class SimpleTestDenyUpdateEntity extends Entity<TestEntityFields, 'id', ViewerContext> {
|
|
567
570
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
568
571
|
TestEntityFields,
|
|
569
|
-
|
|
572
|
+
'id',
|
|
570
573
|
ViewerContext,
|
|
571
574
|
SimpleTestDenyUpdateEntity,
|
|
572
|
-
DenyUpdateEntityPrivacyPolicy<
|
|
573
|
-
TestEntityFields,
|
|
574
|
-
string,
|
|
575
|
-
ViewerContext,
|
|
576
|
-
SimpleTestDenyUpdateEntity
|
|
577
|
-
>
|
|
575
|
+
DenyUpdateEntityPrivacyPolicy<TestEntityFields, 'id', ViewerContext, SimpleTestDenyUpdateEntity>
|
|
578
576
|
> {
|
|
579
577
|
return {
|
|
580
578
|
entityClass: SimpleTestDenyUpdateEntity,
|
|
581
|
-
entityConfiguration: new EntityConfiguration<TestEntityFields>({
|
|
579
|
+
entityConfiguration: new EntityConfiguration<TestEntityFields, 'id'>({
|
|
582
580
|
idField: 'id',
|
|
583
581
|
tableName: 'blah',
|
|
584
582
|
inboundEdges: [
|
|
@@ -590,6 +588,7 @@ class SimpleTestDenyUpdateEntity extends Entity<TestEntityFields, string, Viewer
|
|
|
590
588
|
schema: {
|
|
591
589
|
id: new UUIDField({
|
|
592
590
|
columnName: 'custom_id',
|
|
591
|
+
cache: false,
|
|
593
592
|
}),
|
|
594
593
|
},
|
|
595
594
|
databaseAdapterFlavor: 'postgres',
|
|
@@ -600,22 +599,17 @@ class SimpleTestDenyUpdateEntity extends Entity<TestEntityFields, string, Viewer
|
|
|
600
599
|
}
|
|
601
600
|
}
|
|
602
601
|
|
|
603
|
-
class SimpleTestDenyDeleteEntity extends Entity<TestEntityFields,
|
|
602
|
+
class SimpleTestDenyDeleteEntity extends Entity<TestEntityFields, 'id', ViewerContext> {
|
|
604
603
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
605
604
|
TestEntityFields,
|
|
606
|
-
|
|
605
|
+
'id',
|
|
607
606
|
ViewerContext,
|
|
608
607
|
SimpleTestDenyDeleteEntity,
|
|
609
|
-
DenyDeleteEntityPrivacyPolicy<
|
|
610
|
-
TestEntityFields,
|
|
611
|
-
string,
|
|
612
|
-
ViewerContext,
|
|
613
|
-
SimpleTestDenyDeleteEntity
|
|
614
|
-
>
|
|
608
|
+
DenyDeleteEntityPrivacyPolicy<TestEntityFields, 'id', ViewerContext, SimpleTestDenyDeleteEntity>
|
|
615
609
|
> {
|
|
616
610
|
return {
|
|
617
611
|
entityClass: SimpleTestDenyDeleteEntity,
|
|
618
|
-
entityConfiguration: new EntityConfiguration<TestEntityFields>({
|
|
612
|
+
entityConfiguration: new EntityConfiguration<TestEntityFields, 'id'>({
|
|
619
613
|
idField: 'id',
|
|
620
614
|
tableName: 'blah_2',
|
|
621
615
|
inboundEdges: [
|
|
@@ -627,6 +621,7 @@ class SimpleTestDenyDeleteEntity extends Entity<TestEntityFields, string, Viewer
|
|
|
627
621
|
schema: {
|
|
628
622
|
id: new UUIDField({
|
|
629
623
|
columnName: 'custom_id',
|
|
624
|
+
cache: false,
|
|
630
625
|
}),
|
|
631
626
|
},
|
|
632
627
|
databaseAdapterFlavor: 'postgres',
|
|
@@ -639,30 +634,31 @@ class SimpleTestDenyDeleteEntity extends Entity<TestEntityFields, string, Viewer
|
|
|
639
634
|
|
|
640
635
|
class SimpleTestThrowOtherErrorEntity extends Entity<
|
|
641
636
|
TestEntityThrowOtherErrorFields,
|
|
642
|
-
|
|
637
|
+
'id',
|
|
643
638
|
ViewerContext
|
|
644
639
|
> {
|
|
645
640
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
646
641
|
TestEntityThrowOtherErrorFields,
|
|
647
|
-
|
|
642
|
+
'id',
|
|
648
643
|
ViewerContext,
|
|
649
644
|
SimpleTestThrowOtherErrorEntity,
|
|
650
645
|
ThrowOtherErrorEntityPrivacyPolicy<
|
|
651
646
|
TestEntityThrowOtherErrorFields,
|
|
652
|
-
|
|
647
|
+
'id',
|
|
653
648
|
ViewerContext,
|
|
654
649
|
SimpleTestThrowOtherErrorEntity
|
|
655
650
|
>
|
|
656
651
|
> {
|
|
657
652
|
return {
|
|
658
653
|
entityClass: SimpleTestThrowOtherErrorEntity,
|
|
659
|
-
entityConfiguration: new EntityConfiguration<TestEntityThrowOtherErrorFields>({
|
|
654
|
+
entityConfiguration: new EntityConfiguration<TestEntityThrowOtherErrorFields, 'id'>({
|
|
660
655
|
idField: 'id',
|
|
661
656
|
tableName: 'blah_3',
|
|
662
657
|
inboundEdges: [],
|
|
663
658
|
schema: {
|
|
664
659
|
id: new UUIDField({
|
|
665
660
|
columnName: 'custom_id',
|
|
661
|
+
cache: false,
|
|
666
662
|
}),
|
|
667
663
|
simple_test_id: new UUIDField({
|
|
668
664
|
columnName: 'simple_test_id',
|
package/src/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.ts
CHANGED
|
@@ -12,7 +12,7 @@ import ViewerContext from '../../ViewerContext';
|
|
|
12
12
|
import AlwaysAllowPrivacyPolicyRule from '../../rules/AlwaysAllowPrivacyPolicyRule';
|
|
13
13
|
import AlwaysDenyPrivacyPolicyRule from '../../rules/AlwaysDenyPrivacyPolicyRule';
|
|
14
14
|
import { canViewerDeleteAsync } from '../EntityPrivacyUtils';
|
|
15
|
-
import { createUnitTestEntityCompanionProvider } from '../
|
|
15
|
+
import { createUnitTestEntityCompanionProvider } from '../__testfixtures__/createUnitTestEntityCompanionProvider';
|
|
16
16
|
|
|
17
17
|
describe(canViewerDeleteAsync, () => {
|
|
18
18
|
describe('edgeDeletionPermissionInferenceBehavior', () => {
|
|
@@ -97,43 +97,44 @@ type TestLeafEntityFields = {
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
class AlwaysAllowEntityPrivacyPolicy<
|
|
100
|
-
TFields extends
|
|
101
|
-
|
|
100
|
+
TFields extends Record<string, any>,
|
|
101
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
102
102
|
TViewerContext extends ViewerContext,
|
|
103
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
103
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
104
104
|
TSelectedFields extends keyof TFields = keyof TFields,
|
|
105
|
-
> extends EntityPrivacyPolicy<TFields,
|
|
105
|
+
> extends EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
106
106
|
protected override readonly readRules = [
|
|
107
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
107
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
108
108
|
];
|
|
109
109
|
protected override readonly createRules = [
|
|
110
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
110
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
111
111
|
];
|
|
112
112
|
protected override readonly updateRules = [
|
|
113
|
-
new AlwaysDenyPrivacyPolicyRule<TFields,
|
|
113
|
+
new AlwaysDenyPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
114
114
|
];
|
|
115
115
|
protected override readonly deleteRules = [
|
|
116
|
-
new AlwaysAllowPrivacyPolicyRule<TFields,
|
|
116
|
+
new AlwaysAllowPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>(),
|
|
117
117
|
];
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
class TestEntity extends Entity<TestEntityFields,
|
|
120
|
+
class TestEntity extends Entity<TestEntityFields, 'id', ViewerContext> {
|
|
121
121
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
122
122
|
TestEntityFields,
|
|
123
|
-
|
|
123
|
+
'id',
|
|
124
124
|
ViewerContext,
|
|
125
125
|
TestEntity,
|
|
126
|
-
AlwaysAllowEntityPrivacyPolicy<TestEntityFields,
|
|
126
|
+
AlwaysAllowEntityPrivacyPolicy<TestEntityFields, 'id', ViewerContext, TestEntity>
|
|
127
127
|
> {
|
|
128
128
|
return {
|
|
129
129
|
entityClass: TestEntity,
|
|
130
|
-
entityConfiguration: new EntityConfiguration<TestEntityFields>({
|
|
130
|
+
entityConfiguration: new EntityConfiguration<TestEntityFields, 'id'>({
|
|
131
131
|
idField: 'id',
|
|
132
132
|
tableName: 'blah',
|
|
133
133
|
inboundEdges: [TestLeafEntity, TestLeafLookupByFieldEntity, TestLeafNoInferenceEntity],
|
|
134
134
|
schema: {
|
|
135
135
|
id: new UUIDField({
|
|
136
136
|
columnName: 'custom_id',
|
|
137
|
+
cache: false,
|
|
137
138
|
}),
|
|
138
139
|
},
|
|
139
140
|
databaseAdapterFlavor: 'postgres',
|
|
@@ -144,22 +145,23 @@ class TestEntity extends Entity<TestEntityFields, string, ViewerContext> {
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
class TestLeafEntity extends Entity<TestLeafEntityFields,
|
|
148
|
+
class TestLeafEntity extends Entity<TestLeafEntityFields, 'id', ViewerContext> {
|
|
148
149
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
149
150
|
TestLeafEntityFields,
|
|
150
|
-
|
|
151
|
+
'id',
|
|
151
152
|
ViewerContext,
|
|
152
153
|
TestLeafEntity,
|
|
153
|
-
AlwaysAllowEntityPrivacyPolicy<TestLeafEntityFields,
|
|
154
|
+
AlwaysAllowEntityPrivacyPolicy<TestLeafEntityFields, 'id', ViewerContext, TestLeafEntity>
|
|
154
155
|
> {
|
|
155
156
|
return {
|
|
156
157
|
entityClass: TestLeafEntity,
|
|
157
|
-
entityConfiguration: new EntityConfiguration<TestLeafEntityFields>({
|
|
158
|
+
entityConfiguration: new EntityConfiguration<TestLeafEntityFields, 'id'>({
|
|
158
159
|
idField: 'id',
|
|
159
160
|
tableName: 'blah_2',
|
|
160
161
|
schema: {
|
|
161
162
|
id: new UUIDField({
|
|
162
163
|
columnName: 'custom_id',
|
|
164
|
+
cache: false,
|
|
163
165
|
}),
|
|
164
166
|
test_entity_id: new UUIDField({
|
|
165
167
|
columnName: 'test_entity_id',
|
|
@@ -179,22 +181,23 @@ class TestLeafEntity extends Entity<TestLeafEntityFields, string, ViewerContext>
|
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
class TestLeafLookupByFieldEntity extends Entity<TestLeafEntityFields,
|
|
184
|
+
class TestLeafLookupByFieldEntity extends Entity<TestLeafEntityFields, 'id', ViewerContext> {
|
|
183
185
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
184
186
|
TestLeafEntityFields,
|
|
185
|
-
|
|
187
|
+
'id',
|
|
186
188
|
ViewerContext,
|
|
187
189
|
TestLeafEntity,
|
|
188
|
-
AlwaysAllowEntityPrivacyPolicy<TestLeafEntityFields,
|
|
190
|
+
AlwaysAllowEntityPrivacyPolicy<TestLeafEntityFields, 'id', ViewerContext, TestLeafEntity>
|
|
189
191
|
> {
|
|
190
192
|
return {
|
|
191
193
|
entityClass: TestLeafEntity,
|
|
192
|
-
entityConfiguration: new EntityConfiguration<TestLeafEntityFields>({
|
|
194
|
+
entityConfiguration: new EntityConfiguration<TestLeafEntityFields, 'id'>({
|
|
193
195
|
idField: 'id',
|
|
194
196
|
tableName: 'blah_4',
|
|
195
197
|
schema: {
|
|
196
198
|
id: new UUIDField({
|
|
197
199
|
columnName: 'custom_id',
|
|
200
|
+
cache: false,
|
|
198
201
|
}),
|
|
199
202
|
test_entity_id: new UUIDField({
|
|
200
203
|
columnName: 'test_entity_id',
|
|
@@ -215,27 +218,28 @@ class TestLeafLookupByFieldEntity extends Entity<TestLeafEntityFields, string, V
|
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
|
|
218
|
-
class TestLeafNoInferenceEntity extends Entity<TestLeafEntityFields,
|
|
221
|
+
class TestLeafNoInferenceEntity extends Entity<TestLeafEntityFields, 'id', ViewerContext> {
|
|
219
222
|
static defineCompanionDefinition(): EntityCompanionDefinition<
|
|
220
223
|
TestLeafEntityFields,
|
|
221
|
-
|
|
224
|
+
'id',
|
|
222
225
|
ViewerContext,
|
|
223
226
|
TestLeafNoInferenceEntity,
|
|
224
227
|
AlwaysAllowEntityPrivacyPolicy<
|
|
225
228
|
TestLeafEntityFields,
|
|
226
|
-
|
|
229
|
+
'id',
|
|
227
230
|
ViewerContext,
|
|
228
231
|
TestLeafNoInferenceEntity
|
|
229
232
|
>
|
|
230
233
|
> {
|
|
231
234
|
return {
|
|
232
235
|
entityClass: TestLeafNoInferenceEntity,
|
|
233
|
-
entityConfiguration: new EntityConfiguration<TestLeafEntityFields>({
|
|
236
|
+
entityConfiguration: new EntityConfiguration<TestLeafEntityFields, 'id'>({
|
|
234
237
|
idField: 'id',
|
|
235
238
|
tableName: 'blah_3',
|
|
236
239
|
schema: {
|
|
237
240
|
id: new UUIDField({
|
|
238
241
|
columnName: 'custom_id',
|
|
242
|
+
cache: false,
|
|
239
243
|
}),
|
|
240
244
|
test_entity_id: new UUIDField({
|
|
241
245
|
columnName: 'test_entity_id',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestMutationTrigger } from '
|
|
1
|
+
import { TestMutationTrigger } from '../__testfixtures__/TestEntityWithMutationTriggers';
|
|
2
2
|
import { mergeEntityMutationTriggerConfigurations } from '../mergeEntityMutationTriggerConfigurations';
|
|
3
3
|
|
|
4
4
|
describe(mergeEntityMutationTriggerConfigurations, () => {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A serializable object. The serialized value is used to determine equality.
|
|
3
|
+
*/
|
|
4
|
+
export interface ISerializable<TSerialized> {
|
|
5
|
+
serialize(): TSerialized;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A map with keys that are serializable. Serialized keys are considered equal if their serialized values are equal.
|
|
10
|
+
* Otherwise, the map behaves like a regular Map.
|
|
11
|
+
*/
|
|
12
|
+
export abstract class SerializableKeyMap<TSerialized, K extends ISerializable<TSerialized>, V>
|
|
13
|
+
implements ReadonlyMap<K, V>, Map<K, V>
|
|
14
|
+
{
|
|
15
|
+
protected readonly underlyingMap: Map<TSerialized, V>;
|
|
16
|
+
|
|
17
|
+
constructor(iterable?: Iterable<readonly [K, V]> | null) {
|
|
18
|
+
this.underlyingMap = new Map(
|
|
19
|
+
Array.from(iterable ?? []).map(([key, value]) => [key.serialize(), value]),
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
protected abstract deserializeKey(serializedKey: TSerialized): K;
|
|
24
|
+
|
|
25
|
+
forEach(
|
|
26
|
+
callbackfn: (value: V, key: K, map: SerializableKeyMap<TSerialized, K, V>) => void,
|
|
27
|
+
thisArg?: any,
|
|
28
|
+
): void {
|
|
29
|
+
this.underlyingMap.forEach((value, key) => {
|
|
30
|
+
callbackfn.call(thisArg, value, this.deserializeKey(key), this);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get(key: K): V | undefined {
|
|
35
|
+
return this.underlyingMap.get(key.serialize());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
has(key: K): boolean {
|
|
39
|
+
return this.underlyingMap.has(key.serialize());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
clear(): void {
|
|
43
|
+
this.underlyingMap.clear();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
delete(key: K): boolean {
|
|
47
|
+
return this.underlyingMap.delete(key.serialize());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
set(key: K, value: V): this {
|
|
51
|
+
this.underlyingMap.set(key.serialize(), value);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get size(): number {
|
|
56
|
+
return this.underlyingMap.size;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
*entries(): MapIterator<[K, V]> {
|
|
60
|
+
for (const [key, value] of this.underlyingMap.entries()) {
|
|
61
|
+
yield [this.deserializeKey(key), value];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
*keys(): MapIterator<K> {
|
|
66
|
+
for (const key of this.underlyingMap.keys()) {
|
|
67
|
+
yield this.deserializeKey(key);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
*values(): MapIterator<V> {
|
|
72
|
+
for (const value of this.underlyingMap.values()) {
|
|
73
|
+
yield value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[Symbol.iterator](): MapIterator<[K, V]> {
|
|
78
|
+
return this.entries();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
get [Symbol.toStringTag](): string {
|
|
82
|
+
return 'SerializableKeyMap';
|
|
83
|
+
}
|
|
84
|
+
}
|