@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
|
@@ -76,7 +76,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
76
76
|
|
|
77
77
|
when(
|
|
78
78
|
cacheAdapterMock.loadManyAsync(
|
|
79
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
79
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
80
80
|
deepEqualEntityAware([
|
|
81
81
|
new SingleFieldValueHolder('wat'),
|
|
82
82
|
new SingleFieldValueHolder('who'),
|
|
@@ -102,7 +102,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
102
102
|
|
|
103
103
|
verify(
|
|
104
104
|
cacheAdapterMock.loadManyAsync(
|
|
105
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
105
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
106
106
|
deepEqualEntityAware([
|
|
107
107
|
new SingleFieldValueHolder('wat'),
|
|
108
108
|
new SingleFieldValueHolder('who'),
|
|
@@ -111,7 +111,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
111
111
|
).once();
|
|
112
112
|
verify(
|
|
113
113
|
cacheAdapterMock.cacheManyAsync(
|
|
114
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
114
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
115
115
|
deepEqualEntityAware(
|
|
116
116
|
new SingleFieldValueHolderMap(
|
|
117
117
|
new Map([
|
|
@@ -146,7 +146,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
146
146
|
|
|
147
147
|
when(
|
|
148
148
|
cacheAdapterMock.loadManyAsync(
|
|
149
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
149
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
150
150
|
deepEqualEntityAware([
|
|
151
151
|
new SingleFieldValueHolder('wat'),
|
|
152
152
|
new SingleFieldValueHolder('who'),
|
|
@@ -170,7 +170,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
170
170
|
|
|
171
171
|
verify(
|
|
172
172
|
cacheAdapterMock.loadManyAsync(
|
|
173
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
173
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
174
174
|
deepEqualEntityAware([
|
|
175
175
|
new SingleFieldValueHolder('wat'),
|
|
176
176
|
new SingleFieldValueHolder('who'),
|
|
@@ -179,7 +179,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
179
179
|
).once();
|
|
180
180
|
verify(
|
|
181
181
|
cacheAdapterMock.cacheManyAsync(
|
|
182
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
182
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
183
183
|
deepEqualEntityAware(
|
|
184
184
|
new SingleFieldValueHolderMap(
|
|
185
185
|
new Map([
|
|
@@ -216,7 +216,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
216
216
|
|
|
217
217
|
when(
|
|
218
218
|
cacheAdapterMock.loadManyAsync(
|
|
219
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
219
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
220
220
|
deepEqualEntityAware([new SingleFieldValueHolder('why')]),
|
|
221
221
|
),
|
|
222
222
|
).thenResolve(
|
|
@@ -233,19 +233,19 @@ describe(ReadThroughEntityCache, () => {
|
|
|
233
233
|
|
|
234
234
|
verify(
|
|
235
235
|
cacheAdapterMock.loadManyAsync(
|
|
236
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
236
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
237
237
|
deepEqualEntityAware([new SingleFieldValueHolder('why')]),
|
|
238
238
|
),
|
|
239
239
|
).once();
|
|
240
240
|
verify(
|
|
241
241
|
cacheAdapterMock.cacheManyAsync(
|
|
242
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
242
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
243
243
|
deepEqualEntityAware(new SingleFieldValueHolderMap(new Map())),
|
|
244
244
|
),
|
|
245
245
|
).once();
|
|
246
246
|
verify(
|
|
247
247
|
cacheAdapterMock.cacheDBMissesAsync(
|
|
248
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
248
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
249
249
|
deepEqualEntityAware([new SingleFieldValueHolder('why')]),
|
|
250
250
|
),
|
|
251
251
|
).once();
|
|
@@ -260,7 +260,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
260
260
|
|
|
261
261
|
when(
|
|
262
262
|
cacheAdapterMock.loadManyAsync(
|
|
263
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
263
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
264
264
|
deepEqualEntityAware([new SingleFieldValueHolder('why')]),
|
|
265
265
|
),
|
|
266
266
|
).thenResolve(
|
|
@@ -276,12 +276,22 @@ describe(ReadThroughEntityCache, () => {
|
|
|
276
276
|
);
|
|
277
277
|
verify(
|
|
278
278
|
cacheAdapterMock.loadManyAsync(
|
|
279
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
279
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
280
280
|
deepEqualEntityAware([new SingleFieldValueHolder('why')]),
|
|
281
281
|
),
|
|
282
282
|
).once();
|
|
283
|
-
verify(
|
|
284
|
-
|
|
283
|
+
verify(
|
|
284
|
+
cacheAdapterMock.cacheManyAsync(
|
|
285
|
+
new SingleFieldHolder<BlahFields, 'id', 'id'>('id'),
|
|
286
|
+
anything(),
|
|
287
|
+
),
|
|
288
|
+
).never();
|
|
289
|
+
verify(
|
|
290
|
+
cacheAdapterMock.cacheDBMissesAsync(
|
|
291
|
+
new SingleFieldHolder<BlahFields, 'id', 'id'>('id'),
|
|
292
|
+
anything(),
|
|
293
|
+
),
|
|
294
|
+
).never();
|
|
285
295
|
expect(result).toEqual(new SingleFieldValueHolderMap(new Map()));
|
|
286
296
|
});
|
|
287
297
|
|
|
@@ -293,7 +303,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
293
303
|
|
|
294
304
|
when(
|
|
295
305
|
cacheAdapterMock.loadManyAsync(
|
|
296
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
306
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
297
307
|
deepEqualEntityAware([
|
|
298
308
|
new SingleFieldValueHolder('wat'),
|
|
299
309
|
new SingleFieldValueHolder('who'),
|
|
@@ -324,7 +334,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
324
334
|
);
|
|
325
335
|
verify(
|
|
326
336
|
cacheAdapterMock.loadManyAsync(
|
|
327
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
337
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
328
338
|
deepEqualEntityAware([
|
|
329
339
|
new SingleFieldValueHolder('wat'),
|
|
330
340
|
new SingleFieldValueHolder('who'),
|
|
@@ -335,7 +345,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
335
345
|
).once();
|
|
336
346
|
verify(
|
|
337
347
|
cacheAdapterMock.cacheManyAsync(
|
|
338
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
348
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
339
349
|
deepEqualEntityAware(
|
|
340
350
|
new SingleFieldValueHolderMap(
|
|
341
351
|
new Map([[new SingleFieldValueHolder('wat'), { id: 'wat' }]]),
|
|
@@ -345,7 +355,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
345
355
|
).once();
|
|
346
356
|
verify(
|
|
347
357
|
cacheAdapterMock.cacheDBMissesAsync(
|
|
348
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
358
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
349
359
|
deepEqualEntityAware([new SingleFieldValueHolder('how')]),
|
|
350
360
|
),
|
|
351
361
|
).once();
|
|
@@ -372,7 +382,12 @@ describe(ReadThroughEntityCache, () => {
|
|
|
372
382
|
[new SingleFieldValueHolder<BlahFields, 'id'>('wat')],
|
|
373
383
|
fetcher,
|
|
374
384
|
);
|
|
375
|
-
verify(
|
|
385
|
+
verify(
|
|
386
|
+
cacheAdapterMock.loadManyAsync(
|
|
387
|
+
new SingleFieldHolder<BlahFields, 'id', 'id'>('id'),
|
|
388
|
+
anything(),
|
|
389
|
+
),
|
|
390
|
+
).never();
|
|
376
391
|
expect(result).toEqual(
|
|
377
392
|
new SingleFieldValueHolderMap(
|
|
378
393
|
new Map([[new SingleFieldValueHolder('wat'), [{ id: 'wat' }]]]),
|
|
@@ -390,7 +405,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
390
405
|
|
|
391
406
|
when(
|
|
392
407
|
cacheAdapterMock.loadManyAsync(
|
|
393
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
408
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
394
409
|
deepEqualEntityAware([
|
|
395
410
|
new SingleFieldValueHolder('wat'),
|
|
396
411
|
new SingleFieldValueHolder('who'),
|
|
@@ -416,7 +431,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
416
431
|
|
|
417
432
|
verify(
|
|
418
433
|
cacheAdapterMock.loadManyAsync(
|
|
419
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
434
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
420
435
|
deepEqualEntityAware([
|
|
421
436
|
new SingleFieldValueHolder('wat'),
|
|
422
437
|
new SingleFieldValueHolder('who'),
|
|
@@ -425,7 +440,7 @@ describe(ReadThroughEntityCache, () => {
|
|
|
425
440
|
).once();
|
|
426
441
|
verify(
|
|
427
442
|
cacheAdapterMock.cacheManyAsync(
|
|
428
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
443
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
429
444
|
deepEqualEntityAware(
|
|
430
445
|
new Map([
|
|
431
446
|
[new SingleFieldValueHolder('wat'), { id: 'wat' }],
|
|
@@ -456,12 +471,12 @@ describe(ReadThroughEntityCache, () => {
|
|
|
456
471
|
const cacheAdapterMock = mock<IEntityCacheAdapter<BlahFields, 'id'>>();
|
|
457
472
|
const cacheAdapter = instance(cacheAdapterMock);
|
|
458
473
|
const entityCache = new ReadThroughEntityCache(makeEntityConfiguration(true), cacheAdapter);
|
|
459
|
-
await entityCache.invalidateManyAsync(new SingleFieldHolder('id'), [
|
|
474
|
+
await entityCache.invalidateManyAsync(new SingleFieldHolder<BlahFields, 'id', 'id'>('id'), [
|
|
460
475
|
new SingleFieldValueHolder('wat'),
|
|
461
476
|
]);
|
|
462
477
|
verify(
|
|
463
478
|
cacheAdapterMock.invalidateManyAsync(
|
|
464
|
-
deepEqualEntityAware(new SingleFieldHolder('id')),
|
|
479
|
+
deepEqualEntityAware(new SingleFieldHolder<BlahFields, 'id', 'id'>('id')),
|
|
465
480
|
deepEqualEntityAware([new SingleFieldValueHolder('wat')]),
|
|
466
481
|
),
|
|
467
482
|
).once();
|
|
@@ -30,6 +30,29 @@ export const timeAndLogLoadEventAsync =
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
export const timeAndLogLoadOneEventAsync =
|
|
34
|
+
(
|
|
35
|
+
metricsAdapter: IEntityMetricsAdapter,
|
|
36
|
+
loadType: EntityMetricsLoadType,
|
|
37
|
+
entityClassName: string,
|
|
38
|
+
queryContext: EntityQueryContext,
|
|
39
|
+
) =>
|
|
40
|
+
async <TFields>(promise: Promise<Readonly<TFields> | null>) => {
|
|
41
|
+
const startTime = Date.now();
|
|
42
|
+
const result = await promise;
|
|
43
|
+
const endTime = Date.now();
|
|
44
|
+
|
|
45
|
+
metricsAdapter.logDataManagerLoadEvent({
|
|
46
|
+
type: loadType,
|
|
47
|
+
isInTransaction: queryContext.isInTransaction(),
|
|
48
|
+
entityClassName,
|
|
49
|
+
duration: endTime - startTime,
|
|
50
|
+
count: result ? 1 : 0,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
|
|
33
56
|
export const timeAndLogLoadMapEventAsync =
|
|
34
57
|
(
|
|
35
58
|
metricsAdapter: IEntityMetricsAdapter,
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { describe, expect, it } from '@jest/globals';
|
|
2
|
+
import { anyNumber, deepEqual, instance, mock, verify, when } from 'ts-mockito';
|
|
3
|
+
|
|
4
|
+
import { EntityQueryContext } from '../../EntityQueryContext';
|
|
5
|
+
import {
|
|
6
|
+
timeAndLogLoadEventAsync,
|
|
7
|
+
timeAndLogLoadMapEventAsync,
|
|
8
|
+
timeAndLogMutationEventAsync,
|
|
9
|
+
} from '../EntityMetricsUtils';
|
|
10
|
+
import {
|
|
11
|
+
EntityMetricsLoadType,
|
|
12
|
+
EntityMetricsMutationType,
|
|
13
|
+
IEntityMetricsAdapter,
|
|
14
|
+
} from '../IEntityMetricsAdapter';
|
|
15
|
+
|
|
16
|
+
describe(timeAndLogLoadEventAsync, () => {
|
|
17
|
+
it('returns the result from the wrapped promise and logs', async () => {
|
|
18
|
+
const metricsAdapterMock = mock<IEntityMetricsAdapter>();
|
|
19
|
+
const metricsAdapter = instance(metricsAdapterMock);
|
|
20
|
+
|
|
21
|
+
const queryContextMock = mock<EntityQueryContext>();
|
|
22
|
+
when(queryContextMock.isInTransaction()).thenReturn(false);
|
|
23
|
+
const queryContext = instance(queryContextMock);
|
|
24
|
+
|
|
25
|
+
const expectedResult = [{ id: 1 }, { id: 2 }];
|
|
26
|
+
|
|
27
|
+
const result = await timeAndLogLoadEventAsync(
|
|
28
|
+
metricsAdapter,
|
|
29
|
+
EntityMetricsLoadType.LOAD_MANY,
|
|
30
|
+
'TestEntity',
|
|
31
|
+
queryContext,
|
|
32
|
+
)(Promise.resolve(expectedResult));
|
|
33
|
+
|
|
34
|
+
expect(result).toBe(expectedResult);
|
|
35
|
+
|
|
36
|
+
verify(
|
|
37
|
+
metricsAdapterMock.logDataManagerLoadEvent(
|
|
38
|
+
deepEqual({
|
|
39
|
+
type: EntityMetricsLoadType.LOAD_MANY,
|
|
40
|
+
isInTransaction: false,
|
|
41
|
+
entityClassName: 'TestEntity',
|
|
42
|
+
duration: anyNumber(),
|
|
43
|
+
count: expectedResult.length,
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
).once();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe(timeAndLogLoadMapEventAsync, () => {
|
|
51
|
+
it('returns the result from the wrapped promise and logs with count summed across map values', async () => {
|
|
52
|
+
const metricsAdapterMock = mock<IEntityMetricsAdapter>();
|
|
53
|
+
const metricsAdapter = instance(metricsAdapterMock);
|
|
54
|
+
|
|
55
|
+
const queryContextMock = mock<EntityQueryContext>();
|
|
56
|
+
when(queryContextMock.isInTransaction()).thenReturn(false);
|
|
57
|
+
const queryContext = instance(queryContextMock);
|
|
58
|
+
|
|
59
|
+
const key1 = { serialize: () => 'key1' };
|
|
60
|
+
const key2 = { serialize: () => 'key2' };
|
|
61
|
+
const expectedResult = new Map([
|
|
62
|
+
[key1, [{ id: 1 }, { id: 2 }]],
|
|
63
|
+
[key2, [{ id: 3 }]],
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
const result = await timeAndLogLoadMapEventAsync(
|
|
67
|
+
metricsAdapter,
|
|
68
|
+
EntityMetricsLoadType.LOAD_MANY,
|
|
69
|
+
'TestEntity',
|
|
70
|
+
queryContext,
|
|
71
|
+
)(Promise.resolve(expectedResult));
|
|
72
|
+
|
|
73
|
+
expect(result).toBe(expectedResult);
|
|
74
|
+
|
|
75
|
+
verify(
|
|
76
|
+
metricsAdapterMock.logDataManagerLoadEvent(
|
|
77
|
+
deepEqual({
|
|
78
|
+
type: EntityMetricsLoadType.LOAD_MANY,
|
|
79
|
+
isInTransaction: false,
|
|
80
|
+
entityClassName: 'TestEntity',
|
|
81
|
+
duration: anyNumber(),
|
|
82
|
+
count: 3,
|
|
83
|
+
}),
|
|
84
|
+
),
|
|
85
|
+
).once();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe(timeAndLogMutationEventAsync, () => {
|
|
90
|
+
it('returns the result from the wrapped promise and logs', async () => {
|
|
91
|
+
const metricsAdapterMock = mock<IEntityMetricsAdapter>();
|
|
92
|
+
const metricsAdapter = instance(metricsAdapterMock);
|
|
93
|
+
|
|
94
|
+
const queryContextMock = mock<EntityQueryContext>();
|
|
95
|
+
when(queryContextMock.isInTransaction()).thenReturn(true);
|
|
96
|
+
const queryContext = instance(queryContextMock);
|
|
97
|
+
|
|
98
|
+
const expectedResult = { id: 1, name: 'created' };
|
|
99
|
+
|
|
100
|
+
const result = await timeAndLogMutationEventAsync(
|
|
101
|
+
metricsAdapter,
|
|
102
|
+
EntityMetricsMutationType.CREATE,
|
|
103
|
+
'TestEntity',
|
|
104
|
+
queryContext,
|
|
105
|
+
)(Promise.resolve(expectedResult));
|
|
106
|
+
|
|
107
|
+
expect(result).toBe(expectedResult);
|
|
108
|
+
|
|
109
|
+
verify(
|
|
110
|
+
metricsAdapterMock.logMutatorMutationEvent(
|
|
111
|
+
deepEqual({
|
|
112
|
+
type: EntityMetricsMutationType.CREATE,
|
|
113
|
+
isInTransaction: true,
|
|
114
|
+
entityClassName: 'TestEntity',
|
|
115
|
+
duration: anyNumber(),
|
|
116
|
+
}),
|
|
117
|
+
),
|
|
118
|
+
).once();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -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';
|
|
@@ -26,7 +26,7 @@ export class AllowIfAllSubRulesAllowPrivacyPolicyRule<
|
|
|
26
26
|
async evaluateAsync(
|
|
27
27
|
viewerContext: TViewerContext,
|
|
28
28
|
queryContext: EntityQueryContext,
|
|
29
|
-
evaluationContext:
|
|
29
|
+
evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<
|
|
30
30
|
TFields,
|
|
31
31
|
TIDField,
|
|
32
32
|
TViewerContext,
|
|
@@ -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';
|
|
@@ -26,7 +26,7 @@ export class AllowIfAnySubRuleAllowsPrivacyPolicyRule<
|
|
|
26
26
|
async evaluateAsync(
|
|
27
27
|
viewerContext: TViewerContext,
|
|
28
28
|
queryContext: EntityQueryContext,
|
|
29
|
-
evaluationContext:
|
|
29
|
+
evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<
|
|
30
30
|
TFields,
|
|
31
31
|
TIDField,
|
|
32
32
|
TViewerContext,
|
|
@@ -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';
|
|
@@ -29,7 +29,7 @@ export class EvaluateIfEntityFieldPredicatePrivacyPolicyRule<
|
|
|
29
29
|
async evaluateAsync(
|
|
30
30
|
viewerContext: TViewerContext,
|
|
31
31
|
queryContext: EntityQueryContext,
|
|
32
|
-
evaluationContext:
|
|
32
|
+
evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<
|
|
33
33
|
TFields,
|
|
34
34
|
TIDField,
|
|
35
35
|
TViewerContext,
|
|
@@ -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';
|
|
@@ -46,7 +46,7 @@ export abstract class PrivacyPolicyRule<
|
|
|
46
46
|
abstract evaluateAsync(
|
|
47
47
|
viewerContext: TViewerContext,
|
|
48
48
|
queryContext: EntityQueryContext,
|
|
49
|
-
evaluationContext:
|
|
49
|
+
evaluationContext: EntityPrivacyPolicyRuleEvaluationContext<
|
|
50
50
|
TFields,
|
|
51
51
|
TIDField,
|
|
52
52
|
TViewerContext,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { anything, instance, mock } from 'ts-mockito';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../../EntityPrivacyPolicy';
|
|
4
4
|
import { EntityQueryContext } from '../../EntityQueryContext';
|
|
5
5
|
import { ViewerContext } from '../../ViewerContext';
|
|
6
6
|
import { describePrivacyPolicyRule } from '../../utils/__testfixtures__/PrivacyPolicyRuleTestUtils';
|
|
@@ -20,7 +20,7 @@ describePrivacyPolicyRule(
|
|
|
20
20
|
viewerContext: instance(mock(ViewerContext)),
|
|
21
21
|
queryContext: instance(mock(EntityQueryContext)),
|
|
22
22
|
evaluationContext:
|
|
23
|
-
instance(mock<
|
|
23
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
24
24
|
entity: anything(),
|
|
25
25
|
},
|
|
26
26
|
],
|
|
@@ -38,7 +38,7 @@ describePrivacyPolicyRule(
|
|
|
38
38
|
viewerContext: instance(mock(ViewerContext)),
|
|
39
39
|
queryContext: instance(mock(EntityQueryContext)),
|
|
40
40
|
evaluationContext:
|
|
41
|
-
instance(mock<
|
|
41
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
42
42
|
entity: anything(),
|
|
43
43
|
},
|
|
44
44
|
],
|
|
@@ -56,7 +56,7 @@ describePrivacyPolicyRule(
|
|
|
56
56
|
viewerContext: instance(mock(ViewerContext)),
|
|
57
57
|
queryContext: instance(mock(EntityQueryContext)),
|
|
58
58
|
evaluationContext:
|
|
59
|
-
instance(mock<
|
|
59
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
60
60
|
entity: anything(),
|
|
61
61
|
},
|
|
62
62
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { anything, instance, mock } from 'ts-mockito';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../../EntityPrivacyPolicy';
|
|
4
4
|
import { EntityQueryContext } from '../../EntityQueryContext';
|
|
5
5
|
import { ViewerContext } from '../../ViewerContext';
|
|
6
6
|
import { describePrivacyPolicyRule } from '../../utils/__testfixtures__/PrivacyPolicyRuleTestUtils';
|
|
@@ -20,7 +20,7 @@ describePrivacyPolicyRule(
|
|
|
20
20
|
viewerContext: instance(mock(ViewerContext)),
|
|
21
21
|
queryContext: instance(mock(EntityQueryContext)),
|
|
22
22
|
evaluationContext:
|
|
23
|
-
instance(mock<
|
|
23
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
24
24
|
entity: anything(),
|
|
25
25
|
},
|
|
26
26
|
],
|
|
@@ -38,7 +38,7 @@ describePrivacyPolicyRule(
|
|
|
38
38
|
viewerContext: instance(mock(ViewerContext)),
|
|
39
39
|
queryContext: instance(mock(EntityQueryContext)),
|
|
40
40
|
evaluationContext:
|
|
41
|
-
instance(mock<
|
|
41
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
42
42
|
entity: anything(),
|
|
43
43
|
},
|
|
44
44
|
],
|
|
@@ -56,7 +56,7 @@ describePrivacyPolicyRule(
|
|
|
56
56
|
viewerContext: instance(mock(ViewerContext)),
|
|
57
57
|
queryContext: instance(mock(EntityQueryContext)),
|
|
58
58
|
evaluationContext:
|
|
59
|
-
instance(mock<
|
|
59
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
60
60
|
entity: anything(),
|
|
61
61
|
},
|
|
62
62
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { instance, mock, when } from 'ts-mockito';
|
|
1
|
+
import { anything, instance, mock, when } from 'ts-mockito';
|
|
2
2
|
|
|
3
3
|
import { EntityCompanionDefinition } from '../../EntityCompanionProvider';
|
|
4
4
|
import { EntityPrivacyPolicy } from '../../EntityPrivacyPolicy';
|
|
@@ -96,6 +96,7 @@ describePrivacyPolicyRule(
|
|
|
96
96
|
viewerContext: instance(mock(ViewerContext)),
|
|
97
97
|
queryContext: instance(mock(EntityQueryContext)),
|
|
98
98
|
evaluationContext: {
|
|
99
|
+
action: anything(),
|
|
99
100
|
previousValue: instance(childEntityMock),
|
|
100
101
|
cascadingDeleteCause: {
|
|
101
102
|
entity: parentEntity,
|
|
@@ -109,6 +110,7 @@ describePrivacyPolicyRule(
|
|
|
109
110
|
viewerContext: instance(mock(ViewerContext)),
|
|
110
111
|
queryContext: instance(mock(EntityQueryContext)),
|
|
111
112
|
evaluationContext: {
|
|
113
|
+
action: anything(),
|
|
112
114
|
previousValue: instance(childEntityMock),
|
|
113
115
|
cascadingDeleteCause: {
|
|
114
116
|
entity: parentEntity,
|
|
@@ -124,6 +126,7 @@ describePrivacyPolicyRule(
|
|
|
124
126
|
viewerContext: instance(mock(ViewerContext)),
|
|
125
127
|
queryContext: instance(mock(EntityQueryContext)),
|
|
126
128
|
evaluationContext: {
|
|
129
|
+
action: anything(),
|
|
127
130
|
previousValue: null,
|
|
128
131
|
cascadingDeleteCause: null,
|
|
129
132
|
},
|
|
@@ -134,6 +137,7 @@ describePrivacyPolicyRule(
|
|
|
134
137
|
viewerContext: instance(mock(ViewerContext)),
|
|
135
138
|
queryContext: instance(mock(EntityQueryContext)),
|
|
136
139
|
evaluationContext: {
|
|
140
|
+
action: anything(),
|
|
137
141
|
previousValue: null,
|
|
138
142
|
cascadingDeleteCause: {
|
|
139
143
|
entity: instance(unrelatedOtherEntityMock),
|
|
@@ -147,6 +151,7 @@ describePrivacyPolicyRule(
|
|
|
147
151
|
viewerContext: instance(mock(ViewerContext)),
|
|
148
152
|
queryContext: instance(mock(EntityQueryContext)),
|
|
149
153
|
evaluationContext: {
|
|
154
|
+
action: anything(),
|
|
150
155
|
previousValue: null,
|
|
151
156
|
cascadingDeleteCause: {
|
|
152
157
|
entity: otherParentEntity,
|
|
@@ -160,6 +165,7 @@ describePrivacyPolicyRule(
|
|
|
160
165
|
viewerContext: instance(mock(ViewerContext)),
|
|
161
166
|
queryContext: instance(mock(EntityQueryContext)),
|
|
162
167
|
evaluationContext: {
|
|
168
|
+
action: anything(),
|
|
163
169
|
previousValue: null,
|
|
164
170
|
cascadingDeleteCause: {
|
|
165
171
|
entity: parentEntity,
|
|
@@ -173,6 +179,7 @@ describePrivacyPolicyRule(
|
|
|
173
179
|
viewerContext: instance(mock(ViewerContext)),
|
|
174
180
|
queryContext: instance(mock(EntityQueryContext)),
|
|
175
181
|
evaluationContext: {
|
|
182
|
+
action: anything(),
|
|
176
183
|
previousValue: null,
|
|
177
184
|
cascadingDeleteCause: {
|
|
178
185
|
entity: parentEntity,
|
|
@@ -186,6 +193,7 @@ describePrivacyPolicyRule(
|
|
|
186
193
|
viewerContext: instance(mock(ViewerContext)),
|
|
187
194
|
queryContext: instance(mock(EntityQueryContext)),
|
|
188
195
|
evaluationContext: {
|
|
196
|
+
action: anything(),
|
|
189
197
|
previousValue: instance(childEntityDifferentParentMock),
|
|
190
198
|
cascadingDeleteCause: {
|
|
191
199
|
entity: parentEntity,
|
|
@@ -232,6 +240,7 @@ describePrivacyPolicyRule(
|
|
|
232
240
|
viewerContext: instance(mock(ViewerContext)),
|
|
233
241
|
queryContext: instance(mock(EntityQueryContext)),
|
|
234
242
|
evaluationContext: {
|
|
243
|
+
action: anything(),
|
|
235
244
|
previousValue: instance(childEntityWithNameRefMock),
|
|
236
245
|
cascadingDeleteCause: {
|
|
237
246
|
entity: parentEntityWithName,
|
|
@@ -245,6 +254,7 @@ describePrivacyPolicyRule(
|
|
|
245
254
|
viewerContext: instance(mock(ViewerContext)),
|
|
246
255
|
queryContext: instance(mock(EntityQueryContext)),
|
|
247
256
|
evaluationContext: {
|
|
257
|
+
action: anything(),
|
|
248
258
|
previousValue: instance(childEntityWithNameRefMock),
|
|
249
259
|
cascadingDeleteCause: {
|
|
250
260
|
entity: parentEntityWithName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { anything, instance, mock } from 'ts-mockito';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../../EntityPrivacyPolicy';
|
|
4
4
|
import { EntityQueryContext } from '../../EntityQueryContext';
|
|
5
5
|
import { ViewerContext } from '../../ViewerContext';
|
|
6
6
|
import { describePrivacyPolicyRule } from '../../utils/__testfixtures__/PrivacyPolicyRuleTestUtils';
|
|
@@ -12,7 +12,7 @@ describePrivacyPolicyRule(new AlwaysAllowPrivacyPolicyRule(), {
|
|
|
12
12
|
viewerContext: instance(mock(ViewerContext)),
|
|
13
13
|
queryContext: instance(mock(EntityQueryContext)),
|
|
14
14
|
evaluationContext:
|
|
15
|
-
instance(mock<
|
|
15
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
16
16
|
entity: anything(),
|
|
17
17
|
},
|
|
18
18
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { anything, instance, mock } from 'ts-mockito';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../../EntityPrivacyPolicy';
|
|
4
4
|
import { EntityQueryContext } from '../../EntityQueryContext';
|
|
5
5
|
import { ViewerContext } from '../../ViewerContext';
|
|
6
6
|
import { describePrivacyPolicyRule } from '../../utils/__testfixtures__/PrivacyPolicyRuleTestUtils';
|
|
@@ -12,7 +12,7 @@ describePrivacyPolicyRule(new AlwaysDenyPrivacyPolicyRule(), {
|
|
|
12
12
|
viewerContext: instance(mock(ViewerContext)),
|
|
13
13
|
queryContext: instance(mock(EntityQueryContext)),
|
|
14
14
|
evaluationContext:
|
|
15
|
-
instance(mock<
|
|
15
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
16
16
|
entity: anything(),
|
|
17
17
|
},
|
|
18
18
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { anything, instance, mock } from 'ts-mockito';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../../EntityPrivacyPolicy';
|
|
4
4
|
import { EntityQueryContext } from '../../EntityQueryContext';
|
|
5
5
|
import { ViewerContext } from '../../ViewerContext';
|
|
6
6
|
import { describePrivacyPolicyRule } from '../../utils/__testfixtures__/PrivacyPolicyRuleTestUtils';
|
|
@@ -12,7 +12,7 @@ describePrivacyPolicyRule(new AlwaysSkipPrivacyPolicyRule(), {
|
|
|
12
12
|
viewerContext: instance(mock(ViewerContext)),
|
|
13
13
|
queryContext: instance(mock(EntityQueryContext)),
|
|
14
14
|
evaluationContext:
|
|
15
|
-
instance(mock<
|
|
15
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
16
16
|
entity: anything(),
|
|
17
17
|
},
|
|
18
18
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mock, instance, when } from 'ts-mockito';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EntityPrivacyPolicyRuleEvaluationContext } from '../../EntityPrivacyPolicy';
|
|
4
4
|
import { EntityQueryContext } from '../../EntityQueryContext';
|
|
5
5
|
import { ViewerContext } from '../../ViewerContext';
|
|
6
6
|
import { describePrivacyPolicyRule } from '../../utils/__testfixtures__/PrivacyPolicyRuleTestUtils';
|
|
@@ -30,7 +30,7 @@ describePrivacyPolicyRule<TestFields, 'customIdField', ViewerContext, TestEntity
|
|
|
30
30
|
viewerContext: instance(mock(ViewerContext)),
|
|
31
31
|
queryContext: instance(mock(EntityQueryContext)),
|
|
32
32
|
evaluationContext:
|
|
33
|
-
instance(mock<
|
|
33
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
34
34
|
entity: entityBlah,
|
|
35
35
|
},
|
|
36
36
|
],
|
|
@@ -39,7 +39,7 @@ describePrivacyPolicyRule<TestFields, 'customIdField', ViewerContext, TestEntity
|
|
|
39
39
|
viewerContext: instance(mock(ViewerContext)),
|
|
40
40
|
queryContext: instance(mock(EntityQueryContext)),
|
|
41
41
|
evaluationContext:
|
|
42
|
-
instance(mock<
|
|
42
|
+
instance(mock<EntityPrivacyPolicyRuleEvaluationContext<any, any, any, any, any>>()),
|
|
43
43
|
entity: entityFoo,
|
|
44
44
|
},
|
|
45
45
|
],
|