@travetto/model-mongo 3.4.5 → 4.0.0-rc.0
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 +4 -5
- package/package.json +5 -5
- package/src/config.ts +3 -4
- package/src/service.ts +2 -2
- package/support/service.mongo.ts +1 -2
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ where the [MongoModelConfig](https://github.com/travetto/travetto/tree/main/modu
|
|
|
48
48
|
```typescript
|
|
49
49
|
import type mongo from 'mongodb';
|
|
50
50
|
|
|
51
|
-
import {
|
|
51
|
+
import { RuntimeResources, Env, TimeSpan } from '@travetto/base';
|
|
52
52
|
import { Config } from '@travetto/config';
|
|
53
53
|
import { Field } from '@travetto/schema';
|
|
54
54
|
|
|
@@ -111,8 +111,7 @@ export class MongoModelConfig {
|
|
|
111
111
|
* Load all the ssl certs as needed
|
|
112
112
|
*/
|
|
113
113
|
async postConstruct(): Promise<void> {
|
|
114
|
-
const
|
|
115
|
-
const resolve = (file: string): Promise<string> => resources.resolve(file).then(v => v, () => file);
|
|
114
|
+
const resolve = (file: string): Promise<string> => RuntimeResources.resolve(file).then(v => v, () => file);
|
|
116
115
|
|
|
117
116
|
if (this.connectionString) {
|
|
118
117
|
const details = new URL(this.connectionString);
|
|
@@ -152,7 +151,7 @@ export class MongoModelConfig {
|
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
if (
|
|
154
|
+
if (!Env.production) {
|
|
156
155
|
opts.waitQueueTimeoutMS ??= 1000 * 60 * 60 * 24; // Wait a day in dev mode
|
|
157
156
|
}
|
|
158
157
|
}
|
|
@@ -175,4 +174,4 @@ export class MongoModelConfig {
|
|
|
175
174
|
}
|
|
176
175
|
```
|
|
177
176
|
|
|
178
|
-
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 standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Configuration support") resolution paths.The SSL file options in `clientOptions` will automatically be resolved to files when given a path. This path can be a [ResourceLoader](https://github.com/travetto/travetto/tree/main/module/base/src/resource.ts#
|
|
177
|
+
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 standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Configuration support") resolution paths.The SSL file options in `clientOptions` will automatically be resolved to files when given a path. This path can be a [ResourceLoader](https://github.com/travetto/travetto/tree/main/module/base/src/resource.ts#L10) path or just a standard file path.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-mongo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.0",
|
|
4
4
|
"description": "Mongo backing for the travetto model module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mongo",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"directory": "module/model-mongo"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@travetto/config": "^
|
|
29
|
-
"@travetto/model": "^
|
|
30
|
-
"@travetto/model-query": "^
|
|
28
|
+
"@travetto/config": "^4.0.0-rc.0",
|
|
29
|
+
"@travetto/model": "^4.0.0-rc.0",
|
|
30
|
+
"@travetto/model-query": "^4.0.0-rc.0",
|
|
31
31
|
"mongodb": "^6.3.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/command": "^
|
|
34
|
+
"@travetto/command": "^4.0.0-rc.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@travetto/command": {
|
package/src/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type mongo from 'mongodb';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { RuntimeResources, Env, TimeSpan } from '@travetto/base';
|
|
4
4
|
import { Config } from '@travetto/config';
|
|
5
5
|
import { Field } from '@travetto/schema';
|
|
6
6
|
|
|
@@ -63,8 +63,7 @@ export class MongoModelConfig {
|
|
|
63
63
|
* Load all the ssl certs as needed
|
|
64
64
|
*/
|
|
65
65
|
async postConstruct(): Promise<void> {
|
|
66
|
-
const
|
|
67
|
-
const resolve = (file: string): Promise<string> => resources.resolve(file).then(v => v, () => file);
|
|
66
|
+
const resolve = (file: string): Promise<string> => RuntimeResources.resolve(file).then(v => v, () => file);
|
|
68
67
|
|
|
69
68
|
if (this.connectionString) {
|
|
70
69
|
const details = new URL(this.connectionString);
|
|
@@ -104,7 +103,7 @@ export class MongoModelConfig {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
if (
|
|
106
|
+
if (!Env.production) {
|
|
108
107
|
opts.waitQueueTimeoutMS ??= 1000 * 60 * 60 * 24; // Wait a day in dev mode
|
|
109
108
|
}
|
|
110
109
|
}
|
package/src/service.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Wildcard import needed here due to packaging issues
|
|
2
2
|
import * as mongo from 'mongodb';
|
|
3
|
-
import { Readable } from 'stream';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
ModelRegistry, ModelType, OptionalId,
|
|
@@ -79,7 +79,7 @@ export class MongoModelService implements
|
|
|
79
79
|
writeConcern: { w: 1 }
|
|
80
80
|
});
|
|
81
81
|
await ModelStorageUtil.registerModelChangeListener(this);
|
|
82
|
-
ShutdownManager.
|
|
82
|
+
ShutdownManager.onGracefulShutdown(() => this.client.close(), this);
|
|
83
83
|
ModelExpiryUtil.registerCull(this);
|
|
84
84
|
}
|
|
85
85
|
|
package/support/service.mongo.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Env } from '@travetto/base';
|
|
2
1
|
import type { CommandService } from '@travetto/command';
|
|
3
2
|
|
|
4
|
-
const version =
|
|
3
|
+
const version = process.env.MONGO_VERSION ?? '7.0';
|
|
5
4
|
|
|
6
5
|
export const service: CommandService = {
|
|
7
6
|
name: 'mongodb',
|