@typesql/postgres 0.2.13 → 0.3.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/dist/index.d.ts CHANGED
@@ -1,24 +1,14 @@
1
- import type { RowKeys } from "@typesql/core";
1
+ import type { SqlPlugin } from "@typesql/core";
2
2
  import { type TransactionalSql } from "@typesql/core/postgres";
3
3
  import { type PostgresJsQueryable } from "./client.js";
4
4
  import type { PostgresJsBigIntTypeMap, PostgresJsTypeMap } from "./type-map.js";
5
5
  export { executor, type MigrationSource, migrate, type PostgresJsQueryable, type PostgresJsRows, type PostgresJsTransactable, } from "./client.js";
6
6
  export type { PostgresJsBigIntTypeMap, PostgresJsParamTypeMap, PostgresJsTypeMap, } from "./type-map.js";
7
- export type PostgresJsSql<DB, Keys extends RowKeys = "preserve", TM = PostgresJsTypeMap> = TransactionalSql<DB, TM, Keys>;
8
- export declare function createSql<DB>(sql: PostgresJsQueryable | undefined, options: {
9
- readonly rowKeys: "camelCase";
7
+ export type PostgresJsSql<DB, TM = PostgresJsTypeMap, Plugins extends readonly SqlPlugin[] = []> = TransactionalSql<DB, TM, Plugins>;
8
+ export declare function createSql<DB>(client: PostgresJsQueryable | undefined, options: {
10
9
  readonly bigint: true;
11
- }): PostgresJsSql<DB, "camelCase", PostgresJsBigIntTypeMap>;
12
- export declare function createSql<DB>(sql: PostgresJsQueryable | undefined, options: {
13
- readonly rowKeys?: "preserve";
14
- readonly bigint: true;
15
- }): PostgresJsSql<DB, "preserve", PostgresJsBigIntTypeMap>;
16
- export declare function createSql<DB>(sql: PostgresJsQueryable | undefined, options: {
17
- readonly rowKeys: "camelCase";
18
- readonly bigint?: false;
19
- }): PostgresJsSql<DB, "camelCase">;
20
- export declare function createSql<DB>(sql?: PostgresJsQueryable, options?: {
21
- readonly rowKeys?: "preserve";
10
+ }): PostgresJsSql<DB, PostgresJsBigIntTypeMap>;
11
+ export declare function createSql<DB>(client?: PostgresJsQueryable, options?: {
22
12
  readonly bigint?: false;
23
13
  }): PostgresJsSql<DB>;
24
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AAEzD,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAU,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEhF,OAAO,EACN,QAAQ,EACR,KAAK,eAAe,EACpB,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,sBAAsB,GAC3B,MAAM,aAAa,CAAC;AACrB,YAAY,EACX,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,GACjB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,aAAa,CACxB,EAAE,EACF,IAAI,SAAS,OAAO,GAAG,UAAU,EACjC,EAAE,GAAG,iBAAiB,IACnB,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAMnC,wBAAgB,SAAS,CAAC,EAAE,EAC3B,GAAG,EAAE,mBAAmB,GAAG,SAAS,EACpC,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GAC/D,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAC3D,wBAAgB,SAAS,CAAC,EAAE,EAC3B,GAAG,EAAE,mBAAmB,GAAG,SAAS,EACpC,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GAC/D,aAAa,CAAC,EA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CAAC,EAAE,EAC3B,MAAM,EAAE,mBAAmB,GAAG,SAAS,EACvC,OAAO,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GAChC,aAAa,CAAC,EAAE,EAAE,uBAAuB,CAAC,CAAC;AAC9C,wBAAgB,SAAS,CAAC,EAAE,EAC3B,MAAM,CAAC,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GACnC,aAAa,CAAC,EAAE,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { createTransactionalSql } from "@typesql/core/adapter";
2
2
  import { postgres, } from "@typesql/core/postgres";
3
3
  import { driver } from "./client.js";
4
4
  export { executor, migrate, } from "./client.js";
5
- export function createSql(sql, options) {
6
- return createTransactionalSql(postgres, sql, driver, options);
5
+ export function createSql(client, _options) {
6
+ return createTransactionalSql(postgres, client, driver);
7
7
  }
8
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAEN,QAAQ,GAER,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAA4B,MAAM,aAAa,CAAC;AAG/D,OAAO,EACN,QAAQ,EAER,OAAO,GAIP,MAAM,aAAa,CAAC;AAiCrB,MAAM,UAAU,SAAS,CACxB,GAAyB,EACzB,OAA8B;IAE9B,OAAO,sBAAsB,CAK3B,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAEN,QAAQ,GAER,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAA4B,MAAM,aAAa,CAAC;AAG/D,OAAO,EACN,QAAQ,EAER,OAAO,GAIP,MAAM,aAAa,CAAC;AAqBrB,MAAM,UAAU,SAAS,CACxB,MAA4B,EAC5B,QAAwC;IAExC,OAAO,sBAAsB,CAK3B,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typesql/postgres",
3
- "version": "0.2.13",
3
+ "version": "0.3.0",
4
4
  "description": "postgres.js adapter for TypeSQL.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@typesql/core": "0.9.1"
31
+ "@typesql/core": "0.10.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "postgres": ">=3"
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RowKeys, SqlOptions } from "@typesql/core";
1
+ import type { SqlPlugin } from "@typesql/core";
2
2
  import { createTransactionalSql } from "@typesql/core/adapter";
3
3
  import {
4
4
  type Postgres,
@@ -24,38 +24,26 @@ export type {
24
24
 
25
25
  export type PostgresJsSql<
26
26
  DB,
27
- Keys extends RowKeys = "preserve",
28
27
  TM = PostgresJsTypeMap,
29
- > = TransactionalSql<DB, TM, Keys>;
28
+ Plugins extends readonly SqlPlugin[] = [],
29
+ > = TransactionalSql<DB, TM, Plugins>;
30
30
 
31
- interface PostgresJsSqlOptions extends SqlOptions {
32
- readonly bigint?: boolean;
33
- }
34
-
35
- export function createSql<DB>(
36
- sql: PostgresJsQueryable | undefined,
37
- options: { readonly rowKeys: "camelCase"; readonly bigint: true },
38
- ): PostgresJsSql<DB, "camelCase", PostgresJsBigIntTypeMap>;
39
- export function createSql<DB>(
40
- sql: PostgresJsQueryable | undefined,
41
- options: { readonly rowKeys?: "preserve"; readonly bigint: true },
42
- ): PostgresJsSql<DB, "preserve", PostgresJsBigIntTypeMap>;
43
31
  export function createSql<DB>(
44
- sql: PostgresJsQueryable | undefined,
45
- options: { readonly rowKeys: "camelCase"; readonly bigint?: false },
46
- ): PostgresJsSql<DB, "camelCase">;
32
+ client: PostgresJsQueryable | undefined,
33
+ options: { readonly bigint: true },
34
+ ): PostgresJsSql<DB, PostgresJsBigIntTypeMap>;
47
35
  export function createSql<DB>(
48
- sql?: PostgresJsQueryable,
49
- options?: { readonly rowKeys?: "preserve"; readonly bigint?: false },
36
+ client?: PostgresJsQueryable,
37
+ options?: { readonly bigint?: false },
50
38
  ): PostgresJsSql<DB>;
51
39
  export function createSql<DB>(
52
- sql?: PostgresJsQueryable,
53
- options?: PostgresJsSqlOptions,
54
- ): PostgresJsSql<DB, RowKeys, PostgresJsTypeMap | PostgresJsBigIntTypeMap> {
40
+ client?: PostgresJsQueryable,
41
+ _options?: { readonly bigint?: boolean },
42
+ ): PostgresJsSql<DB, PostgresJsTypeMap | PostgresJsBigIntTypeMap> {
55
43
  return createTransactionalSql<
56
44
  Postgres,
57
45
  DB,
58
46
  PostgresJsTypeMap,
59
47
  PostgresJsQueryable
60
- >(postgres, sql, driver, options);
48
+ >(postgres, client, driver);
61
49
  }