@travetto/model-redis 8.0.0-alpha.13 → 8.0.0-alpha.14

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/service.ts +7 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-redis",
3
- "version": "8.0.0-alpha.13",
3
+ "version": "8.0.0-alpha.14",
4
4
  "type": "module",
5
5
  "description": "Redis backing for the travetto model module.",
6
6
  "keywords": [
@@ -29,7 +29,7 @@
29
29
  "@redis/client": "^5.11.0",
30
30
  "@travetto/config": "^8.0.0-alpha.12",
31
31
  "@travetto/model": "^8.0.0-alpha.12",
32
- "@travetto/model-indexed": "^8.0.0-alpha.13"
32
+ "@travetto/model-indexed": "^8.0.0-alpha.14"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@travetto/cli": "^8.0.0-alpha.17"
package/src/service.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  type ModelIndexedSupport, type KeyedIndexSelection, type KeyedIndexBody, type ModelPageOptions, ModelIndexedUtil,
11
11
  type SingleItemIndex, type SortedIndexSelection, type ModelPageResult, type SortedIndex, isModelIndexedIndex,
12
12
  type FullKeyedIndexWithPartialBody, type FullKeyedIndexBody, ModelIndexedComputedIndex,
13
+ warnIfIndexedUniqueIndex, warnIfNonIndexedIndex,
13
14
  } from '@travetto/model-indexed';
14
15
 
15
16
  import { Injectable, PostConstruct } from '@travetto/di';
@@ -250,11 +251,8 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
250
251
  await ModelStorageUtil.storageInitialization(this);
251
252
  ShutdownManager.signal.addEventListener('abort', () => this.client.close());
252
253
  for (const cls of ModelRegistryIndex.getClasses()) {
253
- for (const idx of ModelRegistryIndex.getIndices(cls)) {
254
- if (!isModelIndexedIndex(idx) || ('unique' in idx && idx.unique)) {
255
- console.warn('Non-indexed indices are not supported in redis for', { cls: cls.Ⲑid, idx: idx.name });
256
- }
257
- }
254
+ warnIfIndexedUniqueIndex(this, cls, ModelRegistryIndex.getIndices(cls));
255
+ warnIfNonIndexedIndex(this, cls, ModelRegistryIndex.getIndices(cls));
258
256
  }
259
257
  }
260
258
 
@@ -328,7 +326,10 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
328
326
 
329
327
  // Storage
330
328
  async createStorage(): Promise<void> {
331
- // Do nothing
329
+ for (const cls of ModelRegistryIndex.getClasses()) {
330
+ warnIfIndexedUniqueIndex(this, cls, ModelRegistryIndex.getIndices(cls));
331
+ warnIfNonIndexedIndex(this, cls, ModelRegistryIndex.getIndices(cls));
332
+ }
332
333
  }
333
334
 
334
335
  async deleteStorage(): Promise<void> {