@expo/entity-secondary-cache-redis 0.55.0 → 0.58.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-redis",
3
- "version": "0.55.0",
3
+ "version": "0.58.0",
4
4
  "description": "Redis secondary cache for @expo/entity",
5
5
  "files": [
6
6
  "build",
@@ -27,14 +27,14 @@
27
27
  "author": "Expo",
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@expo/entity": "^0.55.0",
31
- "@expo/entity-cache-adapter-redis": "^0.55.0"
30
+ "@expo/entity": "^0.58.0",
31
+ "@expo/entity-cache-adapter-redis": "^0.58.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@jest/globals": "30.2.0",
35
- "ioredis": "5.9.2",
35
+ "ioredis": "5.10.0",
36
36
  "nullthrows": "1.1.1",
37
37
  "typescript": "5.9.3"
38
38
  },
39
- "gitHead": "de7548680dbffb722fb6f5c92106392319782fef"
39
+ "gitHead": "7dab49a36dafae2adba126ba6084512abab1afe1"
40
40
  }
@@ -1,4 +1,10 @@
1
- import { EntitySecondaryCacheLoader, mapMapAsync, ViewerContext } from '@expo/entity';
1
+ import {
2
+ AuthorizationResultBasedEntityLoader,
3
+ EntityConstructionUtils,
4
+ EntitySecondaryCacheLoader,
5
+ mapMapAsync,
6
+ ViewerContext,
7
+ } from '@expo/entity';
2
8
  import {
3
9
  GenericRedisCacheContext,
4
10
  RedisCacheInvalidationStrategy,
@@ -33,6 +39,28 @@ class TestSecondaryRedisCacheLoader extends EntitySecondaryCacheLoader<
33
39
  > {
34
40
  public databaseLoadCount = 0;
35
41
 
42
+ constructor(
43
+ secondaryEntityCache: RedisSecondaryEntityCache<RedisTestEntityFields, 'id', TestLoadParams>,
44
+ constructionUtils: EntityConstructionUtils<
45
+ RedisTestEntityFields,
46
+ 'id',
47
+ TestViewerContext,
48
+ RedisTestEntity,
49
+ RedisTestEntityPrivacyPolicy,
50
+ keyof RedisTestEntityFields
51
+ >,
52
+ private readonly entityLoader: AuthorizationResultBasedEntityLoader<
53
+ RedisTestEntityFields,
54
+ 'id',
55
+ TestViewerContext,
56
+ RedisTestEntity,
57
+ RedisTestEntityPrivacyPolicy,
58
+ keyof RedisTestEntityFields
59
+ >,
60
+ ) {
61
+ super(secondaryEntityCache, constructionUtils);
62
+ }
63
+
36
64
  protected async fetchObjectsFromDatabaseAsync(
37
65
  loadParamsArray: readonly Readonly<TestLoadParams>[],
38
66
  ): Promise<ReadonlyMap<Readonly<TestLoadParams>, Readonly<RedisTestEntityFields> | null>> {
@@ -44,11 +72,7 @@ class TestSecondaryRedisCacheLoader extends EntitySecondaryCacheLoader<
44
72
  return null;
45
73
  }
46
74
  return nullthrows(
47
- (
48
- await this.entityLoader.loadManyByFieldEqualityConjunctionAsync([
49
- { fieldName: 'id', fieldValue: loadParams.id },
50
- ])
51
- )[0],
75
+ (await this.entityLoader.loadManyByFieldEqualingAsync('id', loadParams.id))[0],
52
76
  )
53
77
  .enforceValue()
54
78
  .getAllFields();
@@ -97,6 +121,7 @@ describe(RedisSecondaryEntityCache, () => {
97
121
  genericRedisCacheContext,
98
122
  (loadParams) => `test-key-${loadParams.id}`,
99
123
  ),
124
+ EntitySecondaryCacheLoader.getConstructionUtilsForEntityClass(RedisTestEntity, viewerContext),
100
125
  RedisTestEntity.loaderWithAuthorizationResults(viewerContext),
101
126
  );
102
127
 
@@ -136,6 +161,7 @@ describe(RedisSecondaryEntityCache, () => {
136
161
  genericRedisCacheContext,
137
162
  (loadParams) => `test-key-${loadParams.id}`,
138
163
  ),
164
+ EntitySecondaryCacheLoader.getConstructionUtilsForEntityClass(RedisTestEntity, viewerContext),
139
165
  RedisTestEntity.loaderWithAuthorizationResults(viewerContext),
140
166
  );
141
167