okmodel 0.7.0 → 0.9.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/README.md +14 -0
- package/dist/adapters/capabilities.d.ts +32 -0
- package/dist/adapters/failure.d.ts +1 -1
- package/dist/adapters/pg/bun-sql.d.ts +53 -0
- package/dist/adapters/pg/bunsql-extra.d.ts +1 -1
- package/dist/adapters/pg/bunsql.d.ts +1 -1
- package/dist/adapters/pg/neon-extra.d.ts +18 -0
- package/dist/adapters/pg/neon.d.ts +104 -0
- package/dist/adapters/pg/no-inflight-timeout.d.ts +1 -1
- package/dist/contracts/error.d.ts +1 -1
- package/dist/dialects/pg/ext/btree-gin.d.ts +26 -0
- package/dist/dialects/pg/ext/btree-gin.js +20 -0
- package/dist/dialects/pg/ext/btree-gist.d.ts +26 -0
- package/dist/dialects/pg/ext/btree-gist.js +20 -0
- package/dist/dialects/pg/ext/call.d.ts +53 -0
- package/dist/dialects/pg/ext/citext.js +1 -1
- package/dist/dialects/pg/ext/feature.d.ts +26 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.d.ts +34 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.js +33 -0
- package/dist/dialects/pg/ext/hstore.d.ts +41 -0
- package/dist/dialects/pg/ext/hstore.js +29 -0
- package/dist/dialects/pg/ext/index.d.ts +56 -0
- package/dist/dialects/pg/ext/index.js +1 -1
- package/dist/dialects/pg/ext/ltree.d.ts +41 -0
- package/dist/dialects/pg/ext/ltree.js +29 -0
- package/dist/dialects/pg/ext/pg-trgm.js +4 -13
- package/dist/dialects/pg/ext/pgcrypto.d.ts +33 -0
- package/dist/dialects/pg/ext/pgcrypto.js +33 -0
- package/dist/dialects/pg/ext/unaccent.d.ts +26 -0
- package/dist/dialects/pg/ext/unaccent.js +21 -0
- package/dist/dialects/pg/ext/using.d.ts +23 -0
- package/dist/dialects/pg/ext/versions.d.ts +36 -0
- package/dist/dialects/pg/external.d.ts +19 -0
- package/dist/dialects/pg/fn/index.d.ts +39 -1
- package/dist/dialects/pg/fn/index.js +118 -26
- package/dist/dialects/pg/index.d.ts +3 -0
- package/dist/dialects/pg/index.js +394 -14
- package/dist/dialects/pg/introspect.d.ts +11 -0
- package/dist/dialects/pg/operators.d.ts +1 -1
- package/dist/dialects/pg/ops/fragment.d.ts +119 -0
- package/dist/dialects/pg/ops/lane.d.ts +49 -0
- package/dist/dialects/pg/view/client.d.ts +14 -6
- package/dist/dialects/pg/view/index.d.ts +73 -1
- package/dist/dialects/pg/view/index.js +156 -5
- package/dist/dialects/pg/view/scratch.d.ts +11 -5
- package/dist/runtime/artifact-file.d.ts +22 -0
- package/dist/runtime/client.d.ts +10 -0
- package/dist/runtime/drift-detail.d.ts +2 -1
- package/dist/runtime/drift.d.ts +3 -10
- package/dist/runtime/otel.d.ts +105 -0
- package/dist/runtime/otel.js +97 -0
- package/dist/runtime/pg/bun.js +4 -4
- package/dist/runtime/pg/neon.d.ts +38 -0
- package/dist/runtime/pg/neon.js +64 -0
- package/dist/runtime/pg/pg.js +4 -4
- package/dist/runtime/pg/pglite.js +4 -4
- package/dist/runtime/pg/postgresjs.js +4 -4
- package/dist/runtime/plan.d.ts +1 -1
- package/dist/runtime/server-check.d.ts +36 -6
- package/dist/runtime/sql-fragment.d.ts +43 -0
- package/dist/runtime/tenancy/index.js +10 -10
- package/dist/runtime/topology.d.ts +1 -1
- package/dist/runtime/traits/index.js +16 -17
- package/dist/runtime/types.d.ts +15 -1
- package/dist/runtime/validate/index.js +4 -4
- package/dist/shared/{81ebdx9p.js → 0j6qe91y.js} +4 -4
- package/dist/shared/{qq3899ht.js → 12z7aznj.js} +243 -14
- package/dist/shared/{gzaveazc.js → 1d9q9cv2.js} +29 -2
- package/dist/shared/{w79hsckn.js → 1mxm04fy.js} +5 -5
- package/dist/shared/{7k9grvf6.js → 2szgv6yj.js} +5 -5
- package/dist/shared/{gs74dbj5.js → 2zdxkt7b.js} +933 -111
- package/dist/shared/{m6p12kbr.js → 3456242y.js} +23 -23
- package/dist/shared/3bb7wsqt.js +99 -0
- package/dist/shared/{y6njgyda.js → 3t6kw83m.js} +2 -2
- package/dist/shared/{xhfsfkgk.js → 4vbf83xx.js} +9 -2
- package/dist/shared/{pt94kz7f.js → 5kyb3tqx.js} +1 -1
- package/dist/shared/61bmrmhr.js +35 -0
- package/dist/shared/{x933k9a3.js → 62b603gr.js} +10 -10
- package/dist/shared/{jgqj11w4.js → 6f0z3hzh.js} +4 -0
- package/dist/shared/{tsvww22q.js → 6nae0spm.js} +156 -95
- package/dist/shared/{mtaszv5a.js → 71n0jmhc.js} +102 -4
- package/dist/shared/{5e3tf63j.js → 760ppr76.js} +14 -6
- package/dist/shared/7ba5h6pb.js +17 -0
- package/dist/shared/{sfz1ksn6.js → 8jesqsrk.js} +2 -2
- package/dist/shared/{5v3xf80k.js → 8n688yjg.js} +1 -1
- package/dist/shared/{rs73fca9.js → 8qzkd9f3.js} +6 -6
- package/dist/shared/{ax7qv55k.js → 90sg0w5a.js} +202 -25
- package/dist/shared/{zm0ptry0.js → 99qp9vtg.js} +1 -1
- package/dist/shared/{xnxsed62.js → 9dr2qnx7.js} +14 -14
- package/dist/shared/{1w508jbr.js → 9dtgn1z2.js} +21 -17
- package/dist/shared/{h15jx9bc.js → 9dvh1dr6.js} +1 -1
- package/dist/shared/{q5c6ngn3.js → a62rb2da.js} +1 -1
- package/dist/shared/{te5as7z7.js → aksb89mn.js} +3 -3
- package/dist/shared/{bz84tkzm.js → bphrgwz9.js} +2 -2
- package/dist/shared/bsek72fg.js +225 -0
- package/dist/shared/{7mnme5tn.js → c3mvnq7a.js} +1 -1
- package/dist/shared/{p6qc5gcp.js → ccsmhv9r.js} +25 -7
- package/dist/shared/{pbp1ss85.js → cexb7z6b.js} +2 -2
- package/dist/shared/{ab9gmbwy.js → cf8zdz5p.js} +5 -5
- package/dist/shared/{jvd0mqag.js → ckz05z15.js} +5 -5
- package/dist/shared/{dk8v79p3.js → d5nmj7vv.js} +1 -1
- package/dist/shared/{14vx95q4.js → dd5pmnky.js} +7 -7
- package/dist/shared/{vb6qfyve.js → ds229x4r.js} +2 -2
- package/dist/shared/{1qa0qajz.js → e275q7sd.js} +1 -1
- package/dist/shared/{zp9fmend.js → ebhz8vh6.js} +4 -4
- package/dist/shared/{hyh73qk6.js → ecn8mfdq.js} +5 -5
- package/dist/shared/{je4axnm8.js → fdsz3w80.js} +2 -2
- package/dist/shared/{9s0ypp87.js → fk9vef30.js} +85 -74
- package/dist/shared/{g6evj1j3.js → g89fmz5s.js} +1 -1
- package/dist/shared/{aytqh5y2.js → ghqzdp94.js} +2 -2
- package/dist/shared/h9811jjm.js +17 -0
- package/dist/shared/{dkxgzaqd.js → hqpxf4a4.js} +1 -1
- package/dist/shared/{8skf0cam.js → jpybhf98.js} +1 -1
- package/dist/shared/{67txcrcw.js → kgwp4jdd.js} +4 -4
- package/dist/shared/kzgrnckd.js +29 -0
- package/dist/shared/mazpbcdj.js +233 -0
- package/dist/shared/{kb2sdhfb.js → mfvx6kjx.js} +17 -1
- package/dist/shared/{svncdeh5.js → mgaq2sd3.js} +11 -8
- package/dist/shared/{5mtf6cj3.js → mvmm3xpb.js} +5 -2
- package/dist/shared/{b5pftnn2.js → myk8fswx.js} +66 -21
- package/dist/shared/{2shdbn8q.js → n306gqkd.js} +9 -9
- package/dist/shared/{n816peh1.js → n454kcnw.js} +1 -1
- package/dist/shared/n5whk3mt.js +665 -0
- package/dist/shared/n7kg8mmx.js +61 -0
- package/dist/shared/{vqrjpcqn.js → nmnsgj7x.js} +1 -1
- package/dist/shared/{tbrvgw6z.js → npdftanb.js} +19 -26
- package/dist/shared/{ek2wt2dz.js → pg4ezgyf.js} +11 -30
- package/dist/shared/{5fe3kbsh.js → pgsak1yw.js} +1 -1
- package/dist/shared/{bm22fvzr.js → qfw14tna.js} +2 -2
- package/dist/shared/{wa07eas9.js → qvwwp1mp.js} +62 -41
- package/dist/shared/rbxt795q.js +1766 -0
- package/dist/shared/{xjk7hnn5.js → s7he5e5d.js} +2 -2
- package/dist/shared/{w72kgg4q.js → ss2kv2rs.js} +6 -6
- package/dist/shared/stfa9xcw.js +450 -0
- package/dist/shared/{3v7t1yrv.js → th3be82n.js} +2 -2
- package/dist/shared/{79dt02vc.js → tr64w5p0.js} +1 -1
- package/dist/shared/{cn957f8d.js → tw1nvvfj.js} +3 -3
- package/dist/shared/{ed0b8k4s.js → typ3vy7t.js} +1 -1
- package/dist/shared/{9628a9xt.js → vk7rag46.js} +1 -1
- package/dist/shared/{ze4hxsmy.js → w9ejzaqf.js} +1 -1
- package/dist/shared/{vczs8gd4.js → wvtjg5m3.js} +2 -2
- package/dist/shared/{9y3mmmh1.js → xfhe73sb.js} +1 -1
- package/dist/shared/xqacq37x.js +61 -0
- package/dist/shared/{1est4ezg.js → xtsydxjg.js} +3 -3
- package/dist/shared/xv8qj97g.js +96 -0
- package/dist/shared/{bg3rym3g.js → xwhdcrm4.js} +2 -2
- package/dist/shared/{kr0jzbw2.js → yvabyg9k.js} +7 -7
- package/dist/shared/yybhre6n.js +136 -0
- package/dist/shared/zdqf8k5d.js +8 -0
- package/dist/shared/{jznfax0y.js → zq1he88x.js} +4 -4
- package/dist/tooling/cli.js +108 -23
- package/dist/tooling/driver-run.js +4654 -0
- package/dist/tooling/driver-test.d.ts +36 -0
- package/dist/tooling/github/comment.d.ts +50 -0
- package/dist/tooling/github/post-comment.d.ts +17 -0
- package/dist/tooling/migrate/commands.d.ts +3 -2
- package/dist/tooling/migrate/config.d.ts +13 -0
- package/dist/tooling/migrate/export.d.ts +165 -0
- package/dist/tooling/migrate/ext-surface.d.ts +80 -0
- package/dist/tooling/migrate/ext.d.ts +31 -4
- package/dist/tooling/migrate/import-drizzle.d.ts +40 -0
- package/dist/tooling/migrate/index.d.ts +3 -0
- package/dist/tooling/migrate/index.js +55 -10
- package/dist/tooling/migrate/lint-rules.d.ts +18 -1
- package/dist/tooling/migrate/lint.d.ts +14 -1
- package/dist/tooling/migrate/place.d.ts +18 -0
- package/dist/tooling/migrate/plan-json.d.ts +65 -0
- package/dist/tooling/migrate/project.d.ts +13 -1
- package/dist/tooling/migrate/pull-emit.d.ts +98 -0
- package/dist/tooling/migrate/pull-routines.d.ts +126 -0
- package/dist/tooling/migrate/pull-verify.d.ts +26 -0
- package/dist/tooling/migrate/pull.d.ts +62 -0
- package/dist/tooling/migrate/reprint.d.ts +32 -0
- package/dist/tooling/migrate/sandbox.d.ts +8 -2
- package/dist/tooling/migrate/schema-api.d.ts +43 -0
- package/dist/tooling/migrate/sql-lex.d.ts +18 -0
- package/dist/tooling/shared/04svnxxj.js +344 -0
- package/dist/tooling/shared/0j0jtse1.js +13 -0
- package/dist/tooling/shared/0r05zhyq.js +618 -0
- package/dist/tooling/shared/1800eymw.js +49 -0
- package/dist/tooling/shared/35zemrmf.js +12 -0
- package/dist/tooling/shared/3rmaz3pq.js +140 -0
- package/dist/tooling/shared/3yn79q5m.js +12 -0
- package/dist/tooling/shared/54tqkxja.js +51 -0
- package/dist/tooling/shared/57btdkgm.js +209 -0
- package/dist/tooling/shared/5bmksndh.js +118 -0
- package/dist/tooling/shared/5p8km5jb.js +38 -0
- package/dist/tooling/shared/5x3pf400.js +185 -0
- package/dist/tooling/shared/5zrzffnk.js +6 -0
- package/dist/tooling/shared/62fxpc1p.js +332 -0
- package/dist/tooling/shared/68tf18v4.js +20 -0
- package/dist/tooling/shared/6vk28rjp.js +98 -0
- package/dist/tooling/shared/76pv6qff.js +9 -0
- package/dist/tooling/shared/7aews1zg.js +311 -0
- package/dist/tooling/shared/7b3xp9gc.js +195 -0
- package/dist/tooling/shared/7kms6fvj.js +20 -0
- package/dist/tooling/shared/7pxncnzs.js +40 -0
- package/dist/tooling/shared/829fjxyw.js +198 -0
- package/dist/tooling/shared/8m5znpdt.js +66 -0
- package/dist/tooling/shared/8yr7ges1.js +211 -0
- package/dist/tooling/shared/96ps4g1z.js +32 -0
- package/dist/tooling/shared/9qr9rkbh.js +143 -0
- package/dist/tooling/shared/9sfbtwsk.js +49 -0
- package/dist/tooling/shared/9wsnsvbf.js +10 -0
- package/dist/tooling/shared/a2xe04bm.js +18 -0
- package/dist/tooling/shared/a4pzghha.js +20 -0
- package/dist/tooling/shared/am04v8na.js +233 -0
- package/dist/tooling/shared/asgr07mp.js +194 -0
- package/dist/tooling/shared/c0xevn1h.js +312 -0
- package/dist/tooling/shared/dhatassp.js +134 -0
- package/dist/tooling/shared/ezqn88nj.js +1696 -0
- package/dist/tooling/shared/f77nnfqy.js +231 -0
- package/dist/tooling/shared/fh07z1dt.js +15 -0
- package/dist/tooling/shared/gqwevek4.js +81 -0
- package/dist/tooling/shared/hfq3n3bd.js +4116 -0
- package/dist/tooling/shared/htnaj77v.js +17 -0
- package/dist/tooling/shared/j664qjrt.js +64 -0
- package/dist/tooling/shared/jpgmjsx3.js +38 -0
- package/dist/tooling/shared/jr2nmr81.js +497 -0
- package/dist/tooling/shared/jsjjz875.js +139 -0
- package/dist/tooling/shared/kbqnrs1x.js +1425 -0
- package/dist/tooling/shared/kz715295.js +94 -0
- package/dist/tooling/shared/m3xt8b1h.js +22 -0
- package/dist/tooling/shared/m4hhb8aa.js +9 -0
- package/dist/tooling/shared/mw5npye0.js +16 -0
- package/dist/tooling/shared/n4jqhpqz.js +27 -0
- package/dist/tooling/shared/nxq95eb6.js +42 -0
- package/dist/tooling/shared/qartgazh.js +70 -0
- package/dist/tooling/shared/rcywj2w8.js +190 -0
- package/dist/tooling/shared/s6qha57m.js +16 -0
- package/dist/tooling/shared/shjs0379.js +150 -0
- package/dist/tooling/shared/sjwkt1pg.js +16 -0
- package/dist/tooling/shared/stebqyyd.js +401 -0
- package/dist/tooling/shared/t4xveemq.js +250 -0
- package/dist/tooling/shared/t6zjeake.js +261 -0
- package/dist/tooling/shared/tcwpjvxe.js +9 -0
- package/dist/tooling/shared/tpssp7ac.js +160 -0
- package/dist/tooling/shared/v6j1ep6w.js +42 -0
- package/dist/tooling/shared/vwr2y833.js +270 -0
- package/dist/tooling/shared/w17sj05d.js +7 -0
- package/dist/tooling/shared/w5d89rb4.js +131 -0
- package/dist/tooling/shared/wbwq1jsa.js +157 -0
- package/dist/tooling/shared/wezxf3h8.js +17 -0
- package/dist/tooling/shared/yb4kd19s.js +12 -0
- package/dist/tooling/shared/ybdew6j7.js +294 -0
- package/dist/tooling/shared/yfedr1zb.js +6 -0
- package/dist/tooling/shared/yhp829bx.js +177 -0
- package/dist/tooling/shared/ytk1tjs0.js +604 -0
- package/dist/tooling/shared/zs9aymcp.js +210 -0
- package/dist/tooling/shared/zx3v9phv.js +8 -0
- package/dist/tooling/testing/index.js +3 -3
- package/package.json +50 -9
- package/dist/shared/ktz42yez.js +0 -113
- package/dist/shared/ttsqgp4p.js +0 -71
- package/dist/shared/y34a8714.js +0 -150
- package/dist/shared/zy8r7qvz.js +0 -116
- package/dist/shared/{ywr8hmey.js → 606g0nbf.js} +3 -3
- package/dist/shared/{rpycarcr.js → gcefca6p.js} +4 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `connect` for Neon (`okmodel/pg/neon`).
|
|
3
|
+
*
|
|
4
|
+
* A string or an existing pool is one endpoint. A `{ primary, replicas }` object
|
|
5
|
+
* loads the topology module. The client is typed by the schema passed in.
|
|
6
|
+
* `mode` is `websocket` (the default) or `http`.
|
|
7
|
+
*/
|
|
8
|
+
import type { DriverPool } from "../../contracts/driver.js";
|
|
9
|
+
import type { QuerySchema } from "../../dialects/pg/model.js";
|
|
10
|
+
import { type NeonConfig } from "../../adapters/pg/neon.js";
|
|
11
|
+
import type { RoutedClient, TopologyInput, TopologyOptions } from "../topology.js";
|
|
12
|
+
import type { ConnectOptions, Connected } from "../types.js";
|
|
13
|
+
export { open, type NeonConfig, type NeonMode } from "../../adapters/pg/neon.js";
|
|
14
|
+
export { capabilities, hasCapability, httpCapabilities, readCapability, } from "../../adapters/pg/neon.js";
|
|
15
|
+
export { DriverError } from "../../adapters/error.js";
|
|
16
|
+
/** A connection string or a pool from {@link open}. */
|
|
17
|
+
export type NeonTarget = string | DriverPool;
|
|
18
|
+
/** Driver options `connect` forwards to {@link open}. */
|
|
19
|
+
export type NeonConnectOptions<S extends QuerySchema> = ConnectOptions<S> & Omit<NeonConfig, "url"> & TopologyOptions;
|
|
20
|
+
/**
|
|
21
|
+
* Connects one Neon endpoint, or a primary and its replicas.
|
|
22
|
+
*
|
|
23
|
+
* A string or a pool is one endpoint. A topology loads on demand and the promise
|
|
24
|
+
* resolves to the client. Reads use the first healthy replica.
|
|
25
|
+
*
|
|
26
|
+
* `mode: "websocket"` is the default. Interactive `tx()` needs it. `mode: "http"`
|
|
27
|
+
* is one-shot HTTP: `batch()` is atomic and `tx()` is refused.
|
|
28
|
+
*
|
|
29
|
+
* Named prepared statements are off unless `prepared` is `"named"`.
|
|
30
|
+
* `prepared: "named"` is not for transaction-mode poolers.
|
|
31
|
+
*
|
|
32
|
+
* @typeParam S - Schema
|
|
33
|
+
* @param target - URL, an existing pool, or `{ primary, replicas }`
|
|
34
|
+
* @param options - Schema, mode, errors, logger, and driver options
|
|
35
|
+
* @returns The client. A topology returns a promise. Await `connected` for the dialect check
|
|
36
|
+
*/
|
|
37
|
+
export declare function connect<const S extends QuerySchema>(target: TopologyInput, options: NeonConnectOptions<S>): Promise<RoutedClient<S>>;
|
|
38
|
+
export declare function connect<const S extends QuerySchema>(target: NeonTarget, options: NeonConnectOptions<S>): Promise<Connected<S>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DriverError2
|
|
3
|
+
} from "../../shared/cm3w0ywp.js";
|
|
4
|
+
import {
|
|
5
|
+
open6
|
|
6
|
+
} from "../../shared/mazpbcdj.js";
|
|
7
|
+
import {
|
|
8
|
+
NEON_WEBSOCKET_CAPABILITIES,
|
|
9
|
+
NEON_HTTP_CAPABILITIES,
|
|
10
|
+
readCapability2,
|
|
11
|
+
hasCapability2
|
|
12
|
+
} from "../../shared/mfvx6kjx.js";
|
|
13
|
+
import {
|
|
14
|
+
createClient
|
|
15
|
+
} from "../../shared/npdftanb.js";
|
|
16
|
+
|
|
17
|
+
// src/runtime/pg/neon.ts
|
|
18
|
+
function connect(target, options) {
|
|
19
|
+
if (typeof target === "object" && !isPool(target)) {
|
|
20
|
+
return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, (config) => open6({
|
|
21
|
+
url: config.url,
|
|
22
|
+
...options.mode !== undefined ? { mode: options.mode } : {},
|
|
23
|
+
...config.max !== undefined ? { max: config.max } : {},
|
|
24
|
+
...config.timeouts !== undefined ? { timeouts: config.timeouts } : {},
|
|
25
|
+
...config.prepared !== undefined ? { prepared: config.prepared } : {},
|
|
26
|
+
...config.searchPath !== undefined ? { searchPath: config.searchPath } : {}
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
const owned = !isPool(target);
|
|
30
|
+
const opened = isPool(target) ? Promise.resolve(target) : open6({
|
|
31
|
+
url: target,
|
|
32
|
+
...options.mode !== undefined ? { mode: options.mode } : {},
|
|
33
|
+
...options.max !== undefined ? { max: options.max } : {},
|
|
34
|
+
...options.timeouts !== undefined ? { timeouts: options.timeouts } : {},
|
|
35
|
+
...options.prepared !== undefined ? { prepared: options.prepared } : {},
|
|
36
|
+
...options.searchPath !== undefined ? { searchPath: options.searchPath } : {}
|
|
37
|
+
});
|
|
38
|
+
return opened.then((pool) => createClient(options.schema, pool, {
|
|
39
|
+
ownsPool: owned,
|
|
40
|
+
http: options.errors?.http,
|
|
41
|
+
includeValues: options.errors?.includeValues,
|
|
42
|
+
logger: options.logger,
|
|
43
|
+
signal: options.signal,
|
|
44
|
+
timeout: options.timeout,
|
|
45
|
+
timeouts: options.timeouts,
|
|
46
|
+
hookm: options.hookm,
|
|
47
|
+
catalog: options.catalog,
|
|
48
|
+
catalogDir: options.catalogDir,
|
|
49
|
+
requireMeta: options.requireMeta,
|
|
50
|
+
generators: options.generators
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
function isPool(target) {
|
|
54
|
+
return typeof target === "object" && "execute" in target && "capabilities" in target;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
DriverError2 as DriverError,
|
|
58
|
+
NEON_WEBSOCKET_CAPABILITIES as capabilities,
|
|
59
|
+
connect,
|
|
60
|
+
hasCapability2 as hasCapability,
|
|
61
|
+
NEON_HTTP_CAPABILITIES as httpCapabilities,
|
|
62
|
+
open6 as open,
|
|
63
|
+
readCapability2 as readCapability
|
|
64
|
+
};
|
package/dist/runtime/pg/pg.js
CHANGED
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
} from "../../shared/cm3w0ywp.js";
|
|
4
4
|
import {
|
|
5
5
|
open4
|
|
6
|
-
} from "../../shared/
|
|
6
|
+
} from "../../shared/1mxm04fy.js";
|
|
7
7
|
import {
|
|
8
8
|
NODE_POSTGRES_CAPABILITIES,
|
|
9
9
|
readCapability2,
|
|
10
10
|
hasCapability2
|
|
11
|
-
} from "../../shared/
|
|
11
|
+
} from "../../shared/mfvx6kjx.js";
|
|
12
12
|
import {
|
|
13
13
|
createClient
|
|
14
|
-
} from "../../shared/
|
|
14
|
+
} from "../../shared/npdftanb.js";
|
|
15
15
|
|
|
16
16
|
// src/runtime/pg/pg.ts
|
|
17
17
|
function connect(target, options) {
|
|
18
18
|
if (typeof target === "object" && !isPool(target)) {
|
|
19
|
-
return import("../../shared/
|
|
19
|
+
return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, open4));
|
|
20
20
|
}
|
|
21
21
|
const owned = !isPool(target);
|
|
22
22
|
const pool = isPool(target) ? target : open4({
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
open3,
|
|
6
6
|
seal2
|
|
7
|
-
} from "../../shared/
|
|
7
|
+
} from "../../shared/0j6qe91y.js";
|
|
8
8
|
import {
|
|
9
9
|
PGLITE_CAPABILITIES,
|
|
10
10
|
readCapability2,
|
|
11
11
|
hasCapability2
|
|
12
|
-
} from "../../shared/
|
|
12
|
+
} from "../../shared/mfvx6kjx.js";
|
|
13
13
|
import {
|
|
14
14
|
createClient
|
|
15
|
-
} from "../../shared/
|
|
15
|
+
} from "../../shared/npdftanb.js";
|
|
16
16
|
|
|
17
17
|
// src/runtime/pg/pglite.ts
|
|
18
18
|
async function connect(target, options) {
|
|
19
19
|
if (typeof target === "object" && !isPool(target)) {
|
|
20
|
-
return import("../../shared/
|
|
20
|
+
return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, open3));
|
|
21
21
|
}
|
|
22
22
|
const pool = isPool(target) ? seal2(target) : await open3({
|
|
23
23
|
...target !== undefined ? { dataDir: target } : {},
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
} from "../../shared/cm3w0ywp.js";
|
|
4
4
|
import {
|
|
5
5
|
open2
|
|
6
|
-
} from "../../shared/
|
|
6
|
+
} from "../../shared/dd5pmnky.js";
|
|
7
7
|
import {
|
|
8
8
|
POSTGRESJS_CAPABILITIES,
|
|
9
9
|
readCapability2,
|
|
10
10
|
hasCapability2
|
|
11
|
-
} from "../../shared/
|
|
11
|
+
} from "../../shared/mfvx6kjx.js";
|
|
12
12
|
import {
|
|
13
13
|
createClient
|
|
14
|
-
} from "../../shared/
|
|
14
|
+
} from "../../shared/npdftanb.js";
|
|
15
15
|
|
|
16
16
|
// src/runtime/pg/postgresjs.ts
|
|
17
17
|
function connect(target, options) {
|
|
18
18
|
if (typeof target === "object" && !isPool(target)) {
|
|
19
|
-
return import("../../shared/
|
|
19
|
+
return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, open2));
|
|
20
20
|
}
|
|
21
21
|
const owned = !isPool(target);
|
|
22
22
|
const pool = isPool(target) ? target : open2({
|
package/dist/runtime/plan.d.ts
CHANGED
|
@@ -195,7 +195,7 @@ export declare function readOptionNames(op: ReadOp): readonly string[];
|
|
|
195
195
|
* `order` is set when the operator is an `orderBy` value. `relevance` writes
|
|
196
196
|
* its direction there; the same operator in `where` is refused by that module.
|
|
197
197
|
*/
|
|
198
|
-
type OperatorEmit = (column: ColumnModel, ref: string, name: OperatorName, value: unknown, sink: Sink, order?: true) => void;
|
|
198
|
+
type OperatorEmit = (table: Indexed, column: ColumnModel, ref: string, name: OperatorName, value: unknown, sink: Sink, order?: true) => void;
|
|
199
199
|
/**
|
|
200
200
|
* Installs the 0.2 operator compiler.
|
|
201
201
|
*
|
|
@@ -15,20 +15,50 @@ import type { CatalogArtifact } from "./types.js";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const versionQuery = "select current_setting('server_version_num'), version(), (select (xpath('//catalog_hash/text()', query_to_xml('select catalog_hash from okm_meta where id = ''head''', true, false, '')))[1]::text where to_regclass('okm_meta') is not null)";
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Startup query for the namespace `okm build` recorded.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* `public` returns {@link versionQuery}, the same string as before.
|
|
21
|
+
* Another namespace qualifies `okm_meta`. `to_regclass` still lets a
|
|
22
|
+
* database with no such table plan.
|
|
22
23
|
*
|
|
23
|
-
* @param
|
|
24
|
+
* @param namespace - Catalog schema. `public` is unqualified
|
|
25
|
+
* @returns The version, dialect, and hash query
|
|
26
|
+
*/
|
|
27
|
+
export declare function versionSql(namespace: string): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* History query used when the catalog hashes differ.
|
|
30
|
+
*
|
|
31
|
+
* `public` stays unqualified, so a search path still finds that table.
|
|
32
|
+
*
|
|
33
|
+
* @param namespace - Catalog schema. `public` is unqualified
|
|
34
|
+
* @returns The `okm_history` select
|
|
35
|
+
*/
|
|
36
|
+
export declare function historySql(namespace: string): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Namespace stored beside the catalog hash.
|
|
39
|
+
*
|
|
40
|
+
* A missing file means `public`. `okm build` writes the file only when
|
|
41
|
+
* `defineConfig({ namespace })` is not `public`.
|
|
42
|
+
*
|
|
43
|
+
* @param catalogDir - Directory `connect` was given, or the default `.okm`
|
|
44
|
+
* @returns The schema name
|
|
45
|
+
*/
|
|
46
|
+
export declare function recordedNamespace(catalogDir: string | undefined): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Accepts the server row, or throws OKM1801, OKM1520, OKM1802, or OKM1803.
|
|
49
|
+
*
|
|
50
|
+
* The first statement reads `okm_meta` in the catalog namespace. A declared
|
|
51
|
+
* floor is the minimum. With no floor, the minimum is 15. A major below 15
|
|
52
|
+
* is refused when the schema is built.
|
|
53
|
+
*
|
|
54
|
+
* @param pool - Connection that runs the version query
|
|
24
55
|
* @param schema - Schema whose floor is the declared minimum
|
|
25
|
-
* @param rows - `server_version_num`, `version()`, and the `okm_meta` hash
|
|
26
56
|
* @param http - Status overrides from `connect`
|
|
27
57
|
* @param requireMeta - When true, a missing hash is OKM1520
|
|
28
58
|
* @param options - Signal and timeout for the compatibility read
|
|
29
59
|
* @param source - Trusted catalog used when the hash does not match
|
|
30
60
|
*/
|
|
31
|
-
export declare function acceptServer(pool: DriverPool, schema: QuerySchema,
|
|
61
|
+
export declare function acceptServer(pool: DriverPool, schema: QuerySchema, http: ErrorStatuses | undefined, requireMeta: boolean, options: ExecuteOptions | undefined, source: {
|
|
32
62
|
readonly catalog?: CatalogArtifact;
|
|
33
63
|
readonly catalogDir?: string;
|
|
34
64
|
}): Promise<void>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQL for a composed fragment.
|
|
3
|
+
*
|
|
4
|
+
* Loaded with the operator compiler and with a `select` that contains a
|
|
5
|
+
* fragment. A featureless read does not import it. Parameters are bound.
|
|
6
|
+
* `ident` names the TypeScript field, the same name `where` uses. The compiler
|
|
7
|
+
* quotes that column's SQL name. A hidden field is refused. The fragment is
|
|
8
|
+
* parenthesized so it cannot remove the tenant predicate.
|
|
9
|
+
*/
|
|
10
|
+
import { type FragmentPart } from "../dialects/pg/ops/fragment.js";
|
|
11
|
+
import { type Indexed, type Sink } from "./plan.js";
|
|
12
|
+
/**
|
|
13
|
+
* Writes a where fragment.
|
|
14
|
+
*
|
|
15
|
+
* `ref` is the field the fragment is attached to, already quoted and aliased.
|
|
16
|
+
* `fragment.column` emits that reference.
|
|
17
|
+
*
|
|
18
|
+
* @param table - The table the where field belongs to
|
|
19
|
+
* @param ref - `alias."column"`
|
|
20
|
+
* @param value - Parts the template stored
|
|
21
|
+
* @param sink - Statement builder
|
|
22
|
+
*/
|
|
23
|
+
export declare function emitSqlValue(table: Indexed, ref: string, value: unknown, sink: Sink): void;
|
|
24
|
+
/**
|
|
25
|
+
* Writes a select fragment.
|
|
26
|
+
*
|
|
27
|
+
* There is no where field, so `fragment.column` is OKM1125.
|
|
28
|
+
*
|
|
29
|
+
* @param table - The read table
|
|
30
|
+
* @param parts - Parts the template stored
|
|
31
|
+
* @param sink - Statement builder
|
|
32
|
+
* @param alias - Table alias, `t` on a root read
|
|
33
|
+
*/
|
|
34
|
+
export declare function emitSqlSelect(table: Indexed, parts: readonly FragmentPart[], sink: Sink, alias: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Reads a select fragment as a number.
|
|
37
|
+
*
|
|
38
|
+
* The wire is text. A value that is not a finite number is OKM1125.
|
|
39
|
+
*
|
|
40
|
+
* @param wire - Driver text
|
|
41
|
+
* @returns The number
|
|
42
|
+
*/
|
|
43
|
+
export declare function decodeSqlNumber(wire: string): number;
|
|
@@ -2,24 +2,24 @@ import {
|
|
|
2
2
|
markPathEndpoint
|
|
3
3
|
} from "../../shared/rhs3xe4k.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
policyObject
|
|
8
|
-
} from "../../shared/bdk4sty6.js";
|
|
5
|
+
uuid2
|
|
6
|
+
} from "../../shared/ecn8mfdq.js";
|
|
9
7
|
import {
|
|
10
8
|
isRelationCall
|
|
11
9
|
} from "../../shared/exn3sd90.js";
|
|
12
|
-
import {
|
|
13
|
-
uuid2
|
|
14
|
-
} from "../../shared/hyh73qk6.js";
|
|
15
10
|
import {
|
|
16
11
|
index2,
|
|
17
12
|
snakeCase
|
|
18
|
-
} from "../../shared/
|
|
13
|
+
} from "../../shared/gcefca6p.js";
|
|
19
14
|
import {
|
|
20
15
|
ColumnBuilder2,
|
|
21
16
|
retarget
|
|
22
|
-
} from "../../shared/
|
|
17
|
+
} from "../../shared/606g0nbf.js";
|
|
18
|
+
import {
|
|
19
|
+
tenantPolicyExpression,
|
|
20
|
+
unscopedPolicyExpression,
|
|
21
|
+
policyObject
|
|
22
|
+
} from "../../shared/bdk4sty6.js";
|
|
23
23
|
import {
|
|
24
24
|
definition
|
|
25
25
|
} from "../../shared/tmbdywx0.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "../../shared/94ez8kzh.js";
|
|
29
29
|
import {
|
|
30
30
|
quote
|
|
31
|
-
} from "../../shared/
|
|
31
|
+
} from "../../shared/kgwp4jdd.js";
|
|
32
32
|
import {
|
|
33
33
|
assertIdentifier2
|
|
34
34
|
} from "../../shared/nfzc5z0w.js";
|
|
@@ -14,7 +14,7 @@ export type RouteName = "primary" | "replica";
|
|
|
14
14
|
/**
|
|
15
15
|
* One routing choice.
|
|
16
16
|
*
|
|
17
|
-
* `onRoute` receives this. `inspect()`
|
|
17
|
+
* `onRoute` receives this. `inspect()` on a topology client shows the same reason.
|
|
18
18
|
*/
|
|
19
19
|
export type RouteEvent = {
|
|
20
20
|
/** What the statement was classified as. */
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
functionObject,
|
|
3
|
+
triggerObject
|
|
4
|
+
} from "../../shared/12z7aznj.js";
|
|
5
|
+
import {
|
|
6
|
+
quoteIdent2
|
|
7
|
+
} from "../../shared/fk9vef30.js";
|
|
2
8
|
import {
|
|
3
9
|
checkPresetNames,
|
|
4
10
|
duplicatePreset
|
|
@@ -6,30 +12,23 @@ import {
|
|
|
6
12
|
import {
|
|
7
13
|
checkTrait
|
|
8
14
|
} from "../../shared/n0dgs0pb.js";
|
|
9
|
-
import {
|
|
10
|
-
quoteIdent
|
|
11
|
-
} from "../../shared/9s0ypp87.js";
|
|
12
15
|
import {
|
|
13
16
|
pathEndpoint
|
|
14
17
|
} from "../../shared/rhs3xe4k.js";
|
|
15
|
-
import {
|
|
16
|
-
functionObject,
|
|
17
|
-
triggerObject
|
|
18
|
-
} from "../../shared/y34a8714.js";
|
|
19
18
|
import {
|
|
20
19
|
integer2,
|
|
21
20
|
timestamptz2
|
|
22
|
-
} from "../../shared/
|
|
21
|
+
} from "../../shared/nmnsgj7x.js";
|
|
23
22
|
import {
|
|
24
23
|
uuid2
|
|
25
|
-
} from "../../shared/
|
|
24
|
+
} from "../../shared/ecn8mfdq.js";
|
|
26
25
|
import {
|
|
27
26
|
snakeCase
|
|
28
|
-
} from "../../shared/
|
|
27
|
+
} from "../../shared/gcefca6p.js";
|
|
29
28
|
import {
|
|
30
29
|
ColumnBuilder2,
|
|
31
30
|
retarget
|
|
32
|
-
} from "../../shared/
|
|
31
|
+
} from "../../shared/606g0nbf.js";
|
|
33
32
|
import {
|
|
34
33
|
definition,
|
|
35
34
|
unavailable
|
|
@@ -42,12 +41,12 @@ import {
|
|
|
42
41
|
queryHandle,
|
|
43
42
|
attachHttp,
|
|
44
43
|
settleCall
|
|
45
|
-
} from "../../shared/
|
|
44
|
+
} from "../../shared/npdftanb.js";
|
|
46
45
|
import {
|
|
47
46
|
installArchiveInspect,
|
|
48
47
|
indexes,
|
|
49
48
|
isRecord
|
|
50
|
-
} from "../../shared/
|
|
49
|
+
} from "../../shared/kgwp4jdd.js";
|
|
51
50
|
import {
|
|
52
51
|
fitIdentifier2
|
|
53
52
|
} from "../../shared/nfzc5z0w.js";
|
|
@@ -300,7 +299,7 @@ function timestampRecords(built) {
|
|
|
300
299
|
returns: "trigger",
|
|
301
300
|
language: "plpgsql",
|
|
302
301
|
volatility: "volatile",
|
|
303
|
-
body: `begin new.${
|
|
302
|
+
body: `begin new.${quoteIdent2(column)} = now(); return new; end`,
|
|
304
303
|
provenance: { origin: "trait", name: "timestamps" },
|
|
305
304
|
dependencies: []
|
|
306
305
|
}));
|
|
@@ -468,7 +467,7 @@ function refuse(host, table) {
|
|
|
468
467
|
}
|
|
469
468
|
var archiveMod;
|
|
470
469
|
function loadArchive() {
|
|
471
|
-
archiveMod ??= import("../../shared/
|
|
470
|
+
archiveMod ??= import("../../shared/qfw14tna.js");
|
|
472
471
|
return archiveMod;
|
|
473
472
|
}
|
|
474
473
|
async function settle(host, table, mods) {
|
|
@@ -736,7 +735,7 @@ function attachSort(target, ctx) {
|
|
|
736
735
|
wrapOrder(target, "find", order);
|
|
737
736
|
wrapOrder(target, "page", order);
|
|
738
737
|
const view = ctx.view;
|
|
739
|
-
target.move = (id, place) => import("../../shared/
|
|
738
|
+
target.move = (id, place) => import("../../shared/xfhe73sb.js").then((mod) => mod.move(host, tableName, id, place, view));
|
|
740
739
|
}
|
|
741
740
|
function wrapOrder(target, key, order) {
|
|
742
741
|
const previous = target[key];
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export type Selected<Row, Sel> = [Sel] extends [readonly (infer P)[]] ? [P] exte
|
|
|
120
120
|
type HasWindow<P> = P extends Window<string, string | number> ? true : false;
|
|
121
121
|
/** Result keys a window helper adds. A field name contributes nothing. */
|
|
122
122
|
type WindowFields<Row, P> = Intersect<P extends Window<infer A, infer V> ? {
|
|
123
|
-
readonly [K in A]: V extends keyof Row ? NonNullable<Row[V]> | null : number;
|
|
123
|
+
readonly [K in A]: V extends keyof Row ? NonNullable<Row[V]> | null : V extends number ? number : string;
|
|
124
124
|
} : {}>;
|
|
125
125
|
type IncludeRows<S extends QuerySchema, K extends keyof S["~byName"], Inc> = [Inc] extends [
|
|
126
126
|
Record<string, unknown>
|
|
@@ -637,6 +637,20 @@ export type TableApi<S extends QuerySchema, K extends keyof S["~byName"] & strin
|
|
|
637
637
|
readonly allow: Allow;
|
|
638
638
|
}): Write<Show<RowOf<S, K>>>;
|
|
639
639
|
insert(data: RequiredInsert<InsertOf<S, K>> & OptionalInsert<InsertOf<S, K>>, options?: InsertOptions<S, K>): Write<Show<RowOf<S, K>>>;
|
|
640
|
+
/**
|
|
641
|
+
* Inserts a list in one transaction. Unknown keys are dropped.
|
|
642
|
+
*
|
|
643
|
+
* `{ allow: ["id"] }` may set `id` on a client-generator primary key.
|
|
644
|
+
* A row that omits `id` still takes the generator. A longer `allow` list
|
|
645
|
+
* does not open `id` in this type.
|
|
646
|
+
*
|
|
647
|
+
* @param data - Rows. `id` is optional when `allow` is exactly `["id"]`
|
|
648
|
+
* @param options - Must set `allow` to `["id"]`
|
|
649
|
+
* @returns The inserted rows
|
|
650
|
+
*/
|
|
651
|
+
insert(data: readonly (RequiredInsert<InsertOf<S, K>> & OptionalInsert<InsertOf<S, K>> & Partial<Pick<RowOf<S, K>, "id" & keyof RowOf<S, K>>>)[], options: InsertOptions<S, K> & {
|
|
652
|
+
readonly allow: readonly ["id"];
|
|
653
|
+
}): Write<readonly Show<RowOf<S, K>>[]>;
|
|
640
654
|
/**
|
|
641
655
|
* Inserts a list in one transaction. Unknown keys are dropped.
|
|
642
656
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validationGate
|
|
3
|
-
} from "../../shared/
|
|
3
|
+
} from "../../shared/w9ejzaqf.js";
|
|
4
4
|
import {
|
|
5
5
|
addSchemaHook
|
|
6
|
-
} from "../../shared/
|
|
6
|
+
} from "../../shared/9dr2qnx7.js";
|
|
7
7
|
import {
|
|
8
8
|
queryHandle
|
|
9
|
-
} from "../../shared/
|
|
9
|
+
} from "../../shared/npdftanb.js";
|
|
10
10
|
import {
|
|
11
11
|
OkmError2
|
|
12
12
|
} from "../../shared/52szzakm.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
// src/runtime/validate/load.ts
|
|
15
15
|
var engine;
|
|
16
16
|
function loadEngine() {
|
|
17
|
-
engine ??= import("../../shared/
|
|
17
|
+
engine ??= import("../../shared/9dvh1dr6.js");
|
|
18
18
|
return engine;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
noTimeout
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./tr64w5p0.js";
|
|
4
4
|
import {
|
|
5
5
|
PGLITE_CAPABILITIES,
|
|
6
6
|
driverErrors,
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
runCall,
|
|
12
12
|
EMPTY_NOTICES,
|
|
13
13
|
resultFrom
|
|
14
|
-
} from "./
|
|
14
|
+
} from "./mfvx6kjx.js";
|
|
15
15
|
|
|
16
16
|
// src/adapters/pg/pglite.ts
|
|
17
17
|
import { PGlite } from "@electric-sql/pglite";
|
|
18
18
|
async function open3(config = {}) {
|
|
19
|
-
const wire = await import("./
|
|
19
|
+
const wire = await import("./g89fmz5s.js");
|
|
20
20
|
const db = new PGlite({
|
|
21
21
|
dataDir: config.dataDir ?? "memory://",
|
|
22
22
|
parsers: wire.parsers,
|
|
@@ -67,7 +67,7 @@ async function open3(config = {}) {
|
|
|
67
67
|
return;
|
|
68
68
|
released = true;
|
|
69
69
|
try {
|
|
70
|
-
const { resetQueried } = await import("./
|
|
70
|
+
const { resetQueried } = await import("./pgsak1yw.js");
|
|
71
71
|
await resetQueried(session);
|
|
72
72
|
} finally {
|
|
73
73
|
slot.release();
|