@expo/entity 0.60.0 → 0.62.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/src/AuthorizationResultBasedEntityAssociationLoader.d.ts +6 -6
- package/build/src/AuthorizationResultBasedEntityAssociationLoader.js +5 -10
- package/build/src/AuthorizationResultBasedEntityLoader.d.ts +9 -9
- package/build/src/AuthorizationResultBasedEntityLoader.js +27 -35
- package/build/src/AuthorizationResultBasedEntityMutator.d.ts +13 -13
- package/build/src/AuthorizationResultBasedEntityMutator.js +54 -65
- package/build/src/ComposedEntityCacheAdapter.d.ts +3 -3
- package/build/src/ComposedEntityCacheAdapter.js +15 -23
- package/build/src/ComposedSecondaryEntityCache.d.ts +1 -1
- package/build/src/ComposedSecondaryEntityCache.js +4 -12
- package/build/src/EnforcingEntityAssociationLoader.d.ts +5 -5
- package/build/src/EnforcingEntityAssociationLoader.js +6 -11
- package/build/src/EnforcingEntityCreator.d.ts +4 -4
- package/build/src/EnforcingEntityCreator.js +3 -8
- package/build/src/EnforcingEntityDeleter.d.ts +4 -4
- package/build/src/EnforcingEntityDeleter.js +3 -8
- package/build/src/EnforcingEntityLoader.d.ts +5 -5
- package/build/src/EnforcingEntityLoader.js +9 -14
- package/build/src/EnforcingEntityUpdater.d.ts +4 -4
- package/build/src/EnforcingEntityUpdater.js +3 -8
- package/build/src/Entity.d.ts +9 -9
- package/build/src/Entity.js +11 -16
- package/build/src/EntityAssociationLoader.d.ts +5 -5
- package/build/src/EntityAssociationLoader.js +5 -10
- package/build/src/EntityCompanion.d.ts +9 -9
- package/build/src/EntityCompanion.js +6 -11
- package/build/src/EntityCompanionProvider.d.ts +13 -12
- package/build/src/EntityCompanionProvider.js +13 -21
- package/build/src/EntityConfiguration.d.ts +4 -4
- package/build/src/EntityConfiguration.js +14 -23
- package/build/src/EntityConstructionUtils.d.ts +8 -8
- package/build/src/EntityConstructionUtils.js +15 -23
- package/build/src/EntityCreator.d.ts +7 -7
- package/build/src/EntityCreator.js +3 -8
- package/build/src/EntityDatabaseAdapter.d.ts +4 -4
- package/build/src/EntityDatabaseAdapter.js +19 -27
- package/build/src/EntityDeleter.d.ts +7 -7
- package/build/src/EntityDeleter.js +3 -8
- package/build/src/EntityFieldDefinition.d.ts +4 -4
- package/build/src/EntityFieldDefinition.js +5 -10
- package/build/src/EntityFields.d.ts +2 -1
- package/build/src/EntityFields.js +12 -27
- package/build/src/EntityInvalidationUtils.d.ts +8 -10
- package/build/src/EntityInvalidationUtils.js +5 -10
- package/build/src/EntityLoader.d.ts +7 -7
- package/build/src/EntityLoader.js +3 -8
- package/build/src/EntityLoaderFactory.d.ts +11 -11
- package/build/src/EntityLoaderFactory.js +7 -12
- package/build/src/EntityMutationInfo.d.ts +2 -2
- package/build/src/EntityMutationInfo.js +2 -6
- package/build/src/EntityMutationTriggerConfiguration.d.ts +4 -4
- package/build/src/EntityMutationTriggerConfiguration.js +2 -8
- package/build/src/EntityMutationValidatorConfiguration.d.ts +4 -4
- package/build/src/EntityMutationValidatorConfiguration.js +1 -6
- package/build/src/EntityMutatorFactory.d.ts +13 -13
- package/build/src/EntityMutatorFactory.js +5 -10
- package/build/src/EntityPrivacyPolicy.d.ts +7 -7
- package/build/src/EntityPrivacyPolicy.js +22 -27
- package/build/src/EntityQueryContext.d.ts +1 -1
- package/build/src/EntityQueryContext.js +11 -22
- package/build/src/EntityQueryContextProvider.d.ts +2 -1
- package/build/src/EntityQueryContextProvider.js +7 -12
- package/build/src/EntitySecondaryCacheLoader.d.ts +7 -7
- package/build/src/EntitySecondaryCacheLoader.js +4 -9
- package/build/src/EntityUpdater.d.ts +7 -7
- package/build/src/EntityUpdater.js +3 -8
- package/build/src/GenericEntityCacheAdapter.d.ts +4 -4
- package/build/src/GenericEntityCacheAdapter.js +5 -13
- package/build/src/GenericSecondaryEntityCache.d.ts +2 -2
- package/build/src/GenericSecondaryEntityCache.js +10 -18
- package/build/src/IEntityCacheAdapter.d.ts +2 -2
- package/build/src/IEntityCacheAdapter.js +1 -3
- package/build/src/IEntityCacheAdapterProvider.d.ts +2 -2
- package/build/src/IEntityCacheAdapterProvider.js +1 -3
- package/build/src/IEntityDatabaseAdapterProvider.d.ts +2 -2
- package/build/src/IEntityDatabaseAdapterProvider.js +1 -3
- package/build/src/IEntityGenericCacher.d.ts +2 -2
- package/build/src/IEntityGenericCacher.js +1 -3
- package/build/src/ReadonlyEntity.d.ts +10 -10
- package/build/src/ReadonlyEntity.js +9 -17
- package/build/src/ViewerContext.d.ts +6 -6
- package/build/src/ViewerContext.js +3 -8
- package/build/src/ViewerScopedEntityCompanion.d.ts +8 -8
- package/build/src/ViewerScopedEntityCompanion.js +5 -10
- package/build/src/ViewerScopedEntityCompanionProvider.d.ts +6 -6
- package/build/src/ViewerScopedEntityCompanionProvider.js +3 -8
- package/build/src/ViewerScopedEntityLoaderFactory.d.ts +9 -9
- package/build/src/ViewerScopedEntityLoaderFactory.js +1 -6
- package/build/src/ViewerScopedEntityMutatorFactory.d.ts +7 -7
- package/build/src/ViewerScopedEntityMutatorFactory.js +1 -6
- package/build/src/entityUtils.d.ts +1 -1
- package/build/src/entityUtils.js +9 -21
- package/build/src/errors/EntityCacheAdapterError.d.ts +1 -1
- package/build/src/errors/EntityCacheAdapterError.js +5 -11
- package/build/src/errors/EntityDatabaseAdapterError.d.ts +1 -1
- package/build/src/errors/EntityDatabaseAdapterError.js +41 -59
- package/build/src/errors/EntityError.js +5 -10
- package/build/src/errors/EntityInvalidFieldValueError.d.ts +5 -5
- package/build/src/errors/EntityInvalidFieldValueError.js +4 -9
- package/build/src/errors/EntityNotAuthorizedError.d.ts +4 -4
- package/build/src/errors/EntityNotAuthorizedError.js +6 -11
- package/build/src/errors/EntityNotFoundError.d.ts +5 -5
- package/build/src/errors/EntityNotFoundError.js +4 -9
- package/build/src/index.d.ts +77 -77
- package/build/src/index.js +77 -94
- package/build/src/internal/CompositeFieldHolder.d.ts +3 -2
- package/build/src/internal/CompositeFieldHolder.js +11 -21
- package/build/src/internal/CompositeFieldValueMap.d.ts +2 -2
- package/build/src/internal/CompositeFieldValueMap.js +7 -12
- package/build/src/internal/EntityDataManager.d.ts +6 -6
- package/build/src/internal/EntityDataManager.js +25 -33
- package/build/src/internal/EntityFieldTransformationUtils.d.ts +1 -1
- package/build/src/internal/EntityFieldTransformationUtils.js +11 -23
- package/build/src/internal/EntityLoadInterfaces.d.ts +3 -2
- package/build/src/internal/EntityLoadInterfaces.js +4 -9
- package/build/src/internal/EntityTableDataCoordinator.d.ts +8 -8
- package/build/src/internal/EntityTableDataCoordinator.js +4 -9
- package/build/src/internal/ReadThroughEntityCache.d.ts +3 -3
- package/build/src/internal/ReadThroughEntityCache.js +7 -15
- package/build/src/internal/SingleFieldHolder.d.ts +3 -2
- package/build/src/internal/SingleFieldHolder.js +9 -19
- package/build/src/metrics/EntityMetricsUtils.d.ts +3 -3
- package/build/src/metrics/EntityMetricsUtils.js +6 -14
- package/build/src/metrics/IEntityMetricsAdapter.d.ts +2 -2
- package/build/src/metrics/IEntityMetricsAdapter.js +8 -12
- package/build/src/metrics/NoOpEntityMetricsAdapter.d.ts +1 -1
- package/build/src/metrics/NoOpEntityMetricsAdapter.js +1 -6
- package/build/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.d.ts +5 -5
- package/build/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.js +5 -10
- package/build/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.d.ts +5 -5
- package/build/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.js +5 -10
- package/build/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.d.ts +6 -6
- package/build/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.js +6 -11
- package/build/src/rules/AlwaysAllowPrivacyPolicyRule.d.ts +5 -5
- package/build/src/rules/AlwaysAllowPrivacyPolicyRule.js +3 -8
- package/build/src/rules/AlwaysDenyPrivacyPolicyRule.d.ts +5 -5
- package/build/src/rules/AlwaysDenyPrivacyPolicyRule.js +3 -8
- package/build/src/rules/AlwaysSkipPrivacyPolicyRule.d.ts +5 -5
- package/build/src/rules/AlwaysSkipPrivacyPolicyRule.js +3 -8
- package/build/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.d.ts +5 -5
- package/build/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.js +3 -8
- package/build/src/rules/PrivacyPolicyRule.d.ts +4 -4
- package/build/src/rules/PrivacyPolicyRule.js +3 -8
- package/build/src/utils/EntityCreationUtils.d.ts +5 -5
- package/build/src/utils/EntityCreationUtils.js +6 -11
- package/build/src/utils/EntityPrivacyUtils.d.ts +5 -5
- package/build/src/utils/EntityPrivacyUtils.js +20 -27
- package/build/src/utils/collections/SerializableKeyMap.js +1 -6
- package/build/src/utils/collections/maps.js +11 -27
- package/build/src/utils/collections/sets.js +1 -5
- package/build/src/utils/mergeEntityMutationTriggerConfigurations.d.ts +3 -3
- package/build/src/utils/mergeEntityMutationTriggerConfigurations.js +1 -5
- package/package.json +8 -7
- package/src/AuthorizationResultBasedEntityAssociationLoader.ts +7 -6
- package/src/AuthorizationResultBasedEntityLoader.ts +19 -17
- package/src/AuthorizationResultBasedEntityMutator.ts +24 -22
- package/src/ComposedEntityCacheAdapter.ts +5 -4
- package/src/ComposedSecondaryEntityCache.ts +2 -2
- package/src/EnforcingEntityAssociationLoader.ts +7 -7
- package/src/EnforcingEntityCreator.ts +4 -4
- package/src/EnforcingEntityDeleter.ts +4 -4
- package/src/EnforcingEntityLoader.ts +8 -8
- package/src/EnforcingEntityUpdater.ts +4 -4
- package/src/Entity.ts +13 -13
- package/src/EntityAssociationLoader.ts +6 -6
- package/src/EntityCompanion.ts +13 -10
- package/src/EntityCompanionProvider.ts +15 -14
- package/src/EntityConfiguration.ts +6 -8
- package/src/EntityConstructionUtils.ts +16 -12
- package/src/EntityCreator.ts +7 -7
- package/src/EntityDatabaseAdapter.ts +6 -6
- package/src/EntityDeleter.ts +7 -7
- package/src/EntityFieldDefinition.ts +4 -4
- package/src/EntityFields.ts +3 -3
- package/src/EntityInvalidationUtils.ts +8 -25
- package/src/EntityLoader.ts +7 -7
- package/src/EntityLoaderFactory.ts +13 -12
- package/src/EntityMutationInfo.ts +2 -2
- package/src/EntityMutationTriggerConfiguration.ts +4 -4
- package/src/EntityMutationValidatorConfiguration.ts +4 -4
- package/src/EntityMutatorFactory.ts +13 -13
- package/src/EntityPrivacyPolicy.ts +9 -10
- package/src/EntityQueryContext.ts +1 -1
- package/src/EntityQueryContextProvider.ts +2 -2
- package/src/EntitySecondaryCacheLoader.ts +8 -8
- package/src/EntityUpdater.ts +7 -7
- package/src/GenericEntityCacheAdapter.ts +5 -5
- package/src/GenericSecondaryEntityCache.ts +4 -4
- package/src/IEntityCacheAdapter.ts +2 -2
- package/src/IEntityCacheAdapterProvider.ts +2 -2
- package/src/IEntityDatabaseAdapterProvider.ts +2 -2
- package/src/IEntityGenericCacher.ts +2 -2
- package/src/ReadonlyEntity.ts +12 -19
- package/src/ViewerContext.ts +8 -8
- package/src/ViewerScopedEntityCompanion.ts +8 -8
- package/src/ViewerScopedEntityCompanionProvider.ts +6 -6
- package/src/ViewerScopedEntityLoaderFactory.ts +11 -9
- package/src/ViewerScopedEntityMutatorFactory.ts +8 -8
- package/src/__tests__/AuthorizationResultBasedEntityAssociationLoader-test.ts +6 -6
- package/src/__tests__/AuthorizationResultBasedEntityLoader-constructor-test.ts +16 -15
- package/src/__tests__/AuthorizationResultBasedEntityLoader-test.ts +21 -21
- package/src/__tests__/ComposedCacheAdapter-test.ts +8 -7
- package/src/__tests__/ComposedSecondaryEntityCache-test.ts +3 -3
- package/src/__tests__/EnforcingEntityAssociationLoader-test.ts +2 -2
- package/src/__tests__/EnforcingEntityLoader-test.ts +4 -4
- package/src/__tests__/Entity-test.ts +8 -8
- package/src/__tests__/EntityAssociationLoader-test.ts +6 -6
- package/src/__tests__/EntityCommonUseCases-test.ts +17 -13
- package/src/__tests__/EntityCompanion-test.ts +11 -11
- package/src/__tests__/EntityCompanionProvider-test.ts +8 -7
- package/src/__tests__/EntityConfiguration-test.ts +3 -3
- package/src/__tests__/EntityDatabaseAdapter-test.ts +11 -7
- package/src/__tests__/EntityEdges-test.ts +17 -19
- package/src/__tests__/EntityFields-test.ts +3 -3
- package/src/__tests__/EntityLoader-test.ts +7 -7
- package/src/__tests__/EntityMutator-MutationCacheConsistency-test.ts +12 -11
- package/src/__tests__/EntityMutator-SingleCompositeFieldCacheConsistency-test.ts +4 -4
- package/src/__tests__/EntityMutator-test.ts +32 -36
- package/src/__tests__/EntityPrivacyPolicy-test.ts +19 -19
- package/src/__tests__/EntityQueryContext-test.ts +9 -9
- package/src/__tests__/EntitySecondaryCacheLoader-test.ts +8 -7
- package/src/__tests__/EntitySelfReferentialEdges-test.ts +12 -12
- package/src/__tests__/GenericEntityCacheAdapter-test.ts +6 -6
- package/src/__tests__/GenericSecondaryEntityCache-test.ts +16 -18
- package/src/__tests__/ReadonlyEntity-test.ts +10 -10
- package/src/__tests__/ViewerContext-test.ts +3 -3
- package/src/__tests__/ViewerScopedEntityCompanion-test.ts +7 -7
- package/src/__tests__/ViewerScopedEntityCompanionProvider-test.ts +5 -5
- package/src/__tests__/ViewerScopedEntityLoaderFactory-test.ts +5 -5
- package/src/__tests__/ViewerScopedEntityMutatorFactory-test.ts +6 -6
- package/src/__tests__/cases/TwoEntitySameTableDisjointRows-test.ts +9 -9
- package/src/__tests__/cases/TwoEntitySameTableOverlappingRows-test.ts +8 -8
- package/src/__tests__/entityUtils-test.ts +4 -4
- package/src/entityUtils.ts +1 -1
- package/src/errors/EntityCacheAdapterError.ts +1 -1
- package/src/errors/EntityDatabaseAdapterError.ts +1 -1
- package/src/errors/EntityInvalidFieldValueError.ts +5 -5
- package/src/errors/EntityNotAuthorizedError.ts +4 -4
- package/src/errors/EntityNotFoundError.ts +5 -5
- package/src/errors/__tests__/EntityDatabaseAdapterError-test.ts +2 -2
- package/src/errors/__tests__/EntityError-test.ts +7 -7
- package/src/index.ts +77 -77
- package/src/internal/CompositeFieldHolder.ts +6 -10
- package/src/internal/CompositeFieldValueMap.ts +3 -5
- package/src/internal/EntityDataManager.ts +11 -14
- package/src/internal/EntityFieldTransformationUtils.ts +2 -2
- package/src/internal/EntityLoadInterfaces.ts +3 -2
- package/src/internal/EntityTableDataCoordinator.ts +9 -9
- package/src/internal/ReadThroughEntityCache.ts +4 -4
- package/src/internal/SingleFieldHolder.ts +4 -8
- package/src/internal/__tests__/CompositeFieldHolder-test.ts +1 -1
- package/src/internal/__tests__/CompositeFieldValueMap-test.ts +3 -3
- package/src/internal/__tests__/EntityDataManager-test.ts +15 -18
- package/src/internal/__tests__/EntityFieldTransformationUtils-test.ts +3 -3
- package/src/internal/__tests__/ReadThroughEntityCache-test.ts +6 -6
- package/src/metrics/EntityMetricsUtils.ts +5 -5
- package/src/metrics/IEntityMetricsAdapter.ts +3 -3
- package/src/metrics/NoOpEntityMetricsAdapter.ts +2 -2
- package/src/metrics/__tests__/EntityMetricsUtils-test.ts +4 -7
- package/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.ts +5 -5
- package/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.ts +5 -5
- package/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.ts +9 -6
- package/src/rules/AlwaysAllowPrivacyPolicyRule.ts +5 -5
- package/src/rules/AlwaysDenyPrivacyPolicyRule.ts +5 -5
- package/src/rules/AlwaysSkipPrivacyPolicyRule.ts +5 -5
- package/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.ts +5 -5
- package/src/rules/PrivacyPolicyRule.ts +4 -4
- package/src/rules/__tests__/AllowIfAllSubRulesAllowPrivacyPolicyRule-test.ts +8 -8
- package/src/rules/__tests__/AllowIfAnySubRuleAllowsPrivacyPolicyRule-test.ts +8 -8
- package/src/rules/__tests__/AllowIfInParentCascadeDeletionPrivacyPolicyRule-test.ts +7 -7
- package/src/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.ts +5 -5
- package/src/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.ts +5 -5
- package/src/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.ts +5 -5
- package/src/rules/__tests__/EvaluateIfEntityFieldPredicatePrivacyPolicyRule-test.ts +9 -8
- package/src/utils/EntityCreationUtils.ts +7 -7
- package/src/utils/EntityPrivacyUtils.ts +13 -9
- package/src/utils/__testfixtures__/PrivacyPolicyRuleTestUtils.ts +6 -5
- package/src/utils/__testfixtures__/SimpleTestEntity.ts +7 -7
- package/src/utils/__testfixtures__/StubCacheAdapter.ts +6 -5
- package/src/utils/__testfixtures__/StubDatabaseAdapter.ts +6 -6
- package/src/utils/__testfixtures__/StubDatabaseAdapterProvider.ts +4 -4
- package/src/utils/__testfixtures__/StubQueryContextProvider.ts +2 -2
- package/src/utils/__testfixtures__/TSMockitoExtensions.ts +5 -5
- package/src/utils/__testfixtures__/TestEntity.ts +9 -8
- package/src/utils/__testfixtures__/TestEntity2.ts +7 -7
- package/src/utils/__testfixtures__/TestEntityWithMutationTriggers.ts +10 -10
- package/src/utils/__testfixtures__/TestViewerContext.ts +1 -1
- package/src/utils/__testfixtures__/createUnitTestEntityCompanionProvider.ts +6 -6
- package/src/utils/__testfixtures__/describeFieldTestCase.ts +1 -1
- package/src/utils/__tests__/EntityCreationUtils-test.ts +7 -7
- package/src/utils/__tests__/EntityPrivacyUtils-test.ts +20 -21
- package/src/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.ts +12 -12
- package/src/utils/__tests__/mergeEntityMutationTriggerConfigurations-test.ts +2 -2
- package/src/utils/collections/__tests__/SerializableKeyMap-test.ts +2 -1
- package/src/utils/collections/__tests__/maps-test.ts +5 -5
- package/src/utils/collections/__tests__/sets-test.ts +1 -1
- package/src/utils/mergeEntityMutationTriggerConfigurations.ts +3 -3
- package/build/src/AuthorizationResultBasedEntityAssociationLoader.js.map +0 -1
- package/build/src/AuthorizationResultBasedEntityLoader.js.map +0 -1
- package/build/src/AuthorizationResultBasedEntityMutator.js.map +0 -1
- package/build/src/ComposedEntityCacheAdapter.js.map +0 -1
- package/build/src/ComposedSecondaryEntityCache.js.map +0 -1
- package/build/src/EnforcingEntityAssociationLoader.js.map +0 -1
- package/build/src/EnforcingEntityCreator.js.map +0 -1
- package/build/src/EnforcingEntityDeleter.js.map +0 -1
- package/build/src/EnforcingEntityLoader.js.map +0 -1
- package/build/src/EnforcingEntityUpdater.js.map +0 -1
- package/build/src/Entity.js.map +0 -1
- package/build/src/EntityAssociationLoader.js.map +0 -1
- package/build/src/EntityCompanion.js.map +0 -1
- package/build/src/EntityCompanionProvider.js.map +0 -1
- package/build/src/EntityConfiguration.js.map +0 -1
- package/build/src/EntityConstructionUtils.js.map +0 -1
- package/build/src/EntityCreator.js.map +0 -1
- package/build/src/EntityDatabaseAdapter.js.map +0 -1
- package/build/src/EntityDeleter.js.map +0 -1
- package/build/src/EntityFieldDefinition.js.map +0 -1
- package/build/src/EntityFields.js.map +0 -1
- package/build/src/EntityInvalidationUtils.js.map +0 -1
- package/build/src/EntityLoader.js.map +0 -1
- package/build/src/EntityLoaderFactory.js.map +0 -1
- package/build/src/EntityMutationInfo.js.map +0 -1
- package/build/src/EntityMutationTriggerConfiguration.js.map +0 -1
- package/build/src/EntityMutationValidatorConfiguration.js.map +0 -1
- package/build/src/EntityMutatorFactory.js.map +0 -1
- package/build/src/EntityPrivacyPolicy.js.map +0 -1
- package/build/src/EntityQueryContext.js.map +0 -1
- package/build/src/EntityQueryContextProvider.js.map +0 -1
- package/build/src/EntitySecondaryCacheLoader.js.map +0 -1
- package/build/src/EntityUpdater.js.map +0 -1
- package/build/src/GenericEntityCacheAdapter.js.map +0 -1
- package/build/src/GenericSecondaryEntityCache.js.map +0 -1
- package/build/src/IEntityCacheAdapter.js.map +0 -1
- package/build/src/IEntityCacheAdapterProvider.js.map +0 -1
- package/build/src/IEntityDatabaseAdapterProvider.js.map +0 -1
- package/build/src/IEntityGenericCacher.js.map +0 -1
- package/build/src/ReadonlyEntity.js.map +0 -1
- package/build/src/ViewerContext.js.map +0 -1
- package/build/src/ViewerScopedEntityCompanion.js.map +0 -1
- package/build/src/ViewerScopedEntityCompanionProvider.js.map +0 -1
- package/build/src/ViewerScopedEntityLoaderFactory.js.map +0 -1
- package/build/src/ViewerScopedEntityMutatorFactory.js.map +0 -1
- package/build/src/entityUtils.js.map +0 -1
- package/build/src/errors/EntityCacheAdapterError.js.map +0 -1
- package/build/src/errors/EntityDatabaseAdapterError.js.map +0 -1
- package/build/src/errors/EntityError.js.map +0 -1
- package/build/src/errors/EntityInvalidFieldValueError.js.map +0 -1
- package/build/src/errors/EntityNotAuthorizedError.js.map +0 -1
- package/build/src/errors/EntityNotFoundError.js.map +0 -1
- package/build/src/index.js.map +0 -1
- package/build/src/internal/CompositeFieldHolder.js.map +0 -1
- package/build/src/internal/CompositeFieldValueMap.js.map +0 -1
- package/build/src/internal/EntityDataManager.js.map +0 -1
- package/build/src/internal/EntityFieldTransformationUtils.js.map +0 -1
- package/build/src/internal/EntityLoadInterfaces.js.map +0 -1
- package/build/src/internal/EntityTableDataCoordinator.js.map +0 -1
- package/build/src/internal/ReadThroughEntityCache.js.map +0 -1
- package/build/src/internal/SingleFieldHolder.js.map +0 -1
- package/build/src/metrics/EntityMetricsUtils.js.map +0 -1
- package/build/src/metrics/IEntityMetricsAdapter.js.map +0 -1
- package/build/src/metrics/NoOpEntityMetricsAdapter.js.map +0 -1
- package/build/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.js.map +0 -1
- package/build/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.js.map +0 -1
- package/build/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.js.map +0 -1
- package/build/src/rules/AlwaysAllowPrivacyPolicyRule.js.map +0 -1
- package/build/src/rules/AlwaysDenyPrivacyPolicyRule.js.map +0 -1
- package/build/src/rules/AlwaysSkipPrivacyPolicyRule.js.map +0 -1
- package/build/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.js.map +0 -1
- package/build/src/rules/PrivacyPolicyRule.js.map +0 -1
- package/build/src/utils/EntityCreationUtils.js.map +0 -1
- package/build/src/utils/EntityPrivacyUtils.js.map +0 -1
- package/build/src/utils/collections/SerializableKeyMap.js.map +0 -1
- package/build/src/utils/collections/maps.js.map +0 -1
- package/build/src/utils/collections/sets.js.map +0 -1
- package/build/src/utils/mergeEntityMutationTriggerConfigurations.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy';
|
|
2
|
-
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
|
-
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
4
|
-
import { ViewerContext } from '../ViewerContext';
|
|
5
|
-
import { PrivacyPolicyRule, RuleEvaluationResult } from './PrivacyPolicyRule';
|
|
1
|
+
import type { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy.ts';
|
|
2
|
+
import type { EntityQueryContext } from '../EntityQueryContext.ts';
|
|
3
|
+
import type { ReadonlyEntity } from '../ReadonlyEntity.ts';
|
|
4
|
+
import type { ViewerContext } from '../ViewerContext.ts';
|
|
5
|
+
import { PrivacyPolicyRule, RuleEvaluationResult } from './PrivacyPolicyRule.ts';
|
|
6
6
|
export declare class EvaluateIfEntityFieldPredicatePrivacyPolicyRule<TFields extends object, TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>, N extends TSelectedFields, TSelectedFields extends keyof TFields = keyof TFields> extends PrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
7
7
|
private readonly fieldName;
|
|
8
8
|
private readonly shouldEvaluatePredicate;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EvaluateIfEntityFieldPredicatePrivacyPolicyRule = void 0;
|
|
4
|
-
const PrivacyPolicyRule_1 = require("./PrivacyPolicyRule");
|
|
5
|
-
class EvaluateIfEntityFieldPredicatePrivacyPolicyRule extends PrivacyPolicyRule_1.PrivacyPolicyRule {
|
|
1
|
+
import { PrivacyPolicyRule, RuleEvaluationResult } from "./PrivacyPolicyRule.js";
|
|
2
|
+
export class EvaluateIfEntityFieldPredicatePrivacyPolicyRule extends PrivacyPolicyRule {
|
|
6
3
|
fieldName;
|
|
7
4
|
shouldEvaluatePredicate;
|
|
8
5
|
rule;
|
|
@@ -16,8 +13,6 @@ class EvaluateIfEntityFieldPredicatePrivacyPolicyRule extends PrivacyPolicyRule_
|
|
|
16
13
|
const fieldValue = entity.getField(this.fieldName);
|
|
17
14
|
return this.shouldEvaluatePredicate(fieldValue)
|
|
18
15
|
? await this.rule.evaluateAsync(viewerContext, queryContext, evaluationContext, entity)
|
|
19
|
-
:
|
|
16
|
+
: RuleEvaluationResult.SKIP;
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
|
-
exports.EvaluateIfEntityFieldPredicatePrivacyPolicyRule = EvaluateIfEntityFieldPredicatePrivacyPolicyRule;
|
|
23
|
-
//# sourceMappingURL=EvaluateIfEntityFieldPredicatePrivacyPolicyRule.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy';
|
|
2
|
-
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
|
-
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
4
|
-
import { ViewerContext } from '../ViewerContext';
|
|
1
|
+
import type { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy.ts';
|
|
2
|
+
import type { EntityQueryContext } from '../EntityQueryContext.ts';
|
|
3
|
+
import type { ReadonlyEntity } from '../ReadonlyEntity.ts';
|
|
4
|
+
import type { ViewerContext } from '../ViewerContext.ts';
|
|
5
5
|
export declare enum RuleEvaluationResult {
|
|
6
6
|
/**
|
|
7
7
|
* Deny viewer access to the entity.
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrivacyPolicyRule = exports.RuleEvaluationResult = void 0;
|
|
4
|
-
var RuleEvaluationResult;
|
|
1
|
+
export var RuleEvaluationResult;
|
|
5
2
|
(function (RuleEvaluationResult) {
|
|
6
3
|
/**
|
|
7
4
|
* Deny viewer access to the entity.
|
|
@@ -15,7 +12,7 @@ var RuleEvaluationResult;
|
|
|
15
12
|
* Allow viewer access to the entity.
|
|
16
13
|
*/
|
|
17
14
|
RuleEvaluationResult[RuleEvaluationResult["ALLOW"] = 1] = "ALLOW";
|
|
18
|
-
})(RuleEvaluationResult || (
|
|
15
|
+
})(RuleEvaluationResult || (RuleEvaluationResult = {}));
|
|
19
16
|
/**
|
|
20
17
|
* A single unit of which declarative privacy policies are composed, allowing for simple
|
|
21
18
|
* expression and testing of authorization logic.
|
|
@@ -32,7 +29,5 @@ var RuleEvaluationResult;
|
|
|
32
29
|
* - Blocking. For example, a user blocks another user from seeing their posts, and the rule
|
|
33
30
|
* would be named something like `DenyIfViewerHasBeenBlockedPrivacyPolicyRule`.
|
|
34
31
|
*/
|
|
35
|
-
class PrivacyPolicyRule {
|
|
32
|
+
export class PrivacyPolicyRule {
|
|
36
33
|
}
|
|
37
|
-
exports.PrivacyPolicyRule = PrivacyPolicyRule;
|
|
38
|
-
//# sourceMappingURL=PrivacyPolicyRule.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IEntityClass } from '../Entity';
|
|
2
|
-
import { EntityPrivacyPolicy } from '../EntityPrivacyPolicy';
|
|
3
|
-
import { EntityTransactionalQueryContext } from '../EntityQueryContext';
|
|
4
|
-
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
5
|
-
import { ViewerContext } from '../ViewerContext';
|
|
1
|
+
import type { IEntityClass } from '../Entity.ts';
|
|
2
|
+
import type { EntityPrivacyPolicy } from '../EntityPrivacyPolicy.ts';
|
|
3
|
+
import type { EntityTransactionalQueryContext } from '../EntityQueryContext.ts';
|
|
4
|
+
import type { ReadonlyEntity } from '../ReadonlyEntity.ts';
|
|
5
|
+
import type { ViewerContext } from '../ViewerContext.ts';
|
|
6
6
|
/**
|
|
7
7
|
* Create an entity if it doesn't exist, or get the existing entity if it does.
|
|
8
8
|
*/
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.createOrGetExistingAsync = createOrGetExistingAsync;
|
|
4
|
-
exports.createWithUniqueConstraintRecoveryAsync = createWithUniqueConstraintRecoveryAsync;
|
|
5
|
-
const EntityDatabaseAdapterError_1 = require("../errors/EntityDatabaseAdapterError");
|
|
6
|
-
const EntityNotFoundError_1 = require("../errors/EntityNotFoundError");
|
|
1
|
+
import { EntityDatabaseAdapterUniqueConstraintError } from "../errors/EntityDatabaseAdapterError.js";
|
|
2
|
+
import { EntityNotFoundError } from "../errors/EntityNotFoundError.js";
|
|
7
3
|
/**
|
|
8
4
|
* Create an entity if it doesn't exist, or get the existing entity if it does.
|
|
9
5
|
*/
|
|
10
|
-
async function createOrGetExistingAsync(viewerContext, entityClass, getAsync, getArgs, createAsync, createArgs, queryContext) {
|
|
6
|
+
export async function createOrGetExistingAsync(viewerContext, entityClass, getAsync, getArgs, createAsync, createArgs, queryContext) {
|
|
11
7
|
if (!queryContext) {
|
|
12
8
|
const maybeEntity = await getAsync(viewerContext, getArgs);
|
|
13
9
|
if (maybeEntity) {
|
|
@@ -31,7 +27,7 @@ async function createOrGetExistingAsync(viewerContext, entityClass, getAsync, ge
|
|
|
31
27
|
* Account for concurrent requests that may try to create the same entity.
|
|
32
28
|
* Return the existing entity if we get a Unique Constraint error.
|
|
33
29
|
*/
|
|
34
|
-
async function createWithUniqueConstraintRecoveryAsync(viewerContext, entityClass, getAsync, getArgs, createAsync, createArgs, queryContext) {
|
|
30
|
+
export async function createWithUniqueConstraintRecoveryAsync(viewerContext, entityClass, getAsync, getArgs, createAsync, createArgs, queryContext) {
|
|
35
31
|
try {
|
|
36
32
|
if (!queryContext) {
|
|
37
33
|
return await createAsync(viewerContext, createArgs);
|
|
@@ -39,10 +35,10 @@ async function createWithUniqueConstraintRecoveryAsync(viewerContext, entityClas
|
|
|
39
35
|
return await queryContext.runInNestedTransactionAsync((nestedQueryContext) => createAsync(viewerContext, createArgs, nestedQueryContext));
|
|
40
36
|
}
|
|
41
37
|
catch (e) {
|
|
42
|
-
if (e instanceof
|
|
38
|
+
if (e instanceof EntityDatabaseAdapterUniqueConstraintError) {
|
|
43
39
|
const entity = await getAsync(viewerContext, getArgs, queryContext);
|
|
44
40
|
if (!entity) {
|
|
45
|
-
throw new
|
|
41
|
+
throw new EntityNotFoundError(`Expected entity to exist after unique constraint error: ${entityClass.name}`);
|
|
46
42
|
}
|
|
47
43
|
return entity;
|
|
48
44
|
}
|
|
@@ -51,4 +47,3 @@ async function createWithUniqueConstraintRecoveryAsync(viewerContext, entityClas
|
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
|
-
//# sourceMappingURL=EntityCreationUtils.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Entity, IEntityClass } from '../Entity';
|
|
2
|
-
import { EntityPrivacyPolicy } from '../EntityPrivacyPolicy';
|
|
3
|
-
import { EntityQueryContext } from '../EntityQueryContext';
|
|
4
|
-
import { ViewerContext } from '../ViewerContext';
|
|
5
|
-
import { EntityNotAuthorizedError } from '../errors/EntityNotAuthorizedError';
|
|
1
|
+
import type { Entity, IEntityClass } from '../Entity.ts';
|
|
2
|
+
import type { EntityPrivacyPolicy } from '../EntityPrivacyPolicy.ts';
|
|
3
|
+
import type { EntityQueryContext } from '../EntityQueryContext.ts';
|
|
4
|
+
import type { ViewerContext } from '../ViewerContext.ts';
|
|
5
|
+
import { EntityNotAuthorizedError } from '../errors/EntityNotAuthorizedError.ts';
|
|
6
6
|
export type EntityPrivacyEvaluationResultSuccess = {
|
|
7
7
|
allowed: true;
|
|
8
8
|
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.canViewerDeleteAsync = canViewerDeleteAsync;
|
|
6
|
-
exports.getCanViewerDeleteResultAsync = getCanViewerDeleteResultAsync;
|
|
7
|
-
const results_1 = require("@expo/results");
|
|
8
|
-
const EntityFieldDefinition_1 = require("../EntityFieldDefinition");
|
|
9
|
-
const entityUtils_1 = require("../entityUtils");
|
|
10
|
-
const EntityNotAuthorizedError_1 = require("../errors/EntityNotAuthorizedError");
|
|
1
|
+
import { asyncResult } from '@expo/results';
|
|
2
|
+
import { EntityEdgeDeletionAuthorizationInferenceBehavior, EntityEdgeDeletionBehavior, } from "../EntityFieldDefinition.js";
|
|
3
|
+
import { failedResults, partitionArray } from "../entityUtils.js";
|
|
4
|
+
import { EntityNotAuthorizedError } from "../errors/EntityNotAuthorizedError.js";
|
|
11
5
|
/**
|
|
12
6
|
* Check whether an entity loaded by a viewer can be updated by that same viewer.
|
|
13
7
|
*
|
|
@@ -25,7 +19,7 @@ const EntityNotAuthorizedError_1 = require("../errors/EntityNotAuthorizedError")
|
|
|
25
19
|
* @param sourceEntity - entity loaded by viewer
|
|
26
20
|
* @param queryContext - query context in which to perform the check
|
|
27
21
|
*/
|
|
28
|
-
async function canViewerUpdateAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
22
|
+
export async function canViewerUpdateAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
29
23
|
.getViewerContext()
|
|
30
24
|
.getViewerScopedEntityCompanionForClass(entityClass)
|
|
31
25
|
.getQueryContextProvider()
|
|
@@ -42,7 +36,7 @@ async function canViewerUpdateAsync(entityClass, sourceEntity, queryContext = so
|
|
|
42
36
|
* @param sourceEntity - entity loaded by viewer
|
|
43
37
|
* @param queryContext - query context in which to perform the check
|
|
44
38
|
*/
|
|
45
|
-
async function getCanViewerUpdateResultAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
39
|
+
export async function getCanViewerUpdateResultAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
46
40
|
.getViewerContext()
|
|
47
41
|
.getViewerScopedEntityCompanionForClass(entityClass)
|
|
48
42
|
.getQueryContextProvider()
|
|
@@ -54,9 +48,9 @@ async function canViewerUpdateInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
54
48
|
.getViewerContext()
|
|
55
49
|
.getViewerScopedEntityCompanionForClass(entityClass);
|
|
56
50
|
const privacyPolicy = companion.entityCompanion.privacyPolicy;
|
|
57
|
-
const evaluationResult = await
|
|
51
|
+
const evaluationResult = await asyncResult(privacyPolicy.authorizeUpdateAsync(sourceEntity.getViewerContext(), queryContext, evaluationContext, sourceEntity, companion.getMetricsAdapter()));
|
|
58
52
|
if (!evaluationResult.ok) {
|
|
59
|
-
if (evaluationResult.reason instanceof
|
|
53
|
+
if (evaluationResult.reason instanceof EntityNotAuthorizedError) {
|
|
60
54
|
return { allowed: false, authorizationErrors: [evaluationResult.reason] };
|
|
61
55
|
}
|
|
62
56
|
else {
|
|
@@ -75,7 +69,7 @@ async function canViewerUpdateInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
75
69
|
* @param sourceEntity - entity loaded by viewer
|
|
76
70
|
* @param queryContext - query context in which to perform the check
|
|
77
71
|
*/
|
|
78
|
-
async function canViewerDeleteAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
72
|
+
export async function canViewerDeleteAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
79
73
|
.getViewerContext()
|
|
80
74
|
.getViewerScopedEntityCompanionForClass(entityClass)
|
|
81
75
|
.getQueryContextProvider()
|
|
@@ -92,7 +86,7 @@ async function canViewerDeleteAsync(entityClass, sourceEntity, queryContext = so
|
|
|
92
86
|
* @param sourceEntity - entity loaded by viewer
|
|
93
87
|
* @param queryContext - query context in which to perform the check
|
|
94
88
|
*/
|
|
95
|
-
async function getCanViewerDeleteResultAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
89
|
+
export async function getCanViewerDeleteResultAsync(entityClass, sourceEntity, queryContext = sourceEntity
|
|
96
90
|
.getViewerContext()
|
|
97
91
|
.getViewerScopedEntityCompanionForClass(entityClass)
|
|
98
92
|
.getQueryContextProvider()
|
|
@@ -106,9 +100,9 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
106
100
|
.getViewerContext()
|
|
107
101
|
.getViewerScopedEntityCompanionForClass(entityClass);
|
|
108
102
|
const privacyPolicy = viewerScopedCompanion.entityCompanion.privacyPolicy;
|
|
109
|
-
const evaluationResult = await
|
|
103
|
+
const evaluationResult = await asyncResult(privacyPolicy.authorizeDeleteAsync(sourceEntity.getViewerContext(), queryContext, evaluationContext, sourceEntity, viewerScopedCompanion.getMetricsAdapter()));
|
|
110
104
|
if (!evaluationResult.ok) {
|
|
111
|
-
if (evaluationResult.reason instanceof
|
|
105
|
+
if (evaluationResult.reason instanceof EntityNotAuthorizedError) {
|
|
112
106
|
return { allowed: false, authorizationErrors: [evaluationResult.reason] };
|
|
113
107
|
}
|
|
114
108
|
else {
|
|
@@ -154,7 +148,7 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
154
148
|
const edgeDeletionPermissionInferenceBehavior = association.edgeDeletionAuthorizationInferenceBehavior;
|
|
155
149
|
let entityResultsToCheckForInboundEdge;
|
|
156
150
|
if (edgeDeletionPermissionInferenceBehavior ===
|
|
157
|
-
|
|
151
|
+
EntityEdgeDeletionAuthorizationInferenceBehavior.ONE_IMPLIES_ALL) {
|
|
158
152
|
const singleEntityResultToTestForInboundEdge = await loader['loadOneByFieldEqualingAsync'](fieldName, association.associatedEntityLookupByField
|
|
159
153
|
? sourceEntity.getField(association.associatedEntityLookupByField)
|
|
160
154
|
: sourceEntity.getID());
|
|
@@ -168,9 +162,9 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
168
162
|
: sourceEntity.getID());
|
|
169
163
|
entityResultsToCheckForInboundEdge = entityResultsForInboundEdge;
|
|
170
164
|
}
|
|
171
|
-
const failedEntityLoadResults =
|
|
165
|
+
const failedEntityLoadResults = failedResults(entityResultsToCheckForInboundEdge);
|
|
172
166
|
for (const failedResult of failedEntityLoadResults) {
|
|
173
|
-
if (failedResult.reason instanceof
|
|
167
|
+
if (failedResult.reason instanceof EntityNotAuthorizedError) {
|
|
174
168
|
return { allowed: false, authorizationErrors: [failedResult.reason] };
|
|
175
169
|
}
|
|
176
170
|
else {
|
|
@@ -180,8 +174,8 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
180
174
|
// all results should be success at this point due to check above
|
|
181
175
|
const entitiesForInboundEdge = entityResultsToCheckForInboundEdge.map((r) => r.enforceValue());
|
|
182
176
|
switch (association.edgeDeletionBehavior) {
|
|
183
|
-
case
|
|
184
|
-
case
|
|
177
|
+
case EntityEdgeDeletionBehavior.CASCADE_DELETE:
|
|
178
|
+
case EntityEdgeDeletionBehavior.CASCADE_DELETE_INVALIDATE_CACHE_ONLY: {
|
|
185
179
|
const canDeleteEvaluationResults = await Promise.all(entitiesForInboundEdge.map((entity) => canViewerDeleteInternalAsync(inboundEdge, entity, { previousValue: null, cascadingDeleteCause: newCascadingDeleteCause }, queryContext)));
|
|
186
180
|
const reducedEvaluationResult = reduceEvaluationResults(canDeleteEvaluationResults);
|
|
187
181
|
if (!reducedEvaluationResult.allowed) {
|
|
@@ -189,8 +183,8 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
189
183
|
}
|
|
190
184
|
break;
|
|
191
185
|
}
|
|
192
|
-
case
|
|
193
|
-
case
|
|
186
|
+
case EntityEdgeDeletionBehavior.SET_NULL:
|
|
187
|
+
case EntityEdgeDeletionBehavior.SET_NULL_INVALIDATE_CACHE_ONLY: {
|
|
194
188
|
// create synthetic entities with the reference field set to null to properly evaluate
|
|
195
189
|
// privacy policy as it would be after the cascading SET NULL operation
|
|
196
190
|
const previousAndSyntheticEntitiesForInboundEdge = entitiesForInboundEdge.map((entity) => {
|
|
@@ -220,7 +214,7 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
220
214
|
return { allowed: true };
|
|
221
215
|
}
|
|
222
216
|
function reduceEvaluationResults(evaluationResults) {
|
|
223
|
-
const [successResults, failureResults] =
|
|
217
|
+
const [successResults, failureResults] = partitionArray(evaluationResults, (evaluationResult) => evaluationResult.allowed);
|
|
224
218
|
if (successResults.length === evaluationResults.length) {
|
|
225
219
|
return { allowed: true };
|
|
226
220
|
}
|
|
@@ -229,4 +223,3 @@ function reduceEvaluationResults(evaluationResults) {
|
|
|
229
223
|
authorizationErrors: failureResults.flatMap((failureResult) => failureResult.authorizationErrors),
|
|
230
224
|
};
|
|
231
225
|
}
|
|
232
|
-
//# sourceMappingURL=EntityPrivacyUtils.js.map
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SerializableKeyMap = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* A map with keys that are serializable. Serialized keys are considered equal if their serialized values are equal.
|
|
6
3
|
* Otherwise, the map behaves like a regular Map.
|
|
7
4
|
*/
|
|
8
|
-
class SerializableKeyMap {
|
|
5
|
+
export class SerializableKeyMap {
|
|
9
6
|
underlyingMap;
|
|
10
7
|
constructor(iterable) {
|
|
11
8
|
this.underlyingMap = new Map(Array.from(iterable ?? []).map(([key, value]) => [key.serialize(), value]));
|
|
@@ -56,5 +53,3 @@ class SerializableKeyMap {
|
|
|
56
53
|
return 'SerializableKeyMap';
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
exports.SerializableKeyMap = SerializableKeyMap;
|
|
60
|
-
//# sourceMappingURL=SerializableKeyMap.js.map
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.reduceMapAsync = exports.reduceMap = exports.invertMap = exports.zipToMap = exports.mapKeys = exports.mapMapAsync = exports.mapMap = exports.computeIfAbsent = void 0;
|
|
7
|
-
exports.filterMap = filterMap;
|
|
8
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
1
|
+
import invariant from 'invariant';
|
|
9
2
|
/**
|
|
10
3
|
* If the specified key is not already associated with a value in this map, computes
|
|
11
4
|
* its value using the given mapping function and enters it into this map.
|
|
@@ -14,35 +7,33 @@ const invariant_1 = __importDefault(require("invariant"));
|
|
|
14
7
|
* @param key - key for which to get the value or with which the computed value is to be associated
|
|
15
8
|
* @param mappingFunction - function to compute a value for key
|
|
16
9
|
*/
|
|
17
|
-
const computeIfAbsent = (map, key, mappingFunction) => {
|
|
10
|
+
export const computeIfAbsent = (map, key, mappingFunction) => {
|
|
18
11
|
if (!map.has(key)) {
|
|
19
12
|
const value = mappingFunction(key);
|
|
20
13
|
map.set(key, value);
|
|
21
14
|
}
|
|
22
15
|
return map.get(key);
|
|
23
16
|
};
|
|
24
|
-
exports.computeIfAbsent = computeIfAbsent;
|
|
25
17
|
/**
|
|
26
18
|
* Create a new Map by associating the value of mapper executed for each key in the source map.
|
|
27
19
|
*
|
|
28
20
|
* @param map - source map
|
|
29
21
|
* @param mapper - function to compute a value in the resulting map for the source key and value
|
|
30
22
|
*/
|
|
31
|
-
const mapMap = (map, mapper) => {
|
|
23
|
+
export const mapMap = (map, mapper) => {
|
|
32
24
|
const resultingMap = new Map();
|
|
33
25
|
for (const [k, v] of map) {
|
|
34
26
|
resultingMap.set(k, mapper(v, k));
|
|
35
27
|
}
|
|
36
28
|
return resultingMap;
|
|
37
29
|
};
|
|
38
|
-
exports.mapMap = mapMap;
|
|
39
30
|
/**
|
|
40
31
|
* Create a new Map by associating the value of mapper executed for each key in the source map.
|
|
41
32
|
*
|
|
42
33
|
* @param map - source map
|
|
43
34
|
* @param mapper - asynchronous function to compute a value in the resulting map for the source key and value
|
|
44
35
|
*/
|
|
45
|
-
const mapMapAsync = async function (map, mapper) {
|
|
36
|
+
export const mapMapAsync = async function (map, mapper) {
|
|
46
37
|
const resultingMap = new Map();
|
|
47
38
|
await Promise.all(Array.from(map.keys()).map(async (k) => {
|
|
48
39
|
const initialValue = map.get(k);
|
|
@@ -51,7 +42,6 @@ const mapMapAsync = async function (map, mapper) {
|
|
|
51
42
|
}));
|
|
52
43
|
return resultingMap;
|
|
53
44
|
};
|
|
54
|
-
exports.mapMapAsync = mapMapAsync;
|
|
55
45
|
/**
|
|
56
46
|
* Create a new Map by associating the value of each key with mapper executed for each key in the source map.
|
|
57
47
|
* The opposite of mapMap. In the event two source keys map to the same result key, the second source key's
|
|
@@ -61,14 +51,13 @@ exports.mapMapAsync = mapMapAsync;
|
|
|
61
51
|
* @param map - source map
|
|
62
52
|
* @param mapper - function to compute a key in the resulting map for the source key and value
|
|
63
53
|
*/
|
|
64
|
-
const mapKeys = (map, mapper) => {
|
|
54
|
+
export const mapKeys = (map, mapper) => {
|
|
65
55
|
const resultingMap = new Map();
|
|
66
56
|
for (const [k, v] of map) {
|
|
67
57
|
resultingMap.set(mapper(k, v), v);
|
|
68
58
|
}
|
|
69
59
|
return resultingMap;
|
|
70
60
|
};
|
|
71
|
-
exports.mapKeys = mapKeys;
|
|
72
61
|
/**
|
|
73
62
|
* Create a new Map from each member of keys to the corresponding member of values.
|
|
74
63
|
*
|
|
@@ -80,28 +69,26 @@ exports.mapKeys = mapKeys;
|
|
|
80
69
|
* @param keys - keys
|
|
81
70
|
* @param values - corresponding ordered values for keys
|
|
82
71
|
*/
|
|
83
|
-
const zipToMap = (keys, values) => {
|
|
84
|
-
(
|
|
72
|
+
export const zipToMap = (keys, values) => {
|
|
73
|
+
invariant(keys.length === values.length, `zipToMap input length mismatch: keys[${keys.length}], values[${values.length}]`);
|
|
85
74
|
const resultingMap = new Map();
|
|
86
75
|
for (let i = 0; i < keys.length; i++) {
|
|
87
76
|
resultingMap.set(keys[i], values[i]);
|
|
88
77
|
}
|
|
89
78
|
return resultingMap;
|
|
90
79
|
};
|
|
91
|
-
exports.zipToMap = zipToMap;
|
|
92
80
|
/**
|
|
93
81
|
* Create a new Map by inverting keys and values of specified map.
|
|
94
82
|
*
|
|
95
83
|
* @param map - map to invert
|
|
96
84
|
*/
|
|
97
|
-
const invertMap = (map) => {
|
|
85
|
+
export const invertMap = (map) => {
|
|
98
86
|
const resultingMap = new Map();
|
|
99
87
|
for (const [k, v] of map) {
|
|
100
88
|
resultingMap.set(v, k);
|
|
101
89
|
}
|
|
102
90
|
return resultingMap;
|
|
103
91
|
};
|
|
104
|
-
exports.invertMap = invertMap;
|
|
105
92
|
/**
|
|
106
93
|
* Execute a reducer function on each element of the source map, resulting in a single output value.
|
|
107
94
|
*
|
|
@@ -110,14 +97,13 @@ exports.invertMap = invertMap;
|
|
|
110
97
|
* iteration key and returns a new accumulated value
|
|
111
98
|
* @param initialValue - initial accumulated value
|
|
112
99
|
*/
|
|
113
|
-
const reduceMap = (map, reducer, initialValue) => {
|
|
100
|
+
export const reduceMap = (map, reducer, initialValue) => {
|
|
114
101
|
let newAccumulator = initialValue;
|
|
115
102
|
for (const [k, v] of map) {
|
|
116
103
|
newAccumulator = reducer(newAccumulator, v, k);
|
|
117
104
|
}
|
|
118
105
|
return newAccumulator;
|
|
119
106
|
};
|
|
120
|
-
exports.reduceMap = reduceMap;
|
|
121
107
|
/**
|
|
122
108
|
* Execute an asynchronous reducer function on each element of the source map, resulting in a single output value.
|
|
123
109
|
* Note that this does not parallelize asynchronous reduce steps so it should be used with caution.
|
|
@@ -127,20 +113,19 @@ exports.reduceMap = reduceMap;
|
|
|
127
113
|
* current iteration key and returns a new accumulated value
|
|
128
114
|
* @param initialValue - initial accumulated value
|
|
129
115
|
*/
|
|
130
|
-
const reduceMapAsync = async (map, reducer, initialValue) => {
|
|
116
|
+
export const reduceMapAsync = async (map, reducer, initialValue) => {
|
|
131
117
|
let newAccumulator = initialValue;
|
|
132
118
|
for (const [k, v] of map) {
|
|
133
119
|
newAccumulator = await reducer(newAccumulator, v, k);
|
|
134
120
|
}
|
|
135
121
|
return newAccumulator;
|
|
136
122
|
};
|
|
137
|
-
exports.reduceMapAsync = reduceMapAsync;
|
|
138
123
|
/**
|
|
139
124
|
* Create a new Map containing all elements from the source map that pass the provided test predicate.
|
|
140
125
|
* @param map - source map
|
|
141
126
|
* @param predicate - function to test each element of source map
|
|
142
127
|
*/
|
|
143
|
-
function filterMap(map, predicate) {
|
|
128
|
+
export function filterMap(map, predicate) {
|
|
144
129
|
const resultingMap = new Map();
|
|
145
130
|
map.forEach((v, k) => {
|
|
146
131
|
if (predicate(v, k)) {
|
|
@@ -149,4 +134,3 @@ function filterMap(map, predicate) {
|
|
|
149
134
|
});
|
|
150
135
|
return resultingMap;
|
|
151
136
|
}
|
|
152
|
-
//# sourceMappingURL=maps.js.map
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.areSetsEqual = areSetsEqual;
|
|
4
|
-
function areSetsEqual(a, b) {
|
|
1
|
+
export function areSetsEqual(a, b) {
|
|
5
2
|
return a.size === b.size && [...a].every((value) => b.has(value));
|
|
6
3
|
}
|
|
7
|
-
//# sourceMappingURL=sets.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityMutationTriggerConfiguration } from '../EntityMutationTriggerConfiguration';
|
|
2
|
-
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
3
|
-
import { ViewerContext } from '../ViewerContext';
|
|
1
|
+
import type { EntityMutationTriggerConfiguration } from '../EntityMutationTriggerConfiguration.ts';
|
|
2
|
+
import type { ReadonlyEntity } from '../ReadonlyEntity.ts';
|
|
3
|
+
import type { ViewerContext } from '../ViewerContext.ts';
|
|
4
4
|
export declare function mergeEntityMutationTriggerConfigurations<TFields extends Record<string, any>, TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields>(...mutationTriggerConfigurations: EntityMutationTriggerConfiguration<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>[]): EntityMutationTriggerConfiguration<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeEntityMutationTriggerConfigurations = mergeEntityMutationTriggerConfigurations;
|
|
4
1
|
function nonNullish(value) {
|
|
5
2
|
return value !== null && value !== undefined;
|
|
6
3
|
}
|
|
7
|
-
function mergeEntityMutationTriggerConfigurations(...mutationTriggerConfigurations) {
|
|
4
|
+
export function mergeEntityMutationTriggerConfigurations(...mutationTriggerConfigurations) {
|
|
8
5
|
const merged = {
|
|
9
6
|
beforeCreate: mutationTriggerConfigurations.flatMap((c) => c.beforeCreate).filter(nonNullish),
|
|
10
7
|
afterCreate: mutationTriggerConfigurations.flatMap((c) => c.afterCreate).filter(nonNullish),
|
|
@@ -24,4 +21,3 @@ function mergeEntityMutationTriggerConfigurations(...mutationTriggerConfiguratio
|
|
|
24
21
|
}
|
|
25
22
|
return merged;
|
|
26
23
|
}
|
|
27
|
-
//# sourceMappingURL=mergeEntityMutationTriggerConfigurations.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/entity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "A privacy-first data model",
|
|
5
5
|
"files": [
|
|
6
6
|
"build",
|
|
@@ -19,27 +19,28 @@
|
|
|
19
19
|
"test": "yarn test:all --rootDir $(pwd)"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
22
|
+
"node": ">=18"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"entity"
|
|
26
26
|
],
|
|
27
27
|
"author": "Expo",
|
|
28
28
|
"license": "MIT",
|
|
29
|
+
"type": "module",
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@expo/results": "^1.0.0",
|
|
31
32
|
"dataloader": "^2.2.3",
|
|
32
33
|
"invariant": "^2.2.4"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@jest/globals": "30.
|
|
36
|
+
"@jest/globals": "30.3.0",
|
|
36
37
|
"@types/invariant": "2.2.37",
|
|
37
|
-
"@types/lodash": "4.17.
|
|
38
|
-
"@types/node": "24.
|
|
39
|
-
"lodash": "4.17.23",
|
|
38
|
+
"@types/lodash-es": "4.17.12",
|
|
39
|
+
"@types/node": "24.12.0",
|
|
40
|
+
"lodash-es": "4.17.23",
|
|
40
41
|
"ts-mockito": "2.6.1",
|
|
41
42
|
"typescript": "5.9.3",
|
|
42
43
|
"uuid": "13.0.0"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "4965cc238882982e6315beca48a68679ed45456b"
|
|
45
46
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Result
|
|
1
|
+
import type { Result } from '@expo/results';
|
|
2
|
+
import { result } from '@expo/results';
|
|
2
3
|
|
|
3
|
-
import { IEntityClass } from './Entity';
|
|
4
|
-
import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
|
|
5
|
-
import { EntityQueryContext } from './EntityQueryContext';
|
|
6
|
-
import { ReadonlyEntity } from './ReadonlyEntity';
|
|
7
|
-
import { ViewerContext } from './ViewerContext';
|
|
4
|
+
import type { IEntityClass } from './Entity.ts';
|
|
5
|
+
import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
|
|
6
|
+
import type { EntityQueryContext } from './EntityQueryContext.ts';
|
|
7
|
+
import type { ReadonlyEntity } from './ReadonlyEntity.ts';
|
|
8
|
+
import type { ViewerContext } from './ViewerContext.ts';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* An association loader is a set of convenience methods for loading entities
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import nullthrows from '@expo/nullthrows';
|
|
2
|
+
import type { Result } from '@expo/results';
|
|
3
|
+
import { result } from '@expo/results';
|
|
2
4
|
import invariant from 'invariant';
|
|
3
|
-
import nullthrows from 'nullthrows';
|
|
4
5
|
|
|
5
|
-
import { IEntityClass } from './Entity';
|
|
6
|
-
import {
|
|
6
|
+
import type { IEntityClass } from './Entity.ts';
|
|
7
|
+
import type {
|
|
7
8
|
EntityCompositeField,
|
|
8
9
|
EntityCompositeFieldValue,
|
|
9
10
|
EntityConfiguration,
|
|
10
|
-
} from './EntityConfiguration';
|
|
11
|
-
import { EntityConstructionUtils } from './EntityConstructionUtils';
|
|
12
|
-
import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
|
|
13
|
-
import { EntityQueryContext } from './EntityQueryContext';
|
|
14
|
-
import { ReadonlyEntity } from './ReadonlyEntity';
|
|
15
|
-
import { ViewerContext } from './ViewerContext';
|
|
16
|
-
import { EntityNotFoundError } from './errors/EntityNotFoundError';
|
|
17
|
-
import { CompositeFieldHolder
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
11
|
+
} from './EntityConfiguration.ts';
|
|
12
|
+
import type { EntityConstructionUtils } from './EntityConstructionUtils.ts';
|
|
13
|
+
import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
|
|
14
|
+
import type { EntityQueryContext } from './EntityQueryContext.ts';
|
|
15
|
+
import type { ReadonlyEntity } from './ReadonlyEntity.ts';
|
|
16
|
+
import type { ViewerContext } from './ViewerContext.ts';
|
|
17
|
+
import { EntityNotFoundError } from './errors/EntityNotFoundError.ts';
|
|
18
|
+
import type { CompositeFieldHolder } from './internal/CompositeFieldHolder.ts';
|
|
19
|
+
import { CompositeFieldValueHolder } from './internal/CompositeFieldHolder.ts';
|
|
20
|
+
import { CompositeFieldValueMap } from './internal/CompositeFieldValueMap.ts';
|
|
21
|
+
import type { EntityDataManager } from './internal/EntityDataManager.ts';
|
|
22
|
+
import { SingleFieldHolder, SingleFieldValueHolder } from './internal/SingleFieldHolder.ts';
|
|
23
|
+
import { mapKeys, mapMap } from './utils/collections/maps.ts';
|
|
24
|
+
import { areSetsEqual } from './utils/collections/sets.ts';
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Authorization-result-based entity loader. All normal loads are batched,
|