okmodel 0.9.0 → 0.9.1
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 +9 -1
- package/dist/adapters/pg/bunsql-extra.d.ts +5 -5
- package/dist/adapters/pg/bunsql.d.ts +6 -2
- package/dist/adapters/pg/nodepostgres.d.ts +16 -1
- package/dist/adapters/pg/postgres-extra.d.ts +3 -17
- package/dist/adapters/pg/postgresjs.d.ts +2 -1
- package/dist/contracts/driver.d.ts +3 -2
- package/dist/contracts/error.d.ts +1 -1
- package/dist/dialects/pg/errors.d.ts +2 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.js +1 -1
- package/dist/dialects/pg/ext/hstore.js +1 -1
- package/dist/dialects/pg/ext/ltree.js +1 -1
- package/dist/dialects/pg/ext/pgcrypto.js +1 -1
- package/dist/dialects/pg/ext/unaccent.js +1 -1
- package/dist/dialects/pg/filters.d.ts +2 -2
- package/dist/dialects/pg/fn/index.js +1 -1
- package/dist/dialects/pg/index.js +3 -3
- package/dist/dialects/pg/introspect.d.ts +12 -0
- package/dist/dialects/pg/view/index.js +2 -2
- package/dist/runtime/param-limit.d.ts +20 -0
- package/dist/runtime/pg/bun.js +3 -3
- package/dist/runtime/pg/neon.js +3 -3
- package/dist/runtime/pg/pg.js +3 -3
- package/dist/runtime/pg/pglite.js +2 -2
- package/dist/runtime/pg/postgresjs.js +10 -10
- package/dist/runtime/tenancy/index.js +1 -1
- package/dist/runtime/traits/index.js +2 -2
- package/dist/runtime/validate/index.js +2 -2
- package/dist/runtime/write.d.ts +1 -1
- package/dist/shared/{5kyb3tqx.js → 1h5h1rf5.js} +1 -1
- package/dist/shared/{4vbf83xx.js → 2vcnpf0n.js} +1 -1
- package/dist/shared/{8n688yjg.js → 3ap5hxvj.js} +2 -1
- package/dist/shared/{wvtjg5m3.js → 3d7a80fq.js} +1 -1
- package/dist/shared/{bphrgwz9.js → 3dr444ny.js} +57 -78
- package/dist/shared/{yvabyg9k.js → 3vvpcphd.js} +7 -6
- package/dist/shared/{760ppr76.js → 4a3mmhhe.js} +2 -2
- package/dist/shared/{90sg0w5a.js → 4pkz5nvw.js} +65 -10
- package/dist/shared/{mazpbcdj.js → 4te76xc5.js} +1 -1
- package/dist/shared/{xwhdcrm4.js → 60y4ahmw.js} +1 -1
- package/dist/shared/{9dtgn1z2.js → 63qjmhnp.js} +100 -17
- package/dist/shared/{s7he5e5d.js → 67w3kn71.js} +1 -1
- package/dist/shared/{n306gqkd.js → 6vfvsdkt.js} +9 -7
- package/dist/shared/{jpybhf98.js → 6xqvesa5.js} +1 -1
- package/dist/shared/{n5whk3mt.js → 8gdbty5v.js} +8 -8
- package/dist/shared/{ccsmhv9r.js → 8ma6drzr.js} +194 -31
- package/dist/shared/{3456242y.js → 8p2bgye0.js} +110 -18
- package/dist/shared/{ebhz8vh6.js → 8qwqrxed.js} +11 -3
- package/dist/shared/{ss2kv2rs.js → 8v7vzpgt.js} +10 -7
- package/dist/shared/{8qzkd9f3.js → ak61ye1f.js} +3 -3
- package/dist/shared/{6nae0spm.js → bdekbvmt.js} +69 -7
- package/dist/shared/{tw1nvvfj.js → bxjq6xqv.js} +2 -2
- package/dist/shared/{rbxt795q.js → c7dqd3gk.js} +81 -41
- package/dist/shared/ddh72ym5.js +20 -0
- package/dist/shared/e1c55v04.js +10 -0
- package/dist/shared/{8jesqsrk.js → ekhq3ytz.js} +1 -1
- package/dist/shared/{7ba5h6pb.js → esy4dyxe.js} +5 -5
- package/dist/shared/{gcefca6p.js → f9t9g54z.js} +22 -9
- package/dist/shared/fkjne6gx.js +8 -0
- package/dist/shared/{ds229x4r.js → fne90dvz.js} +4 -1
- package/dist/shared/{cexb7z6b.js → gr9sn4za.js} +1 -1
- package/dist/shared/{mvmm3xpb.js → gzgfsspx.js} +1 -1
- package/dist/shared/{fdsz3w80.js → hgt69zjf.js} +2 -2
- package/dist/shared/{dd5pmnky.js → jvxcp1qk.js} +70 -86
- package/dist/shared/{yybhre6n.js → k73e8n9d.js} +3 -3
- package/dist/shared/{mgaq2sd3.js → kzgrcy8s.js} +8 -7
- package/dist/shared/{myk8fswx.js → mz48rs74.js} +14 -3
- package/dist/shared/{62b603gr.js → n6je5b28.js} +10 -23
- package/dist/shared/{2szgv6yj.js → ns35jqz0.js} +71 -45
- package/dist/shared/{xtsydxjg.js → nstwgzn8.js} +1 -1
- package/dist/shared/{stfa9xcw.js → py2zrrm6.js} +7 -6
- package/dist/shared/{9dr2qnx7.js → qqm3ze6q.js} +1 -1
- package/dist/shared/{cf8zdz5p.js → rcjm0yn7.js} +27 -34
- package/dist/shared/{ckz05z15.js → rged92v6.js} +7 -4
- package/dist/shared/{qvwwp1mp.js → rw4tpcd0.js} +30 -21
- package/dist/shared/{bsek72fg.js → s5qe47a6.js} +3 -0
- package/dist/shared/{1d9q9cv2.js → smxzjz60.js} +2 -2
- package/dist/shared/{c3mvnq7a.js → th5rnaxw.js} +1 -1
- package/dist/shared/{1mxm04fy.js → tyqapcgk.js} +71 -8
- package/dist/shared/{zdqf8k5d.js → vsna85qf.js} +1 -1
- package/dist/shared/{63qtkrca.js → vy47ryqa.js} +55 -5
- package/dist/shared/{xv8qj97g.js → wbdh9qbg.js} +3 -1
- package/dist/shared/{2zdxkt7b.js → wp7y8q3y.js} +41 -9
- package/dist/shared/{pg4ezgyf.js → xbd9xs6p.js} +2 -2
- package/dist/shared/{npdftanb.js → xbvz446k.js} +16 -13
- package/dist/shared/{aksb89mn.js → y6tfjk9q.js} +2 -2
- package/dist/shared/{3bb7wsqt.js → ycnft340.js} +1 -1
- package/dist/shared/{z7s6fpxv.js → ymenf259.js} +1 -1
- package/dist/shared/{71n0jmhc.js → ysdw2fg3.js} +10 -2
- package/dist/shared/{xqacq37x.js → zecrwdk9.js} +1 -1
- package/dist/shared/{3t6kw83m.js → zm2rzqba.js} +2 -1
- package/dist/tooling/cli.js +122 -44
- package/dist/tooling/driver-run.js +107 -24
- package/dist/tooling/github/comment.d.ts +8 -2
- package/dist/tooling/migrate/apply.d.ts +17 -2
- package/dist/tooling/migrate/drift.d.ts +12 -0
- package/dist/tooling/migrate/driver-url.d.ts +17 -0
- package/dist/tooling/migrate/index.js +9 -7
- package/dist/tooling/migrate/policy.d.ts +17 -5
- package/dist/tooling/migrate/pooler-probe.d.ts +23 -0
- package/dist/tooling/migrate/pull.d.ts +3 -0
- package/dist/tooling/migrate/runner.d.ts +24 -1
- package/dist/tooling/shared/{0j0jtse1.js → 09a6vsys.js} +1 -1
- package/dist/tooling/shared/{68tf18v4.js → 0v9ptnxp.js} +8 -8
- package/dist/tooling/shared/{qartgazh.js → 0wtzps9p.js} +6 -6
- package/dist/tooling/shared/{1800eymw.js → 0yhf1db4.js} +6 -6
- package/dist/tooling/shared/{s6qha57m.js → 19msgrsc.js} +2 -2
- package/dist/tooling/shared/{3yn79q5m.js → 1fwfm5m3.js} +1 -1
- package/dist/tooling/shared/{hfq3n3bd.js → 2jdn09e2.js} +55 -5
- package/dist/tooling/shared/{v6j1ep6w.js → 2qrte2ct.js} +5 -5
- package/dist/tooling/shared/{yb4kd19s.js → 2v4nwnkb.js} +1 -1
- package/dist/tooling/shared/{ezqn88nj.js → 33z39trp.js} +106 -23
- package/dist/tooling/shared/{0r05zhyq.js → 353vnw9z.js} +5 -5
- package/dist/tooling/shared/{m4hhb8aa.js → 390kry9g.js} +2 -2
- package/dist/tooling/shared/{rcywj2w8.js → 3f6etb9z.js} +18 -31
- package/dist/tooling/shared/{9wsnsvbf.js → 3t2cqmsx.js} +1 -1
- package/dist/tooling/shared/{5zrzffnk.js → 4dzvjtpy.js} +1 -1
- package/dist/tooling/shared/{am04v8na.js → 4ec0nxvw.js} +10 -10
- package/dist/tooling/shared/{04svnxxj.js → 4tg2bn41.js} +59 -78
- package/dist/tooling/shared/{829fjxyw.js → 5rah55z0.js} +2 -2
- package/dist/tooling/shared/{c0xevn1h.js → 804w1t69.js} +4 -4
- package/dist/tooling/shared/{dhatassp.js → 8g0m0rvd.js} +6 -6
- package/dist/tooling/shared/{zx3v9phv.js → 8msbtw5s.js} +1 -1
- package/dist/tooling/shared/{7pxncnzs.js → 8t22h3h7.js} +2 -2
- package/dist/tooling/shared/{wbwq1jsa.js → 91c59b7b.js} +2 -2
- package/dist/tooling/shared/{a2xe04bm.js → adk9k6va.js} +1 -1
- package/dist/tooling/shared/{w17sj05d.js → ajjd5cwz.js} +2 -2
- package/dist/tooling/shared/{35zemrmf.js → angjck01.js} +1 -1
- package/dist/tooling/shared/{jsjjz875.js → asnnc3v5.js} +1 -1
- package/dist/tooling/shared/{5bmksndh.js → bj1kyqc8.js} +2 -2
- package/dist/tooling/shared/{kbqnrs1x.js → bt3tjemb.js} +11 -3
- package/dist/tooling/shared/{vwr2y833.js → chk2bh4f.js} +2 -2
- package/dist/tooling/shared/{ybdew6j7.js → ckq4z5ax.js} +5 -2
- package/dist/tooling/shared/{3rmaz3pq.js → d3rhb24q.js} +1 -1
- package/dist/tooling/shared/{mw5npye0.js → d8q00vxg.js} +4 -4
- package/dist/tooling/shared/{j664qjrt.js → dx188rxs.js} +2 -2
- package/dist/tooling/shared/{8yr7ges1.js → efq6p9df.js} +35 -42
- package/dist/tooling/shared/{yhp829bx.js → en6rwzq0.js} +3 -3
- package/dist/tooling/shared/{f77nnfqy.js → f2r5g0fs.js} +2 -2
- package/dist/tooling/shared/{zs9aymcp.js → f4gep0nk.js} +1 -1
- package/dist/tooling/shared/{kz715295.js → f8a010fm.js} +13 -11
- package/dist/tooling/shared/{w5d89rb4.js → fdsek6pa.js} +1 -1
- package/dist/tooling/shared/fvmrxsd1.js +8 -0
- package/dist/tooling/shared/{jpgmjsx3.js → g3xybeqf.js} +4 -3
- package/dist/tooling/shared/{wezxf3h8.js → gefmpwsa.js} +1 -1
- package/dist/tooling/shared/{jr2nmr81.js → gjj71hfh.js} +23 -20
- package/dist/tooling/shared/{9sfbtwsk.js → jgzt69pa.js} +5 -5
- package/dist/tooling/shared/{a4pzghha.js → jm30k2ca.js} +10 -8
- package/dist/tooling/shared/{shjs0379.js → kayqzpbk.js} +6 -3
- package/dist/tooling/shared/{tcwpjvxe.js → kvw1672d.js} +1 -1
- package/dist/tooling/shared/{stebqyyd.js → mr1kcgpw.js} +3 -3
- package/dist/tooling/shared/{tpssp7ac.js → mwbdf409.js} +1 -1
- package/dist/tooling/shared/{fh07z1dt.js → ns9207v3.js} +1 -1
- package/dist/tooling/shared/{5p8km5jb.js → p6tjv97k.js} +3 -3
- package/dist/tooling/shared/{ytk1tjs0.js → p73evwf0.js} +1 -1
- package/dist/tooling/shared/{8m5znpdt.js → phc1nc4g.js} +1 -1
- package/dist/tooling/shared/{asgr07mp.js → ppybjw50.js} +79 -16
- package/dist/tooling/shared/{t4xveemq.js → qdrn8ghn.js} +5 -4
- package/dist/tooling/shared/rd8h01ta.js +20 -0
- package/dist/tooling/shared/{7aews1zg.js → rwg8y90m.js} +3 -3
- package/dist/tooling/shared/{5x3pf400.js → ry2f3w8p.js} +3 -3
- package/dist/tooling/shared/{m3xt8b1h.js → ryc5sa58.js} +8 -8
- package/dist/tooling/shared/{57btdkgm.js → ss87qxwv.js} +2 -2
- package/dist/tooling/shared/{6vk28rjp.js → vg68k11z.js} +3 -3
- package/dist/tooling/shared/{62fxpc1p.js → vms9dta5.js} +73 -89
- package/dist/tooling/shared/{gqwevek4.js → xchpnbdv.js} +1 -1
- package/dist/tooling/shared/{t6zjeake.js → xn6p01fh.js} +5 -5
- package/dist/tooling/shared/{7b3xp9gc.js → xwr6q618.js} +3 -3
- package/dist/tooling/shared/{yfedr1zb.js → xx3gmq94.js} +1 -1
- package/dist/tooling/shared/{9qr9rkbh.js → y2bd7yfx.js} +21 -13
- package/dist/tooling/shared/{nxq95eb6.js → y4gq9rbe.js} +11 -11
- package/dist/tooling/shared/{76pv6qff.js → y4vwft92.js} +2 -2
- package/dist/tooling/shared/{sjwkt1pg.js → yz68xcmc.js} +1 -1
- package/dist/tooling/testing/factories.d.ts +1 -3
- package/dist/tooling/testing/index.js +1 -1
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
emitSqlValue
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./ckq4z5ax.js";
|
|
4
4
|
import {
|
|
5
5
|
assertOperatorFits,
|
|
6
6
|
sqlType,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
assertBoundText,
|
|
9
9
|
assertRegconfig,
|
|
10
10
|
textArray
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./fdsek6pa.js";
|
|
12
12
|
import {
|
|
13
13
|
isOperator,
|
|
14
14
|
operatorName,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
quote,
|
|
18
18
|
isRecord,
|
|
19
19
|
fail2
|
|
20
|
-
} from "./
|
|
20
|
+
} from "./2jdn09e2.js";
|
|
21
21
|
|
|
22
22
|
// src/runtime/operator-sql.ts
|
|
23
23
|
function emitStructured(table, column, ref, name, value, sink, order) {
|
|
@@ -1,44 +1,47 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DriverError2,
|
|
3
3
|
isConnectionLost
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./2jdn09e2.js";
|
|
5
5
|
import {
|
|
6
6
|
armDriverError2,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
logClientError2,
|
|
8
|
+
send4,
|
|
9
|
+
connectClient3
|
|
10
|
+
} from "./ppybjw50.js";
|
|
10
11
|
import {
|
|
11
12
|
resetSession2
|
|
12
|
-
} from "./
|
|
13
|
+
} from "./8t22h3h7.js";
|
|
13
14
|
import {
|
|
14
15
|
cursorStream
|
|
15
16
|
} from "./7kms6fvj.js";
|
|
16
17
|
import {
|
|
17
18
|
WireSession
|
|
18
|
-
} from "./
|
|
19
|
+
} from "./asnnc3v5.js";
|
|
19
20
|
import {
|
|
20
21
|
rejectClosed,
|
|
21
22
|
runCall
|
|
22
|
-
} from "./
|
|
23
|
+
} from "./ry2f3w8p.js";
|
|
23
24
|
|
|
24
25
|
// src/adapters/pg/nodepostgres-extra.ts
|
|
25
26
|
async function checkout(held) {
|
|
26
27
|
const { pool, counters, named, isClosed } = held;
|
|
27
28
|
if (isClosed())
|
|
28
29
|
return rejectClosed();
|
|
29
|
-
const client = await
|
|
30
|
+
const client = await connectClient3(pool, held.acquireMs, counters);
|
|
30
31
|
counters.reserved += 1;
|
|
31
32
|
let lost = false;
|
|
32
|
-
const onError = () => {
|
|
33
|
+
const onError = (error) => {
|
|
33
34
|
lost = true;
|
|
35
|
+
if (error !== undefined)
|
|
36
|
+
logClientError2(held.notices, error);
|
|
34
37
|
};
|
|
35
38
|
const events = client;
|
|
36
39
|
events.on("error", onError);
|
|
37
40
|
const local = new Set;
|
|
38
41
|
const session = new WireSession((text, params) => {
|
|
39
|
-
const pending =
|
|
42
|
+
const pending = send4(client, text, params, named, client);
|
|
40
43
|
const guarded = pending.catch((error) => {
|
|
41
|
-
if (isConnectionLost(error) || lost) {
|
|
44
|
+
if (isConnectionLost(error) || lost || pgClosed(error)) {
|
|
42
45
|
lost = true;
|
|
43
46
|
if (isConnectionLost(error))
|
|
44
47
|
throw error;
|
|
@@ -62,7 +65,7 @@ async function checkout(held) {
|
|
|
62
65
|
return {
|
|
63
66
|
execute: (text, params, options) => guard(() => runCall(isClosed(), options, (watch) => session.query(text, params, watch))),
|
|
64
67
|
batch: (statements, options) => guard(() => runCall(isClosed(), options, async (watch) => {
|
|
65
|
-
const { runAtomicBatch } = await import("./
|
|
68
|
+
const { runAtomicBatch } = await import("./xchpnbdv.js");
|
|
66
69
|
return runAtomicBatch(session, statements, watch);
|
|
67
70
|
})),
|
|
68
71
|
cancel() {
|
|
@@ -75,6 +78,8 @@ async function checkout(held) {
|
|
|
75
78
|
try {
|
|
76
79
|
if (!lost)
|
|
77
80
|
await reset(session, client);
|
|
81
|
+
} catch {
|
|
82
|
+
lost = true;
|
|
78
83
|
} finally {
|
|
79
84
|
counters.reserved = Math.max(0, counters.reserved - 1);
|
|
80
85
|
events.removeListener("error", onError);
|
|
@@ -83,12 +88,15 @@ async function checkout(held) {
|
|
|
83
88
|
}
|
|
84
89
|
};
|
|
85
90
|
}
|
|
91
|
+
function pgClosed(error) {
|
|
92
|
+
return error instanceof Error && error.message === "Client has encountered a connection error and is not queryable";
|
|
93
|
+
}
|
|
86
94
|
async function reset(session, client) {
|
|
87
95
|
await resetSession2(session.depth(), (text) => client.query(text));
|
|
88
96
|
}
|
|
89
97
|
async function listen(held, channel, onNotify) {
|
|
90
98
|
const { pool, counters } = held;
|
|
91
|
-
const client = await
|
|
99
|
+
const client = await connectClient3(pool, held.acquireMs, counters);
|
|
92
100
|
counters.reserved += 1;
|
|
93
101
|
const quoted = quoteIdent(channel);
|
|
94
102
|
const onNotification = (message) => {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
open4
|
|
3
|
+
} from "./vms9dta5.js";
|
|
4
4
|
import {
|
|
5
5
|
createClient
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./gjj71hfh.js";
|
|
7
7
|
|
|
8
8
|
// src/runtime/pg/postgresjs.ts
|
|
9
9
|
function connect(target, options) {
|
|
10
10
|
if (typeof target === "object" && !isPool(target)) {
|
|
11
|
-
return import("./
|
|
11
|
+
return import("./bt3tjemb.js").then((mod) => mod.default(target, options, open4));
|
|
12
12
|
}
|
|
13
13
|
const owned = !isPool(target);
|
|
14
|
-
const pool =
|
|
14
|
+
const pool = owned ? open4({
|
|
15
15
|
url: target,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
16
|
+
max: options.max,
|
|
17
|
+
timeouts: options.timeouts,
|
|
18
|
+
prepared: options.prepared,
|
|
19
|
+
searchPath: options.searchPath,
|
|
20
|
+
ssl: options.ssl
|
|
21
|
+
}) : target;
|
|
22
22
|
return createClient(options.schema, pool, {
|
|
23
23
|
ownsPool: owned,
|
|
24
24
|
http: options.errors?.http,
|
|
@@ -90,8 +90,6 @@ export type FactoryHost = {
|
|
|
90
90
|
readonly rng: Rng;
|
|
91
91
|
/** Latest row of a table in one tenant. Isolation uses its own map. */
|
|
92
92
|
cache: Map<string, Record<string, unknown>>;
|
|
93
|
-
/** Tables currently being inserted. A repeat is a factory cycle. */
|
|
94
|
-
readonly creating: Set<string>;
|
|
95
93
|
readonly created: Map<string, number>;
|
|
96
94
|
readonly definitions: Map<string, (context: FactoryContext) => Readonly<Record<string, unknown>>>;
|
|
97
95
|
};
|
|
@@ -113,7 +111,7 @@ export declare function bindFactories(host: FactoryHost, definitions: Readonly<R
|
|
|
113
111
|
* @param inherited - Tenant from the parent row, when this row is a child
|
|
114
112
|
* @returns The inserted row
|
|
115
113
|
*/
|
|
116
|
-
export declare function insertRow(host: FactoryHost, table: string, overrides: Readonly<Record<string, unknown>> | undefined, children: Readonly<Record<string, number>> | undefined, inherited: string | undefined): Promise<Record<string, unknown>>;
|
|
114
|
+
export declare function insertRow(host: FactoryHost, table: string, overrides: Readonly<Record<string, unknown>> | undefined, children: Readonly<Record<string, number>> | undefined, inherited: string | undefined, creating?: Set<string>): Promise<Record<string, unknown>>;
|
|
117
115
|
/**
|
|
118
116
|
* Drops a cached factory row.
|
|
119
117
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "okmodel",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "okmodel is a catalog-first TypeScript ORM, PostgreSQL first.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"migrations",
|
|
@@ -224,6 +224,7 @@
|
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
226
|
"engines": {
|
|
227
|
+
"bun": ">=1.4.0",
|
|
227
228
|
"node": ">=22.18"
|
|
228
229
|
}
|
|
229
230
|
}
|