@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
package/build/EntityFields.d.ts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
import { EntityFieldDefinition } from './EntityFieldDefinition';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* EntityFieldDefinition for a column with a JS string type.
|
|
4
4
|
*/
|
|
5
5
|
export declare class StringField extends EntityFieldDefinition<string> {
|
|
6
6
|
protected validateInputValueInternal(value: string): boolean;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* EntityFieldDefinition for a column with a JS string type.
|
|
10
10
|
* Enforces that the string is a valid UUID.
|
|
11
11
|
*/
|
|
12
12
|
export declare class UUIDField extends StringField {
|
|
13
13
|
protected validateInputValueInternal(value: string): boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* EntityFieldDefinition for a column with a JS Date type.
|
|
17
17
|
*/
|
|
18
18
|
export declare class DateField extends EntityFieldDefinition<Date> {
|
|
19
19
|
protected validateInputValueInternal(value: Date): boolean;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* EntityFieldDefinition for a column with a JS boolean type.
|
|
23
23
|
*/
|
|
24
24
|
export declare class BooleanField extends EntityFieldDefinition<boolean> {
|
|
25
25
|
protected validateInputValueInternal(value: boolean): boolean;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* EntityFieldDefinition for a column with a JS number type.
|
|
29
29
|
* Enforces that the number is an integer.
|
|
30
30
|
*/
|
|
31
31
|
export declare class IntField extends EntityFieldDefinition<number> {
|
|
32
32
|
protected validateInputValueInternal(value: number): boolean;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* EntityFieldDefinition for a column with a JS number type.
|
|
36
36
|
* Enforces that the number is a float (which includes integers in JS).
|
|
37
37
|
*/
|
|
38
38
|
export declare class FloatField extends EntityFieldDefinition<number> {
|
|
39
39
|
protected validateInputValueInternal(value: number): boolean;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* EntityFieldDefinition for a column with a JS string array type.
|
|
43
43
|
* Enforces that every member of the string array is a string.
|
|
44
44
|
*/
|
|
45
45
|
export declare class StringArrayField extends EntityFieldDefinition<string[]> {
|
|
46
46
|
protected validateInputValueInternal(value: string[]): boolean;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* EntityFieldDefinition for a column with a JS JSON object type.
|
|
50
50
|
*/
|
|
51
51
|
export declare class JSONObjectField extends EntityFieldDefinition<object> {
|
|
52
52
|
protected validateInputValueInternal(value: object): boolean;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* EntityFieldDefinition for a enum column with a JS string or number type.
|
|
56
56
|
*/
|
|
57
57
|
export declare class EnumField extends EntityFieldDefinition<string | number> {
|
|
58
58
|
protected validateInputValueInternal(value: string | number): boolean;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* EntityFieldDefinition for a column with a JS JSON array type.
|
|
62
62
|
*/
|
|
63
63
|
export declare class JSONArrayField extends EntityFieldDefinition<any[]> {
|
|
64
64
|
protected validateInputValueInternal(value: any[]): boolean;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* EntityFieldDefinition for a column that may be a JS JSON array type.
|
|
68
68
|
* Does not do any validation.
|
|
69
69
|
*/
|
|
70
70
|
export declare class MaybeJSONArrayField extends EntityFieldDefinition<any | any[]> {
|
package/build/EntityFields.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.MaybeJSONArrayField = exports.JSONArrayField = exports.EnumField = expor
|
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
const EntityFieldDefinition_1 = require("./EntityFieldDefinition");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* EntityFieldDefinition for a column with a JS string type.
|
|
8
8
|
*/
|
|
9
9
|
class StringField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
10
10
|
validateInputValueInternal(value) {
|
|
@@ -13,7 +13,7 @@ class StringField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
13
13
|
}
|
|
14
14
|
exports.StringField = StringField;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* EntityFieldDefinition for a column with a JS string type.
|
|
17
17
|
* Enforces that the string is a valid UUID.
|
|
18
18
|
*/
|
|
19
19
|
class UUIDField extends StringField {
|
|
@@ -23,7 +23,7 @@ class UUIDField extends StringField {
|
|
|
23
23
|
}
|
|
24
24
|
exports.UUIDField = UUIDField;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* EntityFieldDefinition for a column with a JS Date type.
|
|
27
27
|
*/
|
|
28
28
|
class DateField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
29
29
|
validateInputValueInternal(value) {
|
|
@@ -32,7 +32,7 @@ class DateField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
32
32
|
}
|
|
33
33
|
exports.DateField = DateField;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* EntityFieldDefinition for a column with a JS boolean type.
|
|
36
36
|
*/
|
|
37
37
|
class BooleanField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
38
38
|
validateInputValueInternal(value) {
|
|
@@ -41,7 +41,7 @@ class BooleanField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
41
41
|
}
|
|
42
42
|
exports.BooleanField = BooleanField;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* EntityFieldDefinition for a column with a JS number type.
|
|
45
45
|
* Enforces that the number is an integer.
|
|
46
46
|
*/
|
|
47
47
|
class IntField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
@@ -51,7 +51,7 @@ class IntField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
51
51
|
}
|
|
52
52
|
exports.IntField = IntField;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* EntityFieldDefinition for a column with a JS number type.
|
|
55
55
|
* Enforces that the number is a float (which includes integers in JS).
|
|
56
56
|
*/
|
|
57
57
|
class FloatField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
@@ -61,7 +61,7 @@ class FloatField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
61
61
|
}
|
|
62
62
|
exports.FloatField = FloatField;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* EntityFieldDefinition for a column with a JS string array type.
|
|
65
65
|
* Enforces that every member of the string array is a string.
|
|
66
66
|
*/
|
|
67
67
|
class StringArrayField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
@@ -71,7 +71,7 @@ class StringArrayField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
71
71
|
}
|
|
72
72
|
exports.StringArrayField = StringArrayField;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* EntityFieldDefinition for a column with a JS JSON object type.
|
|
75
75
|
*/
|
|
76
76
|
class JSONObjectField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
77
77
|
validateInputValueInternal(value) {
|
|
@@ -80,7 +80,7 @@ class JSONObjectField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
80
80
|
}
|
|
81
81
|
exports.JSONObjectField = JSONObjectField;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* EntityFieldDefinition for a enum column with a JS string or number type.
|
|
84
84
|
*/
|
|
85
85
|
class EnumField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
86
86
|
validateInputValueInternal(value) {
|
|
@@ -89,7 +89,7 @@ class EnumField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
89
89
|
}
|
|
90
90
|
exports.EnumField = EnumField;
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* EntityFieldDefinition for a column with a JS JSON array type.
|
|
93
93
|
*/
|
|
94
94
|
class JSONArrayField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
95
95
|
validateInputValueInternal(value) {
|
|
@@ -98,7 +98,7 @@ class JSONArrayField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
|
|
98
98
|
}
|
|
99
99
|
exports.JSONArrayField = JSONArrayField;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* EntityFieldDefinition for a column that may be a JS JSON array type.
|
|
102
102
|
* Does not do any validation.
|
|
103
103
|
*/
|
|
104
104
|
class MaybeJSONArrayField extends EntityFieldDefinition_1.EntityFieldDefinition {
|
package/build/EntityLoader.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Result } from '@expo/results';
|
|
|
2
2
|
import EnforcingEntityLoader from './EnforcingEntityLoader';
|
|
3
3
|
import { IEntityClass } from './Entity';
|
|
4
4
|
import EntityConfiguration from './EntityConfiguration';
|
|
5
|
-
import { FieldEqualityCondition, QuerySelectionModifiers } from './EntityDatabaseAdapter';
|
|
5
|
+
import { FieldEqualityCondition, QuerySelectionModifiers, QuerySelectionModifiersWithOrderByRaw } from './EntityDatabaseAdapter';
|
|
6
6
|
import EntityPrivacyPolicy, { EntityPrivacyPolicyEvaluationContext } from './EntityPrivacyPolicy';
|
|
7
7
|
import { EntityQueryContext } from './EntityQueryContext';
|
|
8
8
|
import ReadonlyEntity from './ReadonlyEntity';
|
|
@@ -11,7 +11,7 @@ import EntityDataManager from './internal/EntityDataManager';
|
|
|
11
11
|
import IEntityMetricsAdapter from './metrics/IEntityMetricsAdapter';
|
|
12
12
|
/**
|
|
13
13
|
* The primary interface for loading entities. All normal loads are batched,
|
|
14
|
-
* cached, and authorized against the entity's
|
|
14
|
+
* cached, and authorized against the entity's EntityPrivacyPolicy.
|
|
15
15
|
*/
|
|
16
16
|
export default class EntityLoader<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> {
|
|
17
17
|
private readonly viewerContext;
|
|
@@ -100,20 +100,20 @@ export default class EntityLoader<TFields, TID extends NonNullable<TFields[TSele
|
|
|
100
100
|
* bindings: `[1]`
|
|
101
101
|
* Entites returned `WHERE id = 1`
|
|
102
102
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
103
|
+
* http://knexjs.org/#Builder-whereRaw
|
|
104
|
+
* http://knexjs.org/#Raw-Bindings
|
|
105
105
|
*
|
|
106
106
|
* @param rawWhereClause - parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders
|
|
107
107
|
* @param bindings - array of positional bindings or object of named bindings
|
|
108
|
-
* @param querySelectionModifiers - limit, offset, and
|
|
108
|
+
* @param querySelectionModifiers - limit, offset, orderBy, and orderByRaw for the query
|
|
109
109
|
* @returns array of entity results that match the query, where result error can be UnauthorizedError
|
|
110
110
|
* @throws Error when rawWhereClause or bindings are invalid
|
|
111
111
|
*
|
|
112
112
|
* @deprecated prefer caching loaders
|
|
113
113
|
*/
|
|
114
|
-
loadManyByRawWhereClauseAsync(rawWhereClause: string, bindings: any[] | object, querySelectionModifiers?:
|
|
114
|
+
loadManyByRawWhereClauseAsync(rawWhereClause: string, bindings: any[] | object, querySelectionModifiers?: QuerySelectionModifiersWithOrderByRaw<TFields>): Promise<readonly Result<TEntity>[]>;
|
|
115
115
|
/**
|
|
116
|
-
* Invalidate all caches for an entity's fields. Exposed primarily for internal use by
|
|
116
|
+
* Invalidate all caches for an entity's fields. Exposed primarily for internal use by EntityMutator.
|
|
117
117
|
* @param objectFields - entity data object to be invalidated
|
|
118
118
|
*/
|
|
119
119
|
invalidateFieldsAsync(objectFields: Readonly<TFields>): Promise<void>;
|
package/build/EntityLoader.js
CHANGED
|
@@ -12,7 +12,7 @@ const EntityNotFoundError_1 = __importDefault(require("./errors/EntityNotFoundEr
|
|
|
12
12
|
const maps_1 = require("./utils/collections/maps");
|
|
13
13
|
/**
|
|
14
14
|
* The primary interface for loading entities. All normal loads are batched,
|
|
15
|
-
* cached, and authorized against the entity's
|
|
15
|
+
* cached, and authorized against the entity's EntityPrivacyPolicy.
|
|
16
16
|
*/
|
|
17
17
|
class EntityLoader {
|
|
18
18
|
constructor(viewerContext, queryContext, privacyPolicyEvaluationContext, entityConfiguration, entityClass, privacyPolicy, dataManager, metricsAdapter) {
|
|
@@ -148,12 +148,12 @@ class EntityLoader {
|
|
|
148
148
|
* bindings: `[1]`
|
|
149
149
|
* Entites returned `WHERE id = 1`
|
|
150
150
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
151
|
+
* http://knexjs.org/#Builder-whereRaw
|
|
152
|
+
* http://knexjs.org/#Raw-Bindings
|
|
153
153
|
*
|
|
154
154
|
* @param rawWhereClause - parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders
|
|
155
155
|
* @param bindings - array of positional bindings or object of named bindings
|
|
156
|
-
* @param querySelectionModifiers - limit, offset, and
|
|
156
|
+
* @param querySelectionModifiers - limit, offset, orderBy, and orderByRaw for the query
|
|
157
157
|
* @returns array of entity results that match the query, where result error can be UnauthorizedError
|
|
158
158
|
* @throws Error when rawWhereClause or bindings are invalid
|
|
159
159
|
*
|
|
@@ -170,7 +170,7 @@ class EntityLoader {
|
|
|
170
170
|
}));
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* Invalidate all caches for an entity's fields. Exposed primarily for internal use by
|
|
173
|
+
* Invalidate all caches for an entity's fields. Exposed primarily for internal use by EntityMutator.
|
|
174
174
|
* @param objectFields - entity data object to be invalidated
|
|
175
175
|
*/
|
|
176
176
|
async invalidateFieldsAsync(objectFields) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityLoader.js","sourceRoot":"","sources":["../src/EntityLoader.ts"],"names":[],"mappings":";;;;;AAAA,2CAA4D;AAC5D,0DAAkC;AAElC,oFAA4D;AAG5D,
|
|
1
|
+
{"version":3,"file":"EntityLoader.js","sourceRoot":"","sources":["../src/EntityLoader.ts"],"names":[],"mappings":";;;;;AAAA,2CAA4D;AAC5D,0DAAkC;AAElC,oFAA4D;AAG5D,mEAKiC;AAKjC,yGAAiF;AACjF,uFAA+D;AAG/D,mDAA+D;AAE/D;;;GAGG;AACH,MAAqB,YAAY;IAc/B,YACmB,aAA6B,EAC7B,YAAgC,EAChC,8BAAoE,EACpE,mBAAiD,EACjD,WAOhB,EACgB,aAA6B,EAC7B,WAAuC,EACrC,cAAqC;QAdvC,kBAAa,GAAb,aAAa,CAAgB;QAC7B,iBAAY,GAAZ,YAAY,CAAoB;QAChC,mCAA8B,GAA9B,8BAA8B,CAAsC;QACpE,wBAAmB,GAAnB,mBAAmB,CAA8B;QACjD,gBAAW,GAAX,WAAW,CAO3B;QACgB,kBAAa,GAAb,aAAa,CAAgB;QAC7B,gBAAW,GAAX,WAAW,CAA4B;QACrC,mBAAc,GAAd,cAAc,CAAuB;IACvD,CAAC;IAEJ;;;;OAIG;IACH,SAAS;QAQP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AAA,kBAAW,EAAC,yBAAyB,EAAE,KAAK,EAAE,sBAAsB,EAAE,EAAE;YACnF,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,sBAAsB,CAAC,GAAG,CAAC,KAAK,EAAE,qBAAqB,EAAE,EAAE;gBACzD,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE;oBAC7B,OAAO,qBAAqB,CAAC;iBAC9B;gBACD,OAAO,MAAM,IAAA,qBAAW,EACtB,IAAI,CAAC,aAAa,CAAC,kBAAkB,CACnC,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,8BAA8B,EACnC,qBAAqB,CAAC,KAAK,EAC3B,IAAI,CAAC,cAAc,CACpB,CACF,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,mBAAmB,CACzB,SAAY,EACZ,WAAkC;QAElC,MAAM,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvE,IAAA,mBAAS,EAAC,eAAe,EAAE,0CAA0C,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC1F,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACpC,MAAM,YAAY,GAAG,eAAe,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;YACpE,IAAI,CAAC,YAAY,EAAE;gBACjB,MAAM,IAAI,sCAA4B,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;aACjF;SACF;IACH,CAAC;CACF;AAjVD,+BAiVC"}
|
|
@@ -55,7 +55,7 @@ export declare abstract class EntityMutationTrigger<TFields, TID extends NonNull
|
|
|
55
55
|
abstract executeAsync(viewerContext: TViewerContext, queryContext: EntityTransactionalQueryContext, entity: TEntity, mutationInfo: EntityTriggerMutationInfo<TFields, TID, TViewerContext, TEntity, TSelectedFields>): Promise<void>;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* A non-transactional trigger is like a
|
|
58
|
+
* A non-transactional trigger is like a EntityMutationTrigger but used for afterCommit triggers
|
|
59
59
|
* since they explicitly occur outside of the transaction.
|
|
60
60
|
*/
|
|
61
61
|
export declare abstract class EntityNonTransactionalMutationTrigger<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
|
|
@@ -10,7 +10,7 @@ class EntityMutationTrigger {
|
|
|
10
10
|
}
|
|
11
11
|
exports.EntityMutationTrigger = EntityMutationTrigger;
|
|
12
12
|
/**
|
|
13
|
-
* A non-transactional trigger is like a
|
|
13
|
+
* A non-transactional trigger is like a EntityMutationTrigger but used for afterCommit triggers
|
|
14
14
|
* since they explicitly occur outside of the transaction.
|
|
15
15
|
*/
|
|
16
16
|
class EntityNonTransactionalMutationTrigger {
|
package/build/EntityMutator.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export declare class DeleteMutator<TFields, TID extends NonNullable<TFields[TSel
|
|
|
98
98
|
/**
|
|
99
99
|
* Finds all entities referencing the specified entity and either deletes them, nullifies
|
|
100
100
|
* their references to the specified entity, or invalidates the cache depending on the
|
|
101
|
-
*
|
|
101
|
+
* OnDeleteBehavior of the field referencing the specified entity.
|
|
102
102
|
*
|
|
103
103
|
* @remarks
|
|
104
104
|
* This works by doing reverse fan-out queries:
|
package/build/EntityMutator.js
CHANGED
|
@@ -236,7 +236,7 @@ class DeleteMutator extends BaseMutator {
|
|
|
236
236
|
/**
|
|
237
237
|
* Finds all entities referencing the specified entity and either deletes them, nullifies
|
|
238
238
|
* their references to the specified entity, or invalidates the cache depending on the
|
|
239
|
-
*
|
|
239
|
+
* OnDeleteBehavior of the field referencing the specified entity.
|
|
240
240
|
*
|
|
241
241
|
* @remarks
|
|
242
242
|
* This works by doing reverse fan-out queries:
|
|
@@ -16,7 +16,7 @@ export declare type EntityPrivacyPolicyEvaluationContext = {
|
|
|
16
16
|
cascadingDeleteCause: EntityCascadingDeletionInfo | null;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* Evaluation mode for a
|
|
19
|
+
* Evaluation mode for a EntityPrivacyPolicy. Useful when transitioning to
|
|
20
20
|
* using Entity for privacy.
|
|
21
21
|
*/
|
|
22
22
|
export declare enum EntityPrivacyPolicyEvaluationMode {
|
|
@@ -53,7 +53,7 @@ export declare enum EntityAuthorizationAction {
|
|
|
53
53
|
*
|
|
54
54
|
* @remarks
|
|
55
55
|
*
|
|
56
|
-
* A privacy policy declares lists of
|
|
56
|
+
* A privacy policy declares lists of PrivacyPolicyRule for create, read, update, and delete actions
|
|
57
57
|
* for an entity and provides logic for authorizing an entity against rules.
|
|
58
58
|
*
|
|
59
59
|
* Evaluation of a list of rules is performed according the following example. This allows constructing of
|
|
@@ -89,7 +89,7 @@ export default abstract class EntityPrivacyPolicy<TFields, TID extends NonNullab
|
|
|
89
89
|
* @param queryContext - query context in which to perform the create authorization
|
|
90
90
|
* @param entity - entity to authorize
|
|
91
91
|
* @returns entity if authorized
|
|
92
|
-
* @throws
|
|
92
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
93
93
|
*/
|
|
94
94
|
authorizeCreateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyEvaluationContext, entity: TEntity, metricsAdapter: IEntityMetricsAdapter): Promise<TEntity>;
|
|
95
95
|
/**
|
|
@@ -98,7 +98,7 @@ export default abstract class EntityPrivacyPolicy<TFields, TID extends NonNullab
|
|
|
98
98
|
* @param queryContext - query context in which to perform the read authorization
|
|
99
99
|
* @param entity - entity to authorize
|
|
100
100
|
* @returns entity if authorized
|
|
101
|
-
* @throws
|
|
101
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
102
102
|
*/
|
|
103
103
|
authorizeReadAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyEvaluationContext, entity: TEntity, metricsAdapter: IEntityMetricsAdapter): Promise<TEntity>;
|
|
104
104
|
/**
|
|
@@ -107,7 +107,7 @@ export default abstract class EntityPrivacyPolicy<TFields, TID extends NonNullab
|
|
|
107
107
|
* @param queryContext - query context in which to perform the update authorization
|
|
108
108
|
* @param entity - entity to authorize
|
|
109
109
|
* @returns entity if authorized
|
|
110
|
-
* @throws
|
|
110
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
111
111
|
*/
|
|
112
112
|
authorizeUpdateAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyEvaluationContext, entity: TEntity, metricsAdapter: IEntityMetricsAdapter): Promise<TEntity>;
|
|
113
113
|
/**
|
|
@@ -116,7 +116,7 @@ export default abstract class EntityPrivacyPolicy<TFields, TID extends NonNullab
|
|
|
116
116
|
* @param queryContext - query context in which to perform the delete authorization
|
|
117
117
|
* @param entity - entity to authorize
|
|
118
118
|
* @returns entity if authorized
|
|
119
|
-
* @throws
|
|
119
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
120
120
|
*/
|
|
121
121
|
authorizeDeleteAsync(viewerContext: TViewerContext, queryContext: EntityQueryContext, evaluationContext: EntityPrivacyPolicyEvaluationContext, entity: TEntity, metricsAdapter: IEntityMetricsAdapter): Promise<TEntity>;
|
|
122
122
|
private authorizeForRulesetAsync;
|
|
@@ -8,7 +8,7 @@ const EntityNotAuthorizedError_1 = __importDefault(require("./errors/EntityNotAu
|
|
|
8
8
|
const IEntityMetricsAdapter_1 = require("./metrics/IEntityMetricsAdapter");
|
|
9
9
|
const PrivacyPolicyRule_1 = require("./rules/PrivacyPolicyRule");
|
|
10
10
|
/**
|
|
11
|
-
* Evaluation mode for a
|
|
11
|
+
* Evaluation mode for a EntityPrivacyPolicy. Useful when transitioning to
|
|
12
12
|
* using Entity for privacy.
|
|
13
13
|
*/
|
|
14
14
|
var EntityPrivacyPolicyEvaluationMode;
|
|
@@ -38,7 +38,7 @@ var EntityAuthorizationAction;
|
|
|
38
38
|
*
|
|
39
39
|
* @remarks
|
|
40
40
|
*
|
|
41
|
-
* A privacy policy declares lists of
|
|
41
|
+
* A privacy policy declares lists of PrivacyPolicyRule for create, read, update, and delete actions
|
|
42
42
|
* for an entity and provides logic for authorizing an entity against rules.
|
|
43
43
|
*
|
|
44
44
|
* Evaluation of a list of rules is performed according the following example. This allows constructing of
|
|
@@ -80,7 +80,7 @@ class EntityPrivacyPolicy {
|
|
|
80
80
|
* @param queryContext - query context in which to perform the create authorization
|
|
81
81
|
* @param entity - entity to authorize
|
|
82
82
|
* @returns entity if authorized
|
|
83
|
-
* @throws
|
|
83
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
84
84
|
*/
|
|
85
85
|
async authorizeCreateAsync(viewerContext, queryContext, evaluationContext, entity, metricsAdapter) {
|
|
86
86
|
return await this.authorizeForRulesetAsync(this.createRules, viewerContext, queryContext, evaluationContext, entity, EntityAuthorizationAction.CREATE, metricsAdapter);
|
|
@@ -91,7 +91,7 @@ class EntityPrivacyPolicy {
|
|
|
91
91
|
* @param queryContext - query context in which to perform the read authorization
|
|
92
92
|
* @param entity - entity to authorize
|
|
93
93
|
* @returns entity if authorized
|
|
94
|
-
* @throws
|
|
94
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
95
95
|
*/
|
|
96
96
|
async authorizeReadAsync(viewerContext, queryContext, evaluationContext, entity, metricsAdapter) {
|
|
97
97
|
return await this.authorizeForRulesetAsync(this.readRules, viewerContext, queryContext, evaluationContext, entity, EntityAuthorizationAction.READ, metricsAdapter);
|
|
@@ -102,7 +102,7 @@ class EntityPrivacyPolicy {
|
|
|
102
102
|
* @param queryContext - query context in which to perform the update authorization
|
|
103
103
|
* @param entity - entity to authorize
|
|
104
104
|
* @returns entity if authorized
|
|
105
|
-
* @throws
|
|
105
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
106
106
|
*/
|
|
107
107
|
async authorizeUpdateAsync(viewerContext, queryContext, evaluationContext, entity, metricsAdapter) {
|
|
108
108
|
return await this.authorizeForRulesetAsync(this.updateRules, viewerContext, queryContext, evaluationContext, entity, EntityAuthorizationAction.UPDATE, metricsAdapter);
|
|
@@ -113,7 +113,7 @@ class EntityPrivacyPolicy {
|
|
|
113
113
|
* @param queryContext - query context in which to perform the delete authorization
|
|
114
114
|
* @param entity - entity to authorize
|
|
115
115
|
* @returns entity if authorized
|
|
116
|
-
* @throws
|
|
116
|
+
* @throws EntityNotAuthorizedError when not authorized
|
|
117
117
|
*/
|
|
118
118
|
async authorizeDeleteAsync(viewerContext, queryContext, evaluationContext, entity, metricsAdapter) {
|
|
119
119
|
return await this.authorizeForRulesetAsync(this.deleteRules, viewerContext, queryContext, evaluationContext, entity, EntityAuthorizationAction.DELETE, metricsAdapter);
|
|
@@ -5,7 +5,7 @@ export declare type PreCommitCallback = (queryContext: EntityTransactionalQueryC
|
|
|
5
5
|
* Entity framework representation of transactional and non-transactional database
|
|
6
6
|
* query execution units.
|
|
7
7
|
*
|
|
8
|
-
* The behavior of
|
|
8
|
+
* The behavior of EntityMutator and EntityLoader
|
|
9
9
|
* differs when in a transactional context.
|
|
10
10
|
*/
|
|
11
11
|
export declare abstract class EntityQueryContext {
|
|
@@ -17,7 +17,7 @@ export declare abstract class EntityQueryContext {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Entity framework representation of a non-transactional query execution unit.
|
|
20
|
-
* When supplied to
|
|
20
|
+
* When supplied to EntityMutator and EntityLoader methods, they will be
|
|
21
21
|
* run independently of any running transaction (though mutations start their own
|
|
22
22
|
* independent transactions internally when not being run in a transaction).
|
|
23
23
|
*/
|
|
@@ -29,7 +29,7 @@ export declare class EntityNonTransactionalQueryContext extends EntityQueryConte
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Entity framework representation of a transactional query execution unit. When supplied
|
|
32
|
-
* to
|
|
32
|
+
* to EntityMutator and EntityLoader methods, those methods and their
|
|
33
33
|
* dependent triggers and validators will run within the transaction.
|
|
34
34
|
*/
|
|
35
35
|
export declare class EntityTransactionalQueryContext extends EntityQueryContext {
|
|
@@ -9,7 +9,7 @@ const assert_1 = __importDefault(require("assert"));
|
|
|
9
9
|
* Entity framework representation of transactional and non-transactional database
|
|
10
10
|
* query execution units.
|
|
11
11
|
*
|
|
12
|
-
* The behavior of
|
|
12
|
+
* The behavior of EntityMutator and EntityLoader
|
|
13
13
|
* differs when in a transactional context.
|
|
14
14
|
*/
|
|
15
15
|
class EntityQueryContext {
|
|
@@ -23,7 +23,7 @@ class EntityQueryContext {
|
|
|
23
23
|
exports.EntityQueryContext = EntityQueryContext;
|
|
24
24
|
/**
|
|
25
25
|
* Entity framework representation of a non-transactional query execution unit.
|
|
26
|
-
* When supplied to
|
|
26
|
+
* When supplied to EntityMutator and EntityLoader methods, they will be
|
|
27
27
|
* run independently of any running transaction (though mutations start their own
|
|
28
28
|
* independent transactions internally when not being run in a transaction).
|
|
29
29
|
*/
|
|
@@ -42,7 +42,7 @@ class EntityNonTransactionalQueryContext extends EntityQueryContext {
|
|
|
42
42
|
exports.EntityNonTransactionalQueryContext = EntityNonTransactionalQueryContext;
|
|
43
43
|
/**
|
|
44
44
|
* Entity framework representation of a transactional query execution unit. When supplied
|
|
45
|
-
* to
|
|
45
|
+
* to EntityMutator and EntityLoader methods, those methods and their
|
|
46
46
|
* dependent triggers and validators will run within the transaction.
|
|
47
47
|
*/
|
|
48
48
|
class EntityTransactionalQueryContext extends EntityQueryContext {
|
|
@@ -12,7 +12,7 @@ export default abstract class EntityQueryContextProvider {
|
|
|
12
12
|
*/
|
|
13
13
|
protected abstract getQueryInterface(): any;
|
|
14
14
|
/**
|
|
15
|
-
* Vend a transaction runner for use in
|
|
15
|
+
* Vend a transaction runner for use in runInTransactionAsync.
|
|
16
16
|
*/
|
|
17
17
|
protected abstract createTransactionRunner<T>(): (transactionScope: (queryInterface: any) => Promise<T>) => Promise<T>;
|
|
18
18
|
/**
|
|
@@ -30,7 +30,7 @@ export interface ISecondaryEntityCache<TFields, TLoadParams> {
|
|
|
30
30
|
* when the underlying data of a cache key could be stale.
|
|
31
31
|
*
|
|
32
32
|
* This is most commonly used to further optimize hot paths that cannot make use of normal entity cache loading
|
|
33
|
-
* due to use of a non-unique-field-based
|
|
33
|
+
* due to use of a non-unique-field-based EntityLoader method like `loadManyByFieldEqualityConjunctionAsync` or
|
|
34
34
|
* `loadManyByRawWhereClauseAsync`.
|
|
35
35
|
*/
|
|
36
36
|
export default abstract class EntitySecondaryCacheLoader<TLoadParams, 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 = keyof TFields> {
|
|
@@ -9,7 +9,7 @@ const maps_1 = require("./utils/collections/maps");
|
|
|
9
9
|
* when the underlying data of a cache key could be stale.
|
|
10
10
|
*
|
|
11
11
|
* This is most commonly used to further optimize hot paths that cannot make use of normal entity cache loading
|
|
12
|
-
* due to use of a non-unique-field-based
|
|
12
|
+
* due to use of a non-unique-field-based EntityLoader method like `loadManyByFieldEqualityConjunctionAsync` or
|
|
13
13
|
* `loadManyByRawWhereClauseAsync`.
|
|
14
14
|
*/
|
|
15
15
|
class EntitySecondaryCacheLoader {
|
|
@@ -3,7 +3,7 @@ import IEntityGenericCacher from './IEntityGenericCacher';
|
|
|
3
3
|
/**
|
|
4
4
|
* A custom secondary read-through entity cache is a way to add a custom second layer of caching for a particular
|
|
5
5
|
* single entity load. One common way this may be used is to add a second layer of caching in a hot path that makes
|
|
6
|
-
* a call to
|
|
6
|
+
* a call to EntityLoader.loadManyByFieldEqualityConjunctionAsync is guaranteed to return at most one entity.
|
|
7
7
|
*/
|
|
8
8
|
export default abstract class GenericSecondaryEntityCache<TFields, TLoadParams> implements ISecondaryEntityCache<TFields, TLoadParams> {
|
|
9
9
|
protected readonly cacher: IEntityGenericCacher<TFields>;
|
|
@@ -9,7 +9,7 @@ const maps_1 = require("./utils/collections/maps");
|
|
|
9
9
|
/**
|
|
10
10
|
* A custom secondary read-through entity cache is a way to add a custom second layer of caching for a particular
|
|
11
11
|
* single entity load. One common way this may be used is to add a second layer of caching in a hot path that makes
|
|
12
|
-
* a call to
|
|
12
|
+
* a call to EntityLoader.loadManyByFieldEqualityConjunctionAsync is guaranteed to return at most one entity.
|
|
13
13
|
*/
|
|
14
14
|
class GenericSecondaryEntityCache {
|
|
15
15
|
constructor(cacher, constructCacheKey) {
|
|
@@ -36,7 +36,7 @@ export default abstract class ReadonlyEntity<TFields, TID extends NonNullable<TF
|
|
|
36
36
|
*/
|
|
37
37
|
getID(): TID;
|
|
38
38
|
/**
|
|
39
|
-
* @returns
|
|
39
|
+
* @returns EntityAssociationLoader for this entity
|
|
40
40
|
*/
|
|
41
41
|
associationLoader(): EntityAssociationLoader<TFields, TID, TViewerContext, this, TSelectedFields>;
|
|
42
42
|
/**
|
package/build/ReadonlyEntity.js
CHANGED
package/build/ViewerContext.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { EntityQueryContext, EntityTransactionalQueryContext } from './EntityQue
|
|
|
5
5
|
import ReadonlyEntity from './ReadonlyEntity';
|
|
6
6
|
import ViewerScopedEntityCompanion from './ViewerScopedEntityCompanion';
|
|
7
7
|
/**
|
|
8
|
-
* A viewer context encapsulates all information necessary to evaluate an
|
|
8
|
+
* A viewer context encapsulates all information necessary to evaluate an EntityPrivacyPolicy.
|
|
9
9
|
*
|
|
10
|
-
* In combination with an
|
|
10
|
+
* In combination with an EntityCompanionProvider, a viewer context is the
|
|
11
11
|
* entry point into the Entity framework.
|
|
12
12
|
*/
|
|
13
13
|
export default class ViewerContext {
|
package/build/ViewerContext.js
CHANGED
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const ViewerScopedEntityCompanionProvider_1 = __importDefault(require("./ViewerScopedEntityCompanionProvider"));
|
|
7
7
|
/**
|
|
8
|
-
* A viewer context encapsulates all information necessary to evaluate an
|
|
8
|
+
* A viewer context encapsulates all information necessary to evaluate an EntityPrivacyPolicy.
|
|
9
9
|
*
|
|
10
|
-
* In combination with an
|
|
10
|
+
* In combination with an EntityCompanionProvider, a viewer context is the
|
|
11
11
|
* entry point into the Entity framework.
|
|
12
12
|
*/
|
|
13
13
|
class ViewerContext {
|
|
@@ -7,7 +7,7 @@ import ViewerScopedEntityLoaderFactory from './ViewerScopedEntityLoaderFactory';
|
|
|
7
7
|
import ViewerScopedEntityMutatorFactory from './ViewerScopedEntityMutatorFactory';
|
|
8
8
|
import IEntityMetricsAdapter from './metrics/IEntityMetricsAdapter';
|
|
9
9
|
/**
|
|
10
|
-
* Provides a simpler API for loading and mutating entities by injecting the
|
|
10
|
+
* Provides a simpler API for loading and mutating entities by injecting the ViewerContext
|
|
11
11
|
* from the viewer-scoped entity companion provider.
|
|
12
12
|
*/
|
|
13
13
|
export default class ViewerScopedEntityCompanion<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> {
|
|
@@ -27,7 +27,7 @@ export default class ViewerScopedEntityCompanion<TFields, TID extends NonNullabl
|
|
|
27
27
|
*/
|
|
28
28
|
getQueryContextProvider(): EntityQueryContextProvider;
|
|
29
29
|
/**
|
|
30
|
-
* Get the
|
|
30
|
+
* Get the IEntityMetricsAdapter for this companion.
|
|
31
31
|
*/
|
|
32
32
|
getMetricsAdapter(): IEntityMetricsAdapter;
|
|
33
33
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const ViewerScopedEntityLoaderFactory_1 = __importDefault(require("./ViewerScopedEntityLoaderFactory"));
|
|
7
7
|
const ViewerScopedEntityMutatorFactory_1 = __importDefault(require("./ViewerScopedEntityMutatorFactory"));
|
|
8
8
|
/**
|
|
9
|
-
* Provides a simpler API for loading and mutating entities by injecting the
|
|
9
|
+
* Provides a simpler API for loading and mutating entities by injecting the ViewerContext
|
|
10
10
|
* from the viewer-scoped entity companion provider.
|
|
11
11
|
*/
|
|
12
12
|
class ViewerScopedEntityCompanion {
|
|
@@ -33,7 +33,7 @@ class ViewerScopedEntityCompanion {
|
|
|
33
33
|
return this.entityCompanion.getQueryContextProvider();
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Get the
|
|
36
|
+
* Get the IEntityMetricsAdapter for this companion.
|
|
37
37
|
*/
|
|
38
38
|
getMetricsAdapter() {
|
|
39
39
|
return this.entityCompanion.getMetricsAdapter();
|