@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.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/build/ComposedEntityCacheAdapter.d.ts +1 -1
  3. package/build/ComposedEntityCacheAdapter.js +1 -1
  4. package/build/ComposedSecondaryEntityCache.d.ts +1 -1
  5. package/build/ComposedSecondaryEntityCache.js +1 -1
  6. package/build/EnforcingEntityLoader.d.ts +10 -10
  7. package/build/EnforcingEntityLoader.js +8 -8
  8. package/build/EnforcingEntityLoader.js.map +1 -1
  9. package/build/Entity.d.ts +5 -5
  10. package/build/Entity.js +5 -5
  11. package/build/EntityAssociationLoader.d.ts +4 -4
  12. package/build/EntityCacheAdapter.d.ts +1 -1
  13. package/build/EntityCompanion.d.ts +1 -1
  14. package/build/EntityCompanion.js +1 -1
  15. package/build/EntityCompanionProvider.d.ts +9 -9
  16. package/build/EntityCompanionProvider.js +3 -3
  17. package/build/EntityConfiguration.d.ts +2 -2
  18. package/build/EntityDatabaseAdapter.d.ts +25 -6
  19. package/build/EntityDatabaseAdapter.js +8 -2
  20. package/build/EntityDatabaseAdapter.js.map +1 -1
  21. package/build/EntityFieldDefinition.d.ts +2 -2
  22. package/build/EntityFields.d.ts +9 -22
  23. package/build/EntityFields.js +10 -29
  24. package/build/EntityFields.js.map +1 -1
  25. package/build/EntityLoader.d.ts +10 -10
  26. package/build/EntityLoader.js +8 -8
  27. package/build/EntityLoader.js.map +1 -1
  28. package/build/EntityMutationTriggerConfiguration.d.ts +1 -1
  29. package/build/EntityMutationTriggerConfiguration.js +1 -1
  30. package/build/EntityMutator.d.ts +1 -1
  31. package/build/EntityMutator.js +1 -1
  32. package/build/EntityPrivacyPolicy.d.ts +6 -6
  33. package/build/EntityPrivacyPolicy.js +6 -6
  34. package/build/EntityQueryContext.d.ts +23 -3
  35. package/build/EntityQueryContext.js +43 -6
  36. package/build/EntityQueryContext.js.map +1 -1
  37. package/build/EntityQueryContextProvider.d.ts +10 -2
  38. package/build/EntityQueryContextProvider.js +18 -1
  39. package/build/EntityQueryContextProvider.js.map +1 -1
  40. package/build/EntitySecondaryCacheLoader.d.ts +1 -1
  41. package/build/EntitySecondaryCacheLoader.js +1 -1
  42. package/build/GenericSecondaryEntityCache.d.ts +1 -1
  43. package/build/GenericSecondaryEntityCache.js +1 -1
  44. package/build/ReadonlyEntity.d.ts +1 -1
  45. package/build/ReadonlyEntity.js +1 -1
  46. package/build/ViewerContext.d.ts +2 -2
  47. package/build/ViewerContext.js +2 -2
  48. package/build/ViewerScopedEntityCompanion.d.ts +2 -2
  49. package/build/ViewerScopedEntityCompanion.js +2 -2
  50. package/build/ViewerScopedEntityLoaderFactory.d.ts +1 -1
  51. package/build/ViewerScopedEntityLoaderFactory.js +1 -1
  52. package/build/ViewerScopedEntityMutatorFactory.d.ts +1 -1
  53. package/build/ViewerScopedEntityMutatorFactory.js +1 -1
  54. package/build/__tests__/EntityFields-test.js +0 -4
  55. package/build/__tests__/EntityFields-test.js.map +1 -1
  56. package/build/__tests__/EntityQueryContext-test.js +39 -0
  57. package/build/__tests__/EntityQueryContext-test.js.map +1 -1
  58. package/build/internal/EntityDataManager.d.ts +5 -5
  59. package/build/internal/EntityDataManager.js +3 -3
  60. package/build/internal/EntityDataManager.js.map +1 -1
  61. package/build/internal/ReadThroughEntityCache.d.ts +2 -2
  62. package/build/internal/ReadThroughEntityCache.js +2 -2
  63. package/build/metrics/IEntityMetricsAdapter.d.ts +10 -10
  64. package/build/rules/PrivacyPolicyRule.d.ts +1 -1
  65. package/build/rules/PrivacyPolicyRule.js +1 -1
  66. package/build/utils/collections/maps.d.ts +1 -1
  67. package/build/utils/collections/maps.js +1 -1
  68. package/build/utils/testing/PrivacyPolicyRuleTestUtils.d.ts +1 -2
  69. package/build/utils/testing/StubQueryContextProvider.d.ts +2 -1
  70. package/build/utils/testing/StubQueryContextProvider.js +5 -0
  71. package/build/utils/testing/StubQueryContextProvider.js.map +1 -1
  72. package/package.json +3 -2
  73. package/src/ComposedEntityCacheAdapter.ts +1 -1
  74. package/src/ComposedSecondaryEntityCache.ts +1 -1
  75. package/src/EnforcingEntityLoader.ts +14 -10
  76. package/src/Entity.ts +5 -5
  77. package/src/EntityAssociationLoader.ts +4 -4
  78. package/src/EntityCacheAdapter.ts +1 -1
  79. package/src/EntityCompanion.ts +1 -1
  80. package/src/EntityCompanionProvider.ts +9 -9
  81. package/src/EntityConfiguration.ts +2 -2
  82. package/src/EntityDatabaseAdapter.ts +43 -6
  83. package/src/EntityFieldDefinition.ts +2 -2
  84. package/src/EntityFields.ts +9 -28
  85. package/src/EntityLoader.ts +10 -9
  86. package/src/EntityMutationTriggerConfiguration.ts +1 -1
  87. package/src/EntityMutator.ts +1 -1
  88. package/src/EntityPrivacyPolicy.ts +6 -6
  89. package/src/EntityQueryContext.ts +63 -3
  90. package/src/EntityQueryContextProvider.ts +34 -2
  91. package/src/EntitySecondaryCacheLoader.ts +1 -1
  92. package/src/GenericSecondaryEntityCache.ts +1 -1
  93. package/src/ReadonlyEntity.ts +1 -1
  94. package/src/ViewerContext.ts +2 -2
  95. package/src/ViewerScopedEntityCompanion.ts +2 -2
  96. package/src/ViewerScopedEntityLoaderFactory.ts +1 -1
  97. package/src/ViewerScopedEntityMutatorFactory.ts +1 -1
  98. package/src/__tests__/EntityFields-test.ts +0 -12
  99. package/src/__tests__/EntityQueryContext-test.ts +50 -0
  100. package/src/internal/EntityDataManager.ts +5 -4
  101. package/src/internal/ReadThroughEntityCache.ts +2 -2
  102. package/src/metrics/IEntityMetricsAdapter.ts +10 -10
  103. package/src/rules/PrivacyPolicyRule.ts +1 -1
  104. package/src/utils/collections/maps.ts +1 -1
  105. package/src/utils/testing/PrivacyPolicyRuleTestUtils.ts +1 -1
  106. package/src/utils/testing/StubQueryContextProvider.ts +7 -1
@@ -1,72 +1,59 @@
1
1
  import { EntityFieldDefinition } from './EntityFieldDefinition';
2
2
  /**
3
- * {@link EntityFieldDefinition} for a column with a JS string type.
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
- * {@link EntityFieldDefinition} for a column with a JS string type.
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
- * {@link EntityFieldDefinition} for a column with a JS Date type.
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
- * {@link EntityFieldDefinition} for a column with a JS boolean type.
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
- * {@link EntityFieldDefinition} for a column with a JS number type.
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
- * {@link EntityFieldDefinition} for a column with a JS number type.
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
- * {@link EntityFieldDefinition} for a column with a JS string array type.
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
- * {@link EntityFieldDefinition} for a column with a JS JSON object type.
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
- * {@link EntityFieldDefinition} for a enum column with a JS string or number type.
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
- /**
61
- * {@link EntityFieldDefinition} for a column with a JS JSON array type.
62
- */
63
- export declare class JSONArrayField extends EntityFieldDefinition<any[]> {
64
- protected validateInputValueInternal(value: any[]): boolean;
65
- }
66
- /**
67
- * {@link EntityFieldDefinition} for a column that may be a JS JSON array type.
68
- * Does not do any validation.
69
- */
70
- export declare class MaybeJSONArrayField extends EntityFieldDefinition<any | any[]> {
71
- protected validateInputValueInternal(_value: any): boolean;
72
- }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MaybeJSONArrayField = exports.JSONArrayField = exports.EnumField = exports.JSONObjectField = exports.StringArrayField = exports.FloatField = exports.IntField = exports.BooleanField = exports.DateField = exports.UUIDField = exports.StringField = void 0;
3
+ exports.EnumField = exports.JSONObjectField = exports.StringArrayField = exports.FloatField = exports.IntField = exports.BooleanField = exports.DateField = exports.UUIDField = exports.StringField = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  const EntityFieldDefinition_1 = require("./EntityFieldDefinition");
6
6
  /**
7
- * {@link EntityFieldDefinition} for a column with a JS string type.
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
- * {@link EntityFieldDefinition} for a column with a JS string type.
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
- * {@link EntityFieldDefinition} for a column with a JS Date type.
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
- * {@link EntityFieldDefinition} for a column with a JS boolean type.
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
- * {@link EntityFieldDefinition} for a column with a JS number type.
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
- * {@link EntityFieldDefinition} for a column with a JS number type.
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
- * {@link EntityFieldDefinition} for a column with a JS string array type.
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
- * {@link EntityFieldDefinition} for a column with a JS JSON object type.
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
- * {@link EntityFieldDefinition} for a enum column with a JS string or number type.
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) {
@@ -88,23 +88,4 @@ class EnumField extends EntityFieldDefinition_1.EntityFieldDefinition {
88
88
  }
89
89
  }
90
90
  exports.EnumField = EnumField;
91
- /**
92
- * {@link EntityFieldDefinition} for a column with a JS JSON array type.
93
- */
94
- class JSONArrayField extends EntityFieldDefinition_1.EntityFieldDefinition {
95
- validateInputValueInternal(value) {
96
- return Array.isArray(value);
97
- }
98
- }
99
- exports.JSONArrayField = JSONArrayField;
100
- /**
101
- * {@link EntityFieldDefinition} for a column that may be a JS JSON array type.
102
- * Does not do any validation.
103
- */
104
- class MaybeJSONArrayField extends EntityFieldDefinition_1.EntityFieldDefinition {
105
- validateInputValueInternal(_value) {
106
- return true;
107
- }
108
- }
109
- exports.MaybeJSONArrayField = MaybeJSONArrayField;
110
91
  //# sourceMappingURL=EntityFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityFields.js","sourceRoot":"","sources":["../src/EntityFields.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAEhD,mEAA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AAK,KAAK,SAAS,CAAC;IACpC,CAAC;CACF;AAJD,oCAIC;AAED;;;GAGG;AACH,MAAa,QAAS,SAAQ,6CAA6B;IAC/C,0BAA0B,CAAC,KAAa;QAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;CACF;AAJD,4BAIC;AAED;;;GAGG;AACH,MAAa,UAAW,SAAQ,6CAA6B;IACjD,0BAA0B,CAAC,KAAa;QAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;IACnC,CAAC;CACF;AAJD,gCAIC;AAED;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,6CAA+B;IACzD,0BAA0B,CAAC,KAAe;QAClD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACzF,CAAC;CACF;AAJD,4CAIC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,6CAA6B;IACtD,0BAA0B,CAAC,KAAa;QAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;CACF;AAJD,0CAIC;AAED;;GAEG;AACH,MAAa,SAAU,SAAQ,6CAAsC;IACzD,0BAA0B,CAAC,KAAsB;QACzD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;IAChE,CAAC;CACF;AAJD,8BAIC"}
@@ -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 {@link EntityPrivacyPolicy}.
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;
@@ -72,16 +72,16 @@ export default class EntityLoader<TFields, TID extends NonNullable<TFields[TSele
72
72
  */
73
73
  loadManyByIDsAsync(ids: readonly TID[]): Promise<ReadonlyMap<TID, Result<TEntity>>>;
74
74
  /**
75
- * Loads many entities matching the conjunction of WHERE clauses constructed from specified operands.
75
+ * Loads many entities matching the selection constructed from the conjunction of specified operands.
76
76
  * Entities loaded using this method are not batched or cached.
77
77
  *
78
78
  * @example
79
79
  * fieldEqualityOperands:
80
80
  * `[{fieldName: 'hello', fieldValue: 1}, {fieldName: 'world', fieldValues: [2, 3]}]`
81
- * Entities returned:
81
+ * Entities returned with a SQL EntityDatabaseAdapter:
82
82
  * `WHERE hello = 1 AND world = ANY({2, 3})`
83
83
  *
84
- * @param fieldEqualityOperands - list of field equality WHERE clause operand specifications
84
+ * @param fieldEqualityOperands - list of field equality selection operand specifications
85
85
  * @param querySelectionModifiers - limit, offset, and orderBy for the query
86
86
  * @returns array of entity results that match the query, where result error can be UnauthorizedError
87
87
  */
@@ -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
- * {@link http://knexjs.org/#Builder-whereRaw}
104
- * {@link http://knexjs.org/#Raw-Bindings}
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 orderBy for the query
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?: QuerySelectionModifiers<TFields>): Promise<readonly Result<TEntity>[]>;
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 {@link EntityMutator}.
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>;
@@ -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 {@link EntityPrivacyPolicy}.
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) {
@@ -105,16 +105,16 @@ class EntityLoader {
105
105
  });
106
106
  }
107
107
  /**
108
- * Loads many entities matching the conjunction of WHERE clauses constructed from specified operands.
108
+ * Loads many entities matching the selection constructed from the conjunction of specified operands.
109
109
  * Entities loaded using this method are not batched or cached.
110
110
  *
111
111
  * @example
112
112
  * fieldEqualityOperands:
113
113
  * `[{fieldName: 'hello', fieldValue: 1}, {fieldName: 'world', fieldValues: [2, 3]}]`
114
- * Entities returned:
114
+ * Entities returned with a SQL EntityDatabaseAdapter:
115
115
  * `WHERE hello = 1 AND world = ANY({2, 3})`
116
116
  *
117
- * @param fieldEqualityOperands - list of field equality WHERE clause operand specifications
117
+ * @param fieldEqualityOperands - list of field equality selection operand specifications
118
118
  * @param querySelectionModifiers - limit, offset, and orderBy for the query
119
119
  * @returns array of entity results that match the query, where result error can be UnauthorizedError
120
120
  */
@@ -148,12 +148,12 @@ class EntityLoader {
148
148
  * bindings: `[1]`
149
149
  * Entites returned `WHERE id = 1`
150
150
  *
151
- * {@link http://knexjs.org/#Builder-whereRaw}
152
- * {@link http://knexjs.org/#Raw-Bindings}
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 orderBy for the query
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 {@link EntityMutator}.
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,mEAIiC;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,OAAO,IAAI,+BAAqB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gCAAgC,CACpC,SAAY,EACZ,WAA+C;QAE/C,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAEjD,MAAM,yBAAyB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,4BAA4B,CACnF,IAAI,CAAC,YAAY,EACjB,SAAS,EACT,WAAW,CACZ,CAAC;QAEF,OAAO,MAAM,IAAI,CAAC,kCAAkC,CAAC,yBAAyB,CAAC,CAAC;IAClF,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,4BAA4B,CAChC,SAAY,EACZ,UAAmC;QAEnC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gC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AAE;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 {@link EntityMutationTrigger} but used for afterCommit triggers
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 {@link EntityMutationTrigger} but used for afterCommit triggers
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 {
@@ -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
- * {@link OnDeleteBehavior} of the field referencing the specified entity.
101
+ * OnDeleteBehavior of the field referencing the specified entity.
102
102
  *
103
103
  * @remarks
104
104
  * This works by doing reverse fan-out queries:
@@ -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
- * {@link OnDeleteBehavior} of the field referencing the specified entity.
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 {@link EntityPrivacyPolicy}. Useful when transitioning to
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 {@link PrivacyPolicyRule} for create, read, update, and delete actions
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityPrivacyPolicy}. Useful when transitioning to
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 {@link PrivacyPolicyRule} for create, read, update, and delete actions
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityNotAuthorizedError} when not authorized
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 {@link EntityMutator} and {@link EntityLoader}
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 {@link EntityMutator} and {@link EntityLoader} methods, they will be
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,13 +29,15 @@ 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 {@link EntityMutator} and {@link EntityLoader} methods, those methods and their
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 {
36
+ private readonly entityQueryContextProvider;
36
37
  private readonly postCommitInvalidationCallbacks;
37
38
  private readonly postCommitCallbacks;
38
39
  private readonly preCommitCallbacks;
40
+ constructor(queryInterface: any, entityQueryContextProvider: EntityQueryContextProvider);
39
41
  /**
40
42
  * Schedule a pre-commit callback. These will be run within the transaction right before it is
41
43
  * committed, and will be run in the order specified. Ordering of callbacks scheduled with the
@@ -61,4 +63,22 @@ export declare class EntityTransactionalQueryContext extends EntityQueryContext
61
63
  runPostCommitCallbacksAsync(): Promise<void>;
62
64
  isInTransaction(): boolean;
63
65
  runInTransactionIfNotInTransactionAsync<T>(transactionScope: (queryContext: EntityTransactionalQueryContext) => Promise<T>): Promise<T>;
66
+ runInNestedTransactionAsync<T>(transactionScope: (innerQueryContext: EntityTransactionalQueryContext) => Promise<T>): Promise<T>;
67
+ }
68
+ /**
69
+ * Entity framework representation of a nested transactional query execution unit. When supplied
70
+ * to EntityMutator and EntityLoader methods, those methods and their
71
+ * dependent triggers and validators will run within the nested transaction.
72
+ *
73
+ * This exists to forward post-commit callbacks to the parent query context.
74
+ */
75
+ export declare class EntityNestedTransactionalQueryContext extends EntityTransactionalQueryContext {
76
+ private readonly parentQueryContext;
77
+ private readonly postCommitInvalidationCallbacksToTransfer;
78
+ private readonly postCommitCallbacksToTransfer;
79
+ constructor(queryInterface: any, parentQueryContext: EntityTransactionalQueryContext, entityQueryContextProvider: EntityQueryContextProvider);
80
+ appendPostCommitCallback(callback: PostCommitCallback): void;
81
+ appendPostCommitInvalidationCallback(callback: PostCommitCallback): void;
82
+ runPostCommitCallbacksAsync(): Promise<void>;
83
+ transferPostCommitCallbacksToParent(): void;
64
84
  }
@@ -3,13 +3,13 @@ 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.EntityTransactionalQueryContext = exports.EntityNonTransactionalQueryContext = exports.EntityQueryContext = void 0;
6
+ exports.EntityNestedTransactionalQueryContext = exports.EntityTransactionalQueryContext = exports.EntityNonTransactionalQueryContext = exports.EntityQueryContext = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
8
  /**
9
9
  * Entity framework representation of transactional and non-transactional database
10
10
  * query execution units.
11
11
  *
12
- * The behavior of {@link EntityMutator} and {@link EntityLoader}
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 {@link EntityMutator} and {@link EntityLoader} methods, they will be
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,12 +42,13 @@ 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 {@link EntityMutator} and {@link EntityLoader} methods, those methods and their
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 {
49
- constructor() {
50
- super(...arguments);
49
+ constructor(queryInterface, entityQueryContextProvider) {
50
+ super(queryInterface);
51
+ this.entityQueryContextProvider = entityQueryContextProvider;
51
52
  this.postCommitInvalidationCallbacks = [];
52
53
  this.postCommitCallbacks = [];
53
54
  this.preCommitCallbacks = [];
@@ -103,6 +104,42 @@ class EntityTransactionalQueryContext extends EntityQueryContext {
103
104
  async runInTransactionIfNotInTransactionAsync(transactionScope) {
104
105
  return await transactionScope(this);
105
106
  }
107
+ async runInNestedTransactionAsync(transactionScope) {
108
+ return await this.entityQueryContextProvider.runInNestedTransactionAsync(this, transactionScope);
109
+ }
106
110
  }
107
111
  exports.EntityTransactionalQueryContext = EntityTransactionalQueryContext;
112
+ /**
113
+ * Entity framework representation of a nested transactional query execution unit. When supplied
114
+ * to EntityMutator and EntityLoader methods, those methods and their
115
+ * dependent triggers and validators will run within the nested transaction.
116
+ *
117
+ * This exists to forward post-commit callbacks to the parent query context.
118
+ */
119
+ class EntityNestedTransactionalQueryContext extends EntityTransactionalQueryContext {
120
+ constructor(queryInterface, parentQueryContext, entityQueryContextProvider) {
121
+ super(queryInterface, entityQueryContextProvider);
122
+ this.parentQueryContext = parentQueryContext;
123
+ this.postCommitInvalidationCallbacksToTransfer = [];
124
+ this.postCommitCallbacksToTransfer = [];
125
+ }
126
+ appendPostCommitCallback(callback) {
127
+ this.postCommitInvalidationCallbacksToTransfer.push(callback);
128
+ }
129
+ appendPostCommitInvalidationCallback(callback) {
130
+ this.postCommitCallbacksToTransfer.push(callback);
131
+ }
132
+ runPostCommitCallbacksAsync() {
133
+ throw new Error('Must not call runPostCommitCallbacksAsync on EntityNestedTransactionalQueryContext');
134
+ }
135
+ transferPostCommitCallbacksToParent() {
136
+ for (const callback of this.postCommitInvalidationCallbacksToTransfer) {
137
+ this.parentQueryContext.appendPostCommitInvalidationCallback(callback);
138
+ }
139
+ for (const callback of this.postCommitCallbacksToTransfer) {
140
+ this.parentQueryContext.appendPostCommitCallback(callback);
141
+ }
142
+ }
143
+ }
144
+ exports.EntityNestedTransactionalQueryContext = EntityNestedTransactionalQueryContext;
108
145
  //# sourceMappingURL=EntityQueryContext.js.map