@expo/entity 0.55.0 → 0.57.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 +1 -1
- package/build/src/AuthorizationResultBasedEntityAssociationLoader.js.map +1 -1
- package/build/src/AuthorizationResultBasedEntityLoader.d.ts +18 -24
- package/build/src/AuthorizationResultBasedEntityLoader.js +37 -56
- package/build/src/AuthorizationResultBasedEntityLoader.js.map +1 -1
- package/build/src/AuthorizationResultBasedEntityMutator.js +26 -19
- package/build/src/AuthorizationResultBasedEntityMutator.js.map +1 -1
- package/build/src/EnforcingEntityCreator.d.ts +1 -1
- package/build/src/EnforcingEntityCreator.js +1 -1
- package/build/src/EnforcingEntityLoader.d.ts +1 -58
- package/build/src/EnforcingEntityLoader.js +0 -65
- package/build/src/EnforcingEntityLoader.js.map +1 -1
- package/build/src/Entity.d.ts +6 -0
- package/build/src/Entity.js +6 -0
- package/build/src/Entity.js.map +1 -1
- package/build/src/EntityCompanion.d.ts +2 -2
- package/build/src/EntityCompanion.js.map +1 -1
- package/build/src/EntityCompanionProvider.d.ts +1 -1
- package/build/src/EntityCompanionProvider.js +4 -4
- package/build/src/EntityConfiguration.d.ts +1 -1
- package/build/src/EntityConfiguration.js +1 -2
- package/build/src/EntityConfiguration.js.map +1 -1
- package/build/src/{EntityLoaderUtils.d.ts → EntityConstructionUtils.d.ts} +15 -29
- package/build/src/EntityConstructionUtils.js +118 -0
- package/build/src/EntityConstructionUtils.js.map +1 -0
- package/build/src/EntityDatabaseAdapter.d.ts +10 -108
- package/build/src/EntityDatabaseAdapter.js +14 -76
- package/build/src/EntityDatabaseAdapter.js.map +1 -1
- package/build/src/EntityFieldDefinition.d.ts +1 -1
- package/build/src/EntityInvalidationUtils.d.ts +41 -0
- package/build/src/EntityInvalidationUtils.js +71 -0
- package/build/src/EntityInvalidationUtils.js.map +1 -0
- package/build/src/EntityLoader.d.ts +0 -6
- package/build/src/EntityLoader.js +0 -7
- package/build/src/EntityLoader.js.map +1 -1
- package/build/src/EntityLoaderFactory.d.ts +4 -0
- package/build/src/EntityLoaderFactory.js +10 -3
- package/build/src/EntityLoaderFactory.js.map +1 -1
- package/build/src/EntityPrivacyPolicy.d.ts +27 -0
- package/build/src/EntityPrivacyPolicy.js +22 -1
- package/build/src/EntityPrivacyPolicy.js.map +1 -1
- package/build/src/EntitySecondaryCacheLoader.d.ts +14 -3
- package/build/src/EntitySecondaryCacheLoader.js +21 -4
- package/build/src/EntitySecondaryCacheLoader.js.map +1 -1
- package/build/src/ReadonlyEntity.d.ts +4 -5
- package/build/src/ReadonlyEntity.js +7 -8
- package/build/src/ReadonlyEntity.js.map +1 -1
- package/build/src/ViewerContext.d.ts +6 -6
- package/build/src/ViewerContext.js +8 -8
- package/build/src/ViewerScopedEntityCompanion.d.ts +1 -1
- package/build/src/ViewerScopedEntityCompanion.js.map +1 -1
- package/build/src/ViewerScopedEntityLoaderFactory.d.ts +4 -0
- package/build/src/ViewerScopedEntityLoaderFactory.js +6 -0
- package/build/src/ViewerScopedEntityLoaderFactory.js.map +1 -1
- package/build/src/errors/EntityDatabaseAdapterError.d.ts +4 -0
- package/build/src/errors/EntityDatabaseAdapterError.js +13 -1
- package/build/src/errors/EntityDatabaseAdapterError.js.map +1 -1
- package/build/src/errors/EntityError.d.ts +2 -1
- package/build/src/errors/EntityError.js +1 -0
- package/build/src/errors/EntityError.js.map +1 -1
- package/build/src/index.d.ts +2 -1
- package/build/src/index.js +2 -1
- package/build/src/index.js.map +1 -1
- package/build/src/internal/EntityDataManager.d.ts +8 -16
- package/build/src/internal/EntityDataManager.js +8 -18
- package/build/src/internal/EntityDataManager.js.map +1 -1
- package/build/src/internal/EntityFieldTransformationUtils.js.map +1 -1
- package/build/src/internal/EntityLoadInterfaces.d.ts +2 -0
- package/build/src/internal/EntityLoadInterfaces.js +2 -0
- package/build/src/internal/EntityLoadInterfaces.js.map +1 -1
- package/build/src/internal/EntityTableDataCoordinator.d.ts +2 -0
- package/build/src/internal/EntityTableDataCoordinator.js +4 -0
- package/build/src/internal/EntityTableDataCoordinator.js.map +1 -1
- package/build/src/metrics/EntityMetricsUtils.d.ts +1 -0
- package/build/src/metrics/EntityMetricsUtils.js +15 -1
- package/build/src/metrics/EntityMetricsUtils.js.map +1 -1
- package/build/src/metrics/IEntityMetricsAdapter.d.ts +4 -1
- package/build/src/metrics/IEntityMetricsAdapter.js +3 -0
- package/build/src/metrics/IEntityMetricsAdapter.js.map +1 -1
- package/build/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.d.ts +2 -2
- package/build/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.d.ts +2 -2
- package/build/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.d.ts +2 -2
- package/build/src/rules/PrivacyPolicyRule.d.ts +2 -2
- package/build/src/utils/EntityPrivacyUtils.js +11 -20
- package/build/src/utils/EntityPrivacyUtils.js.map +1 -1
- package/build/src/utils/collections/maps.d.ts +2 -2
- package/build/src/utils/collections/maps.js +2 -2
- package/package.json +4 -4
- package/src/AuthorizationResultBasedEntityAssociationLoader.ts +4 -7
- package/src/AuthorizationResultBasedEntityLoader.ts +58 -88
- package/src/AuthorizationResultBasedEntityMutator.ts +35 -20
- package/src/EnforcingEntityCreator.ts +1 -1
- package/src/EnforcingEntityLoader.ts +1 -95
- package/src/Entity.ts +6 -0
- package/src/EntityCompanion.ts +2 -2
- package/src/EntityCompanionProvider.ts +4 -4
- package/src/EntityConfiguration.ts +8 -5
- package/src/EntityConstructionUtils.ts +168 -0
- package/src/EntityDatabaseAdapter.ts +32 -222
- package/src/EntityFieldDefinition.ts +1 -1
- package/src/{EntityLoaderUtils.ts → EntityInvalidationUtils.ts} +5 -96
- package/src/EntityLoader.ts +0 -16
- package/src/EntityLoaderFactory.ts +50 -10
- package/src/EntityPrivacyPolicy.ts +44 -1
- package/src/EntitySecondaryCacheLoader.ts +54 -3
- package/src/ReadonlyEntity.ts +9 -11
- package/src/ViewerContext.ts +10 -10
- package/src/ViewerScopedEntityCompanion.ts +1 -1
- package/src/ViewerScopedEntityLoaderFactory.ts +37 -0
- package/src/__tests__/AuthorizationResultBasedEntityLoader-constructor-test.ts +3 -5
- package/src/__tests__/AuthorizationResultBasedEntityLoader-test.ts +34 -419
- package/src/__tests__/ComposedCacheAdapter-test.ts +3 -3
- package/src/__tests__/EnforcingEntityLoader-test.ts +2 -134
- package/src/__tests__/EntityCompanion-test.ts +18 -0
- package/src/__tests__/EntityConfiguration-test.ts +4 -4
- package/src/__tests__/EntityDatabaseAdapter-test.ts +33 -68
- package/src/__tests__/EntityEdges-test.ts +10 -10
- package/src/__tests__/EntityLoader-test.ts +6 -4
- package/src/__tests__/EntityMutator-test.ts +27 -15
- package/src/__tests__/EntityPrivacyPolicy-test.ts +102 -0
- package/src/__tests__/EntityQueryContext-test.ts +11 -11
- package/src/__tests__/EntitySecondaryCacheLoader-test.ts +10 -5
- package/src/__tests__/EntitySelfReferentialEdges-test.ts +6 -6
- package/src/__tests__/GenericEntityCacheAdapter-test.ts +18 -15
- package/src/__tests__/GenericSecondaryEntityCache-test.ts +27 -5
- package/src/__tests__/ReadonlyEntity-test.ts +6 -4
- package/src/__tests__/ViewerContext-test.ts +4 -4
- package/src/__tests__/ViewerScopedEntityCompanion-test.ts +1 -0
- package/src/__tests__/cases/TwoEntitySameTableDisjointRows-test.ts +0 -17
- package/src/errors/EntityDatabaseAdapterError.ts +14 -0
- package/src/errors/EntityError.ts +1 -0
- package/src/errors/__tests__/EntityDatabaseAdapterError-test.ts +9 -0
- package/src/errors/__tests__/EntityError-test.ts +13 -5
- package/src/index.ts +2 -1
- package/src/internal/EntityDataManager.ts +19 -54
- package/src/internal/EntityFieldTransformationUtils.ts +5 -5
- package/src/internal/EntityLoadInterfaces.ts +2 -0
- package/src/internal/EntityTableDataCoordinator.ts +2 -2
- package/src/internal/__tests__/CompositeFieldHolder-test.ts +8 -2
- package/src/internal/__tests__/EntityDataManager-test.ts +71 -202
- package/src/internal/__tests__/ReadThroughEntityCache-test.ts +39 -24
- package/src/metrics/EntityMetricsUtils.ts +23 -0
- package/src/metrics/IEntityMetricsAdapter.ts +3 -0
- package/src/metrics/__tests__/EntityMetricsUtils-test.ts +120 -0
- package/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.ts +2 -2
- package/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.ts +2 -2
- package/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.ts +2 -2
- package/src/rules/PrivacyPolicyRule.ts +2 -2
- package/src/rules/__tests__/AllowIfAllSubRulesAllowPrivacyPolicyRule-test.ts +4 -4
- package/src/rules/__tests__/AllowIfAnySubRuleAllowsPrivacyPolicyRule-test.ts +4 -4
- package/src/rules/__tests__/AllowIfInParentCascadeDeletionPrivacyPolicyRule-test.ts +11 -1
- package/src/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.ts +2 -2
- package/src/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.ts +2 -2
- package/src/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.ts +2 -2
- package/src/rules/__tests__/EvaluateIfEntityFieldPredicatePrivacyPolicyRule-test.ts +3 -3
- package/src/utils/EntityPrivacyUtils.ts +18 -29
- package/src/utils/__testfixtures__/PrivacyPolicyRuleTestUtils.ts +2 -2
- package/src/utils/__testfixtures__/StubDatabaseAdapter.ts +13 -101
- package/src/utils/__tests__/EntityCreationUtils-test.ts +6 -6
- package/src/utils/__tests__/EntityPrivacyUtils-test.ts +2 -2
- package/src/utils/collections/maps.ts +2 -2
- package/build/src/EntityLoaderUtils.js +0 -147
- package/build/src/EntityLoaderUtils.js.map +0 -1
|
@@ -6,6 +6,9 @@ var EntityMetricsLoadType;
|
|
|
6
6
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY"] = 0] = "LOAD_MANY";
|
|
7
7
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY_EQUALITY_CONJUNCTION"] = 1] = "LOAD_MANY_EQUALITY_CONJUNCTION";
|
|
8
8
|
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY_RAW"] = 2] = "LOAD_MANY_RAW";
|
|
9
|
+
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY_SQL"] = 3] = "LOAD_MANY_SQL";
|
|
10
|
+
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_ONE"] = 4] = "LOAD_ONE";
|
|
11
|
+
EntityMetricsLoadType[EntityMetricsLoadType["LOAD_PAGE"] = 5] = "LOAD_PAGE";
|
|
9
12
|
})(EntityMetricsLoadType || (exports.EntityMetricsLoadType = EntityMetricsLoadType = {}));
|
|
10
13
|
var EntityMetricsMutationType;
|
|
11
14
|
(function (EntityMetricsMutationType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEntityMetricsAdapter.js","sourceRoot":"","sources":["../../../src/metrics/IEntityMetricsAdapter.ts"],"names":[],"mappings":";;;AAMA,IAAY,
|
|
1
|
+
{"version":3,"file":"IEntityMetricsAdapter.js","sourceRoot":"","sources":["../../../src/metrics/IEntityMetricsAdapter.ts"],"names":[],"mappings":";;;AAMA,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,2EAAS,CAAA;IACT,qHAA8B,CAAA;IAC9B,mFAAa,CAAA;IACb,mFAAa,CAAA;IACb,yEAAQ,CAAA;IACR,2EAAS,CAAA;AACX,CAAC,EAPW,qBAAqB,qCAArB,qBAAqB,QAOhC;AAgCD,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,6EAAM,CAAA;IACN,6EAAM,CAAA;IACN,6EAAM,CAAA;AACR,CAAC,EAJW,yBAAyB,yCAAzB,yBAAyB,QAIpC;AAwBD,IAAY,2BAgBX;AAhBD,WAAY,2BAA2B;IACrC;;;OAGG;IACH,yFAAU,CAAA;IAEV;;OAEG;IACH,+EAAK,CAAA;IAEL;;OAEG;IACH,qFAAQ,CAAA;AACV,CAAC,EAhBW,2BAA2B,2CAA3B,2BAA2B,QAgBtC;AAgCD,IAAY,gCAGX;AAHD,WAAY,gCAAgC;IAC1C,uFAAI,CAAA;IACJ,yFAAK,CAAA;AACP,CAAC,EAHW,gCAAgC,gDAAhC,gCAAgC,QAG3C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy';
|
|
2
2
|
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
3
|
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
4
4
|
import { ViewerContext } from '../ViewerContext';
|
|
@@ -6,5 +6,5 @@ import { PrivacyPolicyRule, RuleEvaluationResult } from './PrivacyPolicyRule';
|
|
|
6
6
|
export declare class AllowIfAllSubRulesAllowPrivacyPolicyRule<TFields extends object, TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> extends PrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
7
7
|
private readonly subRules;
|
|
8
8
|
constructor(subRules: PrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>[]);
|
|
9
|
-
evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext:
|
|
9
|
+
evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>, entity: TEntity): Promise<RuleEvaluationResult>;
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy';
|
|
2
2
|
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
3
|
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
4
4
|
import { ViewerContext } from '../ViewerContext';
|
|
@@ -6,5 +6,5 @@ import { PrivacyPolicyRule, RuleEvaluationResult } from './PrivacyPolicyRule';
|
|
|
6
6
|
export declare class AllowIfAnySubRuleAllowsPrivacyPolicyRule<TFields extends object, TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> extends PrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields> {
|
|
7
7
|
private readonly subRules;
|
|
8
8
|
constructor(subRules: PrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>[]);
|
|
9
|
-
evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext:
|
|
9
|
+
evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>, entity: TEntity): Promise<RuleEvaluationResult>;
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy';
|
|
2
2
|
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
3
|
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
4
4
|
import { ViewerContext } from '../ViewerContext';
|
|
@@ -8,5 +8,5 @@ export declare class EvaluateIfEntityFieldPredicatePrivacyPolicyRule<TFields ext
|
|
|
8
8
|
private readonly shouldEvaluatePredicate;
|
|
9
9
|
private readonly rule;
|
|
10
10
|
constructor(fieldName: N, shouldEvaluatePredicate: (fieldValue: TFields[N]) => boolean, rule: PrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>);
|
|
11
|
-
evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext:
|
|
11
|
+
evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>, entity: TEntity): Promise<RuleEvaluationResult>;
|
|
12
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../EntityPrivacyPolicy';
|
|
2
2
|
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
3
|
import { ReadonlyEntity } from '../ReadonlyEntity';
|
|
4
4
|
import { ViewerContext } from '../ViewerContext';
|
|
@@ -33,5 +33,5 @@ export declare enum RuleEvaluationResult {
|
|
|
33
33
|
* would be named something like `DenyIfViewerHasBeenBlockedPrivacyPolicyRule`.
|
|
34
34
|
*/
|
|
35
35
|
export declare abstract class PrivacyPolicyRule<TFields extends Record<string, any>, TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
|
|
36
|
-
abstract evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext:
|
|
36
|
+
abstract evaluateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>, entity: TEntity): Promise<RuleEvaluationResult>;
|
|
37
37
|
}
|
|
@@ -132,10 +132,13 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
132
132
|
for (const inboundEdge of inboundEdges) {
|
|
133
133
|
const configurationForInboundEdge = entityCompanionProvider.getCompanionForEntity(inboundEdge).entityCompanionDefinition
|
|
134
134
|
.entityConfiguration;
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
const entityCompanion = viewerContext.getViewerScopedEntityCompanionForClass(inboundEdge);
|
|
136
|
+
const loaderFactory = entityCompanion.getLoaderFactory();
|
|
137
|
+
const loader = loaderFactory.forLoad(queryContext, {
|
|
138
|
+
previousValue: null,
|
|
139
|
+
cascadingDeleteCause: newCascadingDeleteCause,
|
|
140
|
+
});
|
|
141
|
+
const constructionUtils = loaderFactory.constructionUtils(queryContext, {
|
|
139
142
|
previousValue: null,
|
|
140
143
|
cascadingDeleteCause: newCascadingDeleteCause,
|
|
141
144
|
});
|
|
@@ -152,14 +155,9 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
152
155
|
let entityResultsToCheckForInboundEdge;
|
|
153
156
|
if (edgeDeletionPermissionInferenceBehavior ===
|
|
154
157
|
EntityFieldDefinition_1.EntityEdgeDeletionAuthorizationInferenceBehavior.ONE_IMPLIES_ALL) {
|
|
155
|
-
const singleEntityResultToTestForInboundEdge = await loader.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
fieldValue: association.associatedEntityLookupByField
|
|
159
|
-
? sourceEntity.getField(association.associatedEntityLookupByField)
|
|
160
|
-
: sourceEntity.getID(),
|
|
161
|
-
},
|
|
162
|
-
], { orderBy: [] });
|
|
158
|
+
const singleEntityResultToTestForInboundEdge = await loader['loadOneByFieldEqualingAsync'](fieldName, association.associatedEntityLookupByField
|
|
159
|
+
? sourceEntity.getField(association.associatedEntityLookupByField)
|
|
160
|
+
: sourceEntity.getID());
|
|
163
161
|
entityResultsToCheckForInboundEdge = singleEntityResultToTestForInboundEdge
|
|
164
162
|
? [singleEntityResultToTestForInboundEdge]
|
|
165
163
|
: [];
|
|
@@ -196,13 +194,6 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
196
194
|
// create synthetic entities with the reference field set to null to properly evaluate
|
|
197
195
|
// privacy policy as it would be after the cascading SET NULL operation
|
|
198
196
|
const previousAndSyntheticEntitiesForInboundEdge = entitiesForInboundEdge.map((entity) => {
|
|
199
|
-
const entityLoader = viewerContext
|
|
200
|
-
.getViewerScopedEntityCompanionForClass(inboundEdge)
|
|
201
|
-
.getLoaderFactory()
|
|
202
|
-
.forLoad(queryContext, {
|
|
203
|
-
previousValue: entity,
|
|
204
|
-
cascadingDeleteCause: newCascadingDeleteCause,
|
|
205
|
-
});
|
|
206
197
|
const allFields = entity.getAllDatabaseFields();
|
|
207
198
|
const syntheticFields = {
|
|
208
199
|
...allFields,
|
|
@@ -210,7 +201,7 @@ async function canViewerDeleteInternalAsync(entityClass, sourceEntity, evaluatio
|
|
|
210
201
|
};
|
|
211
202
|
return {
|
|
212
203
|
previousValue: entity,
|
|
213
|
-
syntheticallyUpdatedValue:
|
|
204
|
+
syntheticallyUpdatedValue: constructionUtils.constructEntity(syntheticFields),
|
|
214
205
|
};
|
|
215
206
|
});
|
|
216
207
|
const canUpdateEvaluationResults = await Promise.all(previousAndSyntheticEntitiesForInboundEdge.map(({ previousValue, syntheticallyUpdatedValue }) => canViewerUpdateInternalAsync(inboundEdge, syntheticallyUpdatedValue, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPrivacyUtils.js","sourceRoot":"","sources":["../../../src/utils/EntityPrivacyUtils.ts"],"names":[],"mappings":";;AA4CA,oDAoCC;AAWD,sEAmCC;AAmED,oDAoCC;AAWD,sEAmCC;AAnRD,2CAAoD;AAGpD,oEAGkC;AAKlC,gDAA+D;AAC/D,iFAA8E;AAe9E;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,oBAAoB,CAcxC,WAOC,EACD,YAAqB,EACrB,eAAmC,YAAY;KAC5C,gBAAgB,EAAE;KAClB,sCAAsC,CAAC,WAAW,CAAC;KACnD,uBAAuB,EAAE;KACzB,eAAe,EAAE;IAEpB,MAAM,MAAM,GAAG,MAAM,4BAA4B,CAC/C,WAAW,EACX,YAAY,EACZ,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,IAAI,EAAE,E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KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* If the specified key is not already associated with a value in this map,
|
|
3
|
-
* its value using the given mapping function and enters it into this map
|
|
2
|
+
* If the specified key is not already associated with a value in this map, computes
|
|
3
|
+
* its value using the given mapping function and enters it into this map.
|
|
4
4
|
*
|
|
5
5
|
* @param map - map from which to get the key's value or compute and associate
|
|
6
6
|
* @param key - key for which to get the value or with which the computed value is to be associated
|
|
@@ -7,8 +7,8 @@ exports.reduceMapAsync = exports.reduceMap = exports.invertMap = exports.zipToMa
|
|
|
7
7
|
exports.filterMap = filterMap;
|
|
8
8
|
const invariant_1 = __importDefault(require("invariant"));
|
|
9
9
|
/**
|
|
10
|
-
* If the specified key is not already associated with a value in this map,
|
|
11
|
-
* its value using the given mapping function and enters it into this map
|
|
10
|
+
* If the specified key is not already associated with a value in this map, computes
|
|
11
|
+
* its value using the given mapping function and enters it into this map.
|
|
12
12
|
*
|
|
13
13
|
* @param map - map from which to get the key's value or compute and associate
|
|
14
14
|
* @param key - key for which to get the value or with which the computed value is to be associated
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/entity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "A privacy-first data model",
|
|
5
5
|
"files": [
|
|
6
6
|
"build",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jest/globals": "30.2.0",
|
|
36
36
|
"@types/invariant": "2.2.37",
|
|
37
|
-
"@types/lodash": "4.17.
|
|
38
|
-
"@types/node": "24.10.
|
|
37
|
+
"@types/lodash": "4.17.24",
|
|
38
|
+
"@types/node": "24.10.13",
|
|
39
39
|
"lodash": "4.17.23",
|
|
40
40
|
"ts-mockito": "2.6.1",
|
|
41
41
|
"typescript": "5.9.3",
|
|
42
42
|
"uuid": "13.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e876cfb27bb9b0004d81b40c9067481e3e0c2beb"
|
|
45
45
|
}
|
|
@@ -16,7 +16,7 @@ export class AuthorizationResultBasedEntityAssociationLoader<
|
|
|
16
16
|
TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>,
|
|
17
17
|
TViewerContext extends ViewerContext,
|
|
18
18
|
TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>,
|
|
19
|
-
TSelectedFields extends keyof TFields,
|
|
19
|
+
TSelectedFields extends keyof TFields = keyof TFields,
|
|
20
20
|
> {
|
|
21
21
|
constructor(
|
|
22
22
|
private readonly entity: TEntity,
|
|
@@ -123,10 +123,7 @@ export class AuthorizationResultBasedEntityAssociationLoader<
|
|
|
123
123
|
.getViewerScopedEntityCompanionForClass(associatedEntityClass)
|
|
124
124
|
.getLoaderFactory()
|
|
125
125
|
.forLoad(this.queryContext, { previousValue: null, cascadingDeleteCause: null });
|
|
126
|
-
return await loader.loadManyByFieldEqualingAsync(
|
|
127
|
-
associatedEntityFieldContainingThisID,
|
|
128
|
-
thisID as any,
|
|
129
|
-
);
|
|
126
|
+
return await loader.loadManyByFieldEqualingAsync(associatedEntityFieldContainingThisID, thisID);
|
|
130
127
|
}
|
|
131
128
|
|
|
132
129
|
/**
|
|
@@ -178,7 +175,7 @@ export class AuthorizationResultBasedEntityAssociationLoader<
|
|
|
178
175
|
.forLoad(this.queryContext, { previousValue: null, cascadingDeleteCause: null });
|
|
179
176
|
return await loader.loadByFieldEqualingAsync(
|
|
180
177
|
associatedEntityLookupByField,
|
|
181
|
-
associatedFieldValue
|
|
178
|
+
associatedFieldValue,
|
|
182
179
|
);
|
|
183
180
|
}
|
|
184
181
|
|
|
@@ -232,7 +229,7 @@ export class AuthorizationResultBasedEntityAssociationLoader<
|
|
|
232
229
|
.forLoad(this.queryContext, { previousValue: null, cascadingDeleteCause: null });
|
|
233
230
|
return await loader.loadManyByFieldEqualingAsync(
|
|
234
231
|
associatedEntityLookupByField,
|
|
235
|
-
associatedFieldValue
|
|
232
|
+
associatedFieldValue,
|
|
236
233
|
);
|
|
237
234
|
}
|
|
238
235
|
|
|
@@ -8,24 +8,16 @@ import {
|
|
|
8
8
|
EntityCompositeFieldValue,
|
|
9
9
|
EntityConfiguration,
|
|
10
10
|
} from './EntityConfiguration';
|
|
11
|
-
import {
|
|
12
|
-
FieldEqualityCondition,
|
|
13
|
-
isSingleValueFieldEqualityCondition,
|
|
14
|
-
QuerySelectionModifiers,
|
|
15
|
-
QuerySelectionModifiersWithOrderByRaw,
|
|
16
|
-
} from './EntityDatabaseAdapter';
|
|
17
|
-
import { EntityLoaderUtils } from './EntityLoaderUtils';
|
|
11
|
+
import { EntityConstructionUtils } from './EntityConstructionUtils';
|
|
18
12
|
import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
|
|
19
13
|
import { EntityQueryContext } from './EntityQueryContext';
|
|
20
14
|
import { ReadonlyEntity } from './ReadonlyEntity';
|
|
21
15
|
import { ViewerContext } from './ViewerContext';
|
|
22
|
-
import { EntityInvalidFieldValueError } from './errors/EntityInvalidFieldValueError';
|
|
23
16
|
import { EntityNotFoundError } from './errors/EntityNotFoundError';
|
|
24
17
|
import { CompositeFieldHolder, CompositeFieldValueHolder } from './internal/CompositeFieldHolder';
|
|
25
18
|
import { CompositeFieldValueMap } from './internal/CompositeFieldValueMap';
|
|
26
19
|
import { EntityDataManager } from './internal/EntityDataManager';
|
|
27
20
|
import { SingleFieldHolder, SingleFieldValueHolder } from './internal/SingleFieldHolder';
|
|
28
|
-
import { IEntityMetricsAdapter } from './metrics/IEntityMetricsAdapter';
|
|
29
21
|
import { mapKeys, mapMap } from './utils/collections/maps';
|
|
30
22
|
import { areSetsEqual } from './utils/collections/sets';
|
|
31
23
|
|
|
@@ -61,8 +53,7 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
61
53
|
TSelectedFields
|
|
62
54
|
>,
|
|
63
55
|
private readonly dataManager: EntityDataManager<TFields, TIDField>,
|
|
64
|
-
|
|
65
|
-
public readonly utils: EntityLoaderUtils<
|
|
56
|
+
private readonly constructionUtils: EntityConstructionUtils<
|
|
66
57
|
TFields,
|
|
67
58
|
TIDField,
|
|
68
59
|
TViewerContext,
|
|
@@ -96,7 +87,9 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
96
87
|
loadValuesToFieldObjects,
|
|
97
88
|
(loadValue) => loadValue.fieldValue,
|
|
98
89
|
);
|
|
99
|
-
return await this.
|
|
90
|
+
return await this.constructionUtils.constructAndAuthorizeEntitiesAsync(
|
|
91
|
+
fieldValuesToFieldObjects,
|
|
92
|
+
);
|
|
100
93
|
}
|
|
101
94
|
|
|
102
95
|
/**
|
|
@@ -141,6 +134,41 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
141
134
|
return entityResultsForFieldValue;
|
|
142
135
|
}
|
|
143
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Load one entity where fieldName equals fieldValue, or null if no entity exists matching the condition.
|
|
139
|
+
* Not cached or coalesced, and not guaranteed to be deterministic if multiple entities match the condition.
|
|
140
|
+
*
|
|
141
|
+
* Only used when evaluating EntityEdgeDeletionAuthorizationInferenceBehavior.ONE_IMPLIES_ALL.
|
|
142
|
+
*
|
|
143
|
+
* @param fieldName - entity field being queried
|
|
144
|
+
* @param fieldValue - fieldName field value being queried
|
|
145
|
+
* @returns entity result matching the query for fieldValue. Returns null if no entity matches the query.
|
|
146
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
147
|
+
*
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
151
|
+
// @ts-ignore -- this method is used in EntityPrivacyUtils, but is not intended to be part of the public API of this class, so it is marked as private.
|
|
152
|
+
private async loadOneByFieldEqualingAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
153
|
+
fieldName: N,
|
|
154
|
+
fieldValue: NonNullable<TFields[N]>,
|
|
155
|
+
): Promise<Result<TEntity> | null> {
|
|
156
|
+
const { loadKey, loadValue } = this.validateFieldAndValueAndConvertToHolders(
|
|
157
|
+
fieldName,
|
|
158
|
+
fieldValue,
|
|
159
|
+
);
|
|
160
|
+
const result = await this.dataManager.loadOneEqualingAsync(
|
|
161
|
+
this.queryContext,
|
|
162
|
+
loadKey,
|
|
163
|
+
loadValue,
|
|
164
|
+
);
|
|
165
|
+
if (!result) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return await this.constructionUtils.constructAndAuthorizeEntityAsync(result);
|
|
170
|
+
}
|
|
171
|
+
|
|
144
172
|
/**
|
|
145
173
|
* Authorization-result-based version of the EnforcingEntityLoader method by the same name.
|
|
146
174
|
* @returns array of entity results that match the query for compositeFieldValue, where result error can be UnauthorizedError
|
|
@@ -265,79 +293,6 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
265
293
|
});
|
|
266
294
|
}
|
|
267
295
|
|
|
268
|
-
/**
|
|
269
|
-
* Authorization-result-based version of the EnforcingEntityLoader method by the same name.
|
|
270
|
-
* @returns the first entity results that matches the query, where result error can be
|
|
271
|
-
* UnauthorizedError
|
|
272
|
-
*/
|
|
273
|
-
async loadFirstByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
274
|
-
fieldEqualityOperands: FieldEqualityCondition<TFields, N>[],
|
|
275
|
-
querySelectionModifiers: Omit<QuerySelectionModifiers<TFields>, 'limit'> &
|
|
276
|
-
Required<Pick<QuerySelectionModifiers<TFields>, 'orderBy'>>,
|
|
277
|
-
): Promise<Result<TEntity> | null> {
|
|
278
|
-
const results = await this.loadManyByFieldEqualityConjunctionAsync(fieldEqualityOperands, {
|
|
279
|
-
...querySelectionModifiers,
|
|
280
|
-
limit: 1,
|
|
281
|
-
});
|
|
282
|
-
return results[0] ?? null;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Authorization-result-based version of the EnforcingEntityLoader method by the same name.
|
|
287
|
-
* @returns array of entity results that match the query, where result error can be UnauthorizedError
|
|
288
|
-
*/
|
|
289
|
-
async loadManyByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
290
|
-
fieldEqualityOperands: FieldEqualityCondition<TFields, N>[],
|
|
291
|
-
querySelectionModifiers: QuerySelectionModifiers<TFields> = {},
|
|
292
|
-
): Promise<readonly Result<TEntity>[]> {
|
|
293
|
-
for (const fieldEqualityOperand of fieldEqualityOperands) {
|
|
294
|
-
const fieldValues = isSingleValueFieldEqualityCondition(fieldEqualityOperand)
|
|
295
|
-
? [fieldEqualityOperand.fieldValue]
|
|
296
|
-
: fieldEqualityOperand.fieldValues;
|
|
297
|
-
this.validateFieldAndValues(fieldEqualityOperand.fieldName, fieldValues);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const fieldObjects = await this.dataManager.loadManyByFieldEqualityConjunctionAsync(
|
|
301
|
-
this.queryContext,
|
|
302
|
-
fieldEqualityOperands,
|
|
303
|
-
querySelectionModifiers,
|
|
304
|
-
);
|
|
305
|
-
return await this.utils.constructAndAuthorizeEntitiesArrayAsync(fieldObjects);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Authorization-result-based version of the EnforcingEntityLoader method by the same name.
|
|
310
|
-
* @returns array of entity results that match the query, where result error can be UnauthorizedError
|
|
311
|
-
* @throws Error when rawWhereClause or bindings are invalid
|
|
312
|
-
*/
|
|
313
|
-
async loadManyByRawWhereClauseAsync(
|
|
314
|
-
rawWhereClause: string,
|
|
315
|
-
bindings: any[] | object,
|
|
316
|
-
querySelectionModifiers: QuerySelectionModifiersWithOrderByRaw<TFields> = {},
|
|
317
|
-
): Promise<readonly Result<TEntity>[]> {
|
|
318
|
-
const fieldObjects = await this.dataManager.loadManyByRawWhereClauseAsync(
|
|
319
|
-
this.queryContext,
|
|
320
|
-
rawWhereClause,
|
|
321
|
-
bindings,
|
|
322
|
-
querySelectionModifiers,
|
|
323
|
-
);
|
|
324
|
-
return await this.utils.constructAndAuthorizeEntitiesArrayAsync(fieldObjects);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
private validateFieldAndValues<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
328
|
-
fieldName: N,
|
|
329
|
-
fieldValues: readonly TFields[N][],
|
|
330
|
-
): void {
|
|
331
|
-
const fieldDefinition = this.entityConfiguration.schema.get(fieldName);
|
|
332
|
-
invariant(fieldDefinition, `must have field definition for field = ${String(fieldName)}`);
|
|
333
|
-
for (const fieldValue of fieldValues) {
|
|
334
|
-
const isInputValid = fieldDefinition.validateInputValue(fieldValue);
|
|
335
|
-
if (!isInputValid) {
|
|
336
|
-
throw new EntityInvalidFieldValueError(this.entityClass, fieldName, fieldValue);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
296
|
private validateFieldAndValuesAndConvertToHolders<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
342
297
|
fieldName: N,
|
|
343
298
|
fieldValues: readonly NonNullable<TFields[N]>[],
|
|
@@ -345,7 +300,7 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
345
300
|
loadKey: SingleFieldHolder<TFields, TIDField, N>;
|
|
346
301
|
loadValues: readonly SingleFieldValueHolder<TFields, N>[];
|
|
347
302
|
} {
|
|
348
|
-
this.validateFieldAndValues(fieldName, fieldValues);
|
|
303
|
+
this.constructionUtils.validateFieldAndValues(fieldName, fieldValues);
|
|
349
304
|
|
|
350
305
|
return {
|
|
351
306
|
loadKey: new SingleFieldHolder<TFields, TIDField, N>(fieldName),
|
|
@@ -355,6 +310,21 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
355
310
|
};
|
|
356
311
|
}
|
|
357
312
|
|
|
313
|
+
private validateFieldAndValueAndConvertToHolders<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
314
|
+
fieldName: N,
|
|
315
|
+
fieldValue: NonNullable<TFields[N]>,
|
|
316
|
+
): {
|
|
317
|
+
loadKey: SingleFieldHolder<TFields, TIDField, N>;
|
|
318
|
+
loadValue: SingleFieldValueHolder<TFields, N>;
|
|
319
|
+
} {
|
|
320
|
+
this.constructionUtils.validateFieldAndValues(fieldName, [fieldValue]);
|
|
321
|
+
|
|
322
|
+
return {
|
|
323
|
+
loadKey: new SingleFieldHolder<TFields, TIDField, N>(fieldName),
|
|
324
|
+
loadValue: new SingleFieldValueHolder<TFields, N>(fieldValue),
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
358
328
|
private validateCompositeFieldAndValuesAndConvertToHolders<
|
|
359
329
|
N extends EntityCompositeField<Pick<TFields, TSelectedFields>>,
|
|
360
330
|
>(
|
|
@@ -388,7 +358,7 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
388
358
|
);
|
|
389
359
|
for (const field of compositeField) {
|
|
390
360
|
const fieldValue = compositeFieldValueHolder.compositeFieldValue[field];
|
|
391
|
-
this.validateFieldAndValues(field, [fieldValue]);
|
|
361
|
+
this.constructionUtils.validateFieldAndValues(field, [fieldValue]);
|
|
392
362
|
}
|
|
393
363
|
}
|
|
394
364
|
|
|
@@ -408,7 +378,7 @@ export class AuthorizationResultBasedEntityLoader<
|
|
|
408
378
|
Array.from(map.entries()).map(async ([compositeFieldValueHolder, fieldObjects]) => {
|
|
409
379
|
return [
|
|
410
380
|
compositeFieldValueHolder,
|
|
411
|
-
await this.
|
|
381
|
+
await this.constructionUtils.constructAndAuthorizeEntitiesArrayAsync(fieldObjects),
|
|
412
382
|
];
|
|
413
383
|
}),
|
|
414
384
|
),
|
|
@@ -333,8 +333,17 @@ export class AuthorizationResultBasedCreateMutator<
|
|
|
333
333
|
previousValue: null,
|
|
334
334
|
cascadingDeleteCause: null,
|
|
335
335
|
});
|
|
336
|
+
const invalidationUtils = this.entityLoaderFactory.invalidationUtils();
|
|
337
|
+
const constructionUtils = this.entityLoaderFactory.constructionUtils(
|
|
338
|
+
this.viewerContext,
|
|
339
|
+
queryContext,
|
|
340
|
+
{
|
|
341
|
+
previousValue: null,
|
|
342
|
+
cascadingDeleteCause: null,
|
|
343
|
+
},
|
|
344
|
+
);
|
|
336
345
|
|
|
337
|
-
const temporaryEntityForPrivacyCheck =
|
|
346
|
+
const temporaryEntityForPrivacyCheck = constructionUtils.constructEntity({
|
|
338
347
|
[this.entityConfiguration.idField]: '00000000-0000-0000-0000-000000000000', // zero UUID
|
|
339
348
|
...this.fieldsForEntity,
|
|
340
349
|
} as unknown as TFields);
|
|
@@ -376,13 +385,13 @@ export class AuthorizationResultBasedCreateMutator<
|
|
|
376
385
|
// Invalidate all caches for the new entity so that any previously-negatively-cached loads
|
|
377
386
|
// are removed from the caches.
|
|
378
387
|
queryContext.appendPostCommitInvalidationCallback(async () => {
|
|
379
|
-
|
|
380
|
-
await
|
|
388
|
+
invalidationUtils.invalidateFieldsForTransaction(queryContext, insertResult);
|
|
389
|
+
await invalidationUtils.invalidateFieldsAsync(insertResult);
|
|
381
390
|
});
|
|
382
391
|
|
|
383
|
-
|
|
392
|
+
invalidationUtils.invalidateFieldsForTransaction(queryContext, insertResult);
|
|
384
393
|
|
|
385
|
-
const unauthorizedEntityAfterInsert =
|
|
394
|
+
const unauthorizedEntityAfterInsert = constructionUtils.constructEntity(insertResult);
|
|
386
395
|
const newEntity = await enforceAsyncResult(
|
|
387
396
|
entityLoader.loadByIDAsync(unauthorizedEntityAfterInsert.getID()),
|
|
388
397
|
);
|
|
@@ -541,8 +550,17 @@ export class AuthorizationResultBasedUpdateMutator<
|
|
|
541
550
|
previousValue: this.originalEntity,
|
|
542
551
|
cascadingDeleteCause: this.cascadingDeleteCause,
|
|
543
552
|
});
|
|
553
|
+
const invalidationUtils = this.entityLoaderFactory.invalidationUtils();
|
|
554
|
+
const constructionUtils = this.entityLoaderFactory.constructionUtils(
|
|
555
|
+
this.viewerContext,
|
|
556
|
+
queryContext,
|
|
557
|
+
{
|
|
558
|
+
previousValue: this.originalEntity,
|
|
559
|
+
cascadingDeleteCause: this.cascadingDeleteCause,
|
|
560
|
+
},
|
|
561
|
+
);
|
|
544
562
|
|
|
545
|
-
const entityAboutToBeUpdated =
|
|
563
|
+
const entityAboutToBeUpdated = constructionUtils.constructEntity(this.fieldsForEntity);
|
|
546
564
|
const authorizeUpdateResult = await asyncResult(
|
|
547
565
|
this.privacyPolicy.authorizeUpdateAsync(
|
|
548
566
|
this.viewerContext,
|
|
@@ -606,22 +624,22 @@ export class AuthorizationResultBasedUpdateMutator<
|
|
|
606
624
|
// version of the entity.
|
|
607
625
|
|
|
608
626
|
queryContext.appendPostCommitInvalidationCallback(async () => {
|
|
609
|
-
|
|
627
|
+
invalidationUtils.invalidateFieldsForTransaction(
|
|
610
628
|
queryContext,
|
|
611
629
|
this.originalEntity.getAllDatabaseFields(),
|
|
612
630
|
);
|
|
613
|
-
|
|
631
|
+
invalidationUtils.invalidateFieldsForTransaction(queryContext, this.fieldsForEntity);
|
|
614
632
|
await Promise.all([
|
|
615
|
-
|
|
616
|
-
|
|
633
|
+
invalidationUtils.invalidateFieldsAsync(this.originalEntity.getAllDatabaseFields()),
|
|
634
|
+
invalidationUtils.invalidateFieldsAsync(this.fieldsForEntity),
|
|
617
635
|
]);
|
|
618
636
|
});
|
|
619
637
|
|
|
620
|
-
|
|
638
|
+
invalidationUtils.invalidateFieldsForTransaction(
|
|
621
639
|
queryContext,
|
|
622
640
|
this.originalEntity.getAllDatabaseFields(),
|
|
623
641
|
);
|
|
624
|
-
|
|
642
|
+
invalidationUtils.invalidateFieldsForTransaction(queryContext, this.fieldsForEntity);
|
|
625
643
|
|
|
626
644
|
const updatedEntity = await enforceAsyncResult(
|
|
627
645
|
entityLoader.loadByIDAsync(entityAboutToBeUpdated.getID()),
|
|
@@ -839,21 +857,18 @@ export class AuthorizationResultBasedDeleteMutator<
|
|
|
839
857
|
);
|
|
840
858
|
}
|
|
841
859
|
|
|
842
|
-
const
|
|
843
|
-
previousValue: null,
|
|
844
|
-
cascadingDeleteCause: this.cascadingDeleteCause,
|
|
845
|
-
});
|
|
860
|
+
const invalidationUtils = this.entityLoaderFactory.invalidationUtils();
|
|
846
861
|
|
|
847
862
|
// Invalidate all caches for the entity so that any previously-cached loads
|
|
848
863
|
// are removed from the caches.
|
|
849
864
|
queryContext.appendPostCommitInvalidationCallback(async () => {
|
|
850
|
-
|
|
865
|
+
invalidationUtils.invalidateFieldsForTransaction(
|
|
851
866
|
queryContext,
|
|
852
867
|
this.entity.getAllDatabaseFields(),
|
|
853
868
|
);
|
|
854
|
-
await
|
|
869
|
+
await invalidationUtils.invalidateFieldsAsync(this.entity.getAllDatabaseFields());
|
|
855
870
|
});
|
|
856
|
-
|
|
871
|
+
invalidationUtils.invalidateFieldsForTransaction(
|
|
857
872
|
queryContext,
|
|
858
873
|
this.entity.getAllDatabaseFields(),
|
|
859
874
|
);
|
|
@@ -971,7 +986,7 @@ export class AuthorizationResultBasedDeleteMutator<
|
|
|
971
986
|
.loadManyByFieldEqualingAsync(
|
|
972
987
|
fieldName,
|
|
973
988
|
association.associatedEntityLookupByField
|
|
974
|
-
? entity.getField(association.associatedEntityLookupByField
|
|
989
|
+
? entity.getField(association.associatedEntityLookupByField)
|
|
975
990
|
: entity.getID(),
|
|
976
991
|
),
|
|
977
992
|
);
|
|
@@ -6,7 +6,7 @@ import { ReadonlyEntity } from './ReadonlyEntity';
|
|
|
6
6
|
import { ViewerContext } from './ViewerContext';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Enforcing entity creator. All
|
|
9
|
+
* Enforcing entity creator. All creates
|
|
10
10
|
* through this creator will throw if authorization is not successful.
|
|
11
11
|
*/
|
|
12
12
|
export class EnforcingEntityCreator<
|