@travetto/model-postgres 5.0.0-rc.0 → 5.0.0-rc.10

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
@@ -42,11 +42,12 @@ export class Init {
42
42
  }
43
43
  ```
44
44
 
45
- where the [SQLModelConfig](https://github.com/travetto/travetto/tree/main/module/model-sql/src/config.ts#L7) is defined by:
45
+ where the [SQLModelConfig](https://github.com/travetto/travetto/tree/main/module/model-sql/src/config.ts#L8) is defined by:
46
46
 
47
47
  **Code: Structure of SQLModelConfig**
48
48
  ```typescript
49
49
  import { Config } from '@travetto/config';
50
+ import { asFull } from '@travetto/runtime';
50
51
 
51
52
  /**
52
53
  * SQL Model Config
@@ -88,8 +89,7 @@ export class SQLModelConfig<T extends {} = {}> {
88
89
  /**
89
90
  * Raw client options
90
91
  */
91
-
92
- options: T = {} as T;
92
+ options: T = asFull({});
93
93
  }
94
94
  ```
95
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-postgres",
3
- "version": "5.0.0-rc.0",
3
+ "version": "5.0.0-rc.10",
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,16 +27,16 @@
27
27
  "directory": "module/model-postgres"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/config": "^5.0.0-rc.0",
31
- "@travetto/context": "^5.0.0-rc.0",
32
- "@travetto/model": "^5.0.0-rc.0",
33
- "@travetto/model-query": "^5.0.0-rc.0",
34
- "@travetto/model-sql": "^5.0.0-rc.0",
30
+ "@travetto/config": "^5.0.0-rc.10",
31
+ "@travetto/context": "^5.0.0-rc.9",
32
+ "@travetto/model": "^5.0.0-rc.10",
33
+ "@travetto/model-query": "^5.0.0-rc.10",
34
+ "@travetto/model-sql": "^5.0.0-rc.10",
35
35
  "@types/pg": "^8.11.6",
36
36
  "pg": "^8.12.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "@travetto/command": "^5.0.0-rc.0"
39
+ "@travetto/command": "^5.0.0-rc.9"
40
40
  },
41
41
  "peerDependenciesMeta": {
42
42
  "@travetto/command": {
package/src/connection.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Pool, PoolClient } from 'pg';
2
2
 
3
- import { ShutdownManager } from '@travetto/base';
3
+ import { castTo, ShutdownManager } from '@travetto/runtime';
4
4
  import { AsyncContext, WithAsyncContext } from '@travetto/context';
5
5
  import { ExistsError } from '@travetto/model';
6
6
 
@@ -33,8 +33,9 @@ export class PostgreSQLConnection extends Connection<PoolClient> {
33
33
  database: this.#config.database,
34
34
  host: this.#config.host,
35
35
  port: this.#config.port,
36
- // @ts-expect-error
37
- parseInputDatesAsUTC: true,
36
+ ...castTo({
37
+ parseInputDatesAsUTC: true,
38
+ }),
38
39
  ...(this.#config.options || {})
39
40
  });
40
41
 
package/src/dialect.ts CHANGED
@@ -2,7 +2,7 @@ import { FieldConfig } from '@travetto/schema';
2
2
  import { Injectable } from '@travetto/di';
3
3
  import { AsyncContext } from '@travetto/context';
4
4
  import { ModelType } from '@travetto/model';
5
- import { Class } from '@travetto/base';
5
+ import { castTo, Class } from '@travetto/runtime';
6
6
 
7
7
  import { SQLDialect, SQLModelConfig } from '@travetto/model-sql';
8
8
  import { SQLUtil, VisitStack } from '@travetto/model-sql/src/internal/util';
@@ -52,8 +52,7 @@ export class PostgreSQLDialect extends SQLDialect {
52
52
  * Define column modification
53
53
  */
54
54
  getModifyColumnSQL(stack: VisitStack[]): string {
55
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
56
- const field = stack[stack.length - 1] as FieldConfig;
55
+ const field: FieldConfig = castTo(stack[stack.length - 1]);
57
56
  const type = this.getColumnType(field);
58
57
  const ident = this.ident(field.name);
59
58
  return `ALTER TABLE ${this.parentTable(stack)} ALTER COLUMN ${ident} TYPE ${type} USING (${ident}::${type});`;