@expo/entity 0.59.0 → 0.61.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 -8
- package/build/src/EntityInvalidationUtils.js +4 -9
- package/build/src/EntityLoader.d.ts +7 -7
- package/build/src/EntityLoader.js +3 -8
- package/build/src/EntityLoaderFactory.d.ts +10 -10
- 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 +9 -9
- 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 +8 -8
- 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 +7 -6
- 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 +10 -10
- package/src/EntityLoader.ts +7 -7
- package/src/EntityLoaderFactory.ts +13 -10
- 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 +11 -11
- package/src/ViewerContext.ts +8 -8
- package/src/ViewerScopedEntityCompanion.ts +8 -8
- package/src/ViewerScopedEntityCompanionProvider.ts +6 -6
- package/src/ViewerScopedEntityLoaderFactory.ts +11 -8
- 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 -18
- 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,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
|
*
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoadValueMap = exports.EntityLoadMethodType = void 0;
|
|
4
|
-
const SerializableKeyMap_1 = require("../utils/collections/SerializableKeyMap");
|
|
1
|
+
import { SerializableKeyMap } from "../utils/collections/SerializableKeyMap.js";
|
|
5
2
|
/**
|
|
6
3
|
* Load method type identifier of a load key. Used for keying data loaders and identification in metrics.
|
|
7
4
|
*
|
|
8
5
|
* @internal
|
|
9
6
|
*/
|
|
10
|
-
var EntityLoadMethodType;
|
|
7
|
+
export var EntityLoadMethodType;
|
|
11
8
|
(function (EntityLoadMethodType) {
|
|
12
9
|
/**
|
|
13
10
|
* Load method type for loading entities by single fieldName and fieldValue(s).
|
|
@@ -17,13 +14,11 @@ var EntityLoadMethodType;
|
|
|
17
14
|
* Load method type for loading entities by composite field.
|
|
18
15
|
*/
|
|
19
16
|
EntityLoadMethodType["COMPOSITE"] = "composite";
|
|
20
|
-
})(EntityLoadMethodType || (
|
|
17
|
+
})(EntityLoadMethodType || (EntityLoadMethodType = {}));
|
|
21
18
|
/**
|
|
22
19
|
* Map from load value interface to value.
|
|
23
20
|
*
|
|
24
21
|
* @internal
|
|
25
22
|
*/
|
|
26
|
-
class LoadValueMap extends
|
|
23
|
+
export class LoadValueMap extends SerializableKeyMap {
|
|
27
24
|
}
|
|
28
|
-
exports.LoadValueMap = LoadValueMap;
|
|
29
|
-
//# sourceMappingURL=EntityLoadInterfaces.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { EntityConfiguration } from '../EntityConfiguration';
|
|
2
|
-
import { EntityDatabaseAdapter } from '../EntityDatabaseAdapter';
|
|
3
|
-
import { EntityQueryContextProvider } from '../EntityQueryContextProvider';
|
|
4
|
-
import { IEntityCacheAdapter } from '../IEntityCacheAdapter';
|
|
5
|
-
import { IEntityCacheAdapterProvider } from '../IEntityCacheAdapterProvider';
|
|
6
|
-
import { IEntityDatabaseAdapterProvider } from '../IEntityDatabaseAdapterProvider';
|
|
7
|
-
import { EntityDataManager } from './EntityDataManager';
|
|
8
|
-
import { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter';
|
|
1
|
+
import type { EntityConfiguration } from '../EntityConfiguration.ts';
|
|
2
|
+
import type { EntityDatabaseAdapter } from '../EntityDatabaseAdapter.ts';
|
|
3
|
+
import type { EntityQueryContextProvider } from '../EntityQueryContextProvider.ts';
|
|
4
|
+
import type { IEntityCacheAdapter } from '../IEntityCacheAdapter.ts';
|
|
5
|
+
import type { IEntityCacheAdapterProvider } from '../IEntityCacheAdapterProvider.ts';
|
|
6
|
+
import type { IEntityDatabaseAdapterProvider } from '../IEntityDatabaseAdapterProvider.ts';
|
|
7
|
+
import { EntityDataManager } from './EntityDataManager.ts';
|
|
8
|
+
import type { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter.ts';
|
|
9
9
|
/**
|
|
10
10
|
* Responsible for orchestrating fetching and caching of entity data from a
|
|
11
11
|
* table. Note that one instance is shared amongst all entities that read from
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EntityTableDataCoordinator = void 0;
|
|
4
|
-
const EntityDataManager_1 = require("./EntityDataManager");
|
|
5
|
-
const ReadThroughEntityCache_1 = require("./ReadThroughEntityCache");
|
|
1
|
+
import { EntityDataManager } from "./EntityDataManager.js";
|
|
2
|
+
import { ReadThroughEntityCache } from "./ReadThroughEntityCache.js";
|
|
6
3
|
/**
|
|
7
4
|
* Responsible for orchestrating fetching and caching of entity data from a
|
|
8
5
|
* table. Note that one instance is shared amongst all entities that read from
|
|
@@ -10,7 +7,7 @@ const ReadThroughEntityCache_1 = require("./ReadThroughEntityCache");
|
|
|
10
7
|
*
|
|
11
8
|
* @internal
|
|
12
9
|
*/
|
|
13
|
-
class EntityTableDataCoordinator {
|
|
10
|
+
export class EntityTableDataCoordinator {
|
|
14
11
|
entityConfiguration;
|
|
15
12
|
queryContextProvider;
|
|
16
13
|
metricsAdapter;
|
|
@@ -25,11 +22,9 @@ class EntityTableDataCoordinator {
|
|
|
25
22
|
this.entityClassName = entityClassName;
|
|
26
23
|
this.databaseAdapter = databaseAdapterProvider.getDatabaseAdapter(entityConfiguration);
|
|
27
24
|
this.cacheAdapter = cacheAdapterProvider.getCacheAdapter(entityConfiguration);
|
|
28
|
-
this.dataManager = new
|
|
25
|
+
this.dataManager = new EntityDataManager(this.databaseAdapter, new ReadThroughEntityCache(entityConfiguration, this.cacheAdapter), queryContextProvider, metricsAdapter, entityClassName);
|
|
29
26
|
}
|
|
30
27
|
getQueryContextProvider() {
|
|
31
28
|
return this.queryContextProvider;
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
exports.EntityTableDataCoordinator = EntityTableDataCoordinator;
|
|
35
|
-
//# sourceMappingURL=EntityTableDataCoordinator.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityConfiguration } from '../EntityConfiguration';
|
|
2
|
-
import { IEntityCacheAdapter } from '../IEntityCacheAdapter';
|
|
3
|
-
import { IEntityLoadKey, IEntityLoadValue } from './EntityLoadInterfaces';
|
|
1
|
+
import type { EntityConfiguration } from '../EntityConfiguration.ts';
|
|
2
|
+
import type { IEntityCacheAdapter } from '../IEntityCacheAdapter.ts';
|
|
3
|
+
import type { IEntityLoadKey, IEntityLoadValue } from './EntityLoadInterfaces.ts';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ReadThroughEntityCache = exports.CacheStatus = void 0;
|
|
7
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
8
|
-
const maps_1 = require("../utils/collections/maps");
|
|
1
|
+
import invariant from 'invariant';
|
|
2
|
+
import { filterMap } from "../utils/collections/maps.js";
|
|
9
3
|
/**
|
|
10
4
|
* @internal
|
|
11
5
|
*/
|
|
12
|
-
var CacheStatus;
|
|
6
|
+
export var CacheStatus;
|
|
13
7
|
(function (CacheStatus) {
|
|
14
8
|
CacheStatus[CacheStatus["HIT"] = 0] = "HIT";
|
|
15
9
|
CacheStatus[CacheStatus["MISS"] = 1] = "MISS";
|
|
16
10
|
CacheStatus[CacheStatus["NEGATIVE"] = 2] = "NEGATIVE";
|
|
17
|
-
})(CacheStatus || (
|
|
11
|
+
})(CacheStatus || (CacheStatus = {}));
|
|
18
12
|
/**
|
|
19
13
|
* A read-through entity cache is responsible for coordinating EntityDatabaseAdapter and
|
|
20
14
|
* EntityCacheAdapter within the EntityDataManager.
|
|
21
15
|
*
|
|
22
16
|
* @internal
|
|
23
17
|
*/
|
|
24
|
-
class ReadThroughEntityCache {
|
|
18
|
+
export class ReadThroughEntityCache {
|
|
25
19
|
entityConfiguration;
|
|
26
20
|
entityCacheAdapter;
|
|
27
21
|
constructor(entityConfiguration, entityCacheAdapter) {
|
|
@@ -53,8 +47,8 @@ class ReadThroughEntityCache {
|
|
|
53
47
|
return await fetcher(values);
|
|
54
48
|
}
|
|
55
49
|
const cacheLoadResults = await this.entityCacheAdapter.loadManyAsync(key, values);
|
|
56
|
-
(
|
|
57
|
-
const valuesToFetchFromDB = Array.from(
|
|
50
|
+
invariant(cacheLoadResults.size === values.length, `${this.constructor.name} loadMany should return a result for each value`);
|
|
51
|
+
const valuesToFetchFromDB = Array.from(filterMap(cacheLoadResults, (cacheLoadResult) => cacheLoadResult.status === CacheStatus.MISS).keys());
|
|
58
52
|
// put transformed cache hits in result map
|
|
59
53
|
const results = key.vendNewLoadValueMap();
|
|
60
54
|
cacheLoadResults.forEach((cacheLoadResult, value) => {
|
|
@@ -105,5 +99,3 @@ class ReadThroughEntityCache {
|
|
|
105
99
|
await this.entityCacheAdapter.invalidateManyAsync(key, values);
|
|
106
100
|
}
|
|
107
101
|
}
|
|
108
|
-
exports.ReadThroughEntityCache = ReadThroughEntityCache;
|
|
109
|
-
//# sourceMappingURL=ReadThroughEntityCache.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EntityConfiguration } from '../EntityConfiguration';
|
|
2
|
-
import {
|
|
1
|
+
import type { EntityConfiguration } from '../EntityConfiguration.ts';
|
|
2
|
+
import type { IEntityLoadKey, IEntityLoadValue } from './EntityLoadInterfaces.ts';
|
|
3
|
+
import { EntityLoadMethodType, LoadValueMap } from './EntityLoadInterfaces.ts';
|
|
3
4
|
/**
|
|
4
5
|
* A load key that represents a single field (fieldName) on an entity.
|
|
5
6
|
*
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SingleFieldValueHolderMap = exports.SingleFieldValueHolder = exports.SingleFieldHolder = void 0;
|
|
7
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
8
|
-
const EntityFieldTransformationUtils_1 = require("./EntityFieldTransformationUtils");
|
|
9
|
-
const EntityLoadInterfaces_1 = require("./EntityLoadInterfaces");
|
|
1
|
+
import invariant from 'invariant';
|
|
2
|
+
import { getDatabaseFieldForEntityField } from "./EntityFieldTransformationUtils.js";
|
|
3
|
+
import { EntityLoadMethodType, LoadValueMap } from "./EntityLoadInterfaces.js";
|
|
10
4
|
/**
|
|
11
5
|
* A load key that represents a single field (fieldName) on an entity.
|
|
12
6
|
*
|
|
13
7
|
* @internal
|
|
14
8
|
*/
|
|
15
|
-
class SingleFieldHolder {
|
|
9
|
+
export class SingleFieldHolder {
|
|
16
10
|
fieldName;
|
|
17
11
|
constructor(fieldName) {
|
|
18
12
|
this.fieldName = fieldName;
|
|
@@ -24,7 +18,7 @@ class SingleFieldHolder {
|
|
|
24
18
|
return entityConfiguration.cacheableKeys.has(this.fieldName);
|
|
25
19
|
}
|
|
26
20
|
getDatabaseColumns(entityConfiguration) {
|
|
27
|
-
return [
|
|
21
|
+
return [getDatabaseFieldForEntityField(entityConfiguration, this.fieldName)];
|
|
28
22
|
}
|
|
29
23
|
getDatabaseValues(value) {
|
|
30
24
|
return [value.fieldValue];
|
|
@@ -38,11 +32,11 @@ class SingleFieldHolder {
|
|
|
38
32
|
}
|
|
39
33
|
createCacheKeyPartsForLoadValue(entityConfiguration, value) {
|
|
40
34
|
const columnName = entityConfiguration.entityToDBFieldsKeyMapping.get(this.fieldName);
|
|
41
|
-
(
|
|
35
|
+
invariant(columnName, `database field mapping missing for ${String(this.fieldName)}`);
|
|
42
36
|
return [columnName, String(value.fieldValue)];
|
|
43
37
|
}
|
|
44
38
|
getLoadMethodType() {
|
|
45
|
-
return
|
|
39
|
+
return EntityLoadMethodType.SINGLE;
|
|
46
40
|
}
|
|
47
41
|
getDataManagerDataLoaderKey() {
|
|
48
42
|
return this.fieldName;
|
|
@@ -63,13 +57,12 @@ class SingleFieldHolder {
|
|
|
63
57
|
return new SingleFieldValueHolderMap();
|
|
64
58
|
}
|
|
65
59
|
}
|
|
66
|
-
exports.SingleFieldHolder = SingleFieldHolder;
|
|
67
60
|
/**
|
|
68
61
|
* A load value for a SingleFieldHolder.
|
|
69
62
|
*
|
|
70
63
|
* @internal
|
|
71
64
|
*/
|
|
72
|
-
class SingleFieldValueHolder {
|
|
65
|
+
export class SingleFieldValueHolder {
|
|
73
66
|
fieldValue;
|
|
74
67
|
constructor(fieldValue) {
|
|
75
68
|
this.fieldValue = fieldValue;
|
|
@@ -84,14 +77,11 @@ class SingleFieldValueHolder {
|
|
|
84
77
|
return new SingleFieldValueHolder(fieldValue);
|
|
85
78
|
}
|
|
86
79
|
}
|
|
87
|
-
exports.SingleFieldValueHolder = SingleFieldValueHolder;
|
|
88
80
|
/**
|
|
89
81
|
* @internal
|
|
90
82
|
*/
|
|
91
|
-
class SingleFieldValueHolderMap extends
|
|
83
|
+
export class SingleFieldValueHolderMap extends LoadValueMap {
|
|
92
84
|
deserializeKey(serializedKey) {
|
|
93
85
|
return SingleFieldValueHolder.deserialize(serializedKey);
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
|
-
exports.SingleFieldValueHolderMap = SingleFieldValueHolderMap;
|
|
97
|
-
//# sourceMappingURL=SingleFieldHolder.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityQueryContext } from '../EntityQueryContext';
|
|
2
|
-
import { EntityMetricsLoadType, EntityMetricsMutationType, IEntityMetricsAdapter } from './IEntityMetricsAdapter';
|
|
3
|
-
import { IEntityLoadValue } from '../internal/EntityLoadInterfaces';
|
|
1
|
+
import type { EntityQueryContext } from '../EntityQueryContext.ts';
|
|
2
|
+
import type { EntityMetricsLoadType, EntityMetricsMutationType, IEntityMetricsAdapter } from './IEntityMetricsAdapter.ts';
|
|
3
|
+
import type { IEntityLoadValue } from '../internal/EntityLoadInterfaces.ts';
|
|
4
4
|
export declare const timeAndLogLoadEventAsync: (metricsAdapter: IEntityMetricsAdapter, loadType: EntityMetricsLoadType, entityClassName: string, queryContext: EntityQueryContext) => <TFields>(promise: Promise<readonly Readonly<TFields>[]>) => Promise<readonly Readonly<TFields>[]>;
|
|
5
5
|
export declare const timeAndLogLoadOneEventAsync: (metricsAdapter: IEntityMetricsAdapter, loadType: EntityMetricsLoadType, entityClassName: string, queryContext: EntityQueryContext) => <TFields>(promise: Promise<Readonly<TFields> | null>) => Promise<Readonly<TFields> | null>;
|
|
6
6
|
export declare const timeAndLogLoadMapEventAsync: (metricsAdapter: IEntityMetricsAdapter, loadType: EntityMetricsLoadType, entityClassName: string, queryContext: EntityQueryContext) => <TFields extends Record<string, any>, TSerializedLoadValue, TLoadValue extends IEntityLoadValue<TSerializedLoadValue>>(promise: Promise<ReadonlyMap<TLoadValue, readonly Readonly<TFields>[]>>) => Promise<ReadonlyMap<TLoadValue, readonly Readonly<TFields>[]>>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.timeAndLogMutationEventAsync = exports.timeAndLogLoadMapEventAsync = exports.timeAndLogLoadOneEventAsync = exports.timeAndLogLoadEventAsync = void 0;
|
|
4
|
-
const maps_1 = require("../utils/collections/maps");
|
|
5
|
-
const timeAndLogLoadEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
|
|
1
|
+
import { reduceMap } from "../utils/collections/maps.js";
|
|
2
|
+
export const timeAndLogLoadEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
|
|
6
3
|
const startTime = Date.now();
|
|
7
4
|
const result = await promise;
|
|
8
5
|
const endTime = Date.now();
|
|
@@ -15,8 +12,7 @@ const timeAndLogLoadEventAsync = (metricsAdapter, loadType, entityClassName, que
|
|
|
15
12
|
});
|
|
16
13
|
return result;
|
|
17
14
|
};
|
|
18
|
-
|
|
19
|
-
const timeAndLogLoadOneEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
|
|
15
|
+
export const timeAndLogLoadOneEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
|
|
20
16
|
const startTime = Date.now();
|
|
21
17
|
const result = await promise;
|
|
22
18
|
const endTime = Date.now();
|
|
@@ -29,12 +25,11 @@ const timeAndLogLoadOneEventAsync = (metricsAdapter, loadType, entityClassName,
|
|
|
29
25
|
});
|
|
30
26
|
return result;
|
|
31
27
|
};
|
|
32
|
-
|
|
33
|
-
const timeAndLogLoadMapEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
|
|
28
|
+
export const timeAndLogLoadMapEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
|
|
34
29
|
const startTime = Date.now();
|
|
35
30
|
const result = await promise;
|
|
36
31
|
const endTime = Date.now();
|
|
37
|
-
const count =
|
|
32
|
+
const count = reduceMap(result, (acc, v) => acc + v.length, 0);
|
|
38
33
|
metricsAdapter.logDataManagerLoadEvent({
|
|
39
34
|
type: loadType,
|
|
40
35
|
isInTransaction: queryContext.isInTransaction(),
|
|
@@ -44,8 +39,7 @@ const timeAndLogLoadMapEventAsync = (metricsAdapter, loadType, entityClassName,
|
|
|
44
39
|
});
|
|
45
40
|
return result;
|
|
46
41
|
};
|
|
47
|
-
|
|
48
|
-
const timeAndLogMutationEventAsync = (metricsAdapter, mutationType, entityClassName, queryContext) => async (promise) => {
|
|
42
|
+
export const timeAndLogMutationEventAsync = (metricsAdapter, mutationType, entityClassName, queryContext) => async (promise) => {
|
|
49
43
|
const startTime = Date.now();
|
|
50
44
|
const result = await promise;
|
|
51
45
|
const endTime = Date.now();
|
|
@@ -57,5 +51,3 @@ const timeAndLogMutationEventAsync = (metricsAdapter, mutationType, entityClassN
|
|
|
57
51
|
});
|
|
58
52
|
return result;
|
|
59
53
|
};
|
|
60
|
-
exports.timeAndLogMutationEventAsync = timeAndLogMutationEventAsync;
|
|
61
|
-
//# sourceMappingURL=EntityMetricsUtils.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EntityAuthorizationAction, EntityPrivacyPolicyEvaluationMode } from '../EntityPrivacyPolicy';
|
|
2
|
-
import { EntityLoadMethodType } from '../internal/EntityLoadInterfaces';
|
|
1
|
+
import type { EntityAuthorizationAction, EntityPrivacyPolicyEvaluationMode } from '../EntityPrivacyPolicy.ts';
|
|
2
|
+
import type { EntityLoadMethodType } from '../internal/EntityLoadInterfaces.ts';
|
|
3
3
|
export declare enum EntityMetricsLoadType {
|
|
4
4
|
LOAD_MANY = 0,
|
|
5
5
|
LOAD_MANY_EQUALITY_CONJUNCTION = 1,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EntityMetricsAuthorizationResult = exports.IncrementLoadCountEventType = exports.EntityMetricsMutationType = exports.EntityMetricsLoadType = void 0;
|
|
4
|
-
var EntityMetricsLoadType;
|
|
1
|
+
export var EntityMetricsLoadType;
|
|
5
2
|
(function (EntityMetricsLoadType) {
|
|
6
3
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY"] = 0] = "LOAD_MANY";
|
|
7
4
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY_EQUALITY_CONJUNCTION"] = 1] = "LOAD_MANY_EQUALITY_CONJUNCTION";
|
|
@@ -9,14 +6,14 @@ var EntityMetricsLoadType;
|
|
|
9
6
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY_SQL"] = 3] = "LOAD_MANY_SQL";
|
|
10
7
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_ONE"] = 4] = "LOAD_ONE";
|
|
11
8
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_PAGE"] = 5] = "LOAD_PAGE";
|
|
12
|
-
})(EntityMetricsLoadType || (
|
|
13
|
-
var EntityMetricsMutationType;
|
|
9
|
+
})(EntityMetricsLoadType || (EntityMetricsLoadType = {}));
|
|
10
|
+
export var EntityMetricsMutationType;
|
|
14
11
|
(function (EntityMetricsMutationType) {
|
|
15
12
|
EntityMetricsMutationType[EntityMetricsMutationType["CREATE"] = 0] = "CREATE";
|
|
16
13
|
EntityMetricsMutationType[EntityMetricsMutationType["UPDATE"] = 1] = "UPDATE";
|
|
17
14
|
EntityMetricsMutationType[EntityMetricsMutationType["DELETE"] = 2] = "DELETE";
|
|
18
|
-
})(EntityMetricsMutationType || (
|
|
19
|
-
var IncrementLoadCountEventType;
|
|
15
|
+
})(EntityMetricsMutationType || (EntityMetricsMutationType = {}));
|
|
16
|
+
export var IncrementLoadCountEventType;
|
|
20
17
|
(function (IncrementLoadCountEventType) {
|
|
21
18
|
/**
|
|
22
19
|
* Type for when a dataloader load is initiated via the standard load methods
|
|
@@ -31,10 +28,9 @@ var IncrementLoadCountEventType;
|
|
|
31
28
|
* Type for when a database load is initiated due to a dataloader and cache miss, when an entity query doesn't support caching, or during a transaction.
|
|
32
29
|
*/
|
|
33
30
|
IncrementLoadCountEventType[IncrementLoadCountEventType["DATABASE"] = 2] = "DATABASE";
|
|
34
|
-
})(IncrementLoadCountEventType || (
|
|
35
|
-
var EntityMetricsAuthorizationResult;
|
|
31
|
+
})(IncrementLoadCountEventType || (IncrementLoadCountEventType = {}));
|
|
32
|
+
export var EntityMetricsAuthorizationResult;
|
|
36
33
|
(function (EntityMetricsAuthorizationResult) {
|
|
37
34
|
EntityMetricsAuthorizationResult[EntityMetricsAuthorizationResult["DENY"] = 0] = "DENY";
|
|
38
35
|
EntityMetricsAuthorizationResult[EntityMetricsAuthorizationResult["ALLOW"] = 1] = "ALLOW";
|
|
39
|
-
})(EntityMetricsAuthorizationResult || (
|
|
40
|
-
//# sourceMappingURL=IEntityMetricsAdapter.js.map
|
|
36
|
+
})(EntityMetricsAuthorizationResult || (EntityMetricsAuthorizationResult = {}));
|