okmodel 0.6.0 → 0.8.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 +100 -1131
- package/dist/adapters/capabilities.d.ts +35 -0
- package/dist/adapters/failure.d.ts +13 -2
- package/dist/adapters/lazy-errors.d.ts +22 -0
- package/dist/adapters/pg/bun-sql.d.ts +53 -0
- package/dist/adapters/pg/bunsql-extra.d.ts +54 -3
- package/dist/adapters/pg/bunsql.d.ts +15 -2
- package/dist/adapters/pg/cursor.d.ts +17 -0
- 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 +11 -8
- package/dist/adapters/pg/nodepostgres-extra.d.ts +22 -1
- package/dist/adapters/pg/nodepostgres.d.ts +12 -0
- package/dist/adapters/pg/pglite-wire.d.ts +24 -0
- package/dist/adapters/pg/pglite.d.ts +10 -0
- package/dist/adapters/pg/postgres-extra.d.ts +27 -11
- package/dist/adapters/pg/reserved.d.ts +42 -0
- package/dist/adapters/pg/session.d.ts +0 -18
- package/dist/contracts/connection.d.ts +7 -6
- package/dist/contracts/error.d.ts +1 -1
- package/dist/dialects/pg/floor.d.ts +68 -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 +8 -1
- package/dist/dialects/pg/index.js +435 -170
- package/dist/dialects/pg/introspect.d.ts +11 -0
- package/dist/dialects/pg/keys.d.ts +11 -8
- package/dist/dialects/pg/model.d.ts +40 -0
- package/dist/dialects/pg/morph.d.ts +43 -0
- package/dist/dialects/pg/operator-fit.d.ts +2 -2
- package/dist/dialects/pg/operators.d.ts +14 -7
- package/dist/dialects/pg/ops/bucket.d.ts +65 -0
- package/dist/dialects/pg/ops/fragment.d.ts +119 -0
- package/dist/dialects/pg/ops/inc.d.ts +2 -2
- package/dist/dialects/pg/ops/lane.d.ts +49 -0
- package/dist/dialects/pg/ops/matches.d.ts +9 -12
- package/dist/dialects/pg/ops/relevance.d.ts +13 -0
- package/dist/dialects/pg/ops/search-query.d.ts +22 -0
- package/dist/dialects/pg/ops/window.d.ts +103 -0
- package/dist/dialects/pg/preset.d.ts +1 -1
- package/dist/dialects/pg/relations.d.ts +100 -3
- package/dist/dialects/pg/schema.d.ts +31 -3
- 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 +8 -5
- package/dist/runtime/aggregate.d.ts +8 -2
- package/dist/runtime/bucket-group.d.ts +70 -0
- package/dist/runtime/conflict.d.ts +22 -4
- package/dist/runtime/include.d.ts +0 -8
- package/dist/runtime/inflight.d.ts +1 -1
- package/dist/runtime/otel.d.ts +105 -0
- package/dist/runtime/otel.js +97 -0
- package/dist/runtime/page.d.ts +4 -1
- package/dist/runtime/pg/bun.js +12 -6
- package/dist/runtime/pg/neon.d.ts +38 -0
- package/dist/runtime/pg/neon.js +64 -0
- package/dist/runtime/pg/pg.js +5 -5
- package/dist/runtime/pg/pglite.d.ts +1 -0
- package/dist/runtime/pg/pglite.js +9 -9
- package/dist/runtime/pg/postgresjs.js +5 -5
- package/dist/runtime/plan.d.ts +95 -5
- package/dist/runtime/read-stream.d.ts +13 -16
- package/dist/runtime/result-name.d.ts +17 -0
- package/dist/runtime/server-check.d.ts +3 -3
- package/dist/runtime/sort-bind.d.ts +21 -0
- package/dist/runtime/sort.d.ts +56 -0
- package/dist/runtime/sql-fragment.d.ts +43 -0
- package/dist/runtime/sync.d.ts +70 -0
- package/dist/runtime/tenancy/index.js +15 -13
- package/dist/runtime/text-search.d.ts +20 -0
- package/dist/runtime/topology.d.ts +1 -1
- package/dist/runtime/traits/index.d.ts +80 -0
- package/dist/runtime/traits/index.js +184 -21
- package/dist/runtime/tree.d.ts +38 -0
- package/dist/runtime/types.d.ts +232 -22
- package/dist/runtime/validate/index.js +4 -4
- package/dist/runtime/version.d.ts +39 -0
- package/dist/runtime/window.d.ts +21 -0
- package/dist/runtime/write.d.ts +54 -2
- package/dist/shared/{929h19xp.js → 0wrea3jq.js} +141 -13
- package/dist/shared/{qq3899ht.js → 12z7aznj.js} +243 -14
- package/dist/shared/{1z04fa85.js → 14x60fbf.js} +12 -57
- package/dist/shared/{ek2wt2dz.js → 16kvjebh.js} +4 -4
- package/dist/shared/{wynzeggs.js → 195pzzzz.js} +8 -8
- package/dist/shared/1d9q9cv2.js +312 -0
- package/dist/shared/2c13q96h.js +18 -0
- package/dist/shared/{b4v57v3x.js → 2d3xq4ps.js} +2 -2
- package/dist/shared/{1f0xa3cb.js → 3449rcae.js} +5 -5
- package/dist/shared/{wkme6tep.js → 35q0n9tz.js} +8 -16
- package/dist/shared/3bb7wsqt.js +99 -0
- package/dist/shared/3t6kw83m.js +249 -0
- package/dist/shared/{5j36z8dn.js → 4m6hskg8.js} +39 -70
- package/dist/shared/{n076ydsc.js → 4vbf83xx.js} +69 -28
- package/dist/shared/{vmfkhszw.js → 63f4ksbz.js} +33 -26
- package/dist/shared/{c58secgj.js → 63qtkrca.js} +38 -4
- package/dist/shared/6m78c8ss.js +6 -0
- package/dist/shared/{x3jc53kg.js → 760ppr76.js} +15 -7
- package/dist/shared/7ghwamrf.js +40 -0
- package/dist/shared/7kms6fvj.js +20 -0
- package/dist/shared/7n7ddwt4.js +6 -0
- package/dist/shared/9a4ae4p8.js +31 -0
- package/dist/shared/{hazqqecq.js → 9dr2qnx7.js} +63 -34
- package/dist/shared/{h15jx9bc.js → 9dvh1dr6.js} +1 -1
- package/dist/shared/a62rb2da.js +13 -0
- package/dist/shared/{cgbamx3e.js → ae4j5f42.js} +23 -4
- package/dist/shared/agsfb86s.js +233 -0
- package/dist/shared/{8x72s86k.js → b6d6p0zc.js} +13 -7
- package/dist/shared/{ag4c7516.js → b76b8d95.js} +2 -2
- package/dist/shared/{j60w0dvr.js → bah9nbg3.js} +58 -38
- package/dist/shared/bnby0esn.js +10 -0
- package/dist/shared/bsek72fg.js +225 -0
- package/dist/shared/{2cg3wnxc.js → bxas03mq.js} +608 -141
- package/dist/shared/{31vm914h.js → cm3w0ywp.js} +15 -16
- package/dist/shared/{gwn6v667.js → cnkky55j.js} +25 -14
- package/dist/shared/{dk8v79p3.js → d5nmj7vv.js} +1 -1
- package/dist/shared/{ttmg09vd.js → dpc2r7rb.js} +8 -8
- package/dist/shared/dzj09cye.js +10 -0
- package/dist/shared/{sbdme3vy.js → e8zyaqvj.js} +60 -10
- package/dist/shared/{2jd1sn0e.js → ecn8mfdq.js} +6 -6
- package/dist/shared/exn3sd90.js +359 -0
- package/dist/shared/{t3g0k88x.js → f4jy1j7x.js} +39 -22
- package/dist/shared/{y2t3jktd.js → fjpnhqan.js} +20 -13
- package/dist/shared/g5yc06ka.js +272 -0
- package/dist/shared/ga9j92qj.js +25 -0
- package/dist/shared/{3fqwmr09.js → hfqmpasr.js} +6 -6
- package/dist/shared/{wt5rzv1h.js → hm5f8jby.js} +7 -7
- package/dist/shared/{ys0xzyaj.js → hqpxf4a4.js} +224 -19
- package/dist/shared/jebgrkeq.js +179 -0
- package/dist/shared/{09p049xa.js → jp36k7dp.js} +44 -16
- package/dist/shared/jx2m62cs.js +96 -0
- package/dist/shared/{r11n8grd.js → k86n8vq3.js} +7 -4
- package/dist/shared/{2z7wv5tj.js → kgwp4jdd.js} +56 -35
- package/dist/shared/{knmes2kh.js → kj9d8maq.js} +1 -1
- package/dist/shared/{g90m9b0g.js → m4xff2a6.js} +6 -5
- package/dist/shared/{r6nwkxnt.js → m7n9h2a5.js} +4 -4
- package/dist/shared/mfedzr74.js +145 -0
- package/dist/shared/{f0f1n281.js → mkrn359n.js} +60 -11
- package/dist/shared/{p248q79y.js → mnvjvqyp.js} +10 -10
- package/dist/shared/{672t5vym.js → mss6ctgv.js} +2 -2
- package/dist/shared/{4az561fn.js → mtw6jz76.js} +8 -23
- package/dist/shared/n05z9nwz.js +313 -0
- package/dist/shared/{pjr6xrm5.js → n0jmpgj1.js} +20 -17
- package/dist/shared/{p6bjzq9q.js → n41w4fbz.js} +14 -6
- package/dist/shared/{b3awxn7h.js → n454kcnw.js} +1 -1
- package/dist/shared/n7kg8mmx.js +61 -0
- package/dist/shared/nbw1z4yd.js +18 -0
- package/dist/shared/needfe47.js +66 -0
- package/dist/shared/{1nw1f3vs.js → njga14v4.js} +9 -9
- package/dist/shared/{5yv4k6a6.js → nmnsgj7x.js} +145 -3
- package/dist/shared/{vjpnzwjz.js → p3xbdcvt.js} +14 -18
- package/dist/shared/p5nh3r8q.js +622 -0
- package/dist/shared/{nx9hh281.js → pan0370z.js} +13 -12
- package/dist/shared/q0cqt2sp.js +12 -0
- package/dist/shared/qd9hhd8f.js +37 -0
- package/dist/shared/{mb2ycs1p.js → qfw14tna.js} +15 -15
- package/dist/shared/{9s0ypp87.js → sjk86yrx.js} +1 -1
- package/dist/shared/th3be82n.js +208 -0
- package/dist/shared/{ed0b8k4s.js → typ3vy7t.js} +1 -1
- package/dist/shared/{5d8t84hg.js → v1wad97q.js} +14 -14
- package/dist/shared/{x72jb7ad.js → v8g1vgv8.js} +1 -1
- package/dist/shared/{9628a9xt.js → vk7rag46.js} +1 -1
- package/dist/shared/{ze4hxsmy.js → w9ejzaqf.js} +1 -1
- package/dist/shared/{q3j1tq7a.js → wcrheftc.js} +148 -23
- package/dist/shared/wvdjznah.js +213 -0
- package/dist/shared/wz2a78mp.js +8 -0
- package/dist/shared/xfhe73sb.js +436 -0
- package/dist/shared/{r1fdd0f6.js → z581d7ny.js} +5 -2
- package/dist/shared/{8etn7d8w.js → z7s6fpxv.js} +1 -1
- package/dist/shared/{32cnm7kn.js → zbqbmmrp.js} +76 -40
- package/dist/shared/{n7mcc1gk.js → zchaghkf.js} +4 -3
- package/dist/shared/{xq0mvhts.js → zgex00fd.js} +6 -6
- package/dist/shared/{nsva2a6b.js → znm0bpp5.js} +3 -0
- package/dist/shared/zq1he88x.js +155 -0
- package/dist/tooling/cli.js +26 -13
- package/dist/tooling/driver-run.js +4971 -0
- package/dist/tooling/driver-test.d.ts +36 -0
- package/dist/tooling/migrate/commands.d.ts +2 -2
- package/dist/tooling/migrate/engine.d.ts +3 -2
- package/dist/tooling/migrate/index.js +9 -9
- package/dist/tooling/migrate/project.d.ts +3 -0
- package/dist/tooling/shared/03k6res6.js +210 -0
- package/dist/tooling/shared/08kemxjd.js +10 -0
- package/dist/tooling/shared/2revefqt.js +209 -0
- package/dist/tooling/shared/2wtvc7rw.js +1425 -0
- package/dist/tooling/shared/345tbc2k.js +16 -0
- package/dist/tooling/shared/3m1hkg7z.js +344 -0
- package/dist/tooling/shared/3rrw5w8f.js +81 -0
- package/dist/tooling/shared/3tq8pnb8.js +131 -0
- package/dist/tooling/shared/417zdsk7.js +194 -0
- package/dist/tooling/shared/4d2w25vw.js +40 -0
- package/dist/tooling/shared/54tqkxja.js +51 -0
- package/dist/tooling/shared/5bvw2nev.js +12 -0
- package/dist/tooling/shared/6nyfyw70.js +231 -0
- package/dist/tooling/shared/72fyg4zv.js +160 -0
- package/dist/tooling/shared/733a1tq3.js +38 -0
- package/dist/tooling/shared/7ae7rjmn.js +20 -0
- package/dist/tooling/shared/7kms6fvj.js +20 -0
- package/dist/tooling/shared/8sqrsw3s.js +49 -0
- package/dist/tooling/shared/96ps4g1z.js +32 -0
- package/dist/tooling/shared/9kazs5p6.js +195 -0
- package/dist/tooling/shared/9xzm7hjg.js +38 -0
- package/dist/tooling/shared/a6pp9d12.js +49 -0
- package/dist/tooling/shared/a7q7t4n3.js +22 -0
- package/dist/tooling/shared/aftb2mwr.js +18 -0
- package/dist/tooling/shared/bz2dqhab.js +311 -0
- package/dist/tooling/shared/cmptmb4f.js +12 -0
- package/dist/tooling/shared/ddjtfgnx.js +177 -0
- package/dist/tooling/shared/djydjpqt.js +261 -0
- package/dist/tooling/shared/dw08f3m8.js +9 -0
- package/dist/tooling/shared/dy672fz6.js +16 -0
- package/dist/tooling/shared/dzx85q70.js +66 -0
- package/dist/tooling/shared/ec71zqgt.js +270 -0
- package/dist/{shared/d5azex6s.js → tooling/shared/ep8zh3bk.js} +1 -1
- package/dist/tooling/shared/f9mphxej.js +3789 -0
- package/dist/tooling/shared/fb9k2qwd.js +89 -0
- package/dist/tooling/shared/g9ad4n80.js +211 -0
- package/dist/tooling/shared/gfvtj6d0.js +94 -0
- package/dist/tooling/shared/gmcf9cxf.js +294 -0
- package/dist/tooling/shared/htnaj77v.js +17 -0
- package/dist/tooling/shared/j9t5s12a.js +7 -0
- package/dist/tooling/shared/jne7b93p.js +42 -0
- package/dist/tooling/shared/ma2340rx.js +118 -0
- package/dist/tooling/shared/mtrqn2hn.js +505 -0
- package/dist/tooling/shared/n4jqhpqz.js +27 -0
- package/dist/tooling/shared/nf7jmhfa.js +20 -0
- package/dist/tooling/shared/p7f08ktn.js +332 -0
- package/dist/tooling/shared/ppnnnvj8.js +13 -0
- package/dist/tooling/shared/pqy21k24.js +312 -0
- package/dist/tooling/shared/pw8fgahx.js +69 -0
- package/dist/tooling/shared/pwsytxm5.js +17 -0
- package/dist/tooling/shared/rf83gr2d.js +94 -0
- package/dist/tooling/shared/rq5kk8j6.js +401 -0
- package/dist/tooling/shared/rs1jb051.js +12 -0
- package/dist/tooling/shared/smn6kz1p.js +157 -0
- package/dist/tooling/shared/spk1jg3r.js +1696 -0
- package/dist/tooling/shared/tn8gay14.js +143 -0
- package/dist/tooling/shared/vraj6d74.js +42 -0
- package/dist/tooling/shared/vs0t6qt8.js +64 -0
- package/dist/tooling/shared/vx86qjv8.js +150 -0
- package/dist/tooling/shared/w7qe8sj1.js +140 -0
- package/dist/tooling/shared/wt7j7nf6.js +15 -0
- package/dist/tooling/shared/wwnekq5n.js +6 -0
- package/dist/tooling/shared/xhrnjch9.js +185 -0
- package/dist/tooling/shared/xjs6zqtc.js +190 -0
- package/dist/tooling/shared/y031jct9.js +16 -0
- package/dist/tooling/shared/y5656f0e.js +233 -0
- package/dist/tooling/shared/yfr8hzhm.js +604 -0
- package/dist/tooling/shared/yk9mp7vb.js +250 -0
- package/dist/tooling/shared/yw30vnq2.js +139 -0
- package/dist/tooling/shared/z8d7ptht.js +618 -0
- package/dist/tooling/shared/zhwnfyb2.js +9 -0
- package/dist/tooling/shared/zvnhh1n0.js +198 -0
- package/dist/tooling/testing/index.js +3 -3
- package/package.json +17 -3
- package/dist/shared/3qnhc7w5.js +0 -38
- package/dist/shared/7m88x3e9.js +0 -45
- package/dist/shared/8dqhth8c.js +0 -12
- package/dist/shared/j3rkk835.js +0 -99
- package/dist/shared/k68eedmy.js +0 -85
- package/dist/shared/venqrjna.js +0 -216
- package/dist/shared/wxr8cwns.js +0 -6
- package/dist/shared/y34a8714.js +0 -150
- package/dist/shared/zm0mafk4.js +0 -92
- 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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
touchFields,
|
|
3
3
|
fieldSealed
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./bxas03mq.js";
|
|
5
5
|
import {
|
|
6
6
|
projectExpr,
|
|
7
7
|
quote,
|
|
8
8
|
list,
|
|
9
9
|
isRecord,
|
|
10
10
|
registerFailFix,
|
|
11
|
-
|
|
12
|
-
} from "./
|
|
11
|
+
fail2
|
|
12
|
+
} from "./kgwp4jdd.js";
|
|
13
13
|
import {
|
|
14
14
|
throwNamed2
|
|
15
15
|
} from "./52szzakm.js";
|
|
@@ -24,13 +24,13 @@ function readConflict(table, value, allow = NO_ALLOW, tenantKey) {
|
|
|
24
24
|
if (value === "ignore")
|
|
25
25
|
return { kind: "ignore", columns: [], update: [] };
|
|
26
26
|
if (!isRecord(value)) {
|
|
27
|
-
|
|
27
|
+
fail2("OKM1120", 'onConflict must be "error", "ignore", { on, update }, or { on, return: true }.');
|
|
28
28
|
}
|
|
29
29
|
const keys = Object.keys(value);
|
|
30
30
|
const update = value.update;
|
|
31
31
|
const ret = value.return;
|
|
32
32
|
if (update !== undefined && ret !== undefined) {
|
|
33
|
-
|
|
33
|
+
fail2("OKM1120", "onConflict takes update or return, not both.");
|
|
34
34
|
}
|
|
35
35
|
if (ret === true) {
|
|
36
36
|
rejectConflictKeys(keys, ["on", "return"]);
|
|
@@ -44,9 +44,9 @@ function readConflict(table, value, allow = NO_ALLOW, tenantKey) {
|
|
|
44
44
|
update: updateColumns(table, update, allow)
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
fail2("OKM1120", 'onConflict must be "error", "ignore", { on, update }, or { on, return: true }.');
|
|
48
48
|
}
|
|
49
|
-
function finishInsert(head, returning, params, plan, table
|
|
49
|
+
function finishInsert(head, returning, params, plan, table) {
|
|
50
50
|
if (plan.kind === "ignore") {
|
|
51
51
|
return { text: `${head} on conflict do nothing${returning}`, params: [...params] };
|
|
52
52
|
}
|
|
@@ -66,10 +66,13 @@ function finishInsert(head, returning, params, plan, table, returningColumns, ke
|
|
|
66
66
|
params: [...params]
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return {
|
|
70
|
+
text: `${head} on conflict (${target})${conflictWhere(table, plan.columns)} do nothing${returning}`,
|
|
71
|
+
params: [...params]
|
|
72
|
+
};
|
|
70
73
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
74
|
+
function lookupExisting(table, keys, returningColumns, keyRows) {
|
|
75
|
+
const params = [];
|
|
73
76
|
const tuples = [];
|
|
74
77
|
for (const row of keyRows) {
|
|
75
78
|
const slots = [];
|
|
@@ -77,18 +80,21 @@ function firstOrCreate(head, returning, params, keys, table, returningColumns, k
|
|
|
77
80
|
const column = keys[index];
|
|
78
81
|
if (column === undefined)
|
|
79
82
|
continue;
|
|
80
|
-
|
|
81
|
-
slots.push(`$${String(
|
|
83
|
+
params.push(row[index] ?? null);
|
|
84
|
+
slots.push(`$${String(params.length)}::${column.dataType}`);
|
|
82
85
|
}
|
|
83
86
|
tuples.push(keys.length === 1 ? slots[0] ?? "null" : `(${slots.join(", ")})`);
|
|
84
87
|
}
|
|
85
|
-
const keyList = keys.map((column) => quote(column.sql)).join(", ");
|
|
86
88
|
const left = keys.length === 1 ? `t.${quote(keys[0]?.sql ?? "")}` : `(${keys.map((column) => `t.${quote(column.sql)}`).join(", ")})`;
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
const projected = returningColumns.map((column) => projectExpr(`t.${quote(column.sql)}`, column.dataType)).join(", ");
|
|
90
|
+
const text = `select ${projected} from ${quote(table.model.sql)} t where ${left} in (${tuples.join(", ")})${activeAnd(table, keys)}`;
|
|
91
|
+
return { text, params };
|
|
92
|
+
}
|
|
93
|
+
function activeAnd(table, columns) {
|
|
94
|
+
const clause = conflictWhere(table, columns);
|
|
95
|
+
if (clause === "")
|
|
96
|
+
return "";
|
|
97
|
+
return ` and t.${clause.replace(/^ where /, "")}`;
|
|
92
98
|
}
|
|
93
99
|
function conflictWhere(table, columns) {
|
|
94
100
|
const archive = table.model.archive;
|
|
@@ -121,7 +127,7 @@ function uniqueColumns(table, on, tenantKey) {
|
|
|
121
127
|
for (const name of fields) {
|
|
122
128
|
const column = table.columns.get(name);
|
|
123
129
|
if (column === undefined) {
|
|
124
|
-
|
|
130
|
+
fail2("OKM1104", `onConflict column ${name} is not on ${table.model.name}.`);
|
|
125
131
|
}
|
|
126
132
|
columns.push(column);
|
|
127
133
|
}
|
|
@@ -143,12 +149,12 @@ function acceptedConstraints(model, keys) {
|
|
|
143
149
|
}
|
|
144
150
|
function updateColumns(table, value, allow) {
|
|
145
151
|
if (!Array.isArray(value) || value.length === 0) {
|
|
146
|
-
|
|
152
|
+
fail2("OKM1120", "onConflict update must name at least one column.");
|
|
147
153
|
}
|
|
148
154
|
const columns = [];
|
|
149
155
|
for (const name of value) {
|
|
150
156
|
if (typeof name !== "string")
|
|
151
|
-
|
|
157
|
+
fail2("OKM1120", "onConflict update must name columns.");
|
|
152
158
|
const column = table.columns.get(name);
|
|
153
159
|
if (column === undefined) {
|
|
154
160
|
throwNamed2("OKM1120", name, table.names, `Field ${name} is not on ${table.model.name}. Accepted names: ${list(table.names)}.`);
|
|
@@ -166,7 +172,7 @@ function conflictNames(on) {
|
|
|
166
172
|
if (Array.isArray(on) && on.length > 0 && on.every((name) => typeof name === "string")) {
|
|
167
173
|
return on;
|
|
168
174
|
}
|
|
169
|
-
|
|
175
|
+
fail2("OKM1104", "onConflict on must name a unique constraint's columns.");
|
|
170
176
|
}
|
|
171
177
|
function fieldsOf(unique, names, tenantKeys) {
|
|
172
178
|
if (tenantKeys.some((key) => unique.includes(key))) {
|
|
@@ -210,17 +216,18 @@ function rejectConflictKeys(keys, accepted) {
|
|
|
210
216
|
}
|
|
211
217
|
function refuseWrite(table, column) {
|
|
212
218
|
if (fieldSealed(table.model, column.field)) {
|
|
213
|
-
|
|
219
|
+
fail2("OKM1190", `Field ${table.model.name}.${column.field} is set by a trait. Input cannot set it.`);
|
|
214
220
|
}
|
|
215
221
|
if (column.guardUpdate) {
|
|
216
|
-
|
|
222
|
+
fail2("OKM1190", `Field ${table.model.name}.${column.field} is a primary key. Input cannot change it.`);
|
|
217
223
|
}
|
|
218
224
|
if (column.guarded) {
|
|
219
|
-
|
|
225
|
+
fail2("OKM1190", `Field ${table.model.name}.${column.field} is guarded. Input cannot set it.`);
|
|
220
226
|
}
|
|
221
|
-
|
|
227
|
+
fail2("OKM1120", `Field ${table.model.name}.${column.field} cannot be written.`);
|
|
222
228
|
}
|
|
223
229
|
export {
|
|
224
230
|
finishInsert,
|
|
231
|
+
lookupExisting,
|
|
225
232
|
readConflict
|
|
226
233
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isConnectionSqlstate,
|
|
3
3
|
isConnectionFailure
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./cnkky55j.js";
|
|
5
5
|
import {
|
|
6
6
|
OkmError2,
|
|
7
7
|
stripRowValues,
|
|
@@ -9,11 +9,14 @@ import {
|
|
|
9
9
|
} from "./52szzakm.js";
|
|
10
10
|
|
|
11
11
|
// src/dialects/pg/errors.ts
|
|
12
|
-
function
|
|
12
|
+
function mapPostgresError(error, options) {
|
|
13
13
|
if (error instanceof OkmError2)
|
|
14
14
|
return error;
|
|
15
15
|
if (!isDriverError(error))
|
|
16
16
|
return OkmError2.from(error);
|
|
17
|
+
const search = searchInputError(error);
|
|
18
|
+
if (search !== undefined)
|
|
19
|
+
return search;
|
|
17
20
|
const kind = kindOf(error);
|
|
18
21
|
const columns = columnsOf(error);
|
|
19
22
|
const hint = hintOf(error, kind);
|
|
@@ -45,6 +48,36 @@ function isDriverError(error) {
|
|
|
45
48
|
return false;
|
|
46
49
|
return "batchIndex" in error;
|
|
47
50
|
}
|
|
51
|
+
function searchQuery(error) {
|
|
52
|
+
const cause = error.cause;
|
|
53
|
+
if (typeof cause !== "object" || cause === null)
|
|
54
|
+
return false;
|
|
55
|
+
const query = Reflect.get(cause, "query");
|
|
56
|
+
return typeof query === "string" && query.includes("to_tsquery");
|
|
57
|
+
}
|
|
58
|
+
function searchInputError(error) {
|
|
59
|
+
const sqlstate = error.sqlstate;
|
|
60
|
+
const message = error.message;
|
|
61
|
+
if (sqlstate === "42601" && (message.includes("tsquery") || searchQuery(error))) {
|
|
62
|
+
return new OkmError2("OKM1120", `Search input is not valid. ${stripRowValues(message)}`, {
|
|
63
|
+
kind: "invalid",
|
|
64
|
+
sqlstate,
|
|
65
|
+
cause: error.cause ?? error,
|
|
66
|
+
fix: { summary: "Fix the advanced search text, or use natural, all-words, or phrase." }
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (sqlstate === "42704" && message.includes("text search configuration") && message.includes("does not exist")) {
|
|
70
|
+
return new OkmError2("OKM1122", stripRowValues(message), {
|
|
71
|
+
kind: "invalid",
|
|
72
|
+
sqlstate,
|
|
73
|
+
cause: error.cause ?? error,
|
|
74
|
+
fix: {
|
|
75
|
+
summary: "Use a text search configuration that exists, such as english, or omit language."
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
48
81
|
function kindOf(error) {
|
|
49
82
|
if (error.kind === "timeout" || error.kind === "cancelled" || error.kind === "outcome_unknown") {
|
|
50
83
|
return error.kind;
|
|
@@ -370,5 +403,6 @@ function labelOf(kind) {
|
|
|
370
403
|
return "Driver error";
|
|
371
404
|
}
|
|
372
405
|
}
|
|
373
|
-
|
|
374
|
-
|
|
406
|
+
export {
|
|
407
|
+
mapPostgresError
|
|
408
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeUuid,
|
|
3
3
|
decodeUuid
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./ecn8mfdq.js";
|
|
5
5
|
import {
|
|
6
6
|
encodeText,
|
|
7
7
|
decodeText
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./typ3vy7t.js";
|
|
9
9
|
import {
|
|
10
10
|
snakeCase
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./gcefca6p.js";
|
|
12
12
|
import {
|
|
13
13
|
OkmError2
|
|
14
14
|
} from "./52szzakm.js";
|
|
@@ -28,19 +28,27 @@ function viewMentions(query, name) {
|
|
|
28
28
|
pattern += '"?(?![A-Za-z0-9_])';
|
|
29
29
|
return new RegExp(pattern).test(query);
|
|
30
30
|
}
|
|
31
|
+
function readColumns(source) {
|
|
32
|
+
return typeof source === "function" ? source() : source;
|
|
33
|
+
}
|
|
34
|
+
function readQuery(source) {
|
|
35
|
+
return typeof source === "function" ? source() : source;
|
|
36
|
+
}
|
|
31
37
|
function viewClient(name, columns, query, tenancy, refresh = "plain") {
|
|
32
38
|
const field = camelCase(name);
|
|
33
39
|
const marked = readGlobal(name, tenancy);
|
|
34
40
|
return {
|
|
35
41
|
field,
|
|
36
42
|
install(model, scope, tables, casing, scoped) {
|
|
43
|
+
const listed = readColumns(columns);
|
|
44
|
+
const text = readQuery(query);
|
|
37
45
|
if (Object.hasOwn(model, field)) {
|
|
38
46
|
throw new OkmError2("OKM1023", `View ${name} uses the client name ${field}.`, {
|
|
39
47
|
fix: { summary: "Give the view a name that no table uses." }
|
|
40
48
|
});
|
|
41
49
|
}
|
|
42
|
-
const exposes = exposesKey(
|
|
43
|
-
if (scope !== undefined && readsTenant(
|
|
50
|
+
const exposes = exposesKey(listed, scope);
|
|
51
|
+
if (scope !== undefined && readsTenant(text, tables, casing, scoped)) {
|
|
44
52
|
if (!exposes && marked === undefined) {
|
|
45
53
|
throw new OkmError2("OKM1820", `View ${name} reads a tenant table and does not expose ${scope.key}.`, {
|
|
46
54
|
fix: {
|
|
@@ -58,7 +66,7 @@ function viewClient(name, columns, query, tenancy, refresh = "plain") {
|
|
|
58
66
|
sql: name,
|
|
59
67
|
primary: [],
|
|
60
68
|
uniques: [],
|
|
61
|
-
columns: columnModels(
|
|
69
|
+
columns: columnModels(listed, scope),
|
|
62
70
|
relations: []
|
|
63
71
|
};
|
|
64
72
|
if (marked !== undefined)
|
|
@@ -77,7 +85,7 @@ function viewClient(name, columns, query, tenancy, refresh = "plain") {
|
|
|
77
85
|
}
|
|
78
86
|
function refreshHandle(session, name, mode) {
|
|
79
87
|
const concurrently = mode === "concurrently";
|
|
80
|
-
return () => lazyRefresh(() => import("./
|
|
88
|
+
return () => lazyRefresh(() => import("./z7s6fpxv.js").then((mod) => mod.refreshView(session, name, concurrently)));
|
|
81
89
|
}
|
|
82
90
|
function lazyRefresh(run) {
|
|
83
91
|
let pending;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isConnectionLost
|
|
3
|
+
} from "./cnkky55j.js";
|
|
4
|
+
import {
|
|
5
|
+
rejectClosed
|
|
6
|
+
} from "./ae4j5f42.js";
|
|
7
|
+
|
|
8
|
+
// src/adapters/pg/reserved.ts
|
|
9
|
+
var RESET_ALL = "RESET ALL";
|
|
10
|
+
var UNLOCK = "SELECT pg_advisory_unlock_all()";
|
|
11
|
+
async function resetSession2(depth, run) {
|
|
12
|
+
if (depth > 0)
|
|
13
|
+
await run("ROLLBACK").catch(() => {
|
|
14
|
+
return;
|
|
15
|
+
});
|
|
16
|
+
try {
|
|
17
|
+
await run(RESET_ALL);
|
|
18
|
+
await run(UNLOCK);
|
|
19
|
+
} catch {
|
|
20
|
+
await run("ROLLBACK").catch(() => {
|
|
21
|
+
return;
|
|
22
|
+
});
|
|
23
|
+
await run(RESET_ALL);
|
|
24
|
+
await run(UNLOCK);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function resetQueried2(session) {
|
|
28
|
+
await resetSession2(session.inTransaction() ? 1 : 0, (text) => text === "ROLLBACK" ? session.rollback() : session.query(text, undefined, undefined));
|
|
29
|
+
}
|
|
30
|
+
function refuseWhenLost2(lost, run) {
|
|
31
|
+
if (lost.on)
|
|
32
|
+
return rejectClosed();
|
|
33
|
+
return run().catch((error) => {
|
|
34
|
+
if (isConnectionLost(error))
|
|
35
|
+
lost.on = true;
|
|
36
|
+
throw error;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { resetSession2, resetQueried2, refuseWhenLost2 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/adapters/pg/cursor.ts
|
|
2
|
+
async function* cursorStream(run, text, params) {
|
|
3
|
+
const name = "okm_stream";
|
|
4
|
+
await run("BEGIN");
|
|
5
|
+
try {
|
|
6
|
+
await run(`DECLARE ${name} NO SCROLL CURSOR FOR ${text}`, params);
|
|
7
|
+
for (;; ) {
|
|
8
|
+
const chunk = await run(`FETCH 64 FROM ${name}`);
|
|
9
|
+
if (chunk.rows.length === 0)
|
|
10
|
+
break;
|
|
11
|
+
yield chunk.rows;
|
|
12
|
+
}
|
|
13
|
+
} finally {
|
|
14
|
+
await run("ROLLBACK").catch(() => {
|
|
15
|
+
return;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { cursorStream };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/dialects/pg/ops/window.ts
|
|
2
|
+
var RUNTIME = Symbol.for("okmodel.window");
|
|
3
|
+
function isWindow(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && RUNTIME in value;
|
|
5
|
+
}
|
|
6
|
+
function rowNumber2(options) {
|
|
7
|
+
return frame("rowNumber", "row_number", undefined, options);
|
|
8
|
+
}
|
|
9
|
+
function rank2(options) {
|
|
10
|
+
return frame("rank", "rank", undefined, options);
|
|
11
|
+
}
|
|
12
|
+
function denseRank2(options) {
|
|
13
|
+
return frame("denseRank", "dense_rank", undefined, options);
|
|
14
|
+
}
|
|
15
|
+
function runningTotal2(column, options) {
|
|
16
|
+
return frame("runningTotal", "sum", column, options);
|
|
17
|
+
}
|
|
18
|
+
function frame(label, fn, column, options) {
|
|
19
|
+
const spec = options ?? { orderBy: undefined, as: undefined, partitionBy: undefined };
|
|
20
|
+
return {
|
|
21
|
+
[RUNTIME]: true,
|
|
22
|
+
label,
|
|
23
|
+
fn,
|
|
24
|
+
column,
|
|
25
|
+
partitionBy: spec.partitionBy,
|
|
26
|
+
orderBy: spec.orderBy,
|
|
27
|
+
as: spec.as
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { isWindow, rowNumber2, rank2, denseRank2, runningTotal2 };
|
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
UUIDV7_POSTGRES,
|
|
3
|
+
isPostgresMajor,
|
|
4
|
+
parsePostgresFloor,
|
|
5
|
+
formatPostgresFloor,
|
|
6
|
+
minPostgresDefinition,
|
|
7
|
+
uuidv7NeedsPostgres
|
|
8
|
+
} from "./ga9j92qj.js";
|
|
6
9
|
import {
|
|
7
10
|
isRelationCall
|
|
8
|
-
} from "./
|
|
11
|
+
} from "./exn3sd90.js";
|
|
9
12
|
import {
|
|
10
13
|
encodeText,
|
|
11
14
|
decodeText
|
|
12
|
-
} from "./
|
|
15
|
+
} from "./typ3vy7t.js";
|
|
13
16
|
import {
|
|
14
17
|
snakeCase,
|
|
15
18
|
emittedTypeName,
|
|
16
19
|
rejectLater
|
|
17
|
-
} from "./
|
|
20
|
+
} from "./gcefca6p.js";
|
|
18
21
|
import {
|
|
19
22
|
ColumnBuilder2,
|
|
20
23
|
formatType
|
|
21
|
-
} from "./
|
|
24
|
+
} from "./606g0nbf.js";
|
|
25
|
+
import {
|
|
26
|
+
readClientGenerator
|
|
27
|
+
} from "./rwmrejjz.js";
|
|
28
|
+
import {
|
|
29
|
+
withLocation
|
|
30
|
+
} from "./y6jdds7g.js";
|
|
31
|
+
import {
|
|
32
|
+
catalog,
|
|
33
|
+
enumType,
|
|
34
|
+
sameEnumLabels
|
|
35
|
+
} from "./ywspezzx.js";
|
|
22
36
|
import {
|
|
23
37
|
definition,
|
|
24
38
|
unavailable
|
|
@@ -26,9 +40,6 @@ import {
|
|
|
26
40
|
import {
|
|
27
41
|
quoteLiteral
|
|
28
42
|
} from "./94ez8kzh.js";
|
|
29
|
-
import {
|
|
30
|
-
withLocation
|
|
31
|
-
} from "./y6jdds7g.js";
|
|
32
43
|
import {
|
|
33
44
|
staticNamespace2,
|
|
34
45
|
table3,
|
|
@@ -48,9 +59,6 @@ import {
|
|
|
48
59
|
catalogError2,
|
|
49
60
|
throwNamed2
|
|
50
61
|
} from "./52szzakm.js";
|
|
51
|
-
import {
|
|
52
|
-
readClientGenerator
|
|
53
|
-
} from "./rwmrejjz.js";
|
|
54
62
|
|
|
55
63
|
// src/dialects/pg/compile.ts
|
|
56
64
|
function compileColumn(builder, input) {
|
|
@@ -149,6 +157,7 @@ var SCHEMA_KNOWN = new Set([
|
|
|
149
157
|
"defaults",
|
|
150
158
|
"extensions",
|
|
151
159
|
"functions",
|
|
160
|
+
"minPostgres",
|
|
152
161
|
"requires",
|
|
153
162
|
"tables",
|
|
154
163
|
"tenancy",
|
|
@@ -178,7 +187,7 @@ function schema2(config) {
|
|
|
178
187
|
const hooks = collectHooks(tenancy, schemaTraits, config.tables, config.views);
|
|
179
188
|
const types = readTypes(config.types);
|
|
180
189
|
const codecs = readCodecs(config.codecs);
|
|
181
|
-
const requires =
|
|
190
|
+
const requires = readFloor(config.minPostgres, config.requires);
|
|
182
191
|
const idDefault = readIdDefault(config.defaults);
|
|
183
192
|
const namespace = staticNamespace2("public");
|
|
184
193
|
const accepted = acceptTables(config.tables);
|
|
@@ -203,8 +212,9 @@ function schema2(config) {
|
|
|
203
212
|
compileForeignKeys(item, byName, accepted, jobs, edges);
|
|
204
213
|
}
|
|
205
214
|
const model = {};
|
|
215
|
+
const scopeFields = tenancy === undefined ? undefined : tenancy.keys !== undefined ? tenancy.keys : [tenancy.key];
|
|
206
216
|
for (const item of prepared) {
|
|
207
|
-
model[item.tsName] = tableModel(item, edges, byName, accepted);
|
|
217
|
+
model[item.tsName] = tableModel(item, edges, byName, accepted, scopeFields);
|
|
208
218
|
}
|
|
209
219
|
bindViews(config.views, model, tenancy, tables, casing);
|
|
210
220
|
let document;
|
|
@@ -502,7 +512,7 @@ function compileTable(item, namespace, casing, codecs, requires, idDefault, jobs
|
|
|
502
512
|
columnPrimary.push(prepared.sqlName);
|
|
503
513
|
}
|
|
504
514
|
if (column.state.defaultSql === "uuidv7()") {
|
|
505
|
-
refuseUuidV7(
|
|
515
|
+
refuseUuidV7(requires);
|
|
506
516
|
}
|
|
507
517
|
const labels = column.state.enumLabels;
|
|
508
518
|
if (labels !== undefined) {
|
|
@@ -858,7 +868,7 @@ function readCodecs(codecs) {
|
|
|
858
868
|
}
|
|
859
869
|
return { bigint, numeric, timestamps };
|
|
860
870
|
}
|
|
861
|
-
function tableModel(item, edges, byName, accepted) {
|
|
871
|
+
function tableModel(item, edges, byName, accepted, scopeFields) {
|
|
862
872
|
const primary = [];
|
|
863
873
|
for (const sqlName of item.primary) {
|
|
864
874
|
const column = item.bySql.get(sqlName);
|
|
@@ -891,7 +901,7 @@ function tableModel(item, edges, byName, accepted) {
|
|
|
891
901
|
primary,
|
|
892
902
|
uniques: item.uniques,
|
|
893
903
|
columns,
|
|
894
|
-
relations: resolveRelations(item, edges, byName, accepted),
|
|
904
|
+
relations: resolveRelations(item, edges, byName, accepted, scopeFields),
|
|
895
905
|
...conceal ? { conceal: true } : {},
|
|
896
906
|
...item.traits !== undefined ? { traits: item.traits } : {},
|
|
897
907
|
...item.provenance.source !== undefined ? { source: item.provenance.source } : {},
|
|
@@ -899,10 +909,11 @@ function tableModel(item, edges, byName, accepted) {
|
|
|
899
909
|
...item.presets !== undefined ? { presets: item.presets } : {}
|
|
900
910
|
};
|
|
901
911
|
}
|
|
902
|
-
function resolveRelations(item, edges, byName, accepted) {
|
|
912
|
+
function resolveRelations(item, edges, byName, accepted, scopeFields) {
|
|
903
913
|
const raw = item.relationOptions;
|
|
904
914
|
if (raw === undefined)
|
|
905
915
|
return [];
|
|
916
|
+
const describe = (table) => byName.get(table);
|
|
906
917
|
const record = raw;
|
|
907
918
|
const names = Object.keys(record);
|
|
908
919
|
const resolved = [];
|
|
@@ -913,11 +924,18 @@ function resolveRelations(item, edges, byName, accepted) {
|
|
|
913
924
|
seen.add(name);
|
|
914
925
|
const call = record[name];
|
|
915
926
|
if (!isRelationCall(call)) {
|
|
916
|
-
unavailable(`Table ${item.tsName} relation ${name} is not
|
|
927
|
+
unavailable(`Table ${item.tsName} relation ${name} is not a relation. one(), many(), manyThrough(), morph(), and morphMany() are accepted.`);
|
|
917
928
|
}
|
|
918
929
|
const own = call.resolve;
|
|
919
930
|
if (own !== undefined) {
|
|
920
|
-
resolved.push(own({
|
|
931
|
+
resolved.push(own({
|
|
932
|
+
owner: item.tsName,
|
|
933
|
+
name,
|
|
934
|
+
edges,
|
|
935
|
+
tables: accepted,
|
|
936
|
+
describe,
|
|
937
|
+
...scopeFields === undefined ? {} : { scopeFields }
|
|
938
|
+
}));
|
|
921
939
|
continue;
|
|
922
940
|
}
|
|
923
941
|
if (!byName.has(call.table)) {
|
|
@@ -1002,21 +1020,32 @@ function readIdDefault(defaults) {
|
|
|
1002
1020
|
return { kind: "client", fill };
|
|
1003
1021
|
definition('schema() defaults.id must be "uuidv7", "uuidv4", or a client generator.');
|
|
1004
1022
|
}
|
|
1005
|
-
function refuseUuidV7(
|
|
1006
|
-
const declared =
|
|
1007
|
-
if (!(declared > 0) || declared >=
|
|
1023
|
+
function refuseUuidV7(requires) {
|
|
1024
|
+
const declared = parsePostgresFloor(requires?.postgres);
|
|
1025
|
+
if (!(declared > 0) || declared >= UUIDV7_POSTGRES)
|
|
1008
1026
|
return;
|
|
1009
|
-
|
|
1027
|
+
const sentence = uuidv7NeedsPostgres();
|
|
1028
|
+
throw new OkmError2("OKM1812", sentence, { fix: { summary: sentence } });
|
|
1010
1029
|
}
|
|
1011
|
-
function
|
|
1012
|
-
if (requires
|
|
1013
|
-
|
|
1030
|
+
function readFloor(minPostgres, requires) {
|
|
1031
|
+
if (minPostgres !== undefined && requires !== undefined) {
|
|
1032
|
+
definition("minPostgres or requires.postgres, not both.");
|
|
1014
1033
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1034
|
+
if (minPostgres === undefined && requires === undefined)
|
|
1035
|
+
return;
|
|
1036
|
+
let major = minPostgres;
|
|
1037
|
+
if (minPostgres === undefined) {
|
|
1038
|
+
if (typeof requires !== "object" || requires === null || Array.isArray(requires)) {
|
|
1039
|
+
definition(minPostgresDefinition());
|
|
1040
|
+
}
|
|
1041
|
+
const postgres = requires.postgres;
|
|
1042
|
+
if (postgres === undefined)
|
|
1043
|
+
return {};
|
|
1044
|
+
major = typeof postgres === "string" ? parsePostgresFloor(postgres) : NaN;
|
|
1045
|
+
}
|
|
1046
|
+
if (!isPostgresMajor(major))
|
|
1047
|
+
definition(minPostgresDefinition());
|
|
1048
|
+
return { postgres: formatPostgresFloor(major) };
|
|
1020
1049
|
}
|
|
1021
1050
|
function readIndex(tableName, call) {
|
|
1022
1051
|
if (call.columns.length === 0) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fail2
|
|
3
|
+
} from "./kgwp4jdd.js";
|
|
4
|
+
|
|
5
|
+
// src/runtime/result-name.ts
|
|
6
|
+
var PROTOTYPE_KEYS = ",__proto__,constructor,toString,hasOwnProperty,valueOf,isPrototypeOf,propertyIsEnumerable,toLocaleString,__defineGetter__,__defineSetter__,__lookupGetter__,__lookupSetter__,then,";
|
|
7
|
+
function refusePrototypeKey(name, where) {
|
|
8
|
+
if (!PROTOTYPE_KEYS.includes(`,${name},`))
|
|
9
|
+
return;
|
|
10
|
+
fail2("OKM1120", `${where} ${name} is a prototype key. Use another name for the result.`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { refusePrototypeKey };
|
|
@@ -31,6 +31,22 @@ var BUNSQL_CAPABILITIES = {
|
|
|
31
31
|
prepared: "unnamed",
|
|
32
32
|
describe: false
|
|
33
33
|
};
|
|
34
|
+
var NEON_WEBSOCKET_CAPABILITIES = {
|
|
35
|
+
transactions: "interactive",
|
|
36
|
+
stream: false,
|
|
37
|
+
listen: false,
|
|
38
|
+
cancel: false,
|
|
39
|
+
prepared: "unnamed",
|
|
40
|
+
describe: false
|
|
41
|
+
};
|
|
42
|
+
var NEON_HTTP_CAPABILITIES = {
|
|
43
|
+
transactions: "batch",
|
|
44
|
+
stream: false,
|
|
45
|
+
listen: false,
|
|
46
|
+
cancel: false,
|
|
47
|
+
prepared: "none",
|
|
48
|
+
describe: false
|
|
49
|
+
};
|
|
34
50
|
function readCapability2(flags, name) {
|
|
35
51
|
return flags[name];
|
|
36
52
|
}
|
|
@@ -41,11 +57,14 @@ function hasCapability2(flags, name) {
|
|
|
41
57
|
// src/adapters/failure.ts
|
|
42
58
|
var loading;
|
|
43
59
|
function driverErrors() {
|
|
44
|
-
loading ??= import("./
|
|
60
|
+
loading ??= import("./v8g1vgv8.js");
|
|
45
61
|
return loading;
|
|
46
62
|
}
|
|
47
|
-
function rejectClosed(
|
|
48
|
-
return
|
|
63
|
+
function rejectClosed() {
|
|
64
|
+
return import("./2c13q96h.js").then((mod) => mod.closed());
|
|
65
|
+
}
|
|
66
|
+
function rejectUncancellable() {
|
|
67
|
+
return import("./2c13q96h.js").then((mod) => mod.refused());
|
|
49
68
|
}
|
|
50
69
|
function rejectCancelled() {
|
|
51
70
|
return driverErrors().then((mod) => Promise.reject(mod.cancelled()));
|
|
@@ -163,4 +182,4 @@ function countFrom(value, rows) {
|
|
|
163
182
|
return rows;
|
|
164
183
|
}
|
|
165
184
|
|
|
166
|
-
export { POSTGRESJS_CAPABILITIES, PGLITE_CAPABILITIES, NODE_POSTGRES_CAPABILITIES, BUNSQL_CAPABILITIES, readCapability2, hasCapability2, driverErrors, rejectClosed, rejectCancelled, rejectTimedOut, mapFailure, nextTransactionDepth, runCall, EMPTY_NOTICES, rowsFrom, resultFrom };
|
|
185
|
+
export { POSTGRESJS_CAPABILITIES, PGLITE_CAPABILITIES, NODE_POSTGRES_CAPABILITIES, BUNSQL_CAPABILITIES, NEON_WEBSOCKET_CAPABILITIES, NEON_HTTP_CAPABILITIES, readCapability2, hasCapability2, driverErrors, rejectClosed, rejectUncancellable, rejectCancelled, rejectTimedOut, mapFailure, nextTransactionDepth, runCall, EMPTY_NOTICES, rowsFrom, resultFrom };
|