@expo/entity-secondary-cache-local-memory 0.55.0 → 0.57.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/entity-secondary-cache-local-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "Local memory secondary cache for @expo/entity",
|
|
5
5
|
"files": [
|
|
6
6
|
"build",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"author": "Expo",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@expo/entity": "^0.
|
|
32
|
-
"@expo/entity-cache-adapter-local-memory": "^0.
|
|
31
|
+
"@expo/entity": "^0.57.0",
|
|
32
|
+
"@expo/entity-cache-adapter-local-memory": "^0.57.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@isaacs/ttlcache": "2.1.4",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"nullthrows": "1.1.1",
|
|
38
38
|
"typescript": "5.9.3"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "e876cfb27bb9b0004d81b40c9067481e3e0c2beb"
|
|
41
41
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AlwaysAllowPrivacyPolicyRule,
|
|
3
|
+
AuthorizationResultBasedEntityLoader,
|
|
3
4
|
Entity,
|
|
4
5
|
EntityCompanionDefinition,
|
|
5
6
|
EntityCompanionProvider,
|
|
6
7
|
EntityConfiguration,
|
|
8
|
+
EntityConstructionUtils,
|
|
7
9
|
EntityPrivacyPolicy,
|
|
8
10
|
EntitySecondaryCacheLoader,
|
|
9
11
|
IEntityMetricsAdapter,
|
|
@@ -161,6 +163,32 @@ class TestSecondaryLocalMemoryCacheLoader extends EntitySecondaryCacheLoader<
|
|
|
161
163
|
> {
|
|
162
164
|
public databaseLoadCount = 0;
|
|
163
165
|
|
|
166
|
+
constructor(
|
|
167
|
+
secondaryEntityCache: LocalMemorySecondaryEntityCache<
|
|
168
|
+
LocalMemoryTestEntityFields,
|
|
169
|
+
'id',
|
|
170
|
+
TestLoadParams
|
|
171
|
+
>,
|
|
172
|
+
constructionUtils: EntityConstructionUtils<
|
|
173
|
+
LocalMemoryTestEntityFields,
|
|
174
|
+
'id',
|
|
175
|
+
TestViewerContext,
|
|
176
|
+
LocalMemoryTestEntity,
|
|
177
|
+
LocalMemoryTestEntityPrivacyPolicy,
|
|
178
|
+
keyof LocalMemoryTestEntityFields
|
|
179
|
+
>,
|
|
180
|
+
private readonly entityLoader: AuthorizationResultBasedEntityLoader<
|
|
181
|
+
LocalMemoryTestEntityFields,
|
|
182
|
+
'id',
|
|
183
|
+
TestViewerContext,
|
|
184
|
+
LocalMemoryTestEntity,
|
|
185
|
+
LocalMemoryTestEntityPrivacyPolicy,
|
|
186
|
+
keyof LocalMemoryTestEntityFields
|
|
187
|
+
>,
|
|
188
|
+
) {
|
|
189
|
+
super(secondaryEntityCache, constructionUtils);
|
|
190
|
+
}
|
|
191
|
+
|
|
164
192
|
protected async fetchObjectsFromDatabaseAsync(
|
|
165
193
|
loadParamsArray: readonly Readonly<TestLoadParams>[],
|
|
166
194
|
): Promise<ReadonlyMap<Readonly<TestLoadParams>, Readonly<LocalMemoryTestEntityFields> | null>> {
|
|
@@ -172,11 +200,7 @@ class TestSecondaryLocalMemoryCacheLoader extends EntitySecondaryCacheLoader<
|
|
|
172
200
|
return null;
|
|
173
201
|
}
|
|
174
202
|
return nullthrows(
|
|
175
|
-
(
|
|
176
|
-
await this.entityLoader.loadManyByFieldEqualityConjunctionAsync([
|
|
177
|
-
{ fieldName: 'id', fieldValue: loadParams.id },
|
|
178
|
-
])
|
|
179
|
-
)[0],
|
|
203
|
+
(await this.entityLoader.loadManyByFieldEqualingAsync('id', loadParams.id))[0],
|
|
180
204
|
)
|
|
181
205
|
.enforceValue()
|
|
182
206
|
.getAllFields();
|
|
@@ -197,6 +221,10 @@ describe(LocalMemorySecondaryEntityCache, () => {
|
|
|
197
221
|
localMemoryTestEntityConfiguration,
|
|
198
222
|
createTTLCache<LocalMemoryTestEntityFields>(),
|
|
199
223
|
),
|
|
224
|
+
EntitySecondaryCacheLoader.getConstructionUtilsForEntityClass(
|
|
225
|
+
LocalMemoryTestEntity,
|
|
226
|
+
viewerContext,
|
|
227
|
+
),
|
|
200
228
|
LocalMemoryTestEntity.loaderWithAuthorizationResults(viewerContext),
|
|
201
229
|
);
|
|
202
230
|
|
|
@@ -233,6 +261,10 @@ describe(LocalMemorySecondaryEntityCache, () => {
|
|
|
233
261
|
localMemoryTestEntityConfiguration,
|
|
234
262
|
createTTLCache<LocalMemoryTestEntityFields>(),
|
|
235
263
|
),
|
|
264
|
+
EntitySecondaryCacheLoader.getConstructionUtilsForEntityClass(
|
|
265
|
+
LocalMemoryTestEntity,
|
|
266
|
+
viewerContext,
|
|
267
|
+
),
|
|
236
268
|
LocalMemoryTestEntity.loaderWithAuthorizationResults(viewerContext),
|
|
237
269
|
);
|
|
238
270
|
|