@expo/entity 0.41.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.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
|
@@ -15,16 +15,16 @@ import { enforceResultsAsync } from './entityUtils';
|
|
|
15
15
|
* by foreign keys.
|
|
16
16
|
*/
|
|
17
17
|
export default class EnforcingEntityAssociationLoader<
|
|
18
|
-
TFields extends
|
|
19
|
-
|
|
18
|
+
TFields extends Record<string, any>,
|
|
19
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
20
20
|
TViewerContext extends ViewerContext,
|
|
21
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
21
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
22
22
|
TSelectedFields extends keyof TFields,
|
|
23
23
|
> {
|
|
24
24
|
constructor(
|
|
25
25
|
private readonly authorizationResultBasedEntityAssociationLoader: AuthorizationResultBasedEntityAssociationLoader<
|
|
26
26
|
TFields,
|
|
27
|
-
|
|
27
|
+
TIDField,
|
|
28
28
|
TViewerContext,
|
|
29
29
|
TEntity,
|
|
30
30
|
TSelectedFields
|
|
@@ -40,16 +40,18 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
40
40
|
async loadAssociatedEntityAsync<
|
|
41
41
|
TIdentifyingField extends keyof Pick<TFields, TSelectedFields>,
|
|
42
42
|
TAssociatedFields extends object,
|
|
43
|
-
|
|
43
|
+
TAssociatedIDField extends keyof NonNullable<
|
|
44
|
+
Pick<TAssociatedFields, TAssociatedSelectedFields>
|
|
45
|
+
>,
|
|
44
46
|
TAssociatedEntity extends ReadonlyEntity<
|
|
45
47
|
TAssociatedFields,
|
|
46
|
-
|
|
48
|
+
TAssociatedIDField,
|
|
47
49
|
TViewerContext,
|
|
48
50
|
TAssociatedSelectedFields
|
|
49
51
|
>,
|
|
50
52
|
TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<
|
|
51
53
|
TAssociatedFields,
|
|
52
|
-
|
|
54
|
+
TAssociatedIDField,
|
|
53
55
|
TViewerContext,
|
|
54
56
|
TAssociatedEntity,
|
|
55
57
|
TAssociatedSelectedFields
|
|
@@ -59,7 +61,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
59
61
|
fieldIdentifyingAssociatedEntity: TIdentifyingField,
|
|
60
62
|
associatedEntityClass: IEntityClass<
|
|
61
63
|
TAssociatedFields,
|
|
62
|
-
|
|
64
|
+
TAssociatedIDField,
|
|
63
65
|
TViewerContext,
|
|
64
66
|
TAssociatedEntity,
|
|
65
67
|
TAssociatedPrivacyPolicy,
|
|
@@ -86,16 +88,18 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
86
88
|
*/
|
|
87
89
|
async loadManyAssociatedEntitiesAsync<
|
|
88
90
|
TAssociatedFields extends object,
|
|
89
|
-
|
|
91
|
+
TAssociatedIDField extends keyof NonNullable<
|
|
92
|
+
Pick<TAssociatedFields, TAssociatedSelectedFields>
|
|
93
|
+
>,
|
|
90
94
|
TAssociatedEntity extends ReadonlyEntity<
|
|
91
95
|
TAssociatedFields,
|
|
92
|
-
|
|
96
|
+
TAssociatedIDField,
|
|
93
97
|
TViewerContext,
|
|
94
98
|
TAssociatedSelectedFields
|
|
95
99
|
>,
|
|
96
100
|
TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<
|
|
97
101
|
TAssociatedFields,
|
|
98
|
-
|
|
102
|
+
TAssociatedIDField,
|
|
99
103
|
TViewerContext,
|
|
100
104
|
TAssociatedEntity,
|
|
101
105
|
TAssociatedSelectedFields
|
|
@@ -104,7 +108,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
104
108
|
>(
|
|
105
109
|
associatedEntityClass: IEntityClass<
|
|
106
110
|
TAssociatedFields,
|
|
107
|
-
|
|
111
|
+
TAssociatedIDField,
|
|
108
112
|
TViewerContext,
|
|
109
113
|
TAssociatedEntity,
|
|
110
114
|
TAssociatedPrivacyPolicy,
|
|
@@ -129,16 +133,18 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
129
133
|
*/
|
|
130
134
|
async loadAssociatedEntityByFieldEqualingAsync<
|
|
131
135
|
TAssociatedFields extends object,
|
|
132
|
-
|
|
136
|
+
TAssociatedIDField extends keyof NonNullable<
|
|
137
|
+
Pick<TAssociatedFields, TAssociatedSelectedFields>
|
|
138
|
+
>,
|
|
133
139
|
TAssociatedEntity extends ReadonlyEntity<
|
|
134
140
|
TAssociatedFields,
|
|
135
|
-
|
|
141
|
+
TAssociatedIDField,
|
|
136
142
|
TViewerContext,
|
|
137
143
|
TAssociatedSelectedFields
|
|
138
144
|
>,
|
|
139
145
|
TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<
|
|
140
146
|
TAssociatedFields,
|
|
141
|
-
|
|
147
|
+
TAssociatedIDField,
|
|
142
148
|
TViewerContext,
|
|
143
149
|
TAssociatedEntity,
|
|
144
150
|
TAssociatedSelectedFields
|
|
@@ -148,7 +154,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
148
154
|
fieldIdentifyingAssociatedEntity: keyof Pick<TFields, TSelectedFields>,
|
|
149
155
|
associatedEntityClass: IEntityClass<
|
|
150
156
|
TAssociatedFields,
|
|
151
|
-
|
|
157
|
+
TAssociatedIDField,
|
|
152
158
|
TViewerContext,
|
|
153
159
|
TAssociatedEntity,
|
|
154
160
|
TAssociatedPrivacyPolicy,
|
|
@@ -174,16 +180,18 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
174
180
|
*/
|
|
175
181
|
async loadManyAssociatedEntitiesByFieldEqualingAsync<
|
|
176
182
|
TAssociatedFields extends object,
|
|
177
|
-
|
|
183
|
+
TAssociatedIDField extends keyof NonNullable<
|
|
184
|
+
Pick<TAssociatedFields, TAssociatedSelectedFields>
|
|
185
|
+
>,
|
|
178
186
|
TAssociatedEntity extends ReadonlyEntity<
|
|
179
187
|
TAssociatedFields,
|
|
180
|
-
|
|
188
|
+
TAssociatedIDField,
|
|
181
189
|
TViewerContext,
|
|
182
190
|
TAssociatedSelectedFields
|
|
183
191
|
>,
|
|
184
192
|
TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<
|
|
185
193
|
TAssociatedFields,
|
|
186
|
-
|
|
194
|
+
TAssociatedIDField,
|
|
187
195
|
TViewerContext,
|
|
188
196
|
TAssociatedEntity,
|
|
189
197
|
TAssociatedSelectedFields
|
|
@@ -193,7 +201,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
193
201
|
fieldIdentifyingAssociatedEntity: keyof Pick<TFields, TSelectedFields>,
|
|
194
202
|
associatedEntityClass: IEntityClass<
|
|
195
203
|
TAssociatedFields,
|
|
196
|
-
|
|
204
|
+
TAssociatedIDField,
|
|
197
205
|
TViewerContext,
|
|
198
206
|
TAssociatedEntity,
|
|
199
207
|
TAssociatedPrivacyPolicy,
|
|
@@ -217,11 +225,11 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
217
225
|
*/
|
|
218
226
|
async loadAssociatedEntityThroughAsync<
|
|
219
227
|
TFields2 extends object,
|
|
220
|
-
|
|
221
|
-
TEntity2 extends ReadonlyEntity<TFields2,
|
|
228
|
+
TIDField2 extends keyof NonNullable<Pick<TFields2, TSelectedFields2>>,
|
|
229
|
+
TEntity2 extends ReadonlyEntity<TFields2, TIDField2, TViewerContext, TSelectedFields2>,
|
|
222
230
|
TPrivacyPolicy2 extends EntityPrivacyPolicy<
|
|
223
231
|
TFields2,
|
|
224
|
-
|
|
232
|
+
TIDField2,
|
|
225
233
|
TViewerContext,
|
|
226
234
|
TEntity2,
|
|
227
235
|
TSelectedFields2
|
|
@@ -233,7 +241,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
233
241
|
TViewerContext,
|
|
234
242
|
TFields,
|
|
235
243
|
TFields2,
|
|
236
|
-
|
|
244
|
+
TIDField2,
|
|
237
245
|
TEntity2,
|
|
238
246
|
TPrivacyPolicy2,
|
|
239
247
|
TSelectedFields,
|
|
@@ -249,21 +257,21 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
249
257
|
*/
|
|
250
258
|
async loadAssociatedEntityThroughAsync<
|
|
251
259
|
TFields2 extends object,
|
|
252
|
-
|
|
253
|
-
TEntity2 extends ReadonlyEntity<TFields2,
|
|
260
|
+
TIDField2 extends keyof NonNullable<Pick<TFields2, TSelectedFields2>>,
|
|
261
|
+
TEntity2 extends ReadonlyEntity<TFields2, TIDField2, TViewerContext, TSelectedFields2>,
|
|
254
262
|
TPrivacyPolicy2 extends EntityPrivacyPolicy<
|
|
255
263
|
TFields2,
|
|
256
|
-
|
|
264
|
+
TIDField2,
|
|
257
265
|
TViewerContext,
|
|
258
266
|
TEntity2,
|
|
259
267
|
TSelectedFields2
|
|
260
268
|
>,
|
|
261
269
|
TFields3 extends object,
|
|
262
|
-
|
|
263
|
-
TEntity3 extends ReadonlyEntity<TFields3,
|
|
270
|
+
TIDField3 extends keyof NonNullable<Pick<TFields3, TSelectedFields3>>,
|
|
271
|
+
TEntity3 extends ReadonlyEntity<TFields3, TIDField3, TViewerContext, TSelectedFields3>,
|
|
264
272
|
TPrivacyPolicy3 extends EntityPrivacyPolicy<
|
|
265
273
|
TFields3,
|
|
266
|
-
|
|
274
|
+
TIDField3,
|
|
267
275
|
TViewerContext,
|
|
268
276
|
TEntity3,
|
|
269
277
|
TSelectedFields3
|
|
@@ -276,7 +284,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
276
284
|
TViewerContext,
|
|
277
285
|
TFields,
|
|
278
286
|
TFields2,
|
|
279
|
-
|
|
287
|
+
TIDField2,
|
|
280
288
|
TEntity2,
|
|
281
289
|
TPrivacyPolicy2,
|
|
282
290
|
TSelectedFields,
|
|
@@ -286,7 +294,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
286
294
|
TViewerContext,
|
|
287
295
|
TFields2,
|
|
288
296
|
TFields3,
|
|
289
|
-
|
|
297
|
+
TIDField3,
|
|
290
298
|
TEntity3,
|
|
291
299
|
TPrivacyPolicy3,
|
|
292
300
|
TSelectedFields2,
|
|
@@ -302,31 +310,31 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
302
310
|
*/
|
|
303
311
|
async loadAssociatedEntityThroughAsync<
|
|
304
312
|
TFields2 extends object,
|
|
305
|
-
|
|
306
|
-
TEntity2 extends ReadonlyEntity<TFields2,
|
|
313
|
+
TIDField2 extends keyof NonNullable<Pick<TFields2, TSelectedFields2>>,
|
|
314
|
+
TEntity2 extends ReadonlyEntity<TFields2, TIDField2, TViewerContext, TSelectedFields2>,
|
|
307
315
|
TPrivacyPolicy2 extends EntityPrivacyPolicy<
|
|
308
316
|
TFields2,
|
|
309
|
-
|
|
317
|
+
TIDField2,
|
|
310
318
|
TViewerContext,
|
|
311
319
|
TEntity2,
|
|
312
320
|
TSelectedFields2
|
|
313
321
|
>,
|
|
314
322
|
TFields3 extends object,
|
|
315
|
-
|
|
316
|
-
TEntity3 extends ReadonlyEntity<TFields3,
|
|
323
|
+
TIDField3 extends keyof NonNullable<Pick<TFields3, TSelectedFields3>>,
|
|
324
|
+
TEntity3 extends ReadonlyEntity<TFields3, TIDField3, TViewerContext, TSelectedFields3>,
|
|
317
325
|
TPrivacyPolicy3 extends EntityPrivacyPolicy<
|
|
318
326
|
TFields3,
|
|
319
|
-
|
|
327
|
+
TIDField3,
|
|
320
328
|
TViewerContext,
|
|
321
329
|
TEntity3,
|
|
322
330
|
TSelectedFields3
|
|
323
331
|
>,
|
|
324
332
|
TFields4 extends object,
|
|
325
|
-
|
|
326
|
-
TEntity4 extends ReadonlyEntity<TFields4,
|
|
333
|
+
TIDField4 extends keyof NonNullable<Pick<TFields4, TSelectedFields4>>,
|
|
334
|
+
TEntity4 extends ReadonlyEntity<TFields4, TIDField4, TViewerContext, TSelectedFields4>,
|
|
327
335
|
TPrivacyPolicy4 extends EntityPrivacyPolicy<
|
|
328
336
|
TFields4,
|
|
329
|
-
|
|
337
|
+
TIDField4,
|
|
330
338
|
TViewerContext,
|
|
331
339
|
TEntity4,
|
|
332
340
|
TSelectedFields4
|
|
@@ -340,7 +348,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
340
348
|
TViewerContext,
|
|
341
349
|
TFields,
|
|
342
350
|
TFields2,
|
|
343
|
-
|
|
351
|
+
TIDField2,
|
|
344
352
|
TEntity2,
|
|
345
353
|
TPrivacyPolicy2,
|
|
346
354
|
TSelectedFields,
|
|
@@ -350,7 +358,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
350
358
|
TViewerContext,
|
|
351
359
|
TFields2,
|
|
352
360
|
TFields3,
|
|
353
|
-
|
|
361
|
+
TIDField3,
|
|
354
362
|
TEntity3,
|
|
355
363
|
TPrivacyPolicy3,
|
|
356
364
|
TSelectedFields2,
|
|
@@ -360,7 +368,7 @@ export default class EnforcingEntityAssociationLoader<
|
|
|
360
368
|
TViewerContext,
|
|
361
369
|
TFields3,
|
|
362
370
|
TFields4,
|
|
363
|
-
|
|
371
|
+
TIDField4,
|
|
364
372
|
TEntity4,
|
|
365
373
|
TPrivacyPolicy4,
|
|
366
374
|
TSelectedFields3,
|
|
@@ -10,13 +10,13 @@ import ViewerContext from './ViewerContext';
|
|
|
10
10
|
* through this creator will throw if authorization is not successful.
|
|
11
11
|
*/
|
|
12
12
|
export default class EnforcingEntityCreator<
|
|
13
|
-
TFields extends
|
|
14
|
-
|
|
13
|
+
TFields extends Record<string, any>,
|
|
14
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
15
15
|
TViewerContext extends ViewerContext,
|
|
16
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
16
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
17
17
|
TPrivacyPolicy extends EntityPrivacyPolicy<
|
|
18
18
|
TFields,
|
|
19
|
-
|
|
19
|
+
TIDField,
|
|
20
20
|
TViewerContext,
|
|
21
21
|
TEntity,
|
|
22
22
|
TSelectedFields
|
|
@@ -26,7 +26,7 @@ export default class EnforcingEntityCreator<
|
|
|
26
26
|
constructor(
|
|
27
27
|
private readonly entityCreator: AuthorizationResultBasedCreateMutator<
|
|
28
28
|
TFields,
|
|
29
|
-
|
|
29
|
+
TIDField,
|
|
30
30
|
TViewerContext,
|
|
31
31
|
TEntity,
|
|
32
32
|
TPrivacyPolicy,
|
|
@@ -10,13 +10,13 @@ import ViewerContext from './ViewerContext';
|
|
|
10
10
|
* through this deleter will throw if authorization is not successful.
|
|
11
11
|
*/
|
|
12
12
|
export default class EnforcingEntityDeleter<
|
|
13
|
-
TFields extends
|
|
14
|
-
|
|
13
|
+
TFields extends Record<string, any>,
|
|
14
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
15
15
|
TViewerContext extends ViewerContext,
|
|
16
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
16
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
17
17
|
TPrivacyPolicy extends EntityPrivacyPolicy<
|
|
18
18
|
TFields,
|
|
19
|
-
|
|
19
|
+
TIDField,
|
|
20
20
|
TViewerContext,
|
|
21
21
|
TEntity,
|
|
22
22
|
TSelectedFields
|
|
@@ -26,7 +26,7 @@ export default class EnforcingEntityDeleter<
|
|
|
26
26
|
constructor(
|
|
27
27
|
private readonly entityDeleter: AuthorizationResultBasedDeleteMutator<
|
|
28
28
|
TFields,
|
|
29
|
-
|
|
29
|
+
TIDField,
|
|
30
30
|
TViewerContext,
|
|
31
31
|
TEntity,
|
|
32
32
|
TPrivacyPolicy,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import AuthorizationResultBasedEntityLoader from './AuthorizationResultBasedEntityLoader';
|
|
2
|
+
import { EntityCompositeField, EntityCompositeFieldValue } from './EntityConfiguration';
|
|
2
3
|
import {
|
|
3
4
|
FieldEqualityCondition,
|
|
4
5
|
QuerySelectionModifiers,
|
|
@@ -7,6 +8,8 @@ import {
|
|
|
7
8
|
import EntityPrivacyPolicy from './EntityPrivacyPolicy';
|
|
8
9
|
import ReadonlyEntity from './ReadonlyEntity';
|
|
9
10
|
import ViewerContext from './ViewerContext';
|
|
11
|
+
import { CompositeFieldValueHolder } from './internal/CompositeFieldHolder';
|
|
12
|
+
import { CompositeFieldValueMap } from './internal/CompositeFieldValueMap';
|
|
10
13
|
import { mapMap } from './utils/collections/maps';
|
|
11
14
|
|
|
12
15
|
/**
|
|
@@ -15,13 +18,13 @@ import { mapMap } from './utils/collections/maps';
|
|
|
15
18
|
* through this loader will throw if the load is not successful.
|
|
16
19
|
*/
|
|
17
20
|
export default class EnforcingEntityLoader<
|
|
18
|
-
TFields extends
|
|
19
|
-
|
|
21
|
+
TFields extends Record<string, any>,
|
|
22
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
20
23
|
TViewerContext extends ViewerContext,
|
|
21
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
24
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
22
25
|
TPrivacyPolicy extends EntityPrivacyPolicy<
|
|
23
26
|
TFields,
|
|
24
|
-
|
|
27
|
+
TIDField,
|
|
25
28
|
TViewerContext,
|
|
26
29
|
TEntity,
|
|
27
30
|
TSelectedFields
|
|
@@ -31,7 +34,7 @@ export default class EnforcingEntityLoader<
|
|
|
31
34
|
constructor(
|
|
32
35
|
private readonly entityLoader: AuthorizationResultBasedEntityLoader<
|
|
33
36
|
TFields,
|
|
34
|
-
|
|
37
|
+
TIDField,
|
|
35
38
|
TViewerContext,
|
|
36
39
|
TEntity,
|
|
37
40
|
TPrivacyPolicy,
|
|
@@ -40,7 +43,10 @@ export default class EnforcingEntityLoader<
|
|
|
40
43
|
) {}
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
|
-
*
|
|
46
|
+
* Load many entities where fieldName is one of fieldValues.
|
|
47
|
+
* @param fieldName - entity field being queried
|
|
48
|
+
* @param fieldValues - fieldName field values being queried
|
|
49
|
+
* @returns map from fieldValue to entities that match the query for that fieldValue
|
|
44
50
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
45
51
|
*/
|
|
46
52
|
async loadManyByFieldEqualingManyAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
@@ -57,7 +63,39 @@ export default class EnforcingEntityLoader<
|
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
/**
|
|
60
|
-
*
|
|
66
|
+
* Load many entities where compositeField is one of compositeFieldValues.
|
|
67
|
+
* @param compositeField - composite field being queried
|
|
68
|
+
* @param compositeFieldValues - compositeField values being queried
|
|
69
|
+
* @returns map from compositeFieldValue to entities that match the query for that compositeFieldValue
|
|
70
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
71
|
+
*/
|
|
72
|
+
async loadManyByCompositeFieldEqualingManyAsync<
|
|
73
|
+
N extends EntityCompositeField<Pick<TFields, TSelectedFields>>,
|
|
74
|
+
>(
|
|
75
|
+
compositeField: N,
|
|
76
|
+
compositeFieldValues: readonly EntityCompositeFieldValue<Pick<TFields, TSelectedFields>, N>[],
|
|
77
|
+
): Promise<ReadonlyMap<EntityCompositeFieldValue<TFields, N>, readonly TEntity[]>> {
|
|
78
|
+
const compositeFieldValuesToResults =
|
|
79
|
+
await this.entityLoader.loadManyByCompositeFieldEqualingManyAsync(
|
|
80
|
+
compositeField,
|
|
81
|
+
compositeFieldValues,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
return new CompositeFieldValueMap(
|
|
85
|
+
Array.from(compositeFieldValuesToResults.entries()).map(([compositeFieldValue, results]) => {
|
|
86
|
+
return [
|
|
87
|
+
new CompositeFieldValueHolder(compositeFieldValue),
|
|
88
|
+
results.map((result) => result.enforceValue()),
|
|
89
|
+
];
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Load many entities where fieldName equals fieldValue.
|
|
96
|
+
* @param fieldName - entity field being queried
|
|
97
|
+
* @param fieldValue - fieldName field value being queried
|
|
98
|
+
* @returns array of entities that match the query for fieldValue
|
|
61
99
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
62
100
|
*/
|
|
63
101
|
async loadManyByFieldEqualingAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
@@ -72,9 +110,32 @@ export default class EnforcingEntityLoader<
|
|
|
72
110
|
}
|
|
73
111
|
|
|
74
112
|
/**
|
|
75
|
-
*
|
|
113
|
+
* Load many entities where compositeField equals compositeFieldValue.
|
|
114
|
+
* @param compositeField - composite field being queried
|
|
115
|
+
* @param compositeFieldValue - compositeField value being queried
|
|
116
|
+
* @returns array of entities that match the query for compositeFieldValue
|
|
117
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
118
|
+
*/
|
|
119
|
+
async loadManyByCompositeFieldEqualingAsync<
|
|
120
|
+
N extends EntityCompositeField<Pick<TFields, TSelectedFields>>,
|
|
121
|
+
>(
|
|
122
|
+
compositeField: N,
|
|
123
|
+
compositeFieldValue: EntityCompositeFieldValue<Pick<TFields, TSelectedFields>, N>,
|
|
124
|
+
): Promise<readonly TEntity[]> {
|
|
125
|
+
const entityResults = await this.entityLoader.loadManyByCompositeFieldEqualingAsync(
|
|
126
|
+
compositeField,
|
|
127
|
+
compositeFieldValue,
|
|
128
|
+
);
|
|
129
|
+
return entityResults.map((result) => result.enforceValue());
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Load an entity where fieldName equals fieldValue, or null if no entity exists.
|
|
134
|
+
* @param uniqueFieldName - entity field being queried
|
|
135
|
+
* @param fieldValue - uniqueFieldName field value being queried
|
|
136
|
+
* @returns entity where uniqueFieldName equals fieldValue, or null if no entity matches the condition.
|
|
137
|
+
* @throws when multiple entities match the condition
|
|
76
138
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
77
|
-
* @throws when multiple entities are found matching the condition
|
|
78
139
|
*/
|
|
79
140
|
async loadByFieldEqualingAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
80
141
|
uniqueFieldName: N,
|
|
@@ -88,45 +149,90 @@ export default class EnforcingEntityLoader<
|
|
|
88
149
|
}
|
|
89
150
|
|
|
90
151
|
/**
|
|
91
|
-
*
|
|
152
|
+
* Load an entity where compositeField equals compositeFieldValue, or null if no entity exists.
|
|
153
|
+
* @param compositeField - composite field being queried
|
|
154
|
+
* @param compositeFieldValue - compositeField value being queried
|
|
155
|
+
* @returns entity where compositeField equals compositeFieldValue, or null if no entity matches the condition.
|
|
156
|
+
* @throws when multiple entities match the condition
|
|
92
157
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
93
158
|
*/
|
|
94
|
-
async
|
|
159
|
+
async loadByCompositeFieldEqualingAsync<
|
|
160
|
+
N extends EntityCompositeField<Pick<TFields, TSelectedFields>>,
|
|
161
|
+
>(
|
|
162
|
+
compositeField: N,
|
|
163
|
+
compositeFieldValue: EntityCompositeFieldValue<Pick<TFields, TSelectedFields>, N>,
|
|
164
|
+
): Promise<TEntity | null> {
|
|
165
|
+
const entityResult = await this.entityLoader.loadByCompositeFieldEqualingAsync(
|
|
166
|
+
compositeField,
|
|
167
|
+
compositeFieldValue,
|
|
168
|
+
);
|
|
169
|
+
return entityResult ? entityResult.enforceValue() : null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Loads an entity by a specified ID.
|
|
174
|
+
* @param id - ID of the entity
|
|
175
|
+
* @returns entity matching ID
|
|
176
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
177
|
+
* @throws EntityNotFoundError when no entity exists for ID
|
|
178
|
+
*/
|
|
179
|
+
async loadByIDAsync(id: TFields[TIDField]): Promise<TEntity> {
|
|
95
180
|
const entityResult = await this.entityLoader.loadByIDAsync(id);
|
|
96
181
|
return entityResult.enforceValue();
|
|
97
182
|
}
|
|
98
183
|
|
|
99
184
|
/**
|
|
100
|
-
*
|
|
185
|
+
* Load an entity by a specified ID, or return null if non-existent.
|
|
186
|
+
* @param id - ID of the entity
|
|
187
|
+
* @returns entity for matching ID, or null if no entity exists for ID.
|
|
101
188
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
102
189
|
* @throws when multiple entities are found matching the condition
|
|
103
190
|
*/
|
|
104
|
-
async loadByIDNullableAsync(id:
|
|
191
|
+
async loadByIDNullableAsync(id: TFields[TIDField]): Promise<TEntity | null> {
|
|
105
192
|
const entityResult = await this.entityLoader.loadByIDNullableAsync(id);
|
|
106
193
|
return entityResult ? entityResult.enforceValue() : null;
|
|
107
194
|
}
|
|
108
195
|
|
|
109
196
|
/**
|
|
110
|
-
*
|
|
197
|
+
* Loads many entities for a list of IDs.
|
|
198
|
+
* @param ids - IDs of the entities to load
|
|
199
|
+
* @returns map from ID to corresponding entity result, where result error can be UnauthorizedError or EntityNotFoundError.
|
|
111
200
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
201
|
+
* @throws EntityNotFoundError when no entity exists for one or more of the IDs
|
|
112
202
|
*/
|
|
113
|
-
async loadManyByIDsAsync(
|
|
203
|
+
async loadManyByIDsAsync(
|
|
204
|
+
ids: readonly TFields[TIDField][],
|
|
205
|
+
): Promise<ReadonlyMap<TFields[TIDField], TEntity>> {
|
|
114
206
|
const entityResults = await this.entityLoader.loadManyByIDsAsync(ids);
|
|
115
207
|
return mapMap(entityResults, (result) => result.enforceValue());
|
|
116
208
|
}
|
|
117
209
|
|
|
118
210
|
/**
|
|
119
|
-
*
|
|
211
|
+
* Loads many entities for a list of IDs, returning null for any IDs that are non-existent.
|
|
212
|
+
* @param ids - IDs of the entities to load
|
|
213
|
+
* @returns map from ID to nullable corresponding entity
|
|
120
214
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
121
215
|
*/
|
|
122
|
-
async loadManyByIDsNullableAsync(
|
|
216
|
+
async loadManyByIDsNullableAsync(
|
|
217
|
+
ids: readonly TFields[TIDField][],
|
|
218
|
+
): Promise<ReadonlyMap<TFields[TIDField], TEntity | null>> {
|
|
123
219
|
const entityResults = await this.entityLoader.loadManyByIDsNullableAsync(ids);
|
|
124
220
|
return mapMap(entityResults, (result) => result?.enforceValue() ?? null);
|
|
125
221
|
}
|
|
126
222
|
|
|
127
223
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
224
|
+
* Loads the first entity matching the selection constructed from the conjunction of specified
|
|
225
|
+
* operands, or null if no matching entity exists. Entities loaded using this method are not
|
|
226
|
+
* batched or cached.
|
|
227
|
+
*
|
|
228
|
+
* This is a convenience method for {@link loadManyByFieldEqualityConjunctionAsync}. However, the
|
|
229
|
+
* `orderBy` option must be specified to define what "first" means. If ordering doesn't matter,
|
|
230
|
+
* explicitly pass in an empty array.
|
|
231
|
+
*
|
|
232
|
+
* @param fieldEqualityOperands - list of field equality selection operand specifications
|
|
233
|
+
* @param querySelectionModifiers - orderBy and optional offset for the query
|
|
234
|
+
* @returns the first entity that matches the query or null if no entity matches the query
|
|
235
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
130
236
|
*/
|
|
131
237
|
async loadFirstByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
132
238
|
fieldEqualityOperands: FieldEqualityCondition<TFields, N>[],
|
|
@@ -141,7 +247,18 @@ export default class EnforcingEntityLoader<
|
|
|
141
247
|
}
|
|
142
248
|
|
|
143
249
|
/**
|
|
144
|
-
*
|
|
250
|
+
* Loads many entities matching the selection constructed from the conjunction of specified operands.
|
|
251
|
+
* Entities loaded using this method are not batched or cached.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* fieldEqualityOperands:
|
|
255
|
+
* `[{fieldName: 'hello', fieldValue: 1}, {fieldName: 'world', fieldValues: [2, 3]}]`
|
|
256
|
+
* Entities returned with a SQL EntityDatabaseAdapter:
|
|
257
|
+
* `WHERE hello = 1 AND world = ANY({2, 3})`
|
|
258
|
+
*
|
|
259
|
+
* @param fieldEqualityOperands - list of field equality selection operand specifications
|
|
260
|
+
* @param querySelectionModifiers - limit, offset, and orderBy for the query
|
|
261
|
+
* @returns array of entities that match the query
|
|
145
262
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
146
263
|
*/
|
|
147
264
|
async loadManyByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
@@ -156,8 +273,28 @@ export default class EnforcingEntityLoader<
|
|
|
156
273
|
}
|
|
157
274
|
|
|
158
275
|
/**
|
|
159
|
-
*
|
|
276
|
+
* Loads many entities matching the raw WHERE clause. Corresponds to the knex `whereRaw` argument format.
|
|
277
|
+
*
|
|
278
|
+
* @remarks
|
|
279
|
+
* Important notes:
|
|
280
|
+
* - Fields in clause are database column names instead of transformed entity field names.
|
|
281
|
+
* - Entities loaded using this method are not batched or cached.
|
|
282
|
+
* - Not all database adapters implement the ability to execute this method of fetching entities.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* rawWhereClause: `id = ?`
|
|
286
|
+
* bindings: `[1]`
|
|
287
|
+
* Entites returned `WHERE id = 1`
|
|
288
|
+
*
|
|
289
|
+
* http://knexjs.org/#Builder-whereRaw
|
|
290
|
+
* http://knexjs.org/#Raw-Bindings
|
|
291
|
+
*
|
|
292
|
+
* @param rawWhereClause - parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders
|
|
293
|
+
* @param bindings - array of positional bindings or object of named bindings
|
|
294
|
+
* @param querySelectionModifiers - limit, offset, orderBy, and orderByRaw for the query
|
|
295
|
+
* @returns array of entities that match the query
|
|
160
296
|
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
297
|
+
* @throws Error when rawWhereClause or bindings are invalid
|
|
161
298
|
*/
|
|
162
299
|
async loadManyByRawWhereClauseAsync(
|
|
163
300
|
rawWhereClause: string,
|
|
@@ -10,13 +10,13 @@ import ViewerContext from './ViewerContext';
|
|
|
10
10
|
* through this updater will throw if authorization is not successful.
|
|
11
11
|
*/
|
|
12
12
|
export default class EnforcingEntityUpdater<
|
|
13
|
-
TFields extends
|
|
14
|
-
|
|
13
|
+
TFields extends Record<string, any>,
|
|
14
|
+
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
15
15
|
TViewerContext extends ViewerContext,
|
|
16
|
-
TEntity extends ReadonlyEntity<TFields,
|
|
16
|
+
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
17
17
|
TPrivacyPolicy extends EntityPrivacyPolicy<
|
|
18
18
|
TFields,
|
|
19
|
-
|
|
19
|
+
TIDField,
|
|
20
20
|
TViewerContext,
|
|
21
21
|
TEntity,
|
|
22
22
|
TSelectedFields
|
|
@@ -26,7 +26,7 @@ export default class EnforcingEntityUpdater<
|
|
|
26
26
|
constructor(
|
|
27
27
|
private readonly entityUpdater: AuthorizationResultBasedUpdateMutator<
|
|
28
28
|
TFields,
|
|
29
|
-
|
|
29
|
+
TIDField,
|
|
30
30
|
TViewerContext,
|
|
31
31
|
TEntity,
|
|
32
32
|
TPrivacyPolicy,
|