@travetto/model-redis 3.0.0-rc.1 → 3.0.0-rc.11

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <!-- This file was generated by @travetto/doc and should not be modified directly -->
2
- <!-- Please modify https://github.com/travetto/travetto/tree/main/module/model-redis/doc.ts and execute "npx trv doc" to rebuild -->
2
+ <!-- Please modify https://github.com/travetto/travetto/tree/main/module/model-redis/DOC.ts and execute "npx trv doc" to rebuild -->
3
3
  # Redis Model Support
4
4
  ## Redis backing for the travetto model module.
5
5
 
@@ -40,7 +40,7 @@ export class Init {
40
40
 
41
41
  **Code: Structure of RedisModelConfig**
42
42
  ```typescript
43
- import * as redis from 'redis';
43
+ import type redis from 'redis';
44
44
 
45
45
  import { Config } from '@travetto/config';
46
46
  import { Field } from '@travetto/schema';
@@ -59,5 +59,5 @@ export class RedisModelConfig {
59
59
  }
60
60
  ```
61
61
 
62
- Additionally, you can see that the class is registered with the [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L9) annotation, and so these values can be overridden using the
63
- standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Environment-aware config management using yaml files")resolution paths.
62
+ Additionally, you can see that the class is registered with the [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) annotation, and so these values can be overridden using the
63
+ standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Configuration support")resolution paths.
File without changes
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-redis",
3
- "displayName": "Redis Model Support",
4
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.0-rc.11",
5
4
  "description": "Redis backing for the travetto model module.",
6
5
  "keywords": [
7
6
  "typescript",
@@ -16,19 +15,30 @@
16
15
  "name": "Travetto Framework"
17
16
  },
18
17
  "files": [
19
- "index.ts",
18
+ "__index__.ts",
20
19
  "src",
21
20
  "support"
22
21
  ],
23
- "main": "index.ts",
22
+ "main": "__index__.ts",
24
23
  "repository": {
25
24
  "url": "https://github.com/travetto/travetto.git",
26
25
  "directory": "module/model-redis"
27
26
  },
28
27
  "dependencies": {
29
- "@travetto/config": "^3.0.0-rc.1",
30
- "@travetto/model": "^3.0.0-rc.1",
31
- "redis": "^4.3.0"
28
+ "@travetto/config": "^3.0.0-rc.11",
29
+ "@travetto/model": "^3.0.0-rc.11",
30
+ "redis": "^4.6.4"
31
+ },
32
+ "peerDependencies": {
33
+ "@travetto/command": "^3.0.0-rc.8"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "@travetto/command": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "travetto": {
41
+ "displayName": "Redis Model Support"
32
42
  },
33
43
  "publishConfig": {
34
44
  "access": "public"
package/src/config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as redis from 'redis';
1
+ import type redis from 'redis';
2
2
 
3
3
  import { Config } from '@travetto/config';
4
4
  import { Field } from '@travetto/schema';
package/src/service.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as redis from 'redis';
2
2
 
3
- import { Class, ShutdownManager, Util } from '@travetto/base';
3
+ import { ShutdownManager, type Class } from '@travetto/base';
4
4
  import { DeepPartial } from '@travetto/schema';
5
5
  import {
6
6
  ModelCrudSupport, ModelExpirySupport, ModelRegistry, ModelType, ModelStorageSupport,
@@ -12,6 +12,7 @@ import { ModelCrudUtil } from '@travetto/model/src/internal/service/crud';
12
12
  import { ModelExpiryUtil } from '@travetto/model/src/internal/service/expiry';
13
13
  import { ModelIndexedUtil } from '@travetto/model/src/internal/service/indexed';
14
14
  import { ModelStorageUtil } from '@travetto/model/src/internal/service/storage';
15
+ import { ModelUtil } from '@travetto/model/src/internal/util';
15
16
 
16
17
  import { RedisModelConfig } from './config';
17
18
 
@@ -175,12 +176,12 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
175
176
  this.client = redis.createClient(this.config.client);
176
177
  await this.client.connect();
177
178
  await ModelStorageUtil.registerModelChangeListener(this);
178
- ShutdownManager.onShutdown(this.constructor.ᚕid, () => this.client.disconnect());
179
+ ShutdownManager.onShutdown(this, () => this.client.disconnect());
179
180
  for (const el of ModelRegistry.getClasses()) {
180
181
  for (const idx of ModelRegistry.get(el).indices ?? []) {
181
182
  switch (idx.type) {
182
183
  case 'unique': {
183
- console.error('Unique indices are not supported in redis for', { cls: el.ᚕid, idx: idx.name });
184
+ console.error('Unique indices are not supported in redis for', { cls: el.Ⲑid, idx: idx.name });
184
185
  break;
185
186
  }
186
187
  }
@@ -189,7 +190,7 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
189
190
  }
190
191
 
191
192
  uuid(): string {
192
- return Util.uuid(32);
193
+ return ModelUtil.uuid(32);
193
194
  }
194
195
 
195
196
  async has<T extends ModelType>(cls: Class<T>, id: string, error?: 'notfound' | 'data'): Promise<void> {
@@ -1,9 +1,9 @@
1
- import { EnvUtil } from '@travetto/boot';
2
- import type { Service } from '@travetto/command/bin/lib/service';
1
+ import { Env } from '@travetto/base';
2
+ import type { CommandService } from '@travetto/command';
3
3
 
4
- const version = EnvUtil.get('TRV_SERVICE_REDIS', '5');
4
+ const version = Env.get('REDIS_VERSION', '7');
5
5
 
6
- export const service: Service = {
6
+ export const service: CommandService = {
7
7
  name: 'redis',
8
8
  version,
9
9
  port: 6379,