@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
package/build/src/index.js
CHANGED
|
@@ -1,99 +1,82 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* eslint-disable tsdoc/syntax */
|
|
3
2
|
/**
|
|
4
3
|
* @packageDocumentation
|
|
5
4
|
* @module @expo/entity
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
__exportStar(require("./metrics/NoOpEntityMetricsAdapter"), exports);
|
|
85
|
-
__exportStar(require("./rules/AllowIfAllSubRulesAllowPrivacyPolicyRule"), exports);
|
|
86
|
-
__exportStar(require("./rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule"), exports);
|
|
87
|
-
__exportStar(require("./rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule"), exports);
|
|
88
|
-
__exportStar(require("./rules/AlwaysAllowPrivacyPolicyRule"), exports);
|
|
89
|
-
__exportStar(require("./rules/AlwaysDenyPrivacyPolicyRule"), exports);
|
|
90
|
-
__exportStar(require("./rules/AlwaysSkipPrivacyPolicyRule"), exports);
|
|
91
|
-
__exportStar(require("./rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule"), exports);
|
|
92
|
-
__exportStar(require("./rules/PrivacyPolicyRule"), exports);
|
|
93
|
-
__exportStar(require("./utils/EntityCreationUtils"), exports);
|
|
94
|
-
__exportStar(require("./utils/EntityPrivacyUtils"), exports);
|
|
95
|
-
__exportStar(require("./utils/mergeEntityMutationTriggerConfigurations"), exports);
|
|
96
|
-
__exportStar(require("./utils/collections/maps"), exports);
|
|
97
|
-
__exportStar(require("./utils/collections/SerializableKeyMap"), exports);
|
|
98
|
-
__exportStar(require("./utils/collections/sets"), exports);
|
|
99
|
-
//# sourceMappingURL=index.js.map
|
|
6
|
+
export * from "./AuthorizationResultBasedEntityAssociationLoader.js";
|
|
7
|
+
export * from "./AuthorizationResultBasedEntityLoader.js";
|
|
8
|
+
export * from "./AuthorizationResultBasedEntityMutator.js";
|
|
9
|
+
export * from "./ComposedEntityCacheAdapter.js";
|
|
10
|
+
export * from "./ComposedSecondaryEntityCache.js";
|
|
11
|
+
export * from "./EnforcingEntityAssociationLoader.js";
|
|
12
|
+
export * from "./EnforcingEntityCreator.js";
|
|
13
|
+
export * from "./EnforcingEntityDeleter.js";
|
|
14
|
+
export * from "./EnforcingEntityLoader.js";
|
|
15
|
+
export * from "./EnforcingEntityUpdater.js";
|
|
16
|
+
export * from "./Entity.js";
|
|
17
|
+
export * from "./EntityAssociationLoader.js";
|
|
18
|
+
export * from "./EntityCompanion.js";
|
|
19
|
+
export * from "./EntityCompanionProvider.js";
|
|
20
|
+
export * from "./EntityConfiguration.js";
|
|
21
|
+
export * from "./EntityConstructionUtils.js";
|
|
22
|
+
export * from "./EntityCreator.js";
|
|
23
|
+
export * from "./EntityDatabaseAdapter.js";
|
|
24
|
+
export * from "./EntityDeleter.js";
|
|
25
|
+
export * from "./EntityFieldDefinition.js";
|
|
26
|
+
export * from "./EntityFields.js";
|
|
27
|
+
export * from "./EntityInvalidationUtils.js";
|
|
28
|
+
export * from "./EntityLoader.js";
|
|
29
|
+
export * from "./EntityLoaderFactory.js";
|
|
30
|
+
export * from "./EntityMutationInfo.js";
|
|
31
|
+
export * from "./EntityMutationTriggerConfiguration.js";
|
|
32
|
+
export * from "./EntityMutationValidatorConfiguration.js";
|
|
33
|
+
export * from "./EntityMutatorFactory.js";
|
|
34
|
+
export * from "./EntityPrivacyPolicy.js";
|
|
35
|
+
export * from "./EntityQueryContext.js";
|
|
36
|
+
export * from "./EntityQueryContextProvider.js";
|
|
37
|
+
export * from "./EntitySecondaryCacheLoader.js";
|
|
38
|
+
export * from "./EntityUpdater.js";
|
|
39
|
+
export * from "./entityUtils.js";
|
|
40
|
+
export * from "./GenericEntityCacheAdapter.js";
|
|
41
|
+
export * from "./GenericSecondaryEntityCache.js";
|
|
42
|
+
export * from "./IEntityCacheAdapter.js";
|
|
43
|
+
export * from "./IEntityCacheAdapterProvider.js";
|
|
44
|
+
export * from "./IEntityDatabaseAdapterProvider.js";
|
|
45
|
+
export * from "./IEntityGenericCacher.js";
|
|
46
|
+
export * from "./ReadonlyEntity.js";
|
|
47
|
+
export * from "./ViewerContext.js";
|
|
48
|
+
export * from "./ViewerScopedEntityCompanion.js";
|
|
49
|
+
export * from "./ViewerScopedEntityCompanionProvider.js";
|
|
50
|
+
export * from "./ViewerScopedEntityLoaderFactory.js";
|
|
51
|
+
export * from "./ViewerScopedEntityMutatorFactory.js";
|
|
52
|
+
export * from "./errors/EntityCacheAdapterError.js";
|
|
53
|
+
export * from "./errors/EntityDatabaseAdapterError.js";
|
|
54
|
+
export * from "./errors/EntityError.js";
|
|
55
|
+
export * from "./errors/EntityInvalidFieldValueError.js";
|
|
56
|
+
export * from "./errors/EntityNotAuthorizedError.js";
|
|
57
|
+
export * from "./errors/EntityNotFoundError.js";
|
|
58
|
+
export * from "./internal/CompositeFieldHolder.js";
|
|
59
|
+
export * from "./internal/CompositeFieldValueMap.js";
|
|
60
|
+
export * from "./internal/EntityDataManager.js";
|
|
61
|
+
export * from "./internal/EntityFieldTransformationUtils.js";
|
|
62
|
+
export * from "./internal/EntityLoadInterfaces.js";
|
|
63
|
+
export * from "./internal/EntityTableDataCoordinator.js";
|
|
64
|
+
export * from "./internal/ReadThroughEntityCache.js";
|
|
65
|
+
export * from "./internal/SingleFieldHolder.js";
|
|
66
|
+
export * from "./metrics/EntityMetricsUtils.js";
|
|
67
|
+
export * from "./metrics/IEntityMetricsAdapter.js";
|
|
68
|
+
export * from "./metrics/NoOpEntityMetricsAdapter.js";
|
|
69
|
+
export * from "./rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.js";
|
|
70
|
+
export * from "./rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.js";
|
|
71
|
+
export * from "./rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.js";
|
|
72
|
+
export * from "./rules/AlwaysAllowPrivacyPolicyRule.js";
|
|
73
|
+
export * from "./rules/AlwaysDenyPrivacyPolicyRule.js";
|
|
74
|
+
export * from "./rules/AlwaysSkipPrivacyPolicyRule.js";
|
|
75
|
+
export * from "./rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.js";
|
|
76
|
+
export * from "./rules/PrivacyPolicyRule.js";
|
|
77
|
+
export * from "./utils/EntityCreationUtils.js";
|
|
78
|
+
export * from "./utils/EntityPrivacyUtils.js";
|
|
79
|
+
export * from "./utils/mergeEntityMutationTriggerConfigurations.js";
|
|
80
|
+
export * from "./utils/collections/maps.js";
|
|
81
|
+
export * from "./utils/collections/SerializableKeyMap.js";
|
|
82
|
+
export * from "./utils/collections/sets.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EntityCompositeField, EntityCompositeFieldValue, EntityConfiguration } from '../EntityConfiguration';
|
|
2
|
-
import {
|
|
1
|
+
import type { EntityCompositeField, EntityCompositeFieldValue, EntityConfiguration } from '../EntityConfiguration.ts';
|
|
2
|
+
import type { IEntityLoadKey, IEntityLoadValue } from '../internal/EntityLoadInterfaces.ts';
|
|
3
|
+
import { EntityLoadMethodType, LoadValueMap } from '../internal/EntityLoadInterfaces.ts';
|
|
3
4
|
declare const CompositeFieldHolderSerializedBrand: unique symbol;
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CompositeFieldValueHolderMap = exports.CompositeFieldValueHolder = exports.CompositeFieldHolder = void 0;
|
|
7
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
8
|
-
const entityUtils_1 = require("../entityUtils");
|
|
9
|
-
const EntityFieldTransformationUtils_1 = require("./EntityFieldTransformationUtils");
|
|
10
|
-
const EntityLoadInterfaces_1 = require("../internal/EntityLoadInterfaces");
|
|
1
|
+
import invariant from 'invariant';
|
|
2
|
+
import { pick } from "../entityUtils.js";
|
|
3
|
+
import { getDatabaseFieldForEntityField } from "./EntityFieldTransformationUtils.js";
|
|
4
|
+
import { EntityLoadMethodType, LoadValueMap } from "../internal/EntityLoadInterfaces.js";
|
|
11
5
|
/**
|
|
12
6
|
* A load key that represents a composite field (set of fieldName) on an entity.
|
|
13
7
|
* Must be defined in the entity configuration composite field definition.
|
|
14
8
|
*
|
|
15
9
|
* @internal
|
|
16
10
|
*/
|
|
17
|
-
class CompositeFieldHolder {
|
|
11
|
+
export class CompositeFieldHolder {
|
|
18
12
|
compositeField;
|
|
19
13
|
constructor(compositeFieldInput) {
|
|
20
14
|
this.compositeField = [...compositeFieldInput].sort();
|
|
@@ -26,7 +20,7 @@ class CompositeFieldHolder {
|
|
|
26
20
|
return new Set(this.compositeField);
|
|
27
21
|
}
|
|
28
22
|
extractCompositeFieldValueHolderFromObjectFields(objectFields) {
|
|
29
|
-
const selection =
|
|
23
|
+
const selection = pick(objectFields, this.compositeField);
|
|
30
24
|
if (Object.values(selection).some((value) => value === undefined || value === null)) {
|
|
31
25
|
return null;
|
|
32
26
|
}
|
|
@@ -39,7 +33,7 @@ class CompositeFieldHolder {
|
|
|
39
33
|
return entityConfiguration.compositeFieldInfo.canCacheCompositeField(this.compositeField);
|
|
40
34
|
}
|
|
41
35
|
getDatabaseColumns(entityConfiguration) {
|
|
42
|
-
return this.compositeField.map((fieldName) =>
|
|
36
|
+
return this.compositeField.map((fieldName) => getDatabaseFieldForEntityField(entityConfiguration, fieldName));
|
|
43
37
|
}
|
|
44
38
|
getDatabaseValues(value) {
|
|
45
39
|
return this.compositeField.map((fieldName) => value.compositeFieldValue[fieldName]);
|
|
@@ -50,14 +44,14 @@ class CompositeFieldHolder {
|
|
|
50
44
|
createCacheKeyPartsForLoadValue(entityConfiguration, value) {
|
|
51
45
|
const columnNames = this.compositeField.map((fieldName) => {
|
|
52
46
|
const columnName = entityConfiguration.entityToDBFieldsKeyMapping.get(fieldName);
|
|
53
|
-
(
|
|
47
|
+
invariant(columnName, `database field mapping missing for ${String(fieldName)}`);
|
|
54
48
|
return columnName;
|
|
55
49
|
});
|
|
56
50
|
const compositeFieldValues = this.compositeField.map((fieldName) => value.compositeFieldValue[fieldName]);
|
|
57
51
|
return [...columnNames, ...compositeFieldValues.map((value) => String(value))];
|
|
58
52
|
}
|
|
59
53
|
getLoadMethodType() {
|
|
60
|
-
return
|
|
54
|
+
return EntityLoadMethodType.COMPOSITE;
|
|
61
55
|
}
|
|
62
56
|
getDataManagerDataLoaderKey() {
|
|
63
57
|
return this.serialize();
|
|
@@ -79,13 +73,12 @@ class CompositeFieldHolder {
|
|
|
79
73
|
return new CompositeFieldValueHolderMap();
|
|
80
74
|
}
|
|
81
75
|
}
|
|
82
|
-
exports.CompositeFieldHolder = CompositeFieldHolder;
|
|
83
76
|
/**
|
|
84
77
|
* A load value for a CompositeFieldHolder.
|
|
85
78
|
*
|
|
86
79
|
* @internal
|
|
87
80
|
*/
|
|
88
|
-
class CompositeFieldValueHolder {
|
|
81
|
+
export class CompositeFieldValueHolder {
|
|
89
82
|
compositeFieldValue;
|
|
90
83
|
constructor(compositeFieldValue) {
|
|
91
84
|
this.compositeFieldValue = compositeFieldValue;
|
|
@@ -110,14 +103,11 @@ class CompositeFieldValueHolder {
|
|
|
110
103
|
return JSON.stringify(this.compositeFieldValue, Object.keys(this.compositeFieldValue).sort());
|
|
111
104
|
}
|
|
112
105
|
}
|
|
113
|
-
exports.CompositeFieldValueHolder = CompositeFieldValueHolder;
|
|
114
106
|
/**
|
|
115
107
|
* @internal
|
|
116
108
|
*/
|
|
117
|
-
class CompositeFieldValueHolderMap extends
|
|
109
|
+
export class CompositeFieldValueHolderMap extends LoadValueMap {
|
|
118
110
|
deserializeKey(serializedKey) {
|
|
119
111
|
return CompositeFieldValueHolder.deserialize(serializedKey);
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
|
-
exports.CompositeFieldValueHolderMap = CompositeFieldValueHolderMap;
|
|
123
|
-
//# sourceMappingURL=CompositeFieldHolder.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EntityCompositeField, EntityCompositeFieldValue } from '../EntityConfiguration';
|
|
2
|
-
import { CompositeFieldValueHolder } from './CompositeFieldHolder';
|
|
1
|
+
import type { EntityCompositeField, EntityCompositeFieldValue } from '../EntityConfiguration.ts';
|
|
2
|
+
import { CompositeFieldValueHolder } from './CompositeFieldHolder.ts';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompositeFieldValueMap = void 0;
|
|
4
|
-
const CompositeFieldHolder_1 = require("./CompositeFieldHolder");
|
|
1
|
+
import { CompositeFieldValueHolder } from "./CompositeFieldHolder.js";
|
|
5
2
|
/**
|
|
6
3
|
* @internal
|
|
7
4
|
*/
|
|
8
|
-
class CompositeFieldValueMap {
|
|
5
|
+
export class CompositeFieldValueMap {
|
|
9
6
|
map;
|
|
10
7
|
constructor(entries) {
|
|
11
8
|
const map = new Map();
|
|
@@ -15,14 +12,14 @@ class CompositeFieldValueMap {
|
|
|
15
12
|
this.map = map;
|
|
16
13
|
}
|
|
17
14
|
get(compositeFieldValue) {
|
|
18
|
-
return this.map.get(new
|
|
15
|
+
return this.map.get(new CompositeFieldValueHolder(compositeFieldValue).serialize());
|
|
19
16
|
}
|
|
20
17
|
has(compositeFieldValue) {
|
|
21
|
-
return this.map.has(new
|
|
18
|
+
return this.map.has(new CompositeFieldValueHolder(compositeFieldValue).serialize());
|
|
22
19
|
}
|
|
23
20
|
forEach(callbackfn, thisArg) {
|
|
24
21
|
this.map.forEach((value, key) => {
|
|
25
|
-
callbackfn.call(thisArg, value,
|
|
22
|
+
callbackfn.call(thisArg, value, CompositeFieldValueHolder.deserialize(key).compositeFieldValue, this);
|
|
26
23
|
});
|
|
27
24
|
}
|
|
28
25
|
get size() {
|
|
@@ -30,12 +27,12 @@ class CompositeFieldValueMap {
|
|
|
30
27
|
}
|
|
31
28
|
*entries() {
|
|
32
29
|
for (const [key, value] of this.map.entries()) {
|
|
33
|
-
yield [
|
|
30
|
+
yield [CompositeFieldValueHolder.deserialize(key).compositeFieldValue, value];
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
*keys() {
|
|
37
34
|
for (const key of this.map.keys()) {
|
|
38
|
-
yield
|
|
35
|
+
yield CompositeFieldValueHolder.deserialize(key).compositeFieldValue;
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
*values() {
|
|
@@ -50,5 +47,3 @@ class CompositeFieldValueMap {
|
|
|
50
47
|
return 'CompositeFieldValueMap';
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
exports.CompositeFieldValueMap = CompositeFieldValueMap;
|
|
54
|
-
//# sourceMappingURL=CompositeFieldValueMap.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EntityDatabaseAdapter } from '../EntityDatabaseAdapter';
|
|
2
|
-
import { EntityQueryContext, EntityTransactionalQueryContext } from '../EntityQueryContext';
|
|
3
|
-
import { EntityQueryContextProvider } from '../EntityQueryContextProvider';
|
|
4
|
-
import { IEntityLoadKey, IEntityLoadValue, LoadPair } from './EntityLoadInterfaces';
|
|
5
|
-
import { ReadThroughEntityCache } from './ReadThroughEntityCache';
|
|
6
|
-
import { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter';
|
|
1
|
+
import type { EntityDatabaseAdapter } from '../EntityDatabaseAdapter.ts';
|
|
2
|
+
import type { EntityQueryContext, EntityTransactionalQueryContext } from '../EntityQueryContext.ts';
|
|
3
|
+
import type { EntityQueryContextProvider } from '../EntityQueryContextProvider.ts';
|
|
4
|
+
import type { IEntityLoadKey, IEntityLoadValue, LoadPair } from './EntityLoadInterfaces.ts';
|
|
5
|
+
import type { ReadThroughEntityCache } from './ReadThroughEntityCache.ts';
|
|
6
|
+
import type { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter.ts';
|
|
7
7
|
/**
|
|
8
8
|
* A data manager is responsible for orchestrating multiple sources of entity
|
|
9
9
|
* data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter.
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
9
|
-
const EntityQueryContext_1 = require("../EntityQueryContext");
|
|
10
|
-
const entityUtils_1 = require("../entityUtils");
|
|
11
|
-
const EntityMetricsUtils_1 = require("../metrics/EntityMetricsUtils");
|
|
12
|
-
const IEntityMetricsAdapter_1 = require("../metrics/IEntityMetricsAdapter");
|
|
13
|
-
const maps_1 = require("../utils/collections/maps");
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
import invariant from 'invariant';
|
|
3
|
+
import { TransactionalDataLoaderMode } from "../EntityQueryContext.js";
|
|
4
|
+
import { partitionErrors } from "../entityUtils.js";
|
|
5
|
+
import { timeAndLogLoadMapEventAsync, timeAndLogLoadOneEventAsync, } from "../metrics/EntityMetricsUtils.js";
|
|
6
|
+
import { EntityMetricsLoadType, IncrementLoadCountEventType, } from "../metrics/IEntityMetricsAdapter.js";
|
|
7
|
+
import { computeIfAbsent } from "../utils/collections/maps.js";
|
|
14
8
|
/**
|
|
15
9
|
* A data manager is responsible for orchestrating multiple sources of entity
|
|
16
10
|
* data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter.
|
|
@@ -19,7 +13,7 @@ const maps_1 = require("../utils/collections/maps");
|
|
|
19
13
|
*
|
|
20
14
|
* @internal
|
|
21
15
|
*/
|
|
22
|
-
class EntityDataManager {
|
|
16
|
+
export class EntityDataManager {
|
|
23
17
|
databaseAdapter;
|
|
24
18
|
entityCache;
|
|
25
19
|
queryContextProvider;
|
|
@@ -37,8 +31,8 @@ class EntityDataManager {
|
|
|
37
31
|
this.entityClassName = entityClassName;
|
|
38
32
|
}
|
|
39
33
|
getDataLoaderForLoadKey(key) {
|
|
40
|
-
return
|
|
41
|
-
return new
|
|
34
|
+
return computeIfAbsent(this.dataLoaders, key.getLoadMethodType() + key.getDataManagerDataLoaderKey(), () => {
|
|
35
|
+
return new DataLoader(async (serializedLoadValues) => {
|
|
42
36
|
const values = serializedLoadValues.map((serializedLoadValue) => key.deserializeLoadValue(serializedLoadValue));
|
|
43
37
|
const objectMap = await this.loadManyForNonTransactionalDataLoaderAsync(key, values);
|
|
44
38
|
return values.map((value) => objectMap.get(value) ?? []);
|
|
@@ -47,7 +41,7 @@ class EntityDataManager {
|
|
|
47
41
|
}
|
|
48
42
|
async loadManyForNonTransactionalDataLoaderAsync(key, values) {
|
|
49
43
|
this.metricsAdapter.incrementDataManagerLoadCount({
|
|
50
|
-
type:
|
|
44
|
+
type: IncrementLoadCountEventType.CACHE,
|
|
51
45
|
isInTransaction: false,
|
|
52
46
|
fieldValueCount: values.length,
|
|
53
47
|
entityClassName: this.entityClassName,
|
|
@@ -55,7 +49,7 @@ class EntityDataManager {
|
|
|
55
49
|
});
|
|
56
50
|
return await this.entityCache.readManyThroughAsync(key, values, async (fetcherValues) => {
|
|
57
51
|
this.metricsAdapter.incrementDataManagerLoadCount({
|
|
58
|
-
type:
|
|
52
|
+
type: IncrementLoadCountEventType.DATABASE,
|
|
59
53
|
isInTransaction: false,
|
|
60
54
|
fieldValueCount: fetcherValues.length,
|
|
61
55
|
entityClassName: this.entityClassName,
|
|
@@ -65,21 +59,21 @@ class EntityDataManager {
|
|
|
65
59
|
});
|
|
66
60
|
}
|
|
67
61
|
getTransactionalDataLoaderForLoadKey(queryContext, key) {
|
|
68
|
-
const dataLoaderMapForTransaction =
|
|
69
|
-
return
|
|
70
|
-
return new
|
|
62
|
+
const dataLoaderMapForTransaction = computeIfAbsent(this.transactionalDataLoaders, queryContext.transactionId, () => new Map());
|
|
63
|
+
return computeIfAbsent(dataLoaderMapForTransaction, key.getLoadMethodType() + key.getDataManagerDataLoaderKey(), () => {
|
|
64
|
+
return new DataLoader(async (serializedLoadValues) => {
|
|
71
65
|
const values = serializedLoadValues.map((serializedLoadValue) => key.deserializeLoadValue(serializedLoadValue));
|
|
72
66
|
const objectMap = await this.loadManyForTransactionalDataLoaderAsync(queryContext, key, values);
|
|
73
67
|
return values.map((value) => objectMap.get(value) ?? []);
|
|
74
68
|
}, {
|
|
75
69
|
// only cache if transactional dataloader caching is enabled for the transactional query context
|
|
76
|
-
cache: queryContext.transactionalDataLoaderMode ===
|
|
70
|
+
cache: queryContext.transactionalDataLoaderMode === TransactionalDataLoaderMode.ENABLED,
|
|
77
71
|
});
|
|
78
72
|
});
|
|
79
73
|
}
|
|
80
74
|
async loadManyForTransactionalDataLoaderAsync(queryContext, key, values) {
|
|
81
75
|
this.metricsAdapter.incrementDataManagerLoadCount({
|
|
82
|
-
type:
|
|
76
|
+
type: IncrementLoadCountEventType.DATABASE,
|
|
83
77
|
isInTransaction: true,
|
|
84
78
|
fieldValueCount: values.length,
|
|
85
79
|
entityClassName: this.entityClassName,
|
|
@@ -96,14 +90,14 @@ class EntityDataManager {
|
|
|
96
90
|
* @returns map from load value to objects that match the query for that load value
|
|
97
91
|
*/
|
|
98
92
|
async loadManyEqualingAsync(queryContext, key, values) {
|
|
99
|
-
return await
|
|
93
|
+
return await timeAndLogLoadMapEventAsync(this.metricsAdapter, EntityMetricsLoadType.LOAD_MANY, this.entityClassName, queryContext)(this.loadManyEqualingInternalAsync(queryContext, key, values));
|
|
100
94
|
}
|
|
101
95
|
async loadManyEqualingInternalAsync(queryContext, key, values) {
|
|
102
96
|
key.validateRuntimeLoadValuesForDataManagerDataLoader(values, this.entityClassName);
|
|
103
97
|
if (queryContext.isInTransaction() &&
|
|
104
|
-
queryContext.transactionalDataLoaderMode ===
|
|
98
|
+
queryContext.transactionalDataLoaderMode === TransactionalDataLoaderMode.DISABLED) {
|
|
105
99
|
this.metricsAdapter.incrementDataManagerLoadCount({
|
|
106
|
-
type:
|
|
100
|
+
type: IncrementLoadCountEventType.DATABASE,
|
|
107
101
|
isInTransaction: true,
|
|
108
102
|
fieldValueCount: values.length,
|
|
109
103
|
entityClassName: this.entityClassName,
|
|
@@ -112,7 +106,7 @@ class EntityDataManager {
|
|
|
112
106
|
return await this.databaseAdapter.fetchManyWhereAsync(queryContext, key, values);
|
|
113
107
|
}
|
|
114
108
|
this.metricsAdapter.incrementDataManagerLoadCount({
|
|
115
|
-
type:
|
|
109
|
+
type: IncrementLoadCountEventType.DATALOADER,
|
|
116
110
|
isInTransaction: queryContext.isInTransaction(),
|
|
117
111
|
fieldValueCount: values.length,
|
|
118
112
|
entityClassName: this.entityClassName,
|
|
@@ -122,12 +116,12 @@ class EntityDataManager {
|
|
|
122
116
|
? this.getTransactionalDataLoaderForLoadKey(queryContext, key)
|
|
123
117
|
: this.getDataLoaderForLoadKey(key);
|
|
124
118
|
const results = await dataLoader.loadMany(values.map((v) => key.serializeLoadValue(v)));
|
|
125
|
-
const [successfulValues, errors] =
|
|
119
|
+
const [successfulValues, errors] = partitionErrors(results);
|
|
126
120
|
if (errors.length > 0) {
|
|
127
121
|
const error = errors[0];
|
|
128
122
|
throw error;
|
|
129
123
|
}
|
|
130
|
-
(
|
|
124
|
+
invariant(values.length === successfulValues.length, `length mismatch between values (${values.length}) and successful values (${successfulValues.length})`);
|
|
131
125
|
const mapToReturn = key.vendNewLoadValueMap();
|
|
132
126
|
for (let i = 0; i < successfulValues.length; i++) {
|
|
133
127
|
mapToReturn.set(values[i], successfulValues[i]);
|
|
@@ -146,7 +140,7 @@ class EntityDataManager {
|
|
|
146
140
|
* @returns at most one that match the query for that load value
|
|
147
141
|
*/
|
|
148
142
|
async loadOneEqualingAsync(queryContext, key, value) {
|
|
149
|
-
return await
|
|
143
|
+
return await timeAndLogLoadOneEventAsync(this.metricsAdapter, EntityMetricsLoadType.LOAD_ONE, this.entityClassName, queryContext)(this.databaseAdapter.fetchOneWhereAsync(queryContext, key, value));
|
|
150
144
|
}
|
|
151
145
|
async invalidateOneAsync(key, value) {
|
|
152
146
|
await this.entityCache.invalidateManyAsync(key, [value]);
|
|
@@ -167,7 +161,7 @@ class EntityDataManager {
|
|
|
167
161
|
* @param pairs - key-value pairs to invalidate
|
|
168
162
|
*/
|
|
169
163
|
invalidateKeyValuePairsForTransaction(queryContext, pairs) {
|
|
170
|
-
if (queryContext.transactionalDataLoaderMode ===
|
|
164
|
+
if (queryContext.transactionalDataLoaderMode === TransactionalDataLoaderMode.DISABLED) {
|
|
171
165
|
return;
|
|
172
166
|
}
|
|
173
167
|
// invalidate all query contexts in transaction tree
|
|
@@ -208,5 +202,3 @@ class EntityDataManager {
|
|
|
208
202
|
});
|
|
209
203
|
}
|
|
210
204
|
}
|
|
211
|
-
exports.EntityDataManager = EntityDataManager;
|
|
212
|
-
//# sourceMappingURL=EntityDataManager.js.map
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.transformFieldsToCacheObject = exports.transformCacheObjectToFields = exports.transformFieldsToDatabaseObject = exports.transformDatabaseObjectToFields = exports.getDatabaseFieldForEntityField = void 0;
|
|
7
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
8
|
-
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
1
|
+
import nullthrows from '@expo/nullthrows';
|
|
2
|
+
import invariant from 'invariant';
|
|
9
3
|
/**
|
|
10
4
|
* @internal
|
|
11
5
|
*/
|
|
12
|
-
const getDatabaseFieldForEntityField = (entityConfiguration, entityField) => {
|
|
6
|
+
export const getDatabaseFieldForEntityField = (entityConfiguration, entityField) => {
|
|
13
7
|
const databaseField = entityConfiguration.entityToDBFieldsKeyMapping.get(entityField);
|
|
14
|
-
(
|
|
8
|
+
invariant(databaseField, `database field mapping missing for ${String(entityField)}`);
|
|
15
9
|
return databaseField;
|
|
16
10
|
};
|
|
17
|
-
exports.getDatabaseFieldForEntityField = getDatabaseFieldForEntityField;
|
|
18
11
|
/**
|
|
19
12
|
* @internal
|
|
20
13
|
*/
|
|
21
|
-
const transformDatabaseObjectToFields = (entityConfiguration, fieldTransformerMap, databaseObject) => {
|
|
14
|
+
export const transformDatabaseObjectToFields = (entityConfiguration, fieldTransformerMap, databaseObject) => {
|
|
22
15
|
const fields = {};
|
|
23
16
|
for (const k in databaseObject) {
|
|
24
17
|
const val = databaseObject[k];
|
|
@@ -29,25 +22,23 @@ const transformDatabaseObjectToFields = (entityConfiguration, fieldTransformerMa
|
|
|
29
22
|
}
|
|
30
23
|
return fields;
|
|
31
24
|
};
|
|
32
|
-
exports.transformDatabaseObjectToFields = transformDatabaseObjectToFields;
|
|
33
25
|
/**
|
|
34
26
|
* @internal
|
|
35
27
|
*/
|
|
36
|
-
const transformFieldsToDatabaseObject = (entityConfiguration, fieldTransformerMap, fields) => {
|
|
28
|
+
export const transformFieldsToDatabaseObject = (entityConfiguration, fieldTransformerMap, fields) => {
|
|
37
29
|
const databaseObject = {};
|
|
38
30
|
for (const k in fields) {
|
|
39
31
|
const val = fields[k];
|
|
40
32
|
const databaseKey = entityConfiguration.entityToDBFieldsKeyMapping.get(k);
|
|
41
|
-
(
|
|
33
|
+
invariant(databaseKey, `must be database key for field: ${k}`);
|
|
42
34
|
databaseObject[databaseKey] = maybeTransformFieldValueToDatabaseValue(entityConfiguration, fieldTransformerMap, k, val);
|
|
43
35
|
}
|
|
44
36
|
return databaseObject;
|
|
45
37
|
};
|
|
46
|
-
exports.transformFieldsToDatabaseObject = transformFieldsToDatabaseObject;
|
|
47
38
|
/**
|
|
48
39
|
* @internal
|
|
49
40
|
*/
|
|
50
|
-
const transformCacheObjectToFields = (entityConfiguration, fieldTransformerMap, cacheObject) => {
|
|
41
|
+
export const transformCacheObjectToFields = (entityConfiguration, fieldTransformerMap, cacheObject) => {
|
|
51
42
|
const fields = {};
|
|
52
43
|
for (const fieldsKey in cacheObject) {
|
|
53
44
|
const val = cacheObject[fieldsKey];
|
|
@@ -55,11 +46,10 @@ const transformCacheObjectToFields = (entityConfiguration, fieldTransformerMap,
|
|
|
55
46
|
}
|
|
56
47
|
return fields;
|
|
57
48
|
};
|
|
58
|
-
exports.transformCacheObjectToFields = transformCacheObjectToFields;
|
|
59
49
|
/**
|
|
60
50
|
* @internal
|
|
61
51
|
*/
|
|
62
|
-
const transformFieldsToCacheObject = (entityConfiguration, fieldTransformerMap, fields) => {
|
|
52
|
+
export const transformFieldsToCacheObject = (entityConfiguration, fieldTransformerMap, fields) => {
|
|
63
53
|
const cacheObject = {};
|
|
64
54
|
for (const fieldsKey in fields) {
|
|
65
55
|
const val = fields[fieldsKey];
|
|
@@ -67,17 +57,16 @@ const transformFieldsToCacheObject = (entityConfiguration, fieldTransformerMap,
|
|
|
67
57
|
}
|
|
68
58
|
return cacheObject;
|
|
69
59
|
};
|
|
70
|
-
exports.transformFieldsToCacheObject = transformFieldsToCacheObject;
|
|
71
60
|
const maybeTransformDatabaseValueToFieldValue = (entityConfiguration, fieldTransformerMap, fieldName, value) => {
|
|
72
61
|
// this will always be non-null due to the way the dbToEntityFieldsKeyMapping is computed and this
|
|
73
62
|
// function is called conditionally
|
|
74
|
-
const fieldDefinition = (
|
|
63
|
+
const fieldDefinition = nullthrows(entityConfiguration.schema.get(fieldName));
|
|
75
64
|
const transformer = fieldTransformerMap.get(fieldDefinition.constructor.name);
|
|
76
65
|
const readTransformer = transformer?.read;
|
|
77
66
|
return readTransformer ? readTransformer(value) : value;
|
|
78
67
|
};
|
|
79
68
|
const maybeTransformFieldValueToDatabaseValue = (entityConfiguration, fieldTransformerMap, fieldName, value) => {
|
|
80
|
-
const fieldDefinition = (
|
|
69
|
+
const fieldDefinition = nullthrows(entityConfiguration.schema.get(fieldName));
|
|
81
70
|
const transformer = fieldTransformerMap.get(fieldDefinition.constructor.name);
|
|
82
71
|
const writeTransformer = transformer?.write;
|
|
83
72
|
return writeTransformer ? writeTransformer(value) : value;
|
|
@@ -100,4 +89,3 @@ const maybeTransformFieldValueToCacheValue = (entityConfiguration, fieldTransfor
|
|
|
100
89
|
const writeTransformer = transformer?.write;
|
|
101
90
|
return writeTransformer ? writeTransformer(value) : value;
|
|
102
91
|
};
|
|
103
|
-
//# sourceMappingURL=EntityFieldTransformationUtils.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EntityConfiguration } from '../EntityConfiguration';
|
|
2
|
-
import { ISerializable
|
|
1
|
+
import type { EntityConfiguration } from '../EntityConfiguration.ts';
|
|
2
|
+
import type { ISerializable } from '../utils/collections/SerializableKeyMap.ts';
|
|
3
|
+
import { SerializableKeyMap } from '../utils/collections/SerializableKeyMap.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Load method type identifier of a load key. Used for keying data loaders and identification in metrics.
|
|
5
6
|
*
|