@expo/entity 0.26.1 → 0.27.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/LICENSE +21 -0
- package/build/ComposedEntityCacheAdapter.d.ts +1 -1
- package/build/ComposedEntityCacheAdapter.js +1 -1
- package/build/ComposedSecondaryEntityCache.d.ts +1 -1
- package/build/ComposedSecondaryEntityCache.js +1 -1
- package/build/EnforcingEntityLoader.d.ts +10 -10
- package/build/EnforcingEntityLoader.js +8 -8
- package/build/EnforcingEntityLoader.js.map +1 -1
- package/build/Entity.d.ts +5 -5
- package/build/Entity.js +5 -5
- package/build/EntityAssociationLoader.d.ts +4 -4
- package/build/EntityCacheAdapter.d.ts +1 -1
- package/build/EntityCompanion.d.ts +1 -1
- package/build/EntityCompanion.js +1 -1
- package/build/EntityCompanionProvider.d.ts +9 -9
- package/build/EntityCompanionProvider.js +3 -3
- package/build/EntityConfiguration.d.ts +2 -2
- package/build/EntityDatabaseAdapter.d.ts +15 -6
- package/build/EntityDatabaseAdapter.js +8 -2
- package/build/EntityDatabaseAdapter.js.map +1 -1
- package/build/EntityFieldDefinition.d.ts +2 -2
- package/build/EntityFields.d.ts +11 -11
- package/build/EntityFields.js +11 -11
- package/build/EntityLoader.d.ts +7 -7
- package/build/EntityLoader.js +5 -5
- package/build/EntityLoader.js.map +1 -1
- package/build/EntityMutationTriggerConfiguration.d.ts +1 -1
- package/build/EntityMutationTriggerConfiguration.js +1 -1
- package/build/EntityMutator.d.ts +1 -1
- package/build/EntityMutator.js +1 -1
- package/build/EntityPrivacyPolicy.d.ts +6 -6
- package/build/EntityPrivacyPolicy.js +6 -6
- package/build/EntityQueryContext.d.ts +3 -3
- package/build/EntityQueryContext.js +3 -3
- package/build/EntityQueryContextProvider.d.ts +1 -1
- package/build/EntitySecondaryCacheLoader.d.ts +1 -1
- package/build/EntitySecondaryCacheLoader.js +1 -1
- package/build/GenericSecondaryEntityCache.d.ts +1 -1
- package/build/GenericSecondaryEntityCache.js +1 -1
- package/build/ReadonlyEntity.d.ts +1 -1
- package/build/ReadonlyEntity.js +1 -1
- package/build/ViewerContext.d.ts +2 -2
- package/build/ViewerContext.js +2 -2
- package/build/ViewerScopedEntityCompanion.d.ts +2 -2
- package/build/ViewerScopedEntityCompanion.js +2 -2
- package/build/ViewerScopedEntityLoaderFactory.d.ts +1 -1
- package/build/ViewerScopedEntityLoaderFactory.js +1 -1
- package/build/ViewerScopedEntityMutatorFactory.d.ts +1 -1
- package/build/ViewerScopedEntityMutatorFactory.js +1 -1
- package/build/internal/EntityDataManager.d.ts +5 -5
- package/build/internal/EntityDataManager.js +3 -3
- package/build/internal/EntityDataManager.js.map +1 -1
- package/build/internal/ReadThroughEntityCache.d.ts +2 -2
- package/build/internal/ReadThroughEntityCache.js +2 -2
- package/build/metrics/IEntityMetricsAdapter.d.ts +10 -10
- package/build/rules/PrivacyPolicyRule.d.ts +1 -1
- package/build/rules/PrivacyPolicyRule.js +1 -1
- package/build/utils/collections/maps.d.ts +1 -1
- package/build/utils/collections/maps.js +1 -1
- package/build/utils/testing/PrivacyPolicyRuleTestUtils.d.ts +1 -2
- package/build/utils/testing/StubQueryContextProvider.d.ts +1 -1
- package/build/utils/testing/StubQueryContextProvider.js +2 -0
- package/build/utils/testing/StubQueryContextProvider.js.map +1 -1
- package/package.json +3 -2
- package/src/ComposedEntityCacheAdapter.ts +1 -1
- package/src/ComposedSecondaryEntityCache.ts +1 -1
- package/src/EnforcingEntityLoader.ts +14 -10
- package/src/Entity.ts +5 -5
- package/src/EntityAssociationLoader.ts +4 -4
- package/src/EntityCacheAdapter.ts +1 -1
- package/src/EntityCompanion.ts +1 -1
- package/src/EntityCompanionProvider.ts +9 -9
- package/src/EntityConfiguration.ts +2 -2
- package/src/EntityDatabaseAdapter.ts +33 -6
- package/src/EntityFieldDefinition.ts +2 -2
- package/src/EntityFields.ts +11 -11
- package/src/EntityLoader.ts +7 -6
- package/src/EntityMutationTriggerConfiguration.ts +1 -1
- package/src/EntityMutator.ts +1 -1
- package/src/EntityPrivacyPolicy.ts +6 -6
- package/src/EntityQueryContext.ts +3 -3
- package/src/EntityQueryContextProvider.ts +1 -1
- package/src/EntitySecondaryCacheLoader.ts +1 -1
- package/src/GenericSecondaryEntityCache.ts +1 -1
- package/src/ReadonlyEntity.ts +1 -1
- package/src/ViewerContext.ts +2 -2
- package/src/ViewerScopedEntityCompanion.ts +2 -2
- package/src/ViewerScopedEntityLoaderFactory.ts +1 -1
- package/src/ViewerScopedEntityMutatorFactory.ts +1 -1
- package/src/internal/EntityDataManager.ts +5 -4
- package/src/internal/ReadThroughEntityCache.ts +2 -2
- package/src/metrics/IEntityMetricsAdapter.ts +10 -10
- package/src/rules/PrivacyPolicyRule.ts +1 -1
- package/src/utils/collections/maps.ts +1 -1
- package/src/utils/testing/PrivacyPolicyRuleTestUtils.ts +1 -1
- package/src/utils/testing/StubQueryContextProvider.ts +1 -1
|
@@ -5,7 +5,7 @@ import { EntityQueryContext } from './EntityQueryContext';
|
|
|
5
5
|
import ReadonlyEntity from './ReadonlyEntity';
|
|
6
6
|
import ViewerContext from './ViewerContext';
|
|
7
7
|
/**
|
|
8
|
-
* Provides a cleaner API for loading entities by passing through the
|
|
8
|
+
* Provides a cleaner API for loading entities by passing through the ViewerContext.
|
|
9
9
|
*/
|
|
10
10
|
export default class ViewerScopedEntityLoaderFactory<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields> {
|
|
11
11
|
private readonly entityLoaderFactory;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
|
-
* Provides a cleaner API for loading entities by passing through the
|
|
4
|
+
* Provides a cleaner API for loading entities by passing through the ViewerContext.
|
|
5
5
|
*/
|
|
6
6
|
class ViewerScopedEntityLoaderFactory {
|
|
7
7
|
constructor(entityLoaderFactory, viewerContext) {
|
|
@@ -5,7 +5,7 @@ import { EntityQueryContext } from './EntityQueryContext';
|
|
|
5
5
|
import ReadonlyEntity from './ReadonlyEntity';
|
|
6
6
|
import ViewerContext from './ViewerContext';
|
|
7
7
|
/**
|
|
8
|
-
* Provides a cleaner API for mutating entities by passing through the
|
|
8
|
+
* Provides a cleaner API for mutating entities by passing through the ViewerContext.
|
|
9
9
|
*/
|
|
10
10
|
export default class ViewerScopedEntityMutatorFactory<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields> {
|
|
11
11
|
private readonly entityMutatorFactory;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
|
-
* Provides a cleaner API for mutating entities by passing through the
|
|
4
|
+
* Provides a cleaner API for mutating entities by passing through the ViewerContext.
|
|
5
5
|
*/
|
|
6
6
|
class ViewerScopedEntityMutatorFactory {
|
|
7
7
|
constructor(entityMutatorFactory, viewerContext) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import EntityDatabaseAdapter, { FieldEqualityCondition, QuerySelectionModifiers } from '../EntityDatabaseAdapter';
|
|
1
|
+
import EntityDatabaseAdapter, { FieldEqualityCondition, QuerySelectionModifiers, QuerySelectionModifiersWithOrderByRaw } from '../EntityDatabaseAdapter';
|
|
2
2
|
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
3
|
import EntityQueryContextProvider from '../EntityQueryContextProvider';
|
|
4
4
|
import IEntityMetricsAdapter from '../metrics/IEntityMetricsAdapter';
|
|
5
5
|
import ReadThroughEntityCache from './ReadThroughEntityCache';
|
|
6
6
|
/**
|
|
7
7
|
* A data manager is responsible for orchestrating multiple sources of entity
|
|
8
|
-
* data including local caches,
|
|
8
|
+
* data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter.
|
|
9
9
|
*
|
|
10
|
-
* It is also responsible for invalidating all sources of data when mutated using
|
|
10
|
+
* It is also responsible for invalidating all sources of data when mutated using EntityMutator.
|
|
11
11
|
*/
|
|
12
12
|
export default class EntityDataManager<TFields> {
|
|
13
13
|
private readonly databaseAdapter;
|
|
@@ -45,10 +45,10 @@ export default class EntityDataManager<TFields> {
|
|
|
45
45
|
* @param queryContext - query context in which to perform the load
|
|
46
46
|
* @param rawWhereClause - parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders
|
|
47
47
|
* @param bindings - array of positional bindings or object of named bindings
|
|
48
|
-
* @param querySelectionModifiers - limit, offset, and
|
|
48
|
+
* @param querySelectionModifiers - limit, offset, orderBy, and orderByRaw for the query
|
|
49
49
|
* @returns array of objects matching the query
|
|
50
50
|
*/
|
|
51
|
-
loadManyByRawWhereClauseAsync(queryContext: EntityQueryContext, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers:
|
|
51
|
+
loadManyByRawWhereClauseAsync(queryContext: EntityQueryContext, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers: QuerySelectionModifiersWithOrderByRaw<TFields>): Promise<readonly Readonly<TFields>[]>;
|
|
52
52
|
private invalidateManyByFieldEqualingAsync;
|
|
53
53
|
/**
|
|
54
54
|
* Invalidate all caches, in-memory or otherwise, for an object.
|
|
@@ -10,9 +10,9 @@ const IEntityMetricsAdapter_1 = require("../metrics/IEntityMetricsAdapter");
|
|
|
10
10
|
const maps_1 = require("../utils/collections/maps");
|
|
11
11
|
/**
|
|
12
12
|
* A data manager is responsible for orchestrating multiple sources of entity
|
|
13
|
-
* data including local caches,
|
|
13
|
+
* data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter.
|
|
14
14
|
*
|
|
15
|
-
* It is also responsible for invalidating all sources of data when mutated using
|
|
15
|
+
* It is also responsible for invalidating all sources of data when mutated using EntityMutator.
|
|
16
16
|
*/
|
|
17
17
|
class EntityDataManager {
|
|
18
18
|
constructor(databaseAdapter, entityCache, queryContextProvider, metricsAdapter, entityClassName) {
|
|
@@ -98,7 +98,7 @@ class EntityDataManager {
|
|
|
98
98
|
* @param queryContext - query context in which to perform the load
|
|
99
99
|
* @param rawWhereClause - parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders
|
|
100
100
|
* @param bindings - array of positional bindings or object of named bindings
|
|
101
|
-
* @param querySelectionModifiers - limit, offset, and
|
|
101
|
+
* @param querySelectionModifiers - limit, offset, orderBy, and orderByRaw for the query
|
|
102
102
|
* @returns array of objects matching the query
|
|
103
103
|
*/
|
|
104
104
|
async loadManyByRawWhereClauseAsync(queryContext, rawWhereClause, bindings, querySelectionModifiers) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDataManager.js","sourceRoot":"","sources":["../../src/internal/EntityDataManager.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;
|
|
1
|
+
{"version":3,"file":"EntityDataManager.js","sourceRoot":"","sources":["../../src/internal/EntityDataManager.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AASpC,gDAAiD;AACjD,sEAGuC;AACvC,4EAG0C;AAC1C,oDAAsE;AAGtE;;;;;GAKG;AACH,MAAqB,iBAAiB;IAMpC,YACmB,eAA+C,EAC/C,WAA4C,EAC5C,oBAAgD,EAChD,cAAqC,EACrC,eAAuB;QAJvB,oBAAe,GAAf,eAAe,CAAgC;QAC/C,gBAAW,GAAX,WAAW,CAAiC;QAC5C,yBAAoB,GAApB,oBAAoB,CAA4B;QAChD,mBAAc,GAAd,cAAc,CAAuB;QACrC,oBAAe,GAAf,eAAe,CAAQ;QAVzB,qBAAgB,GAG7B,IAAI,GAAG,EAAE,CAAC;IAQX,CAAC;IAEI,8BAA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GAAG,CACf,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,SAAwB,EAAE,EAAE;YAC1C,MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,MAAM,IAAI,CAAC,kCAAkC,CAAC,SAAS,EAAE;oBACvD,KAA4C;iBAC7C,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AAxMD,oCAwMC"}
|
|
@@ -14,8 +14,8 @@ export declare type CacheLoadResult<TFields> = {
|
|
|
14
14
|
status: CacheStatus.NEGATIVE;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* A read-through entity cache is responsible for coordinating
|
|
18
|
-
*
|
|
17
|
+
* A read-through entity cache is responsible for coordinating EntityDatabaseAdapter and
|
|
18
|
+
* EntityCacheAdapter within the EntityDataManager.
|
|
19
19
|
*/
|
|
20
20
|
export default class ReadThroughEntityCache<TFields> {
|
|
21
21
|
private readonly entityConfiguration;
|
|
@@ -13,8 +13,8 @@ var CacheStatus;
|
|
|
13
13
|
CacheStatus[CacheStatus["NEGATIVE"] = 2] = "NEGATIVE";
|
|
14
14
|
})(CacheStatus = exports.CacheStatus || (exports.CacheStatus = {}));
|
|
15
15
|
/**
|
|
16
|
-
* A read-through entity cache is responsible for coordinating
|
|
17
|
-
*
|
|
16
|
+
* A read-through entity cache is responsible for coordinating EntityDatabaseAdapter and
|
|
17
|
+
* EntityCacheAdapter within the EntityDataManager.
|
|
18
18
|
*/
|
|
19
19
|
class ReadThroughEntityCache {
|
|
20
20
|
constructor(entityConfiguration, entityCacheAdapter) {
|
|
@@ -5,15 +5,15 @@ export declare enum EntityMetricsLoadType {
|
|
|
5
5
|
LOAD_MANY_RAW = 2
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Event about a single call to an
|
|
8
|
+
* Event about a single call to an EntityLoader method.
|
|
9
9
|
*/
|
|
10
10
|
export interface EntityMetricsLoadEvent {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* EntityMetricsLoadType for this load.
|
|
13
13
|
*/
|
|
14
14
|
type: EntityMetricsLoadType;
|
|
15
15
|
/**
|
|
16
|
-
* Class name of the
|
|
16
|
+
* Class name of the Entity being loaded.
|
|
17
17
|
*/
|
|
18
18
|
entityClassName: string;
|
|
19
19
|
/**
|
|
@@ -32,11 +32,11 @@ export declare enum EntityMetricsMutationType {
|
|
|
32
32
|
}
|
|
33
33
|
export interface EntityMetricsMutationEvent {
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* EntityMetricsMutationType for this mutation.
|
|
36
36
|
*/
|
|
37
37
|
type: EntityMetricsMutationType;
|
|
38
38
|
/**
|
|
39
|
-
* Class name of the
|
|
39
|
+
* Class name of the Entity being mutated.
|
|
40
40
|
*/
|
|
41
41
|
entityClassName: string;
|
|
42
42
|
/**
|
|
@@ -60,7 +60,7 @@ export declare enum IncrementLoadCountEventType {
|
|
|
60
60
|
DATABASE = 2
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Event used to record dataloader, cache, and database load counts in
|
|
63
|
+
* Event used to record dataloader, cache, and database load counts in EntityDataManager.
|
|
64
64
|
*/
|
|
65
65
|
export interface IncrementLoadCountEvent {
|
|
66
66
|
/**
|
|
@@ -72,7 +72,7 @@ export interface IncrementLoadCountEvent {
|
|
|
72
72
|
*/
|
|
73
73
|
fieldValueCount: number;
|
|
74
74
|
/**
|
|
75
|
-
* Class name of the
|
|
75
|
+
* Class name of the Entity being loaded.
|
|
76
76
|
*/
|
|
77
77
|
entityClassName: string;
|
|
78
78
|
}
|
|
@@ -81,11 +81,11 @@ export declare enum EntityMetricsAuthorizationResult {
|
|
|
81
81
|
ALLOW = 1
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* Event used to record a singe
|
|
84
|
+
* Event used to record a singe EntityPrivacyPolicy authorization.
|
|
85
85
|
*/
|
|
86
86
|
export interface EntityMetricsAuthorizationEvent {
|
|
87
87
|
/**
|
|
88
|
-
* Class name of the
|
|
88
|
+
* Class name of the Entity being authorized.
|
|
89
89
|
*/
|
|
90
90
|
entityClassName: string;
|
|
91
91
|
action: EntityAuthorizationAction;
|
|
@@ -98,7 +98,7 @@ export interface EntityMetricsAuthorizationEvent {
|
|
|
98
98
|
*/
|
|
99
99
|
export default interface IEntityMetricsAdapter {
|
|
100
100
|
/**
|
|
101
|
-
* Called when a
|
|
101
|
+
* Called when a EntityPrivacyPolicy authorization succeeds or fails.
|
|
102
102
|
* @param authorizationEvent - info about the authorization event
|
|
103
103
|
*/
|
|
104
104
|
logAuthorizationEvent(authorizationEvent: EntityMetricsAuthorizationEvent): void;
|
|
@@ -28,7 +28,7 @@ export declare enum RuleEvaluationResult {
|
|
|
28
28
|
* rule in the privacy policy. If all rules in the policy SKIP, the policy is denied.
|
|
29
29
|
*
|
|
30
30
|
* Returning DENY from a rule is useful in a few notable cases:
|
|
31
|
-
* - Preventing a CRUD action on an entity (
|
|
31
|
+
* - Preventing a CRUD action on an entity (AlwaysDenyPrivacyPolicyRule)
|
|
32
32
|
* - Blocking. For example, a user blocks another user from seeing their posts, and the rule
|
|
33
33
|
* would be named something like `DenyIfViewerHasBeenBlockedPrivacyPolicyRule`.
|
|
34
34
|
*/
|
|
@@ -28,7 +28,7 @@ var RuleEvaluationResult;
|
|
|
28
28
|
* rule in the privacy policy. If all rules in the policy SKIP, the policy is denied.
|
|
29
29
|
*
|
|
30
30
|
* Returning DENY from a rule is useful in a few notable cases:
|
|
31
|
-
* - Preventing a CRUD action on an entity (
|
|
31
|
+
* - Preventing a CRUD action on an entity (AlwaysDenyPrivacyPolicyRule)
|
|
32
32
|
* - Blocking. For example, a user blocks another user from seeing their posts, and the rule
|
|
33
33
|
* would be named something like `DenyIfViewerHasBeenBlockedPrivacyPolicyRule`.
|
|
34
34
|
*/
|
|
@@ -23,7 +23,7 @@ export declare const mapMap: <K, V, M>(map: ReadonlyMap<K, V>, mapper: (value: V
|
|
|
23
23
|
export declare const mapMapAsync: <K, V, M>(map: ReadonlyMap<K, V>, mapper: (value: V, key: K) => Promise<M>) => Promise<Map<K, M>>;
|
|
24
24
|
/**
|
|
25
25
|
* Create a new Map by associating the value of each key with mapper executed for each key in the source map.
|
|
26
|
-
* The opposite of
|
|
26
|
+
* The opposite of mapMap. In the event two source keys map to the same result key, the second source key's
|
|
27
27
|
* value will overwrite the first, in which case the cardinality of the returned map may be smaller than the
|
|
28
28
|
* source map's.
|
|
29
29
|
*
|
|
@@ -53,7 +53,7 @@ const mapMapAsync = async function (map, mapper) {
|
|
|
53
53
|
exports.mapMapAsync = mapMapAsync;
|
|
54
54
|
/**
|
|
55
55
|
* Create a new Map by associating the value of each key with mapper executed for each key in the source map.
|
|
56
|
-
* The opposite of
|
|
56
|
+
* The opposite of mapMap. In the event two source keys map to the same result key, the second source key's
|
|
57
57
|
* value will overwrite the first, in which case the cardinality of the returned map may be smaller than the
|
|
58
58
|
* source map's.
|
|
59
59
|
*
|
|
@@ -9,7 +9,7 @@ export interface Case<TFields, TID extends NonNullable<TFields[TSelectedFields]>
|
|
|
9
9
|
evaluationContext: EntityPrivacyPolicyEvaluationContext;
|
|
10
10
|
entity: TEntity;
|
|
11
11
|
}
|
|
12
|
-
declare type CaseMap<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields> = Map<string, () => Promise<Case<TFields, TID, TViewerContext, TEntity, TSelectedFields>>>;
|
|
12
|
+
export declare type CaseMap<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields> = Map<string, () => Promise<Case<TFields, TID, TViewerContext, TEntity, TSelectedFields>>>;
|
|
13
13
|
/**
|
|
14
14
|
* Useful for defining test cases that have async preconditions.
|
|
15
15
|
*/
|
|
@@ -26,4 +26,3 @@ export declare const describePrivacyPolicyRule: <TFields, TID extends NonNullabl
|
|
|
26
26
|
skipCases?: Case<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
|
|
27
27
|
denyCases?: Case<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
|
|
28
28
|
}) => void;
|
|
29
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EntityQueryContextProvider from '../../EntityQueryContextProvider';
|
|
2
|
-
declare class StubQueryContextProvider extends EntityQueryContextProvider {
|
|
2
|
+
export declare class StubQueryContextProvider extends EntityQueryContextProvider {
|
|
3
3
|
protected getQueryInterface(): any;
|
|
4
4
|
protected createTransactionRunner<T>(): (transactionScope: (queryInterface: any) => Promise<T>) => Promise<T>;
|
|
5
5
|
}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StubQueryContextProvider = void 0;
|
|
6
7
|
const EntityQueryContextProvider_1 = __importDefault(require("../../EntityQueryContextProvider"));
|
|
7
8
|
class StubQueryContextProvider extends EntityQueryContextProvider_1.default {
|
|
8
9
|
getQueryInterface() {
|
|
@@ -12,5 +13,6 @@ class StubQueryContextProvider extends EntityQueryContextProvider_1.default {
|
|
|
12
13
|
return (transactionScope) => Promise.resolve(transactionScope({}));
|
|
13
14
|
}
|
|
14
15
|
}
|
|
16
|
+
exports.StubQueryContextProvider = StubQueryContextProvider;
|
|
15
17
|
exports.default = new StubQueryContextProvider();
|
|
16
18
|
//# sourceMappingURL=StubQueryContextProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StubQueryContextProvider.js","sourceRoot":"","sources":["../../../src/utils/testing/StubQueryContextProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StubQueryContextProvider.js","sourceRoot":"","sources":["../../../src/utils/testing/StubQueryContextProvider.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA0E;AAE1E,MAAa,wBAAyB,SAAQ,oCAA0B;IAC5D,iBAAiB;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,uBAAuB;QAG/B,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AAVD,4DAUC;AAED,kBAAe,IAAI,wBAAwB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/entity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "A privacy-first data model",
|
|
5
5
|
"files": [
|
|
6
6
|
"build",
|
|
@@ -32,5 +32,6 @@
|
|
|
32
32
|
"es6-error": "^4.1.1",
|
|
33
33
|
"invariant": "^2.2.4",
|
|
34
34
|
"uuid": "^8.3.0"
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "813e72bd53291ad6087fbcd0782946d6b125347d"
|
|
36
37
|
}
|
|
@@ -5,7 +5,7 @@ import EntityConfiguration from './EntityConfiguration';
|
|
|
5
5
|
import { CacheStatus, CacheLoadResult } from './internal/ReadThroughEntityCache';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* A
|
|
8
|
+
* A EntityCacheAdapter that composes other EntityCacheAdapter instances.
|
|
9
9
|
*/
|
|
10
10
|
export default class ComposedEntityCacheAdapter<TFields> extends EntityCacheAdapter<TFields> {
|
|
11
11
|
/**
|
|
@@ -3,7 +3,7 @@ import nullthrows from 'nullthrows';
|
|
|
3
3
|
import { ISecondaryEntityCache } from './EntitySecondaryCacheLoader';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A
|
|
6
|
+
* A ISecondaryEntityCache that composes other ISecondaryEntityCache instances.
|
|
7
7
|
*/
|
|
8
8
|
export default class ComposedSecondaryEntityCache<TLoadParams, TFields>
|
|
9
9
|
implements ISecondaryEntityCache<TFields, TLoadParams>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FieldEqualityCondition,
|
|
3
|
+
QuerySelectionModifiers,
|
|
4
|
+
QuerySelectionModifiersWithOrderByRaw,
|
|
5
|
+
} from './EntityDatabaseAdapter';
|
|
2
6
|
import EntityLoader from './EntityLoader';
|
|
3
7
|
import EntityPrivacyPolicy from './EntityPrivacyPolicy';
|
|
4
8
|
import ReadonlyEntity from './ReadonlyEntity';
|
|
@@ -36,7 +40,7 @@ export default class EnforcingEntityLoader<
|
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* Enforcing version of entity loader method by the same name.
|
|
39
|
-
* @throws
|
|
43
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
40
44
|
*/
|
|
41
45
|
async loadManyByFieldEqualingManyAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
42
46
|
fieldName: N,
|
|
@@ -53,7 +57,7 @@ export default class EnforcingEntityLoader<
|
|
|
53
57
|
|
|
54
58
|
/**
|
|
55
59
|
* Enforcing version of entity loader method by the same name.
|
|
56
|
-
* @throws
|
|
60
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
57
61
|
*/
|
|
58
62
|
async loadManyByFieldEqualingAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
59
63
|
fieldName: N,
|
|
@@ -68,7 +72,7 @@ export default class EnforcingEntityLoader<
|
|
|
68
72
|
|
|
69
73
|
/**
|
|
70
74
|
* Enforcing version of entity loader method by the same name.
|
|
71
|
-
* @throws
|
|
75
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
72
76
|
* @throws when multiple entities are found matching the condition
|
|
73
77
|
*/
|
|
74
78
|
async loadByFieldEqualingAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
@@ -84,7 +88,7 @@ export default class EnforcingEntityLoader<
|
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
90
|
* Enforcing version of entity loader method by the same name.
|
|
87
|
-
* @throws
|
|
91
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
88
92
|
*/
|
|
89
93
|
async loadByIDAsync(id: TID): Promise<TEntity> {
|
|
90
94
|
const entityResult = await this.entityLoader.loadByIDAsync(id);
|
|
@@ -93,7 +97,7 @@ export default class EnforcingEntityLoader<
|
|
|
93
97
|
|
|
94
98
|
/**
|
|
95
99
|
* Enforcing version of entity loader method by the same name.
|
|
96
|
-
* @throws
|
|
100
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
97
101
|
* @throws when multiple entities are found matching the condition
|
|
98
102
|
*/
|
|
99
103
|
async loadByIDNullableAsync(id: TID): Promise<TEntity | null> {
|
|
@@ -103,7 +107,7 @@ export default class EnforcingEntityLoader<
|
|
|
103
107
|
|
|
104
108
|
/**
|
|
105
109
|
* Enforcing version of entity loader method by the same name.
|
|
106
|
-
* @throws
|
|
110
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
107
111
|
*/
|
|
108
112
|
async loadManyByIDsAsync(ids: readonly TID[]): Promise<ReadonlyMap<TID, TEntity>> {
|
|
109
113
|
const entityResults = await this.entityLoader.loadManyByIDsAsync(ids);
|
|
@@ -112,7 +116,7 @@ export default class EnforcingEntityLoader<
|
|
|
112
116
|
|
|
113
117
|
/**
|
|
114
118
|
* Enforcing version of entity loader method by the same name.
|
|
115
|
-
* @throws
|
|
119
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
116
120
|
*/
|
|
117
121
|
async loadManyByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(
|
|
118
122
|
fieldEqualityOperands: FieldEqualityCondition<TFields, N>[],
|
|
@@ -127,12 +131,12 @@ export default class EnforcingEntityLoader<
|
|
|
127
131
|
|
|
128
132
|
/**
|
|
129
133
|
* Enforcing version of entity loader method by the same name.
|
|
130
|
-
* @throws
|
|
134
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
131
135
|
*/
|
|
132
136
|
async loadManyByRawWhereClauseAsync(
|
|
133
137
|
rawWhereClause: string,
|
|
134
138
|
bindings: any[] | object,
|
|
135
|
-
querySelectionModifiers:
|
|
139
|
+
querySelectionModifiers: QuerySelectionModifiersWithOrderByRaw<TFields> = {}
|
|
136
140
|
): Promise<readonly TEntity[]> {
|
|
137
141
|
const entityResults = await this.entityLoader.loadManyByRawWhereClauseAsync(
|
|
138
142
|
rawWhereClause,
|
package/src/Entity.ts
CHANGED
|
@@ -11,19 +11,19 @@ import ViewerContext from './ViewerContext';
|
|
|
11
11
|
* Entity is a privacy-first data model.
|
|
12
12
|
*
|
|
13
13
|
* A instance of an entity represents a single "row" of persisted data in a database that a
|
|
14
|
-
* viewer, represented by the corresponding
|
|
14
|
+
* viewer, represented by the corresponding ViewerContext, has permission to read.
|
|
15
15
|
*
|
|
16
16
|
* Create, read, update, and delete permissions for an entity are declaratively defined using an
|
|
17
|
-
*
|
|
17
|
+
* EntityPrivacyPolicy.
|
|
18
18
|
*
|
|
19
|
-
* Entites are loaded through an
|
|
19
|
+
* Entites are loaded through an EntityLoader, which is responsible for
|
|
20
20
|
* orchestrating fetching, caching, and authorization of reading "rows".
|
|
21
21
|
*
|
|
22
|
-
* Entities are mutated and deleted through an
|
|
22
|
+
* Entities are mutated and deleted through an EntityMutator, which is responsible for
|
|
23
23
|
* orchestrating database writes, cache invalidation, and authorization of writing "rows".
|
|
24
24
|
*
|
|
25
25
|
* All concrete entity implementations should extend this class and provide their
|
|
26
|
-
* own
|
|
26
|
+
* own EntityCompanionDefinition.
|
|
27
27
|
*/
|
|
28
28
|
export default abstract class Entity<
|
|
29
29
|
TFields,
|
|
@@ -251,7 +251,7 @@ export default class EntityAssociationLoader<
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* Load an associated entity by folding a sequence of
|
|
254
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
255
255
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
256
256
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
257
257
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -285,7 +285,7 @@ export default class EntityAssociationLoader<
|
|
|
285
285
|
): Promise<Result<TEntity2> | null>;
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
|
-
* Load an associated entity by folding a sequence of
|
|
288
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
289
289
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
290
290
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
291
291
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -340,7 +340,7 @@ export default class EntityAssociationLoader<
|
|
|
340
340
|
): Promise<Result<TEntity3> | null>;
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
|
-
* Load an associated entity by folding a sequence of
|
|
343
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
344
344
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
345
345
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
346
346
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -416,7 +416,7 @@ export default class EntityAssociationLoader<
|
|
|
416
416
|
): Promise<Result<TEntity4> | null>;
|
|
417
417
|
|
|
418
418
|
/**
|
|
419
|
-
* Load an associated entity by folding a sequence of
|
|
419
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
420
420
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
421
421
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
422
422
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -32,7 +32,7 @@ export default abstract class EntityCacheAdapter<TFields> {
|
|
|
32
32
|
/**
|
|
33
33
|
* Negatively cache objects that could not be found in the cache or DB.
|
|
34
34
|
* @param fieldName - object field being queried
|
|
35
|
-
* @param fieldValues - fieldValues for objects reported as
|
|
35
|
+
* @param fieldValues - fieldValues for objects reported as CacheStatus.NEGATIVE
|
|
36
36
|
* in the cache and not found in the DB.
|
|
37
37
|
*/
|
|
38
38
|
public abstract cacheDBMissesAsync<N extends keyof TFields>(
|
package/src/EntityCompanion.ts
CHANGED
|
@@ -132,7 +132,7 @@ export default class EntityCompanion<
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
* Get the
|
|
135
|
+
* Get the IEntityMetricsAdapter for this companion.
|
|
136
136
|
*/
|
|
137
137
|
getMetricsAdapter(): IEntityMetricsAdapter {
|
|
138
138
|
return this.metricsAdapter;
|
|
@@ -109,15 +109,15 @@ export class EntityCompanionDefinition<
|
|
|
109
109
|
TSelectedFields
|
|
110
110
|
>;
|
|
111
111
|
/**
|
|
112
|
-
* The
|
|
112
|
+
* The EntityConfiguration for this entity.
|
|
113
113
|
*/
|
|
114
114
|
entityConfiguration: EntityConfiguration<TFields>;
|
|
115
115
|
/**
|
|
116
|
-
* The
|
|
116
|
+
* The EntityPrivacyPolicy class for this entity.
|
|
117
117
|
*/
|
|
118
118
|
privacyPolicyClass: IPrivacyPolicyClass<TPrivacyPolicy>;
|
|
119
119
|
/**
|
|
120
|
-
* An optional list of
|
|
120
|
+
* An optional list of EntityMutationValidator for this entity.
|
|
121
121
|
*/
|
|
122
122
|
mutationValidators?: () => EntityMutationValidator<
|
|
123
123
|
TFields,
|
|
@@ -127,7 +127,7 @@ export class EntityCompanionDefinition<
|
|
|
127
127
|
TSelectedFields
|
|
128
128
|
>[];
|
|
129
129
|
/**
|
|
130
|
-
* An optional list of
|
|
130
|
+
* An optional list of EntityMutationTrigger for this entity.
|
|
131
131
|
*/
|
|
132
132
|
mutationTriggers?: () => EntityMutationTriggerConfiguration<
|
|
133
133
|
TFields,
|
|
@@ -137,8 +137,8 @@ export class EntityCompanionDefinition<
|
|
|
137
137
|
TSelectedFields
|
|
138
138
|
>;
|
|
139
139
|
/**
|
|
140
|
-
* An optional subset of fields defined in the
|
|
141
|
-
* For use when multiple types of entities are backed by a single table (
|
|
140
|
+
* An optional subset of fields defined in the EntityConfiguration which belong to this entity.
|
|
141
|
+
* For use when multiple types of entities are backed by a single table (EntityConfiguration) yet
|
|
142
142
|
* only expose a subset of the fields.
|
|
143
143
|
*/
|
|
144
144
|
entitySelectedFields?: TSelectedFields[];
|
|
@@ -155,11 +155,11 @@ export class EntityCompanionDefinition<
|
|
|
155
155
|
/**
|
|
156
156
|
* An instance of the Entity framework.
|
|
157
157
|
*
|
|
158
|
-
* Required to create a
|
|
158
|
+
* Required to create a ViewerContext, which is the application entry point
|
|
159
159
|
* into the framework.
|
|
160
160
|
*
|
|
161
161
|
* Internally, this is a lazy entity companion factory that instantiates and caches one
|
|
162
|
-
*
|
|
162
|
+
* EntityCompanion for each type of Entity.
|
|
163
163
|
*/
|
|
164
164
|
export default class EntityCompanionProvider {
|
|
165
165
|
private readonly companionMap: Map<string, EntityCompanion<any, any, any, any, any, any>> =
|
|
@@ -169,7 +169,7 @@ export default class EntityCompanionProvider {
|
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
171
|
* Instantiate an Entity framework.
|
|
172
|
-
* @param metricsAdapter - An
|
|
172
|
+
* @param metricsAdapter - An IEntityMetricsAdapter for collecting metrics on this instance
|
|
173
173
|
* @param databaseAdapterFlavors - Database adapter configurations for this instance
|
|
174
174
|
* @param cacheAdapterFlavors - Cache adapter configurations for this instance
|
|
175
175
|
*/
|
|
@@ -41,12 +41,12 @@ export default class EntityConfiguration<TFields> {
|
|
|
41
41
|
tableName: string;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Map from each entity field to an
|
|
44
|
+
* Map from each entity field to an EntityFieldDefinition specifying information about the field.
|
|
45
45
|
*/
|
|
46
46
|
schema: Record<keyof TFields, EntityFieldDefinition<any>>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* List of other entity types that reference this type in
|
|
49
|
+
* List of other entity types that reference this type in EntityFieldDefinition associations.
|
|
50
50
|
*/
|
|
51
51
|
getInboundEdges?: () => IEntityClass<any, any, any, any, any, any>[];
|
|
52
52
|
|