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
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
DriverError2,
|
|
3
3
|
timedOut2,
|
|
4
4
|
isConnectionLost
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./2jdn09e2.js";
|
|
6
6
|
import {
|
|
7
7
|
PgSession2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./vms9dta5.js";
|
|
9
9
|
import {
|
|
10
10
|
driverErrors,
|
|
11
11
|
rejectClosed,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
runCall,
|
|
14
14
|
rowsFrom,
|
|
15
15
|
resultFrom
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./ry2f3w8p.js";
|
|
17
17
|
|
|
18
18
|
// src/adapters/pg/postgres-extra.ts
|
|
19
19
|
var RESET_ALL = "RESET ALL";
|
|
@@ -48,7 +48,7 @@ async function checkout(pool, timeoutMs) {
|
|
|
48
48
|
batch: (statements, options) => {
|
|
49
49
|
remember(options?.timeout);
|
|
50
50
|
return guard(() => runCall(pool.isClosed(), options, async (watch) => {
|
|
51
|
-
const { runAtomicBatch } = await import("./
|
|
51
|
+
const { runAtomicBatch } = await import("./xchpnbdv.js");
|
|
52
52
|
return runAtomicBatch(session, statements, watch);
|
|
53
53
|
}));
|
|
54
54
|
},
|
|
@@ -78,18 +78,12 @@ async function checkout(pool, timeoutMs) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
async function describe(sql, text, params) {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
columns: described.columns.map((column) => column.name),
|
|
85
|
-
parameterCount: described.types.length
|
|
86
|
-
};
|
|
81
|
+
const d = await sql.unsafe(text, asParams(params), { prepare: true }).describe();
|
|
82
|
+
return { columns: d.columns.map((c) => c.name), parameterCount: d.types.length };
|
|
87
83
|
}
|
|
88
84
|
async function* stream(sql, text, params) {
|
|
89
|
-
const
|
|
90
|
-
for await (const chunk of pending.cursor(64)) {
|
|
85
|
+
for await (const chunk of sql.unsafe(text, asParams(params)).cursor(64))
|
|
91
86
|
yield rowsFrom(chunk);
|
|
92
|
-
}
|
|
93
87
|
}
|
|
94
88
|
function poolWaits(sql) {
|
|
95
89
|
const options = sql.options;
|
|
@@ -103,14 +97,14 @@ function poolWaits(sql) {
|
|
|
103
97
|
n.add(id);
|
|
104
98
|
if (n.size < options.max) {
|
|
105
99
|
queueMicrotask(() => {
|
|
106
|
-
for (const
|
|
107
|
-
|
|
100
|
+
for (const w of q)
|
|
101
|
+
w.a();
|
|
108
102
|
});
|
|
109
103
|
return;
|
|
110
104
|
}
|
|
111
105
|
n.clear();
|
|
112
|
-
for (const
|
|
113
|
-
|
|
106
|
+
for (const w of q)
|
|
107
|
+
w.s();
|
|
114
108
|
q.clear();
|
|
115
109
|
};
|
|
116
110
|
return options;
|
|
@@ -192,41 +186,40 @@ function reserveConnection(sql, acquireMs, counters, callMs) {
|
|
|
192
186
|
counters.waiting = Math.max(0, counters.waiting - 1);
|
|
193
187
|
};
|
|
194
188
|
return new Promise((resolve, reject) => {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
timer = setTimeout(() => {
|
|
198
|
-
if (settled)
|
|
199
|
-
return;
|
|
200
|
-
settled = true;
|
|
201
|
-
finish();
|
|
202
|
-
driverErrors().then((errors) => {
|
|
203
|
-
reject(errors.acquireTimeout());
|
|
204
|
-
});
|
|
205
|
-
}, acquireMs);
|
|
206
|
-
}
|
|
207
|
-
const ms = callMs !== undefined && callMs > 0 ? callMs : 0;
|
|
208
|
-
deadline(ms, () => sql.reserve(), sql).then((connection) => {
|
|
209
|
-
if (settled) {
|
|
210
|
-
resetConnection(connection, 0).catch(() => {
|
|
211
|
-
return;
|
|
212
|
-
}).finally(() => {
|
|
213
|
-
connection.release();
|
|
214
|
-
});
|
|
189
|
+
const timer = acquireMs === undefined ? undefined : setTimeout(() => {
|
|
190
|
+
if (settled)
|
|
215
191
|
return;
|
|
216
|
-
}
|
|
217
192
|
settled = true;
|
|
218
|
-
if (timer !== undefined)
|
|
219
|
-
clearTimeout(timer);
|
|
220
193
|
finish();
|
|
221
|
-
|
|
222
|
-
|
|
194
|
+
driverErrors().then((errors) => {
|
|
195
|
+
reject(errors.acquireTimeout());
|
|
196
|
+
});
|
|
197
|
+
}, acquireMs);
|
|
198
|
+
const done = (fn) => {
|
|
223
199
|
if (settled)
|
|
224
200
|
return;
|
|
225
201
|
settled = true;
|
|
226
202
|
if (timer !== undefined)
|
|
227
203
|
clearTimeout(timer);
|
|
228
204
|
finish();
|
|
229
|
-
|
|
205
|
+
fn();
|
|
206
|
+
};
|
|
207
|
+
deadline(callMs !== undefined && callMs > 0 ? callMs : 0, () => sql.reserve(), sql).then((connection) => {
|
|
208
|
+
if (settled) {
|
|
209
|
+
resetConnection(connection, 0).catch(() => {
|
|
210
|
+
return;
|
|
211
|
+
}).finally(() => {
|
|
212
|
+
connection.release();
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
done(() => {
|
|
217
|
+
resolve(connection);
|
|
218
|
+
});
|
|
219
|
+
}, (error) => {
|
|
220
|
+
done(() => {
|
|
221
|
+
mapFailure(error).then(reject);
|
|
222
|
+
});
|
|
230
223
|
});
|
|
231
224
|
});
|
|
232
225
|
}
|
|
@@ -235,22 +228,20 @@ async function resetConnection(sql, depth) {
|
|
|
235
228
|
await sql.unsafe("ROLLBACK").catch(() => {
|
|
236
229
|
return;
|
|
237
230
|
});
|
|
238
|
-
|
|
231
|
+
const clear = async () => {
|
|
239
232
|
await sql.unsafe(RESET_ALL);
|
|
240
233
|
await sql.unsafe(UNLOCK);
|
|
234
|
+
};
|
|
235
|
+
try {
|
|
236
|
+
await clear();
|
|
241
237
|
} catch {
|
|
242
238
|
await sql.unsafe("ROLLBACK").catch(() => {
|
|
243
239
|
return;
|
|
244
240
|
});
|
|
245
|
-
await
|
|
246
|
-
await sql.unsafe(UNLOCK);
|
|
241
|
+
await clear();
|
|
247
242
|
}
|
|
248
243
|
}
|
|
249
|
-
|
|
250
|
-
if (params === undefined)
|
|
251
|
-
return [];
|
|
252
|
-
return params;
|
|
253
|
-
}
|
|
244
|
+
var asParams = (params) => params ?? [];
|
|
254
245
|
function arm(sql, lost) {
|
|
255
246
|
const unsafe = sql.unsafe.bind(sql);
|
|
256
247
|
sql.unsafe = (text, params, options) => unsafe(text, params, {
|
|
@@ -268,14 +259,7 @@ async function holdCheckout(gate, checkout) {
|
|
|
268
259
|
const connection = await checkout();
|
|
269
260
|
let released = false;
|
|
270
261
|
const release = connection.release.bind(connection);
|
|
271
|
-
connection.release = () =>
|
|
272
|
-
if (released)
|
|
273
|
-
return Promise.resolve();
|
|
274
|
-
released = true;
|
|
275
|
-
return release().finally(() => {
|
|
276
|
-
gate.leave();
|
|
277
|
-
});
|
|
278
|
-
};
|
|
262
|
+
connection.release = () => released ? Promise.resolve() : (released = true, release().finally(() => gate.leave()));
|
|
279
263
|
return connection;
|
|
280
264
|
} catch (error) {
|
|
281
265
|
gate.leave();
|
|
@@ -290,11 +274,9 @@ async function holdListener(gate, start) {
|
|
|
290
274
|
if (stopped)
|
|
291
275
|
return;
|
|
292
276
|
stopped = true;
|
|
293
|
-
|
|
294
|
-
await stop();
|
|
295
|
-
} finally {
|
|
277
|
+
await stop().finally(() => {
|
|
296
278
|
gate.leave();
|
|
297
|
-
}
|
|
279
|
+
});
|
|
298
280
|
};
|
|
299
281
|
} catch (error) {
|
|
300
282
|
gate.leave();
|
|
@@ -302,36 +284,35 @@ async function holdListener(gate, start) {
|
|
|
302
284
|
}
|
|
303
285
|
}
|
|
304
286
|
function watchQuery(pending, watch, onAbort, ctx) {
|
|
287
|
+
const done = () => {
|
|
288
|
+
ctx.leave();
|
|
289
|
+
ctx.untrack(pending);
|
|
290
|
+
watch.signal.removeEventListener("abort", onAbort);
|
|
291
|
+
};
|
|
305
292
|
return pending.then((value) => {
|
|
306
|
-
|
|
293
|
+
done();
|
|
307
294
|
const why = watch.reason();
|
|
308
295
|
if (why === "timeout" || why === "cancelled")
|
|
309
296
|
return classify(why, watch);
|
|
310
297
|
ctx.note(ctx.text);
|
|
311
298
|
return resultFrom(value, ctx.notices.since(ctx.start));
|
|
312
299
|
}, (error) => {
|
|
313
|
-
|
|
300
|
+
done();
|
|
314
301
|
return classify(error, watch);
|
|
315
302
|
});
|
|
316
303
|
}
|
|
317
|
-
function finishWatch(pending, watch, onAbort, ctx) {
|
|
318
|
-
ctx.leave();
|
|
319
|
-
ctx.untrack(pending);
|
|
320
|
-
watch.signal.removeEventListener("abort", onAbort);
|
|
321
|
-
}
|
|
322
304
|
async function classify(error, watch) {
|
|
323
305
|
const errors = await driverErrors();
|
|
324
306
|
if (error instanceof errors.DriverError)
|
|
325
|
-
|
|
307
|
+
throw error;
|
|
326
308
|
const why = typeof error === "string" ? error : watch.reason();
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return Promise.reject(errors.cancelled(typeof error === "string" ? undefined : error));
|
|
309
|
+
const cause = typeof error === "string" ? undefined : error;
|
|
310
|
+
if (why === "timeout")
|
|
311
|
+
throw errors.timedOut(cause);
|
|
312
|
+
if (why === "cancelled" || errors.errorField(error, "code") === "57014") {
|
|
313
|
+
throw errors.cancelled(cause);
|
|
333
314
|
}
|
|
334
|
-
|
|
315
|
+
throw errors.mapDriverError(error);
|
|
335
316
|
}
|
|
336
317
|
export {
|
|
337
318
|
checkout,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readHandle,
|
|
4
4
|
readCall,
|
|
5
5
|
attachHttp
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./gjj71hfh.js";
|
|
7
7
|
import {
|
|
8
8
|
OkmError,
|
|
9
9
|
throwNamed,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isRecord,
|
|
18
18
|
registerFailFix,
|
|
19
19
|
fail2
|
|
20
|
-
} from "./
|
|
20
|
+
} from "./2jdn09e2.js";
|
|
21
21
|
|
|
22
22
|
// src/runtime/page.ts
|
|
23
23
|
registerFailFix("OKM1130", "Request the next page with the same orderBy and the exact next value the previous page returned. The cursor encodes that order.");
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
readSelectFragment,
|
|
3
3
|
emitSqlSelect,
|
|
4
4
|
decodeSqlNumber
|
|
5
|
-
} from "./
|
|
6
|
-
import"./
|
|
5
|
+
} from "./ckq4z5ax.js";
|
|
6
|
+
import"./fdsek6pa.js";
|
|
7
7
|
import {
|
|
8
8
|
refusePrototypeKey
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./09a6vsys.js";
|
|
10
10
|
import {
|
|
11
11
|
throwNamed,
|
|
12
12
|
emitWhere,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
list,
|
|
21
21
|
isRecord,
|
|
22
22
|
fail2
|
|
23
|
-
} from "./
|
|
23
|
+
} from "./2jdn09e2.js";
|
|
24
24
|
|
|
25
25
|
// src/dialects/pg/ops/window.ts
|
|
26
26
|
var RUNTIME = Symbol.for("okmodel.window");
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
withHttp,
|
|
3
3
|
attachHttp,
|
|
4
4
|
mapOptions
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./gjj71hfh.js";
|
|
6
6
|
import {
|
|
7
7
|
OkmError,
|
|
8
8
|
POSTGRES_FLOOR,
|
|
9
9
|
isPostgresMajor,
|
|
10
10
|
parsePostgresFloor,
|
|
11
11
|
serverNeedsPostgres
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./2jdn09e2.js";
|
|
13
13
|
|
|
14
14
|
// src/runtime/artifact-file.ts
|
|
15
15
|
function artifactDir(catalogDir) {
|
|
@@ -73,12 +73,12 @@ async function acceptServer2(pool, schema, http, requireMeta, options, source) {
|
|
|
73
73
|
const result = await pool.execute(await versionSql(namespace), undefined, options);
|
|
74
74
|
rows = result.rows;
|
|
75
75
|
} catch (error) {
|
|
76
|
-
const { mapPostgresError } = await import("./
|
|
76
|
+
const { mapPostgresError } = await import("./xx3gmq94.js");
|
|
77
77
|
throw mapPostgresError(error, mapOptions(http, false, schema));
|
|
78
78
|
}
|
|
79
79
|
for (const name in schema.model) {
|
|
80
80
|
if (schema.model[name]?.presets !== undefined) {
|
|
81
|
-
(await import("./
|
|
81
|
+
(await import("./bj1kyqc8.js")).checkSchema(schema);
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -98,7 +98,7 @@ async function acceptServer2(pool, schema, http, requireMeta, options, source) {
|
|
|
98
98
|
}));
|
|
99
99
|
}
|
|
100
100
|
} else {
|
|
101
|
-
const { assertCompatible } = await import("./
|
|
101
|
+
const { assertCompatible } = await import("./0wtzps9p.js");
|
|
102
102
|
try {
|
|
103
103
|
await assertCompatible(pool, schema, recorded, source, options, namespace);
|
|
104
104
|
} catch (error) {
|
|
@@ -127,7 +127,7 @@ async function acceptServer2(pool, schema, http, requireMeta, options, source) {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
async function qualified(table, namespace) {
|
|
130
|
-
const { quoteIdent } = await import("./
|
|
130
|
+
const { quoteIdent } = await import("./8msbtw5s.js");
|
|
131
131
|
return `${quoteIdent(namespace)}.${table}`;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertNoControl
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./fdsek6pa.js";
|
|
4
4
|
import {
|
|
5
5
|
throwNamed,
|
|
6
6
|
isOperator,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
list,
|
|
13
13
|
isRecord,
|
|
14
14
|
fail2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./2jdn09e2.js";
|
|
16
16
|
|
|
17
17
|
// src/dialects/pg/ops/search-query.ts
|
|
18
18
|
function searchValue(query, options) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createClient
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./gjj71hfh.js";
|
|
4
4
|
import {
|
|
5
5
|
OkmError,
|
|
6
6
|
isConnectionSqlstate,
|
|
7
7
|
isConnectionErrno
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./2jdn09e2.js";
|
|
9
9
|
|
|
10
10
|
// src/runtime/topology.ts
|
|
11
11
|
var CIRCUIT_AT = 2;
|
|
@@ -1166,7 +1166,15 @@ function fromSelect(handle, select, candidates) {
|
|
|
1166
1166
|
lag: byteLagNumber(handle, endpoint)
|
|
1167
1167
|
});
|
|
1168
1168
|
}
|
|
1169
|
-
|
|
1169
|
+
let returned;
|
|
1170
|
+
try {
|
|
1171
|
+
returned = select(offered, { op: "read" });
|
|
1172
|
+
} catch (error) {
|
|
1173
|
+
if (error instanceof OkmError)
|
|
1174
|
+
throw error;
|
|
1175
|
+
const message = error instanceof Error ? error.message : "routing.select threw.";
|
|
1176
|
+
throw new OkmError("invalid", message, { kind: "invalid", cause: error });
|
|
1177
|
+
}
|
|
1170
1178
|
if (typeof returned === "string") {
|
|
1171
1179
|
const endpoint = endpoints.find((item) => item.name === returned);
|
|
1172
1180
|
if (endpoint !== undefined)
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
readHandle,
|
|
3
3
|
readCall,
|
|
4
4
|
attachHttp
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./gjj71hfh.js";
|
|
6
6
|
import {
|
|
7
7
|
OkmError,
|
|
8
8
|
throwNamed,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
list,
|
|
18
18
|
isRecord,
|
|
19
19
|
fail2
|
|
20
|
-
} from "./
|
|
20
|
+
} from "./2jdn09e2.js";
|
|
21
21
|
|
|
22
22
|
// src/runtime/tree.ts
|
|
23
23
|
var OPTIONS = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertNoControl
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./fdsek6pa.js";
|
|
4
4
|
import {
|
|
5
5
|
OkmError,
|
|
6
6
|
throwNamed,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
quote,
|
|
13
13
|
list,
|
|
14
14
|
fail2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./2jdn09e2.js";
|
|
16
16
|
|
|
17
17
|
// src/dialects/pg/ops/fragment.ts
|
|
18
18
|
var IDENT = Symbol("okmodel.sql.ident");
|
|
@@ -57,6 +57,9 @@ function scanLiteral(literal, state) {
|
|
|
57
57
|
for (let index = 0;index < literal.length; index += 1) {
|
|
58
58
|
const char = literal[index] ?? "";
|
|
59
59
|
const code = literal.charCodeAt(index);
|
|
60
|
+
if (char === "\\") {
|
|
61
|
+
fragmentError("A fragment cannot include a backslash.", "Pass the value as an interpolation.");
|
|
62
|
+
}
|
|
60
63
|
if (state.quote !== undefined) {
|
|
61
64
|
if (char !== state.quote)
|
|
62
65
|
continue;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
open4,
|
|
3
3
|
PgSession2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./vms9dta5.js";
|
|
5
5
|
import {
|
|
6
6
|
POSTGRESJS_CAPABILITIES,
|
|
7
7
|
readCapability2,
|
|
8
8
|
hasCapability2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./ry2f3w8p.js";
|
|
10
10
|
export {
|
|
11
11
|
PgSession2 as PgSession,
|
|
12
12
|
POSTGRESJS_CAPABILITIES as capabilities,
|
|
13
13
|
hasCapability2 as hasCapability,
|
|
14
|
-
|
|
14
|
+
open4 as open,
|
|
15
15
|
readCapability2 as readCapability
|
|
16
16
|
};
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
readHandle,
|
|
4
4
|
readCall,
|
|
5
5
|
attachHttp
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./gjj71hfh.js";
|
|
7
7
|
import {
|
|
8
8
|
OkmError,
|
|
9
9
|
throwNamed,
|
|
10
10
|
fail2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./2jdn09e2.js";
|
|
12
12
|
|
|
13
13
|
// src/runtime/lock.ts
|
|
14
14
|
var LOCKS = ["update", "share"];
|