@travetto/model-redis 6.0.0-rc.1 → 6.0.0-rc.2
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 +3 -8
- package/__index__.ts +2 -2
- package/package.json +4 -4
- package/src/service.ts +4 -8
package/README.md
CHANGED
|
@@ -16,9 +16,9 @@ yarn add @travetto/model-redis
|
|
|
16
16
|
This module provides an [redis](https://redis.io)-based implementation for the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations."). This source allows the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module to read, write and query against [redis](https://redis.io).
|
|
17
17
|
|
|
18
18
|
Supported features:
|
|
19
|
-
* [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/
|
|
20
|
-
* [Expiry](https://github.com/travetto/travetto/tree/main/module/model/src/
|
|
21
|
-
* [Indexed](https://github.com/travetto/travetto/tree/main/module/model/src/
|
|
19
|
+
* [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/types/crud.ts#L11)
|
|
20
|
+
* [Expiry](https://github.com/travetto/travetto/tree/main/module/model/src/types/expiry.ts#L10)
|
|
21
|
+
* [Indexed](https://github.com/travetto/travetto/tree/main/module/model/src/types/indexed.ts#L11)
|
|
22
22
|
Out of the box, by installing the module, everything should be wired up by default.If you need to customize any aspect of the source or config, you can override and register it with the [Dependency Injection](https://github.com/travetto/travetto/tree/main/module/di#readme "Dependency registration/management and injection support.") module.
|
|
23
23
|
|
|
24
24
|
**Code: Wiring up a custom Model Source**
|
|
@@ -40,11 +40,6 @@ where the [RedisModelConfig](https://github.com/travetto/travetto/tree/main/modu
|
|
|
40
40
|
|
|
41
41
|
**Code: Structure of RedisModelConfig**
|
|
42
42
|
```typescript
|
|
43
|
-
import type redis from 'redis';
|
|
44
|
-
|
|
45
|
-
import { Config } from '@travetto/config';
|
|
46
|
-
import { Field } from '@travetto/schema';
|
|
47
|
-
|
|
48
43
|
@Config('model.redis')
|
|
49
44
|
export class RedisModelConfig {
|
|
50
45
|
|
package/__index__.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './src/service';
|
|
2
|
-
export * from './src/config';
|
|
1
|
+
export * from './src/service.ts';
|
|
2
|
+
export * from './src/config.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-redis",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.2",
|
|
4
4
|
"description": "Redis backing for the travetto model module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"directory": "module/model-redis"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@travetto/cli": "^6.0.0-rc.
|
|
29
|
-
"@travetto/config": "^6.0.0-rc.
|
|
30
|
-
"@travetto/model": "^6.0.0-rc.
|
|
28
|
+
"@travetto/cli": "^6.0.0-rc.2",
|
|
29
|
+
"@travetto/config": "^6.0.0-rc.2",
|
|
30
|
+
"@travetto/model": "^6.0.0-rc.2",
|
|
31
31
|
"redis": "^4.7.0"
|
|
32
32
|
},
|
|
33
33
|
"travetto": {
|
package/src/service.ts
CHANGED
|
@@ -3,16 +3,12 @@ import { createClient } from 'redis';
|
|
|
3
3
|
import { ShutdownManager, type Class, type DeepPartial } from '@travetto/runtime';
|
|
4
4
|
import {
|
|
5
5
|
ModelCrudSupport, ModelExpirySupport, ModelRegistry, ModelType, ModelStorageSupport,
|
|
6
|
-
NotFoundError, ExistsError, ModelIndexedSupport, OptionalId
|
|
6
|
+
NotFoundError, ExistsError, ModelIndexedSupport, OptionalId,
|
|
7
|
+
ModelCrudUtil, ModelExpiryUtil, ModelIndexedUtil, ModelStorageUtil,
|
|
7
8
|
} from '@travetto/model';
|
|
8
9
|
import { Injectable } from '@travetto/di';
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
-
import { ModelExpiryUtil } from '@travetto/model/src/internal/service/expiry';
|
|
12
|
-
import { ModelIndexedUtil } from '@travetto/model/src/internal/service/indexed';
|
|
13
|
-
import { ModelStorageUtil } from '@travetto/model/src/internal/service/storage';
|
|
14
|
-
|
|
15
|
-
import { RedisModelConfig } from './config';
|
|
11
|
+
import { RedisModelConfig } from './config.ts';
|
|
16
12
|
|
|
17
13
|
type RedisScan = { key: string } | { match: string };
|
|
18
14
|
type RedisClient = ReturnType<typeof createClient>;
|
|
@@ -267,7 +263,7 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
|
|
|
267
263
|
}
|
|
268
264
|
|
|
269
265
|
// Expiry
|
|
270
|
-
async deleteExpired<T extends ModelType>(
|
|
266
|
+
async deleteExpired<T extends ModelType>(_cls: Class<T>): Promise<number> {
|
|
271
267
|
// Automatic
|
|
272
268
|
return -1;
|
|
273
269
|
}
|