@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.
Files changed (146) hide show
  1. package/README.md +2 -0
  2. package/dist/adapter.d.mts +4 -4
  3. package/dist/adapter.mjs +1 -1
  4. package/dist/adapter__codec-types.d.mts +2 -2
  5. package/dist/adapter__control.d.mts +1 -1
  6. package/dist/adapter__control.mjs +1 -1
  7. package/dist/adapter__runtime.d.mts +1 -1
  8. package/dist/adapter__runtime.mjs +17 -6
  9. package/dist/adapter__runtime.mjs.map +1 -1
  10. package/dist/{codec-descriptor-Du6DSz-3-ytBCu_mq.mjs → codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs} +5 -3
  11. package/dist/codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs.map +1 -0
  12. package/dist/codec-ids-CrR9Xi7r-CarpqbNM.mjs +20 -0
  13. package/dist/codec-ids-CrR9Xi7r-CarpqbNM.mjs.map +1 -0
  14. package/dist/codec-ids-Dgh5IpML-76oBMuwK.d.mts +20 -0
  15. package/dist/codec-ids-Dgh5IpML-76oBMuwK.d.mts.map +1 -0
  16. package/dist/codec-types-BH5moCD9.d.mts +1 -0
  17. package/dist/codec-types-Bai_CFkk-Blx2GxCH.d.mts +31 -0
  18. package/dist/codec-types-Bai_CFkk-Blx2GxCH.d.mts.map +1 -0
  19. package/dist/codec-types-zzVcrnbk.d.mts +1 -0
  20. package/dist/codecs-BMidk26M-DsKq6wt5.d.mts +282 -0
  21. package/dist/codecs-BMidk26M-DsKq6wt5.d.mts.map +1 -0
  22. package/dist/codecs-BfiB79-5.mjs +750 -0
  23. package/dist/codecs-BfiB79-5.mjs.map +1 -0
  24. package/dist/codecs-C_twedMx.d.mts +36 -0
  25. package/dist/codecs-C_twedMx.d.mts.map +1 -0
  26. package/dist/{control-CgeXsxCR.mjs → control-5eVF1TXc.mjs} +2 -2
  27. package/dist/{control-CgeXsxCR.mjs.map → control-5eVF1TXc.mjs.map} +1 -1
  28. package/dist/{control-H2sjKXXS.mjs → control-BBhWaGnH.mjs} +24 -13
  29. package/dist/control-BBhWaGnH.mjs.map +1 -0
  30. package/dist/control-BvSM7mGR.d.mts +396 -0
  31. package/dist/control-BvSM7mGR.d.mts.map +1 -0
  32. package/dist/{control-Ez_PtlFI.d.mts → control-MoPFgSaQ.d.mts} +2 -2
  33. package/dist/{control-Ez_PtlFI.d.mts.map → control-MoPFgSaQ.d.mts.map} +1 -1
  34. package/dist/data-type-entries-C7VH2IHc-D1d5I8zF.mjs +59 -0
  35. package/dist/data-type-entries-C7VH2IHc-D1d5I8zF.mjs.map +1 -0
  36. package/dist/{data-types-SXrh0Lou.d.mts → data-types-C-rfxpgB.d.mts} +2 -2
  37. package/dist/data-types-C-rfxpgB.d.mts.map +1 -0
  38. package/dist/data-types-D2HAT-Qf-CRI506c0.d.mts +88 -0
  39. package/dist/data-types-D2HAT-Qf-CRI506c0.d.mts.map +1 -0
  40. package/dist/data-types-DOaaPS93-DBkMJyh1.mjs +289 -0
  41. package/dist/data-types-DOaaPS93-DBkMJyh1.mjs.map +1 -0
  42. package/dist/date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs +72 -0
  43. package/dist/date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs.map +1 -0
  44. package/dist/{default-normalizer-BDUgHXUn-Xk7HQJuI.mjs → default-normalizer-C8pc7SbL-CKgOEnGl.mjs} +22 -12
  45. package/dist/default-normalizer-C8pc7SbL-CKgOEnGl.mjs.map +1 -0
  46. package/dist/{default-normalizer-BBhGpw7r.d.mts → default-normalizer-CGIwQiKB.d.mts} +4 -4
  47. package/dist/{default-normalizer-BBhGpw7r.d.mts.map → default-normalizer-CGIwQiKB.d.mts.map} +1 -1
  48. package/dist/descriptor-meta-CsMPRsxp-DhK87vlc.mjs +352 -0
  49. package/dist/descriptor-meta-CsMPRsxp-DhK87vlc.mjs.map +1 -0
  50. package/dist/driver.mjs +1 -1
  51. package/dist/driver__control.mjs +1 -1
  52. package/dist/driver__runtime.mjs +1 -1
  53. package/dist/errors-Cng94tYg-D02Eud2d.mjs +87 -0
  54. package/dist/errors-Cng94tYg-D02Eud2d.mjs.map +1 -0
  55. package/dist/{errors-BYhjQT7y.d.mts → errors-DfrC_yfG.d.mts} +2 -2
  56. package/dist/{errors-BYhjQT7y.d.mts.map → errors-DfrC_yfG.d.mts.map} +1 -1
  57. package/dist/{marker-lock-CmGvN4hw-Com29AtQ.mjs → marker-lock-Bwew7cAs-CZ20Y_tA.mjs} +3 -3
  58. package/dist/{marker-lock-CmGvN4hw-Com29AtQ.mjs.map → marker-lock-Bwew7cAs-CZ20Y_tA.mjs.map} +1 -1
  59. package/dist/{marker-read-Cf80LSbG-BZaJ8Ll6.mjs → marker-read-Cf80LSbG-CUp3v1e5.mjs} +3 -3
  60. package/dist/{marker-read-Cf80LSbG-BZaJ8Ll6.mjs.map → marker-read-Cf80LSbG-CUp3v1e5.mjs.map} +1 -1
  61. package/dist/mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs +35 -0
  62. package/dist/mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs.map +1 -0
  63. package/dist/{mysql-contract-serializer-DLv0uW_f-Cg4A43Ry.mjs → mysql-database-CHl9-oSL-CWZLDXt6.mjs} +39 -40
  64. package/dist/mysql-database-CHl9-oSL-CWZLDXt6.mjs.map +1 -0
  65. package/dist/now-expression-DVD18CUc-00buJUto.mjs +38 -0
  66. package/dist/now-expression-DVD18CUc-00buJUto.mjs.map +1 -0
  67. package/dist/{pack-DXsOvRJn.d.mts → pack-BXvLVBWP.d.mts} +394 -14
  68. package/dist/{pack-DXsOvRJn.d.mts.map → pack-BXvLVBWP.d.mts.map} +1 -1
  69. package/dist/require-temporal-DeDQhbTn-Bxc65WbA.mjs +16 -0
  70. package/dist/require-temporal-DeDQhbTn-Bxc65WbA.mjs.map +1 -0
  71. package/dist/{runner-BaBQoXiU-C7ln-4b2.mjs → runner-C39AEe6--BVG3xPYw.mjs} +7 -7
  72. package/dist/{runner-BaBQoXiU-C7ln-4b2.mjs.map → runner-C39AEe6--BVG3xPYw.mjs.map} +1 -1
  73. package/dist/{runtime-CeuRr9nE.d.mts → runtime-ClRDfPiY.d.mts} +2 -2
  74. package/dist/{runtime-CeuRr9nE.d.mts.map → runtime-ClRDfPiY.d.mts.map} +1 -1
  75. package/dist/runtime-CrB5DXx4.d.mts +54 -0
  76. package/dist/runtime-CrB5DXx4.d.mts.map +1 -0
  77. package/dist/{sql-utils-Db0IQO_B-PaULnfrE.mjs → sql-utils-Cmv_TVa8-BetrIUcj.mjs} +3 -3
  78. package/dist/{sql-utils-Db0IQO_B-PaULnfrE.mjs.map → sql-utils-Cmv_TVa8-BetrIUcj.mjs.map} +1 -1
  79. package/dist/{sql-utils-RW0vJvDl.mjs → sql-utils-bD4SfgX0.mjs} +2 -2
  80. package/dist/{sql-utils-RW0vJvDl.mjs.map → sql-utils-bD4SfgX0.mjs.map} +1 -1
  81. package/dist/{statement-DC62oiSx-DTx1JaP7.mjs → statement-DC62oiSx-Buzptbpk.mjs} +5 -5
  82. package/dist/{statement-DC62oiSx-DTx1JaP7.mjs.map → statement-DC62oiSx-Buzptbpk.mjs.map} +1 -1
  83. package/dist/target.d.mts +14 -13
  84. package/dist/target.mjs +17 -13
  85. package/dist/target__codec-descriptor.mjs +1 -1
  86. package/dist/target__codec-ids.d.mts +2 -2
  87. package/dist/target__codec-ids.mjs +2 -2
  88. package/dist/target__codec-types.d.mts +2 -2
  89. package/dist/target__codecs.d.mts +3 -3
  90. package/dist/target__codecs.mjs +3 -2
  91. package/dist/target__control.d.mts +2 -2
  92. package/dist/target__control.mjs +38 -32
  93. package/dist/target__control.mjs.map +1 -1
  94. package/dist/target__data-types.d.mts +3 -3
  95. package/dist/target__data-types.mjs +3 -3
  96. package/dist/target__default-normalizer.d.mts +1 -1
  97. package/dist/target__default-normalizer.mjs +1 -1
  98. package/dist/target__errors.d.mts +1 -1
  99. package/dist/target__errors.mjs +1 -1
  100. package/dist/target__marker-lock.mjs +1 -1
  101. package/dist/target__migration.mjs +1 -1
  102. package/dist/target__pack.d.mts +1 -1
  103. package/dist/target__pack.mjs +1 -1
  104. package/dist/target__runtime.d.mts +2 -2
  105. package/dist/target__runtime.mjs +3 -3
  106. package/dist/target__runtime.mjs.map +1 -1
  107. package/dist/target__sql-utils.mjs +2 -2
  108. package/dist/target__types.d.mts +2 -0
  109. package/dist/target__types.mjs +2 -0
  110. package/dist/{control-_4epnrIW.d.mts → types-CgrFHUdk.d.mts} +3 -8
  111. package/dist/types-CgrFHUdk.d.mts.map +1 -0
  112. package/package.json +18 -12
  113. package/dist/codec-descriptor-Du6DSz-3-ytBCu_mq.mjs.map +0 -1
  114. package/dist/codec-ids-cjxtOcLM-vFeQhgPm.mjs +0 -10
  115. package/dist/codec-ids-cjxtOcLM-vFeQhgPm.mjs.map +0 -1
  116. package/dist/codec-ids-sMOU8F-B-BQbCq2dr.d.mts +0 -10
  117. package/dist/codec-ids-sMOU8F-B-BQbCq2dr.d.mts.map +0 -1
  118. package/dist/codec-types-Bd7DL1Mr-CZWNfnp9.d.mts +0 -21
  119. package/dist/codec-types-Bd7DL1Mr-CZWNfnp9.d.mts.map +0 -1
  120. package/dist/codec-types-Bo3Jfilx.d.mts +0 -1
  121. package/dist/codec-types-Ja2kLzLS.d.mts +0 -1
  122. package/dist/codecs-C00kjHgh.mjs +0 -282
  123. package/dist/codecs-C00kjHgh.mjs.map +0 -1
  124. package/dist/codecs-CO_VNEYU-CwAnKzRs.d.mts +0 -102
  125. package/dist/codecs-CO_VNEYU-CwAnKzRs.d.mts.map +0 -1
  126. package/dist/codecs-DM61agRr.d.mts +0 -21
  127. package/dist/codecs-DM61agRr.d.mts.map +0 -1
  128. package/dist/control-H2sjKXXS.mjs.map +0 -1
  129. package/dist/control-_4epnrIW.d.mts.map +0 -1
  130. package/dist/data-type-entries-B0AoBozh-f9AEUIUQ.mjs +0 -42
  131. package/dist/data-type-entries-B0AoBozh-f9AEUIUQ.mjs.map +0 -1
  132. package/dist/data-types-BpihGKoK-BMW-m4EN.d.mts +0 -52
  133. package/dist/data-types-BpihGKoK-BMW-m4EN.d.mts.map +0 -1
  134. package/dist/data-types-Dv9gwVRV-BZPzCWZk.mjs +0 -181
  135. package/dist/data-types-Dv9gwVRV-BZPzCWZk.mjs.map +0 -1
  136. package/dist/data-types-SXrh0Lou.d.mts.map +0 -1
  137. package/dist/default-normalizer-BDUgHXUn-Xk7HQJuI.mjs.map +0 -1
  138. package/dist/descriptor-meta-D7tc0iue-C4W7o0Av.mjs +0 -82
  139. package/dist/descriptor-meta-D7tc0iue-C4W7o0Av.mjs.map +0 -1
  140. package/dist/descriptor-meta-runtime-Cur6umHo-C_4rsCGC.mjs +0 -20
  141. package/dist/descriptor-meta-runtime-Cur6umHo-C_4rsCGC.mjs.map +0 -1
  142. package/dist/errors-rvH_F2Yj-BQrO_--u.mjs +0 -20
  143. package/dist/errors-rvH_F2Yj-BQrO_--u.mjs.map +0 -1
  144. package/dist/mysql-contract-serializer-DLv0uW_f-Cg4A43Ry.mjs.map +0 -1
  145. package/dist/runtime-Cl0BbTZq.d.mts +0 -22
  146. package/dist/runtime-Cl0BbTZq.d.mts.map +0 -1
@@ -1,52 +0,0 @@
1
- import { DataType, DataTypeId } from "@prisma/orm-framework/components/codec";
2
- //#region ../../../3-targets/mysql/1-target/dist/data-types-BpihGKoK.d.mts
3
- //#region src/core/data-types.d.ts
4
- declare const mysqlText: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
5
- /** A signed 32-bit integer, stored as a JSON number. */
6
- declare const mysqlInt: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
7
- /** A signed 64-bit integer, stored as digit text so that no digit is lost. */
8
- declare const mysqlBigint: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<Readonly<Record<string, unknown>>>;
9
- /** The length of `varchar`, which MySQL requires, up to the largest it accepts. */
10
- declare const mysqlVarcharParams: import("arktype/internal/variants/object.ts").ObjectType<{
11
- length: number;
12
- }, {}>;
13
- declare const mysqlVarchar: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
14
- length: number;
15
- }>;
16
- /** The length of `char`, at most 255; a bare `char` is `char(1)`. */
17
- declare const mysqlCharParams: import("arktype/internal/variants/object.ts").ObjectType<{
18
- length?: number;
19
- }, {}>;
20
- declare const mysqlChar: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
21
- length?: number;
22
- }>;
23
- /** The fractional-second precision of `datetime`, 0 to 6; MySQL prints a precision of 0 as a bare `datetime`. */
24
- declare const mysqlDatetimeParams: import("arktype/internal/variants/object.ts").ObjectType<{
25
- precision?: number;
26
- }, {}>;
27
- /**
28
- * The value of `mysql/datetime`: a date and time without a time zone, ISO 8601 text with a `T` and no trailing zeros in the fraction, within MySQL's range. Throws `CONTRACT.CAST_REFUSED` for text that names no such date and time.
29
- */
30
- declare function mysqlDatetimeText(text: string): string;
31
- declare const mysqlDatetime: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
32
- precision?: number;
33
- }>;
34
- /** The members of a native enum column, in the order they are declared. */
35
- declare const mysqlEnumParams: import("arktype/internal/variants/object.ts").ObjectType<{
36
- values?: string[];
37
- }, {}>;
38
- /** `enum('A','B')`, the text MySQL's catalog prints for the column type, with each member a quoted literal. */
39
- declare function renderMysqlEnumType(values: readonly string[] | undefined): string;
40
- /**
41
- * A native MySQL enum. Its name is the catalog text `enum('A','B')`, so `db verify` compares the members and their order with what MySQL reports (ADR 273). A column's members are its value set's, written into its parameters by the target's namespace (see `mysql-database.ts`).
42
- */
43
- declare const mysqlEnum: import("@prisma/orm-family-sql/contract/data-type").SqlDataType<{
44
- values?: string[];
45
- }>;
46
- /** Every data type this target registers. */
47
- declare const mysqlDataTypes: readonly DataType[];
48
- /** MySQL's text data types, which a SQL discriminator column may have. */
49
- declare const mysqlTextDataTypes: readonly DataTypeId[];
50
- //#endregion
51
- export { mysqlDatetime as a, mysqlEnum as c, mysqlText as d, mysqlTextDataTypes as f, renderMysqlEnumType as h, mysqlDataTypes as i, mysqlEnumParams as l, mysqlVarcharParams as m, mysqlChar as n, mysqlDatetimeParams as o, mysqlVarchar as p, mysqlCharParams as r, mysqlDatetimeText as s, mysqlBigint as t, mysqlInt as u };
52
- //# sourceMappingURL=data-types-BpihGKoK-BMW-m4EN.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-types-BpihGKoK-BMW-m4EN.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/data-types-BpihGKoK.d.mts"],"mappings":";;;cAEc,sDAAsD,YAAY,SAAS;;cAE3E,qDAAqD,YAAY,SAAS;;cAE1E,wDAAwD,YAAY,SAAS;;cAE7E,kEAAkE;EAC9E;;cAEY,yDAAyD;EACrE;;;cAGY,+DAA+D;EAC3E;;cAEY,sDAAsD;EAClE;;;cAGY,mEAAmE;EAC/E;;;;;iBAKe,kBAAkB;cACrB,0DAA0D;EACtE;;;cAGY,+DAA+D;EAC3E;;;iBAGe,oBAAoB;;;;cAIvB,sDAAsD;EAClE;;;cAGY,yBAAyB;;cAEzB,6BAA6B"}
@@ -1,181 +0,0 @@
1
- import { t as mysqlError } from "./errors-rvH_F2Yj-BQrO_--u.mjs";
2
- import { r as quoteLiteral } from "./sql-utils-Db0IQO_B-PaULnfrE.mjs";
3
- import { INT32_RANGE, INT64_RANGE, dateTimeStoredText, numeralText, readJsonInteger, readJsonIntegerText, readJsonString, refuseJsonValue } from "@prisma/orm-framework/components/codec";
4
- import { structuredError } from "@prisma/orm-framework/utils/structured-error";
5
- import { sqlDataType, sqlRawDataType } from "@prisma/orm-family-sql/contract/data-type";
6
- import { type } from "arktype";
7
- //#region ../../../3-targets/mysql/1-target/dist/data-types-Dv9gwVRV.mjs
8
- const unchanged = (value) => value;
9
- function wrongShape(value, expected) {
10
- throw structuredError("CONTRACT.CAST_REFUSED", `Expected ${expected}, got ${JSON.stringify(value)}.`, {
11
- why: "A cast reads the stored form of the type it takes values of.",
12
- fix: "Hand the cast a value in the shape its source type stores."
13
- });
14
- }
15
- const asNumeralText = (value) => typeof value === "number" ? numeralText(value) : wrongShape(value, "a number");
16
- function integerParam(params, name) {
17
- const value = params[name];
18
- return typeof value === "number" ? value : void 0;
19
- }
20
- /** Text of at most `length` characters, counted as code points, as MySQL counts characters. */
21
- function readTextOfLength(owner, json, length) {
22
- const text = readJsonString(owner, json);
23
- if (length !== void 0 && [...text].length > length) return refuseJsonValue(owner, `a string of at most ${length} ${length === 1 ? "character" : "characters"}`, json);
24
- return json;
25
- }
26
- const mysqlText = sqlDataType("mysql/text", {
27
- texts: [{
28
- text: "text",
29
- written: true,
30
- catalog: true
31
- }],
32
- read: (json) => readJsonString("mysql/text", json),
33
- casts: {}
34
- });
35
- const fromText = { [mysqlText.id]: unchanged };
36
- /** A signed 32-bit integer, stored as a JSON number. */
37
- const mysqlInt = sqlDataType("mysql/int", {
38
- texts: [{
39
- text: "int",
40
- written: true,
41
- catalog: true
42
- }, { text: "integer" }],
43
- read: (json) => readJsonInteger("mysql/int", json, INT32_RANGE),
44
- casts: {}
45
- });
46
- /** A signed 64-bit integer, stored as digit text so that no digit is lost. */
47
- const mysqlBigint = sqlDataType("mysql/bigint", {
48
- texts: [{
49
- text: "bigint",
50
- written: true,
51
- catalog: true
52
- }],
53
- read: (json) => {
54
- readJsonIntegerText("mysql/bigint", json, INT64_RANGE);
55
- return json;
56
- },
57
- casts: { [mysqlInt.id]: asNumeralText }
58
- });
59
- /** The length of `varchar`, which MySQL requires, up to the largest it accepts. */
60
- const mysqlVarcharParams = type({ length: "number.integer >= 1 & number.integer <= 65535" });
61
- const mysqlVarchar = sqlDataType("mysql/varchar", {
62
- params: mysqlVarcharParams,
63
- texts: [{
64
- text: "varchar({length})",
65
- written: true,
66
- catalog: true
67
- }],
68
- read: (json, params) => readTextOfLength("mysql/varchar", json, integerParam(params, "length")),
69
- casts: fromText
70
- });
71
- /** The length of `char`, at most 255; a bare `char` is `char(1)`. */
72
- const mysqlCharParams = type({ "length?": "number.integer >= 1 & number.integer <= 255" });
73
- const mysqlChar = sqlDataType("mysql/char", {
74
- params: mysqlCharParams,
75
- texts: [{
76
- text: "char",
77
- written: true
78
- }, {
79
- text: "char({length})",
80
- written: true,
81
- catalog: true
82
- }],
83
- read: (json, params) => readTextOfLength("mysql/char", json, integerParam(params, "length") ?? 1),
84
- normalize: (params) => params.length === void 0 ? {
85
- ...params,
86
- length: 1
87
- } : params,
88
- casts: fromText
89
- });
90
- /** The fractional-second precision of `datetime`, 0 to 6; MySQL prints a precision of 0 as a bare `datetime`. */
91
- const mysqlDatetimeParams = type({ "precision?": "number.integer >= 0 & number.integer <= 6" });
92
- const DATETIME_RANGE = {
93
- earliest: "1000-01-01T00:00:00",
94
- latest: "9999-12-31T23:59:59.999999"
95
- };
96
- /**
97
- * The value of `mysql/datetime`: a date and time without a time zone, ISO 8601 text with a `T` and no trailing zeros in the fraction, within MySQL's range. Throws `CONTRACT.CAST_REFUSED` for text that names no such date and time.
98
- */
99
- function mysqlDatetimeText(text) {
100
- return dateTimeStoredText(text, {
101
- shape: "dateTime",
102
- ownerId: "mysql/datetime",
103
- range: DATETIME_RANGE
104
- });
105
- }
106
- function storedDatetime(text) {
107
- try {
108
- return mysqlDatetimeText(text);
109
- } catch {
110
- return;
111
- }
112
- }
113
- const readDatetime = (json) => typeof json === "string" && storedDatetime(json) !== void 0 ? json : refuseJsonValue("mysql/datetime", "ISO 8601 date and time text without a UTC offset, as in \"2024-01-01T00:00:00\"", json);
114
- const spellDatetime = (json) => typeof json === "string" ? storedDatetime(json) ?? json : json;
115
- const mysqlDatetime = sqlDataType("mysql/datetime", {
116
- params: mysqlDatetimeParams,
117
- texts: [{
118
- text: "datetime",
119
- written: true,
120
- catalog: true
121
- }, {
122
- text: "datetime({precision})",
123
- written: true,
124
- catalog: true
125
- }],
126
- read: readDatetime,
127
- spell: spellDatetime,
128
- normalize: ({ precision, ...rest }) => precision === 0 ? rest : {
129
- ...rest,
130
- precision
131
- },
132
- casts: {}
133
- });
134
- /** The members of a native enum column, in the order they are declared. */
135
- const mysqlEnumParams = type({ "values?": "string[]" });
136
- /** `enum('A','B')`, the text MySQL's catalog prints for the column type, with each member a quoted literal. */
137
- function renderMysqlEnumType(values) {
138
- if (values === void 0 || values.length === 0) throw mysqlError("CONTRACT.TYPE_PARAMS_INVALID", "A MySQL enum column type needs at least one member.", {
139
- why: "A native enum column is written with its members, and this column has none.",
140
- fix: "Type the column with a PSL enum or an enumType() that declares its members.",
141
- meta: { dataType: "mysql/enum" }
142
- });
143
- return `enum(${values.map(quoteLiteral).join(",")})`;
144
- }
145
- const readEnumMember = (json, params) => {
146
- const member = readJsonString("mysql/enum", json);
147
- const values = params["values"];
148
- if (Array.isArray(values) && !values.includes(member)) return refuseJsonValue("mysql/enum", `one of the members ${values.join(", ")}`, json);
149
- return json;
150
- };
151
- /**
152
- * A native MySQL enum. Its name is the catalog text `enum('A','B')`, so `db verify` compares the members and their order with what MySQL reports (ADR 273). A column's members are its value set's, written into its parameters by the target's namespace (see `mysql-database.ts`).
153
- */
154
- const mysqlEnum = sqlDataType("mysql/enum", {
155
- params: mysqlEnumParams,
156
- nameIsCatalogText: true,
157
- render: ({ values }) => renderMysqlEnumType(values),
158
- read: readEnumMember,
159
- casts: fromText
160
- });
161
- /** Every data type this target registers. */
162
- const mysqlDataTypes = [
163
- mysqlText,
164
- mysqlInt,
165
- mysqlBigint,
166
- mysqlVarchar,
167
- mysqlChar,
168
- mysqlDatetime,
169
- mysqlEnum,
170
- sqlRawDataType
171
- ];
172
- /** MySQL's text data types, which a SQL discriminator column may have. */
173
- const mysqlTextDataTypes = [
174
- mysqlText.id,
175
- mysqlVarchar.id,
176
- mysqlChar.id
177
- ];
178
- //#endregion
179
- export { mysqlDatetime as a, mysqlEnum as c, mysqlText as d, mysqlTextDataTypes as f, renderMysqlEnumType as h, mysqlDataTypes as i, mysqlEnumParams as l, mysqlVarcharParams as m, mysqlChar as n, mysqlDatetimeParams as o, mysqlVarchar as p, mysqlCharParams as r, mysqlDatetimeText as s, mysqlBigint as t, mysqlInt as u };
180
-
181
- //# sourceMappingURL=data-types-Dv9gwVRV-BZPzCWZk.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-types-Dv9gwVRV-BZPzCWZk.mjs","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/data-types-Dv9gwVRV.mjs"],"sourcesContent":["import { t as mysqlError } from \"./errors-rvH_F2Yj.mjs\";\nimport { r as quoteLiteral } from \"./sql-utils-Db0IQO_B.mjs\";\nimport { INT32_RANGE, INT64_RANGE, dateTimeStoredText, numeralText, readJsonInteger, readJsonIntegerText, readJsonString, refuseJsonValue } from \"@internal/framework-components/codec\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { sqlDataType, sqlRawDataType } from \"@internal/sql-contract/data-type\";\nimport { type } from \"arktype\";\n//#region src/core/data-types.ts\nconst unchanged = (value) => value;\nfunction wrongShape(value, expected) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected ${expected}, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A cast reads the stored form of the type it takes values of.\",\n\t\tfix: \"Hand the cast a value in the shape its source type stores.\"\n\t});\n}\nconst asNumeralText = (value) => typeof value === \"number\" ? numeralText(value) : wrongShape(value, \"a number\");\nfunction integerParam(params, name) {\n\tconst value = params[name];\n\treturn typeof value === \"number\" ? value : void 0;\n}\n/** Text of at most `length` characters, counted as code points, as MySQL counts characters. */\nfunction readTextOfLength(owner, json, length) {\n\tconst text = readJsonString(owner, json);\n\tif (length !== void 0 && [...text].length > length) return refuseJsonValue(owner, `a string of at most ${length} ${length === 1 ? \"character\" : \"characters\"}`, json);\n\treturn json;\n}\nconst mysqlText = sqlDataType(\"mysql/text\", {\n\ttexts: [{\n\t\ttext: \"text\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: (json) => readJsonString(\"mysql/text\", json),\n\tcasts: {}\n});\nconst fromText = { [mysqlText.id]: unchanged };\n/** A signed 32-bit integer, stored as a JSON number. */\nconst mysqlInt = sqlDataType(\"mysql/int\", {\n\ttexts: [{\n\t\ttext: \"int\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}, { text: \"integer\" }],\n\tread: (json) => readJsonInteger(\"mysql/int\", json, INT32_RANGE),\n\tcasts: {}\n});\n/** A signed 64-bit integer, stored as digit text so that no digit is lost. */\nconst mysqlBigint = sqlDataType(\"mysql/bigint\", {\n\ttexts: [{\n\t\ttext: \"bigint\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: (json) => {\n\t\treadJsonIntegerText(\"mysql/bigint\", json, INT64_RANGE);\n\t\treturn json;\n\t},\n\tcasts: { [mysqlInt.id]: asNumeralText }\n});\n/** The length of `varchar`, which MySQL requires, up to the largest it accepts. */\nconst mysqlVarcharParams = type({ length: \"number.integer >= 1 & number.integer <= 65535\" });\nconst mysqlVarchar = sqlDataType(\"mysql/varchar\", {\n\tparams: mysqlVarcharParams,\n\ttexts: [{\n\t\ttext: \"varchar({length})\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: (json, params) => readTextOfLength(\"mysql/varchar\", json, integerParam(params, \"length\")),\n\tcasts: fromText\n});\n/** The length of `char`, at most 255; a bare `char` is `char(1)`. */\nconst mysqlCharParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 255\" });\nconst mysqlChar = sqlDataType(\"mysql/char\", {\n\tparams: mysqlCharParams,\n\ttexts: [{\n\t\ttext: \"char\",\n\t\twritten: true\n\t}, {\n\t\ttext: \"char({length})\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: (json, params) => readTextOfLength(\"mysql/char\", json, integerParam(params, \"length\") ?? 1),\n\tnormalize: (params) => params.length === void 0 ? {\n\t\t...params,\n\t\tlength: 1\n\t} : params,\n\tcasts: fromText\n});\n/** The fractional-second precision of `datetime`, 0 to 6; MySQL prints a precision of 0 as a bare `datetime`. */\nconst mysqlDatetimeParams = type({ \"precision?\": \"number.integer >= 0 & number.integer <= 6\" });\nconst DATETIME_RANGE = {\n\tearliest: \"1000-01-01T00:00:00\",\n\tlatest: \"9999-12-31T23:59:59.999999\"\n};\n/**\n* The value of `mysql/datetime`: a date and time without a time zone, ISO 8601 text with a `T` and no trailing zeros in the fraction, within MySQL's range. Throws `CONTRACT.CAST_REFUSED` for text that names no such date and time.\n*/\nfunction mysqlDatetimeText(text) {\n\treturn dateTimeStoredText(text, {\n\t\tshape: \"dateTime\",\n\t\townerId: \"mysql/datetime\",\n\t\trange: DATETIME_RANGE\n\t});\n}\nfunction storedDatetime(text) {\n\ttry {\n\t\treturn mysqlDatetimeText(text);\n\t} catch {\n\t\treturn;\n\t}\n}\nconst readDatetime = (json) => typeof json === \"string\" && storedDatetime(json) !== void 0 ? json : refuseJsonValue(\"mysql/datetime\", \"ISO 8601 date and time text without a UTC offset, as in \\\"2024-01-01T00:00:00\\\"\", json);\nconst spellDatetime = (json) => typeof json === \"string\" ? storedDatetime(json) ?? json : json;\nconst mysqlDatetime = sqlDataType(\"mysql/datetime\", {\n\tparams: mysqlDatetimeParams,\n\ttexts: [{\n\t\ttext: \"datetime\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}, {\n\t\ttext: \"datetime({precision})\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}],\n\tread: readDatetime,\n\tspell: spellDatetime,\n\tnormalize: ({ precision, ...rest }) => precision === 0 ? rest : {\n\t\t...rest,\n\t\tprecision\n\t},\n\tcasts: {}\n});\n/** The members of a native enum column, in the order they are declared. */\nconst mysqlEnumParams = type({ \"values?\": \"string[]\" });\n/** `enum('A','B')`, the text MySQL's catalog prints for the column type, with each member a quoted literal. */\nfunction renderMysqlEnumType(values) {\n\tif (values === void 0 || values.length === 0) throw mysqlError(\"CONTRACT.TYPE_PARAMS_INVALID\", \"A MySQL enum column type needs at least one member.\", {\n\t\twhy: \"A native enum column is written with its members, and this column has none.\",\n\t\tfix: \"Type the column with a PSL enum or an enumType() that declares its members.\",\n\t\tmeta: { dataType: \"mysql/enum\" }\n\t});\n\treturn `enum(${values.map(quoteLiteral).join(\",\")})`;\n}\nconst readEnumMember = (json, params) => {\n\tconst member = readJsonString(\"mysql/enum\", json);\n\tconst values = params[\"values\"];\n\tif (Array.isArray(values) && !values.includes(member)) return refuseJsonValue(\"mysql/enum\", `one of the members ${values.join(\", \")}`, json);\n\treturn json;\n};\n/**\n* A native MySQL enum. Its name is the catalog text `enum('A','B')`, so `db verify` compares the members and their order with what MySQL reports (ADR 273). A column's members are its value set's, written into its parameters by the target's namespace (see `mysql-database.ts`).\n*/\nconst mysqlEnum = sqlDataType(\"mysql/enum\", {\n\tparams: mysqlEnumParams,\n\tnameIsCatalogText: true,\n\trender: ({ values }) => renderMysqlEnumType(values),\n\tread: readEnumMember,\n\tcasts: fromText\n});\n/** Every data type this target registers. */\nconst mysqlDataTypes = [\n\tmysqlText,\n\tmysqlInt,\n\tmysqlBigint,\n\tmysqlVarchar,\n\tmysqlChar,\n\tmysqlDatetime,\n\tmysqlEnum,\n\tsqlRawDataType\n];\n/** MySQL's text data types, which a SQL discriminator column may have. */\nconst mysqlTextDataTypes = [\n\tmysqlText.id,\n\tmysqlVarchar.id,\n\tmysqlChar.id\n];\n//#endregion\nexport { mysqlDatetime as a, mysqlEnum as c, mysqlText as d, mysqlTextDataTypes as f, renderMysqlEnumType as h, mysqlDataTypes as i, mysqlEnumParams as l, mysqlVarcharParams as m, mysqlChar as n, mysqlDatetimeParams as o, mysqlVarchar as p, mysqlCharParams as r, mysqlDatetimeText as s, mysqlBigint as t, mysqlInt as u };\n\n//# sourceMappingURL=data-types-Dv9gwVRV.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,aAAa,UAAU;AAC7B,SAAS,WAAW,OAAO,UAAU;CACpC,MAAM,gBAAgB,yBAAyB,YAAY,SAAS,QAAQ,KAAK,UAAU,KAAK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ED,MAAM,kBAAkB,KAAK,EAAE,WAAW,WAAW,CAAC;;AAEtD,SAAS,oBAAoB,QAAQ;CACpC,IAAI,WAAW,KAAK,KAAK,OAAO,WAAW,GAAG,MAAM,WAAW,gCAAgC,uDAAuD;EACrJ,KAAK;EACL,KAAK;EACL,MAAM,EAAE,UAAU,aAAa;CAChC,CAAC;CACD,OAAO,QAAQ,OAAO,IAAI,YAAY,CAAC,CAAC,KAAK,GAAG,EAAE;AACnD;AACA,MAAM,kBAAkB,MAAM,WAAW;CACxC,MAAM,SAAS,eAAe,cAAc,IAAI;CAChD,MAAM,SAAS,OAAO;CACtB,IAAI,MAAM,QAAQ,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,GAAG,OAAO,gBAAgB,cAAc,sBAAsB,OAAO,KAAK,IAAI,KAAK,IAAI;CAC3I,OAAO;AACR;;;;AAIA,MAAM,YAAY,YAAY,cAAc;CAC3C,QAAQ;CACR,mBAAmB;CACnB,SAAS,EAAE,aAAa,oBAAoB,MAAM;CAClD,MAAM;CACN,OAAO;AACR,CAAC;;AAED,MAAM,iBAAiB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAEA,MAAM,qBAAqB;CAC1B,UAAU;CACV,aAAa;CACb,UAAU;AACX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-types-SXrh0Lou.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/data-types.d.mts"],"mappings":";;;;iBAGiB,wBAAwB,SAAS,eAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"default-normalizer-BDUgHXUn-Xk7HQJuI.mjs","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/default-normalizer-BDUgHXUn.mjs"],"sourcesContent":["//#region src/core/default-normalizer.ts\nconst AUTOINCREMENT = {\n\tkind: \"function\",\n\texpression: \"autoincrement()\"\n};\nconst NOW = {\n\tkind: \"function\",\n\texpression: \"now()\"\n};\nconst CURRENT_TIMESTAMP = /^(?:current_timestamp|now|localtime|localtimestamp)(?:\\s*\\(\\s*\\d*\\s*\\))?$/i;\nconst SQL_ESCAPES = {\n\t\"0\": \"\\0\",\n\tb: \"\\b\",\n\tn: \"\\n\",\n\tr: \"\\r\",\n\tt: \"\t\",\n\tZ: \"\u001a\"\n};\nconst INTRODUCED_STRING = /^_[A-Za-z0-9]+'/;\nfunction withoutBackslashEscapes(text) {\n\treturn text.replace(/\\\\(.)/gs, \"$1\");\n}\n/** The text of a MySQL string literal whose opening quote ends `start`, when the literal runs to the end of `text`. */\nfunction stringLiteralBody(text, start) {\n\tlet body = \"\";\n\tfor (let index = start; index < text.length; index += 1) {\n\t\tconst char = text.charAt(index);\n\t\tif (char === \"\\\\\") {\n\t\t\tindex += 1;\n\t\t\tconst escaped = text.charAt(index);\n\t\t\tbody += escaped === \"%\" || escaped === \"_\" ? `\\\\${escaped}` : SQL_ESCAPES[escaped] ?? escaped;\n\t\t} else if (char === \"'\" && text.charAt(index + 1) === \"'\") {\n\t\t\tbody += \"'\";\n\t\t\tindex += 1;\n\t\t} else if (char === \"'\") return index === text.length - 1 ? body : void 0;\n\t\telse body += char;\n\t}\n}\n/**\n* The value of a default MySQL reports as a string with a character set introducer, such as `_utf8mb4\\'abc\\'`: the form a literal default on a text, blob or JSON column takes, because MySQL writes it as an expression. `undefined` for any other expression.\n*/\nfunction introducedStringValue(reported) {\n\tconst expression = withoutBackslashEscapes(reported.trim());\n\tconst opening = INTRODUCED_STRING.exec(expression);\n\treturn opening === null ? void 0 : stringLiteralBody(expression, opening[0].length);\n}\nfunction extraFlags(extra) {\n\treturn extra.toLowerCase().split(/\\s+/);\n}\n/**\n* Reads a column's reported default from `COLUMN_DEFAULT` and `EXTRA`. `auto_increment` is `autoincrement()`; a string with a character set introducer, the form MySQL reports for a literal default on a text, blob or JSON column, is that literal; an expression default that writes the current time, such as `CURRENT_TIMESTAMP(3)`, is `now()`; any other expression default is a function default kept as reported; and anything else is a literal. `undefined` when the column has no default.\n*/\nfunction readMysqlDefault(columnDefault, extra) {\n\tconst flags = extraFlags(extra);\n\tif (flags.includes(\"auto_increment\")) return AUTOINCREMENT;\n\tif (columnDefault === null) return void 0;\n\tif (flags.includes(\"default_generated\")) {\n\t\tconst introduced = introducedStringValue(columnDefault);\n\t\tif (introduced !== void 0) return {\n\t\t\tkind: \"literal\",\n\t\t\tliteral: {\n\t\t\t\tkind: \"value\",\n\t\t\t\tbody: introduced\n\t\t\t}\n\t\t};\n\t\tconst expression = columnDefault.trim();\n\t\treturn CURRENT_TIMESTAMP.test(expression) ? NOW : {\n\t\t\tkind: \"function\",\n\t\t\texpression\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: columnDefault\n\t\t}\n\t};\n}\n/**\n* Names a contract's expression default the way {@link readMysqlDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP(3)` `` and the database's `now()` compare equal. Every other default passes through unchanged.\n*/\nfunction mysqlResolveDefault(def, _column) {\n\tif (def.kind !== \"function\") return def;\n\treturn CURRENT_TIMESTAMP.test(def.expression.trim()) ? NOW : def;\n}\n//#endregion\nexport { readMysqlDefault as n, mysqlResolveDefault as t };\n\n//# sourceMappingURL=default-normalizer-BDUgHXUn.mjs.map"],"mappings":";AACA,MAAM,gBAAgB;CACrB,MAAM;CACN,YAAY;AACb;AACA,MAAM,MAAM;CACX,MAAM;CACN,YAAY;AACb;AACA,MAAM,oBAAoB;AAC1B,MAAM,cAAc;CACnB,KAAK;CACL,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACJ;AACA,MAAM,oBAAoB;AAC1B,SAAS,wBAAwB,MAAM;CACtC,OAAO,KAAK,QAAQ,WAAW,IAAI;AACpC;;AAEA,SAAS,kBAAkB,MAAM,OAAO;CACvC,IAAI,OAAO;CACX,KAAK,IAAI,QAAQ,OAAO,QAAQ,KAAK,QAAQ,SAAS,GAAG;EACxD,MAAM,OAAO,KAAK,OAAO,KA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1,82 +0,0 @@
1
- import { a as MYSQL_TEXT_CODEC_ID, i as MYSQL_INT_CODEC_ID, n as MYSQL_DATETIME_CODEC_ID, t as MYSQL_BIGINT_CODEC_ID } from "./codec-ids-cjxtOcLM-vFeQhgPm.mjs";
2
- import { f as mysqlTextDataTypes, u as mysqlInt } from "./data-types-Dv9gwVRV-BZPzCWZk.mjs";
3
- import { t as mysqlDataTypeEntries } from "./data-type-entries-B0AoBozh-f9AEUIUQ.mjs";
4
- import { t as mysqlTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-Cur6umHo-C_4rsCGC.mjs";
5
- import { SQL_VARCHAR_CODEC_ID } from "@prisma/orm-family-sql/relational-core/ast";
6
- import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
7
- import { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions, sqlTargetTypeConstructors } from "@prisma/orm-family-sql/family/pack";
8
- import { TIMESTAMP_NOW_GENERATOR_ID } from "@prisma/orm-framework/components/authoring";
9
- import { singleGeneratorBinding } from "@prisma/orm-framework/components/components";
10
- //#region ../../../3-targets/mysql/1-target/dist/descriptor-meta-D7tc0iue.mjs
11
- /** The type constructors whose arguments are sizes, which take values of `mysql/int`. */
12
- const mysqlAuthoringTypes = { .../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: "mysql/int" }) };
13
- const mysqlGeneratorFunctions = [
14
- ...sqlIntegerArgumentGeneratorFunctions({ integer: mysqlInt.id }),
15
- {
16
- name: "now",
17
- bindings: [singleGeneratorBinding({
18
- codecIds: [MYSQL_DATETIME_CODEC_ID],
19
- generatorId: TIMESTAMP_NOW_GENERATOR_ID
20
- })]
21
- },
22
- ...idGeneratorFunctionBindings({ text: [MYSQL_TEXT_CODEC_ID] })
23
- ];
24
- /** The `now` generator MySQL binds. The SQL family registers the identifier generators. */
25
- const mysqlGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }];
26
- /**
27
- * The base PSL scalars 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.
28
- */
29
- const mysqlScalarTypeConstructors = {
30
- String: {
31
- kind: "typeConstructor",
32
- documentation: `Text of at most 191 characters, stored as MySQL varchar(191) so that it can be indexed.`,
33
- output: {
34
- codecId: SQL_VARCHAR_CODEC_ID,
35
- typeParams: { length: 191 }
36
- }
37
- },
38
- Int: {
39
- kind: "typeConstructor",
40
- inferred: true,
41
- documentation: "A signed 32-bit integer stored as MySQL int and represented as a JavaScript number.",
42
- output: { codecId: MYSQL_INT_CODEC_ID }
43
- },
44
- BigInt: {
45
- kind: "typeConstructor",
46
- inferred: true,
47
- documentation: "A signed 64-bit integer stored as MySQL bigint and represented as a JavaScript bigint.",
48
- output: { codecId: MYSQL_BIGINT_CODEC_ID }
49
- },
50
- DateTime: {
51
- kind: "typeConstructor",
52
- inferred: true,
53
- documentation: "A date and time with millisecond precision, stored as MySQL datetime(3) in UTC and represented as a JavaScript Date.",
54
- output: {
55
- codecId: MYSQL_DATETIME_CODEC_ID,
56
- typeParams: { precision: 3 }
57
- }
58
- }
59
- };
60
- const mysqlTargetDescriptorMeta = {
61
- ...mysqlTargetDescriptorMetaRuntime,
62
- defaultNamespaceId: UNBOUND_NAMESPACE_ID,
63
- supportsNamespaces: false,
64
- displayName: "MySQL",
65
- authoring: {
66
- type: {
67
- ...mysqlScalarTypeConstructors,
68
- ...mysqlAuthoringTypes
69
- },
70
- dataTypes: mysqlDataTypeEntries(),
71
- textDataTypes: mysqlTextDataTypes
72
- },
73
- generatorFunctions: mysqlGeneratorFunctions,
74
- controlMutationDefaults: {
75
- defaultFunctionRegistry: /* @__PURE__ */ new Map(),
76
- generatorDescriptors: mysqlGeneratorDescriptors
77
- }
78
- };
79
- //#endregion
80
- export { mysqlTargetDescriptorMeta as t };
81
-
82
- //# sourceMappingURL=descriptor-meta-D7tc0iue-C4W7o0Av.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-D7tc0iue-C4W7o0Av.mjs","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/descriptor-meta-D7tc0iue.mjs"],"sourcesContent":["import { a as MYSQL_TEXT_CODEC_ID, i as MYSQL_INT_CODEC_ID, n as MYSQL_DATETIME_CODEC_ID, t as MYSQL_BIGINT_CODEC_ID } from \"./codec-ids-cjxtOcLM.mjs\";\nimport { f as mysqlTextDataTypes, u as mysqlInt } from \"./data-types-Dv9gwVRV.mjs\";\nimport { t as mysqlDataTypeEntries } from \"./data-type-entries-B0AoBozh.mjs\";\nimport { t as mysqlTargetDescriptorMetaRuntime } from \"./descriptor-meta-runtime-Cur6umHo.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 } from \"@internal/framework-components/authoring\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\n//#region src/core/authoring.ts\n/** The type constructors whose arguments are sizes, which take values of `mysql/int`. */\nconst mysqlAuthoringTypes = { .../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: \"mysql/int\" }) };\n//#endregion\n//#region src/core/generator-functions.ts\nconst mysqlGeneratorFunctions = [\n\t...sqlIntegerArgumentGeneratorFunctions({ integer: mysqlInt.id }),\n\t{\n\t\tname: \"now\",\n\t\tbindings: [singleGeneratorBinding({\n\t\t\tcodecIds: [MYSQL_DATETIME_CODEC_ID],\n\t\t\tgeneratorId: TIMESTAMP_NOW_GENERATOR_ID\n\t\t})]\n\t},\n\t...idGeneratorFunctionBindings({ text: [MYSQL_TEXT_CODEC_ID] })\n];\n/** The `now` generator MySQL binds. The SQL family registers the identifier generators. */\nconst mysqlGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }];\n/**\n* The base PSL scalars 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 mysqlScalarTypeConstructors = {\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\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A date and time with millisecond precision, stored as MySQL datetime(3) in UTC and represented as a JavaScript Date.\",\n\t\toutput: {\n\t\t\tcodecId: MYSQL_DATETIME_CODEC_ID,\n\t\t\ttypeParams: { precision: 3 }\n\t\t}\n\t}\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 { mysqlTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-D7tc0iue.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,sBAAsB,EAAE,GAAmB,0CAA0B,EAAE,UAAU,YAAY,CAAC,EAAE;AAGtG,MAAM,0BAA0B;CAC/B,GAAG,qCAAqC,EAAE,SAAS,SAAS,GAAG,CAAC;CAChE;EACC,MAAM;EACN,UAAU,CAAC,uBAAuB;GACjC,UAAU,CAAC,uBAAuB;GAClC,aAAa;EACd,CAAC,CAAC;CACH;CACA,GAAG,4BAA4B,EAAE,MAAM,CAAC,mBAAmB,EAAE,CAAC;AAC/D;;AAEA,MAAM,4BAA4B,CAAC,EAAE,IAAI,2BAA2B,CAAC;;;;AAIrE,MAAM,8BAA8B;CACnC,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ;GACP,SAAS;GACT,YAAY,EAAE,QAAQ,IAAI;EAC3B;CACD;CACA,KAAK;EACJ,MAAM;EACN,UAAU;EACV,eAAe;EACf,QAAQ,EAAE,SAAS,mBAAmB;CACvC;CACA,QAAQ;EACP,MAAM;EACN,UAAU;EACV,eAAe;EACf,QAAQ,EAAE,SAAS,sBAAsB;CAC1C;CACA,UAAU;EACT,MAAM;EACN,UAAU;EACV,eAAe;EACf,QAAQ;GACP,SAAS;GACT,YAAY,EAAE,WAAW,EAAE;EAC5B;CACD;AACD;AACA,MAAM,4BAA4B;CACjC,GAAG;CACH,oBAAoB;CACpB,oBAAoB;CACpB,aAAa;CACb,WAAW;EACV,MAAM;GACL,GAAG;GACH,GAAG;EACJ;EACA,WAAW,qBAAqB;EAChC,eAAe;CAChB;CACA,oBAAoB;CACpB,yBAAyB;EACxB,yCAAyC,IAAI,IAAI;EACjD,sBAAsB;CACvB;AACD"}
@@ -1,20 +0,0 @@
1
- import { i as mysqlDataTypes } from "./data-types-Dv9gwVRV-BZPzCWZk.mjs";
2
- //#region ../../../3-targets/mysql/1-target/dist/descriptor-meta-runtime-Cur6umHo.mjs
3
- /** The runtime-safe part of the MySQL target's metadata: it leaves out `authoring`, which only contract construction reads. Every session runs in UTC, because the datetime codec reads and writes UTC, and at READ COMMITTED, as Postgres does, so a read inside a transaction sees rows other sessions committed. Transaction isolation controls will replace the setting. */
4
- const mysqlTargetDescriptorMetaRuntime = {
5
- kind: "target",
6
- familyId: "sql",
7
- targetId: "mysql",
8
- id: "mysql",
9
- version: "0.0.1",
10
- capabilities: {},
11
- dataTypes: mysqlDataTypes,
12
- sessionSettings: {
13
- time_zone: "+00:00",
14
- transaction_isolation: "READ-COMMITTED"
15
- }
16
- };
17
- //#endregion
18
- export { mysqlTargetDescriptorMetaRuntime as t };
19
-
20
- //# sourceMappingURL=descriptor-meta-runtime-Cur6umHo-C_4rsCGC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-runtime-Cur6umHo-C_4rsCGC.mjs","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/descriptor-meta-runtime-Cur6umHo.mjs"],"sourcesContent":["import { i as mysqlDataTypes } from \"./data-types-Dv9gwVRV.mjs\";\n/** The runtime-safe part of the MySQL target's metadata: it leaves out `authoring`, which only contract construction reads. Every session runs in UTC, because the datetime codec reads and writes UTC, and at READ COMMITTED, as Postgres does, so a read inside a transaction sees rows other sessions committed. Transaction isolation controls will replace the setting. */\nconst mysqlTargetDescriptorMetaRuntime = {\n\tkind: \"target\",\n\tfamilyId: \"sql\",\n\ttargetId: \"mysql\",\n\tid: \"mysql\",\n\tversion: \"0.0.1\",\n\tcapabilities: {},\n\tdataTypes: mysqlDataTypes,\n\tsessionSettings: {\n\t\ttime_zone: \"+00:00\",\n\t\ttransaction_isolation: \"READ-COMMITTED\"\n\t}\n};\n//#endregion\nexport { mysqlTargetDescriptorMetaRuntime as t };\n\n//# sourceMappingURL=descriptor-meta-runtime-Cur6umHo.mjs.map"],"mappings":";;;AAEA,MAAM,mCAAmC;CACxC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;CACf,WAAW;CACX,iBAAiB;EAChB,WAAW;EACX,uBAAuB;CACxB;AACD"}
@@ -1,20 +0,0 @@
1
- import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
- //#region ../../../3-targets/mysql/1-target/dist/errors-rvH_F2Yj.mjs
3
- function mysqlError(code, message, options) {
4
- return structuredError(code, message, options);
5
- }
6
- /** The refusal of a query a later slice of the MySQL target can render: `what` names the feature, as in `Lowering queries`. */
7
- function mysqlQueryNotYetSupported(what) {
8
- return mysqlError("RUNTIME.AST_UNSUPPORTED", `${what} is not yet supported on MySQL.`, {
9
- why: "The MySQL target renders reads; writes and some query forms are not built yet.",
10
- fix: "Use a Postgres or SQLite target for this query until the MySQL target supports it.",
11
- meta: {
12
- target: "mysql",
13
- feature: what
14
- }
15
- });
16
- }
17
- //#endregion
18
- export { mysqlQueryNotYetSupported as n, mysqlError as t };
19
-
20
- //# sourceMappingURL=errors-rvH_F2Yj-BQrO_--u.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-rvH_F2Yj-BQrO_--u.mjs","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/errors-rvH_F2Yj.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\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}\n//#endregion\nexport { mysqlQueryNotYetSupported as n, mysqlError as t };\n\n//# sourceMappingURL=errors-rvH_F2Yj.mjs.map"],"mappings":";;AAEA,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mysql-contract-serializer-DLv0uW_f-Cg4A43Ry.mjs","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/mysql-contract-serializer-DLv0uW_f.mjs"],"sourcesContent":["import \"./codec-ids-cjxtOcLM.mjs\";\nimport { t as mysqlError } from \"./errors-rvH_F2Yj.mjs\";\nimport { n as quoteIdentifier } from \"./sql-utils-Db0IQO_B.mjs\";\nimport { i as mysqlDataTypes } from \"./data-types-Dv9gwVRV.mjs\";\nimport { createDataTypeLookup } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { SqlNamespaceBase } from \"@internal/sql-contract/types\";\nimport { UNBOUND_NAMESPACE_ID, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { tableEntityKind } from \"@internal/sql-contract/entity-kinds\";\n//#region src/core/mysql-database.ts\nconst MYSQL_NAMESPACE_KIND = \"mysql-namespace\";\n/**\n* The MySQL database a connection uses, as the contract's one namespace. Tables are addressed unqualified, so the contract runs against whichever database the connection names.\n*/\nvar MysqlDatabase = class extends SqlNamespaceBase {\n\tid;\n\tentries;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.id = input.id;\n\t\tconst dispatched = hydrateNamespaceEntities(input.entries, /* @__PURE__ */ new Map([[\"table\", tableEntityKind]]), \"carry\");\n\t\tthis.entries = Object.freeze(blindCast(dispatched));\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: MYSQL_NAMESPACE_KIND,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n\tget table() {\n\t\treturn this.entries.table ?? Object.freeze({});\n\t}\n\tqualifier() {\n\t\treturn \"\";\n\t}\n\tqualifyTable(tableName) {\n\t\treturn quoteIdentifier(tableName);\n\t}\n};\nfunction isLoose(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction enumMembersOf(namespace, tableName, columnName, column) {\n\tconst subject = `Column \"${tableName}\".\"${columnName}\"`;\n\tconst ref = column[\"valueSet\"];\n\tconst valueSetName = isLoose(ref) && ref[\"namespaceId\"] === namespace.id ? ref[\"entityName\"] : void 0;\n\tconst valueSet = typeof valueSetName === \"string\" ? namespace.entries[\"valueSet\"]?.[valueSetName] : void 0;\n\tconst values = isLoose(valueSet) ? valueSet[\"values\"] : void 0;\n\tif (!Array.isArray(values) || !values.every((value) => typeof value === \"string\")) throw mysqlError(\"CONTRACT.TYPE_PARAMS_INVALID\", `${subject} is a MySQL enum but has no enum whose text members it can list.`, {\n\t\twhy: \"A native MySQL enum column is written with its members, which come from the enum that types the column.\",\n\t\tfix: \"Type the column with a PSL enum or an enumType() whose members are text.\",\n\t\tmeta: {\n\t\t\ttable: tableName,\n\t\t\tcolumn: columnName\n\t\t}\n\t});\n\treturn values;\n}\nfunction isEnumColumn(column) {\n\treturn isLoose(column) && column[\"codecId\"] === \"mysql/enum@1\";\n}\nfunction sameMembers(left, right) {\n\treturn left.length === right.length && left.every((value, index) => value === right[index]);\n}\nfunction enumColumnWithMembers(namespace, tableName, columnName, column) {\n\tconst typeParams = isLoose(column[\"typeParams\"]) ? column[\"typeParams\"] : {};\n\tconst values = enumMembersOf(namespace, tableName, columnName, column);\n\tconst listed = typeParams[\"values\"];\n\tif (listed !== void 0 && !(Array.isArray(listed) && sameMembers(listed, values))) throw mysqlError(\"CONTRACT.TYPE_PARAMS_INVALID\", `Column \"${tableName}\".\"${columnName}\" lists enum members that differ from the members of the enum that types it.`, {\n\t\twhy: \"A MySQL enum column takes its members from its enum, in the order the enum declares them, so the database and the contract enforce the same members.\",\n\t\tfix: \"Remove the column’s own members, or make them equal the enum’s members in the same order.\",\n\t\tmeta: {\n\t\t\ttable: tableName,\n\t\t\tcolumn: columnName,\n\t\t\tcolumnValues: listed,\n\t\t\tvalueSetValues: values\n\t\t}\n\t});\n\treturn {\n\t\t...column,\n\t\ttypeParams: {\n\t\t\t...typeParams,\n\t\t\tvalues\n\t\t}\n\t};\n}\nfunction withEnumMembers(namespace, tableName, table) {\n\tif (!isLoose(table)) return table;\n\tconst columns = table[\"columns\"];\n\tif (!isLoose(columns) || !Object.values(columns).some(isEnumColumn)) return table;\n\tconst filled = Object.fromEntries(Object.entries(columns).map(([columnName, column]) => [columnName, isEnumColumn(column) ? enumColumnWithMembers(namespace, tableName, columnName, column) : column]));\n\treturn {\n\t\t...table,\n\t\tcolumns: filled\n\t};\n}\n/**\n* Writes each MySQL enum column's members, from the value set the column names, into its type parameters, in the order the enum declares them, and refuses a column whose own members differ from them. The column's type is then `enum('A','B')`, so the database enforces the members and `db verify` sees a change to them as a change of the column's type.\n*/\nfunction fillEnumMembers(input) {\n\tconst tables = input.entries[\"table\"];\n\tif (tables === void 0) return input;\n\treturn {\n\t\t...input,\n\t\tentries: {\n\t\t\t...input.entries,\n\t\t\ttable: Object.fromEntries(Object.entries(tables).map(([tableName, table]) => [tableName, withEnumMembers(input, tableName, table)]))\n\t\t}\n\t};\n}\n/**\n* The MySQL target's refusal of expression and partial indexes, which it neither writes nor introspects yet.\n*/\nfunction rejectSqlBodyIndexes(input) {\n\tfor (const [tableName, table] of Object.entries(input.entries[\"table\"] ?? {})) {\n\t\tconst indexes = isLoose(table) ? table[\"indexes\"] : void 0;\n\t\tfor (const index of Array.isArray(indexes) ? indexes : []) {\n\t\t\tif (!isLoose(index)) continue;\n\t\t\tif (index[\"expression\"] !== void 0 || index[\"where\"] !== void 0) throw mysqlError(\"CONTRACT.ARGUMENT_INVALID\", `MySQL does not support expression or partial indexes yet: index \"${String(index[\"name\"] ?? \"<unnamed>\")}\" on table \"${tableName}\" declares ${index[\"expression\"] !== void 0 ? \"an expression\" : \"a where predicate\"}. Use a fields-only index.`, { meta: { table: tableName } });\n\t\t}\n\t}\n}\n/**\n* The namespace factory the MySQL target hands `defineContract` and the PSL interpreter. MySQL has one namespace per connection, the framework's unbound slot.\n*/\nfunction mysqlCreateNamespace(input) {\n\tif (input.id !== UNBOUND_NAMESPACE_ID) throw mysqlError(\"CONTRACT.NAMESPACE_INVALID\", `The MySQL target has one namespace, \"${UNBOUND_NAMESPACE_ID}\"; it received \"${input.id}\".`, { meta: { received: input.id } });\n\trejectSqlBodyIndexes(input);\n\treturn new MysqlDatabase(fillEnumMembers(input));\n}\n//#endregion\n//#region src/core/mysql-contract-serializer.ts\n/** The MySQL target's contract serializer: the SQL family's, with each namespace built as a `MysqlDatabase`. */\nvar MysqlContractSerializer = class extends SqlContractSerializerBase {\n\tconstructor() {\n\t\tsuper(/* @__PURE__ */ new Map(), [], createDataTypeLookup(mysqlDataTypes));\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\treturn mysqlCreateNamespace(blindCast(super.hydrateSqlNamespaceEntry(nsId, raw)));\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) namespacesJson[nsId] = {\n\t\t\tid: ns.id,\n\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t};\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: {\n\t\t\t\tstorageHash: String(storage.storageHash),\n\t\t\t\tnamespaces: namespacesJson,\n\t\t\t\t...storage.types !== void 0 ? { types: this.serializeJsonObject(storage.types) } : {}\n\t\t\t}\n\t\t});\n\t}\n};\n//#endregion\nexport { MysqlDatabase as n, mysqlCreateNamespace as r, MysqlContractSerializer as t };\n\n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B,KAAK,MAAM,CAAC,MAAM,OAAO,OAAO,QAAQ,QAAQ,UAAU,GAAG,eAAe,QAAQ;GACnF,IAAI,GAAG;GACP,SAAS,KAAK,0BAA0B,GAAG,OAAO;EACnD;EACA,OAAO,UAAU;GAChB,GAAG;GACH,SAAS;IACR,aAAa,OAAO,QAAQ,WAAW;IACvC,YAAY;IACZ,GAAG,QAAQ,UAAU,KAAK,IAAI,EAAE,OAAO,KAAK,oBAAoB,QAAQ,KAAK,EAAE,IAAI,CAAC;GACrF;EACD,CAAC;CACF;AACD"}
@@ -1,22 +0,0 @@
1
- import { Namespace } from "@prisma/orm-framework/components/ir";
2
- import { SqlNamespaceInput, SqlStorage } from "@prisma/orm-family-sql/contract/types";
3
- import { SqlContractSerializerBase } from "@prisma/orm-family-sql/family/ir";
4
- import { Contract } from "@prisma/orm-framework/contract/types";
5
- import { RuntimeTargetInstance } from "@prisma/orm-framework/components/execution";
6
- import { SqlRuntimeTargetDescriptor } from "@prisma/orm-family-sql/runtime";
7
- import { JsonObject } from "@prisma/orm-framework/utils/json";
8
- //#region ../../../3-targets/mysql/1-target/dist/runtime.d.mts
9
- //#region src/core/mysql-contract-serializer.d.ts
10
- /** The MySQL target's contract serializer: the SQL family's, with each namespace built as a `MysqlDatabase`. */
11
- declare class MysqlContractSerializer extends SqlContractSerializerBase<Contract<SqlStorage>> {
12
- constructor();
13
- protected hydrateSqlNamespaceEntry(nsId: string, raw: Record<string, unknown>): Namespace | SqlNamespaceInput;
14
- serializeContract(contract: Contract<SqlStorage>): JsonObject;
15
- }
16
- //#endregion
17
- //#region src/core/runtime/runtime-target.d.ts
18
- interface MysqlRuntimeTargetInstance extends RuntimeTargetInstance<'sql', 'mysql'> {}
19
- declare const mysqlRuntimeTargetDescriptor: SqlRuntimeTargetDescriptor<'mysql', MysqlRuntimeTargetInstance>;
20
- //#endregion
21
- export { MysqlRuntimeTargetInstance as n, mysqlRuntimeTargetDescriptor as r, MysqlContractSerializer as t };
22
- //# sourceMappingURL=runtime-Cl0BbTZq.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-Cl0BbTZq.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-target/dist/runtime.d.mts"],"mappings":";;;;;;;;;;cASc,gCAAgC,0BAA0B,SAAS;EAC/E;YACU,yBAAyB,cAAc,KAAK,0BAA0B,YAAY;EAC5F,kBAAkB,UAAU,SAAS,cAAc;;;;UAI3C,mCAAmC;cAC/B,8BAA8B,oCAAoC"}