@typesql/postgres 0.2.9 → 0.2.11
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 +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/type-map.d.ts +1 -1
- package/dist/type-map.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +12 -6
- package/src/type-map.ts +4 -1
- package/CHANGELOG.md +0 -165
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ await sql.transaction(async (tx) => {
|
|
|
26
26
|
|
|
27
27
|
If your connection parses `int8` to `bigint` (`types: { bigint: postgres.BigInt }`), pass `{ bigint: true }` as the second argument of `createSql`.
|
|
28
28
|
|
|
29
|
-
[Open an example in the TypeScript Playground](https://www.typescriptlang.org/play/#code/
|
|
29
|
+
[Open an example in the TypeScript Playground](https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBDAnmApnA3nAwhANgGjgHEUA7FKAQxhQBNCA5AV110oCNc0BfOAMygQQcAEQABJKgDOAR1wB6AMbQU8yFJgBzKCikiA3AChQkWBjiKd1FAGU5cXgKGiJyXXLUQN23QePhoeEk0TDtcB35BYRF1LR09I2NSGig+SkU0ABEAIQxDAEgmKQopAC48-PzgWnKScioaWgAeEWBkgBYRAD4jSpQQSmBccpxcFpoADxhu3vzaYCkwNkQAfVJKEBRy5lYOLnGUKZmC-MsUa1oV6lqyCgvx0F0YDbAYAC9j-O5e2LKKqpqxFuDToLTaMAAHJ98pQmDAABbQFbVEZ4MEdaEwYAwLiosYiSbTHonZ6aP6jA5TADaAF1Pt9DNxDIZaChFGwdBYIKQNHBaOxymEjMoefBZOEALwWKw0MJNHJdAAU-IAlIkRbzfnApZQAO6DMVyRUFAAGNgAogAZc1YAAqcGqhCxOJQTsoZLgADEAEoAeQAsnAtQB1AAS5u95rgABIAIzauAAQQYAE04IrSVIVSb8AUROKRLmVQA6Q5suEoRVq5ms9mUTka+D87LATSCuRNTDsVvg8rdzTghzExtwfsJs7WOUK5XsFuaQhdnvJcowKBMHjVkfKJjJKQJvUG0et435M1Wm322EIpGOrk7mCKgBUKqTNjgpC9fsDWqIfoAqgACnA2RpleiJQMitA5oYJZlooFZVokB7YnA4rFqulA8ukWLcoqlBSIgpCKOmMATC+EpdBUyFBBMJ6noBmSJraUZaha9rOlwCZMGAqBQBm2JcC+YYRlGYE3rQCZxtBlQAOy5vksETOWNCIQUI4fjq+ooaRdEmpk57MZ+AZBl4MB7sJkYWPW8zrLg2KIBm7pZgmAAM0mKcpKA4PeqncNWhjioqZ7WnaDoST6xkhuGlmZnAYiUVJhD5nIIjVkAA) <span data-playground="postgres"></span> to hover the types and edit the SQL, with nothing to install.
|
|
30
30
|
|
|
31
31
|
## Documentation
|
|
32
32
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { RowKeys
|
|
1
|
+
import type { RowKeys } from "@typesql/core";
|
|
2
|
+
import { type TransactionalSql } from "@typesql/core/postgres";
|
|
2
3
|
import { type PostgresJsQueryable } from "./client.js";
|
|
3
4
|
import type { PostgresJsBigIntTypeMap, PostgresJsTypeMap } from "./type-map.js";
|
|
4
5
|
export { executor, type MigrationSource, migrate, type PostgresJsQueryable, type PostgresJsRows, type PostgresJsTransactable, } from "./client.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAc,gBAAgB,
|
|
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,K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wBAAgB,SAAS,CAAC,EAAE,EAC3B,GAAG,CAAC,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GAClE,aAAa,CAAC,EAAE,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createTransactionalSql } from "@typesql/core/adapter";
|
|
2
|
+
import { postgres, } from "@typesql/core/postgres";
|
|
2
3
|
import { driver } from "./client.js";
|
|
3
4
|
export { executor, migrate, } from "./client.js";
|
|
4
5
|
export function createSql(sql, options) {
|
|
5
|
-
return createTransactionalSql(sql, driver, options);
|
|
6
|
+
return createTransactionalSql(postgres, sql, driver, options);
|
|
6
7
|
}
|
|
7
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,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,
|
|
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"}
|
package/dist/type-map.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultParamTypeMap, DefaultTypeMap } from "@typesql/core";
|
|
1
|
+
import type { DefaultParamTypeMap, DefaultTypeMap } from "@typesql/core/postgres";
|
|
2
2
|
export interface PostgresJsTypeMap extends Omit<DefaultTypeMap, "bytea" | "interval" | "point" | "circle" | "record" | "void"> {
|
|
3
3
|
$params: PostgresJsParamTypeMap;
|
|
4
4
|
bytea: Buffer;
|
package/dist/type-map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-map.d.ts","sourceRoot":"","sources":["../src/type-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"type-map.d.ts","sourceRoot":"","sources":["../src/type-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,cAAc,EACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,iBAChB,SAAQ,IAAI,CACX,cAAc,EACd,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAC7D;IACD,OAAO,EAAE,sBAAsB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAChB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC;IACvE,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,WAAW,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,uBAChB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;CACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typesql/postgres",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
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.
|
|
31
|
+
"@typesql/core": "0.8.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"postgres": ">=3"
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type { RowKeys, SqlOptions
|
|
1
|
+
import type { RowKeys, SqlOptions } from "@typesql/core";
|
|
2
2
|
import { createTransactionalSql } from "@typesql/core/adapter";
|
|
3
|
+
import {
|
|
4
|
+
type Postgres,
|
|
5
|
+
postgres,
|
|
6
|
+
type TransactionalSql,
|
|
7
|
+
} from "@typesql/core/postgres";
|
|
3
8
|
import { driver, type PostgresJsQueryable } from "./client.js";
|
|
4
9
|
import type { PostgresJsBigIntTypeMap, PostgresJsTypeMap } from "./type-map.js";
|
|
5
10
|
|
|
@@ -47,9 +52,10 @@ export function createSql<DB>(
|
|
|
47
52
|
sql?: PostgresJsQueryable,
|
|
48
53
|
options?: PostgresJsSqlOptions,
|
|
49
54
|
): PostgresJsSql<DB, RowKeys, PostgresJsTypeMap | PostgresJsBigIntTypeMap> {
|
|
50
|
-
return createTransactionalSql<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
return createTransactionalSql<
|
|
56
|
+
Postgres,
|
|
57
|
+
DB,
|
|
58
|
+
PostgresJsTypeMap,
|
|
59
|
+
PostgresJsQueryable
|
|
60
|
+
>(postgres, sql, driver, options);
|
|
55
61
|
}
|
package/src/type-map.ts
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# @typesql/postgres
|
|
2
|
-
|
|
3
|
-
## 0.2.9
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Validate packages against PostgreSQL behavior and built outputs instead of hand-written test suites.
|
|
8
|
-
|
|
9
|
-
- Reorganize core internals and remove source comments and inline API documentation without changing SQL behavior.
|
|
10
|
-
|
|
11
|
-
- Updated dependencies:
|
|
12
|
-
- @typesql/core@0.7.6
|
|
13
|
-
|
|
14
|
-
## 0.2.8
|
|
15
|
-
|
|
16
|
-
### Patch Changes
|
|
17
|
-
|
|
18
|
-
- Updated dependencies:
|
|
19
|
-
- @typesql/core@0.7.5
|
|
20
|
-
|
|
21
|
-
## 0.2.7
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- Updated dependencies:
|
|
26
|
-
- @typesql/core@0.7.4
|
|
27
|
-
|
|
28
|
-
## 0.2.6
|
|
29
|
-
|
|
30
|
-
### Patch Changes
|
|
31
|
-
|
|
32
|
-
- Execute sql.prepare() queries with postgres.js prepared statements, including queries without parameters.
|
|
33
|
-
|
|
34
|
-
- Updated dependencies:
|
|
35
|
-
- @typesql/core@0.7.3
|
|
36
|
-
|
|
37
|
-
## 0.2.5
|
|
38
|
-
|
|
39
|
-
### Patch Changes
|
|
40
|
-
|
|
41
|
-
- Updated dependencies:
|
|
42
|
-
- @typesql/core@0.7.2
|
|
43
|
-
|
|
44
|
-
## 0.2.4
|
|
45
|
-
|
|
46
|
-
### Patch Changes
|
|
47
|
-
|
|
48
|
-
- Updated dependencies:
|
|
49
|
-
- @typesql/core@0.7.1
|
|
50
|
-
|
|
51
|
-
## 0.2.3
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Updated dependencies:
|
|
56
|
-
- @typesql/core@0.7.0
|
|
57
|
-
|
|
58
|
-
## 0.2.2
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- Build and type-check the package with `tsrs`.
|
|
63
|
-
|
|
64
|
-
- Updated dependencies:
|
|
65
|
-
- @typesql/core@0.6.1
|
|
66
|
-
|
|
67
|
-
## 0.2.1
|
|
68
|
-
|
|
69
|
-
### Patch Changes
|
|
70
|
-
|
|
71
|
-
- The README is shorter: install, one example and links to the docs site, which now has the details it used to repeat.
|
|
72
|
-
|
|
73
|
-
- Updated dependencies:
|
|
74
|
-
- @typesql/core@0.6.0
|
|
75
|
-
|
|
76
|
-
## 0.2.0
|
|
77
|
-
|
|
78
|
-
### Minor Changes
|
|
79
|
-
|
|
80
|
-
- `NoResultError`, `Executor` and `TransactionalSql` are no longer re-exported (from `@typesql/drizzle` also `Sql`, `Query`, `RowType`, `ParamsType`, `DefaultTypeMap` and `TypeMap`); import them from `@typesql/core`.
|
|
81
|
-
|
|
82
|
-
- `createBigIntSql(sql)` is replaced by `createSql(sql, { bigint: true })`, and `PostgresJsBigIntSql<DB, Keys>` by `PostgresJsSql<DB, Keys, PostgresJsBigIntTypeMap>`.
|
|
83
|
-
|
|
84
|
-
### Patch Changes
|
|
85
|
-
|
|
86
|
-
- The README's TypeScript Playground example uses `createSql(sql, { bigint: true })` instead of the removed `createBigIntSql`.
|
|
87
|
-
|
|
88
|
-
- Updated dependencies:
|
|
89
|
-
- @typesql/core@0.5.0
|
|
90
|
-
|
|
91
|
-
## 0.1.5
|
|
92
|
-
|
|
93
|
-
### Patch Changes
|
|
94
|
-
|
|
95
|
-
- Updated dependencies:
|
|
96
|
-
- @typesql/core@0.4.0
|
|
97
|
-
|
|
98
|
-
## 0.1.4
|
|
99
|
-
|
|
100
|
-
### Patch Changes
|
|
101
|
-
|
|
102
|
-
- Updated dependencies:
|
|
103
|
-
- @typesql/core@0.3.0
|
|
104
|
-
|
|
105
|
-
## 0.1.3
|
|
106
|
-
|
|
107
|
-
### Patch Changes
|
|
108
|
-
|
|
109
|
-
- Updated dependencies:
|
|
110
|
-
- @typesql/core@0.2.0
|
|
111
|
-
|
|
112
|
-
## 0.1.2
|
|
113
|
-
|
|
114
|
-
### Patch Changes
|
|
115
|
-
|
|
116
|
-
- npm package pages link to the documentation site and the issue tracker, and list keywords.
|
|
117
|
-
|
|
118
|
-
- READMEs link to an example in the TypeScript Playground.
|
|
119
|
-
|
|
120
|
-
- Updated dependencies:
|
|
121
|
-
- @typesql/core@0.1.2
|
|
122
|
-
|
|
123
|
-
## 0.1.1
|
|
124
|
-
|
|
125
|
-
### Patch Changes
|
|
126
|
-
|
|
127
|
-
- Docs, package descriptions and error messages spell the project name TypeSQL.
|
|
128
|
-
|
|
129
|
-
- Updated dependencies:
|
|
130
|
-
- @typesql/core@0.1.1
|
|
131
|
-
|
|
132
|
-
## 0.1.0
|
|
133
|
-
|
|
134
|
-
### Minor Changes
|
|
135
|
-
|
|
136
|
-
- Queries run from the `sql` bound to your client: `createSql<DB>(client)` then `sql("…").execute()` (or `executeTakeFirst`, `executeTakeFirstOrThrow`, `executeCount`), and `sql.transaction(async (tx) => …)` for transactions, nested with savepoints; the `query`, `one`, `maybeOne`, `many`, `execute`, `transaction` and `RowCountError` exports of `@typesql/pg` and `@typesql/postgres`, `query` and `execute` of `@typesql/kysely`, and `queryRaw` and `executeRaw` of `@typesql/prisma` are removed.
|
|
137
|
-
|
|
138
|
-
### Patch Changes
|
|
139
|
-
|
|
140
|
-
- The README links to the type map tables on the new node-postgres and postgres.js adapter pages of the docs.
|
|
141
|
-
|
|
142
|
-
- Updated dependencies:
|
|
143
|
-
- @typesql/core@0.1.0
|
|
144
|
-
|
|
145
|
-
## 0.0.4
|
|
146
|
-
|
|
147
|
-
### Patch Changes
|
|
148
|
-
|
|
149
|
-
- Queries have `executeCount()`, which resolves to the affected row count: an `Executor` may resolve to `{ rows, rowCount }` instead of the rows, as the `executor()` of `@typesql/pg`, `@typesql/postgres` and `@typesql/kysely` now do.
|
|
150
|
-
|
|
151
|
-
- `execute(db, q)` resolves to 0 instead of `null` for statements without a count, such as DDL, and `PostgresJsRows["count"]` is `number | null`.
|
|
152
|
-
|
|
153
|
-
- `createSql(executor, { rowKeys: "camelCase" })` (and the adapters' `createSql(client, { rowKeys: "camelCase" })`) camelCases the top-level row keys the way Kysely's `CamelCasePlugin` does, in the row types and in the rows `execute*` and the `query`/`one`/`maybeOne`/`many` helpers return, leaving JSON values untouched.
|
|
154
|
-
|
|
155
|
-
- The type maps declare what parameters accept (`PgParamTypeMap`, `PostgresJsParamTypeMap`), so `int8`/`numeric` parameters take numbers and bigints and timestamp parameters take strings; postgres.js timestamp parameters also take epoch milliseconds.
|
|
156
|
-
|
|
157
|
-
- Updated dependencies:
|
|
158
|
-
- @typesql/core@0.0.4
|
|
159
|
-
|
|
160
|
-
## 0.0.3
|
|
161
|
-
|
|
162
|
-
### Patch Changes
|
|
163
|
-
|
|
164
|
-
- Updated dependencies:
|
|
165
|
-
- @typesql/core@0.0.3
|