@expo/entity 0.43.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/AuthorizationResultBasedEntityLoader.js +5 -1
- package/build/AuthorizationResultBasedEntityLoader.js.map +1 -1
- package/build/AuthorizationResultBasedEntityMutator.d.ts +87 -2
- package/build/AuthorizationResultBasedEntityMutator.js +122 -8
- package/build/AuthorizationResultBasedEntityMutator.js.map +1 -1
- package/build/EntityLoaderUtils.d.ts +15 -3
- package/build/EntityLoaderUtils.js +25 -10
- package/build/EntityLoaderUtils.js.map +1 -1
- package/build/EntityQueryContext.d.ts +53 -7
- package/build/EntityQueryContext.js +65 -10
- package/build/EntityQueryContext.js.map +1 -1
- package/build/EntityQueryContextProvider.d.ts +5 -1
- package/build/EntityQueryContextProvider.js +11 -4
- package/build/EntityQueryContextProvider.js.map +1 -1
- package/build/IEntityGenericCacher.d.ts +2 -2
- package/build/errors/EntityNotFoundError.d.ts +8 -1
- package/build/errors/EntityNotFoundError.js +7 -2
- package/build/errors/EntityNotFoundError.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/internal/CompositeFieldHolder.d.ts +13 -0
- package/build/internal/CompositeFieldHolder.js +7 -0
- package/build/internal/CompositeFieldHolder.js.map +1 -1
- package/build/internal/CompositeFieldValueMap.d.ts +3 -0
- package/build/internal/CompositeFieldValueMap.js +3 -0
- package/build/internal/CompositeFieldValueMap.js.map +1 -1
- package/build/internal/EntityDataManager.d.ts +22 -3
- package/build/internal/EntityDataManager.js +99 -11
- package/build/internal/EntityDataManager.js.map +1 -1
- package/build/internal/EntityFieldTransformationUtils.d.ts +20 -0
- package/build/internal/EntityFieldTransformationUtils.js +15 -0
- package/build/internal/EntityFieldTransformationUtils.js.map +1 -1
- package/build/internal/EntityLoadInterfaces.d.ts +8 -0
- package/build/internal/EntityLoadInterfaces.js +2 -0
- package/build/internal/EntityLoadInterfaces.js.map +1 -1
- package/build/internal/EntityTableDataCoordinator.d.ts +2 -0
- package/build/internal/EntityTableDataCoordinator.js +2 -0
- package/build/internal/EntityTableDataCoordinator.js.map +1 -1
- package/build/internal/ReadThroughEntityCache.d.ts +8 -0
- package/build/internal/ReadThroughEntityCache.js +5 -0
- package/build/internal/ReadThroughEntityCache.js.map +1 -1
- package/build/internal/SingleFieldHolder.d.ts +7 -0
- package/build/internal/SingleFieldHolder.js +7 -0
- package/build/internal/SingleFieldHolder.js.map +1 -1
- package/build/metrics/EntityMetricsUtils.d.ts +4 -3
- package/build/metrics/EntityMetricsUtils.js +6 -3
- package/build/metrics/EntityMetricsUtils.js.map +1 -1
- package/build/metrics/IEntityMetricsAdapter.d.ts +21 -0
- package/build/metrics/IEntityMetricsAdapter.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/utils/EntityCreationUtils.d.ts +14 -0
- package/build/utils/EntityCreationUtils.js +57 -0
- package/build/utils/EntityCreationUtils.js.map +1 -0
- package/package.json +13 -13
- package/src/AuthorizationResultBasedEntityLoader.ts +7 -1
- package/src/AuthorizationResultBasedEntityMutator.ts +133 -15
- package/src/EntityLoaderUtils.ts +43 -12
- package/src/EntityQueryContext.ts +68 -13
- package/src/EntityQueryContextProvider.ts +20 -3
- package/src/IEntityGenericCacher.ts +2 -2
- package/src/__tests__/AuthorizationResultBasedEntityLoader-test.ts +98 -0
- package/src/__tests__/EntityQueryContext-test.ts +141 -26
- package/src/errors/EntityNotFoundError.ts +51 -4
- package/src/errors/__tests__/EntityDatabaseAdapterError-test.ts +26 -0
- package/src/index.ts +1 -0
- package/src/internal/CompositeFieldHolder.ts +15 -0
- package/src/internal/CompositeFieldValueMap.ts +3 -0
- package/src/internal/EntityDataManager.ts +170 -10
- package/src/internal/EntityFieldTransformationUtils.ts +20 -0
- package/src/internal/EntityLoadInterfaces.ts +8 -0
- package/src/internal/EntityTableDataCoordinator.ts +2 -0
- package/src/internal/ReadThroughEntityCache.ts +8 -0
- package/src/internal/SingleFieldHolder.ts +7 -0
- package/src/internal/__tests__/EntityDataManager-test.ts +708 -186
- package/src/metrics/EntityMetricsUtils.ts +7 -0
- package/src/metrics/IEntityMetricsAdapter.ts +27 -0
- package/src/utils/EntityCreationUtils.ts +143 -0
- package/src/utils/__testfixtures__/StubDatabaseAdapter.ts +13 -1
- package/src/utils/__tests__/EntityCreationUtils-test.ts +354 -0
|
@@ -6,8 +6,14 @@ export declare enum TransactionIsolationLevel {
|
|
|
6
6
|
REPEATABLE_READ = "REPEATABLE_READ",
|
|
7
7
|
SERIALIZABLE = "SERIALIZABLE"
|
|
8
8
|
}
|
|
9
|
+
export declare enum TransactionalDataLoaderMode {
|
|
10
|
+
ENABLED = "ENABLED",
|
|
11
|
+
ENABLED_BATCH_ONLY = "ENABLED_BATCH_ONLY",
|
|
12
|
+
DISABLED = "DISABLED"
|
|
13
|
+
}
|
|
9
14
|
export type TransactionConfig = {
|
|
10
15
|
isolationLevel?: TransactionIsolationLevel;
|
|
16
|
+
transactionalDataLoaderMode?: TransactionalDataLoaderMode;
|
|
11
17
|
};
|
|
12
18
|
/**
|
|
13
19
|
* Entity framework representation of transactional and non-transactional database
|
|
@@ -19,7 +25,7 @@ export type TransactionConfig = {
|
|
|
19
25
|
export declare abstract class EntityQueryContext {
|
|
20
26
|
private readonly queryInterface;
|
|
21
27
|
constructor(queryInterface: any);
|
|
22
|
-
abstract isInTransaction():
|
|
28
|
+
abstract isInTransaction(): this is EntityTransactionalQueryContext;
|
|
23
29
|
getQueryInterface(): any;
|
|
24
30
|
abstract runInTransactionIfNotInTransactionAsync<T>(transactionScope: (queryContext: EntityTransactionalQueryContext) => Promise<T>, transactionConfig?: TransactionConfig): Promise<T>;
|
|
25
31
|
}
|
|
@@ -32,7 +38,7 @@ export declare abstract class EntityQueryContext {
|
|
|
32
38
|
export declare class EntityNonTransactionalQueryContext extends EntityQueryContext {
|
|
33
39
|
private readonly entityQueryContextProvider;
|
|
34
40
|
constructor(queryInterface: any, entityQueryContextProvider: EntityQueryContextProvider);
|
|
35
|
-
isInTransaction():
|
|
41
|
+
isInTransaction(): this is EntityTransactionalQueryContext;
|
|
36
42
|
runInTransactionIfNotInTransactionAsync<T>(transactionScope: (queryContext: EntityTransactionalQueryContext) => Promise<T>, transactionConfig?: TransactionConfig): Promise<T>;
|
|
37
43
|
}
|
|
38
44
|
/**
|
|
@@ -42,10 +48,23 @@ export declare class EntityNonTransactionalQueryContext extends EntityQueryConte
|
|
|
42
48
|
*/
|
|
43
49
|
export declare class EntityTransactionalQueryContext extends EntityQueryContext {
|
|
44
50
|
private readonly entityQueryContextProvider;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
readonly transactionId: string;
|
|
55
|
+
readonly transactionalDataLoaderMode: TransactionalDataLoaderMode;
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
readonly childQueryContexts: EntityNestedTransactionalQueryContext[];
|
|
45
60
|
private readonly postCommitInvalidationCallbacks;
|
|
46
61
|
private readonly postCommitCallbacks;
|
|
47
62
|
private readonly preCommitCallbacks;
|
|
48
|
-
constructor(queryInterface: any, entityQueryContextProvider: EntityQueryContextProvider
|
|
63
|
+
constructor(queryInterface: any, entityQueryContextProvider: EntityQueryContextProvider,
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
transactionId: string, transactionalDataLoaderMode: TransactionalDataLoaderMode);
|
|
49
68
|
/**
|
|
50
69
|
* Schedule a pre-commit callback. These will be run within the transaction right before it is
|
|
51
70
|
* committed, and will be run in the order specified. Ordering of callbacks scheduled with the
|
|
@@ -67,9 +86,16 @@ export declare class EntityTransactionalQueryContext extends EntityQueryContext
|
|
|
67
86
|
* @param callback - callback to schedule
|
|
68
87
|
*/
|
|
69
88
|
appendPostCommitCallback(callback: PostCommitCallback): void;
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
70
92
|
runPreCommitCallbacksAsync(): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
71
96
|
runPostCommitCallbacksAsync(): Promise<void>;
|
|
72
|
-
isInTransaction():
|
|
97
|
+
isInTransaction(): this is EntityTransactionalQueryContext;
|
|
98
|
+
isInNestedTransaction(): this is EntityNestedTransactionalQueryContext;
|
|
73
99
|
runInTransactionIfNotInTransactionAsync<T>(transactionScope: (queryContext: EntityTransactionalQueryContext) => Promise<T>, transactionConfig?: TransactionConfig): Promise<T>;
|
|
74
100
|
runInNestedTransactionAsync<T>(transactionScope: (innerQueryContext: EntityTransactionalQueryContext) => Promise<T>): Promise<T>;
|
|
75
101
|
}
|
|
@@ -82,12 +108,32 @@ export declare class EntityTransactionalQueryContext extends EntityQueryContext
|
|
|
82
108
|
* successful commit of the nested transaction.
|
|
83
109
|
*/
|
|
84
110
|
export declare class EntityNestedTransactionalQueryContext extends EntityTransactionalQueryContext {
|
|
85
|
-
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
readonly parentQueryContext: EntityTransactionalQueryContext;
|
|
86
115
|
private readonly postCommitInvalidationCallbacksToTransfer;
|
|
87
116
|
private readonly postCommitCallbacksToTransfer;
|
|
88
|
-
constructor(queryInterface: any,
|
|
117
|
+
constructor(queryInterface: any,
|
|
118
|
+
/**
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
parentQueryContext: EntityTransactionalQueryContext, entityQueryContextProvider: EntityQueryContextProvider, transactionId: string, transactionalDataLoaderMode: TransactionalDataLoaderMode);
|
|
122
|
+
isInNestedTransaction(): this is EntityNestedTransactionalQueryContext;
|
|
89
123
|
appendPostCommitCallback(callback: PostCommitCallback): void;
|
|
90
124
|
appendPostCommitInvalidationCallback(callback: PostCommitCallback): void;
|
|
125
|
+
/**
|
|
126
|
+
* The behavior of callbacks for nested transactions are a bit different than for normal
|
|
127
|
+
* transactions.
|
|
128
|
+
* - Post-commit (non-invalidation) callbacks are run at the end of the outermost transaction
|
|
129
|
+
* since they often contain side-effects that only should run if the transaction doesn't roll back.
|
|
130
|
+
* The outermost transaction has the final say on the commit state of itself and all sub-transactions.
|
|
131
|
+
* - Invalidation callbacks are run at the end of both the nested transaction iteself but also transferred
|
|
132
|
+
* to the parent transaction to be run at the end of it (and recurse upwards, accumulating invalations).
|
|
133
|
+
* This is to ensure the dataloader cache is never stale no matter the DBMS transaction isolation
|
|
134
|
+
* semantics. See the note in `AuthorizationResultBasedBaseMutator` for more details.
|
|
135
|
+
*
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
91
138
|
runPostCommitCallbacksAsync(): Promise<void>;
|
|
92
|
-
transferPostCommitCallbacksToParent(): void;
|
|
93
139
|
}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EntityNestedTransactionalQueryContext = exports.EntityTransactionalQueryContext = exports.EntityNonTransactionalQueryContext = exports.EntityQueryContext = exports.TransactionIsolationLevel = void 0;
|
|
6
|
+
exports.EntityNestedTransactionalQueryContext = exports.EntityTransactionalQueryContext = exports.EntityNonTransactionalQueryContext = exports.EntityQueryContext = exports.TransactionalDataLoaderMode = exports.TransactionIsolationLevel = void 0;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
var TransactionIsolationLevel;
|
|
9
9
|
(function (TransactionIsolationLevel) {
|
|
@@ -11,6 +11,12 @@ var TransactionIsolationLevel;
|
|
|
11
11
|
TransactionIsolationLevel["REPEATABLE_READ"] = "REPEATABLE_READ";
|
|
12
12
|
TransactionIsolationLevel["SERIALIZABLE"] = "SERIALIZABLE";
|
|
13
13
|
})(TransactionIsolationLevel || (exports.TransactionIsolationLevel = TransactionIsolationLevel = {}));
|
|
14
|
+
var TransactionalDataLoaderMode;
|
|
15
|
+
(function (TransactionalDataLoaderMode) {
|
|
16
|
+
TransactionalDataLoaderMode["ENABLED"] = "ENABLED";
|
|
17
|
+
TransactionalDataLoaderMode["ENABLED_BATCH_ONLY"] = "ENABLED_BATCH_ONLY";
|
|
18
|
+
TransactionalDataLoaderMode["DISABLED"] = "DISABLED";
|
|
19
|
+
})(TransactionalDataLoaderMode || (exports.TransactionalDataLoaderMode = TransactionalDataLoaderMode = {}));
|
|
14
20
|
/**
|
|
15
21
|
* Entity framework representation of transactional and non-transactional database
|
|
16
22
|
* query execution units.
|
|
@@ -55,12 +61,24 @@ exports.EntityNonTransactionalQueryContext = EntityNonTransactionalQueryContext;
|
|
|
55
61
|
*/
|
|
56
62
|
class EntityTransactionalQueryContext extends EntityQueryContext {
|
|
57
63
|
entityQueryContextProvider;
|
|
64
|
+
transactionId;
|
|
65
|
+
transactionalDataLoaderMode;
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
childQueryContexts = [];
|
|
58
70
|
postCommitInvalidationCallbacks = [];
|
|
59
71
|
postCommitCallbacks = [];
|
|
60
72
|
preCommitCallbacks = [];
|
|
61
|
-
constructor(queryInterface, entityQueryContextProvider
|
|
73
|
+
constructor(queryInterface, entityQueryContextProvider,
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
transactionId, transactionalDataLoaderMode) {
|
|
62
78
|
super(queryInterface);
|
|
63
79
|
this.entityQueryContextProvider = entityQueryContextProvider;
|
|
80
|
+
this.transactionId = transactionId;
|
|
81
|
+
this.transactionalDataLoaderMode = transactionalDataLoaderMode;
|
|
64
82
|
}
|
|
65
83
|
/**
|
|
66
84
|
* Schedule a pre-commit callback. These will be run within the transaction right before it is
|
|
@@ -90,6 +108,9 @@ class EntityTransactionalQueryContext extends EntityQueryContext {
|
|
|
90
108
|
appendPostCommitCallback(callback) {
|
|
91
109
|
this.postCommitCallbacks.push(callback);
|
|
92
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
93
114
|
async runPreCommitCallbacksAsync() {
|
|
94
115
|
const callbacks = [...this.preCommitCallbacks]
|
|
95
116
|
.sort((a, b) => a.order - b.order)
|
|
@@ -99,6 +120,9 @@ class EntityTransactionalQueryContext extends EntityQueryContext {
|
|
|
99
120
|
await callback(this);
|
|
100
121
|
}
|
|
101
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
102
126
|
async runPostCommitCallbacksAsync() {
|
|
103
127
|
const invalidationCallbacks = [...this.postCommitInvalidationCallbacks];
|
|
104
128
|
this.postCommitInvalidationCallbacks.length = 0;
|
|
@@ -110,6 +134,9 @@ class EntityTransactionalQueryContext extends EntityQueryContext {
|
|
|
110
134
|
isInTransaction() {
|
|
111
135
|
return true;
|
|
112
136
|
}
|
|
137
|
+
isInNestedTransaction() {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
113
140
|
async runInTransactionIfNotInTransactionAsync(transactionScope, transactionConfig) {
|
|
114
141
|
(0, assert_1.default)(transactionConfig === undefined, 'Should not pass transactionConfig to a nested transaction');
|
|
115
142
|
return await transactionScope(this);
|
|
@@ -131,23 +158,51 @@ class EntityNestedTransactionalQueryContext extends EntityTransactionalQueryCont
|
|
|
131
158
|
parentQueryContext;
|
|
132
159
|
postCommitInvalidationCallbacksToTransfer = [];
|
|
133
160
|
postCommitCallbacksToTransfer = [];
|
|
134
|
-
constructor(queryInterface,
|
|
135
|
-
|
|
161
|
+
constructor(queryInterface,
|
|
162
|
+
/**
|
|
163
|
+
* @internal
|
|
164
|
+
*/
|
|
165
|
+
parentQueryContext, entityQueryContextProvider, transactionId, transactionalDataLoaderMode) {
|
|
166
|
+
super(queryInterface, entityQueryContextProvider, transactionId, transactionalDataLoaderMode);
|
|
136
167
|
this.parentQueryContext = parentQueryContext;
|
|
168
|
+
parentQueryContext.childQueryContexts.push(this);
|
|
137
169
|
}
|
|
138
|
-
|
|
139
|
-
|
|
170
|
+
isInNestedTransaction() {
|
|
171
|
+
return true;
|
|
140
172
|
}
|
|
141
|
-
|
|
173
|
+
appendPostCommitCallback(callback) {
|
|
174
|
+
// explicitly do not add to the super-class's post-commit callbacks
|
|
175
|
+
// instead, we will add them to the parent transaction's post-commit callbacks
|
|
176
|
+
// after the nested transaction has been committed
|
|
142
177
|
this.postCommitCallbacksToTransfer.push(callback);
|
|
143
178
|
}
|
|
144
|
-
|
|
145
|
-
|
|
179
|
+
appendPostCommitInvalidationCallback(callback) {
|
|
180
|
+
super.appendPostCommitInvalidationCallback(callback);
|
|
181
|
+
this.postCommitInvalidationCallbacksToTransfer.push(callback);
|
|
146
182
|
}
|
|
147
|
-
|
|
183
|
+
/**
|
|
184
|
+
* The behavior of callbacks for nested transactions are a bit different than for normal
|
|
185
|
+
* transactions.
|
|
186
|
+
* - Post-commit (non-invalidation) callbacks are run at the end of the outermost transaction
|
|
187
|
+
* since they often contain side-effects that only should run if the transaction doesn't roll back.
|
|
188
|
+
* The outermost transaction has the final say on the commit state of itself and all sub-transactions.
|
|
189
|
+
* - Invalidation callbacks are run at the end of both the nested transaction iteself but also transferred
|
|
190
|
+
* to the parent transaction to be run at the end of it (and recurse upwards, accumulating invalations).
|
|
191
|
+
* This is to ensure the dataloader cache is never stale no matter the DBMS transaction isolation
|
|
192
|
+
* semantics. See the note in `AuthorizationResultBasedBaseMutator` for more details.
|
|
193
|
+
*
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
196
|
+
async runPostCommitCallbacksAsync() {
|
|
197
|
+
// run the post-commit callbacks for the nested transaction now
|
|
198
|
+
// (this technically also would run regular post-commit callbacks, but they are empty)
|
|
199
|
+
await super.runPostCommitCallbacksAsync();
|
|
200
|
+
// transfer a copy of the post-commit invalidation callbacks to the parent transaction
|
|
201
|
+
// to also be run at the end of it (or recurse in the case of the parent transaction being nested as well)
|
|
148
202
|
for (const callback of this.postCommitInvalidationCallbacksToTransfer) {
|
|
149
203
|
this.parentQueryContext.appendPostCommitInvalidationCallback(callback);
|
|
150
204
|
}
|
|
205
|
+
// transfer post-commit callbacks to patent
|
|
151
206
|
for (const callback of this.postCommitCallbacksToTransfer) {
|
|
152
207
|
this.parentQueryContext.appendPostCommitCallback(callback);
|
|
153
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityQueryContext.js","sourceRoot":"","sources":["../src/EntityQueryContext.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAU5B,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,8DAAiC,CAAA;IACjC,gEAAmC,CAAA;IACnC,0DAA6B,CAAA;AAC/B,CAAC,EAJW,yBAAyB,yCAAzB,yBAAyB,QAIpC;
|
|
1
|
+
{"version":3,"file":"EntityQueryContext.js","sourceRoot":"","sources":["../src/EntityQueryContext.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAU5B,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,8DAAiC,CAAA;IACjC,gEAAmC,CAAA;IACnC,0DAA6B,CAAA;AAC/B,CAAC,EAJW,yBAAyB,yCAAzB,yBAAyB,QAIpC;AAED,IAAY,2BAIX;AAJD,WAAY,2BAA2B;IACrC,kDAAmB,CAAA;IACnB,wEAAyC,CAAA;IACzC,oDAAqB,CAAA;AACvB,CAAC,EAJW,2BAA2B,2CAA3B,2BAA2B,QAItC;AAOD;;;;;;GAMG;AACH,MAAsB,kBAAkB;IACT;IAA7B,YAA6B,cAAmB;QAAnB,mBAAc,GAAd,cAAc,CAAK;IAAG,CAAC;IAIpD,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CAMF;AAbD,gDAaC;AAED;;;;;GAKG;AACH,MAAa,kCAAmC,SAAQ,kBAAkB;IAGrD;IAFnB,YACE,cAAmB,EACF,0BAAsD;QAEvE,KAAK,CAAC,cAAc,CAAC,CAAC;QA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E,CAAC;YACtE,IAAI,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,QAAQ,CAAC,CAAC;QACzE,CAAC;QAED,2CAA2C;QAC3C,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;YAC1D,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF;AA/DD,sFA+DC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityTransactionalQueryContext, EntityNonTransactionalQueryContext, EntityNestedTransactionalQueryContext, TransactionConfig } from './EntityQueryContext';
|
|
1
|
+
import { EntityTransactionalQueryContext, EntityNonTransactionalQueryContext, EntityNestedTransactionalQueryContext, TransactionConfig, TransactionalDataLoaderMode } from './EntityQueryContext';
|
|
2
2
|
/**
|
|
3
3
|
* A query context provider vends transactional and non-transactional query contexts.
|
|
4
4
|
*/
|
|
@@ -11,6 +11,10 @@ export default abstract class EntityQueryContextProvider {
|
|
|
11
11
|
* Get the query interface for constructing a query context.
|
|
12
12
|
*/
|
|
13
13
|
protected abstract getQueryInterface(): any;
|
|
14
|
+
/**
|
|
15
|
+
* @returns true if the transactional dataloader should be disabled for all transactions.
|
|
16
|
+
*/
|
|
17
|
+
protected defaultTransactionalDataLoaderMode(): TransactionalDataLoaderMode;
|
|
14
18
|
/**
|
|
15
19
|
* Vend a transaction runner for use in runInTransactionAsync.
|
|
16
20
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_crypto_1 = require("node:crypto");
|
|
3
4
|
const EntityQueryContext_1 = require("./EntityQueryContext");
|
|
4
5
|
/**
|
|
5
6
|
* A query context provider vends transactional and non-transactional query contexts.
|
|
@@ -11,13 +12,19 @@ class EntityQueryContextProvider {
|
|
|
11
12
|
getQueryContext() {
|
|
12
13
|
return new EntityQueryContext_1.EntityNonTransactionalQueryContext(this.getQueryInterface(), this);
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @returns true if the transactional dataloader should be disabled for all transactions.
|
|
17
|
+
*/
|
|
18
|
+
defaultTransactionalDataLoaderMode() {
|
|
19
|
+
return EntityQueryContext_1.TransactionalDataLoaderMode.ENABLED;
|
|
20
|
+
}
|
|
14
21
|
/**
|
|
15
22
|
* Start a transaction and execute the provided transaction-scoped closure within the transaction.
|
|
16
23
|
* @param transactionScope - async callback to execute within the transaction
|
|
17
24
|
*/
|
|
18
25
|
async runInTransactionAsync(transactionScope, transactionConfig) {
|
|
19
26
|
const [returnedValue, queryContext] = await this.createTransactionRunner(transactionConfig)(async (queryInterface) => {
|
|
20
|
-
const queryContext = new EntityQueryContext_1.EntityTransactionalQueryContext(queryInterface, this);
|
|
27
|
+
const queryContext = new EntityQueryContext_1.EntityTransactionalQueryContext(queryInterface, this, (0, node_crypto_1.randomUUID)(), transactionConfig?.transactionalDataLoaderMode ?? this.defaultTransactionalDataLoaderMode());
|
|
21
28
|
const result = await transactionScope(queryContext);
|
|
22
29
|
await queryContext.runPreCommitCallbacksAsync();
|
|
23
30
|
return [result, queryContext];
|
|
@@ -33,13 +40,13 @@ class EntityQueryContextProvider {
|
|
|
33
40
|
*/
|
|
34
41
|
async runInNestedTransactionAsync(outerQueryContext, transactionScope) {
|
|
35
42
|
const [returnedValue, innerQueryContext] = await this.createNestedTransactionRunner(outerQueryContext.getQueryInterface())(async (innerQueryInterface) => {
|
|
36
|
-
const innerQueryContext = new EntityQueryContext_1.EntityNestedTransactionalQueryContext(innerQueryInterface, outerQueryContext, this);
|
|
43
|
+
const innerQueryContext = new EntityQueryContext_1.EntityNestedTransactionalQueryContext(innerQueryInterface, outerQueryContext, this, (0, node_crypto_1.randomUUID)(), outerQueryContext.transactionalDataLoaderMode);
|
|
37
44
|
const result = await transactionScope(innerQueryContext);
|
|
38
45
|
await innerQueryContext.runPreCommitCallbacksAsync();
|
|
39
46
|
return [result, innerQueryContext];
|
|
40
47
|
});
|
|
41
|
-
//
|
|
42
|
-
innerQueryContext.
|
|
48
|
+
// behavior of this call differs for nested transaction query contexts from regular transaction query contexts
|
|
49
|
+
await innerQueryContext.runPostCommitCallbacksAsync();
|
|
43
50
|
return returnedValue;
|
|
44
51
|
}
|
|
45
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityQueryContextProvider.js","sourceRoot":"","sources":["../src/EntityQueryContextProvider.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"EntityQueryContextProvider.js","sourceRoot":"","sources":["../src/EntityQueryContextProvider.ts"],"names":[],"mappings":";;AAAA,6CAAyC;AAEzC,6DAM8B;AAE9B;;GAEG;AACH,MAA8B,0BAA0B;IACtD;;OAEG;IACI,eAAe;QACpB,OAAO,IAAI,uDAAkC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;IAOD;;OAEG;IACO,kCAAkC;QAC1C,OAAO,gDAA2B,CAAC,OAAO,CAAC;IAC7C,CAAC;IAaD;;;OAGG;IACH,KAAK,CAAC,qBAAqB,CACzB,gBAA+E,EAC/E,iBAAqC;QAErC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAEtE,iBAAiB,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE;YAC5C,MAAM,YAAY,GAAG,IAAI,oDAA+B,CACtD,cAAc,EACd,IAAI,EACJ,IAAA,wBAAU,GAAE,EACZ,iBAAiB,EAAE,2BAA2B,IAAI,IAAI,CAAC,kCAAkC,EAAE,CAC5F,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC;YACpD,MAAM,YAAY,CAAC,0BAA0B,EAAE,CAAC;YAChD,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,MAAM,YAAY,CAAC,2BAA2B,EAAE,CAAC;QACjD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,iBAAkD,EAClD,gBAA0F;QAE1F,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAEjF,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE;YACrE,MAAM,iBAAiB,GAAG,IAAI,0DAAqC,CACjE,mBAAmB,EACnB,iBAAiB,EACjB,IAAI,EACJ,IAAA,wBAAU,GAAE,EACZ,iBAAiB,CAAC,2BAA2B,CAC9C,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;YACzD,MAAM,iBAAiB,CAAC,0BAA0B,EAAE,CAAC;YACrD,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,8GAA8G;QAC9G,MAAM,iBAAiB,CAAC,2BAA2B,EAAE,CAAC;QACtD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AApFD,6CAoFC"}
|
|
@@ -43,8 +43,8 @@ export default interface IEntityGenericCacher<TFields extends Record<string, any
|
|
|
43
43
|
* from makeCacheKeyForStorage because invalidation can optionally be configured to invalidate a larger set of keys than
|
|
44
44
|
* the one for just the current cache version, which can be useful for things like push safety.
|
|
45
45
|
*
|
|
46
|
-
* @param key - load key
|
|
47
|
-
* @param
|
|
46
|
+
* @param key - load key for the cache keys
|
|
47
|
+
* @param value - load value for the cache keys
|
|
48
48
|
*/
|
|
49
49
|
makeCacheKeysForInvalidation<TLoadKey extends IEntityLoadKey<TFields, TIDField, TSerializedLoadValue, TLoadValue>, TSerializedLoadValue, TLoadValue extends IEntityLoadValue<TSerializedLoadValue>>(key: TLoadKey, value: TLoadValue): readonly string[];
|
|
50
50
|
}
|
|
@@ -3,8 +3,15 @@ import { IEntityClass } from '../Entity';
|
|
|
3
3
|
import EntityPrivacyPolicy from '../EntityPrivacyPolicy';
|
|
4
4
|
import ReadonlyEntity from '../ReadonlyEntity';
|
|
5
5
|
import ViewerContext from '../ViewerContext';
|
|
6
|
+
type EntityNotFoundOptions<TFields extends Record<string, any>, TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>, N extends keyof TFields, TSelectedFields extends keyof TFields = keyof TFields> = {
|
|
7
|
+
entityClass: IEntityClass<TFields, TIDField, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
|
|
8
|
+
fieldName: N;
|
|
9
|
+
fieldValue: TFields[N];
|
|
10
|
+
};
|
|
6
11
|
export default class EntityNotFoundError<TFields extends Record<string, any>, TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TIDField, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>, N extends keyof TFields, TSelectedFields extends keyof TFields = keyof TFields> extends EntityError {
|
|
7
12
|
readonly state = EntityErrorState.PERMANENT;
|
|
8
13
|
readonly code = EntityErrorCode.ERR_ENTITY_NOT_FOUND;
|
|
9
|
-
constructor(
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
constructor(options: EntityNotFoundOptions<TFields, TIDField, TViewerContext, TEntity, TPrivacyPolicy, N, TSelectedFields>);
|
|
10
16
|
}
|
|
17
|
+
export {};
|
|
@@ -37,8 +37,13 @@ const EntityError_1 = __importStar(require("./EntityError"));
|
|
|
37
37
|
class EntityNotFoundError extends EntityError_1.default {
|
|
38
38
|
state = EntityError_1.EntityErrorState.PERMANENT;
|
|
39
39
|
code = EntityError_1.EntityErrorCode.ERR_ENTITY_NOT_FOUND;
|
|
40
|
-
constructor(
|
|
41
|
-
|
|
40
|
+
constructor(messageOrOptions) {
|
|
41
|
+
if (typeof messageOrOptions === 'string') {
|
|
42
|
+
super(messageOrOptions);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
super(`Entity not found: ${messageOrOptions.entityClass.name} (${String(messageOrOptions.fieldName)} = ${messageOrOptions.fieldValue})`);
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
exports.default = EntityNotFoundError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityNotFoundError.js","sourceRoot":"","sources":["../../src/errors/EntityNotFoundError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA+E;
|
|
1
|
+
{"version":3,"file":"EntityNotFoundError.js","sourceRoot":"","sources":["../../src/errors/EntityNotFoundError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA+E;AAiC/E,MAAqB,mBAcnB,SAAQ,qBAAW;IACH,KAAK,GAAG,8BAAgB,CAAC,SAAS,CAAC;IACnC,IAAI,GAAG,6BAAe,CAAC,oBAAoB,CAAC;IAe5D,YACE,gBAUK;QAEL,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YACzC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,KAAK,CACH,qBAAqB,gBAAgB,CAAC,WAAW,CAAC,IAAI,KAAK,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,MAAM,gBAAgB,CAAC,UAAU,GAAG,CAClI,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AApDD,sCAoDC"}
|
package/build/index.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export { default as AlwaysDenyPrivacyPolicyRule } from './rules/AlwaysDenyPrivac
|
|
|
83
83
|
export { default as AlwaysSkipPrivacyPolicyRule } from './rules/AlwaysSkipPrivacyPolicyRule';
|
|
84
84
|
export { default as PrivacyPolicyRule } from './rules/PrivacyPolicyRule';
|
|
85
85
|
export * from './rules/PrivacyPolicyRule';
|
|
86
|
+
export * from './utils/EntityCreationUtils';
|
|
86
87
|
export * from './utils/EntityPrivacyUtils';
|
|
87
88
|
export * from './utils/mergeEntityMutationTriggerConfigurations';
|
|
88
89
|
export * from './utils/collections/maps';
|
package/build/index.js
CHANGED
|
@@ -146,6 +146,7 @@ Object.defineProperty(exports, "AlwaysSkipPrivacyPolicyRule", { enumerable: true
|
|
|
146
146
|
var PrivacyPolicyRule_1 = require("./rules/PrivacyPolicyRule");
|
|
147
147
|
Object.defineProperty(exports, "PrivacyPolicyRule", { enumerable: true, get: function () { return __importDefault(PrivacyPolicyRule_1).default; } });
|
|
148
148
|
__exportStar(require("./rules/PrivacyPolicyRule"), exports);
|
|
149
|
+
__exportStar(require("./utils/EntityCreationUtils"), exports);
|
|
149
150
|
__exportStar(require("./utils/EntityPrivacyUtils"), exports);
|
|
150
151
|
__exportStar(require("./utils/mergeEntityMutationTriggerConfigurations"), exports);
|
|
151
152
|
__exportStar(require("./utils/collections/maps"), exports);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC;;;GAGG;;;;;;;;;;;;;;;;;;;;AAEH,qHAA+H;AAAtH,mMAAA,OAAO,OAAmD;AACnE,oFAAkE;AAClE,+FAAyG;AAAhG,6KAAA,OAAO,OAAwC;AACxD,0EAAwD;AACxD,2EAAqF;AAA5E,yJAAA,OAAO,OAA8B;AAC9C,+EAAyF;AAAhF,6JAAA,OAAO,OAAgC;AAChD,uFAAiG;AAAxF,qKAAA,OAAO,OAAoC;AACpD,mEAA6E;AAApE,iJAAA,OAAO,OAA0B;AAC1C,mEAA6E;AAApE,i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'../EntityConfiguration';
|
|
2
2
|
import { EntityLoadMethodType, IEntityLoadKey, IEntityLoadValue, LoadValueMap } from '../internal/EntityLoadInterfaces';
|
|
3
3
|
declare const CompositeFieldHolderSerializedBrand: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
4
7
|
export type SerializedCompositeFieldHolder = string & {
|
|
5
8
|
readonly [CompositeFieldHolderSerializedBrand]: true;
|
|
6
9
|
};
|
|
7
10
|
/**
|
|
8
11
|
* A load key that represents a composite field (set of fieldName) on an entity.
|
|
9
12
|
* Must be defined in the entity configuration composite field definition.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
10
15
|
*/
|
|
11
16
|
export declare class CompositeFieldHolder<TFields extends Record<string, any>, TIDField extends keyof TFields> implements IEntityLoadKey<TFields, TIDField, SerializedCompositeFieldValueHolder, CompositeFieldValueHolder<TFields, EntityCompositeField<TFields>>> {
|
|
12
17
|
readonly compositeField: EntityCompositeField<TFields>;
|
|
@@ -28,11 +33,16 @@ export declare class CompositeFieldHolder<TFields extends Record<string, any>, T
|
|
|
28
33
|
vendNewLoadValueMap<V>(): LoadValueMap<SerializedCompositeFieldValueHolder, CompositeFieldValueHolder<TFields, EntityCompositeField<TFields>>, V>;
|
|
29
34
|
}
|
|
30
35
|
declare const CompositeFieldValueHolderSerializedBrand: unique symbol;
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
31
39
|
export type SerializedCompositeFieldValueHolder = string & {
|
|
32
40
|
readonly [CompositeFieldValueHolderSerializedBrand]: true;
|
|
33
41
|
};
|
|
34
42
|
/**
|
|
35
43
|
* A load value for a CompositeFieldHolder.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
36
46
|
*/
|
|
37
47
|
export declare class CompositeFieldValueHolder<TFields extends Record<string, any>, TCompositeField extends EntityCompositeField<TFields>> implements IEntityLoadValue<SerializedCompositeFieldValueHolder> {
|
|
38
48
|
readonly compositeFieldValue: EntityCompositeFieldValue<TFields, TCompositeField>;
|
|
@@ -42,6 +52,9 @@ export declare class CompositeFieldValueHolder<TFields extends Record<string, an
|
|
|
42
52
|
static deserialize<TFields extends Record<string, any>, TCompositeField extends EntityCompositeField<TFields>>(serialized: SerializedCompositeFieldValueHolder): CompositeFieldValueHolder<TFields, TCompositeField>;
|
|
43
53
|
serialize(): SerializedCompositeFieldValueHolder;
|
|
44
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
45
58
|
export declare class CompositeFieldValueHolderMap<TFields extends Record<string, any>, N extends EntityCompositeField<TFields>, V> extends LoadValueMap<SerializedCompositeFieldValueHolder, CompositeFieldValueHolder<TFields, N>, V> {
|
|
46
59
|
protected deserializeKey(serializedKey: SerializedCompositeFieldValueHolder): CompositeFieldValueHolder<TFields, N>;
|
|
47
60
|
}
|
|
@@ -11,6 +11,8 @@ const EntityLoadInterfaces_1 = require("../internal/EntityLoadInterfaces");
|
|
|
11
11
|
/**
|
|
12
12
|
* A load key that represents a composite field (set of fieldName) on an entity.
|
|
13
13
|
* Must be defined in the entity configuration composite field definition.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
14
16
|
*/
|
|
15
17
|
class CompositeFieldHolder {
|
|
16
18
|
compositeField;
|
|
@@ -80,6 +82,8 @@ class CompositeFieldHolder {
|
|
|
80
82
|
exports.CompositeFieldHolder = CompositeFieldHolder;
|
|
81
83
|
/**
|
|
82
84
|
* A load value for a CompositeFieldHolder.
|
|
85
|
+
*
|
|
86
|
+
* @internal
|
|
83
87
|
*/
|
|
84
88
|
class CompositeFieldValueHolder {
|
|
85
89
|
compositeFieldValue;
|
|
@@ -107,6 +111,9 @@ class CompositeFieldValueHolder {
|
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
exports.CompositeFieldValueHolder = CompositeFieldValueHolder;
|
|
114
|
+
/**
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
110
117
|
class CompositeFieldValueHolderMap extends EntityLoadInterfaces_1.LoadValueMap {
|
|
111
118
|
deserializeKey(serializedKey) {
|
|
112
119
|
return CompositeFieldValueHolder.deserialize(serializedKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeFieldHolder.js","sourceRoot":"","sources":["../../src/internal/CompositeFieldHolder.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAMlC,gDAAsC;AACtC,qFAAkF;AAClF,2EAK0C;
|
|
1
|
+
{"version":3,"file":"CompositeFieldHolder.js","sourceRoot":"","sources":["../../src/internal/CompositeFieldHolder.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAMlC,gDAAsC;AACtC,qFAAkF;AAClF,2EAK0C;AAW1C;;;;;GAKG;AACH,MAAa,oBAAoB;IAWf,cAAc,CAAgC;IAE9D,YAAY,mBAAkD;QAC5D,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,mBAAmB,CAAC,CAAC,IAAI,EAAE,CAAC;IACxD,CAAC;IAED,QAAQ;QACN,OAAO,kBAAkB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC5D,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC;IAEM,gDAAgD,CACrD,YAAqB;QAErB,MAAM,SAAS,GAAG,IAAA,kBAAI,EAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1D,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,CAAC;YACpF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,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AAU,EAAE,CAAC;aAC9D,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAsB,CAAC,CAAC;IAC7E,CAAC;IAEM,MAAM,CAAC,WAAW,CAIvB,UAA+C;QAE/C,OAAO,IAAI,yBAAyB,CAClC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAwD,CAC9E,CAAC;IACJ,CAAC;IAEM,SAAS;QACd,8FAA8F;QAC9F,mEAAmE;QACnE,0FAA0F;QAC1F,iEAAiE;QACjE,0FAA0F;QAC1F,OAAO,IAAI,CAAC,SAAS,CACnB,IAAI,CAAC,mBAAmB,EACxB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,CACN,CAAC;IAC3C,CAAC;CACF;AAzCD,8DAyCC;AAED;;GAEG;AACH,MAAa,4BAIX,SAAQ,mCAIT;IACoB,cAAc,CAC/B,aAAkD;QAElD,OAAO,yBAAyB,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC9D,CAAC;CACF;AAdD,oEAcC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { EntityCompositeField, EntityCompositeFieldValue } from '../EntityConfiguration';
|
|
2
2
|
import { CompositeFieldValueHolder } from './CompositeFieldHolder';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
3
6
|
export declare class CompositeFieldValueMap<TFields extends Record<string, any>, N extends EntityCompositeField<TFields>, TOutput> implements ReadonlyMap<EntityCompositeFieldValue<TFields, N>, TOutput> {
|
|
4
7
|
private readonly map;
|
|
5
8
|
constructor(entries: [CompositeFieldValueHolder<TFields, N>, TOutput][]);
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CompositeFieldValueMap = void 0;
|
|
4
4
|
const CompositeFieldHolder_1 = require("./CompositeFieldHolder");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
class CompositeFieldValueMap {
|
|
6
9
|
map;
|
|
7
10
|
constructor(entries) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeFieldValueMap.js","sourceRoot":"","sources":["../../src/internal/CompositeFieldValueMap.ts"],"names":[],"mappings":";;;AACA,iEAGgC;AAEhC,MAAa,sBAAsB;IAMhB,GAAG,CAAoD;IAExE,YAAY,OAA2D;QACrE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAgD,CAAC;QACpE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;YACnC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,GAAG,CAAC,mBAA0D;QAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,gDAAyB,CAAC,mBAAmB,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,GAAG,CAAC,mBAA0D;QAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,gDAAyB,CAAC,mBAAmB,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,CACL,UAIS,EACT,OAAa;QAEb,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC9B,UAAU,CAAC,IAAI,CACb,OAAO,EACP,KAAK,EACL,gDAAyB,CAAC,WAAW,CAAa,GAAG,CAAC,CAAC,mBAAmB,EAC1E,IAAI,CACL,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,CAAC,OAAO;QACN,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9C,MAAM,CAAC,gDAAyB,CAAC,WAAW,CAAa,GAAG,CAAC,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IAED,CAAC,IAAI;QACH,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YAClC,MAAM,gDAAyB,CAAC,WAAW,CAAa,GAAG,CAAC,CAAC,mBAAmB,CAAC;QACnF,CAAC;IACH,CAAC;IAED,CAAC,MAAM;QACL,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;YACtC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,wBAAwB,CAAC;IAClC,CAAC;CACF;AAvED,wDAuEC"}
|
|
1
|
+
{"version":3,"file":"CompositeFieldValueMap.js","sourceRoot":"","sources":["../../src/internal/CompositeFieldValueMap.ts"],"names":[],"mappings":";;;AACA,iEAGgC;AAEhC;;GAEG;AACH,MAAa,sBAAsB;IAMhB,GAAG,CAAoD;IAExE,YAAY,OAA2D;QACrE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAgD,CAAC;QACpE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;YACnC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,GAAG,C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AC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,wBAAwB,CAAC;IAClC,CAAC;CACF;AAvED,wDAuEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ReadThroughEntityCache from './ReadThroughEntityCache';
|
|
2
2
|
import EntityDatabaseAdapter, { FieldEqualityCondition, QuerySelectionModifiers, QuerySelectionModifiersWithOrderByRaw } from '../EntityDatabaseAdapter';
|
|
3
|
-
import { EntityQueryContext } from '../EntityQueryContext';
|
|
3
|
+
import { EntityQueryContext, EntityTransactionalQueryContext } from '../EntityQueryContext';
|
|
4
4
|
import EntityQueryContextProvider from '../EntityQueryContextProvider';
|
|
5
5
|
import { IEntityLoadKey, IEntityLoadValue, LoadPair } from './EntityLoadInterfaces';
|
|
6
6
|
import IEntityMetricsAdapter from '../metrics/IEntityMetricsAdapter';
|
|
@@ -9,6 +9,8 @@ import IEntityMetricsAdapter from '../metrics/IEntityMetricsAdapter';
|
|
|
9
9
|
* data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter.
|
|
10
10
|
*
|
|
11
11
|
* It is also responsible for invalidating all sources of data when mutated using EntityMutator.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
12
14
|
*/
|
|
13
15
|
export default class EntityDataManager<TFields extends Record<string, any>, TIDField extends keyof TFields> {
|
|
14
16
|
private readonly databaseAdapter;
|
|
@@ -16,10 +18,13 @@ export default class EntityDataManager<TFields extends Record<string, any>, TIDF
|
|
|
16
18
|
private readonly queryContextProvider;
|
|
17
19
|
private readonly metricsAdapter;
|
|
18
20
|
private readonly entityClassName;
|
|
19
|
-
private readonly
|
|
21
|
+
private readonly dataLoaders;
|
|
22
|
+
private readonly transactionalDataLoaders;
|
|
20
23
|
constructor(databaseAdapter: EntityDatabaseAdapter<TFields, TIDField>, entityCache: ReadThroughEntityCache<TFields, TIDField>, queryContextProvider: EntityQueryContextProvider, metricsAdapter: IEntityMetricsAdapter, entityClassName: string);
|
|
21
24
|
private getDataLoaderForLoadKey;
|
|
22
|
-
private
|
|
25
|
+
private loadManyForNonTransactionalDataLoaderAsync;
|
|
26
|
+
private getTransactionalDataLoaderForLoadKey;
|
|
27
|
+
private loadManyForTransactionalDataLoaderAsync;
|
|
23
28
|
/**
|
|
24
29
|
* Load many objects through read-through dataloader (batcher) and cache (optional).
|
|
25
30
|
*
|
|
@@ -51,9 +56,23 @@ export default class EntityDataManager<TFields extends Record<string, any>, TIDF
|
|
|
51
56
|
*/
|
|
52
57
|
loadManyByRawWhereClauseAsync(queryContext: EntityQueryContext, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers: QuerySelectionModifiersWithOrderByRaw<TFields>): Promise<readonly Readonly<TFields>[]>;
|
|
53
58
|
private invalidateOneAsync;
|
|
59
|
+
private invalidateOneForTransaction;
|
|
54
60
|
/**
|
|
55
61
|
* Invalidate all caches, in-memory or otherwise, for sets of key-value pairs.
|
|
56
62
|
* @param pairs - key-value pairs to invalidate
|
|
57
63
|
*/
|
|
58
64
|
invalidateKeyValuePairsAsync(pairs: readonly LoadPair<TFields, TIDField, any, any, any>[]): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Invalidate all in-memory caches for sets of key-value pairs for all transactions and parent transactions.
|
|
67
|
+
* @param pairs - key-value pairs to invalidate
|
|
68
|
+
*/
|
|
69
|
+
invalidateKeyValuePairsForTransaction(queryContext: EntityTransactionalQueryContext, pairs: readonly LoadPair<TFields, TIDField, any, any, any>[]): void;
|
|
70
|
+
/**
|
|
71
|
+
* Traverse to root of transactional query context tree.
|
|
72
|
+
*/
|
|
73
|
+
private static getOutermostTransactionalQueryContextIfInNestedTransaction;
|
|
74
|
+
/**
|
|
75
|
+
* Get a list of all child query contexts recursively for a given query context.
|
|
76
|
+
*/
|
|
77
|
+
private static getAllDescendantTransactionalQueryContexts;
|
|
59
78
|
}
|