@travetto/model-mongo 8.0.0-alpha.0 → 8.0.0-alpha.1
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 -2
- package/package.json +5 -5
- package/src/config.ts +3 -1
- package/src/service.ts +3 -2
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ export class Init {
|
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
where the [MongoModelConfig](https://github.com/travetto/travetto/tree/main/module/model-mongo/src/config.ts#
|
|
46
|
+
where the [MongoModelConfig](https://github.com/travetto/travetto/tree/main/module/model-mongo/src/config.ts#L24) is defined by:
|
|
47
47
|
|
|
48
48
|
**Code: Structure of MongoModelConfig**
|
|
49
49
|
```typescript
|
|
@@ -104,7 +104,8 @@ export class MongoModelConfig {
|
|
|
104
104
|
/**
|
|
105
105
|
* Load all the ssl certs as needed
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
@PostConstruct()
|
|
108
|
+
async finalizeConfig(): Promise<void> {
|
|
108
109
|
if (this.connectionString) {
|
|
109
110
|
const details = new URL(this.connectionString);
|
|
110
111
|
this.hosts ??= details.hostname.split(',').filter(host => !!host);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-mongo",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Mongo backing for the travetto model module.",
|
|
6
6
|
"keywords": [
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"directory": "module/model-mongo"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^8.0.0-alpha.
|
|
30
|
-
"@travetto/model": "^8.0.0-alpha.
|
|
31
|
-
"@travetto/model-query": "^8.0.0-alpha.
|
|
29
|
+
"@travetto/config": "^8.0.0-alpha.1",
|
|
30
|
+
"@travetto/model": "^8.0.0-alpha.1",
|
|
31
|
+
"@travetto/model-query": "^8.0.0-alpha.1",
|
|
32
32
|
"mongodb": "^7.1.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
35
|
+
"@travetto/cli": "^8.0.0-alpha.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/cli": {
|
package/src/config.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type mongo from 'mongodb';
|
|
|
3
3
|
import { type TimeSpan, Runtime, RuntimeResources, BinaryUtil, CodecUtil, type BinaryType, type BinaryArray } from '@travetto/runtime';
|
|
4
4
|
import { Config } from '@travetto/config';
|
|
5
5
|
import { Field } from '@travetto/schema';
|
|
6
|
+
import { PostConstruct } from '@travetto/di';
|
|
6
7
|
|
|
7
8
|
const readCert = async (input: BinaryType | string): Promise<BinaryArray> => {
|
|
8
9
|
if (BinaryUtil.isBinaryType(input)) {
|
|
@@ -76,7 +77,8 @@ export class MongoModelConfig {
|
|
|
76
77
|
/**
|
|
77
78
|
* Load all the ssl certs as needed
|
|
78
79
|
*/
|
|
79
|
-
|
|
80
|
+
@PostConstruct()
|
|
81
|
+
async finalizeConfig(): Promise<void> {
|
|
80
82
|
if (this.connectionString) {
|
|
81
83
|
const details = new URL(this.connectionString);
|
|
82
84
|
this.hosts ??= details.hostname.split(',').filter(host => !!host);
|
package/src/service.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
ShutdownManager, type Class, type DeepPartial, TypedObject,
|
|
23
23
|
castTo, asFull, type BinaryMetadata, type ByteRange, type BinaryType, BinaryUtil, BinaryMetadataUtil,
|
|
24
24
|
} from '@travetto/runtime';
|
|
25
|
-
import { Injectable } from '@travetto/di';
|
|
25
|
+
import { Injectable, PostConstruct } from '@travetto/di';
|
|
26
26
|
|
|
27
27
|
import { MongoUtil, type PlainIdx, type WithId } from './internal/util.ts';
|
|
28
28
|
import type { MongoModelConfig } from './config.ts';
|
|
@@ -98,7 +98,8 @@ export class MongoModelService implements
|
|
|
98
98
|
return files[0];
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
@PostConstruct()
|
|
102
|
+
async initializeClient(): Promise<void> {
|
|
102
103
|
this.client = await MongoClient.connect(this.config.url, {
|
|
103
104
|
...this.config.connectionOptions,
|
|
104
105
|
useBigInt64: true,
|