@expo/entity 0.26.1 → 0.28.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 +25 -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 +9 -22
- package/build/EntityFields.js +10 -29
- package/build/EntityFields.js.map +1 -1
- package/build/EntityLoader.d.ts +10 -10
- package/build/EntityLoader.js +8 -8
- 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 +23 -3
- package/build/EntityQueryContext.js +43 -6
- package/build/EntityQueryContext.js.map +1 -1
- package/build/EntityQueryContextProvider.d.ts +10 -2
- package/build/EntityQueryContextProvider.js +18 -1
- package/build/EntityQueryContextProvider.js.map +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/__tests__/EntityFields-test.js +0 -4
- package/build/__tests__/EntityFields-test.js.map +1 -1
- package/build/__tests__/EntityQueryContext-test.js +39 -0
- package/build/__tests__/EntityQueryContext-test.js.map +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 +2 -1
- package/build/utils/testing/StubQueryContextProvider.js +5 -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 +43 -6
- package/src/EntityFieldDefinition.ts +2 -2
- package/src/EntityFields.ts +9 -28
- package/src/EntityLoader.ts +10 -9
- package/src/EntityMutationTriggerConfiguration.ts +1 -1
- package/src/EntityMutator.ts +1 -1
- package/src/EntityPrivacyPolicy.ts +6 -6
- package/src/EntityQueryContext.ts +63 -3
- package/src/EntityQueryContextProvider.ts +34 -2
- 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/__tests__/EntityFields-test.ts +0 -12
- package/src/__tests__/EntityQueryContext-test.ts +50 -0
- 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 +7 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-present 650 Industries, Inc. (aka Expo)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -2,7 +2,7 @@ import EntityCacheAdapter from './EntityCacheAdapter';
|
|
|
2
2
|
import EntityConfiguration from './EntityConfiguration';
|
|
3
3
|
import { CacheLoadResult } from './internal/ReadThroughEntityCache';
|
|
4
4
|
/**
|
|
5
|
-
* A
|
|
5
|
+
* A EntityCacheAdapter that composes other EntityCacheAdapter instances.
|
|
6
6
|
*/
|
|
7
7
|
export default class ComposedEntityCacheAdapter<TFields> extends EntityCacheAdapter<TFields> {
|
|
8
8
|
private readonly cacheAdapters;
|
|
@@ -7,7 +7,7 @@ const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
|
7
7
|
const EntityCacheAdapter_1 = __importDefault(require("./EntityCacheAdapter"));
|
|
8
8
|
const ReadThroughEntityCache_1 = require("./internal/ReadThroughEntityCache");
|
|
9
9
|
/**
|
|
10
|
-
* A
|
|
10
|
+
* A EntityCacheAdapter that composes other EntityCacheAdapter instances.
|
|
11
11
|
*/
|
|
12
12
|
class ComposedEntityCacheAdapter extends EntityCacheAdapter_1.default {
|
|
13
13
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISecondaryEntityCache } from './EntitySecondaryCacheLoader';
|
|
2
2
|
/**
|
|
3
|
-
* A
|
|
3
|
+
* A ISecondaryEntityCache that composes other ISecondaryEntityCache instances.
|
|
4
4
|
*/
|
|
5
5
|
export default class ComposedSecondaryEntityCache<TLoadParams, TFields> implements ISecondaryEntityCache<TFields, TLoadParams> {
|
|
6
6
|
private readonly secondaryEntityCaches;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
7
7
|
/**
|
|
8
|
-
* A
|
|
8
|
+
* A ISecondaryEntityCache that composes other ISecondaryEntityCache instances.
|
|
9
9
|
*/
|
|
10
10
|
class ComposedSecondaryEntityCache {
|
|
11
11
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldEqualityCondition, QuerySelectionModifiers } from './EntityDatabaseAdapter';
|
|
1
|
+
import { FieldEqualityCondition, QuerySelectionModifiers, QuerySelectionModifiersWithOrderByRaw } from './EntityDatabaseAdapter';
|
|
2
2
|
import EntityLoader from './EntityLoader';
|
|
3
3
|
import EntityPrivacyPolicy from './EntityPrivacyPolicy';
|
|
4
4
|
import ReadonlyEntity from './ReadonlyEntity';
|
|
@@ -12,44 +12,44 @@ export default class EnforcingEntityLoader<TFields, TID extends NonNullable<TFie
|
|
|
12
12
|
constructor(entityLoader: EntityLoader<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>);
|
|
13
13
|
/**
|
|
14
14
|
* Enforcing version of entity loader method by the same name.
|
|
15
|
-
* @throws
|
|
15
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
16
16
|
*/
|
|
17
17
|
loadManyByFieldEqualingManyAsync<N extends keyof Pick<TFields, TSelectedFields>>(fieldName: N, fieldValues: readonly NonNullable<TFields[N]>[]): Promise<ReadonlyMap<NonNullable<TFields[N]>, readonly TEntity[]>>;
|
|
18
18
|
/**
|
|
19
19
|
* Enforcing version of entity loader method by the same name.
|
|
20
|
-
* @throws
|
|
20
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
21
21
|
*/
|
|
22
22
|
loadManyByFieldEqualingAsync<N extends keyof Pick<TFields, TSelectedFields>>(fieldName: N, fieldValue: NonNullable<TFields[N]>): Promise<readonly TEntity[]>;
|
|
23
23
|
/**
|
|
24
24
|
* Enforcing version of entity loader method by the same name.
|
|
25
|
-
* @throws
|
|
25
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
26
26
|
* @throws when multiple entities are found matching the condition
|
|
27
27
|
*/
|
|
28
28
|
loadByFieldEqualingAsync<N extends keyof Pick<TFields, TSelectedFields>>(uniqueFieldName: N, fieldValue: NonNullable<TFields[N]>): Promise<TEntity | null>;
|
|
29
29
|
/**
|
|
30
30
|
* Enforcing version of entity loader method by the same name.
|
|
31
|
-
* @throws
|
|
31
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
32
32
|
*/
|
|
33
33
|
loadByIDAsync(id: TID): Promise<TEntity>;
|
|
34
34
|
/**
|
|
35
35
|
* Enforcing version of entity loader method by the same name.
|
|
36
|
-
* @throws
|
|
36
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
37
37
|
* @throws when multiple entities are found matching the condition
|
|
38
38
|
*/
|
|
39
39
|
loadByIDNullableAsync(id: TID): Promise<TEntity | null>;
|
|
40
40
|
/**
|
|
41
41
|
* Enforcing version of entity loader method by the same name.
|
|
42
|
-
* @throws
|
|
42
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
43
43
|
*/
|
|
44
44
|
loadManyByIDsAsync(ids: readonly TID[]): Promise<ReadonlyMap<TID, TEntity>>;
|
|
45
45
|
/**
|
|
46
46
|
* Enforcing version of entity loader method by the same name.
|
|
47
|
-
* @throws
|
|
47
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
48
48
|
*/
|
|
49
49
|
loadManyByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(fieldEqualityOperands: FieldEqualityCondition<TFields, N>[], querySelectionModifiers?: QuerySelectionModifiers<TFields>): Promise<readonly TEntity[]>;
|
|
50
50
|
/**
|
|
51
51
|
* Enforcing version of entity loader method by the same name.
|
|
52
|
-
* @throws
|
|
52
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
53
53
|
*/
|
|
54
|
-
loadManyByRawWhereClauseAsync(rawWhereClause: string, bindings: any[] | object, querySelectionModifiers?:
|
|
54
|
+
loadManyByRawWhereClauseAsync(rawWhereClause: string, bindings: any[] | object, querySelectionModifiers?: QuerySelectionModifiersWithOrderByRaw<TFields>): Promise<readonly TEntity[]>;
|
|
55
55
|
}
|
|
@@ -11,7 +11,7 @@ class EnforcingEntityLoader {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Enforcing version of entity loader method by the same name.
|
|
14
|
-
* @throws
|
|
14
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
15
15
|
*/
|
|
16
16
|
async loadManyByFieldEqualingManyAsync(fieldName, fieldValues) {
|
|
17
17
|
const fieldValuesToResults = await this.entityLoader.loadManyByFieldEqualingManyAsync(fieldName, fieldValues);
|
|
@@ -19,7 +19,7 @@ class EnforcingEntityLoader {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Enforcing version of entity loader method by the same name.
|
|
22
|
-
* @throws
|
|
22
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
23
23
|
*/
|
|
24
24
|
async loadManyByFieldEqualingAsync(fieldName, fieldValue) {
|
|
25
25
|
const entityResults = await this.entityLoader.loadManyByFieldEqualingAsync(fieldName, fieldValue);
|
|
@@ -27,7 +27,7 @@ class EnforcingEntityLoader {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Enforcing version of entity loader method by the same name.
|
|
30
|
-
* @throws
|
|
30
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
31
31
|
* @throws when multiple entities are found matching the condition
|
|
32
32
|
*/
|
|
33
33
|
async loadByFieldEqualingAsync(uniqueFieldName, fieldValue) {
|
|
@@ -36,7 +36,7 @@ class EnforcingEntityLoader {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Enforcing version of entity loader method by the same name.
|
|
39
|
-
* @throws
|
|
39
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
40
40
|
*/
|
|
41
41
|
async loadByIDAsync(id) {
|
|
42
42
|
const entityResult = await this.entityLoader.loadByIDAsync(id);
|
|
@@ -44,7 +44,7 @@ class EnforcingEntityLoader {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Enforcing version of entity loader method by the same name.
|
|
47
|
-
* @throws
|
|
47
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity
|
|
48
48
|
* @throws when multiple entities are found matching the condition
|
|
49
49
|
*/
|
|
50
50
|
async loadByIDNullableAsync(id) {
|
|
@@ -53,7 +53,7 @@ class EnforcingEntityLoader {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Enforcing version of entity loader method by the same name.
|
|
56
|
-
* @throws
|
|
56
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
57
57
|
*/
|
|
58
58
|
async loadManyByIDsAsync(ids) {
|
|
59
59
|
const entityResults = await this.entityLoader.loadManyByIDsAsync(ids);
|
|
@@ -61,7 +61,7 @@ class EnforcingEntityLoader {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Enforcing version of entity loader method by the same name.
|
|
64
|
-
* @throws
|
|
64
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
65
65
|
*/
|
|
66
66
|
async loadManyByFieldEqualityConjunctionAsync(fieldEqualityOperands, querySelectionModifiers = {}) {
|
|
67
67
|
const entityResults = await this.entityLoader.loadManyByFieldEqualityConjunctionAsync(fieldEqualityOperands, querySelectionModifiers);
|
|
@@ -69,7 +69,7 @@ class EnforcingEntityLoader {
|
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Enforcing version of entity loader method by the same name.
|
|
72
|
-
* @throws
|
|
72
|
+
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
73
73
|
*/
|
|
74
74
|
async loadManyByRawWhereClauseAsync(rawWhereClause, bindings, querySelectionModifiers = {}) {
|
|
75
75
|
const entityResults = await this.entityLoader.loadManyByRawWhereClauseAsync(rawWhereClause, bindings, querySelectionModifiers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnforcingEntityLoader.js","sourceRoot":"","sources":["../src/EnforcingEntityLoader.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"EnforcingEntityLoader.js","sourceRoot":"","sources":["../src/EnforcingEntityLoader.ts"],"names":[],"mappings":";;AASA,mDAAkD;AAElD;;;GAGG;AACH,MAAqB,qBAAqB;IAcxC,YACmB,YAOhB;QAPgB,iBAAY,GAAZ,YAAY,CAO5B;IACA,CAAC;IAEJ;;;OAGG;IACH,KAAK,CAAC,gCAAgC,CACpC,SAAY,EACZ,WAA+C;QAE/C,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,gCAAgC,CACnF,SAAS,EACT,WAAW,CACZ,CAAC;QACF,OAAO,IAAA,aAAM,EAAC,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE,CAC9C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAC/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C,CAAC;IAClE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,uCAAuC,CAC3C,qBAA2D,EAC3D,0BAA4D,EAAE;QAE9D,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,uCAAuC,CACnF,qBAAqB,EACrB,uBAAuB,CACxB,CAAC;QACF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,6BAA6B,CACjC,cAAsB,EACtB,QAAwB,EACxB,0BAA0E,EAAE;QAE5E,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,6BAA6B,CACzE,cAAc,EACd,QAAQ,EACR,uBAAuB,CACxB,CAAC;QACF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF;AApID,wCAoIC"}
|
package/build/Entity.d.ts
CHANGED
|
@@ -9,19 +9,19 @@ import ViewerContext from './ViewerContext';
|
|
|
9
9
|
* Entity is a privacy-first data model.
|
|
10
10
|
*
|
|
11
11
|
* A instance of an entity represents a single "row" of persisted data in a database that a
|
|
12
|
-
* viewer, represented by the corresponding
|
|
12
|
+
* viewer, represented by the corresponding ViewerContext, has permission to read.
|
|
13
13
|
*
|
|
14
14
|
* Create, read, update, and delete permissions for an entity are declaratively defined using an
|
|
15
|
-
*
|
|
15
|
+
* EntityPrivacyPolicy.
|
|
16
16
|
*
|
|
17
|
-
* Entites are loaded through an
|
|
17
|
+
* Entites are loaded through an EntityLoader, which is responsible for
|
|
18
18
|
* orchestrating fetching, caching, and authorization of reading "rows".
|
|
19
19
|
*
|
|
20
|
-
* Entities are mutated and deleted through an
|
|
20
|
+
* Entities are mutated and deleted through an EntityMutator, which is responsible for
|
|
21
21
|
* orchestrating database writes, cache invalidation, and authorization of writing "rows".
|
|
22
22
|
*
|
|
23
23
|
* All concrete entity implementations should extend this class and provide their
|
|
24
|
-
* own
|
|
24
|
+
* own EntityCompanionDefinition.
|
|
25
25
|
*/
|
|
26
26
|
export default abstract class Entity<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TSelectedFields extends keyof TFields = keyof TFields> extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields> {
|
|
27
27
|
/**
|
package/build/Entity.js
CHANGED
|
@@ -9,19 +9,19 @@ const ReadonlyEntity_1 = __importDefault(require("./ReadonlyEntity"));
|
|
|
9
9
|
* Entity is a privacy-first data model.
|
|
10
10
|
*
|
|
11
11
|
* A instance of an entity represents a single "row" of persisted data in a database that a
|
|
12
|
-
* viewer, represented by the corresponding
|
|
12
|
+
* viewer, represented by the corresponding ViewerContext, has permission to read.
|
|
13
13
|
*
|
|
14
14
|
* Create, read, update, and delete permissions for an entity are declaratively defined using an
|
|
15
|
-
*
|
|
15
|
+
* EntityPrivacyPolicy.
|
|
16
16
|
*
|
|
17
|
-
* Entites are loaded through an
|
|
17
|
+
* Entites are loaded through an EntityLoader, which is responsible for
|
|
18
18
|
* orchestrating fetching, caching, and authorization of reading "rows".
|
|
19
19
|
*
|
|
20
|
-
* Entities are mutated and deleted through an
|
|
20
|
+
* Entities are mutated and deleted through an EntityMutator, which is responsible for
|
|
21
21
|
* orchestrating database writes, cache invalidation, and authorization of writing "rows".
|
|
22
22
|
*
|
|
23
23
|
* All concrete entity implementations should extend this class and provide their
|
|
24
|
-
* own
|
|
24
|
+
* own EntityCompanionDefinition.
|
|
25
25
|
*/
|
|
26
26
|
class Entity extends ReadonlyEntity_1.default {
|
|
27
27
|
/**
|
|
@@ -49,7 +49,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
|
|
|
49
49
|
*/
|
|
50
50
|
loadManyAssociatedEntitiesByFieldEqualingAsync<TAssociatedFields, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: keyof Pick<TFields, TSelectedFields>, associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, associatedEntityLookupByField: keyof Pick<TAssociatedFields, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<readonly Result<TAssociatedEntity>[]>;
|
|
51
51
|
/**
|
|
52
|
-
* Load an associated entity by folding a sequence of
|
|
52
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
53
53
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
54
54
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
55
55
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -58,7 +58,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
|
|
|
58
58
|
EntityLoadThroughDirective<TViewerContext, TFields, TFields2, TID2, TEntity2, TPrivacyPolicy2, TSelectedFields, TSelectedFields2>
|
|
59
59
|
], queryContext?: EntityQueryContext): Promise<Result<TEntity2> | null>;
|
|
60
60
|
/**
|
|
61
|
-
* Load an associated entity by folding a sequence of
|
|
61
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
62
62
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
63
63
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
64
64
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -68,7 +68,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
|
|
|
68
68
|
EntityLoadThroughDirective<TViewerContext, TFields2, TFields3, TID3, TEntity3, TPrivacyPolicy3, TSelectedFields2, TSelectedFields3>
|
|
69
69
|
], queryContext?: EntityQueryContext): Promise<Result<TEntity3> | null>;
|
|
70
70
|
/**
|
|
71
|
-
* Load an associated entity by folding a sequence of
|
|
71
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
72
72
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
73
73
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
74
74
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -79,7 +79,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
|
|
|
79
79
|
EntityLoadThroughDirective<TViewerContext, TFields3, TFields4, TID4, TEntity4, TPrivacyPolicy4, TSelectedFields3, TSelectedFields4>
|
|
80
80
|
], queryContext?: EntityQueryContext): Promise<Result<TEntity4> | null>;
|
|
81
81
|
/**
|
|
82
|
-
* Load an associated entity by folding a sequence of
|
|
82
|
+
* Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
|
|
83
83
|
* fold step, load an associated entity identified by a field value of the current fold value.
|
|
84
84
|
* @param loadDirectives - associated entity load directives instructing each step of the fold
|
|
85
85
|
* @param queryContext - query context in which to perform the loads
|
|
@@ -23,7 +23,7 @@ export default abstract class EntityCacheAdapter<TFields> {
|
|
|
23
23
|
/**
|
|
24
24
|
* Negatively cache objects that could not be found in the cache or DB.
|
|
25
25
|
* @param fieldName - object field being queried
|
|
26
|
-
* @param fieldValues - fieldValues for objects reported as
|
|
26
|
+
* @param fieldValues - fieldValues for objects reported as CacheStatus.NEGATIVE
|
|
27
27
|
* in the cache and not found in the DB.
|
|
28
28
|
*/
|
|
29
29
|
abstract cacheDBMissesAsync<N extends keyof TFields>(fieldName: N, fieldValues: readonly NonNullable<TFields[N]>[]): Promise<void>;
|
|
@@ -28,7 +28,7 @@ export default class EntityCompanion<TFields, TID extends NonNullable<TFields[TS
|
|
|
28
28
|
*/
|
|
29
29
|
getQueryContextProvider(): EntityQueryContextProvider;
|
|
30
30
|
/**
|
|
31
|
-
* Get the
|
|
31
|
+
* Get the IEntityMetricsAdapter for this companion.
|
|
32
32
|
*/
|
|
33
33
|
getMetricsAdapter(): IEntityMetricsAdapter;
|
|
34
34
|
}
|
package/build/EntityCompanion.js
CHANGED
|
@@ -29,7 +29,7 @@ class EntityCompanion {
|
|
|
29
29
|
return this.tableDataCoordinator.getQueryContextProvider();
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Get the
|
|
32
|
+
* Get the IEntityMetricsAdapter for this companion.
|
|
33
33
|
*/
|
|
34
34
|
getMetricsAdapter() {
|
|
35
35
|
return this.metricsAdapter;
|
|
@@ -53,24 +53,24 @@ export declare class EntityCompanionDefinition<TFields, TID extends NonNullable<
|
|
|
53
53
|
*/
|
|
54
54
|
entityClass: IEntityClass<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
|
|
55
55
|
/**
|
|
56
|
-
* The
|
|
56
|
+
* The EntityConfiguration for this entity.
|
|
57
57
|
*/
|
|
58
58
|
entityConfiguration: EntityConfiguration<TFields>;
|
|
59
59
|
/**
|
|
60
|
-
* The
|
|
60
|
+
* The EntityPrivacyPolicy class for this entity.
|
|
61
61
|
*/
|
|
62
62
|
privacyPolicyClass: IPrivacyPolicyClass<TPrivacyPolicy>;
|
|
63
63
|
/**
|
|
64
|
-
* An optional list of
|
|
64
|
+
* An optional list of EntityMutationValidator for this entity.
|
|
65
65
|
*/
|
|
66
66
|
mutationValidators?: () => EntityMutationValidator<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
|
|
67
67
|
/**
|
|
68
|
-
* An optional list of
|
|
68
|
+
* An optional list of EntityMutationTrigger for this entity.
|
|
69
69
|
*/
|
|
70
70
|
mutationTriggers?: () => EntityMutationTriggerConfiguration<TFields, TID, TViewerContext, TEntity, TSelectedFields>;
|
|
71
71
|
/**
|
|
72
|
-
* An optional subset of fields defined in the
|
|
73
|
-
* For use when multiple types of entities are backed by a single table (
|
|
72
|
+
* An optional subset of fields defined in the EntityConfiguration which belong to this entity.
|
|
73
|
+
* For use when multiple types of entities are backed by a single table (EntityConfiguration) yet
|
|
74
74
|
* only expose a subset of the fields.
|
|
75
75
|
*/
|
|
76
76
|
entitySelectedFields?: TSelectedFields[];
|
|
@@ -79,11 +79,11 @@ export declare class EntityCompanionDefinition<TFields, TID extends NonNullable<
|
|
|
79
79
|
/**
|
|
80
80
|
* An instance of the Entity framework.
|
|
81
81
|
*
|
|
82
|
-
* Required to create a
|
|
82
|
+
* Required to create a ViewerContext, which is the application entry point
|
|
83
83
|
* into the framework.
|
|
84
84
|
*
|
|
85
85
|
* Internally, this is a lazy entity companion factory that instantiates and caches one
|
|
86
|
-
*
|
|
86
|
+
* EntityCompanion for each type of Entity.
|
|
87
87
|
*/
|
|
88
88
|
export default class EntityCompanionProvider {
|
|
89
89
|
readonly metricsAdapter: IEntityMetricsAdapter;
|
|
@@ -93,7 +93,7 @@ export default class EntityCompanionProvider {
|
|
|
93
93
|
private readonly tableDataCoordinatorMap;
|
|
94
94
|
/**
|
|
95
95
|
* Instantiate an Entity framework.
|
|
96
|
-
* @param metricsAdapter - An
|
|
96
|
+
* @param metricsAdapter - An IEntityMetricsAdapter for collecting metrics on this instance
|
|
97
97
|
* @param databaseAdapterFlavors - Database adapter configurations for this instance
|
|
98
98
|
* @param cacheAdapterFlavors - Cache adapter configurations for this instance
|
|
99
99
|
*/
|
|
@@ -26,16 +26,16 @@ exports.EntityCompanionDefinition = EntityCompanionDefinition;
|
|
|
26
26
|
/**
|
|
27
27
|
* An instance of the Entity framework.
|
|
28
28
|
*
|
|
29
|
-
* Required to create a
|
|
29
|
+
* Required to create a ViewerContext, which is the application entry point
|
|
30
30
|
* into the framework.
|
|
31
31
|
*
|
|
32
32
|
* Internally, this is a lazy entity companion factory that instantiates and caches one
|
|
33
|
-
*
|
|
33
|
+
* EntityCompanion for each type of Entity.
|
|
34
34
|
*/
|
|
35
35
|
class EntityCompanionProvider {
|
|
36
36
|
/**
|
|
37
37
|
* Instantiate an Entity framework.
|
|
38
|
-
* @param metricsAdapter - An
|
|
38
|
+
* @param metricsAdapter - An IEntityMetricsAdapter for collecting metrics on this instance
|
|
39
39
|
* @param databaseAdapterFlavors - Database adapter configurations for this instance
|
|
40
40
|
* @param cacheAdapterFlavors - Cache adapter configurations for this instance
|
|
41
41
|
*/
|
|
@@ -26,11 +26,11 @@ export default class EntityConfiguration<TFields> {
|
|
|
26
26
|
*/
|
|
27
27
|
tableName: string;
|
|
28
28
|
/**
|
|
29
|
-
* Map from each entity field to an
|
|
29
|
+
* Map from each entity field to an EntityFieldDefinition specifying information about the field.
|
|
30
30
|
*/
|
|
31
31
|
schema: Record<keyof TFields, EntityFieldDefinition<any>>;
|
|
32
32
|
/**
|
|
33
|
-
* List of other entity types that reference this type in
|
|
33
|
+
* List of other entity types that reference this type in EntityFieldDefinition associations.
|
|
34
34
|
*/
|
|
35
35
|
getInboundEdges?: () => IEntityClass<any, any, any, any, any, any>[];
|
|
36
36
|
/**
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import EntityConfiguration from './EntityConfiguration';
|
|
2
2
|
import { EntityQueryContext } from './EntityQueryContext';
|
|
3
3
|
import { FieldTransformerMap } from './internal/EntityFieldTransformationUtils';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Equality operand that is used for selecting entities with a field with a single value.
|
|
6
|
+
*/
|
|
7
|
+
export interface SingleValueFieldEqualityCondition<TFields, N extends keyof TFields = keyof TFields> {
|
|
5
8
|
fieldName: N;
|
|
6
9
|
fieldValue: TFields[N];
|
|
7
10
|
}
|
|
8
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Equality operand that is used for selecting entities with a field matching one of multiple values.
|
|
13
|
+
*/
|
|
14
|
+
export interface MultiValueFieldEqualityCondition<TFields, N extends keyof TFields = keyof TFields> {
|
|
9
15
|
fieldName: N;
|
|
10
16
|
fieldValues: readonly TFields[N][];
|
|
11
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A single equality operand for use in a selection clause.
|
|
20
|
+
* See EntityLoader.loadManyByFieldEqualityConjunctionAsync documentation for examples.
|
|
21
|
+
*/
|
|
12
22
|
export declare type FieldEqualityCondition<TFields, N extends keyof TFields = keyof TFields> = SingleValueFieldEqualityCondition<TFields, N> | MultiValueFieldEqualityCondition<TFields, N>;
|
|
13
23
|
export declare function isSingleValueFieldEqualityCondition<TFields, N extends keyof TFields = keyof TFields>(condition: FieldEqualityCondition<TFields, N>): condition is SingleValueFieldEqualityCondition<TFields, N>;
|
|
14
24
|
export interface TableFieldSingleValueEqualityCondition {
|
|
@@ -43,6 +53,12 @@ export interface QuerySelectionModifiers<TFields> {
|
|
|
43
53
|
*/
|
|
44
54
|
limit?: number;
|
|
45
55
|
}
|
|
56
|
+
export interface QuerySelectionModifiersWithOrderByRaw<TFields> extends QuerySelectionModifiers<TFields> {
|
|
57
|
+
/**
|
|
58
|
+
* Order the entities by a raw SQL `ORDER BY` clause.
|
|
59
|
+
*/
|
|
60
|
+
orderByRaw?: string;
|
|
61
|
+
}
|
|
46
62
|
export interface TableQuerySelectionModifiers {
|
|
47
63
|
orderBy: {
|
|
48
64
|
columnName: string;
|
|
@@ -51,6 +67,9 @@ export interface TableQuerySelectionModifiers {
|
|
|
51
67
|
offset: number | undefined;
|
|
52
68
|
limit: number | undefined;
|
|
53
69
|
}
|
|
70
|
+
export interface TableQuerySelectionModifiersWithOrderByRaw extends TableQuerySelectionModifiers {
|
|
71
|
+
orderByRaw: string | undefined;
|
|
72
|
+
}
|
|
54
73
|
/**
|
|
55
74
|
* A database adapter is an interface by which entity objects can be
|
|
56
75
|
* fetched, inserted, updated, and deleted from a database. This base class
|
|
@@ -83,7 +102,7 @@ export default abstract class EntityDatabaseAdapter<TFields> {
|
|
|
83
102
|
*
|
|
84
103
|
* @param queryContext - query context with which to perform the fetch
|
|
85
104
|
* @param fieldEqualityOperands - list of field equality where clause operand specifications
|
|
86
|
-
* @param querySelectionModifiers - limit, offset, and
|
|
105
|
+
* @param querySelectionModifiers - limit, offset, orderBy, and orderByRaw for the query
|
|
87
106
|
* @returns array of objects matching the query
|
|
88
107
|
*/
|
|
89
108
|
fetchManyByFieldEqualityConjunctionAsync<N extends keyof TFields>(queryContext: EntityQueryContext, fieldEqualityOperands: FieldEqualityCondition<TFields, N>[], querySelectionModifiers: QuerySelectionModifiers<TFields>): Promise<readonly Readonly<TFields>[]>;
|
|
@@ -97,8 +116,8 @@ export default abstract class EntityDatabaseAdapter<TFields> {
|
|
|
97
116
|
* @param querySelectionModifiers - limit, offset, and orderBy for the query
|
|
98
117
|
* @returns array of objects matching the query
|
|
99
118
|
*/
|
|
100
|
-
fetchManyByRawWhereClauseAsync(queryContext: EntityQueryContext, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers:
|
|
101
|
-
protected abstract fetchManyByRawWhereClauseInternalAsync(queryInterface: any, tableName: string, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers:
|
|
119
|
+
fetchManyByRawWhereClauseAsync(queryContext: EntityQueryContext, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers: QuerySelectionModifiersWithOrderByRaw<TFields>): Promise<readonly Readonly<TFields>[]>;
|
|
120
|
+
protected abstract fetchManyByRawWhereClauseInternalAsync(queryInterface: any, tableName: string, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers: TableQuerySelectionModifiersWithOrderByRaw): Promise<object[]>;
|
|
102
121
|
/**
|
|
103
122
|
* Insert an object.
|
|
104
123
|
*
|
|
@@ -128,6 +147,6 @@ export default abstract class EntityDatabaseAdapter<TFields> {
|
|
|
128
147
|
*/
|
|
129
148
|
deleteAsync<K extends keyof TFields>(queryContext: EntityQueryContext, idField: K, id: any): Promise<void>;
|
|
130
149
|
protected abstract deleteInternalAsync(queryInterface: any, tableName: string, tableIdField: string, id: any): Promise<number>;
|
|
150
|
+
private convertToTableQueryModifiersWithOrderByRaw;
|
|
131
151
|
private convertToTableQueryModifiers;
|
|
132
152
|
}
|
|
133
|
-
export {};
|
|
@@ -50,7 +50,7 @@ class EntityDatabaseAdapter {
|
|
|
50
50
|
*
|
|
51
51
|
* @param queryContext - query context with which to perform the fetch
|
|
52
52
|
* @param fieldEqualityOperands - list of field equality where clause operand specifications
|
|
53
|
-
* @param querySelectionModifiers - limit, offset, and
|
|
53
|
+
* @param querySelectionModifiers - limit, offset, orderBy, and orderByRaw for the query
|
|
54
54
|
* @returns array of objects matching the query
|
|
55
55
|
*/
|
|
56
56
|
async fetchManyByFieldEqualityConjunctionAsync(queryContext, fieldEqualityOperands, querySelectionModifiers) {
|
|
@@ -83,7 +83,7 @@ class EntityDatabaseAdapter {
|
|
|
83
83
|
* @returns array of objects matching the query
|
|
84
84
|
*/
|
|
85
85
|
async fetchManyByRawWhereClauseAsync(queryContext, rawWhereClause, bindings, querySelectionModifiers) {
|
|
86
|
-
const results = await this.fetchManyByRawWhereClauseInternalAsync(queryContext.getQueryInterface(), this.entityConfiguration.tableName, rawWhereClause, bindings, this.
|
|
86
|
+
const results = await this.fetchManyByRawWhereClauseInternalAsync(queryContext.getQueryInterface(), this.entityConfiguration.tableName, rawWhereClause, bindings, this.convertToTableQueryModifiersWithOrderByRaw(querySelectionModifiers));
|
|
87
87
|
return results.map((result) => (0, EntityFieldTransformationUtils_1.transformDatabaseObjectToFields)(this.entityConfiguration, this.fieldTransformerMap, result));
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -139,6 +139,12 @@ class EntityDatabaseAdapter {
|
|
|
139
139
|
throw new Error(`Excessive deletions from database adapter delete: ${this.entityConfiguration.tableName}(id = ${id})`);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
+
convertToTableQueryModifiersWithOrderByRaw(querySelectionModifiers) {
|
|
143
|
+
return {
|
|
144
|
+
...this.convertToTableQueryModifiers(querySelectionModifiers),
|
|
145
|
+
orderByRaw: querySelectionModifiers.orderByRaw,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
142
148
|
convertToTableQueryModifiers(querySelectionModifiers) {
|
|
143
149
|
const orderBy = querySelectionModifiers.orderBy;
|
|
144
150
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDatabaseAdapter.js","sourceRoot":"","sources":["../src/EntityDatabaseAdapter.ts"],"names":[],"mappings":";;;AAEA,8FAKmD;
|
|
1
|
+
{"version":3,"file":"EntityDatabaseAdapter.js","sourceRoot":"","sources":["../src/EntityDatabaseAdapter.ts"],"names":[],"mappings":";;;AAEA,8FAKmD;AAgCnD,SAAgB,mCAAmC,CAIjD,SAA6C;IAE7C,OAAQ,SAA2D,CAAC,UAAU,KAAK,SAAS,CAAC;AAC/F,CAAC;AAPD,kFAOC;AAYD,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;AACrB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAgDD;;;;;GAKG;AACH,MAA8B,qBAAqB;IAGjD,YAA6B,mBAAiD;QAAjD,wBAAmB,GAAnB,mBAAmB,CAA8B;QAC5E,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC3D,CAAC;IASD;;;;;;;OAOG;IACH,KAAK,CAAC,mBAAmB,CACvB,YAAgC,EAChC,KAAQ,EACR,WAA+C;QAE/C,MAAM,WAAW,GAAG,IAAA,+DAA8B,EAAC,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QACpF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,2BAA2B,CACpD,YAAY,CAAC,iBAAiB,EAAE,EAChC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAClC,WAAW,EACX,WAAW,CACZ,CAAC;QACF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACrC,IAAA,gEAA+B,EAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,MA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AAG,IAAA,+DAA8B,EAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAC/C,YAAY,CAAC,iBAAiB,EAAE,EAChC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAClC,QAAQ,EACR,EAAE,CACH,CAAC;QAEF,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,MAAM,IAAI,KAAK,CACb,qDAAqD,IAAI,CAAC,mBAAmB,CAAC,SAAS,SAAS,EAAE,GAAG,CACtG,CAAC;SACH;IACH,CAAC;IASO,0CAA0C,CAChD,uBAAuE;QAEvE,OAAO;YACL,GAAG,IAAI,CAAC,4BAA4B,CAAC,uBAAuB,CAAC;YAC7D,UAAU,EAAE,uBAAuB,CAAC,UAAU;SAC/C,CAAC;IACJ,CAAC;IAEO,4BAA4B,CAClC,uBAAyD;QAEzD,MAAM,OAAO,GAAG,uBAAuB,CAAC,OAAO,CAAC;QAChD,OAAO;YACL,OAAO,EACL,OAAO,KAAK,SAAS;gBACnB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;oBACrC,UAAU,EAAE,IAAA,+DAA8B,EACxC,IAAI,CAAC,mBAAmB,EACxB,oBAAoB,CAAC,SAAS,CAC/B;oBACD,KAAK,EAAE,oBAAoB,CAAC,KAAK;iBAClC,CAAC,CAAC;gBACL,CAAC,CAAC,SAAS;YACf,MAAM,EAAE,uBAAuB,CAAC,MAAM;YACtC,KAAK,EAAE,uBAAuB,CAAC,KAAK;SACrC,CAAC;IACJ,CAAC;CACF;AAlTD,wCAkTC"}
|
|
@@ -55,8 +55,8 @@ export interface EntityAssociationDefinition<TViewerContext extends ViewerContex
|
|
|
55
55
|
* application requirements, and sometimes even a mix-and-match is the right choice.
|
|
56
56
|
*
|
|
57
57
|
* - If referential integrity is critical to your application, database foreign key constraints
|
|
58
|
-
* combined with
|
|
59
|
-
*
|
|
58
|
+
* combined with EntityEdgeDeletionBehavior.CASCADE_DELETE_INVALIDATE_CACHE_ONLY or
|
|
59
|
+
* EntityEdgeDeletionBehavior.SET_NULL_INVALIDATE_CACHE_ONLY are recommended.
|
|
60
60
|
* - If the database being used doesn't support foreign keys, then using the entity framework for referential
|
|
61
61
|
* integrity is recommended.
|
|
62
62
|
*/
|