@prisma/orm-target-mysql 8.0.0-rc.23-dev.7 → 8.0.0-rc.23-dev.9
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-D0qXT1lj.d.mts +57 -0
- package/dist/adapter-D0qXT1lj.d.mts.map +1 -0
- package/dist/adapter.d.mts +6 -6
- package/dist/adapter.mjs +3 -3
- package/dist/adapter__adapter.d.mts +2 -2
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__codec-types.d.mts +2 -2
- package/dist/adapter__control.d.mts +2 -2
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +19 -10
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/{codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs → codec-descriptor-3xp1XvVH-DfPKpYeP.mjs} +2 -2
- package/dist/codec-descriptor-3xp1XvVH-DfPKpYeP.mjs.map +1 -0
- package/dist/codec-descriptor-BRcKIX3h.d.mts +2 -0
- package/dist/{codec-descriptor-DXyubAS6-siA0R8Ow.d.mts → codec-descriptor-DXyubAS6-XDBj6Yet.d.mts} +2 -2
- package/dist/codec-descriptor-DXyubAS6-XDBj6Yet.d.mts.map +1 -0
- package/dist/codec-descriptor-J3TP08l8-BmdgkIU6.d.mts +1 -0
- package/dist/{codec-ids-CrR9Xi7r-CarpqbNM.mjs → codec-ids-CrR9Xi7r-CjbGCS3o.mjs} +2 -2
- package/dist/codec-ids-CrR9Xi7r-CjbGCS3o.mjs.map +1 -0
- package/dist/{codec-ids-Dgh5IpML-76oBMuwK.d.mts → codec-ids-Dgh5IpML-DGXIq6j8.d.mts} +2 -2
- package/dist/codec-ids-Dgh5IpML-DGXIq6j8.d.mts.map +1 -0
- package/dist/codec-types-BS-lWfda.d.mts +1 -0
- package/dist/{codec-types-Bai_CFkk-Blx2GxCH.d.mts → codec-types-Bai_CFkk-DmZ74URd.d.mts} +5 -5
- package/dist/codec-types-Bai_CFkk-DmZ74URd.d.mts.map +1 -0
- package/dist/codec-types-Dk2h5dBB.d.mts +1 -0
- package/dist/{codecs-BMidk26M-DsKq6wt5.d.mts → codecs-BMidk26M-B_iWNti6.d.mts} +5 -5
- package/dist/codecs-BMidk26M-B_iWNti6.d.mts.map +1 -0
- package/dist/{codecs-C_twedMx.d.mts → codecs-CIJRyUd3.d.mts} +4 -4
- package/dist/codecs-CIJRyUd3.d.mts.map +1 -0
- package/dist/{codecs-BfiB79-5.mjs → codecs-wVJlFapM.mjs} +7 -7
- package/dist/codecs-wVJlFapM.mjs.map +1 -0
- package/dist/{contract-free-Cw9Mjcro.d.mts → contract-free-BnJBWENn.d.mts} +3 -3
- package/dist/contract-free-BnJBWENn.d.mts.map +1 -0
- package/dist/{contract-free-BvCdx_Ee.mjs → contract-free-DekbHRyr.mjs} +4 -4
- package/dist/contract-free-DekbHRyr.mjs.map +1 -0
- package/dist/control-BBuy6yt5.mjs +73 -0
- package/dist/control-BBuy6yt5.mjs.map +1 -0
- package/dist/control-BiZaCqna.mjs +89 -0
- package/dist/control-BiZaCqna.mjs.map +1 -0
- package/dist/{control-BBhWaGnH.mjs → control-CyGJDPay.mjs} +102 -77
- package/dist/control-CyGJDPay.mjs.map +1 -0
- package/dist/control-D7_IpeiU.d.mts +31 -0
- package/dist/control-D7_IpeiU.d.mts.map +1 -0
- package/dist/{control-BvSM7mGR.d.mts → control-Dj8nIA1M.d.mts} +13 -4
- package/dist/control-Dj8nIA1M.d.mts.map +1 -0
- package/dist/{control-MoPFgSaQ.d.mts → control-WNuLF2Wh.d.mts} +29 -56
- package/dist/control-WNuLF2Wh.d.mts.map +1 -0
- package/dist/{control-tables-CHw2F-rg.d.mts → control-tables-CWJyQ3dZ.d.mts} +2 -2
- package/dist/control-tables-CWJyQ3dZ.d.mts.map +1 -0
- package/dist/{control-tables-CcQ77JE7-CxTQYoQJ.mjs → control-tables-CcQ77JE7-DKb3ubVU.mjs} +2 -2
- package/dist/control-tables-CcQ77JE7-DKb3ubVU.mjs.map +1 -0
- package/dist/{data-type-entries-C7VH2IHc-D1d5I8zF.mjs → data-type-entries-C7VH2IHc-DM6TbTaz.mjs} +3 -3
- package/dist/data-type-entries-C7VH2IHc-DM6TbTaz.mjs.map +1 -0
- package/dist/{data-types-C-rfxpgB.d.mts → data-types-65iVc7q1.d.mts} +3 -3
- package/dist/data-types-65iVc7q1.d.mts.map +1 -0
- package/dist/{data-types-D2HAT-Qf-CRI506c0.d.mts → data-types-D2HAT-Qf-CSdDz1Pk.d.mts} +2 -2
- package/dist/data-types-D2HAT-Qf-CSdDz1Pk.d.mts.map +1 -0
- package/dist/{data-types-DOaaPS93-DBkMJyh1.mjs → data-types-DOaaPS93-lycGybNk.mjs} +4 -4
- package/dist/data-types-DOaaPS93-lycGybNk.mjs.map +1 -0
- package/dist/{date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs → date-time-now-generators-DY-8Bodc-DpQ5Se1u.mjs} +4 -4
- package/dist/date-time-now-generators-DY-8Bodc-DpQ5Se1u.mjs.map +1 -0
- package/dist/ddl-Bobm-S7I.d.mts +1 -0
- package/dist/{ddl-DDmMHyA_-Bb8sXoS0.mjs → ddl-DDmMHyA_-grdUmU3J.mjs} +3 -3
- package/dist/ddl-DDmMHyA_-grdUmU3J.mjs.map +1 -0
- package/dist/{default-normalizer-C8pc7SbL-CKgOEnGl.mjs → default-normalizer-C8pc7SbL-BXd70q02.mjs} +3 -3
- package/dist/default-normalizer-C8pc7SbL-BXd70q02.mjs.map +1 -0
- package/dist/{default-normalizer-CGIwQiKB.d.mts → default-normalizer-D-8Ii0df.d.mts} +2 -2
- package/dist/default-normalizer-D-8Ii0df.d.mts.map +1 -0
- package/dist/{descriptor-meta-CsMPRsxp-DhK87vlc.mjs → descriptor-meta-CsMPRsxp-QVV7vNY8.mjs} +6 -6
- package/dist/descriptor-meta-CsMPRsxp-QVV7vNY8.mjs.map +1 -0
- package/dist/descriptor-meta-pVdZBI-g-BJN4T_on.mjs +32 -0
- package/dist/descriptor-meta-pVdZBI-g-BJN4T_on.mjs.map +1 -0
- package/dist/driver.d.mts +3 -3
- package/dist/driver.mjs +3 -2
- package/dist/driver__control.d.mts +2 -2
- package/dist/driver__control.mjs +2 -2
- package/dist/driver__runtime.d.mts +2 -2
- package/dist/driver__runtime.mjs +2 -564
- package/dist/{errors-Cng94tYg-D02Eud2d.mjs → errors-Cng94tYg-DTH51xWG.mjs} +2 -2
- package/dist/errors-Cng94tYg-DTH51xWG.mjs.map +1 -0
- package/dist/{errors-DfrC_yfG.d.mts → errors-DjCkC9IM.d.mts} +2 -2
- package/dist/errors-DjCkC9IM.d.mts.map +1 -0
- package/dist/{marker-lock-Bwew7cAs-CZ20Y_tA.mjs → marker-lock-Bwew7cAs-ElLxlCQp.mjs} +3 -3
- package/dist/marker-lock-Bwew7cAs-ElLxlCQp.mjs.map +1 -0
- package/dist/{marker-lock-su6IxinO.d.mts → marker-lock-Px2qK06F.d.mts} +2 -2
- package/dist/marker-lock-Px2qK06F.d.mts.map +1 -0
- package/dist/{marker-read-Cf80LSbG-CUp3v1e5.mjs → marker-read-D1hp62hF-3-4fEgDD.mjs} +6 -23
- package/dist/marker-read-D1hp62hF-3-4fEgDD.mjs.map +1 -0
- package/dist/{migration-DmlblTTw.d.mts → migration-DILkj7kB.d.mts} +41 -29
- package/dist/migration-DILkj7kB.d.mts.map +1 -0
- package/dist/{mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs → mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs} +4 -4
- package/dist/mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs.map +1 -0
- package/dist/{mysql-database-CHl9-oSL-CWZLDXt6.mjs → mysql-database-CHl9-oSL-B1arvq6Q.mjs} +5 -5
- package/dist/mysql-database-CHl9-oSL-B1arvq6Q.mjs.map +1 -0
- package/dist/{nodes-CvcX47ot-B-ZaUYRj.mjs → nodes-CvcX47ot-CcCy0Oh4.mjs} +2 -2
- package/dist/nodes-CvcX47ot-CcCy0Oh4.mjs.map +1 -0
- package/dist/{nodes-xc0cR0_c-2YbhgEjb.d.mts → nodes-xc0cR0_c-CLET35o0.d.mts} +2 -2
- package/dist/nodes-xc0cR0_c-CLET35o0.d.mts.map +1 -0
- package/dist/{now-expression-DVD18CUc-00buJUto.mjs → now-expression-DVD18CUc-DJqdZY96.mjs} +3 -3
- package/dist/now-expression-DVD18CUc-DJqdZY96.mjs.map +1 -0
- package/dist/{pack-BXvLVBWP.d.mts → pack-COnjX17N.d.mts} +6 -6
- package/dist/pack-COnjX17N.d.mts.map +1 -0
- package/dist/{planner-target-details-D6g2uSp--C5NKHmCc.d.mts → planner-target-details-D6g2uSp--6VJKSGxe.d.mts} +2 -2
- package/dist/planner-target-details-D6g2uSp--6VJKSGxe.d.mts.map +1 -0
- package/dist/{require-temporal-DeDQhbTn-Bxc65WbA.mjs → require-temporal-DeDQhbTn-CdpjEWCB.mjs} +3 -3
- package/dist/require-temporal-DeDQhbTn-CdpjEWCB.mjs.map +1 -0
- package/dist/{runner-C39AEe6--BVG3xPYw.mjs → runner-BIjAWX-E-BgTmrD8f.mjs} +146 -124
- package/dist/runner-BIjAWX-E-BgTmrD8f.mjs.map +1 -0
- package/dist/runtime-BGF0cSIt.mjs +569 -0
- package/dist/runtime-BGF0cSIt.mjs.map +1 -0
- package/dist/{runtime-ClRDfPiY.d.mts → runtime-Cm-T3hbP.d.mts} +4 -4
- package/dist/runtime-Cm-T3hbP.d.mts.map +1 -0
- package/dist/{runtime-BGyTXcQH.d.mts → runtime-DN20lWEg.d.mts} +7 -5
- package/dist/runtime-DN20lWEg.d.mts.map +1 -0
- package/dist/{runtime-CrB5DXx4.d.mts → runtime-sPIp-JgC.d.mts} +2 -2
- package/dist/runtime-sPIp-JgC.d.mts.map +1 -0
- package/dist/{sql-utils-bD4SfgX0.mjs → sql-utils-BE8tDXHs.mjs} +3 -3
- package/dist/sql-utils-BE8tDXHs.mjs.map +1 -0
- package/dist/{sql-utils-Cmv_TVa8-BetrIUcj.mjs → sql-utils-Cmv_TVa8-CNW3UmfQ.mjs} +3 -3
- package/dist/sql-utils-Cmv_TVa8-CNW3UmfQ.mjs.map +1 -0
- package/dist/{sql-utils-BOS1c2QT.d.mts → sql-utils-DBvre8Ar.d.mts} +2 -2
- package/dist/sql-utils-DBvre8Ar.d.mts.map +1 -0
- package/dist/{statement-DC62oiSx-Buzptbpk.mjs → statement-CT5tB4uX-CHqHFM3z.mjs} +17 -14
- package/dist/statement-CT5tB4uX-CHqHFM3z.mjs.map +1 -0
- package/dist/target.d.mts +24 -24
- package/dist/target.mjs +22 -21
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-ids.d.mts +1 -1
- package/dist/target__codec-ids.mjs +1 -1
- 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__contract-free.d.mts +1 -1
- package/dist/target__contract-free.mjs +2 -2
- package/dist/target__control-tables.d.mts +1 -1
- package/dist/target__control-tables.mjs +1 -1
- package/dist/target__control.d.mts +3 -3
- package/dist/target__control.mjs +3 -64
- package/dist/target__data-types.d.mts +2 -2
- package/dist/target__data-types.mjs +2 -2
- package/dist/target__ddl.d.mts +2 -2
- package/dist/target__ddl.mjs +1 -1
- package/dist/target__default-normalizer.d.mts +1 -1
- package/dist/target__default-normalizer.mjs +1 -1
- package/dist/target__errors.d.mts +1 -1
- package/dist/target__errors.mjs +1 -1
- package/dist/target__marker-lock.d.mts +1 -1
- package/dist/target__marker-lock.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__runtime.d.mts +1 -1
- package/dist/target__runtime.mjs +3 -3
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.d.mts +1 -1
- package/dist/target__sql-utils.mjs +2 -2
- package/dist/target__types.d.mts +1 -1
- package/dist/target__types.mjs +1 -1
- package/dist/{types-CgrFHUdk.d.mts → types-gXYDzQXs.d.mts} +2 -2
- package/dist/types-gXYDzQXs.d.mts.map +1 -0
- package/package.json +10 -10
- package/dist/adapter-Dl4Wwz1I.d.mts +0 -29
- package/dist/adapter-Dl4Wwz1I.d.mts.map +0 -1
- package/dist/codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs.map +0 -1
- package/dist/codec-descriptor-DXyubAS6-siA0R8Ow.d.mts.map +0 -1
- package/dist/codec-descriptor-J3TP08l8-ekLvUVxW.d.mts +0 -1
- package/dist/codec-descriptor-oLRh9E29.d.mts +0 -2
- package/dist/codec-ids-CrR9Xi7r-CarpqbNM.mjs.map +0 -1
- package/dist/codec-ids-Dgh5IpML-76oBMuwK.d.mts.map +0 -1
- package/dist/codec-types-BH5moCD9.d.mts +0 -1
- package/dist/codec-types-Bai_CFkk-Blx2GxCH.d.mts.map +0 -1
- package/dist/codec-types-zzVcrnbk.d.mts +0 -1
- package/dist/codecs-BMidk26M-DsKq6wt5.d.mts.map +0 -1
- package/dist/codecs-BfiB79-5.mjs.map +0 -1
- package/dist/codecs-C_twedMx.d.mts.map +0 -1
- package/dist/contract-contributions-ChiX6W0F-CAng98bZ.mjs +0 -15
- package/dist/contract-contributions-ChiX6W0F-CAng98bZ.mjs.map +0 -1
- package/dist/contract-free-BvCdx_Ee.mjs.map +0 -1
- package/dist/contract-free-Cw9Mjcro.d.mts.map +0 -1
- package/dist/control-5eVF1TXc.mjs +0 -74
- package/dist/control-5eVF1TXc.mjs.map +0 -1
- package/dist/control-BBhWaGnH.mjs.map +0 -1
- package/dist/control-BvSM7mGR.d.mts.map +0 -1
- package/dist/control-DHkZbo58.d.mts +0 -25
- package/dist/control-DHkZbo58.d.mts.map +0 -1
- package/dist/control-MoPFgSaQ.d.mts.map +0 -1
- package/dist/control-tables-CHw2F-rg.d.mts.map +0 -1
- package/dist/control-tables-CcQ77JE7-CxTQYoQJ.mjs.map +0 -1
- package/dist/data-type-entries-C7VH2IHc-D1d5I8zF.mjs.map +0 -1
- package/dist/data-types-C-rfxpgB.d.mts.map +0 -1
- package/dist/data-types-D2HAT-Qf-CRI506c0.d.mts.map +0 -1
- package/dist/data-types-DOaaPS93-DBkMJyh1.mjs.map +0 -1
- package/dist/date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs.map +0 -1
- package/dist/ddl-CT6DPEqg.d.mts +0 -1
- package/dist/ddl-DDmMHyA_-Bb8sXoS0.mjs.map +0 -1
- package/dist/default-normalizer-C8pc7SbL-CKgOEnGl.mjs.map +0 -1
- package/dist/default-normalizer-CGIwQiKB.d.mts.map +0 -1
- package/dist/descriptor-meta-CsMPRsxp-DhK87vlc.mjs.map +0 -1
- package/dist/driver__runtime.mjs.map +0 -1
- package/dist/errors-Cng94tYg-D02Eud2d.mjs.map +0 -1
- package/dist/errors-DfrC_yfG.d.mts.map +0 -1
- package/dist/marker-lock-Bwew7cAs-CZ20Y_tA.mjs.map +0 -1
- package/dist/marker-lock-su6IxinO.d.mts.map +0 -1
- package/dist/marker-read-Cf80LSbG-CUp3v1e5.mjs.map +0 -1
- package/dist/migration-DmlblTTw.d.mts.map +0 -1
- package/dist/mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs.map +0 -1
- package/dist/mysql-database-CHl9-oSL-CWZLDXt6.mjs.map +0 -1
- package/dist/nodes-CvcX47ot-B-ZaUYRj.mjs.map +0 -1
- package/dist/nodes-xc0cR0_c-2YbhgEjb.d.mts.map +0 -1
- package/dist/now-expression-DVD18CUc-00buJUto.mjs.map +0 -1
- package/dist/pack-BXvLVBWP.d.mts.map +0 -1
- package/dist/planner-target-details-D6g2uSp--C5NKHmCc.d.mts.map +0 -1
- package/dist/require-temporal-DeDQhbTn-Bxc65WbA.mjs.map +0 -1
- package/dist/runner-C39AEe6--BVG3xPYw.mjs.map +0 -1
- package/dist/runtime-BGyTXcQH.d.mts.map +0 -1
- package/dist/runtime-ClRDfPiY.d.mts.map +0 -1
- package/dist/runtime-CrB5DXx4.d.mts.map +0 -1
- package/dist/sql-utils-BOS1c2QT.d.mts.map +0 -1
- package/dist/sql-utils-Cmv_TVa8-BetrIUcj.mjs.map +0 -1
- package/dist/sql-utils-bD4SfgX0.mjs.map +0 -1
- package/dist/statement-DC62oiSx-Buzptbpk.mjs.map +0 -1
- package/dist/target__control.mjs.map +0 -1
- package/dist/types-CgrFHUdk.d.mts.map +0 -1
package/dist/driver__runtime.mjs
CHANGED
|
@@ -1,564 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
4
|
-
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
5
|
-
import { createConnection, createPool } from "mariadb";
|
|
6
|
-
import { EventEmitter } from "node:events";
|
|
7
|
-
import { finished } from "node:stream/promises";
|
|
8
|
-
//#region ../../../3-targets/mysql/3-driver/dist/runtime.mjs
|
|
9
|
-
/** How long the canceller waits to open its connection, and for MySQL to answer a `KILL QUERY`. */
|
|
10
|
-
const CANCEL_TIMEOUT_MILLIS = 2e3;
|
|
11
|
-
function timeout(millis) {
|
|
12
|
-
let timer;
|
|
13
|
-
return {
|
|
14
|
-
expired: new Promise((resolve) => {
|
|
15
|
-
timer = setTimeout(() => resolve("expired"), millis);
|
|
16
|
-
}),
|
|
17
|
-
clear: () => clearTimeout(timer)
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 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.
|
|
22
|
-
*/
|
|
23
|
-
var Canceller = class {
|
|
24
|
-
#url;
|
|
25
|
-
#idleTimeoutMillis;
|
|
26
|
-
#connection;
|
|
27
|
-
#pending = /* @__PURE__ */ new WeakMap();
|
|
28
|
-
#closed = false;
|
|
29
|
-
#idleTimer;
|
|
30
|
-
constructor(url, idleTimeoutMillis) {
|
|
31
|
-
this.#url = url;
|
|
32
|
-
this.#idleTimeoutMillis = idleTimeoutMillis;
|
|
33
|
-
}
|
|
34
|
-
/** Sends `KILL QUERY` for `threadId`. Never rejects. A kept connection that is no longer valid is replaced once. */
|
|
35
|
-
async cancel(threadId, replaced = false) {
|
|
36
|
-
if (this.#closed || threadId === null) return "unsent";
|
|
37
|
-
clearTimeout(this.#idleTimer);
|
|
38
|
-
const opening = this.#connection ?? this.#open();
|
|
39
|
-
this.#connection = opening;
|
|
40
|
-
const connection = await opening;
|
|
41
|
-
if (connection === void 0) {
|
|
42
|
-
this.#setAside(opening);
|
|
43
|
-
return "unsent";
|
|
44
|
-
}
|
|
45
|
-
if (!connection.isValid()) {
|
|
46
|
-
this.#setAside(opening);
|
|
47
|
-
return replaced ? "unsent" : this.cancel(threadId, true);
|
|
48
|
-
}
|
|
49
|
-
this.#pending.set(connection, this.#pendingOn(connection) + 1);
|
|
50
|
-
const killing = connection.query("KILL QUERY ?", [threadId]).then(() => "sent", (error) => isFatal(error) ? "unconfirmed" : "unsent");
|
|
51
|
-
killing.then(() => {
|
|
52
|
-
this.#pending.set(connection, this.#pendingOn(connection) - 1);
|
|
53
|
-
this.#idleLater(opening, connection);
|
|
54
|
-
});
|
|
55
|
-
const limit = timeout(CANCEL_TIMEOUT_MILLIS);
|
|
56
|
-
const result = await Promise.race([killing, limit.expired]);
|
|
57
|
-
limit.clear();
|
|
58
|
-
if (result === "sent" || result === "unsent") return result;
|
|
59
|
-
this.#setAside(opening);
|
|
60
|
-
connection.end().catch(() => void 0);
|
|
61
|
-
return "unconfirmed";
|
|
62
|
-
}
|
|
63
|
-
/** 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. */
|
|
64
|
-
async close() {
|
|
65
|
-
this.#closed = true;
|
|
66
|
-
clearTimeout(this.#idleTimer);
|
|
67
|
-
const connection = await this.#connection;
|
|
68
|
-
this.#connection = void 0;
|
|
69
|
-
if (connection === void 0) return;
|
|
70
|
-
const ending = connection.end().catch(() => void 0);
|
|
71
|
-
if (this.#pendingOn(connection) === 0) await ending;
|
|
72
|
-
}
|
|
73
|
-
#idleLater(opening, connection) {
|
|
74
|
-
if (this.#idleTimeoutMillis === 0 || this.#pendingOn(connection) > 0 || this.#connection !== opening) return;
|
|
75
|
-
clearTimeout(this.#idleTimer);
|
|
76
|
-
this.#idleTimer = setTimeout(() => {
|
|
77
|
-
if (this.#pendingOn(connection) > 0 || this.#connection !== opening) return;
|
|
78
|
-
this.#connection = void 0;
|
|
79
|
-
connection.end().catch(() => void 0);
|
|
80
|
-
}, this.#idleTimeoutMillis);
|
|
81
|
-
this.#idleTimer.unref();
|
|
82
|
-
}
|
|
83
|
-
#pendingOn(connection) {
|
|
84
|
-
return this.#pending.get(connection) ?? 0;
|
|
85
|
-
}
|
|
86
|
-
#setAside(opening) {
|
|
87
|
-
if (this.#connection === opening) this.#connection = void 0;
|
|
88
|
-
}
|
|
89
|
-
async #open() {
|
|
90
|
-
try {
|
|
91
|
-
const connection = await createConnection(mysqlConnectionOptions(this.#url, { connectTimeoutMs: CANCEL_TIMEOUT_MILLIS }));
|
|
92
|
-
connection.on("error", () => void 0);
|
|
93
|
-
if (this.#closed) {
|
|
94
|
-
await connection.end().catch(() => void 0);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
return connection;
|
|
98
|
-
} catch {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
function notConnected(message) {
|
|
104
|
-
return errorRuntime("DRIVER.NOT_CONNECTED", message, { fix: "Call connect(binding) before running queries, and do not use the driver after close()." });
|
|
105
|
-
}
|
|
106
|
-
/** 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. */
|
|
107
|
-
async function run(client, request) {
|
|
108
|
-
const { sql, values } = statementFor(client, request.sql, request.params ?? []);
|
|
109
|
-
return client.query(sql, values);
|
|
110
|
-
}
|
|
111
|
-
/** 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. */
|
|
112
|
-
function startStream(client, request, outcome) {
|
|
113
|
-
try {
|
|
114
|
-
const { sql, values } = statementFor(client, request.sql, request.params ?? []);
|
|
115
|
-
return client.queryStream(sql, values);
|
|
116
|
-
} catch (error) {
|
|
117
|
-
throw settle(error, outcome);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/** 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. */
|
|
121
|
-
function statementStats(result) {
|
|
122
|
-
if (typeof result !== "object" || result === null) return { affectedRows: 0 };
|
|
123
|
-
const affectedRows = "affectedRows" in result && typeof result.affectedRows === "number" ? result.affectedRows : 0;
|
|
124
|
-
const insertId = "insertId" in result ? result.insertId : void 0;
|
|
125
|
-
return affectedRows === 1 && (typeof insertId === "bigint" || typeof insertId === "number") && insertId > 0 ? {
|
|
126
|
-
affectedRows,
|
|
127
|
-
insertId: String(insertId)
|
|
128
|
-
} : { affectedRows };
|
|
129
|
-
}
|
|
130
|
-
/** The error to report for `error`, after noting in `outcome` whether it left the client unusable. */
|
|
131
|
-
function settle(error, outcome) {
|
|
132
|
-
if (isFatal(error)) outcome.destroy = true;
|
|
133
|
-
return normalizeMysqlError(error);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* 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.
|
|
137
|
-
*/
|
|
138
|
-
function resultReceived(rows) {
|
|
139
|
-
const state = Reflect.get(rows, "_readableState");
|
|
140
|
-
return typeof state === "object" && state !== null && "ended" in state && state.ended === true;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* 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.
|
|
144
|
-
*/
|
|
145
|
-
async function dropRest(rows) {
|
|
146
|
-
rows.close?.();
|
|
147
|
-
const drain = () => {
|
|
148
|
-
while (rows.read() !== null);
|
|
149
|
-
};
|
|
150
|
-
rows.on("readable", drain);
|
|
151
|
-
try {
|
|
152
|
-
drain();
|
|
153
|
-
await finished(rows);
|
|
154
|
-
} finally {
|
|
155
|
-
rows.off("readable", drain);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function cancelNotConfirmed() {
|
|
159
|
-
return errorRuntime("DRIVER.NOT_CONNECTED", "A cancel on this MySQL connection could not be confirmed, so the connection can no longer be used", {
|
|
160
|
-
why: "The driver cancelled a stream the caller stopped early, and MySQL did not answer the KILL QUERY in time. It may still arrive and would interrupt whatever statement the connection runs then.",
|
|
161
|
-
fix: "Release the connection, which closes it; MySQL rolls back an open transaction on it. Acquire another connection and run the work again."
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
function connectionReleased() {
|
|
165
|
-
return errorRuntime("DRIVER.NOT_CONNECTED", "MySQL connection was released", { fix: "Send statements on a connection only until you release it, and await each one before release()." });
|
|
166
|
-
}
|
|
167
|
-
/** 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. */
|
|
168
|
-
function ignoreAfterStop() {}
|
|
169
|
-
/** 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. */
|
|
170
|
-
function isQueryInterrupted(error) {
|
|
171
|
-
return error instanceof Error && "errno" in error && error.errno === 1317;
|
|
172
|
-
}
|
|
173
|
-
var MysqlQueryable = class {
|
|
174
|
-
streams;
|
|
175
|
-
constructor(streams) {
|
|
176
|
-
this.streams = streams;
|
|
177
|
-
}
|
|
178
|
-
/** Records a stream that is open, and returns the call that records its end. */
|
|
179
|
-
streamOpened(_rows) {
|
|
180
|
-
return () => {};
|
|
181
|
-
}
|
|
182
|
-
/** Takes the client's lock, which keeps statements on it one at a time in the order sent. */
|
|
183
|
-
lockClient(client) {
|
|
184
|
-
return acquireClientQueryLock(client);
|
|
185
|
-
}
|
|
186
|
-
/** Runs one statement that is not a stream, under the client's lock. */
|
|
187
|
-
runStatement(work) {
|
|
188
|
-
return work();
|
|
189
|
-
}
|
|
190
|
-
/** Whether the client went back to the pool under this queryable, so it must send nothing more on it. */
|
|
191
|
-
get handedBack() {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
async *query(request) {
|
|
195
|
-
if (this.streams) {
|
|
196
|
-
yield* this.#streamRows(request);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const result = await this.#runReleasing(request);
|
|
200
|
-
for (const row of Array.isArray(result) ? result : []) yield blindCast(row);
|
|
201
|
-
}
|
|
202
|
-
async execute(request) {
|
|
203
|
-
return statementStats(await this.#runReleasing(request));
|
|
204
|
-
}
|
|
205
|
-
async #runReleasing(request) {
|
|
206
|
-
const client = await this.acquireClient();
|
|
207
|
-
const outcome = { destroy: false };
|
|
208
|
-
try {
|
|
209
|
-
const releaseLock = await this.lockClient(client);
|
|
210
|
-
try {
|
|
211
|
-
return await this.runStatement(() => run(client, request));
|
|
212
|
-
} finally {
|
|
213
|
-
releaseLock();
|
|
214
|
-
}
|
|
215
|
-
} catch (error) {
|
|
216
|
-
throw settle(error, outcome);
|
|
217
|
-
} finally {
|
|
218
|
-
await this.releaseClient(client, outcome);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* 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.
|
|
223
|
-
*/
|
|
224
|
-
async *#streamRows(request) {
|
|
225
|
-
const client = await this.acquireClient();
|
|
226
|
-
const outcome = { destroy: false };
|
|
227
|
-
let releaseLock;
|
|
228
|
-
try {
|
|
229
|
-
releaseLock = await this.lockClient(client);
|
|
230
|
-
} catch (error) {
|
|
231
|
-
await this.releaseClient(client, outcome);
|
|
232
|
-
throw error;
|
|
233
|
-
}
|
|
234
|
-
try {
|
|
235
|
-
const rows = startStream(client, request, outcome);
|
|
236
|
-
rows.on("error", ignoreAfterStop);
|
|
237
|
-
const streamClosed = this.streamOpened(rows);
|
|
238
|
-
let settled = false;
|
|
239
|
-
try {
|
|
240
|
-
for await (const row of rows.iterator({ destroyOnReturn: false })) yield blindCast(row);
|
|
241
|
-
settled = true;
|
|
242
|
-
} catch (error) {
|
|
243
|
-
settled = true;
|
|
244
|
-
throw settle(error, outcome);
|
|
245
|
-
} finally {
|
|
246
|
-
if (!settled && !this.handedBack) await this.#stopEarly(client, rows, outcome);
|
|
247
|
-
if (outcome.destroy) rows.destroy();
|
|
248
|
-
streamClosed();
|
|
249
|
-
}
|
|
250
|
-
} finally {
|
|
251
|
-
releaseLock();
|
|
252
|
-
await this.releaseClient(client, outcome);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* 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.
|
|
257
|
-
*/
|
|
258
|
-
async #stopEarly(client, rows, outcome) {
|
|
259
|
-
const cancel = resultReceived(rows) ? "unsent" : await this.cancelStatement(client.threadId);
|
|
260
|
-
await dropRest(rows).catch((error) => {
|
|
261
|
-
if (isFatal(error) && !(cancel !== "unsent" && isQueryInterrupted(error))) outcome.destroy = true;
|
|
262
|
-
});
|
|
263
|
-
if (cancel === "unconfirmed") this.cancelUnconfirmed(outcome);
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* 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.
|
|
267
|
-
*/
|
|
268
|
-
cancelUnconfirmed(outcome) {
|
|
269
|
-
outcome.destroy = true;
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
function handedBackState() {
|
|
273
|
-
let refuse = () => {};
|
|
274
|
-
const signal = new Promise((_, reject) => {
|
|
275
|
-
refuse = () => reject(connectionReleased());
|
|
276
|
-
});
|
|
277
|
-
signal.catch(() => void 0);
|
|
278
|
-
const state = {
|
|
279
|
-
done: false,
|
|
280
|
-
signal,
|
|
281
|
-
refuse: () => {
|
|
282
|
-
state.done = true;
|
|
283
|
-
refuse();
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
return state;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* 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.
|
|
290
|
-
*/
|
|
291
|
-
var MysqlHeldQueryable = class extends MysqlQueryable {
|
|
292
|
-
client;
|
|
293
|
-
held;
|
|
294
|
-
holdsClient = true;
|
|
295
|
-
get cancelStatement() {
|
|
296
|
-
return this.held.cancel;
|
|
297
|
-
}
|
|
298
|
-
streamOpened(rows) {
|
|
299
|
-
this.held.streams.add(rows);
|
|
300
|
-
return () => this.held.streams.delete(rows);
|
|
301
|
-
}
|
|
302
|
-
get handedBack() {
|
|
303
|
-
return this.held.handedBack.done;
|
|
304
|
-
}
|
|
305
|
-
cancelUnconfirmed() {
|
|
306
|
-
this.held.cancelUnconfirmed = true;
|
|
307
|
-
}
|
|
308
|
-
/** 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. */
|
|
309
|
-
async lockClient(client) {
|
|
310
|
-
this.#refuseIfUnusable();
|
|
311
|
-
const locking = acquireClientQueryLock(client);
|
|
312
|
-
try {
|
|
313
|
-
const releaseLock = await Promise.race([locking, this.held.handedBack.signal]);
|
|
314
|
-
if (!this.held.handedBack.done && !this.held.cancelUnconfirmed) return releaseLock;
|
|
315
|
-
releaseLock();
|
|
316
|
-
} catch {
|
|
317
|
-
locking.then((releaseLock) => releaseLock());
|
|
318
|
-
}
|
|
319
|
-
this.#refuseIfUnusable();
|
|
320
|
-
throw connectionReleased();
|
|
321
|
-
}
|
|
322
|
-
/** 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. */
|
|
323
|
-
#refuseIfUnusable() {
|
|
324
|
-
if (this.held.handedBack.done) throw connectionReleased();
|
|
325
|
-
if (this.held.cancelUnconfirmed) throw cancelNotConfirmed();
|
|
326
|
-
}
|
|
327
|
-
runStatement(work) {
|
|
328
|
-
const running = work();
|
|
329
|
-
this.held.running.add(running);
|
|
330
|
-
running.then(() => this.held.running.delete(running), () => this.held.running.delete(running));
|
|
331
|
-
return running;
|
|
332
|
-
}
|
|
333
|
-
constructor(client, held, streams) {
|
|
334
|
-
super(streams);
|
|
335
|
-
this.client = client;
|
|
336
|
-
this.held = held;
|
|
337
|
-
}
|
|
338
|
-
async acquireClient() {
|
|
339
|
-
this.#refuseIfUnusable();
|
|
340
|
-
return this.client;
|
|
341
|
-
}
|
|
342
|
-
async releaseClient() {}
|
|
343
|
-
/** 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. */
|
|
344
|
-
async underLock(call) {
|
|
345
|
-
const client = await this.acquireClient();
|
|
346
|
-
const releaseLock = await this.lockClient(client);
|
|
347
|
-
try {
|
|
348
|
-
await this.runStatement(call);
|
|
349
|
-
} catch (error) {
|
|
350
|
-
throw normalizeMysqlError(error);
|
|
351
|
-
} finally {
|
|
352
|
-
releaseLock();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
var MysqlConnectionImpl = class extends MysqlHeldQueryable {
|
|
357
|
-
#onRelease;
|
|
358
|
-
constructor(client, streams, cancel, onRelease) {
|
|
359
|
-
super(client, {
|
|
360
|
-
streams: /* @__PURE__ */ new Set(),
|
|
361
|
-
cancelUnconfirmed: false,
|
|
362
|
-
running: /* @__PURE__ */ new Set(),
|
|
363
|
-
cancel,
|
|
364
|
-
handedBack: handedBackState()
|
|
365
|
-
}, streams);
|
|
366
|
-
this.#onRelease = onRelease;
|
|
367
|
-
}
|
|
368
|
-
#released() {
|
|
369
|
-
const onRelease = this.#onRelease;
|
|
370
|
-
this.#onRelease = void 0;
|
|
371
|
-
onRelease?.();
|
|
372
|
-
}
|
|
373
|
-
async beginTransaction() {
|
|
374
|
-
await this.underLock(() => this.client.beginTransaction());
|
|
375
|
-
return new MysqlTransactionImpl(this.client, this.held, this.streams);
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* 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.
|
|
379
|
-
*/
|
|
380
|
-
async release() {
|
|
381
|
-
if (this.held.handedBack.done) return;
|
|
382
|
-
this.held.handedBack.refuse();
|
|
383
|
-
try {
|
|
384
|
-
if (this.held.streams.size > 0) await this.#cancelRunning();
|
|
385
|
-
await this.#runningSettled();
|
|
386
|
-
if (this.held.cancelUnconfirmed) await this.#close();
|
|
387
|
-
else await this.client.release();
|
|
388
|
-
} finally {
|
|
389
|
-
this.#released();
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
/** 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. */
|
|
393
|
-
async destroy(_reason) {
|
|
394
|
-
if (this.held.handedBack.done) return;
|
|
395
|
-
this.held.handedBack.refuse();
|
|
396
|
-
try {
|
|
397
|
-
if (this.held.streams.size > 0 || this.held.running.size > 0) await this.#cancelRunning();
|
|
398
|
-
await this.#runningSettled();
|
|
399
|
-
await this.#close();
|
|
400
|
-
} finally {
|
|
401
|
-
this.#released();
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
/** 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. */
|
|
405
|
-
async #close() {
|
|
406
|
-
await this.client.ping().catch(() => void 0);
|
|
407
|
-
this.client.destroy();
|
|
408
|
-
}
|
|
409
|
-
async #cancelRunning() {
|
|
410
|
-
if (await this.held.cancel(this.client.threadId) === "unconfirmed") this.held.cancelUnconfirmed = true;
|
|
411
|
-
await Promise.all([...this.held.streams].map((rows) => dropRest(rows).catch(() => void 0)));
|
|
412
|
-
}
|
|
413
|
-
async #runningSettled() {
|
|
414
|
-
await Promise.allSettled([...this.held.running]);
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
var MysqlTransactionImpl = class extends MysqlHeldQueryable {
|
|
418
|
-
async commit() {
|
|
419
|
-
await this.underLock(() => this.client.commit());
|
|
420
|
-
}
|
|
421
|
-
async rollback() {
|
|
422
|
-
await this.underLock(() => this.client.rollback());
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
/** 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. */
|
|
426
|
-
var ClientsInUse = class {
|
|
427
|
-
#count = 0;
|
|
428
|
-
#idle = [];
|
|
429
|
-
acquired() {
|
|
430
|
-
this.#count += 1;
|
|
431
|
-
}
|
|
432
|
-
released() {
|
|
433
|
-
this.#count -= 1;
|
|
434
|
-
if (this.#count === 0) for (const resolve of this.#idle.splice(0)) resolve();
|
|
435
|
-
}
|
|
436
|
-
none() {
|
|
437
|
-
return this.#count === 0 ? Promise.resolve() : new Promise((resolve) => this.#idle.push(resolve));
|
|
438
|
-
}
|
|
439
|
-
};
|
|
440
|
-
/** 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. */
|
|
441
|
-
function ignoreConnectionFailure() {}
|
|
442
|
-
/**
|
|
443
|
-
* 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.
|
|
444
|
-
*/
|
|
445
|
-
var WaitingForConnection = class {
|
|
446
|
-
#fail = /* @__PURE__ */ new Set();
|
|
447
|
-
async race(getting) {
|
|
448
|
-
let fail = () => {};
|
|
449
|
-
const failed = new Promise((_, reject) => {
|
|
450
|
-
fail = reject;
|
|
451
|
-
});
|
|
452
|
-
this.#fail.add(fail);
|
|
453
|
-
try {
|
|
454
|
-
return await Promise.race([getting, failed]);
|
|
455
|
-
} finally {
|
|
456
|
-
this.#fail.delete(fail);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
/** 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. */
|
|
460
|
-
reported(error) {
|
|
461
|
-
if (!isFatal(error) || !connectingCannotSucceed(error)) return;
|
|
462
|
-
for (const fail of this.#fail) fail(error);
|
|
463
|
-
this.#fail.clear();
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
/** Gives a connection the pool hands over after its statement stopped waiting back to the pool. */
|
|
467
|
-
function releaseLate(getting) {
|
|
468
|
-
getting.then((late) => late.release(), ignoreConnectionFailure).catch(ignoreConnectionFailure);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* 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.
|
|
472
|
-
*/
|
|
473
|
-
var MysqlDriver = class extends MysqlQueryable {
|
|
474
|
-
familyId = "sql";
|
|
475
|
-
targetId = "mysql";
|
|
476
|
-
holdsClient = false;
|
|
477
|
-
#state = { kind: "unbound" };
|
|
478
|
-
#inUse = new ClientsInUse();
|
|
479
|
-
#canceller;
|
|
480
|
-
cancelStatement = (threadId) => this.#canceller?.cancel(threadId) ?? Promise.resolve("unsent");
|
|
481
|
-
#options;
|
|
482
|
-
#sessionSettings;
|
|
483
|
-
constructor(options = {}) {
|
|
484
|
-
super(options.stream ?? false);
|
|
485
|
-
this.#options = options;
|
|
486
|
-
this.#sessionSettings = new SessionSettingsGuard(options.sessionSettings ?? {});
|
|
487
|
-
}
|
|
488
|
-
get state() {
|
|
489
|
-
return this.#state.kind;
|
|
490
|
-
}
|
|
491
|
-
async connect(binding) {
|
|
492
|
-
if (this.#state.kind === "connected") throw errorRuntime("DRIVER.ALREADY_CONNECTED", "MySQL driver already connected", { fix: "Call close() before connecting again." });
|
|
493
|
-
const waiting = new WaitingForConnection();
|
|
494
|
-
const pool = createPool({
|
|
495
|
-
...mysqlPoolOptions(binding.url, this.#options.poolOptions),
|
|
496
|
-
logger: { error: (error) => waiting.reported(error) }
|
|
497
|
-
});
|
|
498
|
-
if (pool instanceof EventEmitter) pool.on("error", ignoreConnectionFailure);
|
|
499
|
-
this.#state = {
|
|
500
|
-
kind: "connected",
|
|
501
|
-
pool,
|
|
502
|
-
waiting
|
|
503
|
-
};
|
|
504
|
-
this.#canceller = new Canceller(binding.url, mysqlPoolIdleTimeoutMillis(this.#options.poolOptions));
|
|
505
|
-
}
|
|
506
|
-
async acquireConnection() {
|
|
507
|
-
return new MysqlConnectionImpl(await this.acquireClient(), this.streams, this.cancelStatement, () => this.#inUse.released());
|
|
508
|
-
}
|
|
509
|
-
async close() {
|
|
510
|
-
if (this.#state.kind !== "connected") return;
|
|
511
|
-
const { pool } = this.#state;
|
|
512
|
-
this.#state = { kind: "closed" };
|
|
513
|
-
await this.#inUse.none();
|
|
514
|
-
await this.#canceller?.close();
|
|
515
|
-
this.#canceller = void 0;
|
|
516
|
-
await pool.end();
|
|
517
|
-
}
|
|
518
|
-
async acquireClient() {
|
|
519
|
-
if (this.#state.kind !== "connected") throw notConnected(this.#state.kind === "closed" ? "MySQL driver is closed" : "MySQL driver not connected");
|
|
520
|
-
const { pool, waiting } = this.#state;
|
|
521
|
-
this.#inUse.acquired();
|
|
522
|
-
const getting = pool.getConnection();
|
|
523
|
-
let client;
|
|
524
|
-
try {
|
|
525
|
-
client = await waiting.race(getting);
|
|
526
|
-
} catch (error) {
|
|
527
|
-
releaseLate(getting);
|
|
528
|
-
this.#inUse.released();
|
|
529
|
-
throw normalizeMysqlError(error);
|
|
530
|
-
}
|
|
531
|
-
try {
|
|
532
|
-
await this.#sessionSettings.ensure(client);
|
|
533
|
-
} catch (error) {
|
|
534
|
-
client.destroy();
|
|
535
|
-
this.#inUse.released();
|
|
536
|
-
throw normalizeMysqlError(error);
|
|
537
|
-
}
|
|
538
|
-
return client;
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* 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`).
|
|
542
|
-
*/
|
|
543
|
-
async releaseClient(client, { destroy }) {
|
|
544
|
-
try {
|
|
545
|
-
if (destroy) client.destroy();
|
|
546
|
-
else await client.release();
|
|
547
|
-
} finally {
|
|
548
|
-
this.#inUse.released();
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
const mysqlRuntimeDriverDescriptor = {
|
|
553
|
-
...mysqlDriverDescriptorMeta,
|
|
554
|
-
create(options, sessionSettings) {
|
|
555
|
-
return new MysqlDriver({
|
|
556
|
-
...options,
|
|
557
|
-
...ifDefined("sessionSettings", sessionSettings)
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
//#endregion
|
|
562
|
-
export { mysqlRuntimeDriverDescriptor as default };
|
|
563
|
-
|
|
564
|
-
//# sourceMappingURL=driver__runtime.mjs.map
|
|
1
|
+
import { n as mysqlRuntimeDriverDescriptor, t as createMysqlRuntimeDriverDescriptor } from "./runtime-BGF0cSIt.mjs";
|
|
2
|
+
export { createMysqlRuntimeDriverDescriptor, mysqlRuntimeDriverDescriptor as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
2
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
|
-
//#region ../../../3-targets/mysql/1-target/dist/errors-Cng94tYg.mjs
|
|
3
|
+
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/errors-Cng94tYg.mjs
|
|
4
4
|
function mysqlError(code, message, options) {
|
|
5
5
|
return structuredError(code, message, options);
|
|
6
6
|
}
|
|
@@ -84,4 +84,4 @@ function errorDateTimeUnwritable(options) {
|
|
|
84
84
|
//#endregion
|
|
85
85
|
export { errorTemporalUnavailableForDefault as a, mysqlQueryNotYetSupported as c, errorTemporalUnavailable as i, errorDateTimeUnwritable as n, errorTemporalWrongType as o, errorTemporalNonIsoCalendar as r, mysqlError as s, errorDateTimeUnreadable as t };
|
|
86
86
|
|
|
87
|
-
//# sourceMappingURL=errors-Cng94tYg-
|
|
87
|
+
//# sourceMappingURL=errors-Cng94tYg-DTH51xWG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-Cng94tYg-DTH51xWG.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/errors-Cng94tYg.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/errors.ts\nfunction mysqlError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n/** The refusal of a query a later slice of the MySQL target can render: `what` names the feature, as in `Lowering queries`. */\nfunction mysqlQueryNotYetSupported(what) {\n\treturn mysqlError(\"RUNTIME.AST_UNSUPPORTED\", `${what} is not yet supported on MySQL.`, {\n\t\twhy: \"The MySQL target renders reads; writes and some query forms are not built yet.\",\n\t\tfix: \"Use a Postgres or SQLite target for this query until the MySQL target supports it.\",\n\t\tmeta: {\n\t\t\ttarget: \"mysql\",\n\t\t\tfeature: what\n\t\t}\n\t});\n}\nconst TEMPORAL_UNAVAILABLE_FIX = \"Run on a runtime with Temporal available, install a Temporal polyfill before creating the client, or write the column as a convenience type at its default, which needs no Temporal: `DateTime` reads a JavaScript `Date`, and `Date`, `Time` and `Duration` read ISO 8601 strings.\";\nfunction errorTemporalUnavailable(codecId, operation) {\n\treturn mysqlError(\"RUNTIME.TEMPORAL_UNAVAILABLE\", `Codec '${codecId}' cannot ${operation} a value because this runtime has no global Temporal implementation.`, {\n\t\twhy: \"Temporal-backed codecs read and write their values through the global Temporal API, which this runtime does not provide.\",\n\t\tfix: TEMPORAL_UNAVAILABLE_FIX,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\toperation\n\t\t}\n\t});\n}\nfunction errorTemporalUnavailableForDefault(generatorId) {\n\treturn mysqlError(\"RUNTIME.TEMPORAL_UNAVAILABLE\", `Mutation default generator '${generatorId}' cannot produce a value because this runtime has no global Temporal implementation.`, {\n\t\twhy: \"The generator answers a Temporal-backed column, so the value it produces is a Temporal value, which this runtime cannot construct.\",\n\t\tfix: TEMPORAL_UNAVAILABLE_FIX,\n\t\tmeta: { generatorId }\n\t});\n}\nfunction errorTemporalWrongType(codecId, temporalTag, stringType, received) {\n\treturn mysqlError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' encodes a ${temporalTag}, but received ${received}.`, {\n\t\twhy: \"The codec writes the Temporal value's own ISO 8601 text. A value of another type has no text the column holds.\",\n\t\tfix: `Pass a ${temporalTag}, or author the column with its ${stringType} type to write ISO 8601 text.`,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\ttemporalTag,\n\t\t\tstringType,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction errorTemporalNonIsoCalendar(codecId, calendarId) {\n\treturn mysqlError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' accepts only the iso8601 calendar, but the value carries '${calendarId}'.`, {\n\t\twhy: \"MySQL stores no calendar alongside a date, so a non-ISO calendar would be discarded on write and the value would read back as a different date than the one authored.\",\n\t\tfix: \"Convert the value with .withCalendar(\\\"iso8601\\\") before writing if the ISO projection is what you mean to store.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\tcalendarId\n\t\t}\n\t});\n}\n/** A date or time codec read a value from MySQL that is not a value of its type, such as a zero date or a `time` that is no time of day, or that `Temporal` cannot hold. */\nfunction errorDateTimeUnreadable(options) {\n\tconst { codecId, value, detail } = options;\n\treturn mysqlError(\"RUNTIME.DECODE_FAILED\", `Codec '${codecId}' cannot read the value MySQL returned: ${JSON.stringify(value)}. ${detail}`, {\n\t\twhy: \"MySQL can hold values the column's type does not, such as the zero date 0000-00-00 or a time of 838:59:59, when a row is written outside Prisma.\",\n\t\tfix: \"Rewrite the row with a value the column type holds, or read the column with a type that holds its text, such as String.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\tvalue: value.slice(0, 100)\n\t\t},\n\t\t...ifDefined(\"cause\", options.cause)\n\t});\n}\n/** A date or time codec was given a value its column does not hold, such as a date before the year 1000 or text with digits below a microsecond. */\nfunction errorDateTimeUnwritable(options) {\n\tconst { codecId, received, detail } = options;\n\treturn mysqlError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' cannot write ${received}. ${detail}`, {\n\t\twhy: \"The codec refuses a value its column does not hold before it reaches MySQL.\",\n\t\tfix: \"Write a value the column holds, as the message shows.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\treceived: received.slice(0, 100)\n\t\t},\n\t\t...ifDefined(\"cause\", options.cause)\n\t});\n}\n//#endregion\nexport { errorTemporalUnavailableForDefault as a, mysqlQueryNotYetSupported as c, errorTemporalUnavailable as i, errorDateTimeUnwritable as n, errorTemporalWrongType as o, errorTemporalNonIsoCalendar as r, mysqlError as s, errorDateTimeUnreadable as t };\n\n//# sourceMappingURL=errors-Cng94tYg.mjs.map"],"mappings":";;;AAGA,SAAS,WAAW,MAAM,SAAS,SAAS;CAC3C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;AAEA,SAAS,0BAA0B,MAAM;CACxC,OAAO,WAAW,2BAA2B,GAAG,KAAK,kCAAkC;EACtF,KAAK;EACL,KAAK;EACL,MAAM;GACL,QAAQ;GACR,SAAS;EACV;CACD,CAAC;AACF;AACA,MAAM,2BAA2B;AACjC,SAAS,yBAAyB,SAAS,WAAW;CACrD,OAAO,WAAW,gCAAgC,UAAU,QAAQ,WAAW,UAAU,uEAAuE;EAC/J,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,mCAAmC,aAAa;CACxD,OAAO,WAAW,gCAAgC,+BAA+B,YAAY,uFAAuF;EACnL,KAAK;EACL,KAAK;EACL,MAAM,EAAE,YAAY;CACrB,CAAC;AACF;AACA,SAAS,uBAAuB,SAAS,aAAa,YAAY,UAAU;CAC3E,OAAO,WAAW,yBAAyB,UAAU,QAAQ,cAAc,YAAY,iBAAiB,SAAS,IAAI;EACpH,KAAK;EACL,KAAK,UAAU,YAAY,kCAAkC,WAAW;EACxE,MAAM;GACL;GACA;GACA;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,4BAA4B,SAAS,YAAY;CACzD,OAAO,WAAW,yBAAyB,UAAU,QAAQ,8DAA8D,WAAW,KAAK;EAC1I,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;;AAEA,SAAS,wBAAwB,SAAS;CACzC,MAAM,EAAE,SAAS,OAAO,WAAW;CACnC,OAAO,WAAW,yBAAyB,UAAU,QAAQ,0CAA0C,KAAK,UAAU,KAAK,EAAE,IAAI,UAAU;EAC1I,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA,OAAO,MAAM,MAAM,GAAG,GAAG;EAC1B;EACA,GAAG,UAAU,SAAS,QAAQ,KAAK;CACpC,CAAC;AACF;;AAEA,SAAS,wBAAwB,SAAS;CACzC,MAAM,EAAE,SAAS,UAAU,WAAW;CACtC,OAAO,WAAW,yBAAyB,UAAU,QAAQ,iBAAiB,SAAS,IAAI,UAAU;EACpG,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA,UAAU,SAAS,MAAM,GAAG,GAAG;EAChC;EACA,GAAG,UAAU,SAAS,QAAQ,KAAK;CACpC,CAAC;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StructuredError, StructuredErrorOptions } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
-
//#region ../../../3-targets/mysql/1-target/dist/errors.d.mts
|
|
2
|
+
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/errors.d.mts
|
|
3
3
|
//#region src/core/errors.d.ts
|
|
4
4
|
type MysqlTargetErrorCode = 'CONTRACT.ARGUMENT_INVALID' | 'CONTRACT.CONSTRAINT_INVALID' | 'CONTRACT.IDENTIFIER_INVALID' | 'CONTRACT.NAMESPACE_INVALID' | 'CONTRACT.TARGET_MISMATCH' | 'CONTRACT.TYPE_PARAMS_INVALID' | 'MIGRATION.CONTRACT_SPACE_VIOLATION' | 'MIGRATION.MARKER_LOCK_TIMEOUT' | 'MIGRATION.MYSQL_CONTROL_STACK_MISSING' | 'RUNTIME.AST_INVALID' | 'RUNTIME.AST_UNSUPPORTED' | 'RUNTIME.CHARACTER_SET_UNSUPPORTED' | 'RUNTIME.DECODE_FAILED' | 'RUNTIME.ENCODE_FAILED' | 'RUNTIME.SQL_MODE_UNSUPPORTED' | 'RUNTIME.TEMPORAL_UNAVAILABLE';
|
|
5
5
|
declare function mysqlError(code: MysqlTargetErrorCode, message: string, options?: StructuredErrorOptions): StructuredError;
|
|
@@ -7,4 +7,4 @@ declare function mysqlError(code: MysqlTargetErrorCode, message: string, options
|
|
|
7
7
|
declare function mysqlQueryNotYetSupported(what: string): StructuredError;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { mysqlQueryNotYetSupported as n, mysqlError as t };
|
|
10
|
-
//# sourceMappingURL=errors-
|
|
10
|
+
//# sourceMappingURL=errors-DjCkC9IM.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-DjCkC9IM.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/errors.d.mts"],"mappings":";;;KAEK;iBACY,WAAW,MAAM,sBAAsB,iBAAiB,UAAU,yBAAyB;;iBAE3F,0BAA0B,eAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as mysqlError } from "./errors-Cng94tYg-
|
|
2
|
-
//#region ../../../3-targets/mysql/1-target/dist/marker-lock-Bwew7cAs.mjs
|
|
1
|
+
import { s as mysqlError } from "./errors-Cng94tYg-DTH51xWG.mjs";
|
|
2
|
+
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/marker-lock-Bwew7cAs.mjs
|
|
3
3
|
/** How long a migration runner or `db sign` waits for another one to release the marker lock. */
|
|
4
4
|
const MARKER_LOCK_TIMEOUT_SECONDS = 60;
|
|
5
5
|
/** `GET_LOCK` names are global to the server, so the name carries a hash of the connection's database: two databases on one server never wait on each other. */
|
|
@@ -48,4 +48,4 @@ async function withMarkerLock(driver, work, succeeded = () => true) {
|
|
|
48
48
|
//#endregion
|
|
49
49
|
export { withMarkerLock as i, acquireMarkerLock as n, releaseMarkerLock as r, MARKER_LOCK_TIMEOUT_SECONDS as t };
|
|
50
50
|
|
|
51
|
-
//# sourceMappingURL=marker-lock-Bwew7cAs-
|
|
51
|
+
//# sourceMappingURL=marker-lock-Bwew7cAs-ElLxlCQp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-lock-Bwew7cAs-ElLxlCQp.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/marker-lock-Bwew7cAs.mjs"],"sourcesContent":["import { s as mysqlError } from \"./errors-Cng94tYg.mjs\";\n//#region src/core/marker-lock.ts\n/** How long a migration runner or `db sign` waits for another one to release the marker lock. */\nconst MARKER_LOCK_TIMEOUT_SECONDS = 60;\n/** `GET_LOCK` names are global to the server, so the name carries a hash of the connection's database: two databases on one server never wait on each other. */\nconst LOCK_NAME = \"CONCAT('prisma_marker_', LEFT(SHA2(DATABASE(), 256), 50))\";\nfunction lockResult(rows) {\n\tconst value = rows[0]?.[\"acquired\"];\n\treturn value === null || value === void 0 ? void 0 : String(value);\n}\n/**\n* Takes the marker lock on the connection `driver` holds. MySQL holds a `GET_LOCK` lock for the session, not for a transaction, so the caller releases it with {@link releaseMarkerLock} on the same connection when the work it guards ends.\n*/\nasync function acquireMarkerLock(driver, timeoutSeconds = 60) {\n\tconst { rows } = await driver.query(`SELECT GET_LOCK(${LOCK_NAME}, ?) AS acquired`, [timeoutSeconds]);\n\tif (lockResult(rows) !== \"1\") throw mysqlError(\"MIGRATION.MARKER_LOCK_TIMEOUT\", `Another process held the migration marker lock for ${timeoutSeconds} seconds.`, {\n\t\twhy: \"A migration or db sign on this database is still running, and they write the contract markers one at a time.\",\n\t\tfix: \"Wait for the other process to finish, then run the command again.\",\n\t\tmeta: { timeoutSeconds }\n\t});\n}\n/** Releases the marker lock {@link acquireMarkerLock} took on this connection. */\nasync function releaseMarkerLock(driver) {\n\tawait driver.query(`SELECT RELEASE_LOCK(${LOCK_NAME}) AS released`);\n}\n/**\n* Releases the marker lock after work that failed, keeping that failure: a release that fails too is dropped. MySQL frees a session's locks when the session ends, which is the usual reason a release fails.\n*/\nasync function releaseMarkerLockAfterFailure(driver) {\n\tawait releaseMarkerLock(driver).catch(() => void 0);\n}\n/**\n* The one way MySQL holds the marker lock: takes it on the connection `driver` holds, runs `work`, and releases it on the same connection when `work` ends. A failed release is reported only when `work` succeeded; when `work` throws, or `succeeded` says its result is a failure, that outcome is what comes back.\n*/\nasync function withMarkerLock(driver, work, succeeded = () => true) {\n\tawait acquireMarkerLock(driver);\n\tlet result;\n\ttry {\n\t\tresult = await work();\n\t} catch (error) {\n\t\tawait releaseMarkerLockAfterFailure(driver);\n\t\tthrow error;\n\t}\n\tif (succeeded(result)) await releaseMarkerLock(driver);\n\telse await releaseMarkerLockAfterFailure(driver);\n\treturn result;\n}\n//#endregion\nexport { withMarkerLock as i, acquireMarkerLock as n, releaseMarkerLock as r, MARKER_LOCK_TIMEOUT_SECONDS as t };\n\n//# sourceMappingURL=marker-lock-Bwew7cAs.mjs.map"],"mappings":";;;AAGA,MAAM,8BAA8B;;AAEpC,MAAM,YAAY;AAClB,SAAS,WAAW,MAAM;CACzB,MAAM,QAAQ,KAAK,EAAE,GAAG;CACxB,OAAO,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,OAAO,KAAK;AAClE;;;;AAIA,eAAe,kBAAkB,QAAQ,iBAAiB,IAAI;CAC7D,MAAM,EAAE,SAAS,MAAM,OAAO,MAAM,mBAAmB,UAAU,mBAAmB,CAAC,cAAc,CAAC;CACpG,IAAI,WAAW,IAAI,MAAM,KAAK,MAAM,WAAW,iCAAiC,sDAAsD,eAAe,YAAY;EAChK,KAAK;EACL,KAAK;EACL,MAAM,EAAE,eAAe;CACxB,CAAC;AACF;;AAEA,eAAe,kBAAkB,QAAQ;CACxC,MAAM,OAAO,MAAM,uBAAuB,UAAU,cAAc;AACnE;;;;AAIA,eAAe,8BAA8B,QAAQ;CACpD,MAAM,kBAAkB,MAAM,CAAC,CAAC,YAAY,KAAK,CAAC;AACnD;;;;AAIA,eAAe,eAAe,QAAQ,MAAM,kBAAkB,MAAM;CACnE,MAAM,kBAAkB,MAAM;CAC9B,IAAI;CACJ,IAAI;EACH,SAAS,MAAM,KAAK;CACrB,SAAS,OAAO;EACf,MAAM,8BAA8B,MAAM;EAC1C,MAAM;CACP;CACA,IAAI,UAAU,MAAM,GAAG,MAAM,kBAAkB,MAAM;MAChD,MAAM,8BAA8B,MAAM;CAC/C,OAAO;AACR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SqlControlDriverInstance } from "@prisma/orm-family-sql/contract/types";
|
|
2
|
-
//#region ../../../3-targets/mysql/1-target/dist/marker-lock.d.mts
|
|
2
|
+
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/marker-lock.d.mts
|
|
3
3
|
//#region src/core/marker-lock.d.ts
|
|
4
4
|
/** How long a migration runner or `db sign` waits for another one to release the marker lock. */
|
|
5
5
|
declare const MARKER_LOCK_TIMEOUT_SECONDS = 60;
|
|
@@ -15,4 +15,4 @@ declare function releaseMarkerLock(driver: SqlControlDriverInstance<string>): Pr
|
|
|
15
15
|
declare function withMarkerLock<T>(driver: SqlControlDriverInstance<string>, work: () => Promise<T>, succeeded?: (result: T) => boolean): Promise<T>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { withMarkerLock as i, acquireMarkerLock as n, releaseMarkerLock as r, MARKER_LOCK_TIMEOUT_SECONDS as t };
|
|
18
|
-
//# sourceMappingURL=marker-lock-
|
|
18
|
+
//# sourceMappingURL=marker-lock-Px2qK06F.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-lock-Px2qK06F.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/marker-lock.d.mts"],"mappings":";;;;cAGc;;;;iBAIG,kBAAkB,QAAQ,kCAAkC,0BAA0B;;iBAEtF,kBAAkB,QAAQ,mCAAmC;;;;iBAI7D,eAAe,GAAG,QAAQ,kCAAkC,YAAY,QAAQ,IAAI,aAAa,QAAQ,gBAAgB,QAAQ"}
|