@prisma/orm-target-mysql 8.0.0-rc.24-dev.27 → 8.0.0-rc.24-dev.29
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/dist/adapter-D4QpAe2i.d.mts +374 -0
- package/dist/adapter-D4QpAe2i.d.mts.map +1 -0
- package/dist/adapter.d.mts +8 -6
- package/dist/adapter.mjs +5 -3
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__codec-types.d.mts +2 -2
- package/dist/adapter__control.d.mts +1 -1
- package/dist/adapter__control.mjs +1 -1
- package/dist/adapter__runtime.d.mts +2 -2
- package/dist/adapter__runtime.mjs +2 -501
- package/dist/adapter__sql-renderer.d.mts +3 -0
- package/dist/adapter__sql-renderer.mjs +2 -0
- package/dist/aggregates-BK8qyA2x.d.mts +164 -0
- package/dist/aggregates-BK8qyA2x.d.mts.map +1 -0
- package/dist/aggregates-Bk6CCgQ-.mjs +145 -0
- package/dist/aggregates-Bk6CCgQ-.mjs.map +1 -0
- package/dist/codec-descriptor-B1fMmxOK-D59zKJws.d.mts +1 -0
- package/dist/{codec-descriptor-3xp1XvVH-DfPKpYeP.mjs → codec-descriptor-ByN7iIha-48yW7oDN.mjs} +23 -16
- package/dist/codec-descriptor-ByN7iIha-48yW7oDN.mjs.map +1 -0
- package/dist/codec-descriptor-CqM_hQjY.d.mts +2 -0
- package/dist/{codec-descriptor-DXyubAS6-XDBj6Yet.d.mts → codec-descriptor-DXsJwUng-D4abEAFs.d.mts} +10 -5
- package/dist/codec-descriptor-DXsJwUng-D4abEAFs.d.mts.map +1 -0
- package/dist/codec-ids-DHeJ2SMJ-Uz1FAFmQ.d.mts +26 -0
- package/dist/codec-ids-DHeJ2SMJ-Uz1FAFmQ.d.mts.map +1 -0
- package/dist/codec-ids-DuWt4aOn-DiyLf9dW.mjs +26 -0
- package/dist/codec-ids-DuWt4aOn-DiyLf9dW.mjs.map +1 -0
- package/dist/codec-types-BQBBUlf_.d.mts +1 -0
- package/dist/{codec-types-Bai_CFkk-DmZ74URd.d.mts → codec-types-C4Q_JJgX-CUPkvPDx.d.mts} +11 -5
- package/dist/codec-types-C4Q_JJgX-CUPkvPDx.d.mts.map +1 -0
- package/dist/codec-types-DxSSgcpB.d.mts +1 -0
- package/dist/{codecs-BMidk26M-B_iWNti6.d.mts → codecs-D35fqdXJ-BZwilYUu.d.mts} +115 -7
- package/dist/codecs-D35fqdXJ-BZwilYUu.d.mts.map +1 -0
- package/dist/{codecs-CIJRyUd3.d.mts → codecs-DTfUoamS.d.mts} +3 -3
- package/dist/{codecs-CIJRyUd3.d.mts.map → codecs-DTfUoamS.d.mts.map} +1 -1
- package/dist/{codecs-wVJlFapM.mjs → codecs-DVX-3El1.mjs} +429 -12
- package/dist/codecs-DVX-3El1.mjs.map +1 -0
- package/dist/{control-Dj8nIA1M.d.mts → control-B7v7zc3l.d.mts} +272 -13
- package/dist/control-B7v7zc3l.d.mts.map +1 -0
- package/dist/{control-D7_IpeiU.d.mts → control-BFe8NrSk.d.mts} +22 -5
- package/dist/control-BFe8NrSk.d.mts.map +1 -0
- package/dist/{control-BiZaCqna.mjs → control-BTolgwH5.mjs} +28 -13
- package/dist/control-BTolgwH5.mjs.map +1 -0
- package/dist/{control-CTfV1Zag.mjs → control-CZSBblPm.mjs} +26 -19
- package/dist/control-CZSBblPm.mjs.map +1 -0
- package/dist/{control-WNuLF2Wh.d.mts → control-DqJJGh-5.d.mts} +3 -3
- package/dist/control-DqJJGh-5.d.mts.map +1 -0
- package/dist/{control-RYDTbndD.mjs → control-DtXS4WsY.mjs} +9 -14
- package/dist/control-DtXS4WsY.mjs.map +1 -0
- package/dist/data-type-entries-DlbQ1Bvl-BFkHeHVz.mjs +108 -0
- package/dist/data-type-entries-DlbQ1Bvl-BFkHeHVz.mjs.map +1 -0
- package/dist/{data-types-65iVc7q1.d.mts → data-types-COQT9bVG.d.mts} +2 -2
- package/dist/data-types-COQT9bVG.d.mts.map +1 -0
- package/dist/data-types-CU_43cNv-CQ8eHx3H.mjs +461 -0
- package/dist/data-types-CU_43cNv-CQ8eHx3H.mjs.map +1 -0
- package/dist/{data-types-D2HAT-Qf-CSdDz1Pk.d.mts → data-types-C_vInIbm-Gt1XINav.d.mts} +58 -4
- package/dist/data-types-C_vInIbm-Gt1XINav.d.mts.map +1 -0
- package/dist/{date-time-now-generators-BKakW3gd-CIFPuRdM.mjs → date-time-now-generators-Cx_aQTSw-ay1tlvw6.mjs} +4 -15
- package/dist/date-time-now-generators-Cx_aQTSw-ay1tlvw6.mjs.map +1 -0
- package/dist/default-normalizer-C9c043DP-DPhwJOC4.mjs +175 -0
- package/dist/default-normalizer-C9c043DP-DPhwJOC4.mjs.map +1 -0
- package/dist/default-normalizer-zXWtDBp_.d.mts +31 -0
- package/dist/default-normalizer-zXWtDBp_.d.mts.map +1 -0
- package/dist/{descriptor-meta-e29H69KN-t-S8_DYh.mjs → descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs} +19 -12
- package/dist/descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs.map +1 -0
- package/dist/{descriptor-meta-BF6YvSag-ChHHvlHc.mjs → descriptor-meta-BHSEcFWR-41BcRcOy.mjs} +219 -25
- package/dist/descriptor-meta-BHSEcFWR-41BcRcOy.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs +17 -0
- package/dist/descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-DEKunXiL.d.mts +22 -0
- package/dist/descriptor-meta-runtime-DEKunXiL.d.mts.map +1 -0
- package/dist/driver.d.mts +3 -3
- package/dist/driver.mjs +2 -2
- package/dist/driver__control.d.mts +2 -2
- package/dist/driver__control.mjs +1 -1
- package/dist/driver__runtime.d.mts +2 -2
- package/dist/driver__runtime.mjs +1 -1
- package/dist/{errors-DjCkC9IM.d.mts → errors-B81Qeu5_.d.mts} +3 -2
- package/dist/errors-B81Qeu5_.d.mts.map +1 -0
- package/dist/{errors-Cng94tYg-DTH51xWG.mjs → errors-CWtFTnst-xBLJ-9Lp.mjs} +43 -17
- package/dist/errors-CWtFTnst-xBLJ-9Lp.mjs.map +1 -0
- package/dist/{marker-lock-Bwew7cAs-ElLxlCQp.mjs → marker-lock-B7CyXf2F-CakjZnQP.mjs} +3 -3
- package/dist/{marker-lock-Bwew7cAs-ElLxlCQp.mjs.map → marker-lock-B7CyXf2F-CakjZnQP.mjs.map} +1 -1
- package/dist/{marker-read-D1hp62hF-3-4fEgDD.mjs → marker-read-D1hp62hF-BSXs2TVo.mjs} +3 -3
- package/dist/{marker-read-D1hp62hF-3-4fEgDD.mjs.map → marker-read-D1hp62hF-BSXs2TVo.mjs.map} +1 -1
- package/dist/{migration-DILkj7kB.d.mts → migration-O-3NHVlW.d.mts} +2 -5
- package/dist/migration-O-3NHVlW.d.mts.map +1 -0
- package/dist/{mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs → mysql-contract-serializer-D7NjmI2L-gTs-kAW1.mjs} +4 -4
- package/dist/{mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs.map → mysql-contract-serializer-D7NjmI2L-gTs-kAW1.mjs.map} +1 -1
- package/dist/{mysql-database-CHl9-oSL-B1arvq6Q.mjs → mysql-database-ByniOtau-BKBIGgSm.mjs} +45 -17
- package/dist/mysql-database-ByniOtau-BKBIGgSm.mjs.map +1 -0
- package/dist/{now-expression-DVD18CUc-DJqdZY96.mjs → now-expression-DDHpZL6o-Ixs-vg-B.mjs} +3 -3
- package/dist/{now-expression-DVD18CUc-DJqdZY96.mjs.map → now-expression-DDHpZL6o-Ixs-vg-B.mjs.map} +1 -1
- package/dist/{pack-CqULIal0.d.mts → pack-C5_g-3YX.d.mts} +272 -11
- package/dist/{pack-CqULIal0.d.mts.map → pack-C5_g-3YX.d.mts.map} +1 -1
- package/dist/{require-temporal-DeDQhbTn-CdpjEWCB.mjs → require-temporal-DDdrgVtL-VOKxTqhD.mjs} +3 -3
- package/dist/{require-temporal-DeDQhbTn-CdpjEWCB.mjs.map → require-temporal-DDdrgVtL-VOKxTqhD.mjs.map} +1 -1
- package/dist/{runner-DEKKxDyw-Cdo1Ysod.mjs → runner-IjNtlp_v-DLCqpSh5.mjs} +68 -72
- package/dist/runner-IjNtlp_v-DLCqpSh5.mjs.map +1 -0
- package/dist/runtime-Bw6vKz9t.mjs +96 -0
- package/dist/runtime-Bw6vKz9t.mjs.map +1 -0
- package/dist/{runtime-DB0w8R7i.mjs → runtime-CHWztV6c.mjs} +66 -46
- package/dist/runtime-CHWztV6c.mjs.map +1 -0
- package/dist/{runtime-DN20lWEg.d.mts → runtime-CQ1V-8Yh.d.mts} +11 -4
- package/dist/runtime-CQ1V-8Yh.d.mts.map +1 -0
- package/dist/{runtime-CbqytTbM.d.mts → runtime-Ci3hPz1j.d.mts} +16 -5
- package/dist/runtime-Ci3hPz1j.d.mts.map +1 -0
- package/dist/{runtime-DUDdsFyy.mjs → runtime-_c_DZuYR.mjs} +18 -13
- package/dist/runtime-_c_DZuYR.mjs.map +1 -0
- package/dist/runtime-dn4-kzZV.d.mts +43 -0
- package/dist/runtime-dn4-kzZV.d.mts.map +1 -0
- package/dist/sql-renderer-CrnJ8cCo.d.mts +1 -0
- package/dist/sql-renderer-DfPaqPkD-DFaweHvr.mjs +501 -0
- package/dist/sql-renderer-DfPaqPkD-DFaweHvr.mjs.map +1 -0
- package/dist/sql-renderer-fnDhRUHs-CcsyIaZ4.d.mts +95 -0
- package/dist/sql-renderer-fnDhRUHs-CcsyIaZ4.d.mts.map +1 -0
- package/dist/{sql-utils-Cmv_TVa8-CNW3UmfQ.mjs → sql-utils-CveZhawQ-B2QmUlY0.mjs} +3 -3
- package/dist/{sql-utils-Cmv_TVa8-CNW3UmfQ.mjs.map → sql-utils-CveZhawQ-B2QmUlY0.mjs.map} +1 -1
- package/dist/{sql-utils-BE8tDXHs.mjs → sql-utils-DVH8boEI.mjs} +3 -6
- package/dist/sql-utils-DVH8boEI.mjs.map +1 -0
- package/dist/{statement-CT5tB4uX-CHqHFM3z.mjs → statement-a2Eekpu6-BDJa255m.mjs} +73 -67
- package/dist/statement-a2Eekpu6-BDJa255m.mjs.map +1 -0
- package/dist/target.d.mts +18 -16
- package/dist/target.mjs +21 -19
- package/dist/target__aggregates.d.mts +2 -0
- package/dist/target__aggregates.mjs +2 -0
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-ids.d.mts +2 -2
- package/dist/target__codec-ids.mjs +2 -2
- package/dist/target__codec-types.d.mts +2 -2
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__control.d.mts +1 -1
- package/dist/target__control.mjs +2 -2
- package/dist/target__data-types.d.mts +3 -3
- package/dist/target__data-types.mjs +3 -3
- package/dist/target__default-normalizer.d.mts +2 -2
- package/dist/target__default-normalizer.mjs +2 -2
- package/dist/target__descriptor-meta-runtime.d.mts +2 -0
- package/dist/target__descriptor-meta-runtime.mjs +2 -0
- package/dist/target__errors.d.mts +1 -1
- package/dist/target__errors.mjs +1 -1
- package/dist/target__marker-lock.mjs +1 -1
- package/dist/target__migration.d.mts +1 -1
- package/dist/target__migration.mjs +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__runtime.d.mts +2 -2
- package/dist/target__runtime.mjs +4 -4
- package/dist/target__sql-utils.mjs +2 -2
- package/dist/target__types.mjs +1 -1
- package/package.json +13 -10
- package/dist/adapter-1Kd67Gfa.d.mts +0 -66
- package/dist/adapter-1Kd67Gfa.d.mts.map +0 -1
- package/dist/adapter__runtime.mjs.map +0 -1
- package/dist/codec-descriptor-3xp1XvVH-DfPKpYeP.mjs.map +0 -1
- package/dist/codec-descriptor-BRcKIX3h.d.mts +0 -2
- package/dist/codec-descriptor-DXyubAS6-XDBj6Yet.d.mts.map +0 -1
- package/dist/codec-descriptor-J3TP08l8-BmdgkIU6.d.mts +0 -1
- package/dist/codec-ids-CrR9Xi7r-CjbGCS3o.mjs +0 -20
- package/dist/codec-ids-CrR9Xi7r-CjbGCS3o.mjs.map +0 -1
- package/dist/codec-ids-Dgh5IpML-DGXIq6j8.d.mts +0 -20
- package/dist/codec-ids-Dgh5IpML-DGXIq6j8.d.mts.map +0 -1
- package/dist/codec-types-BS-lWfda.d.mts +0 -1
- package/dist/codec-types-Bai_CFkk-DmZ74URd.d.mts.map +0 -1
- package/dist/codec-types-Dk2h5dBB.d.mts +0 -1
- package/dist/codecs-BMidk26M-B_iWNti6.d.mts.map +0 -1
- package/dist/codecs-wVJlFapM.mjs.map +0 -1
- package/dist/control-BiZaCqna.mjs.map +0 -1
- package/dist/control-CTfV1Zag.mjs.map +0 -1
- package/dist/control-D7_IpeiU.d.mts.map +0 -1
- package/dist/control-Dj8nIA1M.d.mts.map +0 -1
- package/dist/control-RYDTbndD.mjs.map +0 -1
- package/dist/control-WNuLF2Wh.d.mts.map +0 -1
- package/dist/data-type-entries-C7VH2IHc-DM6TbTaz.mjs +0 -59
- package/dist/data-type-entries-C7VH2IHc-DM6TbTaz.mjs.map +0 -1
- package/dist/data-types-65iVc7q1.d.mts.map +0 -1
- package/dist/data-types-D2HAT-Qf-CSdDz1Pk.d.mts.map +0 -1
- package/dist/data-types-DOaaPS93-lycGybNk.mjs +0 -289
- package/dist/data-types-DOaaPS93-lycGybNk.mjs.map +0 -1
- package/dist/date-time-now-generators-BKakW3gd-CIFPuRdM.mjs.map +0 -1
- package/dist/default-normalizer-C8pc7SbL-BXd70q02.mjs +0 -100
- package/dist/default-normalizer-C8pc7SbL-BXd70q02.mjs.map +0 -1
- package/dist/default-normalizer-D-8Ii0df.d.mts +0 -27
- package/dist/default-normalizer-D-8Ii0df.d.mts.map +0 -1
- package/dist/descriptor-meta-BF6YvSag-ChHHvlHc.mjs.map +0 -1
- package/dist/descriptor-meta-e29H69KN-t-S8_DYh.mjs.map +0 -1
- package/dist/errors-Cng94tYg-DTH51xWG.mjs.map +0 -1
- package/dist/errors-DjCkC9IM.d.mts.map +0 -1
- package/dist/migration-DILkj7kB.d.mts.map +0 -1
- package/dist/mysql-database-CHl9-oSL-B1arvq6Q.mjs.map +0 -1
- package/dist/runner-DEKKxDyw-Cdo1Ysod.mjs.map +0 -1
- package/dist/runtime-CbqytTbM.d.mts.map +0 -1
- package/dist/runtime-Cm-T3hbP.d.mts +0 -29
- package/dist/runtime-Cm-T3hbP.d.mts.map +0 -1
- package/dist/runtime-DB0w8R7i.mjs.map +0 -1
- package/dist/runtime-DN20lWEg.d.mts.map +0 -1
- package/dist/runtime-DUDdsFyy.mjs.map +0 -1
- package/dist/sql-utils-BE8tDXHs.mjs.map +0 -1
- package/dist/statement-CT5tB4uX-CHqHFM3z.mjs.map +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { g as MYSQL_TEXT_CODEC_ID, p as MYSQL_INT_CODEC_ID, t as MYSQL_BIGINT_CODEC_ID } from "./codec-ids-DuWt4aOn-DiyLf9dW.mjs";
|
|
2
|
+
import { a as mysqlCodecDescriptorRegistry, t as assembleMysqlCodecRegistry } from "./codecs-DVX-3El1.mjs";
|
|
3
|
+
import { t as mysqlTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs";
|
|
4
|
+
import { t as mysqlNowGenerators } from "./date-time-now-generators-Cx_aQTSw-ay1tlvw6.mjs";
|
|
5
|
+
import { r as mysqlAdapterDescriptorMeta } from "./descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs";
|
|
6
|
+
import { r as readMarkerResult } from "./marker-read-D1hp62hF-BSXs2TVo.mjs";
|
|
7
|
+
import { t as MysqlSqlRenderer } from "./sql-renderer-DfPaqPkD-DFaweHvr.mjs";
|
|
8
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
9
|
+
import { isDdlNode } from "@prisma/orm-family-sql/relational-core/ast";
|
|
10
|
+
import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
11
|
+
import { timestampNowRuntimeGenerator } from "@prisma/orm-family-sql/family/runtime";
|
|
12
|
+
//#region ../../../3-targets/mysql/1-mysql/2-adapter/dist/runtime.mjs
|
|
13
|
+
const INT_MIN = -(2 ** 31);
|
|
14
|
+
const INT_MAX = 2 ** 31 - 1;
|
|
15
|
+
function refuse(value) {
|
|
16
|
+
throw structuredError("RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION", "MySQL and MariaDB have no codec for this JS value in raw SQL: wrap it in `param(...)` with an explicit codec", { meta: { valueType: typeof value } });
|
|
17
|
+
}
|
|
18
|
+
/** The codec of a bare value interpolated into `fns.raw` or the raw lane on a MySQL client: integers, bigints and strings. */
|
|
19
|
+
const mysqlRawCodecInferer = { inferCodec(value) {
|
|
20
|
+
switch (typeof value) {
|
|
21
|
+
case "number":
|
|
22
|
+
if (!Number.isSafeInteger(value)) return refuse(value);
|
|
23
|
+
return value >= INT_MIN && value <= INT_MAX ? MYSQL_INT_CODEC_ID : refuse(value);
|
|
24
|
+
case "bigint": return MYSQL_BIGINT_CODEC_ID;
|
|
25
|
+
case "string": return MYSQL_TEXT_CODEC_ID;
|
|
26
|
+
default: return refuse(value);
|
|
27
|
+
}
|
|
28
|
+
} };
|
|
29
|
+
function markerQuery(queryable) {
|
|
30
|
+
return { async query(sql, params) {
|
|
31
|
+
const rows = [];
|
|
32
|
+
for await (const row of queryable.query({
|
|
33
|
+
sql,
|
|
34
|
+
...params ? { params } : {}
|
|
35
|
+
})) rows.push(row);
|
|
36
|
+
return { rows };
|
|
37
|
+
} };
|
|
38
|
+
}
|
|
39
|
+
var MysqlAdapterImpl = class {
|
|
40
|
+
familyId = "sql";
|
|
41
|
+
targetId;
|
|
42
|
+
profile;
|
|
43
|
+
#renderer;
|
|
44
|
+
constructor(options) {
|
|
45
|
+
this.targetId = options.targetId;
|
|
46
|
+
this.#renderer = options.renderer;
|
|
47
|
+
this.profile = Object.freeze({
|
|
48
|
+
id: `${options.targetId}/default@1`,
|
|
49
|
+
target: options.targetId,
|
|
50
|
+
capabilities: options.capabilities,
|
|
51
|
+
readMarker: (queryable) => readMarkerResult(markerQuery(queryable), APP_SPACE_ID)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
lower(ast, context) {
|
|
55
|
+
if (isDdlNode(ast)) throw structuredError("RUNTIME.DDL_UNSUPPORTED", "lower() does not lower DDL on the runtime adapter: DDL lowering belongs to the control adapter.", { meta: { surface: "runtime-adapter" } });
|
|
56
|
+
return this.#renderer.render(ast, context.contract);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
/** The runtime adapter of MySQL, or of a target that extends it: it lowers queries with the renderer it is given and reads the marker the control tables hold. */
|
|
60
|
+
function createMysqlAdapter(options) {
|
|
61
|
+
return Object.freeze(new MysqlAdapterImpl(options));
|
|
62
|
+
}
|
|
63
|
+
/** The `now()` generators of the MySQL date and time types: the SQL family's `timestampNow` for a `Date`, and the target's for every other value. */
|
|
64
|
+
function createMysqlMutationDefaultGenerators() {
|
|
65
|
+
return [timestampNowRuntimeGenerator(), ...mysqlNowGenerators.map(({ id, generate }) => ({
|
|
66
|
+
id,
|
|
67
|
+
generate,
|
|
68
|
+
stability: "query"
|
|
69
|
+
}))];
|
|
70
|
+
}
|
|
71
|
+
/** The runtime adapter descriptor of MySQL, or of a target that extends it. Its profile id is `<targetId>/default@1`. */
|
|
72
|
+
function createMysqlRuntimeAdapterDescriptor(options) {
|
|
73
|
+
const { descriptorMeta, target } = options;
|
|
74
|
+
return {
|
|
75
|
+
...descriptorMeta,
|
|
76
|
+
codecs: () => Array.from(mysqlCodecDescriptorRegistry.values()),
|
|
77
|
+
mutationDefaultGenerators: createMysqlMutationDefaultGenerators,
|
|
78
|
+
rawCodecInferer: mysqlRawCodecInferer,
|
|
79
|
+
create(stack) {
|
|
80
|
+
return createMysqlAdapter({
|
|
81
|
+
targetId: descriptorMeta.targetId,
|
|
82
|
+
capabilities: descriptorMeta.capabilities ?? {},
|
|
83
|
+
renderer: options.renderer(assembleMysqlCodecRegistry(stack.target, stack.extensions), target)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const mysqlRuntimeAdapterDescriptor = createMysqlRuntimeAdapterDescriptor({
|
|
89
|
+
descriptorMeta: mysqlAdapterDescriptorMeta,
|
|
90
|
+
target: mysqlTargetDescriptorMetaRuntime,
|
|
91
|
+
renderer: (codecs, target) => new MysqlSqlRenderer(codecs, target)
|
|
92
|
+
});
|
|
93
|
+
//#endregion
|
|
94
|
+
export { mysqlRuntimeAdapterDescriptor as n, createMysqlRuntimeAdapterDescriptor as t };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=runtime-Bw6vKz9t.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-Bw6vKz9t.mjs","names":["#renderer"],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/runtime.mjs"],"sourcesContent":["import { t as mysqlAdapterDescriptorMeta } from \"./descriptor-meta-BFQUMwkh.mjs\";\nimport { r as readMarkerResult } from \"./marker-read-D1hp62hF.mjs\";\nimport { t as MysqlSqlRenderer } from \"./sql-renderer-DfPaqPkD.mjs\";\nimport { assembleMysqlCodecRegistry, mysqlCodecDescriptorRegistry } from \"@internal/target-mysql/codecs\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { isDdlNode } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { timestampNowRuntimeGenerator } from \"@internal/family-sql/runtime\";\nimport { mysqlTargetDescriptorMetaRuntime } from \"@internal/target-mysql/descriptor-meta-runtime\";\nimport { mysqlNowGenerators } from \"@internal/target-mysql/runtime\";\nimport { MYSQL_BIGINT_CODEC_ID, MYSQL_INT_CODEC_ID, MYSQL_TEXT_CODEC_ID } from \"@internal/target-mysql/codec-ids\";\n//#region src/core/raw-codec-inferer.ts\nconst INT_MIN = -(2 ** 31);\nconst INT_MAX = 2 ** 31 - 1;\nfunction refuse(value) {\n\tthrow structuredError(\"RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION\", \"MySQL and MariaDB have no codec for this JS value in raw SQL: wrap it in `param(...)` with an explicit codec\", { meta: { valueType: typeof value } });\n}\n/** The codec of a bare value interpolated into `fns.raw` or the raw lane on a MySQL client: integers, bigints and strings. */\nconst mysqlRawCodecInferer = { inferCodec(value) {\n\tswitch (typeof value) {\n\t\tcase \"number\":\n\t\t\tif (!Number.isSafeInteger(value)) return refuse(value);\n\t\t\treturn value >= INT_MIN && value <= INT_MAX ? MYSQL_INT_CODEC_ID : refuse(value);\n\t\tcase \"bigint\": return MYSQL_BIGINT_CODEC_ID;\n\t\tcase \"string\": return MYSQL_TEXT_CODEC_ID;\n\t\tdefault: return refuse(value);\n\t}\n} };\n//#endregion\n//#region src/core/runtime/mysql-adapter.ts\nfunction markerQuery(queryable) {\n\treturn { async query(sql, params) {\n\t\tconst rows = [];\n\t\tfor await (const row of queryable.query({\n\t\t\tsql,\n\t\t\t...params ? { params } : {}\n\t\t})) rows.push(row);\n\t\treturn { rows };\n\t} };\n}\nvar MysqlAdapterImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId;\n\tprofile;\n\t#renderer;\n\tconstructor(options) {\n\t\tthis.targetId = options.targetId;\n\t\tthis.#renderer = options.renderer;\n\t\tthis.profile = Object.freeze({\n\t\t\tid: `${options.targetId}/default@1`,\n\t\t\ttarget: options.targetId,\n\t\t\tcapabilities: options.capabilities,\n\t\t\treadMarker: (queryable) => readMarkerResult(markerQuery(queryable), APP_SPACE_ID)\n\t\t});\n\t}\n\tlower(ast, context) {\n\t\tif (isDdlNode(ast)) throw structuredError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() does not lower DDL on the runtime adapter: DDL lowering belongs to the control adapter.\", { meta: { surface: \"runtime-adapter\" } });\n\t\treturn this.#renderer.render(ast, context.contract);\n\t}\n};\n/** The runtime adapter of MySQL, or of a target that extends it: it lowers queries with the renderer it is given and reads the marker the control tables hold. */\nfunction createMysqlAdapter(options) {\n\treturn Object.freeze(new MysqlAdapterImpl(options));\n}\n//#endregion\n//#region src/core/runtime/runtime-adapter.ts\n/** The `now()` generators of the MySQL date and time types: the SQL family's `timestampNow` for a `Date`, and the target's for every other value. */\nfunction createMysqlMutationDefaultGenerators() {\n\treturn [timestampNowRuntimeGenerator(), ...mysqlNowGenerators.map(({ id, generate }) => ({\n\t\tid,\n\t\tgenerate,\n\t\tstability: \"query\"\n\t}))];\n}\n/** The runtime adapter descriptor of MySQL, or of a target that extends it. Its profile id is `<targetId>/default@1`. */\nfunction createMysqlRuntimeAdapterDescriptor(options) {\n\tconst { descriptorMeta, target } = options;\n\treturn {\n\t\t...descriptorMeta,\n\t\tcodecs: () => Array.from(mysqlCodecDescriptorRegistry.values()),\n\t\tmutationDefaultGenerators: createMysqlMutationDefaultGenerators,\n\t\trawCodecInferer: mysqlRawCodecInferer,\n\t\tcreate(stack) {\n\t\t\treturn createMysqlAdapter({\n\t\t\t\ttargetId: descriptorMeta.targetId,\n\t\t\t\tcapabilities: descriptorMeta.capabilities ?? {},\n\t\t\t\trenderer: options.renderer(assembleMysqlCodecRegistry(stack.target, stack.extensions), target)\n\t\t\t});\n\t\t}\n\t};\n}\nconst mysqlRuntimeAdapterDescriptor = createMysqlRuntimeAdapterDescriptor({\n\tdescriptorMeta: mysqlAdapterDescriptorMeta,\n\ttarget: mysqlTargetDescriptorMetaRuntime,\n\trenderer: (codecs, target) => new MysqlSqlRenderer(codecs, target)\n});\n//#endregion\nexport { createMysqlRuntimeAdapterDescriptor, mysqlRuntimeAdapterDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,UAAU,EAAE,KAAK;AACvB,MAAM,UAAU,KAAK,KAAK;AAC1B,SAAS,OAAO,OAAO;CACtB,MAAM,gBAAgB,6CA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AG,mBAAmB,KAAK,EAAE,IAAI,gBAAgB;EACxF;EACA;EACA,WAAW;CACZ,EAAE,CAAC;AACJ;;AAEA,SAAS,oCAAoC,SAAS;CACrD,MAAM,EAAE,gBAAgB,WAAW;CACnC,OAAO;EACN,GAAG;EACH,cAAc,MAAM,KAAK,6BAA6B,OAAO,CAAC;EAC9D,2BAA2B;EAC3B,iBAAiB;EACjB,OAAO,OAAO;GACb,OAAO,mBAAmB;IACzB,UAAU,eAAe;IACzB,cAAc,eAAe,gBAAgB,CAAC;IAC9C,UAAU,QAAQ,SAAS,2BAA2B,MAAM,QAAQ,MAAM,UAAU,GAAG,MAAM;GAC9F,CAAC;EACF;CACD;AACD;AACA,MAAM,gCAAgC,oCAAoC;CACzE,gBAAgB;CAChB,QAAQ;CACR,WAAW,QAAQ,WAAW,IAAI,iBAAiB,QAAQ,MAAM;AAClE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as mysqlTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs";
|
|
2
|
+
import { a as validateMysqlIsolationLevel } from "./runtime-_c_DZuYR.mjs";
|
|
3
|
+
import { a as connectingCannotSucceed, c as isFatal, d as mysqlPoolIdleTimeoutMillis, f as mysqlPoolOptions, h as statementFor, l as mysqlConnectionOptions, n as SessionSettingsGuard, p as normalizeMysqlError, r as acquireClientQueryLock, t as MYSQL_CHECK_VIOLATION_ERRORS, u as mysqlDriverDescriptorMetaFor } from "./statement-a2Eekpu6-BDJa255m.mjs";
|
|
4
4
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
5
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
5
6
|
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
6
7
|
import { createConnection, createPool } from "mariadb";
|
|
7
8
|
import { EventEmitter } from "node:events";
|
|
@@ -28,9 +29,11 @@ var Canceller = class {
|
|
|
28
29
|
#pending = /* @__PURE__ */ new WeakMap();
|
|
29
30
|
#closed = false;
|
|
30
31
|
#idleTimer;
|
|
31
|
-
|
|
32
|
+
#displayName;
|
|
33
|
+
constructor(url, idleTimeoutMillis, displayName) {
|
|
32
34
|
this.#url = url;
|
|
33
35
|
this.#idleTimeoutMillis = idleTimeoutMillis;
|
|
36
|
+
this.#displayName = displayName;
|
|
34
37
|
}
|
|
35
38
|
/** Sends `KILL QUERY` for `threadId`. Never rejects. A kept connection that is no longer valid is replaced once. */
|
|
36
39
|
async cancel(threadId, replaced = false) {
|
|
@@ -89,7 +92,10 @@ var Canceller = class {
|
|
|
89
92
|
}
|
|
90
93
|
async #open() {
|
|
91
94
|
try {
|
|
92
|
-
const connection = await createConnection(mysqlConnectionOptions(this.#url, {
|
|
95
|
+
const connection = await createConnection(mysqlConnectionOptions(this.#url, {
|
|
96
|
+
connectTimeoutMs: CANCEL_TIMEOUT_MILLIS,
|
|
97
|
+
displayName: this.#displayName
|
|
98
|
+
}));
|
|
93
99
|
connection.on("error", () => void 0);
|
|
94
100
|
if (this.#closed) {
|
|
95
101
|
await connection.end().catch(() => void 0);
|
|
@@ -105,17 +111,17 @@ function notConnected(message) {
|
|
|
105
111
|
return errorRuntime("DRIVER.NOT_CONNECTED", message, { fix: "Call connect(binding) before running queries, and do not use the driver after close()." });
|
|
106
112
|
}
|
|
107
113
|
/** Runs `request` on `client` in one round trip and returns its result: its `?N` placeholders written as `?`, and its values handed to the package, which writes them into the statement. Throws the package's error as it is. */
|
|
108
|
-
async function run(client, request) {
|
|
109
|
-
const { sql, values } = statementFor(client, request.sql, request.params ?? []);
|
|
114
|
+
async function run(client, request, displayName) {
|
|
115
|
+
const { sql, values } = statementFor(client, request.sql, request.params ?? [], displayName);
|
|
110
116
|
return client.query(sql, values);
|
|
111
117
|
}
|
|
112
118
|
/** Starts streaming the rows of `request` on `client`, sent as {@link run} sends it. Throws the error to report, after noting in `outcome` whether it left the client unusable. */
|
|
113
|
-
function startStream(client, request, outcome) {
|
|
119
|
+
function startStream(client, request, outcome, server) {
|
|
114
120
|
try {
|
|
115
|
-
const { sql, values } = statementFor(client, request.sql, request.params ?? []);
|
|
121
|
+
const { sql, values } = statementFor(client, request.sql, request.params ?? [], server.displayName);
|
|
116
122
|
return client.queryStream(sql, values);
|
|
117
123
|
} catch (error) {
|
|
118
|
-
settle(error, outcome);
|
|
124
|
+
settle(error, outcome, server);
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
/** What a statement's result reports: the rows it changed, and, when it changed one row, the value MySQL numbered for it. MySQL reports 0 when it numbered none. */
|
|
@@ -129,9 +135,9 @@ function statementStats(result) {
|
|
|
129
135
|
} : { affectedRows };
|
|
130
136
|
}
|
|
131
137
|
/** The error to report for `error`, after noting in `outcome` whether it left the client unusable. */
|
|
132
|
-
function settle(error, outcome) {
|
|
138
|
+
function settle(error, outcome, server) {
|
|
133
139
|
if (isFatal(error)) outcome.destroy = true;
|
|
134
|
-
throw normalizeMysqlError(error);
|
|
140
|
+
throw normalizeMysqlError(error, server);
|
|
135
141
|
}
|
|
136
142
|
/**
|
|
137
143
|
* Whether the package has received the end of the result, so that any rows the caller has not read are already in the stream's buffer. The package pushes the end of the stream when MySQL's last packet arrives; Node records that in `_readableState.ended`, and its public API reports the end only after the caller has read every row.
|
|
@@ -156,14 +162,14 @@ async function dropRest(rows) {
|
|
|
156
162
|
rows.off("readable", drain);
|
|
157
163
|
}
|
|
158
164
|
}
|
|
159
|
-
function cancelNotConfirmed() {
|
|
160
|
-
return errorRuntime("DRIVER.NOT_CONNECTED",
|
|
161
|
-
why:
|
|
162
|
-
fix:
|
|
165
|
+
function cancelNotConfirmed(displayName) {
|
|
166
|
+
return errorRuntime("DRIVER.NOT_CONNECTED", `A cancel on this ${displayName} connection could not be confirmed, so the connection can no longer be used`, {
|
|
167
|
+
why: `The driver cancelled a stream the caller stopped early, and ${displayName} did not answer the KILL QUERY in time. It may still arrive and would interrupt whatever statement the connection runs then.`,
|
|
168
|
+
fix: `Release the connection, which closes it; ${displayName} rolls back an open transaction on it. Acquire another connection and run the work again.`
|
|
163
169
|
});
|
|
164
170
|
}
|
|
165
|
-
function connectionReleased() {
|
|
166
|
-
return errorRuntime("DRIVER.NOT_CONNECTED",
|
|
171
|
+
function connectionReleased(displayName) {
|
|
172
|
+
return errorRuntime("DRIVER.NOT_CONNECTED", `${displayName} connection was released`, { fix: "Send statements on a connection only until you release it, and await each one before release()." });
|
|
167
173
|
}
|
|
168
174
|
/** The package can report an error on a stream after the caller stopped reading it, such as MySQL's for a statement the driver cancelled; the generator has already settled by then. */
|
|
169
175
|
function ignoreAfterStop() {}
|
|
@@ -173,8 +179,13 @@ function isQueryInterrupted(error) {
|
|
|
173
179
|
}
|
|
174
180
|
var MysqlQueryable = class {
|
|
175
181
|
streams;
|
|
176
|
-
|
|
182
|
+
server;
|
|
183
|
+
constructor(streams, server) {
|
|
177
184
|
this.streams = streams;
|
|
185
|
+
this.server = server;
|
|
186
|
+
}
|
|
187
|
+
get displayName() {
|
|
188
|
+
return this.server.displayName;
|
|
178
189
|
}
|
|
179
190
|
/** Records a stream that is open, and returns the call that records its end. */
|
|
180
191
|
streamOpened(_rows) {
|
|
@@ -209,12 +220,12 @@ var MysqlQueryable = class {
|
|
|
209
220
|
try {
|
|
210
221
|
const releaseLock = await this.lockClient(client);
|
|
211
222
|
try {
|
|
212
|
-
return await this.runStatement(() => run(client, request));
|
|
223
|
+
return await this.runStatement(() => run(client, request, this.displayName));
|
|
213
224
|
} finally {
|
|
214
225
|
releaseLock();
|
|
215
226
|
}
|
|
216
227
|
} catch (error) {
|
|
217
|
-
settle(error, outcome);
|
|
228
|
+
settle(error, outcome, this.server);
|
|
218
229
|
} finally {
|
|
219
230
|
await this.releaseClient(client, outcome);
|
|
220
231
|
}
|
|
@@ -233,7 +244,7 @@ var MysqlQueryable = class {
|
|
|
233
244
|
throw error;
|
|
234
245
|
}
|
|
235
246
|
try {
|
|
236
|
-
const rows = startStream(client, request, outcome);
|
|
247
|
+
const rows = startStream(client, request, outcome, this.server);
|
|
237
248
|
rows.on("error", ignoreAfterStop);
|
|
238
249
|
const streamClosed = this.streamOpened(rows);
|
|
239
250
|
let settled = false;
|
|
@@ -242,7 +253,7 @@ var MysqlQueryable = class {
|
|
|
242
253
|
settled = true;
|
|
243
254
|
} catch (error) {
|
|
244
255
|
settled = true;
|
|
245
|
-
settle(error, outcome);
|
|
256
|
+
settle(error, outcome, this.server);
|
|
246
257
|
} finally {
|
|
247
258
|
if (!settled && !this.handedBack) await this.#stopEarly(client, rows, outcome);
|
|
248
259
|
if (outcome.destroy) rows.destroy();
|
|
@@ -270,10 +281,10 @@ var MysqlQueryable = class {
|
|
|
270
281
|
outcome.destroy = true;
|
|
271
282
|
}
|
|
272
283
|
};
|
|
273
|
-
function handedBackState() {
|
|
284
|
+
function handedBackState(displayName) {
|
|
274
285
|
let refuse = () => {};
|
|
275
286
|
const signal = new Promise((_, reject) => {
|
|
276
|
-
refuse = () => reject(connectionReleased());
|
|
287
|
+
refuse = () => reject(connectionReleased(displayName));
|
|
277
288
|
});
|
|
278
289
|
signal.catch(() => void 0);
|
|
279
290
|
const state = {
|
|
@@ -318,12 +329,12 @@ var MysqlHeldQueryable = class extends MysqlQueryable {
|
|
|
318
329
|
locking.then((releaseLock) => releaseLock());
|
|
319
330
|
}
|
|
320
331
|
this.#refuseIfUnusable();
|
|
321
|
-
throw connectionReleased();
|
|
332
|
+
throw connectionReleased(this.displayName);
|
|
322
333
|
}
|
|
323
334
|
/** Refuses a statement on a connection that was handed back, or whose cancel went out without an answer: a late `KILL QUERY` would interrupt it. */
|
|
324
335
|
#refuseIfUnusable() {
|
|
325
|
-
if (this.held.handedBack.done) throw connectionReleased();
|
|
326
|
-
if (this.held.cancelUnconfirmed) throw cancelNotConfirmed();
|
|
336
|
+
if (this.held.handedBack.done) throw connectionReleased(this.displayName);
|
|
337
|
+
if (this.held.cancelUnconfirmed) throw cancelNotConfirmed(this.displayName);
|
|
327
338
|
}
|
|
328
339
|
runStatement(work) {
|
|
329
340
|
const running = work();
|
|
@@ -332,7 +343,7 @@ var MysqlHeldQueryable = class extends MysqlQueryable {
|
|
|
332
343
|
return running;
|
|
333
344
|
}
|
|
334
345
|
constructor(client, held, streams) {
|
|
335
|
-
super(streams);
|
|
346
|
+
super(streams, held.server);
|
|
336
347
|
this.client = client;
|
|
337
348
|
this.held = held;
|
|
338
349
|
}
|
|
@@ -348,7 +359,7 @@ var MysqlHeldQueryable = class extends MysqlQueryable {
|
|
|
348
359
|
try {
|
|
349
360
|
await this.runStatement(call);
|
|
350
361
|
} catch (error) {
|
|
351
|
-
throw normalizeMysqlError(error);
|
|
362
|
+
throw normalizeMysqlError(error, this.server);
|
|
352
363
|
} finally {
|
|
353
364
|
releaseLock();
|
|
354
365
|
}
|
|
@@ -356,13 +367,14 @@ var MysqlHeldQueryable = class extends MysqlQueryable {
|
|
|
356
367
|
};
|
|
357
368
|
var MysqlConnectionImpl = class extends MysqlHeldQueryable {
|
|
358
369
|
#onRelease;
|
|
359
|
-
constructor(client, streams, cancel, onRelease) {
|
|
370
|
+
constructor(client, streams, cancel, onRelease, server) {
|
|
360
371
|
super(client, {
|
|
361
372
|
streams: /* @__PURE__ */ new Set(),
|
|
362
373
|
cancelUnconfirmed: false,
|
|
363
374
|
running: /* @__PURE__ */ new Set(),
|
|
364
375
|
cancel,
|
|
365
|
-
|
|
376
|
+
server,
|
|
377
|
+
handedBack: handedBackState(server.displayName)
|
|
366
378
|
}, streams);
|
|
367
379
|
this.#onRelease = onRelease;
|
|
368
380
|
}
|
|
@@ -512,8 +524,8 @@ var MysqlDriver = class extends MysqlQueryable {
|
|
|
512
524
|
cancelStatement = (threadId) => this.#canceller?.cancel(threadId) ?? Promise.resolve("unsent");
|
|
513
525
|
#options;
|
|
514
526
|
#sessionSettings;
|
|
515
|
-
constructor(options, targetId) {
|
|
516
|
-
super(options.stream ?? false);
|
|
527
|
+
constructor(options, targetId, server) {
|
|
528
|
+
super(options.stream ?? false, server);
|
|
517
529
|
this.targetId = targetId;
|
|
518
530
|
this.#options = options;
|
|
519
531
|
this.#sessionSettings = new SessionSettingsGuard(options.sessionSettings ?? {});
|
|
@@ -522,10 +534,10 @@ var MysqlDriver = class extends MysqlQueryable {
|
|
|
522
534
|
return this.#state.kind;
|
|
523
535
|
}
|
|
524
536
|
async connect(binding) {
|
|
525
|
-
if (this.#state.kind === "connected") throw errorRuntime("DRIVER.ALREADY_CONNECTED",
|
|
537
|
+
if (this.#state.kind === "connected") throw errorRuntime("DRIVER.ALREADY_CONNECTED", `${this.displayName} driver already connected`, { fix: "Call close() before connecting again." });
|
|
526
538
|
const waiting = new WaitingForConnection();
|
|
527
539
|
const pool = createPool({
|
|
528
|
-
...mysqlPoolOptions(binding.url, this.#options.poolOptions),
|
|
540
|
+
...mysqlPoolOptions(binding.url, this.displayName, this.#options.poolOptions),
|
|
529
541
|
logger: { error: (error) => waiting.reported(error) }
|
|
530
542
|
});
|
|
531
543
|
if (pool instanceof EventEmitter) pool.on("error", ignoreConnectionFailure);
|
|
@@ -534,10 +546,10 @@ var MysqlDriver = class extends MysqlQueryable {
|
|
|
534
546
|
pool,
|
|
535
547
|
waiting
|
|
536
548
|
};
|
|
537
|
-
this.#canceller = new Canceller(binding.url, mysqlPoolIdleTimeoutMillis(this.#options.poolOptions));
|
|
549
|
+
this.#canceller = new Canceller(binding.url, mysqlPoolIdleTimeoutMillis(this.#options.poolOptions), this.displayName);
|
|
538
550
|
}
|
|
539
551
|
async acquireConnection() {
|
|
540
|
-
return new MysqlConnectionImpl(await this.acquireClient(), this.streams, this.cancelStatement, () => this.#inUse.released());
|
|
552
|
+
return new MysqlConnectionImpl(await this.acquireClient(), this.streams, this.cancelStatement, () => this.#inUse.released(), this.server);
|
|
541
553
|
}
|
|
542
554
|
async close() {
|
|
543
555
|
if (this.#state.kind !== "connected") return;
|
|
@@ -549,7 +561,7 @@ var MysqlDriver = class extends MysqlQueryable {
|
|
|
549
561
|
await pool.end();
|
|
550
562
|
}
|
|
551
563
|
async acquireClient() {
|
|
552
|
-
if (this.#state.kind !== "connected") throw notConnected(this.#state.kind === "closed" ?
|
|
564
|
+
if (this.#state.kind !== "connected") throw notConnected(this.#state.kind === "closed" ? `${this.displayName} driver is closed` : `${this.displayName} driver not connected`);
|
|
553
565
|
const { pool, waiting } = this.#state;
|
|
554
566
|
this.#inUse.acquired();
|
|
555
567
|
const getting = pool.getConnection();
|
|
@@ -559,14 +571,14 @@ var MysqlDriver = class extends MysqlQueryable {
|
|
|
559
571
|
} catch (error) {
|
|
560
572
|
releaseLate(getting);
|
|
561
573
|
this.#inUse.released();
|
|
562
|
-
throw normalizeMysqlError(error);
|
|
574
|
+
throw normalizeMysqlError(error, this.server);
|
|
563
575
|
}
|
|
564
576
|
try {
|
|
565
577
|
await this.#sessionSettings.ensure(client);
|
|
566
578
|
} catch (error) {
|
|
567
579
|
client.destroy();
|
|
568
580
|
this.#inUse.released();
|
|
569
|
-
throw normalizeMysqlError(error);
|
|
581
|
+
throw normalizeMysqlError(error, this.server);
|
|
570
582
|
}
|
|
571
583
|
return client;
|
|
572
584
|
}
|
|
@@ -582,20 +594,28 @@ var MysqlDriver = class extends MysqlQueryable {
|
|
|
582
594
|
}
|
|
583
595
|
}
|
|
584
596
|
};
|
|
585
|
-
/** The runtime driver descriptor of MySQL, or of a target that extends it
|
|
586
|
-
function createMysqlRuntimeDriverDescriptor(
|
|
597
|
+
/** The runtime driver descriptor of MySQL, or of a target that extends it. */
|
|
598
|
+
function createMysqlRuntimeDriverDescriptor(options) {
|
|
599
|
+
const { targetId, displayName } = options.target;
|
|
600
|
+
const server = {
|
|
601
|
+
displayName,
|
|
602
|
+
checkViolationErrors: options.checkViolationErrors
|
|
603
|
+
};
|
|
587
604
|
return {
|
|
588
605
|
...mysqlDriverDescriptorMetaFor(targetId),
|
|
589
606
|
create(options, sessionSettings) {
|
|
590
607
|
return new MysqlDriver({
|
|
591
608
|
...options,
|
|
592
609
|
...ifDefined("sessionSettings", sessionSettings)
|
|
593
|
-
}, targetId);
|
|
610
|
+
}, targetId, server);
|
|
594
611
|
}
|
|
595
612
|
};
|
|
596
613
|
}
|
|
597
|
-
const mysqlRuntimeDriverDescriptor = createMysqlRuntimeDriverDescriptor(
|
|
614
|
+
const mysqlRuntimeDriverDescriptor = createMysqlRuntimeDriverDescriptor({
|
|
615
|
+
target: mysqlTargetDescriptorMetaRuntime,
|
|
616
|
+
checkViolationErrors: MYSQL_CHECK_VIOLATION_ERRORS
|
|
617
|
+
});
|
|
598
618
|
//#endregion
|
|
599
619
|
export { mysqlRuntimeDriverDescriptor as n, createMysqlRuntimeDriverDescriptor as t };
|
|
600
620
|
|
|
601
|
-
//# sourceMappingURL=runtime-
|
|
621
|
+
//# sourceMappingURL=runtime-CHWztV6c.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-CHWztV6c.mjs","names":["#url","#idleTimeoutMillis","#displayName","#closed","#idleTimer","#connection","#open","#setAside","#pending","#pendingOn","#idleLater","#streamRows","#runReleasing","#stopEarly","#refuseIfUnusable","#onRelease","#cancelRunning","#runningSettled","#close","#released","#count","#idle","#fail","#canceller","#options","#sessionSettings","#state","#inUse"],"sources":["../../../../3-targets/mysql/1-mysql/3-driver/dist/runtime.mjs"],"sourcesContent":["import { a as MYSQL_CHECK_VIOLATION_ERRORS, d as mysqlDriverDescriptorMetaFor, f as mysqlConnectionOptions, h as acquireClientQueryLock, l as isFatal, m as mysqlPoolOptions, n as SessionSettingsGuard, o as connectingCannotSucceed, p as mysqlPoolIdleTimeoutMillis, t as statementFor, u as normalizeMysqlError } from \"./statement-a2Eekpu6.mjs\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { mysqlTargetDescriptorMetaRuntime } from \"@internal/target-mysql/descriptor-meta-runtime\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { createConnection, createPool } from \"mariadb\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { EventEmitter } from \"node:events\";\nimport { finished } from \"node:stream/promises\";\nimport { validateMysqlIsolationLevel } from \"@internal/target-mysql/runtime\";\n//#region src/core/runtime/canceller.ts\n/** How long the canceller waits to open its connection, and for MySQL to answer a `KILL QUERY`. */\nconst CANCEL_TIMEOUT_MILLIS = 2e3;\nfunction timeout(millis) {\n\tlet timer;\n\treturn {\n\t\texpired: new Promise((resolve) => {\n\t\t\ttimer = setTimeout(() => resolve(\"expired\"), millis);\n\t\t}),\n\t\tclear: () => clearTimeout(timer)\n\t};\n}\n/**\n* Cancels statements with `KILL QUERY`, which MySQL takes only from another connection. It keeps one connection of its own, outside the pool, so a cancel neither waits for a pooled connection nor normally opens one; it opens it on first need, and ends it once it has been idle for the pool's idle timeout, as the pool ends its own; with a timeout of 0 it keeps it open, as the pool keeps its own. Opening it and each `KILL QUERY` are bounded by two seconds. The connection is never destroyed: the package's `destroy()` sends a `KILL` of its own whose failure it does not handle (`mariadb` 3.5.4). A connection that stops answering is set aside and ended with `end()` once its statement settles.\n*/\nvar Canceller = class {\n\t#url;\n\t#idleTimeoutMillis;\n\t#connection;\n\t#pending = /* @__PURE__ */ new WeakMap();\n\t#closed = false;\n\t#idleTimer;\n\t#displayName;\n\tconstructor(url, idleTimeoutMillis, displayName) {\n\t\tthis.#url = url;\n\t\tthis.#idleTimeoutMillis = idleTimeoutMillis;\n\t\tthis.#displayName = displayName;\n\t}\n\t/** Sends `KILL QUERY` for `threadId`. Never rejects. A kept connection that is no longer valid is replaced once. */\n\tasync cancel(threadId, replaced = false) {\n\t\tif (this.#closed || threadId === null) return \"unsent\";\n\t\tclearTimeout(this.#idleTimer);\n\t\tconst opening = this.#connection ?? this.#open();\n\t\tthis.#connection = opening;\n\t\tconst connection = await opening;\n\t\tif (connection === void 0) {\n\t\t\tthis.#setAside(opening);\n\t\t\treturn \"unsent\";\n\t\t}\n\t\tif (!connection.isValid()) {\n\t\t\tthis.#setAside(opening);\n\t\t\treturn replaced ? \"unsent\" : this.cancel(threadId, true);\n\t\t}\n\t\tthis.#pending.set(connection, this.#pendingOn(connection) + 1);\n\t\tconst killing = connection.query(\"KILL QUERY ?\", [threadId]).then(() => \"sent\", (error) => isFatal(error) ? \"unconfirmed\" : \"unsent\");\n\t\tkilling.then(() => {\n\t\t\tthis.#pending.set(connection, this.#pendingOn(connection) - 1);\n\t\t\tthis.#idleLater(opening, connection);\n\t\t});\n\t\tconst limit = timeout(CANCEL_TIMEOUT_MILLIS);\n\t\tconst result = await Promise.race([killing, limit.expired]);\n\t\tlimit.clear();\n\t\tif (result === \"sent\" || result === \"unsent\") return result;\n\t\tthis.#setAside(opening);\n\t\tconnection.end().catch(() => void 0);\n\t\treturn \"unconfirmed\";\n\t}\n\t/** Ends the connection: `end()` sends `QUIT` once any `KILL QUERY` on it settles. Waits for that only when no `KILL QUERY` is pending on it, so a connection that stopped answering cannot hold `close()` up. */\n\tasync close() {\n\t\tthis.#closed = true;\n\t\tclearTimeout(this.#idleTimer);\n\t\tconst connection = await this.#connection;\n\t\tthis.#connection = void 0;\n\t\tif (connection === void 0) return;\n\t\tconst ending = connection.end().catch(() => void 0);\n\t\tif (this.#pendingOn(connection) === 0) await ending;\n\t}\n\t#idleLater(opening, connection) {\n\t\tif (this.#idleTimeoutMillis === 0 || this.#pendingOn(connection) > 0 || this.#connection !== opening) return;\n\t\tclearTimeout(this.#idleTimer);\n\t\tthis.#idleTimer = setTimeout(() => {\n\t\t\tif (this.#pendingOn(connection) > 0 || this.#connection !== opening) return;\n\t\t\tthis.#connection = void 0;\n\t\t\tconnection.end().catch(() => void 0);\n\t\t}, this.#idleTimeoutMillis);\n\t\tthis.#idleTimer.unref();\n\t}\n\t#pendingOn(connection) {\n\t\treturn this.#pending.get(connection) ?? 0;\n\t}\n\t#setAside(opening) {\n\t\tif (this.#connection === opening) this.#connection = void 0;\n\t}\n\tasync #open() {\n\t\ttry {\n\t\t\tconst connection = await createConnection(mysqlConnectionOptions(this.#url, {\n\t\t\t\tconnectTimeoutMs: CANCEL_TIMEOUT_MILLIS,\n\t\t\t\tdisplayName: this.#displayName\n\t\t\t}));\n\t\t\tconnection.on(\"error\", () => void 0);\n\t\t\tif (this.#closed) {\n\t\t\t\tawait connection.end().catch(() => void 0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn connection;\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/runtime/mysql-driver.ts\nfunction notConnected(message) {\n\treturn errorRuntime(\"DRIVER.NOT_CONNECTED\", message, { fix: \"Call connect(binding) before running queries, and do not use the driver after close().\" });\n}\n/** Runs `request` on `client` in one round trip and returns its result: its `?N` placeholders written as `?`, and its values handed to the package, which writes them into the statement. Throws the package's error as it is. */\nasync function run(client, request, displayName) {\n\tconst { sql, values } = statementFor(client, request.sql, request.params ?? [], displayName);\n\treturn client.query(sql, values);\n}\n/** Starts streaming the rows of `request` on `client`, sent as {@link run} sends it. Throws the error to report, after noting in `outcome` whether it left the client unusable. */\nfunction startStream(client, request, outcome, server) {\n\ttry {\n\t\tconst { sql, values } = statementFor(client, request.sql, request.params ?? [], server.displayName);\n\t\treturn client.queryStream(sql, values);\n\t} catch (error) {\n\t\tsettle(error, outcome, server);\n\t}\n}\n/** What a statement's result reports: the rows it changed, and, when it changed one row, the value MySQL numbered for it. MySQL reports 0 when it numbered none. */\nfunction statementStats(result) {\n\tif (typeof result !== \"object\" || result === null) return { affectedRows: 0 };\n\tconst affectedRows = \"affectedRows\" in result && typeof result.affectedRows === \"number\" ? result.affectedRows : 0;\n\tconst insertId = \"insertId\" in result ? result.insertId : void 0;\n\treturn affectedRows === 1 && (typeof insertId === \"bigint\" || typeof insertId === \"number\") && insertId > 0 ? {\n\t\taffectedRows,\n\t\tinsertId: String(insertId)\n\t} : { affectedRows };\n}\n/** The error to report for `error`, after noting in `outcome` whether it left the client unusable. */\nfunction settle(error, outcome, server) {\n\tif (isFatal(error)) outcome.destroy = true;\n\tthrow normalizeMysqlError(error, server);\n}\n/**\n* Whether the package has received the end of the result, so that any rows the caller has not read are already in the stream's buffer. The package pushes the end of the stream when MySQL's last packet arrives; Node records that in `_readableState.ended`, and its public API reports the end only after the caller has read every row.\n*/\nfunction resultReceived(rows) {\n\tconst state = \"_readableState\" in rows ? rows._readableState : void 0;\n\treturn typeof state === \"object\" && state !== null && \"ended\" in state && state.ended === true;\n}\n/**\n* Reads and drops what is left of a stream's result. The package's `close()` stops it keeping new rows; the rows already buffered are read here with `read()`, which works whether or not the caller's iterator is still attached to the stream, so an iterator the caller abandoned cannot hold the drain up.\n*/\nasync function dropRest(rows) {\n\trows.close?.();\n\tconst drain = () => {\n\t\twhile (rows.read() !== null);\n\t};\n\trows.on(\"readable\", drain);\n\ttry {\n\t\tdrain();\n\t\tawait finished(rows);\n\t} finally {\n\t\trows.off(\"readable\", drain);\n\t}\n}\nfunction cancelNotConfirmed(displayName) {\n\treturn errorRuntime(\"DRIVER.NOT_CONNECTED\", `A cancel on this ${displayName} connection could not be confirmed, so the connection can no longer be used`, {\n\t\twhy: `The driver cancelled a stream the caller stopped early, and ${displayName} did not answer the KILL QUERY in time. It may still arrive and would interrupt whatever statement the connection runs then.`,\n\t\tfix: `Release the connection, which closes it; ${displayName} rolls back an open transaction on it. Acquire another connection and run the work again.`\n\t});\n}\nfunction connectionReleased(displayName) {\n\treturn errorRuntime(\"DRIVER.NOT_CONNECTED\", `${displayName} connection was released`, { fix: \"Send statements on a connection only until you release it, and await each one before release().\" });\n}\n/** The package can report an error on a stream after the caller stopped reading it, such as MySQL's for a statement the driver cancelled; the generator has already settled by then. */\nfunction ignoreAfterStop() {}\n/** MySQL's error for a statement `KILL QUERY` cancelled (`ER_QUERY_INTERRUPTED`). The package marks it fatal when it arrives in the middle of a result, but the connection stays usable. */\nfunction isQueryInterrupted(error) {\n\treturn error instanceof Error && \"errno\" in error && error.errno === 1317;\n}\nvar MysqlQueryable = class {\n\tstreams;\n\tserver;\n\tconstructor(streams, server) {\n\t\tthis.streams = streams;\n\t\tthis.server = server;\n\t}\n\tget displayName() {\n\t\treturn this.server.displayName;\n\t}\n\t/** Records a stream that is open, and returns the call that records its end. */\n\tstreamOpened(_rows) {\n\t\treturn () => {};\n\t}\n\t/** Takes the client's lock, which keeps statements on it one at a time in the order sent. */\n\tlockClient(client) {\n\t\treturn acquireClientQueryLock(client);\n\t}\n\t/** Runs one statement that is not a stream, under the client's lock. */\n\trunStatement(work) {\n\t\treturn work();\n\t}\n\t/** Whether the client went back to the pool under this queryable, so it must send nothing more on it. */\n\tget handedBack() {\n\t\treturn false;\n\t}\n\tasync *query(request) {\n\t\tif (this.streams) {\n\t\t\tyield* this.#streamRows(request);\n\t\t\treturn;\n\t\t}\n\t\tconst result = await this.#runReleasing(request);\n\t\tfor (const row of Array.isArray(result) ? result : []) yield blindCast(row);\n\t}\n\tasync execute(request) {\n\t\treturn statementStats(await this.#runReleasing(request));\n\t}\n\tasync #runReleasing(request) {\n\t\tconst client = await this.acquireClient();\n\t\tconst outcome = { destroy: false };\n\t\ttry {\n\t\t\tconst releaseLock = await this.lockClient(client);\n\t\t\ttry {\n\t\t\t\treturn await this.runStatement(() => run(client, request, this.displayName));\n\t\t\t} finally {\n\t\t\t\treleaseLock();\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tsettle(error, outcome, this.server);\n\t\t} finally {\n\t\t\tawait this.releaseClient(client, outcome);\n\t\t}\n\t}\n\t/**\n\t* Streams the rows of `request` as they arrive; the package pauses the socket while the caller is busy. A caller that stops reading early is handled by {@link MysqlQueryable.#stopEarly}. A fatal error, such as a lost connection, destroys the client.\n\t*/\n\tasync *#streamRows(request) {\n\t\tconst client = await this.acquireClient();\n\t\tconst outcome = { destroy: false };\n\t\tlet releaseLock;\n\t\ttry {\n\t\t\treleaseLock = await this.lockClient(client);\n\t\t} catch (error) {\n\t\t\tawait this.releaseClient(client, outcome);\n\t\t\tthrow error;\n\t\t}\n\t\ttry {\n\t\t\tconst rows = startStream(client, request, outcome, this.server);\n\t\t\trows.on(\"error\", ignoreAfterStop);\n\t\t\tconst streamClosed = this.streamOpened(rows);\n\t\t\tlet settled = false;\n\t\t\ttry {\n\t\t\t\tfor await (const row of rows.iterator({ destroyOnReturn: false })) yield blindCast(row);\n\t\t\t\tsettled = true;\n\t\t\t} catch (error) {\n\t\t\t\tsettled = true;\n\t\t\t\tsettle(error, outcome, this.server);\n\t\t\t} finally {\n\t\t\t\tif (!settled && !this.handedBack) await this.#stopEarly(client, rows, outcome);\n\t\t\t\tif (outcome.destroy) rows.destroy();\n\t\t\t\tstreamClosed();\n\t\t\t}\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t\tawait this.releaseClient(client, outcome);\n\t\t}\n\t}\n\t/**\n\t* Ends a stream the caller stopped reading early, and keeps the client usable. While its result is still arriving, the statement is first cancelled with `KILL QUERY`, so a large result is not downloaded only to be thrown away; MySQL does not say how many rows remain. On a held connection or in a transaction, as on a pooled one: `KILL QUERY` ends only the statement, the session survives, and in a transaction MySQL rolls back only that statement. The rest of the result is then read and dropped, MySQL's error for the cancelled statement among it. The client is never destroyed while its statement runs: the package's `destroy()` would send `KILL` itself, on a connection whose failure it does not handle.\n\t*/\n\tasync #stopEarly(client, rows, outcome) {\n\t\tconst cancel = resultReceived(rows) ? \"unsent\" : await this.cancelStatement(client.threadId);\n\t\tawait dropRest(rows).catch((error) => {\n\t\t\tif (isFatal(error) && !(cancel !== \"unsent\" && isQueryInterrupted(error))) outcome.destroy = true;\n\t\t});\n\t\tif (cancel === \"unconfirmed\") this.cancelUnconfirmed(outcome);\n\t}\n\t/**\n\t* A cancel that went out without an answer may still reach MySQL and interrupt the next statement on the client, so the client must not serve another caller. Once its rest has been read, nothing is receiving on it, so closing it sends no `KILL` of the package's own; a late `KILL QUERY` then finds no thread.\n\t*/\n\tcancelUnconfirmed(outcome) {\n\t\toutcome.destroy = true;\n\t}\n};\nfunction handedBackState(displayName) {\n\tlet refuse = () => {};\n\tconst signal = new Promise((_, reject) => {\n\t\trefuse = () => reject(connectionReleased(displayName));\n\t});\n\tsignal.catch(() => void 0);\n\tconst state = {\n\t\tdone: false,\n\t\tsignal,\n\t\trefuse: () => {\n\t\t\tstate.done = true;\n\t\t\trefuse();\n\t\t}\n\t};\n\treturn state;\n}\n/**\n* A queryable on a connection the caller holds, whose statements all run on the same session, in the order they are sent, under the client's lock. A statement sent while a stream on the connection is open waits for that stream to end; one awaited inside the stream's own loop never finishes, as on Postgres with a cursor.\n*/\nvar MysqlHeldQueryable = class extends MysqlQueryable {\n\tclient;\n\theld;\n\tholdsClient = true;\n\tget cancelStatement() {\n\t\treturn this.held.cancel;\n\t}\n\tstreamOpened(rows) {\n\t\tthis.held.streams.add(rows);\n\t\treturn () => this.held.streams.delete(rows);\n\t}\n\tget handedBack() {\n\t\treturn this.held.handedBack.done;\n\t}\n\tcancelUnconfirmed() {\n\t\tthis.held.cancelUnconfirmed = true;\n\t}\n\t/** Takes the client's lock, or fails once the connection is handed back, whether the statement was sent after that or was still waiting for the lock. A lock taken after that is given straight back. */\n\tasync lockClient(client) {\n\t\tthis.#refuseIfUnusable();\n\t\tconst locking = acquireClientQueryLock(client);\n\t\ttry {\n\t\t\tconst releaseLock = await Promise.race([locking, this.held.handedBack.signal]);\n\t\t\tif (!this.held.handedBack.done && !this.held.cancelUnconfirmed) return releaseLock;\n\t\t\treleaseLock();\n\t\t} catch {\n\t\t\tlocking.then((releaseLock) => releaseLock());\n\t\t}\n\t\tthis.#refuseIfUnusable();\n\t\tthrow connectionReleased(this.displayName);\n\t}\n\t/** Refuses a statement on a connection that was handed back, or whose cancel went out without an answer: a late `KILL QUERY` would interrupt it. */\n\t#refuseIfUnusable() {\n\t\tif (this.held.handedBack.done) throw connectionReleased(this.displayName);\n\t\tif (this.held.cancelUnconfirmed) throw cancelNotConfirmed(this.displayName);\n\t}\n\trunStatement(work) {\n\t\tconst running = work();\n\t\tthis.held.running.add(running);\n\t\trunning.then(() => this.held.running.delete(running), () => this.held.running.delete(running));\n\t\treturn running;\n\t}\n\tconstructor(client, held, streams) {\n\t\tsuper(streams, held.server);\n\t\tthis.client = client;\n\t\tthis.held = held;\n\t}\n\tasync acquireClient() {\n\t\tthis.#refuseIfUnusable();\n\t\treturn this.client;\n\t}\n\tasync releaseClient() {}\n\t/** Runs one of the package's transaction calls under the client's lock, taken as a statement takes it, so it keeps its place among the statements sent. */\n\tasync underLock(call) {\n\t\tconst client = await this.acquireClient();\n\t\tconst releaseLock = await this.lockClient(client);\n\t\ttry {\n\t\t\tawait this.runStatement(call);\n\t\t} catch (error) {\n\t\t\tthrow normalizeMysqlError(error, this.server);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t}\n\t}\n};\nvar MysqlConnectionImpl = class extends MysqlHeldQueryable {\n\t#onRelease;\n\tconstructor(client, streams, cancel, onRelease, server) {\n\t\tsuper(client, {\n\t\t\tstreams: /* @__PURE__ */ new Set(),\n\t\t\tcancelUnconfirmed: false,\n\t\t\trunning: /* @__PURE__ */ new Set(),\n\t\t\tcancel,\n\t\t\tserver,\n\t\t\thandedBack: handedBackState(server.displayName)\n\t\t}, streams);\n\t\tthis.#onRelease = onRelease;\n\t}\n\t#released() {\n\t\tconst onRelease = this.#onRelease;\n\t\tthis.#onRelease = void 0;\n\t\tonRelease?.();\n\t}\n\tasync beginTransaction(start) {\n\t\tconst isolationLevel = start?.isolationLevel === void 0 ? void 0 : validateMysqlIsolationLevel(start.isolationLevel);\n\t\tconst statements = {\n\t\t\tReadUncommitted: \"SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED\",\n\t\t\tReadCommitted: \"SET TRANSACTION ISOLATION LEVEL READ COMMITTED\",\n\t\t\tRepeatableRead: \"SET TRANSACTION ISOLATION LEVEL REPEATABLE READ\",\n\t\t\tSerializable: \"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE\"\n\t\t};\n\t\tawait this.underLock(async () => {\n\t\t\tif (isolationLevel !== void 0) await this.client.query(statements[isolationLevel]);\n\t\t\tawait this.client.beginTransaction();\n\t\t});\n\t\treturn new MysqlTransactionImpl(this.client, this.held, this.streams);\n\t}\n\t/**\n\t* Returns the connection to the pool, as the Postgres driver's `release()` does. From then on the connection refuses every statement, those still waiting for its lock included, so none runs later in another caller's session. A statement that is not a stream and is already running finishes, as on Postgres. A stream still open, such as one the caller dropped, is cancelled and read to its end by the driver: the package's release sends `ROLLBACK` behind that statement and waits for it, which would otherwise never finish, where `pg`'s release does not wait on the server.\n\t*/\n\tasync release() {\n\t\tif (this.held.handedBack.done) return;\n\t\tthis.held.handedBack.refuse();\n\t\ttry {\n\t\t\tif (this.held.streams.size > 0) await this.#cancelRunning();\n\t\t\tawait this.#runningSettled();\n\t\t\tif (this.held.cancelUnconfirmed) await this.#close();\n\t\t\telse await this.client.release();\n\t\t} finally {\n\t\t\tthis.#released();\n\t\t}\n\t}\n\t/** Closes the connection instead of returning it. It refuses every statement from then on, cancels whatever still runs and waits for it to end, so the package's `destroy()` never sends a `KILL` of its own. */\n\tasync destroy(_reason) {\n\t\tif (this.held.handedBack.done) return;\n\t\tthis.held.handedBack.refuse();\n\t\ttry {\n\t\t\tif (this.held.streams.size > 0 || this.held.running.size > 0) await this.#cancelRunning();\n\t\t\tawait this.#runningSettled();\n\t\t\tawait this.#close();\n\t\t} finally {\n\t\t\tthis.#released();\n\t\t}\n\t}\n\t/** Closes the client once the `ping` queued behind anything left on it has answered, so nothing is receiving and the package's `destroy()` sends no `KILL` of its own. */\n\tasync #close() {\n\t\tawait this.client.ping().catch(() => void 0);\n\t\tthis.client.destroy();\n\t}\n\tasync #cancelRunning() {\n\t\tif (await this.held.cancel(this.client.threadId) === \"unconfirmed\") this.held.cancelUnconfirmed = true;\n\t\tawait Promise.all([...this.held.streams].map((rows) => dropRest(rows).catch(() => void 0)));\n\t}\n\tasync #runningSettled() {\n\t\tawait Promise.allSettled([...this.held.running]);\n\t}\n};\nvar MysqlTransactionImpl = class extends MysqlHeldQueryable {\n\tasync commit() {\n\t\tawait this.underLock(() => this.client.commit());\n\t}\n\tasync rollback() {\n\t\tawait this.underLock(() => this.client.rollback());\n\t}\n\tasync savepoint(name) {\n\t\tawait this.underLock(() => this.client.query(`SAVEPOINT ${name}`));\n\t\treturn new MysqlSavepointImpl(this.client, this.held, this.streams, name);\n\t}\n};\nvar MysqlSavepointImpl = class MysqlSavepointImpl extends MysqlHeldQueryable {\n\tname;\n\tconstructor(client, held, streams, name) {\n\t\tsuper(client, held, streams);\n\t\tthis.name = name;\n\t}\n\tasync commit() {\n\t\tawait this.underLock(() => this.client.query(`RELEASE SAVEPOINT ${this.name}`));\n\t}\n\tasync rollback() {\n\t\tawait this.underLock(() => this.client.query(`ROLLBACK TO SAVEPOINT ${this.name}`));\n\t}\n\tasync savepoint(name) {\n\t\tawait this.underLock(() => this.client.query(`SAVEPOINT ${name}`));\n\t\treturn new MysqlSavepointImpl(this.client, this.held, this.streams, name);\n\t}\n};\n/** How many clients the driver has handed out and not had back, a held connection or one lent to a single statement, so `close()` can wait until every one is back. */\nvar ClientsInUse = class {\n\t#count = 0;\n\t#idle = [];\n\tacquired() {\n\t\tthis.#count += 1;\n\t}\n\treleased() {\n\t\tthis.#count -= 1;\n\t\tif (this.#count === 0) for (const resolve of this.#idle.splice(0)) resolve();\n\t}\n\tnone() {\n\t\treturn this.#count === 0 ? Promise.resolve() : new Promise((resolve) => this.#idle.push(resolve));\n\t}\n};\n/** The pool reports a connection it failed to open on its `'error'` event, and again as the cause of a `getConnection` that times out; the driver reports it there. */\nfunction ignoreConnectionFailure() {}\n/**\n* The statements waiting for a connection from the pool. The pool keeps retrying a connection it cannot open, with a growing pause between attempts, and fails a waiting `getConnection` only when `connectionTimeoutMillis` ends; the package reports each failure to its `logger.error` as it happens, together with every failed statement. `pg.Pool` instead rejects a pending connect whose connection fails, at once. So the driver fails the waiting statements at once with a failure no retry can get past. It keeps no failure: a later statement waits for the pool's next attempt.\n*/\nvar WaitingForConnection = class {\n\t#fail = /* @__PURE__ */ new Set();\n\tasync race(getting) {\n\t\tlet fail = () => {};\n\t\tconst failed = new Promise((_, reject) => {\n\t\t\tfail = reject;\n\t\t});\n\t\tthis.#fail.add(fail);\n\t\ttry {\n\t\t\treturn await Promise.race([getting, failed]);\n\t\t} finally {\n\t\t\tthis.#fail.delete(fail);\n\t\t}\n\t}\n\t/** Reacts to an error the package reports: only a failure to connect, which the package marks fatal, that no retry can get past. A statement can fail with the same error number, such as 1524 for a missing authentication plugin, but not fatally. */\n\treported(error) {\n\t\tif (!isFatal(error) || !connectingCannotSucceed(error)) return;\n\t\tfor (const fail of this.#fail) fail(error);\n\t\tthis.#fail.clear();\n\t}\n};\n/** Gives a connection the pool hands over after its statement stopped waiting back to the pool. */\nfunction releaseLate(getting) {\n\tgetting.then((late) => late.release(), ignoreConnectionFailure).catch(ignoreConnectionFailure);\n}\n/**\n* The MySQL runtime driver: a `mariadb` pool. Every statement takes one round trip over the text protocol, the package writing its values into it. A query reads its whole result before the first row unless `stream` is set. The pool runs the session setup once on each physical connection, and the driver then sets the target's session settings on it; a connection goes back to the pool after each statement as it is; a broken connection is destroyed. `close()` waits for every connection and stream it has handed out before it ends the pool.\n*/\nvar MysqlDriver = class extends MysqlQueryable {\n\tfamilyId = \"sql\";\n\ttargetId;\n\tholdsClient = false;\n\t#state = { kind: \"unbound\" };\n\t#inUse = new ClientsInUse();\n\t#canceller;\n\tcancelStatement = (threadId) => this.#canceller?.cancel(threadId) ?? Promise.resolve(\"unsent\");\n\t#options;\n\t#sessionSettings;\n\tconstructor(options, targetId, server) {\n\t\tsuper(options.stream ?? false, server);\n\t\tthis.targetId = targetId;\n\t\tthis.#options = options;\n\t\tthis.#sessionSettings = new SessionSettingsGuard(options.sessionSettings ?? {});\n\t}\n\tget state() {\n\t\treturn this.#state.kind;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#state.kind === \"connected\") throw errorRuntime(\"DRIVER.ALREADY_CONNECTED\", `${this.displayName} driver already connected`, { fix: \"Call close() before connecting again.\" });\n\t\tconst waiting = new WaitingForConnection();\n\t\tconst pool = createPool({\n\t\t\t...mysqlPoolOptions(binding.url, this.displayName, this.#options.poolOptions),\n\t\t\tlogger: { error: (error) => waiting.reported(error) }\n\t\t});\n\t\tif (pool instanceof EventEmitter) pool.on(\"error\", ignoreConnectionFailure);\n\t\tthis.#state = {\n\t\t\tkind: \"connected\",\n\t\t\tpool,\n\t\t\twaiting\n\t\t};\n\t\tthis.#canceller = new Canceller(binding.url, mysqlPoolIdleTimeoutMillis(this.#options.poolOptions), this.displayName);\n\t}\n\tasync acquireConnection() {\n\t\treturn new MysqlConnectionImpl(await this.acquireClient(), this.streams, this.cancelStatement, () => this.#inUse.released(), this.server);\n\t}\n\tasync close() {\n\t\tif (this.#state.kind !== \"connected\") return;\n\t\tconst { pool } = this.#state;\n\t\tthis.#state = { kind: \"closed\" };\n\t\tawait this.#inUse.none();\n\t\tawait this.#canceller?.close();\n\t\tthis.#canceller = void 0;\n\t\tawait pool.end();\n\t}\n\tasync acquireClient() {\n\t\tif (this.#state.kind !== \"connected\") throw notConnected(this.#state.kind === \"closed\" ? `${this.displayName} driver is closed` : `${this.displayName} driver not connected`);\n\t\tconst { pool, waiting } = this.#state;\n\t\tthis.#inUse.acquired();\n\t\tconst getting = pool.getConnection();\n\t\tlet client;\n\t\ttry {\n\t\t\tclient = await waiting.race(getting);\n\t\t} catch (error) {\n\t\t\treleaseLate(getting);\n\t\t\tthis.#inUse.released();\n\t\t\tthrow normalizeMysqlError(error, this.server);\n\t\t}\n\t\ttry {\n\t\t\tawait this.#sessionSettings.ensure(client);\n\t\t} catch (error) {\n\t\t\tclient.destroy();\n\t\t\tthis.#inUse.released();\n\t\t\tthrow normalizeMysqlError(error, this.server);\n\t\t}\n\t\treturn client;\n\t}\n\t/**\n\t* Destroys a client only after an error the package marks fatal, or after a cancel that went out without an answer once the rest of its result was read (`cancelUnconfirmed`). The package marks an error fatal when the connection's socket is gone or can no longer be trusted, and it has then already set the connection closed and failed every command on it (`fatalError` in its `connection.js`), so no command is receiving and its `destroy()` sends no `KILL`. A statement the caller stopped early is cancelled and read to its end instead (`#stopEarly`).\n\t*/\n\tasync releaseClient(client, { destroy }) {\n\t\ttry {\n\t\t\tif (destroy) client.destroy();\n\t\t\telse await client.release();\n\t\t} finally {\n\t\t\tthis.#inUse.released();\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/runtime/runtime-driver.ts\n/** The runtime driver descriptor of MySQL, or of a target that extends it. */\nfunction createMysqlRuntimeDriverDescriptor(options) {\n\tconst { targetId, displayName } = options.target;\n\tconst server = {\n\t\tdisplayName,\n\t\tcheckViolationErrors: options.checkViolationErrors\n\t};\n\treturn {\n\t\t...mysqlDriverDescriptorMetaFor(targetId),\n\t\tcreate(options, sessionSettings) {\n\t\t\treturn new MysqlDriver({\n\t\t\t\t...options,\n\t\t\t\t...ifDefined(\"sessionSettings\", sessionSettings)\n\t\t\t}, targetId, server);\n\t\t}\n\t};\n}\nconst mysqlRuntimeDriverDescriptor = createMysqlRuntimeDriverDescriptor({\n\ttarget: mysqlTargetDescriptorMetaRuntime,\n\tcheckViolationErrors: MYSQL_CHECK_VIOLATION_ERRORS\n});\n//#endregion\nexport { createMysqlRuntimeDriverDescriptor, mysqlRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,wBAAwB;AAC9B,SAAS,QAAQ,QAAQ;CACxB,IAAI;CACJ,OAAO;EACN,SAAS,IAAI,SAAS,YAAY;GACjC,QAAQ,iBAAiB,QAAQ,SAAS,GAAG,MAAM;EACpD,CAAC;EACD,aAAa,aAAa,KAAK;CAChC;AACD;;;;AAIA,IAAI,YAAY,MAAM;CACrB;CACA;CACA;CACA,2BAA2B,IAAI,QAAQ;CACvC,UAAU;CACV;CACA;CACA,YAAY,KAAK,mBAAmB,aAAa;EAChD,KAAKA,OAAO;EACZ,KAAKC,qBAAqB;EAC1B,KAAKC,eAAe;CACrB;;CAEA,MAAM,OAAO,UAAU,WAAW,OAAO;EACxC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B;CACD;AACD;AACA,MAAM,+BAA+B,mCAAmC;CACvE,QAAQ;CACR,sBAAsB;AACvB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as MysqlRuntimeTargetMeta } from "./runtime-Ci3hPz1j.mjs";
|
|
1
2
|
import { SqlDriver } from "@prisma/orm-family-sql/relational-core/ast";
|
|
2
3
|
import { SessionSettings } from "@prisma/orm-framework/components/components";
|
|
3
4
|
import "mariadb";
|
|
@@ -30,9 +31,15 @@ interface MysqlDriverCreateOptions {
|
|
|
30
31
|
}
|
|
31
32
|
//#endregion
|
|
32
33
|
//#region src/core/runtime/runtime-driver.d.ts
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
interface MysqlRuntimeDriverOptions<TargetId extends string> {
|
|
35
|
+
/** The target's runtime metadata: its drivers carry its id and name it by its display name in their errors. */
|
|
36
|
+
readonly target: Pick<MysqlRuntimeTargetMeta<TargetId>, 'targetId' | 'displayName'>;
|
|
37
|
+
/** The error numbers the database reports a failed CHECK constraint with, which its drivers report with Postgres's SQLSTATE 23514. */
|
|
38
|
+
readonly checkViolationErrors: readonly number[];
|
|
39
|
+
}
|
|
40
|
+
/** The runtime driver descriptor of MySQL, or of a target that extends it. */
|
|
41
|
+
declare function createMysqlRuntimeDriverDescriptor<TargetId extends string>(options: MysqlRuntimeDriverOptions<TargetId>): RuntimeDriverDescriptor<'sql', TargetId, MysqlDriverCreateOptions, MysqlRuntimeDriver<TargetId>>;
|
|
35
42
|
declare const mysqlRuntimeDriverDescriptor: RuntimeDriverDescriptor<"sql", "mysql", MysqlDriverCreateOptions, MysqlRuntimeDriver<"mysql">>;
|
|
36
43
|
//#endregion
|
|
37
|
-
export {
|
|
38
|
-
//# sourceMappingURL=runtime-
|
|
44
|
+
export { MysqlRuntimeDriverOptions as a, MysqlRuntimeDriver as i, MysqlDriverCreateOptions as n, createMysqlRuntimeDriverDescriptor as o, MysqlPoolOptions as r, mysqlRuntimeDriverDescriptor as s, MysqlBinding as t };
|
|
45
|
+
//# sourceMappingURL=runtime-CQ1V-8Yh.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-CQ1V-8Yh.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-mysql/3-driver/dist/runtime.d.mts"],"mappings":";;;;;;;;UAQU;;WAEC;;WAEA;;WAEA;;;;;KAKN;WACM;WACA;;KAEN,mBAAmB,qCAAqC,6BAA6B,YAAY,UAAU;UACtG;;WAEC;WACA,cAAc;;WAEd,kBAAkB;;;;UAInB,0BAA0B;;WAEzB,QAAQ,KAAK,uBAAuB;;WAEpC;;;iBAGM,mCAAmC,yBAAyB,SAAS,0BAA0B,YAAY,+BAA+B,UAAU,0BAA0B,mBAAmB;cACpM,8BAA8B,wCAAwC,0BAA0B"}
|
|
@@ -5,9 +5,9 @@ import { SqlNamespaceInput, SqlStorage } from "@prisma/orm-family-sql/contract/t
|
|
|
5
5
|
import { SqlContractSerializerBase } from "@prisma/orm-family-sql/family/ir";
|
|
6
6
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
7
7
|
import { Temporal } from "temporal-spec";
|
|
8
|
+
import { JsonObject } from "@prisma/orm-framework/utils/json";
|
|
8
9
|
import { RuntimeTargetInstance } from "@prisma/orm-framework/components/execution";
|
|
9
10
|
import { SqlRuntimeTargetDescriptor } from "@prisma/orm-family-sql/runtime";
|
|
10
|
-
import { JsonObject } from "@prisma/orm-framework/utils/json";
|
|
11
11
|
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/runtime.d.mts
|
|
12
12
|
//#region src/core/date-time-now-generators.d.ts
|
|
13
13
|
declare function instantNow(params?: GeneratorParams): Temporal.Instant;
|
|
@@ -47,8 +47,19 @@ declare class MysqlContractSerializer extends SqlContractSerializerBase<Contract
|
|
|
47
47
|
}
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/core/runtime/runtime-target.d.ts
|
|
50
|
-
interface MysqlRuntimeTargetInstance extends RuntimeTargetInstance<'sql',
|
|
51
|
-
|
|
50
|
+
interface MysqlRuntimeTargetInstance<TargetId extends string = 'mysql'> extends RuntimeTargetInstance<'sql', TargetId> {}
|
|
51
|
+
/** The runtime target descriptor of MySQL, or of a target that extends it, with the name its messages show. */
|
|
52
|
+
type MysqlRuntimeTargetDescriptor<TargetId extends string = 'mysql'> = SqlRuntimeTargetDescriptor<TargetId, MysqlRuntimeTargetInstance<TargetId>> & {
|
|
53
|
+
readonly displayName: string;
|
|
54
|
+
};
|
|
55
|
+
/** What the runtime target descriptor is built from: everything but what the factory supplies. */
|
|
56
|
+
type MysqlRuntimeTargetMeta<TargetId extends string> = Omit<MysqlRuntimeTargetDescriptor<TargetId>, 'codecs' | 'create'>;
|
|
57
|
+
interface MysqlRuntimeTargetOptions<TargetId extends string> {
|
|
58
|
+
readonly descriptorMeta: MysqlRuntimeTargetMeta<TargetId>;
|
|
59
|
+
}
|
|
60
|
+
/** The runtime target descriptor of MySQL, or of a target that extends it. */
|
|
61
|
+
declare function createMysqlRuntimeTargetDescriptor<TargetId extends string>(options: MysqlRuntimeTargetOptions<TargetId>): MysqlRuntimeTargetDescriptor<TargetId>;
|
|
62
|
+
declare const mysqlRuntimeTargetDescriptor: MysqlRuntimeTargetDescriptor<"mysql">;
|
|
52
63
|
//#endregion
|
|
53
64
|
//#region src/core/transaction-isolation.d.ts
|
|
54
65
|
declare const mysqlIsolationLevels: {
|
|
@@ -61,5 +72,5 @@ type MysqlIsolationLevel = (typeof mysqlIsolationLevels)[keyof typeof mysqlIsola
|
|
|
61
72
|
declare const mysqlIsolationLevelSchema: import("arktype/internal/variants/string.ts").StringType<"ReadUncommitted" | "ReadCommitted" | "RepeatableRead" | "Serializable", {}>;
|
|
62
73
|
declare function validateMysqlIsolationLevel(value: unknown): MysqlIsolationLevel;
|
|
63
74
|
//#endregion
|
|
64
|
-
export {
|
|
65
|
-
//# sourceMappingURL=runtime-
|
|
75
|
+
export { MysqlRuntimeTargetMeta as a, mysqlIsolationLevelSchema as c, mysqlRuntimeTargetDescriptor as d, validateMysqlIsolationLevel as f, MysqlRuntimeTargetInstance as i, mysqlIsolationLevels as l, MysqlIsolationLevel as n, MysqlRuntimeTargetOptions as o, MysqlRuntimeTargetDescriptor as r, createMysqlRuntimeTargetDescriptor as s, MysqlContractSerializer as t, mysqlNowGenerators as u };
|
|
76
|
+
//# sourceMappingURL=runtime-Ci3hPz1j.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-Ci3hPz1j.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/runtime.d.mts"],"mappings":";;;;;;;;;;;;iBAWiB,WAAW,SAAS,kBAAkB,SAAS;iBAC/C,gBAAgB,SAAS;iBACzB,aAAa,SAAS,kBAAkB,SAAS;iBACjD,iBAAiB,SAAS;iBAC1B,cAAc,SAAS;;;;cAI1B;WACH;WACA,iBAAiB;;WAEjB;WACA,iBAAiB;;WAEjB;WACA,iBAAiB;;WAEjB;WACA,iBAAiB;;WAEjB;WACA,iBAAiB,UAAU;;WAE3B;WACA,iBAAiB;;;;;cAKd,gCAAgC,0BAA0B,SAAS;EAC/E;YACU,yBAAyB,cAAc,KAAK,0BAA0B,YAAY;EAC5F,kBAAkB,UAAU,SAAS,cAAc;;;;UAI3C,2BAA2B,2CAA2C,6BAA6B;;KAExG,6BAA6B,qCAAqC,2BAA2B,UAAU,2BAA2B;WAC5H;;;KAGN,uBAAuB,2BAA2B,KAAK,6BAA6B;UAC/E,0BAA0B;WACzB,gBAAgB,uBAAuB;;;iBAGjC,mCAAmC,yBAAyB,SAAS,0BAA0B,YAAY,6BAA6B;cAC3I,8BAA8B;;;cAG9B;WACH;WACA;WACA;WACA;;KAEN,8BAA8B,mCAAmC;cACxD,yEAAyE;iBACtE,4BAA4B,iBAAiB"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as mysqlTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs";
|
|
2
2
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
3
3
|
import { type } from "arktype";
|
|
4
4
|
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/runtime.mjs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
/** The runtime target descriptor of MySQL, or of a target that extends it. */
|
|
6
|
+
function createMysqlRuntimeTargetDescriptor(options) {
|
|
7
|
+
const { descriptorMeta } = options;
|
|
8
|
+
return {
|
|
9
|
+
...descriptorMeta,
|
|
10
|
+
codecs: () => [],
|
|
11
|
+
create() {
|
|
12
|
+
return {
|
|
13
|
+
familyId: "sql",
|
|
14
|
+
targetId: descriptorMeta.targetId
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const mysqlRuntimeTargetDescriptor = createMysqlRuntimeTargetDescriptor({ descriptorMeta: mysqlTargetDescriptorMetaRuntime });
|
|
15
20
|
const mysqlIsolationLevels = {
|
|
16
21
|
ReadUncommitted: "ReadUncommitted",
|
|
17
22
|
ReadCommitted: "ReadCommitted",
|
|
@@ -32,6 +37,6 @@ function validateMysqlIsolationLevel(value) {
|
|
|
32
37
|
return result;
|
|
33
38
|
}
|
|
34
39
|
//#endregion
|
|
35
|
-
export { validateMysqlIsolationLevel as i,
|
|
40
|
+
export { validateMysqlIsolationLevel as a, mysqlRuntimeTargetDescriptor as i, mysqlIsolationLevelSchema as n, mysqlIsolationLevels as r, createMysqlRuntimeTargetDescriptor as t };
|
|
36
41
|
|
|
37
|
-
//# sourceMappingURL=runtime-
|
|
42
|
+
//# sourceMappingURL=runtime-_c_DZuYR.mjs.map
|