@prisma/orm-target-mysql 8.0.0-rc.24-dev.27 → 8.0.0-rc.24-dev.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-D4QpAe2i.d.mts +374 -0
- package/dist/adapter-D4QpAe2i.d.mts.map +1 -0
- package/dist/adapter.d.mts +8 -6
- package/dist/adapter.mjs +5 -3
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__codec-types.d.mts +2 -2
- package/dist/adapter__control.d.mts +1 -1
- package/dist/adapter__control.mjs +1 -1
- package/dist/adapter__runtime.d.mts +2 -2
- package/dist/adapter__runtime.mjs +2 -501
- package/dist/adapter__sql-renderer.d.mts +3 -0
- package/dist/adapter__sql-renderer.mjs +2 -0
- package/dist/aggregates-BK8qyA2x.d.mts +164 -0
- package/dist/aggregates-BK8qyA2x.d.mts.map +1 -0
- package/dist/aggregates-Bk6CCgQ-.mjs +145 -0
- package/dist/aggregates-Bk6CCgQ-.mjs.map +1 -0
- package/dist/codec-descriptor-B1fMmxOK-D59zKJws.d.mts +1 -0
- package/dist/{codec-descriptor-3xp1XvVH-DfPKpYeP.mjs → codec-descriptor-ByN7iIha-48yW7oDN.mjs} +23 -16
- package/dist/codec-descriptor-ByN7iIha-48yW7oDN.mjs.map +1 -0
- package/dist/codec-descriptor-CqM_hQjY.d.mts +2 -0
- package/dist/{codec-descriptor-DXyubAS6-XDBj6Yet.d.mts → codec-descriptor-DXsJwUng-D4abEAFs.d.mts} +10 -5
- package/dist/codec-descriptor-DXsJwUng-D4abEAFs.d.mts.map +1 -0
- package/dist/codec-ids-DHeJ2SMJ-Uz1FAFmQ.d.mts +26 -0
- package/dist/codec-ids-DHeJ2SMJ-Uz1FAFmQ.d.mts.map +1 -0
- package/dist/codec-ids-DuWt4aOn-DiyLf9dW.mjs +26 -0
- package/dist/codec-ids-DuWt4aOn-DiyLf9dW.mjs.map +1 -0
- package/dist/codec-types-BQBBUlf_.d.mts +1 -0
- package/dist/{codec-types-Bai_CFkk-DmZ74URd.d.mts → codec-types-C4Q_JJgX-CUPkvPDx.d.mts} +11 -5
- package/dist/codec-types-C4Q_JJgX-CUPkvPDx.d.mts.map +1 -0
- package/dist/codec-types-DxSSgcpB.d.mts +1 -0
- package/dist/{codecs-BMidk26M-B_iWNti6.d.mts → codecs-D35fqdXJ-BZwilYUu.d.mts} +115 -7
- package/dist/codecs-D35fqdXJ-BZwilYUu.d.mts.map +1 -0
- package/dist/{codecs-CIJRyUd3.d.mts → codecs-DTfUoamS.d.mts} +3 -3
- package/dist/{codecs-CIJRyUd3.d.mts.map → codecs-DTfUoamS.d.mts.map} +1 -1
- package/dist/{codecs-wVJlFapM.mjs → codecs-DVX-3El1.mjs} +429 -12
- package/dist/codecs-DVX-3El1.mjs.map +1 -0
- package/dist/{control-Dj8nIA1M.d.mts → control-B7v7zc3l.d.mts} +272 -13
- package/dist/control-B7v7zc3l.d.mts.map +1 -0
- package/dist/{control-D7_IpeiU.d.mts → control-BFe8NrSk.d.mts} +22 -5
- package/dist/control-BFe8NrSk.d.mts.map +1 -0
- package/dist/{control-BiZaCqna.mjs → control-BTolgwH5.mjs} +28 -13
- package/dist/control-BTolgwH5.mjs.map +1 -0
- package/dist/{control-CTfV1Zag.mjs → control-CZSBblPm.mjs} +26 -19
- package/dist/control-CZSBblPm.mjs.map +1 -0
- package/dist/{control-WNuLF2Wh.d.mts → control-DqJJGh-5.d.mts} +3 -3
- package/dist/control-DqJJGh-5.d.mts.map +1 -0
- package/dist/{control-RYDTbndD.mjs → control-DtXS4WsY.mjs} +9 -14
- package/dist/control-DtXS4WsY.mjs.map +1 -0
- package/dist/data-type-entries-DlbQ1Bvl-BFkHeHVz.mjs +108 -0
- package/dist/data-type-entries-DlbQ1Bvl-BFkHeHVz.mjs.map +1 -0
- package/dist/{data-types-65iVc7q1.d.mts → data-types-COQT9bVG.d.mts} +2 -2
- package/dist/data-types-COQT9bVG.d.mts.map +1 -0
- package/dist/data-types-CU_43cNv-CQ8eHx3H.mjs +461 -0
- package/dist/data-types-CU_43cNv-CQ8eHx3H.mjs.map +1 -0
- package/dist/{data-types-D2HAT-Qf-CSdDz1Pk.d.mts → data-types-C_vInIbm-Gt1XINav.d.mts} +58 -4
- package/dist/data-types-C_vInIbm-Gt1XINav.d.mts.map +1 -0
- package/dist/{date-time-now-generators-BKakW3gd-CIFPuRdM.mjs → date-time-now-generators-Cx_aQTSw-ay1tlvw6.mjs} +4 -15
- package/dist/date-time-now-generators-Cx_aQTSw-ay1tlvw6.mjs.map +1 -0
- package/dist/default-normalizer-C9c043DP-DPhwJOC4.mjs +175 -0
- package/dist/default-normalizer-C9c043DP-DPhwJOC4.mjs.map +1 -0
- package/dist/default-normalizer-zXWtDBp_.d.mts +31 -0
- package/dist/default-normalizer-zXWtDBp_.d.mts.map +1 -0
- package/dist/{descriptor-meta-e29H69KN-t-S8_DYh.mjs → descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs} +19 -12
- package/dist/descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs.map +1 -0
- package/dist/{descriptor-meta-BF6YvSag-ChHHvlHc.mjs → descriptor-meta-BHSEcFWR-41BcRcOy.mjs} +219 -25
- package/dist/descriptor-meta-BHSEcFWR-41BcRcOy.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs +17 -0
- package/dist/descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-DEKunXiL.d.mts +22 -0
- package/dist/descriptor-meta-runtime-DEKunXiL.d.mts.map +1 -0
- package/dist/driver.d.mts +3 -3
- package/dist/driver.mjs +2 -2
- package/dist/driver__control.d.mts +2 -2
- package/dist/driver__control.mjs +1 -1
- package/dist/driver__runtime.d.mts +2 -2
- package/dist/driver__runtime.mjs +1 -1
- package/dist/{errors-DjCkC9IM.d.mts → errors-B81Qeu5_.d.mts} +3 -2
- package/dist/errors-B81Qeu5_.d.mts.map +1 -0
- package/dist/{errors-Cng94tYg-DTH51xWG.mjs → errors-CWtFTnst-xBLJ-9Lp.mjs} +43 -17
- package/dist/errors-CWtFTnst-xBLJ-9Lp.mjs.map +1 -0
- package/dist/{marker-lock-Bwew7cAs-ElLxlCQp.mjs → marker-lock-B7CyXf2F-CakjZnQP.mjs} +3 -3
- package/dist/{marker-lock-Bwew7cAs-ElLxlCQp.mjs.map → marker-lock-B7CyXf2F-CakjZnQP.mjs.map} +1 -1
- package/dist/{marker-read-D1hp62hF-3-4fEgDD.mjs → marker-read-D1hp62hF-BSXs2TVo.mjs} +3 -3
- package/dist/{marker-read-D1hp62hF-3-4fEgDD.mjs.map → marker-read-D1hp62hF-BSXs2TVo.mjs.map} +1 -1
- package/dist/{migration-DILkj7kB.d.mts → migration-O-3NHVlW.d.mts} +2 -5
- package/dist/migration-O-3NHVlW.d.mts.map +1 -0
- package/dist/{mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs → mysql-contract-serializer-D7NjmI2L-gTs-kAW1.mjs} +4 -4
- package/dist/{mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs.map → mysql-contract-serializer-D7NjmI2L-gTs-kAW1.mjs.map} +1 -1
- package/dist/{mysql-database-CHl9-oSL-B1arvq6Q.mjs → mysql-database-ByniOtau-BKBIGgSm.mjs} +45 -17
- package/dist/mysql-database-ByniOtau-BKBIGgSm.mjs.map +1 -0
- package/dist/{now-expression-DVD18CUc-DJqdZY96.mjs → now-expression-DDHpZL6o-Ixs-vg-B.mjs} +3 -3
- package/dist/{now-expression-DVD18CUc-DJqdZY96.mjs.map → now-expression-DDHpZL6o-Ixs-vg-B.mjs.map} +1 -1
- package/dist/{pack-CqULIal0.d.mts → pack-C5_g-3YX.d.mts} +272 -11
- package/dist/{pack-CqULIal0.d.mts.map → pack-C5_g-3YX.d.mts.map} +1 -1
- package/dist/{require-temporal-DeDQhbTn-CdpjEWCB.mjs → require-temporal-DDdrgVtL-VOKxTqhD.mjs} +3 -3
- package/dist/{require-temporal-DeDQhbTn-CdpjEWCB.mjs.map → require-temporal-DDdrgVtL-VOKxTqhD.mjs.map} +1 -1
- package/dist/{runner-DEKKxDyw-Cdo1Ysod.mjs → runner-IjNtlp_v-DLCqpSh5.mjs} +68 -72
- package/dist/runner-IjNtlp_v-DLCqpSh5.mjs.map +1 -0
- package/dist/runtime-Bw6vKz9t.mjs +96 -0
- package/dist/runtime-Bw6vKz9t.mjs.map +1 -0
- package/dist/{runtime-DB0w8R7i.mjs → runtime-CHWztV6c.mjs} +66 -46
- package/dist/runtime-CHWztV6c.mjs.map +1 -0
- package/dist/{runtime-DN20lWEg.d.mts → runtime-CQ1V-8Yh.d.mts} +11 -4
- package/dist/runtime-CQ1V-8Yh.d.mts.map +1 -0
- package/dist/{runtime-CbqytTbM.d.mts → runtime-Ci3hPz1j.d.mts} +16 -5
- package/dist/runtime-Ci3hPz1j.d.mts.map +1 -0
- package/dist/{runtime-DUDdsFyy.mjs → runtime-_c_DZuYR.mjs} +18 -13
- package/dist/runtime-_c_DZuYR.mjs.map +1 -0
- package/dist/runtime-dn4-kzZV.d.mts +43 -0
- package/dist/runtime-dn4-kzZV.d.mts.map +1 -0
- package/dist/sql-renderer-CrnJ8cCo.d.mts +1 -0
- package/dist/sql-renderer-DfPaqPkD-DFaweHvr.mjs +501 -0
- package/dist/sql-renderer-DfPaqPkD-DFaweHvr.mjs.map +1 -0
- package/dist/sql-renderer-fnDhRUHs-CcsyIaZ4.d.mts +95 -0
- package/dist/sql-renderer-fnDhRUHs-CcsyIaZ4.d.mts.map +1 -0
- package/dist/{sql-utils-Cmv_TVa8-CNW3UmfQ.mjs → sql-utils-CveZhawQ-B2QmUlY0.mjs} +3 -3
- package/dist/{sql-utils-Cmv_TVa8-CNW3UmfQ.mjs.map → sql-utils-CveZhawQ-B2QmUlY0.mjs.map} +1 -1
- package/dist/{sql-utils-BE8tDXHs.mjs → sql-utils-DVH8boEI.mjs} +3 -6
- package/dist/sql-utils-DVH8boEI.mjs.map +1 -0
- package/dist/{statement-CT5tB4uX-CHqHFM3z.mjs → statement-a2Eekpu6-BDJa255m.mjs} +73 -67
- package/dist/statement-a2Eekpu6-BDJa255m.mjs.map +1 -0
- package/dist/target.d.mts +18 -16
- package/dist/target.mjs +21 -19
- package/dist/target__aggregates.d.mts +2 -0
- package/dist/target__aggregates.mjs +2 -0
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-ids.d.mts +2 -2
- package/dist/target__codec-ids.mjs +2 -2
- package/dist/target__codec-types.d.mts +2 -2
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__control.d.mts +1 -1
- package/dist/target__control.mjs +2 -2
- package/dist/target__data-types.d.mts +3 -3
- package/dist/target__data-types.mjs +3 -3
- package/dist/target__default-normalizer.d.mts +2 -2
- package/dist/target__default-normalizer.mjs +2 -2
- package/dist/target__descriptor-meta-runtime.d.mts +2 -0
- package/dist/target__descriptor-meta-runtime.mjs +2 -0
- package/dist/target__errors.d.mts +1 -1
- package/dist/target__errors.mjs +1 -1
- package/dist/target__marker-lock.mjs +1 -1
- package/dist/target__migration.d.mts +1 -1
- package/dist/target__migration.mjs +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__runtime.d.mts +2 -2
- package/dist/target__runtime.mjs +4 -4
- package/dist/target__sql-utils.mjs +2 -2
- package/dist/target__types.mjs +1 -1
- package/package.json +13 -10
- package/dist/adapter-1Kd67Gfa.d.mts +0 -66
- package/dist/adapter-1Kd67Gfa.d.mts.map +0 -1
- package/dist/adapter__runtime.mjs.map +0 -1
- package/dist/codec-descriptor-3xp1XvVH-DfPKpYeP.mjs.map +0 -1
- package/dist/codec-descriptor-BRcKIX3h.d.mts +0 -2
- package/dist/codec-descriptor-DXyubAS6-XDBj6Yet.d.mts.map +0 -1
- package/dist/codec-descriptor-J3TP08l8-BmdgkIU6.d.mts +0 -1
- package/dist/codec-ids-CrR9Xi7r-CjbGCS3o.mjs +0 -20
- package/dist/codec-ids-CrR9Xi7r-CjbGCS3o.mjs.map +0 -1
- package/dist/codec-ids-Dgh5IpML-DGXIq6j8.d.mts +0 -20
- package/dist/codec-ids-Dgh5IpML-DGXIq6j8.d.mts.map +0 -1
- package/dist/codec-types-BS-lWfda.d.mts +0 -1
- package/dist/codec-types-Bai_CFkk-DmZ74URd.d.mts.map +0 -1
- package/dist/codec-types-Dk2h5dBB.d.mts +0 -1
- package/dist/codecs-BMidk26M-B_iWNti6.d.mts.map +0 -1
- package/dist/codecs-wVJlFapM.mjs.map +0 -1
- package/dist/control-BiZaCqna.mjs.map +0 -1
- package/dist/control-CTfV1Zag.mjs.map +0 -1
- package/dist/control-D7_IpeiU.d.mts.map +0 -1
- package/dist/control-Dj8nIA1M.d.mts.map +0 -1
- package/dist/control-RYDTbndD.mjs.map +0 -1
- package/dist/control-WNuLF2Wh.d.mts.map +0 -1
- package/dist/data-type-entries-C7VH2IHc-DM6TbTaz.mjs +0 -59
- package/dist/data-type-entries-C7VH2IHc-DM6TbTaz.mjs.map +0 -1
- package/dist/data-types-65iVc7q1.d.mts.map +0 -1
- package/dist/data-types-D2HAT-Qf-CSdDz1Pk.d.mts.map +0 -1
- package/dist/data-types-DOaaPS93-lycGybNk.mjs +0 -289
- package/dist/data-types-DOaaPS93-lycGybNk.mjs.map +0 -1
- package/dist/date-time-now-generators-BKakW3gd-CIFPuRdM.mjs.map +0 -1
- package/dist/default-normalizer-C8pc7SbL-BXd70q02.mjs +0 -100
- package/dist/default-normalizer-C8pc7SbL-BXd70q02.mjs.map +0 -1
- package/dist/default-normalizer-D-8Ii0df.d.mts +0 -27
- package/dist/default-normalizer-D-8Ii0df.d.mts.map +0 -1
- package/dist/descriptor-meta-BF6YvSag-ChHHvlHc.mjs.map +0 -1
- package/dist/descriptor-meta-e29H69KN-t-S8_DYh.mjs.map +0 -1
- package/dist/errors-Cng94tYg-DTH51xWG.mjs.map +0 -1
- package/dist/errors-DjCkC9IM.d.mts.map +0 -1
- package/dist/migration-DILkj7kB.d.mts.map +0 -1
- package/dist/mysql-database-CHl9-oSL-B1arvq6Q.mjs.map +0 -1
- package/dist/runner-DEKKxDyw-Cdo1Ysod.mjs.map +0 -1
- package/dist/runtime-CbqytTbM.d.mts.map +0 -1
- package/dist/runtime-Cm-T3hbP.d.mts +0 -29
- package/dist/runtime-Cm-T3hbP.d.mts.map +0 -1
- package/dist/runtime-DB0w8R7i.mjs.map +0 -1
- package/dist/runtime-DN20lWEg.d.mts.map +0 -1
- package/dist/runtime-DUDdsFyy.mjs.map +0 -1
- package/dist/sql-utils-BE8tDXHs.mjs.map +0 -1
- package/dist/statement-CT5tB4uX-CHqHFM3z.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-time-now-generators-Cx_aQTSw-ay1tlvw6.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/date-time-now-generators-Cx_aQTSw.mjs"],"sourcesContent":["import { t as requireTemporal } from \"./require-temporal-DDdrgVtL.mjs\";\nimport * as nowValues from \"@internal/type-implementations/now\";\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, fractionDigitsOf } from \"@internal/type-implementations/now\";\n//#region src/core/date-time-now-generators.ts\n/** The fraction digits of a bare `datetime`, `timestamp` or `time`. */\nconst BARE_TYPE_FRACTION_DIGITS = 0;\nfunction fractionDigits(params) {\n\treturn fractionDigitsOf(params, BARE_TYPE_FRACTION_DIGITS);\n}\nfunction instantNow(params) {\n\treturn nowValues.instantNow(requireTemporal({ generatorId: INSTANT_NOW_GENERATOR_ID }), fractionDigits(params));\n}\nfunction plainDateNow() {\n\treturn nowValues.plainDateNow(requireTemporal({ generatorId: PLAIN_DATE_NOW_GENERATOR_ID }));\n}\nfunction plainTimeNow(params) {\n\treturn nowValues.plainTimeNow(requireTemporal({ generatorId: PLAIN_TIME_NOW_GENERATOR_ID }), fractionDigits(params));\n}\nfunction instantStringNow(params) {\n\treturn nowValues.instantStringNow(fractionDigits(params), \"trimmed\");\n}\nfunction timeStringNow(params) {\n\treturn nowValues.timeStringNow(fractionDigits(params), \"trimmed\");\n}\n/**\n* The MySQL \"now\" generators, one per date and time codec except `mysql/datetime@1` and `mysql/timestamp-date@1`, which use the SQL family's `timestampNow`. All read the clock through `Date.now()` and write UTC. Each rounds down to the column's `precision` param, so MySQL, which rounds a value to the column's fraction digits, stores the value the client holds rather than rounding it up. The string generators write the text their codec reads, with no trailing zeros in the fraction.\n*/\nconst mysqlNowGenerators = [\n\t{\n\t\tid: INSTANT_NOW_GENERATOR_ID,\n\t\tgenerate: instantNow\n\t},\n\t{\n\t\tid: PLAIN_DATE_NOW_GENERATOR_ID,\n\t\tgenerate: plainDateNow\n\t},\n\t{\n\t\tid: PLAIN_TIME_NOW_GENERATOR_ID,\n\t\tgenerate: plainTimeNow\n\t},\n\t{\n\t\tid: INSTANT_STRING_NOW_GENERATOR_ID,\n\t\tgenerate: instantStringNow\n\t},\n\t{\n\t\tid: DATE_STRING_NOW_GENERATOR_ID,\n\t\tgenerate: nowValues.dateStringNow\n\t},\n\t{\n\t\tid: TIME_STRING_NOW_GENERATOR_ID,\n\t\tgenerate: timeStringNow\n\t}\n];\n//#endregion\nexport { mysqlNowGenerators as t };\n\n//# sourceMappingURL=date-time-now-generators-Cx_aQTSw.mjs.map"],"mappings":";;;;;AAKA,MAAM,4BAA4B;AAClC,SAAS,eAAe,QAAQ;CAC/B,OAAO,iBAAiB,QAAQ,yBAAyB;AAC1D;AACA,SAAS,WAAW,QAAQ;CAC3B,OAAO,UAAU,WAAW,gBAAgB,EAAE,aAAa,yBAAyB,CAAC,GAAG,eAAe,MAAM,CAAC;AAC/G;AACA,SAAS,eAAe;CACvB,OAAO,UAAU,aAAa,gBAAgB,EAAE,aAAa,4BAA4B,CAAC,CAAC;AAC5F;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,UAAU,aAAa,gBAAgB,EAAE,aAAa,4BAA4B,CAAC,GAAG,eAAe,MAAM,CAAC;AACpH;AACA,SAAS,iBAAiB,QAAQ;CACjC,OAAO,UAAU,iBAAiB,eAAe,MAAM,GAAG,SAAS;AACpE;AACA,SAAS,cAAc,QAAQ;CAC9B,OAAO,UAAU,cAAc,eAAe,MAAM,GAAG,SAAS;AACjE;;;;AAIA,MAAM,qBAAqB;CAC1B;EACC,IAAI;EACJ,UAAU;CACX;CACA;EACC,IAAI;EACJ,UAAU;CACX;CACA;EACC,IAAI;EACJ,UAAU;CACX;CACA;EACC,IAAI;EACJ,UAAU;CACX;CACA;EACC,IAAI;EACJ,UAAU,UAAU;CACrB;CACA;EACC,IAAI;EACJ,UAAU;CACX;AACD"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { i as mysqlCurrentValueFor, n as MYSQL_INSTANT_NOW, r as MYSQL_TIME_NOW, t as MYSQL_DATE_NOW } from "./now-expression-DDHpZL6o-Ixs-vg-B.mjs";
|
|
2
|
+
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/default-normalizer-C9c043DP.mjs
|
|
3
|
+
const AUTOINCREMENT = {
|
|
4
|
+
kind: "function",
|
|
5
|
+
expression: "autoincrement()"
|
|
6
|
+
};
|
|
7
|
+
const CURRENT_TIMESTAMP = /^(?:current_timestamp|now|localtime|localtimestamp)(?:\s*\(\s*\d*\s*\))?$/i;
|
|
8
|
+
const CURRENT_DATE = /^(?:curdate|current_date)(?:\s*\(\s*\))?$/i;
|
|
9
|
+
const CURRENT_TIME = /^(?:curtime|current_time)(?:\s*\(\s*\d*\s*\))?$/i;
|
|
10
|
+
/** The name of the current value `expression` writes: `now()` for the current instant, and its own name for the current date and the current time of day, which hold different values. `undefined` for any other expression. */
|
|
11
|
+
function currentValueNamed(expression) {
|
|
12
|
+
if (CURRENT_TIMESTAMP.test(expression)) return MYSQL_INSTANT_NOW;
|
|
13
|
+
if (CURRENT_DATE.test(expression)) return MYSQL_DATE_NOW;
|
|
14
|
+
if (CURRENT_TIME.test(expression)) return MYSQL_TIME_NOW;
|
|
15
|
+
}
|
|
16
|
+
const SQL_ESCAPES = {
|
|
17
|
+
"0": "\0",
|
|
18
|
+
b: "\b",
|
|
19
|
+
n: "\n",
|
|
20
|
+
r: "\r",
|
|
21
|
+
t: " ",
|
|
22
|
+
Z: ""
|
|
23
|
+
};
|
|
24
|
+
const INTRODUCED_STRING = /^_([A-Za-z0-9]+)'/;
|
|
25
|
+
const HEX_LITERAL = /^(?:0x((?:[0-9A-Fa-f]{2})*)|X'((?:[0-9A-Fa-f]{2})*)')$/;
|
|
26
|
+
const BLOB_COLUMN_TYPE = /^(?:tiny|medium|long)?blob$/i;
|
|
27
|
+
const BINARY_COLUMN_TYPE = /^(?:varbinary\(\d+\)|binary\((\d+)\))$/i;
|
|
28
|
+
const LATIN1_LAST = 255;
|
|
29
|
+
/** The character sets whose text is UTF-8, which is what a connection to MySQL or MariaDB sends; ASCII text is the same in UTF-8 and Latin-1. */
|
|
30
|
+
const UTF8_CHARACTER_SETS = /* @__PURE__ */ new Set([
|
|
31
|
+
"utf8mb4",
|
|
32
|
+
"utf8mb3",
|
|
33
|
+
"utf8",
|
|
34
|
+
"binary"
|
|
35
|
+
]);
|
|
36
|
+
const ASCII_CHARACTER_SETS = /* @__PURE__ */ new Set(["ascii", "latin1"]);
|
|
37
|
+
/** Whether `columnType` is a blob, `binary` or `varbinary` column, whose rows the driver hands over as bytes. The driver hands `bit` and `geometry` columns over as bytes too; they are left out because no MySQL codec declares them. */
|
|
38
|
+
function isMysqlBytesColumnType(columnType) {
|
|
39
|
+
return BLOB_COLUMN_TYPE.test(columnType) || BINARY_COLUMN_TYPE.test(columnType);
|
|
40
|
+
}
|
|
41
|
+
/** Whether `columnType` is a blob column, which MySQL gives an expression default only. */
|
|
42
|
+
function isMysqlBlobColumnType(columnType) {
|
|
43
|
+
return BLOB_COLUMN_TYPE.test(columnType);
|
|
44
|
+
}
|
|
45
|
+
function withoutBackslashEscapes(text) {
|
|
46
|
+
return text.replace(/\\(.)/gs, "$1");
|
|
47
|
+
}
|
|
48
|
+
/** The text of a MySQL string literal whose opening quote ends `start`, when the literal runs to the end of `text`. */
|
|
49
|
+
function stringLiteralBody(text, start) {
|
|
50
|
+
let body = "";
|
|
51
|
+
for (let index = start; index < text.length; index += 1) {
|
|
52
|
+
const char = text.charAt(index);
|
|
53
|
+
if (char === "\\") {
|
|
54
|
+
index += 1;
|
|
55
|
+
const escaped = text.charAt(index);
|
|
56
|
+
body += escaped === "%" || escaped === "_" ? `\\${escaped}` : SQL_ESCAPES[escaped] ?? escaped;
|
|
57
|
+
} else if (char === "'" && text.charAt(index + 1) === "'") {
|
|
58
|
+
body += "'";
|
|
59
|
+
index += 1;
|
|
60
|
+
} else if (char === "'") return index === text.length - 1 ? body : void 0;
|
|
61
|
+
else body += char;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function utf8Text(bytes) {
|
|
65
|
+
try {
|
|
66
|
+
return new TextDecoder("utf-8", {
|
|
67
|
+
fatal: true,
|
|
68
|
+
ignoreBOM: true
|
|
69
|
+
}).decode(bytes);
|
|
70
|
+
} catch {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The bytes of an expression default, which MySQL reports with each byte shown as the Latin-1 character of the same value: `_utf8mb4'é'` is reported `_utf8mb4\'é\'`. Text with a character past Latin-1 is not in that form and is taken as written.
|
|
76
|
+
*/
|
|
77
|
+
function expressionBytes(reported) {
|
|
78
|
+
const latin1 = [...reported].every((char) => (char.codePointAt(0) ?? 0) <= LATIN1_LAST);
|
|
79
|
+
return Buffer.from(reported, latin1 ? "latin1" : "utf8");
|
|
80
|
+
}
|
|
81
|
+
/** One byte for each character of `bytes`, so a pattern can read the ASCII of an expression without decoding the rest. */
|
|
82
|
+
function asByteText(bytes) {
|
|
83
|
+
return Buffer.from(bytes).toString("latin1");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The value of a string literal with a character set introducer, such as `_utf8mb4'abc'`, the form MySQL reports a literal default on a text, blob or JSON column in: its bytes on a bytes column, and its text on any other. `undefined` for any other expression, and for a literal in a character set other than UTF-8, or Latin-1 and ASCII holding ASCII only, which the reader does not convert.
|
|
87
|
+
*/
|
|
88
|
+
function introducedStringValue(byteText, bytesColumn) {
|
|
89
|
+
const expression = withoutBackslashEscapes(byteText.trim());
|
|
90
|
+
const opening = INTRODUCED_STRING.exec(expression);
|
|
91
|
+
if (opening === null) return void 0;
|
|
92
|
+
const body = stringLiteralBody(expression, opening[0].length);
|
|
93
|
+
if (body === void 0) return void 0;
|
|
94
|
+
const bytes = Buffer.from(body, "latin1");
|
|
95
|
+
const characterSet = (opening[1] ?? "").toLowerCase();
|
|
96
|
+
const ascii = bytes.every((byte) => byte < 128);
|
|
97
|
+
if (!UTF8_CHARACTER_SETS.has(characterSet) && !(ASCII_CHARACTER_SETS.has(characterSet) && ascii)) return;
|
|
98
|
+
return bytesColumn ? new Uint8Array(bytes) : utf8Text(bytes);
|
|
99
|
+
}
|
|
100
|
+
function bytesOfHex(hex) {
|
|
101
|
+
return new Uint8Array(Buffer.from(hex, "hex"));
|
|
102
|
+
}
|
|
103
|
+
function hexLiteralBytes(text) {
|
|
104
|
+
const match = HEX_LITERAL.exec(text.trim());
|
|
105
|
+
if (match === null) return void 0;
|
|
106
|
+
return bytesOfHex(match[1] ?? match[2] ?? "");
|
|
107
|
+
}
|
|
108
|
+
/** The bytes a row of a `binary(n)` column holds for `bytes`: padded with zero bytes to its length, as the server pads every value. */
|
|
109
|
+
function paddedTo(columnType, bytes) {
|
|
110
|
+
const length = Number(BINARY_COLUMN_TYPE.exec(columnType)?.[1] ?? 0);
|
|
111
|
+
if (bytes.length >= length) return bytes;
|
|
112
|
+
const padded = new Uint8Array(length);
|
|
113
|
+
padded.set(bytes);
|
|
114
|
+
return padded;
|
|
115
|
+
}
|
|
116
|
+
function extraFlags(extra) {
|
|
117
|
+
return extra.toLowerCase().split(/\s+/);
|
|
118
|
+
}
|
|
119
|
+
function literal(body) {
|
|
120
|
+
return {
|
|
121
|
+
kind: "literal",
|
|
122
|
+
literal: {
|
|
123
|
+
kind: "value",
|
|
124
|
+
body
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function expressionDefault(reported, bytesColumn) {
|
|
129
|
+
const bytes = expressionBytes(reported);
|
|
130
|
+
const byteText = asByteText(bytes);
|
|
131
|
+
const introduced = introducedStringValue(byteText, bytesColumn);
|
|
132
|
+
if (introduced !== void 0) return literal(introduced);
|
|
133
|
+
const hex = hexLiteralBytes(withoutBackslashEscapes(byteText));
|
|
134
|
+
if (hex !== void 0) return literal(hex);
|
|
135
|
+
const expression = (utf8Text(bytes) ?? reported).trim();
|
|
136
|
+
return {
|
|
137
|
+
kind: "function",
|
|
138
|
+
expression: currentValueNamed(expression) ?? expression
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** A literal default on a `binary` or `varbinary` column is kept as reported, since the report may not be the row's bytes: MySQL cuts it at its first zero byte, and MariaDB shows each byte that is not UTF-8 as `?`. */
|
|
142
|
+
function literalDefault(reported, bytesColumn) {
|
|
143
|
+
return bytesColumn ? {
|
|
144
|
+
kind: "function",
|
|
145
|
+
expression: reported
|
|
146
|
+
} : literal(reported);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Reads a column's reported default from `COLUMN_DEFAULT` and `EXTRA`, as what a row of the column hands its codec. `auto_increment` is `autoincrement()`. An expression default (`DEFAULT_GENERATED`) is a literal when it is a string with a character set introducer, such as `_utf8mb4\'abc\'`, the form MySQL reports for a literal default on a text, blob or JSON column, or a hexadecimal literal, `0x00ff`, or `X\'\'` for no bytes, the forms it reports for bytes; one that writes the current instant, such as `CURRENT_TIMESTAMP(3)`, is `now()`, and one that writes the current date or time of day, `curdate()` or `curtime(6)`, is `CURRENT_DATE` or `CURRENT_TIME`; any other is a function default kept as reported. On a bytes column, `columnType` a blob, `binary` or `varbinary`, a literal is the bytes the server stores: the bytes of a hexadecimal literal, and the UTF-8 bytes of text, padded to the length of a `binary(n)`. Any other default is a literal, except one on a `binary` or `varbinary` column, which is kept as reported because the report may not be the row's bytes. `undefined` when the column has no default.
|
|
150
|
+
*/
|
|
151
|
+
function readMysqlDefault(columnDefault, extra, columnType) {
|
|
152
|
+
const flags = extraFlags(extra);
|
|
153
|
+
if (flags.includes("auto_increment")) return AUTOINCREMENT;
|
|
154
|
+
if (columnDefault === null) return void 0;
|
|
155
|
+
const bytesColumn = isMysqlBytesColumnType(columnType);
|
|
156
|
+
const read = flags.includes("default_generated") ? expressionDefault(columnDefault, bytesColumn) : literalDefault(columnDefault, bytesColumn);
|
|
157
|
+
if (read.kind === "literal" && read.literal.body instanceof Uint8Array && bytesColumn) return literal(paddedTo(columnType, read.literal.body));
|
|
158
|
+
return read;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 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. A `now()` default is named as the current value its column's data type writes, so a `now()` on a `date` column and one on a `datetime` column differ, as the values they write do. Every other default passes through unchanged.
|
|
162
|
+
*/
|
|
163
|
+
function mysqlResolveDefault(def, column) {
|
|
164
|
+
if (def.kind !== "function") return def;
|
|
165
|
+
const expression = def.expression.trim();
|
|
166
|
+
const named = expression === "now()" ? mysqlCurrentValueFor(column.dataTypeId) : currentValueNamed(expression);
|
|
167
|
+
return named === void 0 ? def : {
|
|
168
|
+
kind: "function",
|
|
169
|
+
expression: named
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
export { readMysqlDefault as i, isMysqlBytesColumnType as n, mysqlResolveDefault as r, isMysqlBlobColumnType as t };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=default-normalizer-C9c043DP-DPhwJOC4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-C9c043DP-DPhwJOC4.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/default-normalizer-C9c043DP.mjs"],"sourcesContent":["import { i as mysqlCurrentValueFor, n as MYSQL_INSTANT_NOW, r as MYSQL_TIME_NOW, t as MYSQL_DATE_NOW } from \"./now-expression-DDHpZL6o.mjs\";\n//#region src/core/default-normalizer.ts\nconst AUTOINCREMENT = {\n\tkind: \"function\",\n\texpression: \"autoincrement()\"\n};\nconst CURRENT_TIMESTAMP = /^(?:current_timestamp|now|localtime|localtimestamp)(?:\\s*\\(\\s*\\d*\\s*\\))?$/i;\nconst CURRENT_DATE = /^(?:curdate|current_date)(?:\\s*\\(\\s*\\))?$/i;\nconst CURRENT_TIME = /^(?:curtime|current_time)(?:\\s*\\(\\s*\\d*\\s*\\))?$/i;\n/** The name of the current value `expression` writes: `now()` for the current instant, and its own name for the current date and the current time of day, which hold different values. `undefined` for any other expression. */\nfunction currentValueNamed(expression) {\n\tif (CURRENT_TIMESTAMP.test(expression)) return MYSQL_INSTANT_NOW;\n\tif (CURRENT_DATE.test(expression)) return MYSQL_DATE_NOW;\n\tif (CURRENT_TIME.test(expression)) return MYSQL_TIME_NOW;\n}\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]+)'/;\nconst HEX_LITERAL = /^(?:0x((?:[0-9A-Fa-f]{2})*)|X'((?:[0-9A-Fa-f]{2})*)')$/;\nconst BLOB_COLUMN_TYPE = /^(?:tiny|medium|long)?blob$/i;\nconst BINARY_COLUMN_TYPE = /^(?:varbinary\\(\\d+\\)|binary\\((\\d+)\\))$/i;\nconst LATIN1_LAST = 255;\n/** The character sets whose text is UTF-8, which is what a connection to MySQL or MariaDB sends; ASCII text is the same in UTF-8 and Latin-1. */\nconst UTF8_CHARACTER_SETS = /* @__PURE__ */ new Set([\n\t\"utf8mb4\",\n\t\"utf8mb3\",\n\t\"utf8\",\n\t\"binary\"\n]);\nconst ASCII_CHARACTER_SETS = /* @__PURE__ */ new Set([\"ascii\", \"latin1\"]);\n/** Whether `columnType` is a blob, `binary` or `varbinary` column, whose rows the driver hands over as bytes. The driver hands `bit` and `geometry` columns over as bytes too; they are left out because no MySQL codec declares them. */\nfunction isMysqlBytesColumnType(columnType) {\n\treturn BLOB_COLUMN_TYPE.test(columnType) || BINARY_COLUMN_TYPE.test(columnType);\n}\n/** Whether `columnType` is a blob column, which MySQL gives an expression default only. */\nfunction isMysqlBlobColumnType(columnType) {\n\treturn BLOB_COLUMN_TYPE.test(columnType);\n}\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}\nfunction utf8Text(bytes) {\n\ttry {\n\t\treturn new TextDecoder(\"utf-8\", {\n\t\t\tfatal: true,\n\t\t\tignoreBOM: true\n\t\t}).decode(bytes);\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* The bytes of an expression default, which MySQL reports with each byte shown as the Latin-1 character of the same value: `_utf8mb4'é'` is reported `_utf8mb4\\'é\\'`. Text with a character past Latin-1 is not in that form and is taken as written.\n*/\nfunction expressionBytes(reported) {\n\tconst latin1 = [...reported].every((char) => (char.codePointAt(0) ?? 0) <= LATIN1_LAST);\n\treturn Buffer.from(reported, latin1 ? \"latin1\" : \"utf8\");\n}\n/** One byte for each character of `bytes`, so a pattern can read the ASCII of an expression without decoding the rest. */\nfunction asByteText(bytes) {\n\treturn Buffer.from(bytes).toString(\"latin1\");\n}\n/**\n* The value of a string literal with a character set introducer, such as `_utf8mb4'abc'`, the form MySQL reports a literal default on a text, blob or JSON column in: its bytes on a bytes column, and its text on any other. `undefined` for any other expression, and for a literal in a character set other than UTF-8, or Latin-1 and ASCII holding ASCII only, which the reader does not convert.\n*/\nfunction introducedStringValue(byteText, bytesColumn) {\n\tconst expression = withoutBackslashEscapes(byteText.trim());\n\tconst opening = INTRODUCED_STRING.exec(expression);\n\tif (opening === null) return void 0;\n\tconst body = stringLiteralBody(expression, opening[0].length);\n\tif (body === void 0) return void 0;\n\tconst bytes = Buffer.from(body, \"latin1\");\n\tconst characterSet = (opening[1] ?? \"\").toLowerCase();\n\tconst ascii = bytes.every((byte) => byte < 128);\n\tif (!UTF8_CHARACTER_SETS.has(characterSet) && !(ASCII_CHARACTER_SETS.has(characterSet) && ascii)) return;\n\treturn bytesColumn ? new Uint8Array(bytes) : utf8Text(bytes);\n}\nfunction bytesOfHex(hex) {\n\treturn new Uint8Array(Buffer.from(hex, \"hex\"));\n}\nfunction hexLiteralBytes(text) {\n\tconst match = HEX_LITERAL.exec(text.trim());\n\tif (match === null) return void 0;\n\treturn bytesOfHex(match[1] ?? match[2] ?? \"\");\n}\n/** The bytes a row of a `binary(n)` column holds for `bytes`: padded with zero bytes to its length, as the server pads every value. */\nfunction paddedTo(columnType, bytes) {\n\tconst length = Number(BINARY_COLUMN_TYPE.exec(columnType)?.[1] ?? 0);\n\tif (bytes.length >= length) return bytes;\n\tconst padded = new Uint8Array(length);\n\tpadded.set(bytes);\n\treturn padded;\n}\nfunction extraFlags(extra) {\n\treturn extra.toLowerCase().split(/\\s+/);\n}\nfunction literal(body) {\n\treturn {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody\n\t\t}\n\t};\n}\nfunction expressionDefault(reported, bytesColumn) {\n\tconst bytes = expressionBytes(reported);\n\tconst byteText = asByteText(bytes);\n\tconst introduced = introducedStringValue(byteText, bytesColumn);\n\tif (introduced !== void 0) return literal(introduced);\n\tconst hex = hexLiteralBytes(withoutBackslashEscapes(byteText));\n\tif (hex !== void 0) return literal(hex);\n\tconst expression = (utf8Text(bytes) ?? reported).trim();\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: currentValueNamed(expression) ?? expression\n\t};\n}\n/** A literal default on a `binary` or `varbinary` column is kept as reported, since the report may not be the row's bytes: MySQL cuts it at its first zero byte, and MariaDB shows each byte that is not UTF-8 as `?`. */\nfunction literalDefault(reported, bytesColumn) {\n\treturn bytesColumn ? {\n\t\tkind: \"function\",\n\t\texpression: reported\n\t} : literal(reported);\n}\n/**\n* Reads a column's reported default from `COLUMN_DEFAULT` and `EXTRA`, as what a row of the column hands its codec. `auto_increment` is `autoincrement()`. An expression default (`DEFAULT_GENERATED`) is a literal when it is a string with a character set introducer, such as `_utf8mb4\\'abc\\'`, the form MySQL reports for a literal default on a text, blob or JSON column, or a hexadecimal literal, `0x00ff`, or `X\\'\\'` for no bytes, the forms it reports for bytes; one that writes the current instant, such as `CURRENT_TIMESTAMP(3)`, is `now()`, and one that writes the current date or time of day, `curdate()` or `curtime(6)`, is `CURRENT_DATE` or `CURRENT_TIME`; any other is a function default kept as reported. On a bytes column, `columnType` a blob, `binary` or `varbinary`, a literal is the bytes the server stores: the bytes of a hexadecimal literal, and the UTF-8 bytes of text, padded to the length of a `binary(n)`. Any other default is a literal, except one on a `binary` or `varbinary` column, which is kept as reported because the report may not be the row's bytes. `undefined` when the column has no default.\n*/\nfunction readMysqlDefault(columnDefault, extra, columnType) {\n\tconst flags = extraFlags(extra);\n\tif (flags.includes(\"auto_increment\")) return AUTOINCREMENT;\n\tif (columnDefault === null) return void 0;\n\tconst bytesColumn = isMysqlBytesColumnType(columnType);\n\tconst read = flags.includes(\"default_generated\") ? expressionDefault(columnDefault, bytesColumn) : literalDefault(columnDefault, bytesColumn);\n\tif (read.kind === \"literal\" && read.literal.body instanceof Uint8Array && bytesColumn) return literal(paddedTo(columnType, read.literal.body));\n\treturn read;\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. A `now()` default is named as the current value its column's data type writes, so a `now()` on a `date` column and one on a `datetime` column differ, as the values they write do. Every other default passes through unchanged.\n*/\nfunction mysqlResolveDefault(def, column) {\n\tif (def.kind !== \"function\") return def;\n\tconst expression = def.expression.trim();\n\tconst named = expression === \"now()\" ? mysqlCurrentValueFor(column.dataTypeId) : currentValueNamed(expression);\n\treturn named === void 0 ? def : {\n\t\tkind: \"function\",\n\t\texpression: named\n\t};\n}\n//#endregion\nexport { readMysqlDefault as i, isMysqlBytesColumnType as n, mysqlResolveDefault as r, isMysqlBlobColumnType as t };\n\n//# sourceMappingURL=default-normalizer-C9c043DP.mjs.map"],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DefaultResolverColumn, ReportedLiteralDefault } from "@prisma/orm-family-sql/family/control";
|
|
2
|
+
import { ColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
3
|
+
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/default-normalizer.d.mts
|
|
4
|
+
//#region src/core/default-normalizer.d.ts
|
|
5
|
+
/** What a column's reported default is: a function, or a literal the column's codec reads. */
|
|
6
|
+
type MysqlReportedDefault = {
|
|
7
|
+
readonly kind: 'function';
|
|
8
|
+
readonly expression: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'literal';
|
|
11
|
+
readonly literal: Extract<ReportedLiteralDefault, {
|
|
12
|
+
readonly kind: 'value';
|
|
13
|
+
}> & {
|
|
14
|
+
readonly body: string | Uint8Array;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/** Whether `columnType` is a blob, `binary` or `varbinary` column, whose rows the driver hands over as bytes. The driver hands `bit` and `geometry` columns over as bytes too; they are left out because no MySQL codec declares them. */
|
|
18
|
+
declare function isMysqlBytesColumnType(columnType: string): boolean;
|
|
19
|
+
/** Whether `columnType` is a blob column, which MySQL gives an expression default only. */
|
|
20
|
+
declare function isMysqlBlobColumnType(columnType: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Reads a column's reported default from `COLUMN_DEFAULT` and `EXTRA`, as what a row of the column hands its codec. `auto_increment` is `autoincrement()`. An expression default (`DEFAULT_GENERATED`) is a literal when it is a string with a character set introducer, such as `_utf8mb4\'abc\'`, the form MySQL reports for a literal default on a text, blob or JSON column, or a hexadecimal literal, `0x00ff`, or `X\'\'` for no bytes, the forms it reports for bytes; one that writes the current instant, such as `CURRENT_TIMESTAMP(3)`, is `now()`, and one that writes the current date or time of day, `curdate()` or `curtime(6)`, is `CURRENT_DATE` or `CURRENT_TIME`; any other is a function default kept as reported. On a bytes column, `columnType` a blob, `binary` or `varbinary`, a literal is the bytes the server stores: the bytes of a hexadecimal literal, and the UTF-8 bytes of text, padded to the length of a `binary(n)`. Any other default is a literal, except one on a `binary` or `varbinary` column, which is kept as reported because the report may not be the row's bytes. `undefined` when the column has no default.
|
|
23
|
+
*/
|
|
24
|
+
declare function readMysqlDefault(columnDefault: string | null, extra: string, columnType: string): MysqlReportedDefault | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* 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. A `now()` default is named as the current value its column's data type writes, so a `now()` on a `date` column and one on a `datetime` column differ, as the values they write do. Every other default passes through unchanged.
|
|
27
|
+
*/
|
|
28
|
+
declare function mysqlResolveDefault(def: ColumnDefault, column: DefaultResolverColumn): ColumnDefault;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { readMysqlDefault as a, mysqlResolveDefault as i, isMysqlBlobColumnType as n, isMysqlBytesColumnType as r, MysqlReportedDefault as t };
|
|
31
|
+
//# sourceMappingURL=default-normalizer-zXWtDBp_.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-zXWtDBp_.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/default-normalizer.d.mts"],"mappings":";;;;;KAIK;WACM;WACA;;WAEA;WACA,SAAS,QAAQ;aACf;;aAEA,eAAe;;;;iBAIX,uBAAuB;;iBAEvB,sBAAsB;;;;iBAItB,iBAAiB,8BAA8B,eAAe,qBAAqB;;;;iBAInF,oBAAoB,KAAK,eAAe,QAAQ,wBAAwB"}
|
package/dist/{descriptor-meta-e29H69KN-t-S8_DYh.mjs → descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs}
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as mysqlAggregateDescriptors } from "./aggregates-Bk6CCgQ-.mjs";
|
|
2
|
+
import { o as mysqlCodecRegistry } from "./codecs-DVX-3El1.mjs";
|
|
3
|
+
//#region ../../../3-targets/mysql/1-mysql/2-adapter/dist/descriptor-meta-BFQUMwkh.mjs
|
|
3
4
|
/** What a MySQL 8.4 server does that the SQL family asks about. `RETURNING`, `LATERAL` and conflict targets are not among them: `ON DUPLICATE KEY UPDATE` fires on any unique key. */
|
|
4
5
|
const mysqlAdapterCapabilities = Object.freeze({ sql: {
|
|
5
6
|
orderBy: true,
|
|
@@ -11,8 +12,11 @@ const mysqlAdapterCapabilities = Object.freeze({ sql: {
|
|
|
11
12
|
outerReferencesInDerivedTables: true,
|
|
12
13
|
jsonAggWithoutTruncation: true
|
|
13
14
|
} });
|
|
14
|
-
/** What this adapter adds to every contract it runs: its capabilities. `prisma contract emit` reads them through the adapter's descriptor, and the TypeScript `defineContract` passes them to the contract build. */
|
|
15
|
-
const mysqlAdapterContractContributions = {
|
|
15
|
+
/** What this adapter adds to every contract it runs: its capabilities and the aggregate overloads it lists. `prisma contract emit` reads them through the adapter's descriptor, and the TypeScript `defineContract` passes them to the contract build. */
|
|
16
|
+
const mysqlAdapterContractContributions = {
|
|
17
|
+
capabilities: mysqlAdapterCapabilities,
|
|
18
|
+
types: { aggregateDescriptors: mysqlAggregateDescriptors }
|
|
19
|
+
};
|
|
16
20
|
const mysqlAdapterDescriptorMeta = {
|
|
17
21
|
kind: "adapter",
|
|
18
22
|
familyId: "sql",
|
|
@@ -20,16 +24,19 @@ const mysqlAdapterDescriptorMeta = {
|
|
|
20
24
|
id: "mysql",
|
|
21
25
|
version: "0.0.1",
|
|
22
26
|
capabilities: mysqlAdapterContractContributions.capabilities,
|
|
23
|
-
types: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
types: {
|
|
28
|
+
aggregateDescriptors: mysqlAdapterContractContributions.types.aggregateDescriptors,
|
|
29
|
+
codecTypes: {
|
|
30
|
+
codecDescriptors: Array.from(mysqlCodecRegistry.values()),
|
|
31
|
+
import: {
|
|
32
|
+
package: `@prisma/orm-target-mysql/adapter/codec-types`,
|
|
33
|
+
named: "CodecTypes",
|
|
34
|
+
alias: "MysqlTypes"
|
|
35
|
+
}
|
|
29
36
|
}
|
|
30
|
-
}
|
|
37
|
+
}
|
|
31
38
|
};
|
|
32
39
|
//#endregion
|
|
33
40
|
export { mysqlAdapterContractContributions as n, mysqlAdapterDescriptorMeta as r, mysqlAdapterCapabilities as t };
|
|
34
41
|
|
|
35
|
-
//# sourceMappingURL=descriptor-meta-
|
|
42
|
+
//# sourceMappingURL=descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-BFQUMwkh-Bc3o-ZMV.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/descriptor-meta-BFQUMwkh.mjs"],"sourcesContent":["import { mysqlAggregateDescriptors } from \"@internal/target-mysql/aggregates\";\nimport { mysqlCodecRegistry } from \"@internal/target-mysql/codecs\";\n//#region src/core/capabilities.ts\n/** What a MySQL 8.4 server does that the SQL family asks about. `RETURNING`, `LATERAL` and conflict targets are not among them: `ON DUPLICATE KEY UPDATE` fires on any unique key. */\nconst mysqlAdapterCapabilities = Object.freeze({ sql: {\n\torderBy: true,\n\tlimit: true,\n\tforeignKeys: true,\n\tenums: true,\n\tdefaultInInsert: true,\n\tjsonAgg: true,\n\touterReferencesInDerivedTables: true,\n\tjsonAggWithoutTruncation: true\n} });\n//#endregion\n//#region src/core/contract-contributions.ts\n/** What this adapter adds to every contract it runs: its capabilities and the aggregate overloads it lists. `prisma contract emit` reads them through the adapter's descriptor, and the TypeScript `defineContract` passes them to the contract build. */\nconst mysqlAdapterContractContributions = {\n\tcapabilities: mysqlAdapterCapabilities,\n\ttypes: { aggregateDescriptors: mysqlAggregateDescriptors }\n};\n//#endregion\n//#region src/core/module-base.ts\nconst moduleBase = typeof __PRISMA_PUBLISHED_MODULE_BASE__ADAPTER_MYSQL === \"string\" ? __PRISMA_PUBLISHED_MODULE_BASE__ADAPTER_MYSQL : \"@internal/adapter-mysql\";\n//#endregion\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: {\n\t\taggregateDescriptors: mysqlAdapterContractContributions.types.aggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(mysqlCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: `${moduleBase}/codec-types`,\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"MysqlTypes\"\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\nexport { mysqlAdapterContractContributions as n, mysqlAdapterCapabilities as r, mysqlAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-BFQUMwkh.mjs.map"],"mappings":";;;;AAIA,MAAM,2BAA2B,OAAO,OAAO,EAAE,KAAK;CACrD,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;CACP,iBAAiB;CACjB,SAAS;CACT,gCAAgC;CAChC,0BAA0B;AAC3B,EAAE,CAAC;;AAIH,MAAM,oCAAoC;CACzC,cAAc;CACd,OAAO,EAAE,sBAAsB,0BAA0B;AAC1D;AAMA,MAAM,6BAA6B;CAClC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,kCAAkC;CAChD,OAAO;EACN,sBAAsB,kCAAkC,MAAM;EAC9D,YAAY;GACX,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC;GACxD,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;CACD;AACD"}
|
package/dist/{descriptor-meta-BF6YvSag-ChHHvlHc.mjs → descriptor-meta-BHSEcFWR-41BcRcOy.mjs}
RENAMED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { t as mysqlDataTypeEntries } from "./data-type-entries-
|
|
4
|
-
import {
|
|
1
|
+
import { _ as MYSQL_TIMESTAMP_DATE_CODEC_ID, a as MYSQL_DATETIME_STRING_CODEC_ID, b as MYSQL_TIME_STRING_CODEC_ID, c as MYSQL_DATE_TEMPORAL_CODEC_ID, d as MYSQL_DURATION_STRING_CODEC_ID, g as MYSQL_TEXT_CODEC_ID, h as MYSQL_LONGBLOB_CODEC_ID, i as MYSQL_DATETIME_CODEC_ID, l as MYSQL_DECIMAL_CODEC_ID, m as MYSQL_JSON_CODEC_ID, n as MYSQL_BIGINT_NUMBER_CODEC_ID, o as MYSQL_DATETIME_TEMPORAL_CODEC_ID, p as MYSQL_INT_CODEC_ID, r as MYSQL_BOOLEAN_CODEC_ID, s as MYSQL_DATE_STRING_CODEC_ID, t as MYSQL_BIGINT_CODEC_ID, u as MYSQL_DOUBLE_CODEC_ID, v as MYSQL_TIMESTAMP_STRING_CODEC_ID, x as MYSQL_TIME_TEMPORAL_CODEC_ID, y as MYSQL_TIMESTAMP_TEMPORAL_CODEC_ID } from "./codec-ids-DuWt4aOn-DiyLf9dW.mjs";
|
|
2
|
+
import { N as mysqlTextDataTypes, O as mysqlInt, r as MYSQL_WIDEST_DECIMAL } from "./data-types-CU_43cNv-CQ8eHx3H.mjs";
|
|
3
|
+
import { t as mysqlDataTypeEntries } from "./data-type-entries-DlbQ1Bvl-BFkHeHVz.mjs";
|
|
4
|
+
import { t as mysqlTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-BaIF7fOE-BX9t3rkk.mjs";
|
|
5
|
+
import { t as mysqlNowGenerators } from "./date-time-now-generators-Cx_aQTSw-ay1tlvw6.mjs";
|
|
5
6
|
import { SQL_VARCHAR_CODEC_ID } from "@prisma/orm-family-sql/relational-core/ast";
|
|
6
7
|
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
8
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
8
9
|
import { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions, sqlTargetTypeConstructors } from "@prisma/orm-family-sql/family/pack";
|
|
9
10
|
import { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from "@prisma/orm-framework/components/authoring";
|
|
10
11
|
import { singleGeneratorBinding } from "@prisma/orm-framework/components/components";
|
|
11
|
-
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/descriptor-meta-
|
|
12
|
+
//#region ../../../3-targets/mysql/1-mysql/1-target/dist/descriptor-meta-BHSEcFWR.mjs
|
|
12
13
|
/** 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
14
|
const mysqlAuthoringTypes = {
|
|
14
15
|
.../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: "mysql/int" }),
|
|
@@ -59,36 +60,229 @@ const mysqlGeneratorFunctions = [
|
|
|
59
60
|
];
|
|
60
61
|
/** The `now` generators MySQL binds. The SQL family registers the identifier generators. */
|
|
61
62
|
const mysqlGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...mysqlNowGenerators.map(({ id }) => ({ id }))];
|
|
63
|
+
/** The type of a size argument, `precision`, `scale` or `length`: an int, as for the family's `sql.Varchar(length)`. */
|
|
64
|
+
const MYSQL_SIZE_TYPE = "mysql/int";
|
|
65
|
+
const precision = {
|
|
66
|
+
kind: "value",
|
|
67
|
+
dataType: MYSQL_SIZE_TYPE,
|
|
68
|
+
name: "precision",
|
|
69
|
+
optional: true
|
|
70
|
+
};
|
|
71
|
+
const scale = {
|
|
72
|
+
kind: "value",
|
|
73
|
+
dataType: MYSQL_SIZE_TYPE,
|
|
74
|
+
name: "scale",
|
|
75
|
+
optional: true
|
|
76
|
+
};
|
|
77
|
+
const length = {
|
|
78
|
+
kind: "value",
|
|
79
|
+
dataType: MYSQL_SIZE_TYPE,
|
|
80
|
+
name: "length"
|
|
81
|
+
};
|
|
82
|
+
/** The precision and scale of `Decimal` where they are not written: the widest decimal, the column Prisma ORM 7 created. MySQL's own bare `decimal` is `decimal(10,0)`, which holds no digits after the point. Each is filled on its own, so `Decimal(precision: 40)` is `decimal(40,30)`. */
|
|
83
|
+
const MYSQL_DECIMAL_DEFAULTS = MYSQL_WIDEST_DECIMAL;
|
|
62
84
|
/**
|
|
63
|
-
*
|
|
85
|
+
* MySQL's explicit scalar types other than the date and time types. Each is named after the MySQL column type that stores it, plus the application value where that column type is read by more than one codec (`Int8BigInt` and `Int8Number`). Where that name would be a convenience name, the explicit type takes MySQL's own second name for the column type, as PostgreSQL's explicit types do: `Int4`, `Int8…`, `Float8`, `NumericString` and `Bool`. A JSON column's explicit type is `PlainJson`, as on every target. ADR 322.
|
|
64
86
|
*/
|
|
65
|
-
const
|
|
66
|
-
|
|
87
|
+
const mysqlExplicitScalarTypes = {
|
|
88
|
+
Int4: {
|
|
67
89
|
kind: "typeConstructor",
|
|
68
|
-
|
|
90
|
+
inferred: true,
|
|
91
|
+
documentation: "A signed 32-bit integer stored as MySQL int and represented as a JavaScript number.",
|
|
92
|
+
output: { codecId: MYSQL_INT_CODEC_ID }
|
|
93
|
+
},
|
|
94
|
+
Int8BigInt: {
|
|
95
|
+
kind: "typeConstructor",
|
|
96
|
+
inferred: true,
|
|
97
|
+
documentation: "A signed 64-bit integer stored as MySQL bigint and represented as a JavaScript bigint.",
|
|
98
|
+
output: { codecId: MYSQL_BIGINT_CODEC_ID }
|
|
99
|
+
},
|
|
100
|
+
Int8Number: {
|
|
101
|
+
kind: "typeConstructor",
|
|
102
|
+
documentation: "A signed 64-bit integer stored as MySQL bigint and represented as a JavaScript number within its safe integer range.",
|
|
103
|
+
output: { codecId: MYSQL_BIGINT_NUMBER_CODEC_ID }
|
|
104
|
+
},
|
|
105
|
+
Float8: {
|
|
106
|
+
kind: "typeConstructor",
|
|
107
|
+
inferred: true,
|
|
108
|
+
documentation: "A double-precision floating-point number stored as MySQL double and represented as a JavaScript number.",
|
|
109
|
+
output: { codecId: MYSQL_DOUBLE_CODEC_ID }
|
|
110
|
+
},
|
|
111
|
+
NumericString: {
|
|
112
|
+
kind: "typeConstructor",
|
|
113
|
+
inferred: true,
|
|
114
|
+
documentation: "An exact decimal number stored as MySQL decimal and represented as decimal text, with every digit the column holds after the point: 1.5 in a decimal(10,2) reads \"1.50\". `precision` is the digits the column holds, at most 65, and `scale` the digits after the point, at most 30; MySQL holds decimal(10,0) when neither is written.",
|
|
115
|
+
args: [precision, scale],
|
|
116
|
+
output: {
|
|
117
|
+
codecId: MYSQL_DECIMAL_CODEC_ID,
|
|
118
|
+
typeParams: {
|
|
119
|
+
precision: {
|
|
120
|
+
kind: "arg",
|
|
121
|
+
index: 0
|
|
122
|
+
},
|
|
123
|
+
scale: {
|
|
124
|
+
kind: "arg",
|
|
125
|
+
index: 1
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
Varchar: {
|
|
131
|
+
kind: "typeConstructor",
|
|
132
|
+
inferred: true,
|
|
133
|
+
documentation: "Text of at most `length` characters, stored as MySQL varchar. A column of at most 191 characters can be indexed.",
|
|
134
|
+
args: [length],
|
|
69
135
|
output: {
|
|
70
136
|
codecId: SQL_VARCHAR_CODEC_ID,
|
|
71
|
-
typeParams: { length:
|
|
137
|
+
typeParams: { length: {
|
|
138
|
+
kind: "arg",
|
|
139
|
+
index: 0
|
|
140
|
+
} }
|
|
72
141
|
}
|
|
73
142
|
},
|
|
74
|
-
|
|
143
|
+
Text: {
|
|
75
144
|
kind: "typeConstructor",
|
|
76
145
|
inferred: true,
|
|
77
|
-
documentation: "
|
|
78
|
-
output: { codecId:
|
|
146
|
+
documentation: "Text of up to 65,535 bytes, stored as MySQL text. MySQL cannot index a text column without a prefix length.",
|
|
147
|
+
output: { codecId: MYSQL_TEXT_CODEC_ID }
|
|
79
148
|
},
|
|
80
|
-
|
|
149
|
+
Bool: {
|
|
81
150
|
kind: "typeConstructor",
|
|
82
151
|
inferred: true,
|
|
83
|
-
documentation: "A
|
|
84
|
-
output: { codecId:
|
|
152
|
+
documentation: "A boolean stored as MySQL tinyint(1) holding 0 or 1 and represented as a JavaScript boolean. A stored value other than 0 or 1 fails to read.",
|
|
153
|
+
output: { codecId: MYSQL_BOOLEAN_CODEC_ID }
|
|
154
|
+
},
|
|
155
|
+
Longblob: {
|
|
156
|
+
kind: "typeConstructor",
|
|
157
|
+
inferred: true,
|
|
158
|
+
documentation: "Bytes stored as MySQL longblob and represented as a Uint8Array. MySQL cannot index a longblob column without a prefix length.",
|
|
159
|
+
output: { codecId: MYSQL_LONGBLOB_CODEC_ID }
|
|
160
|
+
},
|
|
161
|
+
PlainJson: {
|
|
162
|
+
kind: "typeConstructor",
|
|
163
|
+
inferred: true,
|
|
164
|
+
documentation: "A JSON document stored as MySQL json, which MariaDB stores as longtext with a json_valid check, and represented as the JSON value. A json column has no equality filter and no ordering.",
|
|
165
|
+
output: { codecId: MYSQL_JSON_CODEC_ID }
|
|
85
166
|
}
|
|
86
167
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
168
|
+
function storageOption(storage) {
|
|
169
|
+
return {
|
|
170
|
+
kind: "option",
|
|
171
|
+
name: "storage",
|
|
172
|
+
values: [storage],
|
|
173
|
+
default: storage,
|
|
174
|
+
optional: true
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The convenience types of MySQL's scalars. Each is a type choice: `storage` names the MySQL column type that stores the value and, for `BigInt`, `as` chooses the application value; `precision`, `scale` and `length` are passed on to the explicit type chosen. A bare name gives the column it gave before these were type choices, which is the column Prisma ORM 7 created. ADR 279, ADR 322.
|
|
179
|
+
*/
|
|
180
|
+
const mysqlConvenienceScalarTypes = {
|
|
181
|
+
Int: {
|
|
182
|
+
kind: "typeChoice",
|
|
183
|
+
documentation: "An integer read as a JavaScript number, stored as MySQL int, a signed 32-bit integer.",
|
|
184
|
+
args: [storageOption("int")],
|
|
185
|
+
choices: [{
|
|
186
|
+
when: { storage: "int" },
|
|
187
|
+
type: "Int4"
|
|
188
|
+
}]
|
|
189
|
+
},
|
|
190
|
+
BigInt: {
|
|
191
|
+
kind: "typeChoice",
|
|
192
|
+
documentation: "A signed 64-bit integer, stored as MySQL bigint. `as` is what the application reads: bigint, or number within the safe integer range.",
|
|
193
|
+
args: [{
|
|
194
|
+
kind: "option",
|
|
195
|
+
name: "as",
|
|
196
|
+
values: ["bigint", "number"],
|
|
197
|
+
default: "bigint",
|
|
198
|
+
optional: true
|
|
199
|
+
}, storageOption("bigint")],
|
|
200
|
+
choices: [{
|
|
201
|
+
when: {
|
|
202
|
+
as: "bigint",
|
|
203
|
+
storage: "bigint"
|
|
204
|
+
},
|
|
205
|
+
type: "Int8BigInt"
|
|
206
|
+
}, {
|
|
207
|
+
when: {
|
|
208
|
+
as: "number",
|
|
209
|
+
storage: "bigint"
|
|
210
|
+
},
|
|
211
|
+
type: "Int8Number"
|
|
212
|
+
}]
|
|
213
|
+
},
|
|
214
|
+
Float: {
|
|
215
|
+
kind: "typeChoice",
|
|
216
|
+
documentation: "A floating-point number, stored as MySQL double, a double-precision float, which holds every JavaScript number but NaN and the infinities; -0 is written as 0.",
|
|
217
|
+
args: [storageOption("double")],
|
|
218
|
+
choices: [{
|
|
219
|
+
when: { storage: "double" },
|
|
220
|
+
type: "Float8"
|
|
221
|
+
}]
|
|
222
|
+
},
|
|
223
|
+
Decimal: {
|
|
224
|
+
kind: "typeChoice",
|
|
225
|
+
documentation: `An exact decimal number, read as decimal text with every digit the column holds after the point, such as "12.50" in a decimal(10,2). \`storage\` is decimal, of \`precision\` digits, \`scale\` of them after the point: decimal(${MYSQL_DECIMAL_DEFAULTS.precision},${MYSQL_DECIMAL_DEFAULTS.scale}) unless written.`,
|
|
226
|
+
args: [
|
|
227
|
+
storageOption("decimal"),
|
|
228
|
+
precision,
|
|
229
|
+
scale
|
|
230
|
+
],
|
|
231
|
+
choices: [{
|
|
232
|
+
when: { storage: "decimal" },
|
|
233
|
+
type: "NumericString",
|
|
234
|
+
defaults: MYSQL_DECIMAL_DEFAULTS
|
|
235
|
+
}]
|
|
236
|
+
},
|
|
237
|
+
String: {
|
|
238
|
+
kind: "typeChoice",
|
|
239
|
+
documentation: `Text. \`storage\` is varchar, of at most \`length\` characters, 191 unless written, so that it can be indexed; or text, of up to 65,535 bytes, which cannot be indexed without a prefix length.`,
|
|
240
|
+
args: [{
|
|
241
|
+
kind: "option",
|
|
242
|
+
name: "storage",
|
|
243
|
+
values: ["varchar", "text"],
|
|
244
|
+
default: "varchar",
|
|
245
|
+
optional: true
|
|
246
|
+
}, {
|
|
247
|
+
...length,
|
|
248
|
+
optional: true
|
|
249
|
+
}],
|
|
250
|
+
choices: [{
|
|
251
|
+
when: { storage: "varchar" },
|
|
252
|
+
type: "Varchar",
|
|
253
|
+
defaults: { length: 191 }
|
|
254
|
+
}, {
|
|
255
|
+
when: { storage: "text" },
|
|
256
|
+
type: "Text"
|
|
257
|
+
}]
|
|
258
|
+
},
|
|
259
|
+
Boolean: {
|
|
260
|
+
kind: "typeChoice",
|
|
261
|
+
documentation: "A boolean, stored as MySQL tinyint(1) holding 0 or 1, which is what MySQL writes for TRUE and FALSE.",
|
|
262
|
+
args: [storageOption("tinyint")],
|
|
263
|
+
choices: [{
|
|
264
|
+
when: { storage: "tinyint" },
|
|
265
|
+
type: "Bool"
|
|
266
|
+
}]
|
|
267
|
+
},
|
|
268
|
+
Bytes: {
|
|
269
|
+
kind: "typeChoice",
|
|
270
|
+
documentation: "Bytes, read as a Uint8Array, stored as MySQL longblob, which holds up to 4 GB and cannot be indexed without a prefix length.",
|
|
271
|
+
args: [storageOption("longblob")],
|
|
272
|
+
choices: [{
|
|
273
|
+
when: { storage: "longblob" },
|
|
274
|
+
type: "Longblob"
|
|
275
|
+
}]
|
|
276
|
+
},
|
|
277
|
+
Json: {
|
|
278
|
+
kind: "typeChoice",
|
|
279
|
+
documentation: "A JSON document, read as the JSON value it holds, stored as MySQL json. It has no equality filter and no ordering. MySQL sorts the keys of a stored object; MariaDB keeps the text as written.",
|
|
280
|
+
args: [storageOption("json")],
|
|
281
|
+
choices: [{
|
|
282
|
+
when: { storage: "json" },
|
|
283
|
+
type: "PlainJson"
|
|
284
|
+
}]
|
|
285
|
+
}
|
|
92
286
|
};
|
|
93
287
|
/** 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
288
|
function withPrecision(codecId, documentation) {
|
|
@@ -320,10 +514,11 @@ const mysqlConvenienceDateTimeTypes = {
|
|
|
320
514
|
}
|
|
321
515
|
};
|
|
322
516
|
/**
|
|
323
|
-
* The
|
|
517
|
+
* The explicit and convenience scalar types, the explicit date and time types and the convenience date and time types. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.
|
|
324
518
|
*/
|
|
325
519
|
const mysqlScalarTypeConstructors = {
|
|
326
|
-
...
|
|
520
|
+
...mysqlExplicitScalarTypes,
|
|
521
|
+
...mysqlConvenienceScalarTypes,
|
|
327
522
|
...mysqlDateTimeTypeConstructors,
|
|
328
523
|
...mysqlConvenienceDateTimeTypes
|
|
329
524
|
};
|
|
@@ -331,7 +526,6 @@ const mysqlTargetDescriptorMeta = {
|
|
|
331
526
|
...mysqlTargetDescriptorMetaRuntime,
|
|
332
527
|
defaultNamespaceId: UNBOUND_NAMESPACE_ID,
|
|
333
528
|
supportsNamespaces: false,
|
|
334
|
-
displayName: "MySQL",
|
|
335
529
|
authoring: {
|
|
336
530
|
type: {
|
|
337
531
|
...mysqlScalarTypeConstructors,
|
|
@@ -349,4 +543,4 @@ const mysqlTargetDescriptorMeta = {
|
|
|
349
543
|
//#endregion
|
|
350
544
|
export { mysqlTargetDescriptorMeta as n, mysqlScalarTypeConstructors as t };
|
|
351
545
|
|
|
352
|
-
//# sourceMappingURL=descriptor-meta-
|
|
546
|
+
//# sourceMappingURL=descriptor-meta-BHSEcFWR-41BcRcOy.mjs.map
|