@prisma/orm-target-mysql 8.0.0-rc.22-dev.11 → 8.0.0-rc.22-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/adapter.d.mts +4 -4
- package/dist/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 +1 -1
- package/dist/adapter__runtime.mjs +17 -6
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/{codec-descriptor-Du6DSz-3-ytBCu_mq.mjs → codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs} +5 -3
- package/dist/codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs.map +1 -0
- package/dist/codec-ids-CrR9Xi7r-CarpqbNM.mjs +20 -0
- package/dist/codec-ids-CrR9Xi7r-CarpqbNM.mjs.map +1 -0
- package/dist/codec-ids-Dgh5IpML-76oBMuwK.d.mts +20 -0
- package/dist/codec-ids-Dgh5IpML-76oBMuwK.d.mts.map +1 -0
- package/dist/codec-types-BH5moCD9.d.mts +1 -0
- package/dist/codec-types-Bai_CFkk-Blx2GxCH.d.mts +31 -0
- package/dist/codec-types-Bai_CFkk-Blx2GxCH.d.mts.map +1 -0
- package/dist/codec-types-zzVcrnbk.d.mts +1 -0
- package/dist/codecs-BMidk26M-DsKq6wt5.d.mts +282 -0
- package/dist/codecs-BMidk26M-DsKq6wt5.d.mts.map +1 -0
- package/dist/codecs-BfiB79-5.mjs +750 -0
- package/dist/codecs-BfiB79-5.mjs.map +1 -0
- package/dist/codecs-C_twedMx.d.mts +36 -0
- package/dist/codecs-C_twedMx.d.mts.map +1 -0
- package/dist/{control-CgeXsxCR.mjs → control-5eVF1TXc.mjs} +2 -2
- package/dist/{control-CgeXsxCR.mjs.map → control-5eVF1TXc.mjs.map} +1 -1
- package/dist/{control-H2sjKXXS.mjs → control-BBhWaGnH.mjs} +24 -13
- package/dist/control-BBhWaGnH.mjs.map +1 -0
- package/dist/control-BvSM7mGR.d.mts +396 -0
- package/dist/control-BvSM7mGR.d.mts.map +1 -0
- package/dist/{control-Ez_PtlFI.d.mts → control-MoPFgSaQ.d.mts} +2 -2
- package/dist/{control-Ez_PtlFI.d.mts.map → control-MoPFgSaQ.d.mts.map} +1 -1
- package/dist/data-type-entries-C7VH2IHc-D1d5I8zF.mjs +59 -0
- package/dist/data-type-entries-C7VH2IHc-D1d5I8zF.mjs.map +1 -0
- package/dist/{data-types-SXrh0Lou.d.mts → data-types-C-rfxpgB.d.mts} +2 -2
- package/dist/data-types-C-rfxpgB.d.mts.map +1 -0
- package/dist/data-types-D2HAT-Qf-CRI506c0.d.mts +88 -0
- package/dist/data-types-D2HAT-Qf-CRI506c0.d.mts.map +1 -0
- package/dist/data-types-DOaaPS93-DBkMJyh1.mjs +289 -0
- package/dist/data-types-DOaaPS93-DBkMJyh1.mjs.map +1 -0
- package/dist/date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs +72 -0
- package/dist/date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs.map +1 -0
- package/dist/{default-normalizer-BDUgHXUn-Xk7HQJuI.mjs → default-normalizer-C8pc7SbL-CKgOEnGl.mjs} +22 -12
- package/dist/default-normalizer-C8pc7SbL-CKgOEnGl.mjs.map +1 -0
- package/dist/{default-normalizer-BBhGpw7r.d.mts → default-normalizer-CGIwQiKB.d.mts} +4 -4
- package/dist/{default-normalizer-BBhGpw7r.d.mts.map → default-normalizer-CGIwQiKB.d.mts.map} +1 -1
- package/dist/descriptor-meta-CsMPRsxp-DhK87vlc.mjs +352 -0
- package/dist/descriptor-meta-CsMPRsxp-DhK87vlc.mjs.map +1 -0
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.mjs +1 -1
- package/dist/driver__runtime.mjs +1 -1
- package/dist/errors-Cng94tYg-D02Eud2d.mjs +87 -0
- package/dist/errors-Cng94tYg-D02Eud2d.mjs.map +1 -0
- package/dist/{errors-BYhjQT7y.d.mts → errors-DfrC_yfG.d.mts} +2 -2
- package/dist/{errors-BYhjQT7y.d.mts.map → errors-DfrC_yfG.d.mts.map} +1 -1
- package/dist/{marker-lock-CmGvN4hw-Com29AtQ.mjs → marker-lock-Bwew7cAs-CZ20Y_tA.mjs} +3 -3
- package/dist/{marker-lock-CmGvN4hw-Com29AtQ.mjs.map → marker-lock-Bwew7cAs-CZ20Y_tA.mjs.map} +1 -1
- package/dist/{marker-read-Cf80LSbG-BZaJ8Ll6.mjs → marker-read-Cf80LSbG-CUp3v1e5.mjs} +3 -3
- package/dist/{marker-read-Cf80LSbG-BZaJ8Ll6.mjs.map → marker-read-Cf80LSbG-CUp3v1e5.mjs.map} +1 -1
- package/dist/mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs +35 -0
- package/dist/mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs.map +1 -0
- package/dist/{mysql-contract-serializer-DLv0uW_f-Cg4A43Ry.mjs → mysql-database-CHl9-oSL-CWZLDXt6.mjs} +39 -40
- package/dist/mysql-database-CHl9-oSL-CWZLDXt6.mjs.map +1 -0
- package/dist/now-expression-DVD18CUc-00buJUto.mjs +38 -0
- package/dist/now-expression-DVD18CUc-00buJUto.mjs.map +1 -0
- package/dist/{pack-DXsOvRJn.d.mts → pack-BXvLVBWP.d.mts} +394 -14
- package/dist/{pack-DXsOvRJn.d.mts.map → pack-BXvLVBWP.d.mts.map} +1 -1
- package/dist/require-temporal-DeDQhbTn-Bxc65WbA.mjs +16 -0
- package/dist/require-temporal-DeDQhbTn-Bxc65WbA.mjs.map +1 -0
- package/dist/{runner-BaBQoXiU-C7ln-4b2.mjs → runner-C39AEe6--BVG3xPYw.mjs} +7 -7
- package/dist/{runner-BaBQoXiU-C7ln-4b2.mjs.map → runner-C39AEe6--BVG3xPYw.mjs.map} +1 -1
- package/dist/{runtime-CeuRr9nE.d.mts → runtime-ClRDfPiY.d.mts} +2 -2
- package/dist/{runtime-CeuRr9nE.d.mts.map → runtime-ClRDfPiY.d.mts.map} +1 -1
- package/dist/runtime-CrB5DXx4.d.mts +54 -0
- package/dist/runtime-CrB5DXx4.d.mts.map +1 -0
- package/dist/{sql-utils-Db0IQO_B-PaULnfrE.mjs → sql-utils-Cmv_TVa8-BetrIUcj.mjs} +3 -3
- package/dist/{sql-utils-Db0IQO_B-PaULnfrE.mjs.map → sql-utils-Cmv_TVa8-BetrIUcj.mjs.map} +1 -1
- package/dist/{sql-utils-RW0vJvDl.mjs → sql-utils-bD4SfgX0.mjs} +2 -2
- package/dist/{sql-utils-RW0vJvDl.mjs.map → sql-utils-bD4SfgX0.mjs.map} +1 -1
- package/dist/{statement-DC62oiSx-DTx1JaP7.mjs → statement-DC62oiSx-Buzptbpk.mjs} +5 -5
- package/dist/{statement-DC62oiSx-DTx1JaP7.mjs.map → statement-DC62oiSx-Buzptbpk.mjs.map} +1 -1
- package/dist/target.d.mts +14 -13
- package/dist/target.mjs +17 -13
- 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 +3 -3
- package/dist/target__codecs.mjs +3 -2
- package/dist/target__control.d.mts +2 -2
- package/dist/target__control.mjs +38 -32
- package/dist/target__control.mjs.map +1 -1
- package/dist/target__data-types.d.mts +3 -3
- package/dist/target__data-types.mjs +3 -3
- 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.mjs +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 +3 -3
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.mjs +2 -2
- package/dist/target__types.d.mts +2 -0
- package/dist/target__types.mjs +2 -0
- package/dist/{control-_4epnrIW.d.mts → types-CgrFHUdk.d.mts} +3 -8
- package/dist/types-CgrFHUdk.d.mts.map +1 -0
- package/package.json +18 -12
- package/dist/codec-descriptor-Du6DSz-3-ytBCu_mq.mjs.map +0 -1
- package/dist/codec-ids-cjxtOcLM-vFeQhgPm.mjs +0 -10
- package/dist/codec-ids-cjxtOcLM-vFeQhgPm.mjs.map +0 -1
- package/dist/codec-ids-sMOU8F-B-BQbCq2dr.d.mts +0 -10
- package/dist/codec-ids-sMOU8F-B-BQbCq2dr.d.mts.map +0 -1
- package/dist/codec-types-Bd7DL1Mr-CZWNfnp9.d.mts +0 -21
- package/dist/codec-types-Bd7DL1Mr-CZWNfnp9.d.mts.map +0 -1
- package/dist/codec-types-Bo3Jfilx.d.mts +0 -1
- package/dist/codec-types-Ja2kLzLS.d.mts +0 -1
- package/dist/codecs-C00kjHgh.mjs +0 -282
- package/dist/codecs-C00kjHgh.mjs.map +0 -1
- package/dist/codecs-CO_VNEYU-CwAnKzRs.d.mts +0 -102
- package/dist/codecs-CO_VNEYU-CwAnKzRs.d.mts.map +0 -1
- package/dist/codecs-DM61agRr.d.mts +0 -21
- package/dist/codecs-DM61agRr.d.mts.map +0 -1
- package/dist/control-H2sjKXXS.mjs.map +0 -1
- package/dist/control-_4epnrIW.d.mts.map +0 -1
- package/dist/data-type-entries-B0AoBozh-f9AEUIUQ.mjs +0 -42
- package/dist/data-type-entries-B0AoBozh-f9AEUIUQ.mjs.map +0 -1
- package/dist/data-types-BpihGKoK-BMW-m4EN.d.mts +0 -52
- package/dist/data-types-BpihGKoK-BMW-m4EN.d.mts.map +0 -1
- package/dist/data-types-Dv9gwVRV-BZPzCWZk.mjs +0 -181
- package/dist/data-types-Dv9gwVRV-BZPzCWZk.mjs.map +0 -1
- package/dist/data-types-SXrh0Lou.d.mts.map +0 -1
- package/dist/default-normalizer-BDUgHXUn-Xk7HQJuI.mjs.map +0 -1
- package/dist/descriptor-meta-D7tc0iue-C4W7o0Av.mjs +0 -82
- package/dist/descriptor-meta-D7tc0iue-C4W7o0Av.mjs.map +0 -1
- package/dist/descriptor-meta-runtime-Cur6umHo-C_4rsCGC.mjs +0 -20
- package/dist/descriptor-meta-runtime-Cur6umHo-C_4rsCGC.mjs.map +0 -1
- package/dist/errors-rvH_F2Yj-BQrO_--u.mjs +0 -20
- package/dist/errors-rvH_F2Yj-BQrO_--u.mjs.map +0 -1
- package/dist/mysql-contract-serializer-DLv0uW_f-Cg4A43Ry.mjs.map +0 -1
- package/dist/runtime-Cl0BbTZq.d.mts +0 -22
- package/dist/runtime-Cl0BbTZq.d.mts.map +0 -1
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { a as MYSQL_DATE_STRING_CODEC_ID, d as MYSQL_TIMESTAMP_DATE_CODEC_ID, f as MYSQL_TIMESTAMP_STRING_CODEC_ID, h as MYSQL_TIME_TEMPORAL_CODEC_ID, i as MYSQL_DATETIME_TEMPORAL_CODEC_ID, l as MYSQL_INT_CODEC_ID, m as MYSQL_TIME_STRING_CODEC_ID, n as MYSQL_DATETIME_CODEC_ID, o as MYSQL_DATE_TEMPORAL_CODEC_ID, p as MYSQL_TIMESTAMP_TEMPORAL_CODEC_ID, r as MYSQL_DATETIME_STRING_CODEC_ID, s as MYSQL_DURATION_STRING_CODEC_ID, t as MYSQL_BIGINT_CODEC_ID, u as MYSQL_TEXT_CODEC_ID } from "./codec-ids-CrR9Xi7r-CarpqbNM.mjs";
|
|
2
|
+
import { _ as mysqlInt, y as mysqlTextDataTypes } from "./data-types-DOaaPS93-DBkMJyh1.mjs";
|
|
3
|
+
import { t as mysqlDataTypeEntries } from "./data-type-entries-C7VH2IHc-D1d5I8zF.mjs";
|
|
4
|
+
import { n as mysqlTargetDescriptorMetaRuntime, t as mysqlNowGenerators } from "./date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs";
|
|
5
|
+
import { SQL_VARCHAR_CODEC_ID } from "@prisma/orm-family-sql/relational-core/ast";
|
|
6
|
+
import { DATE_STRING_NOW_GENERATOR_ID, INSTANT_NOW_GENERATOR_ID, INSTANT_STRING_NOW_GENERATOR_ID, PLAIN_DATE_NOW_GENERATOR_ID, PLAIN_TIME_NOW_GENERATOR_ID, TIME_STRING_NOW_GENERATOR_ID } from "@prisma/orm-framework/type-implementations/now";
|
|
7
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
8
|
+
import { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions, sqlTargetTypeConstructors } from "@prisma/orm-family-sql/family/pack";
|
|
9
|
+
import { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from "@prisma/orm-framework/components/authoring";
|
|
10
|
+
import { singleGeneratorBinding } from "@prisma/orm-framework/components/components";
|
|
11
|
+
//#region ../../../3-targets/mysql/1-target/dist/descriptor-meta-CsMPRsxp.mjs
|
|
12
|
+
/** The type constructors whose arguments are sizes, which take values of `mysql/int`, and the created-at and updated-at aliases on the type a bare `DateTime` becomes: a `datetime(3)` column read as a JavaScript `Date`. */
|
|
13
|
+
const mysqlAuthoringTypes = {
|
|
14
|
+
.../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: "mysql/int" }),
|
|
15
|
+
temporal: /* @__PURE__ */ temporalTypeAliases({
|
|
16
|
+
codecId: MYSQL_DATETIME_CODEC_ID,
|
|
17
|
+
typeParams: { precision: 3 }
|
|
18
|
+
}, "a JavaScript Date")
|
|
19
|
+
};
|
|
20
|
+
/** The "now" generator for each codec that has one. The `now` generator function binds it. */
|
|
21
|
+
const mysqlNowGeneratorIds = {
|
|
22
|
+
[MYSQL_DATETIME_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,
|
|
23
|
+
[MYSQL_DATETIME_TEMPORAL_CODEC_ID]: INSTANT_NOW_GENERATOR_ID,
|
|
24
|
+
[MYSQL_DATETIME_STRING_CODEC_ID]: INSTANT_STRING_NOW_GENERATOR_ID,
|
|
25
|
+
[MYSQL_TIMESTAMP_DATE_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,
|
|
26
|
+
[MYSQL_TIMESTAMP_TEMPORAL_CODEC_ID]: INSTANT_NOW_GENERATOR_ID,
|
|
27
|
+
[MYSQL_TIMESTAMP_STRING_CODEC_ID]: INSTANT_STRING_NOW_GENERATOR_ID,
|
|
28
|
+
[MYSQL_DATE_STRING_CODEC_ID]: DATE_STRING_NOW_GENERATOR_ID,
|
|
29
|
+
[MYSQL_DATE_TEMPORAL_CODEC_ID]: PLAIN_DATE_NOW_GENERATOR_ID,
|
|
30
|
+
[MYSQL_TIME_STRING_CODEC_ID]: TIME_STRING_NOW_GENERATOR_ID,
|
|
31
|
+
[MYSQL_TIME_TEMPORAL_CODEC_ID]: PLAIN_TIME_NOW_GENERATOR_ID
|
|
32
|
+
};
|
|
33
|
+
/** The generators that round down to the column's fraction digits, 0 for a bare type. */
|
|
34
|
+
const takesPrecision = /* @__PURE__ */ new Set([
|
|
35
|
+
INSTANT_NOW_GENERATOR_ID,
|
|
36
|
+
INSTANT_STRING_NOW_GENERATOR_ID,
|
|
37
|
+
PLAIN_TIME_NOW_GENERATOR_ID,
|
|
38
|
+
TIME_STRING_NOW_GENERATOR_ID
|
|
39
|
+
]);
|
|
40
|
+
/** The fraction digits a `Date` holds: `timestampNow` takes a precision only below them, so a column of 3 or more, such as a bare `DateTime`, keeps a contract with no generator params. */
|
|
41
|
+
const DATE_FRACTION_DIGITS = 3;
|
|
42
|
+
function nowParams(generatorId, typeParams) {
|
|
43
|
+
const written = typeParams?.["precision"];
|
|
44
|
+
const precision = typeof written === "number" ? written : 0;
|
|
45
|
+
if (takesPrecision.has(generatorId)) return { precision };
|
|
46
|
+
if (generatorId === TIMESTAMP_NOW_GENERATOR_ID && precision < DATE_FRACTION_DIGITS) return { precision };
|
|
47
|
+
}
|
|
48
|
+
const mysqlGeneratorFunctions = [
|
|
49
|
+
...sqlIntegerArgumentGeneratorFunctions({ integer: mysqlInt.id }),
|
|
50
|
+
{
|
|
51
|
+
name: "now",
|
|
52
|
+
bindings: Object.entries(mysqlNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({
|
|
53
|
+
codecIds: [codecId],
|
|
54
|
+
generatorId,
|
|
55
|
+
paramsFromField: (column) => nowParams(generatorId, column.typeParams)
|
|
56
|
+
}))
|
|
57
|
+
},
|
|
58
|
+
...idGeneratorFunctionBindings({ text: [MYSQL_TEXT_CODEC_ID] })
|
|
59
|
+
];
|
|
60
|
+
/** The `now` generators MySQL binds. The SQL family registers the identifier generators. */
|
|
61
|
+
const mysqlGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...mysqlNowGenerators.map(({ id }) => ({ id }))];
|
|
62
|
+
/**
|
|
63
|
+
* The base PSL scalars other than the date and time types, as zero-arg type constructors. Each names a codec; the column's database type is its data type's. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.
|
|
64
|
+
*/
|
|
65
|
+
const mysqlScalarAuthoringTypes = {
|
|
66
|
+
String: {
|
|
67
|
+
kind: "typeConstructor",
|
|
68
|
+
documentation: `Text of at most 191 characters, stored as MySQL varchar(191) so that it can be indexed.`,
|
|
69
|
+
output: {
|
|
70
|
+
codecId: SQL_VARCHAR_CODEC_ID,
|
|
71
|
+
typeParams: { length: 191 }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
Int: {
|
|
75
|
+
kind: "typeConstructor",
|
|
76
|
+
inferred: true,
|
|
77
|
+
documentation: "A signed 32-bit integer stored as MySQL int and represented as a JavaScript number.",
|
|
78
|
+
output: { codecId: MYSQL_INT_CODEC_ID }
|
|
79
|
+
},
|
|
80
|
+
BigInt: {
|
|
81
|
+
kind: "typeConstructor",
|
|
82
|
+
inferred: true,
|
|
83
|
+
documentation: "A signed 64-bit integer stored as MySQL bigint and represented as a JavaScript bigint.",
|
|
84
|
+
output: { codecId: MYSQL_BIGINT_CODEC_ID }
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const precision = {
|
|
88
|
+
kind: "value",
|
|
89
|
+
dataType: "mysql/int",
|
|
90
|
+
name: "precision",
|
|
91
|
+
optional: true
|
|
92
|
+
};
|
|
93
|
+
/** The explicit type `codecId`, whose `precision` argument is the number of fraction digits its column holds, 0 to 6; MySQL holds 0 when none is written. */
|
|
94
|
+
function withPrecision(codecId, documentation) {
|
|
95
|
+
return {
|
|
96
|
+
kind: "typeConstructor",
|
|
97
|
+
documentation,
|
|
98
|
+
args: [precision],
|
|
99
|
+
output: {
|
|
100
|
+
codecId,
|
|
101
|
+
typeParams: { precision: {
|
|
102
|
+
kind: "arg",
|
|
103
|
+
index: 0
|
|
104
|
+
} }
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The explicit date and time types. Each is named after its MySQL column type, with a suffix for the value the application reads; `DurationString` is stored as `varchar`, since MySQL has no interval type. ADR 315.
|
|
110
|
+
*/
|
|
111
|
+
const mysqlDateTimeTypeConstructors = {
|
|
112
|
+
DatetimeJsDate: {
|
|
113
|
+
...withPrecision(MYSQL_DATETIME_CODEC_ID, "An instant stored as MySQL datetime in UTC and represented as a JavaScript Date. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
114
|
+
inferred: true
|
|
115
|
+
},
|
|
116
|
+
DatetimeTemporal: withPrecision(MYSQL_DATETIME_TEMPORAL_CODEC_ID, "An instant stored as MySQL datetime in UTC and represented as Temporal.Instant. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
117
|
+
DatetimeString: withPrecision(MYSQL_DATETIME_STRING_CODEC_ID, "An instant stored as MySQL datetime in UTC and represented as ISO 8601 text in UTC, such as 2024-01-01T00:00:00.5Z. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
118
|
+
TimestampJsDate: {
|
|
119
|
+
...withPrecision(MYSQL_TIMESTAMP_DATE_CODEC_ID, "An instant from 1970 to 2038 stored as MySQL timestamp and represented as a JavaScript Date. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
120
|
+
inferred: true
|
|
121
|
+
},
|
|
122
|
+
TimestampTemporal: withPrecision(MYSQL_TIMESTAMP_TEMPORAL_CODEC_ID, "An instant from 1970 to 2038 stored as MySQL timestamp and represented as Temporal.Instant. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
123
|
+
TimestampString: withPrecision(MYSQL_TIMESTAMP_STRING_CODEC_ID, "An instant from 1970 to 2038 stored as MySQL timestamp and represented as ISO 8601 text in UTC, such as 2024-01-01T00:00:00.5Z. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
124
|
+
DateString: {
|
|
125
|
+
kind: "typeConstructor",
|
|
126
|
+
inferred: true,
|
|
127
|
+
documentation: "A calendar date stored as MySQL date and represented as ISO 8601 text, such as 2024-02-29.",
|
|
128
|
+
output: { codecId: MYSQL_DATE_STRING_CODEC_ID }
|
|
129
|
+
},
|
|
130
|
+
DateTemporal: {
|
|
131
|
+
kind: "typeConstructor",
|
|
132
|
+
documentation: "A calendar date stored as MySQL date and represented as Temporal.PlainDate.",
|
|
133
|
+
output: { codecId: MYSQL_DATE_TEMPORAL_CODEC_ID }
|
|
134
|
+
},
|
|
135
|
+
TimeString: {
|
|
136
|
+
...withPrecision(MYSQL_TIME_STRING_CODEC_ID, "A time of day stored as MySQL time and represented as ISO 8601 text, such as 09:30:00. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
137
|
+
inferred: true
|
|
138
|
+
},
|
|
139
|
+
TimeTemporal: withPrecision(MYSQL_TIME_TEMPORAL_CODEC_ID, "A time of day stored as MySQL time and represented as Temporal.PlainTime. `precision` is the fraction digits the column holds, 0 to 6."),
|
|
140
|
+
DurationString: {
|
|
141
|
+
kind: "typeConstructor",
|
|
142
|
+
inferred: true,
|
|
143
|
+
documentation: `A length of time stored as MySQL varchar(191), so that it can be indexed, and represented as the ISO 8601 duration it was written as, such as PT1H30M.`,
|
|
144
|
+
output: {
|
|
145
|
+
codecId: MYSQL_DURATION_STRING_CODEC_ID,
|
|
146
|
+
typeParams: { length: 191 }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const MICROSECONDS = { precision: 6 };
|
|
151
|
+
const MILLISECONDS = { precision: 3 };
|
|
152
|
+
/**
|
|
153
|
+
* The convenience date and time types. Each is a type choice: its `as` and `storage` arguments choose the explicit type it becomes, and `precision` is passed on to that type. MySQL holds no fraction of a second in a bare `datetime`, `timestamp` or `time`, so a row that reads a `Date` defaults to milliseconds, which a `Date` holds, and every other row to microseconds, as PostgreSQL's bare types hold. ADR 279, ADR 315.
|
|
154
|
+
*/
|
|
155
|
+
const mysqlConvenienceDateTimeTypes = {
|
|
156
|
+
DateTime: {
|
|
157
|
+
kind: "typeChoice",
|
|
158
|
+
documentation: "A moment in time, read and written in UTC. `as` is what the application reads: jsDate (a JavaScript Date), temporal (Temporal.Instant) or string, such as \"2024-01-01T00:00:00Z\". `storage` is datetime, or timestamp, which holds 1970 to 2038.",
|
|
159
|
+
args: [
|
|
160
|
+
{
|
|
161
|
+
kind: "option",
|
|
162
|
+
name: "as",
|
|
163
|
+
values: [
|
|
164
|
+
"jsDate",
|
|
165
|
+
"temporal",
|
|
166
|
+
"string"
|
|
167
|
+
],
|
|
168
|
+
default: "jsDate",
|
|
169
|
+
optional: true
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
kind: "option",
|
|
173
|
+
name: "storage",
|
|
174
|
+
values: ["datetime", "timestamp"],
|
|
175
|
+
default: "datetime",
|
|
176
|
+
optional: true
|
|
177
|
+
},
|
|
178
|
+
precision
|
|
179
|
+
],
|
|
180
|
+
choices: [
|
|
181
|
+
{
|
|
182
|
+
when: {
|
|
183
|
+
as: "jsDate",
|
|
184
|
+
storage: "datetime"
|
|
185
|
+
},
|
|
186
|
+
type: "DatetimeJsDate",
|
|
187
|
+
defaults: MILLISECONDS
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
when: {
|
|
191
|
+
as: "temporal",
|
|
192
|
+
storage: "datetime"
|
|
193
|
+
},
|
|
194
|
+
type: "DatetimeTemporal",
|
|
195
|
+
defaults: MICROSECONDS
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
when: {
|
|
199
|
+
as: "string",
|
|
200
|
+
storage: "datetime"
|
|
201
|
+
},
|
|
202
|
+
type: "DatetimeString",
|
|
203
|
+
defaults: MICROSECONDS
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
when: {
|
|
207
|
+
as: "jsDate",
|
|
208
|
+
storage: "timestamp"
|
|
209
|
+
},
|
|
210
|
+
type: "TimestampJsDate",
|
|
211
|
+
defaults: MILLISECONDS
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
when: {
|
|
215
|
+
as: "temporal",
|
|
216
|
+
storage: "timestamp"
|
|
217
|
+
},
|
|
218
|
+
type: "TimestampTemporal",
|
|
219
|
+
defaults: MICROSECONDS
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
when: {
|
|
223
|
+
as: "string",
|
|
224
|
+
storage: "timestamp"
|
|
225
|
+
},
|
|
226
|
+
type: "TimestampString",
|
|
227
|
+
defaults: MICROSECONDS
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
Date: {
|
|
232
|
+
kind: "typeChoice",
|
|
233
|
+
documentation: "A calendar date. `as` is what the application reads: string, such as \"2024-02-29\", or temporal (Temporal.PlainDate).",
|
|
234
|
+
args: [{
|
|
235
|
+
kind: "option",
|
|
236
|
+
name: "as",
|
|
237
|
+
values: ["string", "temporal"],
|
|
238
|
+
default: "string",
|
|
239
|
+
optional: true
|
|
240
|
+
}, {
|
|
241
|
+
kind: "option",
|
|
242
|
+
name: "storage",
|
|
243
|
+
values: ["date"],
|
|
244
|
+
default: "date",
|
|
245
|
+
optional: true
|
|
246
|
+
}],
|
|
247
|
+
choices: [{
|
|
248
|
+
when: {
|
|
249
|
+
as: "string",
|
|
250
|
+
storage: "date"
|
|
251
|
+
},
|
|
252
|
+
type: "DateString"
|
|
253
|
+
}, {
|
|
254
|
+
when: {
|
|
255
|
+
as: "temporal",
|
|
256
|
+
storage: "date"
|
|
257
|
+
},
|
|
258
|
+
type: "DateTemporal"
|
|
259
|
+
}]
|
|
260
|
+
},
|
|
261
|
+
Time: {
|
|
262
|
+
kind: "typeChoice",
|
|
263
|
+
documentation: "A time of day, from 00:00:00 to 23:59:59.999999. `as` is what the application reads: string, such as \"09:30:00\", or temporal (Temporal.PlainTime).",
|
|
264
|
+
args: [
|
|
265
|
+
{
|
|
266
|
+
kind: "option",
|
|
267
|
+
name: "as",
|
|
268
|
+
values: ["string", "temporal"],
|
|
269
|
+
default: "string",
|
|
270
|
+
optional: true
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
kind: "option",
|
|
274
|
+
name: "storage",
|
|
275
|
+
values: ["time"],
|
|
276
|
+
default: "time",
|
|
277
|
+
optional: true
|
|
278
|
+
},
|
|
279
|
+
precision
|
|
280
|
+
],
|
|
281
|
+
choices: [{
|
|
282
|
+
when: {
|
|
283
|
+
as: "string",
|
|
284
|
+
storage: "time"
|
|
285
|
+
},
|
|
286
|
+
type: "TimeString",
|
|
287
|
+
defaults: MICROSECONDS
|
|
288
|
+
}, {
|
|
289
|
+
when: {
|
|
290
|
+
as: "temporal",
|
|
291
|
+
storage: "time"
|
|
292
|
+
},
|
|
293
|
+
type: "TimeTemporal",
|
|
294
|
+
defaults: MICROSECONDS
|
|
295
|
+
}]
|
|
296
|
+
},
|
|
297
|
+
Duration: {
|
|
298
|
+
kind: "typeChoice",
|
|
299
|
+
documentation: `A length of time, stored as MySQL varchar(191), since MySQL has no interval type. \`as\` is what the application reads: string, an ISO 8601 duration such as "PT1H30M".`,
|
|
300
|
+
args: [{
|
|
301
|
+
kind: "option",
|
|
302
|
+
name: "as",
|
|
303
|
+
values: ["string"],
|
|
304
|
+
default: "string",
|
|
305
|
+
optional: true
|
|
306
|
+
}, {
|
|
307
|
+
kind: "option",
|
|
308
|
+
name: "storage",
|
|
309
|
+
values: ["varchar"],
|
|
310
|
+
default: "varchar",
|
|
311
|
+
optional: true
|
|
312
|
+
}],
|
|
313
|
+
choices: [{
|
|
314
|
+
when: {
|
|
315
|
+
as: "string",
|
|
316
|
+
storage: "varchar"
|
|
317
|
+
},
|
|
318
|
+
type: "DurationString"
|
|
319
|
+
}]
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* The base scalars, the explicit date and time types and the convenience date and time types as type constructors. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.
|
|
324
|
+
*/
|
|
325
|
+
const mysqlScalarTypeConstructors = {
|
|
326
|
+
...mysqlScalarAuthoringTypes,
|
|
327
|
+
...mysqlDateTimeTypeConstructors,
|
|
328
|
+
...mysqlConvenienceDateTimeTypes
|
|
329
|
+
};
|
|
330
|
+
const mysqlTargetDescriptorMeta = {
|
|
331
|
+
...mysqlTargetDescriptorMetaRuntime,
|
|
332
|
+
defaultNamespaceId: UNBOUND_NAMESPACE_ID,
|
|
333
|
+
supportsNamespaces: false,
|
|
334
|
+
displayName: "MySQL",
|
|
335
|
+
authoring: {
|
|
336
|
+
type: {
|
|
337
|
+
...mysqlScalarTypeConstructors,
|
|
338
|
+
...mysqlAuthoringTypes
|
|
339
|
+
},
|
|
340
|
+
dataTypes: mysqlDataTypeEntries(),
|
|
341
|
+
textDataTypes: mysqlTextDataTypes
|
|
342
|
+
},
|
|
343
|
+
generatorFunctions: mysqlGeneratorFunctions,
|
|
344
|
+
controlMutationDefaults: {
|
|
345
|
+
defaultFunctionRegistry: /* @__PURE__ */ new Map(),
|
|
346
|
+
generatorDescriptors: mysqlGeneratorDescriptors
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
//#endregion
|
|
350
|
+
export { mysqlTargetDescriptorMeta as n, mysqlScalarTypeConstructors as t };
|
|
351
|
+
|
|
352
|
+
//# sourceMappingURL=descriptor-meta-CsMPRsxp-DhK87vlc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-CsMPRsxp-DhK87vlc.mjs","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/descriptor-meta-CsMPRsxp.mjs"],"sourcesContent":["import { a as MYSQL_DATE_STRING_CODEC_ID, d as MYSQL_TIMESTAMP_DATE_CODEC_ID, f as MYSQL_TIMESTAMP_STRING_CODEC_ID, h as MYSQL_TIME_TEMPORAL_CODEC_ID, i as MYSQL_DATETIME_TEMPORAL_CODEC_ID, l as MYSQL_INT_CODEC_ID, m as MYSQL_TIME_STRING_CODEC_ID, n as MYSQL_DATETIME_CODEC_ID, o as MYSQL_DATE_TEMPORAL_CODEC_ID, p as MYSQL_TIMESTAMP_TEMPORAL_CODEC_ID, r as MYSQL_DATETIME_STRING_CODEC_ID, s as MYSQL_DURATION_STRING_CODEC_ID, t as MYSQL_BIGINT_CODEC_ID, u as MYSQL_TEXT_CODEC_ID } from \"./codec-ids-CrR9Xi7r.mjs\";\nimport { _ as mysqlInt, y as mysqlTextDataTypes } from \"./data-types-DOaaPS93.mjs\";\nimport { t as mysqlDataTypeEntries } from \"./data-type-entries-C7VH2IHc.mjs\";\nimport { n as mysqlTargetDescriptorMetaRuntime, t as mysqlNowGenerators } from \"./date-time-now-generators-DY-8Bodc.mjs\";\nimport { SQL_VARCHAR_CODEC_ID } from \"@internal/sql-relational-core/ast\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions, sqlTargetTypeConstructors } from \"@internal/family-sql/pack\";\nimport { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from \"@internal/framework-components/authoring\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\nimport { DATE_STRING_NOW_GENERATOR_ID, INSTANT_NOW_GENERATOR_ID, INSTANT_STRING_NOW_GENERATOR_ID, PLAIN_DATE_NOW_GENERATOR_ID, PLAIN_TIME_NOW_GENERATOR_ID, TIME_STRING_NOW_GENERATOR_ID } from \"@internal/type-implementations/now\";\n//#region src/core/authoring.ts\n/** The type constructors whose arguments are sizes, which take values of `mysql/int`, and the created-at and updated-at aliases on the type a bare `DateTime` becomes: a `datetime(3)` column read as a JavaScript `Date`. */\nconst mysqlAuthoringTypes = {\n\t.../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: \"mysql/int\" }),\n\ttemporal: /* @__PURE__ */ temporalTypeAliases({\n\t\tcodecId: MYSQL_DATETIME_CODEC_ID,\n\t\ttypeParams: { precision: 3 }\n\t}, \"a JavaScript Date\")\n};\n//#endregion\n//#region src/core/generator-functions.ts\n/** The \"now\" generator for each codec that has one. The `now` generator function binds it. */\nconst mysqlNowGeneratorIds = {\n\t[MYSQL_DATETIME_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,\n\t[MYSQL_DATETIME_TEMPORAL_CODEC_ID]: INSTANT_NOW_GENERATOR_ID,\n\t[MYSQL_DATETIME_STRING_CODEC_ID]: INSTANT_STRING_NOW_GENERATOR_ID,\n\t[MYSQL_TIMESTAMP_DATE_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,\n\t[MYSQL_TIMESTAMP_TEMPORAL_CODEC_ID]: INSTANT_NOW_GENERATOR_ID,\n\t[MYSQL_TIMESTAMP_STRING_CODEC_ID]: INSTANT_STRING_NOW_GENERATOR_ID,\n\t[MYSQL_DATE_STRING_CODEC_ID]: DATE_STRING_NOW_GENERATOR_ID,\n\t[MYSQL_DATE_TEMPORAL_CODEC_ID]: PLAIN_DATE_NOW_GENERATOR_ID,\n\t[MYSQL_TIME_STRING_CODEC_ID]: TIME_STRING_NOW_GENERATOR_ID,\n\t[MYSQL_TIME_TEMPORAL_CODEC_ID]: PLAIN_TIME_NOW_GENERATOR_ID\n};\n/** The generators that round down to the column's fraction digits, 0 for a bare type. */\nconst takesPrecision = /* @__PURE__ */ new Set([\n\tINSTANT_NOW_GENERATOR_ID,\n\tINSTANT_STRING_NOW_GENERATOR_ID,\n\tPLAIN_TIME_NOW_GENERATOR_ID,\n\tTIME_STRING_NOW_GENERATOR_ID\n]);\n/** The fraction digits a `Date` holds: `timestampNow` takes a precision only below them, so a column of 3 or more, such as a bare `DateTime`, keeps a contract with no generator params. */\nconst DATE_FRACTION_DIGITS = 3;\nfunction nowParams(generatorId, typeParams) {\n\tconst written = typeParams?.[\"precision\"];\n\tconst precision = typeof written === \"number\" ? written : 0;\n\tif (takesPrecision.has(generatorId)) return { precision };\n\tif (generatorId === TIMESTAMP_NOW_GENERATOR_ID && precision < DATE_FRACTION_DIGITS) return { precision };\n}\nconst mysqlGeneratorFunctions = [\n\t...sqlIntegerArgumentGeneratorFunctions({ integer: mysqlInt.id }),\n\t{\n\t\tname: \"now\",\n\t\tbindings: Object.entries(mysqlNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({\n\t\t\tcodecIds: [codecId],\n\t\t\tgeneratorId,\n\t\t\tparamsFromField: (column) => nowParams(generatorId, column.typeParams)\n\t\t}))\n\t},\n\t...idGeneratorFunctionBindings({ text: [MYSQL_TEXT_CODEC_ID] })\n];\n/** The `now` generators MySQL binds. The SQL family registers the identifier generators. */\nconst mysqlGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...mysqlNowGenerators.map(({ id }) => ({ id }))];\n/**\n* The base PSL scalars other than the date and time types, as zero-arg type constructors. Each names a codec; the column's database type is its data type's. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.\n*/\nconst mysqlScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: `Text of at most 191 characters, stored as MySQL varchar(191) so that it can be indexed.`,\n\t\toutput: {\n\t\t\tcodecId: SQL_VARCHAR_CODEC_ID,\n\t\t\ttypeParams: { length: 191 }\n\t\t}\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A signed 32-bit integer stored as MySQL int and represented as a JavaScript number.\",\n\t\toutput: { codecId: MYSQL_INT_CODEC_ID }\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A signed 64-bit integer stored as MySQL bigint and represented as a JavaScript bigint.\",\n\t\toutput: { codecId: MYSQL_BIGINT_CODEC_ID }\n\t}\n};\nconst precision = {\n\tkind: \"value\",\n\tdataType: \"mysql/int\",\n\tname: \"precision\",\n\toptional: true\n};\n/** The explicit type `codecId`, whose `precision` argument is the number of fraction digits its column holds, 0 to 6; MySQL holds 0 when none is written. */\nfunction withPrecision(codecId, documentation) {\n\treturn {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation,\n\t\targs: [precision],\n\t\toutput: {\n\t\t\tcodecId,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t};\n}\n/**\n* The explicit date and time types. Each is named after its MySQL column type, with a suffix for the value the application reads; `DurationString` is stored as `varchar`, since MySQL has no interval type. ADR 315.\n*/\nconst mysqlDateTimeTypeConstructors = {\n\tDatetimeJsDate: {\n\t\t...withPrecision(MYSQL_DATETIME_CODEC_ID, \"An instant stored as MySQL datetime in UTC and represented as a JavaScript Date. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\t\tinferred: true\n\t},\n\tDatetimeTemporal: withPrecision(MYSQL_DATETIME_TEMPORAL_CODEC_ID, \"An instant stored as MySQL datetime in UTC and represented as Temporal.Instant. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\tDatetimeString: withPrecision(MYSQL_DATETIME_STRING_CODEC_ID, \"An instant stored as MySQL datetime in UTC and represented as ISO 8601 text in UTC, such as 2024-01-01T00:00:00.5Z. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\tTimestampJsDate: {\n\t\t...withPrecision(MYSQL_TIMESTAMP_DATE_CODEC_ID, \"An instant from 1970 to 2038 stored as MySQL timestamp and represented as a JavaScript Date. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\t\tinferred: true\n\t},\n\tTimestampTemporal: withPrecision(MYSQL_TIMESTAMP_TEMPORAL_CODEC_ID, \"An instant from 1970 to 2038 stored as MySQL timestamp and represented as Temporal.Instant. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\tTimestampString: withPrecision(MYSQL_TIMESTAMP_STRING_CODEC_ID, \"An instant from 1970 to 2038 stored as MySQL timestamp and represented as ISO 8601 text in UTC, such as 2024-01-01T00:00:00.5Z. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\tDateString: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A calendar date stored as MySQL date and represented as ISO 8601 text, such as 2024-02-29.\",\n\t\toutput: { codecId: MYSQL_DATE_STRING_CODEC_ID }\n\t},\n\tDateTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date stored as MySQL date and represented as Temporal.PlainDate.\",\n\t\toutput: { codecId: MYSQL_DATE_TEMPORAL_CODEC_ID }\n\t},\n\tTimeString: {\n\t\t...withPrecision(MYSQL_TIME_STRING_CODEC_ID, \"A time of day stored as MySQL time and represented as ISO 8601 text, such as 09:30:00. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\t\tinferred: true\n\t},\n\tTimeTemporal: withPrecision(MYSQL_TIME_TEMPORAL_CODEC_ID, \"A time of day stored as MySQL time and represented as Temporal.PlainTime. `precision` is the fraction digits the column holds, 0 to 6.\"),\n\tDurationString: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: `A length of time stored as MySQL varchar(191), so that it can be indexed, and represented as the ISO 8601 duration it was written as, such as PT1H30M.`,\n\t\toutput: {\n\t\t\tcodecId: MYSQL_DURATION_STRING_CODEC_ID,\n\t\t\ttypeParams: { length: 191 }\n\t\t}\n\t}\n};\nconst MICROSECONDS = { precision: 6 };\nconst MILLISECONDS = { precision: 3 };\n/**\n* The convenience date and time types. Each is a type choice: its `as` and `storage` arguments choose the explicit type it becomes, and `precision` is passed on to that type. MySQL holds no fraction of a second in a bare `datetime`, `timestamp` or `time`, so a row that reads a `Date` defaults to milliseconds, which a `Date` holds, and every other row to microseconds, as PostgreSQL's bare types hold. ADR 279, ADR 315.\n*/\nconst mysqlConvenienceDateTimeTypes = {\n\tDateTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A moment in time, read and written in UTC. `as` is what the application reads: jsDate (a JavaScript Date), temporal (Temporal.Instant) or string, such as \\\"2024-01-01T00:00:00Z\\\". `storage` is datetime, or timestamp, which holds 1970 to 2038.\",\n\t\targs: [\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"as\",\n\t\t\t\tvalues: [\n\t\t\t\t\t\"jsDate\",\n\t\t\t\t\t\"temporal\",\n\t\t\t\t\t\"string\"\n\t\t\t\t],\n\t\t\t\tdefault: \"jsDate\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"storage\",\n\t\t\t\tvalues: [\"datetime\", \"timestamp\"],\n\t\t\t\tdefault: \"datetime\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\tprecision\n\t\t],\n\t\tchoices: [\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"jsDate\",\n\t\t\t\t\tstorage: \"datetime\"\n\t\t\t\t},\n\t\t\t\ttype: \"DatetimeJsDate\",\n\t\t\t\tdefaults: MILLISECONDS\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"datetime\"\n\t\t\t\t},\n\t\t\t\ttype: \"DatetimeTemporal\",\n\t\t\t\tdefaults: MICROSECONDS\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"datetime\"\n\t\t\t\t},\n\t\t\t\ttype: \"DatetimeString\",\n\t\t\t\tdefaults: MICROSECONDS\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"jsDate\",\n\t\t\t\t\tstorage: \"timestamp\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestampJsDate\",\n\t\t\t\tdefaults: MILLISECONDS\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"timestamp\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestampTemporal\",\n\t\t\t\tdefaults: MICROSECONDS\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"timestamp\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestampString\",\n\t\t\t\tdefaults: MICROSECONDS\n\t\t\t}\n\t\t]\n\t},\n\tDate: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A calendar date. `as` is what the application reads: string, such as \\\"2024-02-29\\\", or temporal (Temporal.PlainDate).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"option\",\n\t\t\tname: \"storage\",\n\t\t\tvalues: [\"date\"],\n\t\t\tdefault: \"date\",\n\t\t\toptional: true\n\t\t}],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateTemporal\"\n\t\t}]\n\t},\n\tTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A time of day, from 00:00:00 to 23:59:59.999999. `as` is what the application reads: string, such as \\\"09:30:00\\\", or temporal (Temporal.PlainTime).\",\n\t\targs: [\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"as\",\n\t\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\t\tdefault: \"string\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"storage\",\n\t\t\t\tvalues: [\"time\"],\n\t\t\t\tdefault: \"time\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\tprecision\n\t\t],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"time\"\n\t\t\t},\n\t\t\ttype: \"TimeString\",\n\t\t\tdefaults: MICROSECONDS\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"time\"\n\t\t\t},\n\t\t\ttype: \"TimeTemporal\",\n\t\t\tdefaults: MICROSECONDS\n\t\t}]\n\t},\n\tDuration: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: `A length of time, stored as MySQL varchar(191), since MySQL has no interval type. \\`as\\` is what the application reads: string, an ISO 8601 duration such as \"PT1H30M\".`,\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"option\",\n\t\t\tname: \"storage\",\n\t\t\tvalues: [\"varchar\"],\n\t\t\tdefault: \"varchar\",\n\t\t\toptional: true\n\t\t}],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"varchar\"\n\t\t\t},\n\t\t\ttype: \"DurationString\"\n\t\t}]\n\t}\n};\n/**\n* The base scalars, the explicit date and time types and the convenience date and time types as type constructors. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.\n*/\nconst mysqlScalarTypeConstructors = {\n\t...mysqlScalarAuthoringTypes,\n\t...mysqlDateTimeTypeConstructors,\n\t...mysqlConvenienceDateTimeTypes\n};\nconst mysqlTargetDescriptorMeta = {\n\t...mysqlTargetDescriptorMetaRuntime,\n\tdefaultNamespaceId: UNBOUND_NAMESPACE_ID,\n\tsupportsNamespaces: false,\n\tdisplayName: \"MySQL\",\n\tauthoring: {\n\t\ttype: {\n\t\t\t...mysqlScalarTypeConstructors,\n\t\t\t...mysqlAuthoringTypes\n\t\t},\n\t\tdataTypes: mysqlDataTypeEntries(),\n\t\ttextDataTypes: mysqlTextDataTypes\n\t},\n\tgeneratorFunctions: mysqlGeneratorFunctions,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\tgeneratorDescriptors: mysqlGeneratorDescriptors\n\t}\n};\n//#endregion\nexport { mysqlScalarTypeConstructors as n, mysqlTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CsMPRsxp.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,sBAAsB;CAC3B,GAAmB,0CAA0B,EAAE,UAAU,YAAY,CAAC;CACtE,UAA0B,oCAAoB;EAC7C,SAAS;EACT,YAAY,EAAE,WAAW,EAAE;CAC5B,GAAG,mBAAmB;AACvB;;AAIA,MAAM,uBAAuB;EAC3B,0BAA0B;EAC1B,mCAAmC;EACnC,iCAAiC;EACjC,gCAAgC;EAChC,oCAAoC;EACpC,kCAAkC;EAClC,6BAA6B;EAC7B,+BAA+B;EAC/B,6BAA6B;EAC7B,+BAA+B;AACjC;;AAEA,MAAM,iCAAiC,IAAI,IAAI;CAC9C;CACA;CACA;CACA;AACD,CAAC;;AAED,MAAM,uBAAuB;AAC7B,SAAS,UAAU,aAAa,YAAY;CAC3C,MAAM,UAAU,aAAa;CAC7B,MAAM,YAAY,OAAO,YAAY,WAAW,UAAU;CAC1D,IAAI,eAAe,IAAI,WAAW,GAAG,OAAO,EAAE,UAAU;CACxD,IAAI,gBAAgB,8BAA8B,YAAY,sBAAsB,OAAO,EAAE,UAAU;AACxG;AACA,MAAM,0BA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;EACjD,sBAAsB;CACvB;AACD"}
|
package/dist/driver.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as MysqlControlDriver } from "./control-
|
|
1
|
+
import { t as MysqlControlDriver } from "./control-5eVF1TXc.mjs";
|
|
2
2
|
export { MysqlControlDriver };
|
package/dist/driver__control.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as mysqlDriverDescriptor, t as MysqlControlDriver } from "./control-
|
|
1
|
+
import { n as mysqlDriverDescriptor, t as MysqlControlDriver } from "./control-5eVF1TXc.mjs";
|
|
2
2
|
export { MysqlControlDriver, mysqlDriverDescriptor as default };
|
package/dist/driver__runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as mysqlConnectionOptions, d as mysqlPoolOptions, f as normalizeMysqlError, i as connectingCannotSucceed, l as mysqlDriverDescriptorMeta, m as statementFor, n as acquireClientQueryLock, s as isFatal, t as SessionSettingsGuard, u as mysqlPoolIdleTimeoutMillis } from "./statement-DC62oiSx-
|
|
1
|
+
import { c as mysqlConnectionOptions, d as mysqlPoolOptions, f as normalizeMysqlError, i as connectingCannotSucceed, l as mysqlDriverDescriptorMeta, m as statementFor, n as acquireClientQueryLock, s as isFatal, t as SessionSettingsGuard, u as mysqlPoolIdleTimeoutMillis } from "./statement-DC62oiSx-Buzptbpk.mjs";
|
|
2
2
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
3
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
4
4
|
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
|
+
//#region ../../../3-targets/mysql/1-target/dist/errors-Cng94tYg.mjs
|
|
4
|
+
function mysqlError(code, message, options) {
|
|
5
|
+
return structuredError(code, message, options);
|
|
6
|
+
}
|
|
7
|
+
/** The refusal of a query a later slice of the MySQL target can render: `what` names the feature, as in `Lowering queries`. */
|
|
8
|
+
function mysqlQueryNotYetSupported(what) {
|
|
9
|
+
return mysqlError("RUNTIME.AST_UNSUPPORTED", `${what} is not yet supported on MySQL.`, {
|
|
10
|
+
why: "The MySQL target renders reads; writes and some query forms are not built yet.",
|
|
11
|
+
fix: "Use a Postgres or SQLite target for this query until the MySQL target supports it.",
|
|
12
|
+
meta: {
|
|
13
|
+
target: "mysql",
|
|
14
|
+
feature: what
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const 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.";
|
|
19
|
+
function errorTemporalUnavailable(codecId, operation) {
|
|
20
|
+
return mysqlError("RUNTIME.TEMPORAL_UNAVAILABLE", `Codec '${codecId}' cannot ${operation} a value because this runtime has no global Temporal implementation.`, {
|
|
21
|
+
why: "Temporal-backed codecs read and write their values through the global Temporal API, which this runtime does not provide.",
|
|
22
|
+
fix: TEMPORAL_UNAVAILABLE_FIX,
|
|
23
|
+
meta: {
|
|
24
|
+
codecId,
|
|
25
|
+
operation
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function errorTemporalUnavailableForDefault(generatorId) {
|
|
30
|
+
return mysqlError("RUNTIME.TEMPORAL_UNAVAILABLE", `Mutation default generator '${generatorId}' cannot produce a value because this runtime has no global Temporal implementation.`, {
|
|
31
|
+
why: "The generator answers a Temporal-backed column, so the value it produces is a Temporal value, which this runtime cannot construct.",
|
|
32
|
+
fix: TEMPORAL_UNAVAILABLE_FIX,
|
|
33
|
+
meta: { generatorId }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function errorTemporalWrongType(codecId, temporalTag, stringType, received) {
|
|
37
|
+
return mysqlError("RUNTIME.ENCODE_FAILED", `Codec '${codecId}' encodes a ${temporalTag}, but received ${received}.`, {
|
|
38
|
+
why: "The codec writes the Temporal value's own ISO 8601 text. A value of another type has no text the column holds.",
|
|
39
|
+
fix: `Pass a ${temporalTag}, or author the column with its ${stringType} type to write ISO 8601 text.`,
|
|
40
|
+
meta: {
|
|
41
|
+
codecId,
|
|
42
|
+
temporalTag,
|
|
43
|
+
stringType,
|
|
44
|
+
received
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function errorTemporalNonIsoCalendar(codecId, calendarId) {
|
|
49
|
+
return mysqlError("RUNTIME.ENCODE_FAILED", `Codec '${codecId}' accepts only the iso8601 calendar, but the value carries '${calendarId}'.`, {
|
|
50
|
+
why: "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.",
|
|
51
|
+
fix: "Convert the value with .withCalendar(\"iso8601\") before writing if the ISO projection is what you mean to store.",
|
|
52
|
+
meta: {
|
|
53
|
+
codecId,
|
|
54
|
+
calendarId
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** 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. */
|
|
59
|
+
function errorDateTimeUnreadable(options) {
|
|
60
|
+
const { codecId, value, detail } = options;
|
|
61
|
+
return mysqlError("RUNTIME.DECODE_FAILED", `Codec '${codecId}' cannot read the value MySQL returned: ${JSON.stringify(value)}. ${detail}`, {
|
|
62
|
+
why: "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.",
|
|
63
|
+
fix: "Rewrite the row with a value the column type holds, or read the column with a type that holds its text, such as String.",
|
|
64
|
+
meta: {
|
|
65
|
+
codecId,
|
|
66
|
+
value: value.slice(0, 100)
|
|
67
|
+
},
|
|
68
|
+
...ifDefined("cause", options.cause)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** 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. */
|
|
72
|
+
function errorDateTimeUnwritable(options) {
|
|
73
|
+
const { codecId, received, detail } = options;
|
|
74
|
+
return mysqlError("RUNTIME.ENCODE_FAILED", `Codec '${codecId}' cannot write ${received}. ${detail}`, {
|
|
75
|
+
why: "The codec refuses a value its column does not hold before it reaches MySQL.",
|
|
76
|
+
fix: "Write a value the column holds, as the message shows.",
|
|
77
|
+
meta: {
|
|
78
|
+
codecId,
|
|
79
|
+
received: received.slice(0, 100)
|
|
80
|
+
},
|
|
81
|
+
...ifDefined("cause", options.cause)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
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
|
+
|
|
87
|
+
//# sourceMappingURL=errors-Cng94tYg-D02Eud2d.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-Cng94tYg-D02Eud2d.mjs","names":[],"sources":["../../../../3-targets/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,O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AAQ,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,10 +1,10 @@
|
|
|
1
1
|
import { StructuredError, StructuredErrorOptions } from "@prisma/orm-framework/utils/structured-error";
|
|
2
2
|
//#region ../../../3-targets/mysql/1-target/dist/errors.d.mts
|
|
3
3
|
//#region src/core/errors.d.ts
|
|
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';
|
|
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;
|
|
6
6
|
/** The refusal of a query a later slice of the MySQL target can render: `what` names the feature, as in `Lowering queries`. */
|
|
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-DfrC_yfG.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-
|
|
1
|
+
{"version":3,"file":"errors-DfrC_yfG.d.mts","names":[],"sources":["../../../../3-targets/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 {
|
|
2
|
-
//#region ../../../3-targets/mysql/1-target/dist/marker-lock-
|
|
1
|
+
import { s as mysqlError } from "./errors-Cng94tYg-D02Eud2d.mjs";
|
|
2
|
+
//#region ../../../3-targets/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-
|
|
51
|
+
//# sourceMappingURL=marker-lock-Bwew7cAs-CZ20Y_tA.mjs.map
|
package/dist/{marker-lock-CmGvN4hw-Com29AtQ.mjs.map → marker-lock-Bwew7cAs-CZ20Y_tA.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker-lock-
|
|
1
|
+
{"version":3,"file":"marker-lock-Bwew7cAs-CZ20Y_tA.mjs","names":[],"sources":["../../../../3-targets/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
|
-
import { n as quoteIdentifier } from "./sql-utils-
|
|
2
|
-
import { o as mysqlCodecRegistry, r as decodeMysqlDatetime } from "./codecs-
|
|
1
|
+
import { n as quoteIdentifier } from "./sql-utils-Cmv_TVa8-BetrIUcj.mjs";
|
|
2
|
+
import { o as mysqlCodecRegistry, r as decodeMysqlDatetime } from "./codecs-BfiB79-5.mjs";
|
|
3
3
|
import { r as MARKER_TABLE_NAME } from "./control-tables-CcQ77JE7-CxTQYoQJ.mjs";
|
|
4
4
|
import { n as mysqlAdapterContractContributions } from "./contract-contributions-ChiX6W0F-CAng98bZ.mjs";
|
|
5
5
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
@@ -75,4 +75,4 @@ async function readMarkerResult(driver, space) {
|
|
|
75
75
|
//#endregion
|
|
76
76
|
export { readMarkerRows as a, readMarkerResult as i, mysqlAdapterDescriptorMeta as n, tableExists as o, parseJsonColumn as r, decodeMysqlMarkerRow as t };
|
|
77
77
|
|
|
78
|
-
//# sourceMappingURL=marker-read-Cf80LSbG-
|
|
78
|
+
//# sourceMappingURL=marker-read-Cf80LSbG-CUp3v1e5.mjs.map
|
package/dist/{marker-read-Cf80LSbG-BZaJ8Ll6.mjs.map → marker-read-Cf80LSbG-CUp3v1e5.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker-read-Cf80LSbG-
|
|
1
|
+
{"version":3,"file":"marker-read-Cf80LSbG-CUp3v1e5.mjs","names":[],"sources":["../../../../3-targets/mysql/2-adapter/dist/marker-read-Cf80LSbG.mjs"],"sourcesContent":["import { t as mysqlAdapterContractContributions } from \"./contract-contributions-ChiX6W0F.mjs\";\nimport { decodeMysqlDatetime, mysqlCodecRegistry } from \"@internal/target-mysql/codecs\";\nimport { withMarkerReadErrorHandling } from \"@internal/errors/execution\";\nimport { MARKER_TABLE_NAME } from \"@internal/target-mysql/control-tables\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { parseContractMarkerRow } from \"@internal/family-sql/verify\";\nimport { quoteIdentifier } from \"@internal/target-mysql/sql-utils\";\n//#region src/core/descriptor-meta.ts\nconst mysqlAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"mysql\",\n\tid: \"mysql\",\n\tversion: \"0.0.1\",\n\tcapabilities: mysqlAdapterContractContributions.capabilities,\n\ttypes: { codecTypes: {\n\t\tcodecDescriptors: Array.from(mysqlCodecRegistry.values()),\n\t\timport: {\n\t\t\tpackage: \"@internal/adapter-mysql/codec-types\",\n\t\t\tnamed: \"CodecTypes\",\n\t\t\talias: \"MysqlTypes\"\n\t\t}\n\t} }\n};\n//#endregion\n//#region src/core/marker-read.ts\nconst MARKER_COLUMNS = \"space, core_hash, profile_hash, contract_json, canonical_version, updated_at, app_tag, meta, invariants\";\n/** Whether the connection's database has the table `name`. */\nasync function tableExists(driver, name) {\n\tconst { rows } = await driver.query(\"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ?\", [name]);\n\treturn rows.length > 0;\n}\nfunction parseJsonColumn(column, text) {\n\tif (typeof text !== \"string\") return text;\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tthrow structuredError(\"CONTRACT.MARKER_ROW_CORRUPT\", `Invalid contract marker row: ${column} is not valid JSON: ${detail}`, {\n\t\t\tmeta: { detail },\n\t\t\tcause: error\n\t\t});\n\t}\n}\n/** A marker row as MySQL's text arrives, in the shape the family's marker parser reads. */\nfunction decodeMysqlMarkerRow(row) {\n\tconst canonicalVersion = row[\"canonical_version\"];\n\tconst updatedAt = row[\"updated_at\"];\n\treturn parseContractMarkerRow({\n\t\t...row,\n\t\tcanonical_version: typeof canonicalVersion === \"string\" ? Number(canonicalVersion) : canonicalVersion,\n\t\tupdated_at: typeof updatedAt === \"string\" ? decodeMysqlDatetime(updatedAt) : updatedAt,\n\t\tinvariants: parseJsonColumn(\"invariants\", row[\"invariants\"])\n\t});\n}\nasync function readMarkerRows(driver, space) {\n\tif (!await tableExists(driver, MARKER_TABLE_NAME)) return void 0;\n\tconst select = `SELECT ${MARKER_COLUMNS} FROM ${quoteIdentifier(MARKER_TABLE_NAME)}`;\n\tconst { rows } = space === void 0 ? await driver.query(select) : await driver.query(`${select} WHERE space = ?`, [space]);\n\treturn rows;\n}\n/** The marker of `space`, or whether the marker table or the space's row is missing. */\nasync function readMarkerResult(driver, space) {\n\treturn withMarkerReadErrorHandling(async () => {\n\t\tconst rows = await readMarkerRows(driver, space);\n\t\tif (rows === void 0) return { kind: \"no-table\" };\n\t\tconst [row] = rows;\n\t\treturn row === void 0 ? { kind: \"absent\" } : {\n\t\t\tkind: \"present\",\n\t\t\trecord: decodeMysqlMarkerRow(row)\n\t\t};\n\t}, {\n\t\tspace,\n\t\tmarkerLocation: MARKER_TABLE_NAME\n\t});\n}\n//#endregion\nexport { tableExists as a, readMarkerRows as i, parseJsonColumn as n, mysqlAdapterDescriptorMeta as o, readMarkerResult as r, decodeMysqlMarkerRow as t };\n\n//# sourceMappingURL=marker-read-Cf80LSbG.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,6BAA6B;CAClC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,kCAAkC;CAChD,OAAO,EAAE,YAAY;EACpB,kBAA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