@travetto/model-postgres 6.0.0-rc.1 → 6.0.0-rc.3

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 CHANGED
@@ -13,17 +13,18 @@ npm install @travetto/model-postgres
13
13
  yarn add @travetto/model-postgres
14
14
  ```
15
15
 
16
- This module provides a [Postgres](https://postgresql.org)-based implementation for the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module. 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 [SQL](https://en.wikipedia.org/wiki/SQL) databases. In development mode, the [SQLModelService](https://github.com/travetto/travetto/tree/main/module/model-sql/src/service.ts#L39) will also modify the database schema in real time to minimize impact to development.
16
+ This module provides a [Postgres](https://postgresql.org)-based implementation for the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module. 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 [SQL](https://en.wikipedia.org/wiki/SQL) databases. In development mode, the [SQLModelService](https://github.com/travetto/travetto/tree/main/module/model-sql/src/service.ts#L32) will also modify the database schema in real time to minimize impact to development.
17
17
 
18
18
  The schema generated will not generally map to existing tables as it is attempting to produce a document store like experience on top of a [SQL](https://en.wikipedia.org/wiki/SQL) database. Every table generated will have a `path_id` which determines it's location in the document hierarchy as well as sub tables will have a `parent_path_id` to associate records with the parent values.
19
19
 
20
20
  Supported features:
21
- * [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/service/crud.ts#L11)
22
- * [Bulk](https://github.com/travetto/travetto/tree/main/module/model/src/service/bulk.ts#L19)
23
- * [Query Crud](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/crud.ts#L11)
24
- * [Facet](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/facet.ts#L12)
25
- * [Query](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/query.ts#L10)
26
- * [Suggest](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/suggest.ts#L12)
21
+ * [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/types/crud.ts#L11)
22
+ * [Bulk](https://github.com/travetto/travetto/tree/main/module/model/src/types/bulk.ts#L64)
23
+ * [Query Crud](https://github.com/travetto/travetto/tree/main/module/model-query/src/types/crud.ts#L11)
24
+ * [Facet](https://github.com/travetto/travetto/tree/main/module/model-query/src/types/facet.ts#L14)
25
+ * [Query](https://github.com/travetto/travetto/tree/main/module/model-query/src/types/query.ts#L10)
26
+ * [Suggest](https://github.com/travetto/travetto/tree/main/module/model-query/src/types/suggest.ts#L12)
27
+
27
28
  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.
28
29
 
29
30
  **Code: Wiring up a custom Model Source**
@@ -46,12 +47,6 @@ where the [SQLModelConfig](https://github.com/travetto/travetto/tree/main/module
46
47
 
47
48
  **Code: Structure of SQLModelConfig**
48
49
  ```typescript
49
- import { Config } from '@travetto/config';
50
- import { asFull } from '@travetto/runtime';
51
-
52
- /**
53
- * SQL Model Config
54
- */
55
50
  @Config('model.sql')
56
51
  export class SQLModelConfig<T extends {} = {}> {
57
52
  /**
package/__index__.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './src/dialect';
2
- export * from './src/connection';
1
+ export * from './src/dialect.ts';
2
+ export * from './src/connection.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-postgres",
3
- "version": "6.0.0-rc.1",
3
+ "version": "6.0.0-rc.3",
4
4
  "description": "PostgreSQL backing for the travetto model module, with real-time modeling support for SQL schemas.",
5
5
  "keywords": [
6
6
  "sql",
@@ -27,14 +27,14 @@
27
27
  "directory": "module/model-postgres"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/cli": "^6.0.0-rc.1",
31
- "@travetto/config": "^6.0.0-rc.1",
32
- "@travetto/context": "^6.0.0-rc.1",
33
- "@travetto/model": "^6.0.0-rc.1",
34
- "@travetto/model-query": "^6.0.0-rc.1",
35
- "@travetto/model-sql": "^6.0.0-rc.1",
36
- "@types/pg": "^8.11.11",
37
- "pg": "^8.13.1"
30
+ "@travetto/cli": "^6.0.0-rc.3",
31
+ "@travetto/config": "^6.0.0-rc.2",
32
+ "@travetto/context": "^6.0.0-rc.2",
33
+ "@travetto/model": "^6.0.0-rc.2",
34
+ "@travetto/model-query": "^6.0.0-rc.2",
35
+ "@travetto/model-sql": "^6.0.0-rc.3",
36
+ "@types/pg": "^8.11.14",
37
+ "pg": "^8.15.5"
38
38
  },
39
39
  "travetto": {
40
40
  "displayName": "PostgreSQL Model Service"
package/src/connection.ts CHANGED
@@ -3,7 +3,6 @@ import { type Pool, type PoolClient, default as pg } from 'pg';
3
3
  import { castTo, ShutdownManager } from '@travetto/runtime';
4
4
  import { AsyncContext, WithAsyncContext } from '@travetto/context';
5
5
  import { ExistsError } from '@travetto/model';
6
-
7
6
  import { SQLModelConfig, Connection } from '@travetto/model-sql';
8
7
 
9
8
  /**
package/src/dialect.ts CHANGED
@@ -4,10 +4,9 @@ import { AsyncContext } from '@travetto/context';
4
4
  import { ModelType } from '@travetto/model';
5
5
  import { castTo, Class } from '@travetto/runtime';
6
6
 
7
- import { SQLDialect, SQLModelConfig } from '@travetto/model-sql';
8
- import { SQLUtil, VisitStack } from '@travetto/model-sql/src/internal/util';
7
+ import { SQLDialect, SQLModelConfig, SQLModelUtil, VisitStack } from '@travetto/model-sql';
9
8
 
10
- import { PostgreSQLConnection } from './connection';
9
+ import { PostgreSQLConnection } from './connection.ts';
11
10
 
12
11
  /**
13
12
  * Postgresql Dialect for the SQL Model Source
@@ -62,6 +61,6 @@ export class PostgreSQLDialect extends SQLDialect {
62
61
  * Suppress foreign key checks
63
62
  */
64
63
  override getTruncateAllTablesSQL<T extends ModelType>(cls: Class<T>): string[] {
65
- return [`TRUNCATE ${this.table(SQLUtil.classToStack(cls))} CASCADE;`];
64
+ return [`TRUNCATE ${this.table(SQLModelUtil.classToStack(cls))} CASCADE;`];
66
65
  }
67
66
  }