@travetto/model-redis 8.0.0-alpha.0 → 8.0.0-alpha.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/package.json +4 -4
- package/src/service.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-redis",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Redis backing for the travetto model module.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@redis/client": "^5.11.0",
|
|
30
|
-
"@travetto/config": "^8.0.0-alpha.
|
|
31
|
-
"@travetto/model": "^8.0.0-alpha.
|
|
30
|
+
"@travetto/config": "^8.0.0-alpha.2",
|
|
31
|
+
"@travetto/model": "^8.0.0-alpha.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
34
|
+
"@travetto/cli": "^8.0.0-alpha.3"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
NotFoundError, ExistsError, type ModelIndexedSupport, type OptionalId,
|
|
7
7
|
ModelCrudUtil, ModelExpiryUtil, ModelIndexedUtil, ModelStorageUtil,
|
|
8
8
|
} from '@travetto/model';
|
|
9
|
-
import { Injectable } from '@travetto/di';
|
|
9
|
+
import { Injectable, PostConstruct } from '@travetto/di';
|
|
10
10
|
|
|
11
11
|
import type { RedisModelConfig } from './config.ts';
|
|
12
12
|
|
|
@@ -167,11 +167,12 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
|
|
|
167
167
|
throw new NotFoundError(`${cls.name}: ${idx}`, key);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
@PostConstruct()
|
|
171
|
+
async initializeClient(): Promise<void> {
|
|
171
172
|
this.client = createClient(this.config.client);
|
|
172
173
|
await this.client.connect();
|
|
173
174
|
await ModelStorageUtil.storageInitialization(this);
|
|
174
|
-
ShutdownManager.signal.addEventListener('abort', () => this.client.
|
|
175
|
+
ShutdownManager.signal.addEventListener('abort', () => this.client.close());
|
|
175
176
|
for (const cls of ModelRegistryIndex.getClasses()) {
|
|
176
177
|
for (const idx of ModelRegistryIndex.getConfig(cls).indices ?? []) {
|
|
177
178
|
switch (idx.type) {
|