@travetto/model-postgres 3.0.0-rc.3 → 3.0.0-rc.6
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 +7 -6
- package/{index.ts → __index__.ts} +0 -0
- package/package.json +19 -12
- package/src/connection.ts +2 -2
- package/support/service.postgresql.ts +3 -3
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-postgres/
|
|
2
|
+
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/model-postgres/DOC.ts and execute "npx trv doc" to rebuild -->
|
|
3
3
|
# PostgreSQL Model Service
|
|
4
4
|
## PostgreSQL backing for the travetto model module, with real-time modeling support for SQL schemas.
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ a [SQL](https://en.wikipedia.org/wiki/SQL) database. Every table generated will
|
|
|
16
16
|
Supported features:
|
|
17
17
|
|
|
18
18
|
* [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/service/crud.ts#L11)
|
|
19
|
-
* [Bulk](https://github.com/travetto/travetto/tree/main/module/model/src/service/bulk.ts#
|
|
19
|
+
* [Bulk](https://github.com/travetto/travetto/tree/main/module/model/src/service/bulk.ts#L19)
|
|
20
20
|
* [Query Crud](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/crud.ts#L11)
|
|
21
21
|
* [Facet](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/facet.ts#L12)
|
|
22
22
|
* [Query](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/query.ts#L10)
|
|
@@ -53,7 +53,7 @@ import { Config } from '@travetto/config';
|
|
|
53
53
|
* SQL Model Config
|
|
54
54
|
*/
|
|
55
55
|
@Config('model.sql')
|
|
56
|
-
export class SQLModelConfig {
|
|
56
|
+
export class SQLModelConfig<T extends {} = {}> {
|
|
57
57
|
/**
|
|
58
58
|
* Host to connect to
|
|
59
59
|
*/
|
|
@@ -89,9 +89,10 @@ export class SQLModelConfig {
|
|
|
89
89
|
/**
|
|
90
90
|
* Raw client options
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
options: T = {} as T;
|
|
93
94
|
}
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
Additionally, you can see that the class is registered with the [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#
|
|
97
|
-
standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "
|
|
97
|
+
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
|
|
98
|
+
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-postgres",
|
|
3
|
-
"
|
|
4
|
-
"version": "3.0.0-rc.3",
|
|
3
|
+
"version": "3.0.0-rc.6",
|
|
5
4
|
"description": "PostgreSQL backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"sql",
|
|
@@ -18,26 +17,34 @@
|
|
|
18
17
|
"name": "Travetto Framework"
|
|
19
18
|
},
|
|
20
19
|
"files": [
|
|
21
|
-
"
|
|
20
|
+
"__index__.ts",
|
|
22
21
|
"src",
|
|
23
22
|
"support"
|
|
24
23
|
],
|
|
25
|
-
"main": "
|
|
24
|
+
"main": "__index__.ts",
|
|
26
25
|
"repository": {
|
|
27
26
|
"url": "https://github.com/travetto/travetto.git",
|
|
28
27
|
"directory": "module/model-postgres"
|
|
29
28
|
},
|
|
30
29
|
"dependencies": {
|
|
31
|
-
"@travetto/config": "^3.0.0-rc.
|
|
32
|
-
"@travetto/context": "^3.0.0-rc.
|
|
33
|
-
"@travetto/model": "^3.0.0-rc.
|
|
34
|
-
"@travetto/model-
|
|
35
|
-
"@travetto/model-
|
|
36
|
-
"@types/pg": "^8.6.
|
|
30
|
+
"@travetto/config": "^3.0.0-rc.6",
|
|
31
|
+
"@travetto/context": "^3.0.0-rc.6",
|
|
32
|
+
"@travetto/model": "^3.0.0-rc.6",
|
|
33
|
+
"@travetto/model-query": "^3.0.0-rc.6",
|
|
34
|
+
"@travetto/model-sql": "^3.0.0-rc.6",
|
|
35
|
+
"@types/pg": "^8.6.6",
|
|
37
36
|
"pg": "^8.8.0"
|
|
38
37
|
},
|
|
39
|
-
"
|
|
40
|
-
"@travetto/
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@travetto/command": "^3.0.0-rc.4"
|
|
40
|
+
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"@travetto/command": {
|
|
43
|
+
"optional": true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"travetto": {
|
|
47
|
+
"displayName": "PostgreSQL Model Service"
|
|
41
48
|
},
|
|
42
49
|
"publishConfig": {
|
|
43
50
|
"access": "public"
|
package/src/connection.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import pg from 'pg';
|
|
2
2
|
|
|
3
3
|
import { ShutdownManager } from '@travetto/base';
|
|
4
4
|
import { AsyncContext, WithAsyncContext } from '@travetto/context';
|
|
@@ -44,7 +44,7 @@ export class PostgreSQLConnection extends Connection<pg.PoolClient> {
|
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
// Close postgres
|
|
47
|
-
ShutdownManager.onShutdown(this
|
|
47
|
+
ShutdownManager.onShutdown(this, () => this.#pool.end());
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async execute<T = unknown>(conn: pg.PoolClient, query: string): Promise<{ count: number, records: T[] }> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Service } from '@travetto/command/bin/
|
|
1
|
+
import { Env } from '@travetto/base';
|
|
2
|
+
import type { Service } from '@travetto/command/support/bin/service';
|
|
3
3
|
|
|
4
|
-
const version =
|
|
4
|
+
const version = Env.get('POSTGRESQL_VERSION', '12.2');
|
|
5
5
|
|
|
6
6
|
export const service: Service = {
|
|
7
7
|
name: 'postgresql',
|