@prisma/orm-target-mysql 8.0.0-rc.24-dev.16 → 8.0.0-rc.24-dev.17

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.
@@ -8,6 +8,9 @@ declare const mysqlAdapterCapabilities: Readonly<{
8
8
  readonly foreignKeys: true;
9
9
  readonly enums: true;
10
10
  readonly defaultInInsert: true;
11
+ readonly jsonAgg: true;
12
+ readonly outerReferencesInDerivedTables: true;
13
+ readonly jsonAggWithoutTruncation: true;
11
14
  };
12
15
  }>;
13
16
  //#endregion
@@ -21,6 +24,9 @@ declare const mysqlAdapterContractContributions: {
21
24
  readonly foreignKeys: true;
22
25
  readonly enums: true;
23
26
  readonly defaultInInsert: true;
27
+ readonly jsonAgg: true;
28
+ readonly outerReferencesInDerivedTables: true;
29
+ readonly jsonAggWithoutTruncation: true;
24
30
  };
25
31
  }>;
26
32
  };
@@ -39,6 +45,9 @@ declare const mysqlAdapterDescriptorMeta: {
39
45
  readonly foreignKeys: true;
40
46
  readonly enums: true;
41
47
  readonly defaultInInsert: true;
48
+ readonly jsonAgg: true;
49
+ readonly outerReferencesInDerivedTables: true;
50
+ readonly jsonAggWithoutTruncation: true;
42
51
  };
43
52
  }>;
44
53
  readonly types: {
@@ -54,4 +63,4 @@ declare const mysqlAdapterDescriptorMeta: {
54
63
  };
55
64
  //#endregion
56
65
  export { mysqlAdapterContractContributions as n, mysqlAdapterDescriptorMeta as r, mysqlAdapterCapabilities as t };
57
- //# sourceMappingURL=adapter-D0qXT1lj.d.mts.map
66
+ //# sourceMappingURL=adapter-1Kd67Gfa.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-1Kd67Gfa.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/adapter.d.mts"],"mappings":";;;cAEc,0BAA0B;WAC7B;aACE;aACA;aACA;aACA;aACA;aACA;aACA;aACA;;;;;;cAMC;WACH,cAAc;aACZ;eACE;eACA;eACA;eACA;eACA;eACA;eACA;eACA;;;;;;cAMD;WACH;WACA;WACA;WACA;WACA;WACA,cAAc;aACZ;eACE;eACA;eACA;eACA;eACA;eACA;eACA;eACA;;;WAGJ;aACE;eACE,iEAAiE;eACjE;iBACE;iBACA;iBACA"}
@@ -1,4 +1,4 @@
1
- import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./adapter-D0qXT1lj.mjs";
1
+ import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./adapter-1Kd67Gfa.mjs";
2
2
  import { t as CodecTypes } from "./codec-types-Bai_CFkk-DmZ74URd.mjs";
3
3
  import "./codec-types-Dk2h5dBB.mjs";
4
4
  import { a as MysqlColumnRow, c as createMysqlControlAdapter, i as MysqlCatalogRows, n as MysqlCatalogQueries, o as MysqlControlAdapterOptions, r as MysqlCatalogReader, s as buildMysqlSchemaIR, t as MYSQL_CATALOG_QUERIES, u as readMysqlCatalog } from "./control-WNuLF2Wh.mjs";
package/dist/adapter.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./descriptor-meta-pVdZBI-g-BJN4T_on.mjs";
2
- import { a as readMysqlCatalog, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-CyGJDPay.mjs";
1
+ import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./descriptor-meta-e29H69KN-t-S8_DYh.mjs";
2
+ import { a as readMysqlCatalog, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-DDjdwyGa.mjs";
3
3
  export { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterCapabilities, mysqlAdapterContractContributions, mysqlAdapterDescriptorMeta, readMysqlCatalog };
@@ -1,2 +1,2 @@
1
- import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./adapter-D0qXT1lj.mjs";
1
+ import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./adapter-1Kd67Gfa.mjs";
2
2
  export { mysqlAdapterCapabilities, mysqlAdapterContractContributions, mysqlAdapterDescriptorMeta };
@@ -1,2 +1,2 @@
1
- import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./descriptor-meta-pVdZBI-g-BJN4T_on.mjs";
1
+ import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./descriptor-meta-e29H69KN-t-S8_DYh.mjs";
2
2
  export { mysqlAdapterCapabilities, mysqlAdapterContractContributions, mysqlAdapterDescriptorMeta };
@@ -1,2 +1,2 @@
1
- import { a as readMysqlCatalog, i as mysqlAdapterDescriptor, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-CyGJDPay.mjs";
1
+ import { a as readMysqlCatalog, i as mysqlAdapterDescriptor, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-DDjdwyGa.mjs";
2
2
  export { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterDescriptor as default, readMysqlCatalog };
@@ -4,7 +4,7 @@ import { n as quoteIdentifier, t as escapeLiteral } from "./sql-utils-Cmv_TVa8-C
4
4
  import { a as mysqlCodecDescriptorRegistry, t as assembleMysqlCodecRegistry } from "./codecs-wVJlFapM.mjs";
5
5
  import { t as mysqlNowGenerators } from "./date-time-now-generators-BKakW3gd-CIFPuRdM.mjs";
6
6
  import { t as tokenizeMysqlSql } from "./sql-utils-BE8tDXHs.mjs";
7
- import { r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./descriptor-meta-pVdZBI-g-BJN4T_on.mjs";
7
+ import { r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./descriptor-meta-e29H69KN-t-S8_DYh.mjs";
8
8
  import { r as readMarkerResult } from "./marker-read-D1hp62hF-3-4fEgDD.mjs";
9
9
  import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal-error";
10
10
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
@@ -1 +1 @@
1
- {"version":3,"file":"adapter__runtime.mjs","names":["#codecs"],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/runtime.mjs"],"sourcesContent":["import { r as mysqlAdapterCapabilities, t as mysqlAdapterDescriptorMeta } from \"./descriptor-meta-pVdZBI-g.mjs\";\nimport { r as readMarkerResult } from \"./marker-read-D1hp62hF.mjs\";\nimport { assembleMysqlCodecRegistry, mysqlCodecDescriptorRegistry } from \"@internal/target-mysql/codecs\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { collectOrderedParamRefs, isDdlNode } from \"@internal/sql-relational-core/ast\";\nimport { mysqlError } from \"@internal/target-mysql/errors\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { escapeLiteral, quoteIdentifier, tokenizeMysqlSql } from \"@internal/target-mysql/sql-utils\";\nimport { timestampNowRuntimeGenerator } from \"@internal/family-sql/runtime\";\nimport { mysqlNowGenerators } from \"@internal/target-mysql/runtime\";\nimport { MYSQL_BIGINT_CODEC_ID, MYSQL_INT_CODEC_ID, MYSQL_TEXT_CODEC_ID } from \"@internal/target-mysql/codec-ids\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\n//#region src/core/raw-codec-inferer.ts\nconst INT_MIN = -(2 ** 31);\nconst INT_MAX = 2 ** 31 - 1;\nfunction refuse(value) {\n\tthrow structuredError(\"RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION\", \"MySQL has no codec for this JS value in raw SQL: wrap it in `param(...)` with an explicit codec\", { meta: { valueType: typeof value } });\n}\n/** The codec of a bare value interpolated into `fns.raw` or the raw lane on a MySQL client: integers, bigints and strings. */\nconst mysqlRawCodecInferer = { inferCodec(value) {\n\tswitch (typeof value) {\n\t\tcase \"number\":\n\t\t\tif (!Number.isSafeInteger(value)) return refuse(value);\n\t\t\treturn value >= INT_MIN && value <= INT_MAX ? MYSQL_INT_CODEC_ID : refuse(value);\n\t\tcase \"bigint\": return MYSQL_BIGINT_CODEC_ID;\n\t\tcase \"string\": return MYSQL_TEXT_CODEC_ID;\n\t\tdefault: return refuse(value);\n\t}\n} };\n//#endregion\n//#region src/core/placeholders.ts\n/** Refuses a lowered statement unless every placeholder is a numbered `?N` naming one of its parameters and every parameter has a placeholder. */\nfunction assertPlaceholdersMatchParams(sql, paramCount) {\n\tconst tokens = tokenizeMysqlSql(sql).filter((token) => token.kind === \"placeholder\");\n\tconst placeholders = tokens.map((token) => token.text);\n\tconst numbers = tokens.map((token) => token.number ?? NaN);\n\tif (numbers.every((number) => number >= 1 && number <= paramCount) && new Set(numbers).size === paramCount) return;\n\tthrow structuredError(\"RUNTIME.PARAM_PLACEHOLDER_MISMATCH\", `The lowered MySQL statement writes placeholders ${JSON.stringify(placeholders)} for ${paramCount} parameter(s); each parameter must be written as its own numbered placeholder, and no other placeholder may appear.`, {\n\t\twhy: \"A placeholder that does not match a parameter binds a value to the wrong place in the statement, or leaves a value unbound.\",\n\t\tfix: \"Pass values into raw SQL through interpolation rather than writing a `?` in the SQL text.\",\n\t\tmeta: {\n\t\t\tplaceholders,\n\t\t\tparams: paramCount\n\t\t}\n\t});\n}\n//#endregion\n//#region src/core/sql-renderer.ts\n/** The name an upsert gives the row it proposes, which its update reads as `new`.`column`; the ORM writes that row as `excluded`, as Postgres names it. */\nconst PROPOSED_ROW = \"new\";\n/**\n* Raises `group_concat_max_len` for this statement only, past any result a connection can send, so an ordered include does not depend on how the driver set up its session. MySQL takes `SET_VAR` only on the outermost `SELECT`.\n*/\nconst GROUP_CONCAT_HINT = \"/*+ SET_VAR(group_concat_max_len = 4294967295) */\";\n/** MySQL's documented way to write an `OFFSET` with no `LIMIT`: the largest row count it takes. */\nconst NO_LIMIT = \"18446744073709551615\";\nfunction nodeKind(value) {\n\treturn typeof value === \"object\" && value !== null && \"kind\" in value ? String(value.kind) : \"unknown\";\n}\nfunction unsupported(feature, message) {\n\treturn mysqlError(\"RUNTIME.AST_UNSUPPORTED\", message, { meta: {\n\t\ttarget: \"mysql\",\n\t\tfeature\n\t} });\n}\n/**\n* Lowers a query AST to MySQL SQL. Each param is written as `?N`, N being its position in `collectOrderedParamRefs`, the order the runtime encodes and middleware edits params in; a param written twice is bound once. The driver fills the placeholders.\n*/\nfunction renderMysqlSql(ast, contract, codecs) {\n\tconst placeholderNumbers = /* @__PURE__ */ new Map();\n\tconst params = collectOrderedParamRefs(ast).map((ref, index) => {\n\t\tplaceholderNumbers.set(ref, index + 1);\n\t\treturn ref.kind === \"prepared-param-ref\" ? {\n\t\t\tkind: \"bind\",\n\t\t\tname: ref.name\n\t\t} : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: ref.value\n\t\t};\n\t});\n\tconst ctx = {\n\t\tcontract,\n\t\tcodecs,\n\t\tplaceholderNumbers,\n\t\tuses: { groupConcat: false }\n\t};\n\tconst rendered = renderStatement(ast, ctx);\n\tconst sql = ctx.uses.groupConcat ? withGroupConcatHint(ast, rendered) : rendered;\n\tassertPlaceholdersMatchParams(sql, params.length);\n\treturn Object.freeze({\n\t\tsql,\n\t\tparams\n\t});\n}\n/** Puts `GROUP_CONCAT_HINT` on the outermost `SELECT`; a statement without one would leave `GROUP_CONCAT` at the session's limit, which can cut an array after an element and still read as JSON, so it is refused. */\nfunction withGroupConcatHint(ast, rendered) {\n\tif (ast.kind !== \"select\" || !rendered.startsWith(\"SELECT \")) throw unsupported(\"ordered-array-outside-select\", \"MySQL can build an ordered JSON array only in a SELECT statement, whose outermost SELECT carries the hint that raises group_concat_max_len\");\n\treturn `SELECT ${GROUP_CONCAT_HINT} ${rendered.slice(7)}`;\n}\nfunction renderStatement(ast, ctx) {\n\tswitch (ast.kind) {\n\t\tcase \"select\": return renderSelect(ast, ctx);\n\t\tcase \"raw-query\": return renderParts(ast.parts, ctx);\n\t\tcase \"insert\": return renderInsert(ast, ctx);\n\t\tcase \"update\": return renderUpdate(ast, ctx);\n\t\tcase \"delete\": return renderDelete(ast, ctx);\n\t\tdefault: throw new InternalError(`Unsupported AST node kind: ${nodeKind(ast)}`);\n\t}\n}\nfunction invalid(node, message) {\n\treturn mysqlError(\"RUNTIME.AST_INVALID\", message, { meta: { node } });\n}\n/** MySQL has no `RETURNING`: the SQL family's ORM reads written rows back with a select when the contract does not report `returning`. */\nfunction refuseReturning(returning, what) {\n\tif (returning !== void 0 && returning.length > 0) throw unsupported(\"returning\", `MySQL cannot return the rows ${what} writes; it has no RETURNING`);\n}\nfunction renderInsertValue(value, ctx) {\n\tif (value === void 0 || value.kind === \"default-value\") return \"DEFAULT\";\n\treturn renderExpr(value, ctx);\n}\n/**\n* An insert, with the bare table name: MySQL's `INSERT` takes no alias, so a column of the table is qualified by its name. A row without a value for a column gets `DEFAULT`. An upsert names its proposed row `new` and updates the existing row on any duplicate key. MySQL cannot limit `ON DUPLICATE KEY UPDATE` to named conflict columns, so the adapter does not report `insertOnConflictTarget` and an upsert that names them is refused. Skipping a conflicting row is refused: `INSERT IGNORE` also hides foreign-key and `NOT NULL` errors.\n*/\nfunction renderInsert(ast, ctx) {\n\trefuseReturning(ast.returning, \"an insert\");\n\tif (ast.rows.length === 0) throw invalid(\"insert\", \"INSERT requires at least one row\");\n\tconst table = qualifyTable(ast.table, ctx);\n\tconst insertCtx = {\n\t\t...ctx,\n\t\tinsertInto: {\n\t\t\talias: ast.table.alias ?? ast.table.name,\n\t\t\tname: table\n\t\t}\n\t};\n\tconst columns = [...new Set(ast.rows.flatMap((row) => Object.keys(row)))];\n\tconst values = ast.rows.map((row) => `(${columns.map((column) => renderInsertValue(row[column], insertCtx)).join(\", \")})`).join(\", \");\n\tconst insert = `INSERT INTO ${table} (${columns.map(quoteIdentifier).join(\", \")}) VALUES ${values}`;\n\tconst conflict = ast.onConflict;\n\tif (conflict === void 0) return insert;\n\tconst action = conflict.action;\n\tswitch (action.kind) {\n\t\tcase \"do-nothing\": throw unsupported(\"insert-on-conflict-skip\", \"MySQL cannot skip a conflicting row without also hiding other errors: INSERT IGNORE turns foreign-key and NOT NULL errors into warnings\");\n\t\tcase \"do-update-set\": {\n\t\t\tif (conflict.columns.length > 0) throw unsupported(\"insert-on-conflict-target\", \"MySQL cannot limit ON DUPLICATE KEY UPDATE to named conflict columns: it fires on any unique key\");\n\t\t\tconst assignments = Object.entries(action.set);\n\t\t\tif (assignments.length === 0) throw invalid(\"insert-on-conflict\", \"An upsert requires at least one column to update\");\n\t\t\tconst set = assignments.map(([column, value]) => `${quoteIdentifier(column)} = ${renderExpr(value, insertCtx)}`).join(\", \");\n\t\t\treturn `${insert} AS ${quoteIdentifier(PROPOSED_ROW)} ON DUPLICATE KEY UPDATE ${set}`;\n\t\t}\n\t\tdefault: return assertNever(action, `Unsupported conflict action: ${nodeKind(action)}`);\n\t}\n}\nfunction renderUpdate(ast, ctx) {\n\trefuseReturning(ast.returning, \"an update\");\n\tconst assignments = Object.entries(ast.set);\n\tif (assignments.length === 0) throw invalid(\"update\", \"UPDATE requires at least one column to set\");\n\tconst set = assignments.map(([column, value]) => `${quoteIdentifier(column)} = ${renderExpr(value, ctx)}`).join(\", \");\n\tconst where = ast.where ? ` WHERE ${renderExpr(ast.where, ctx)}` : \"\";\n\treturn `UPDATE ${renderTableSource(ast.table, ctx)} SET ${set}${where}`;\n}\nfunction renderDelete(ast, ctx) {\n\trefuseReturning(ast.returning, \"a delete\");\n\tconst where = ast.where ? ` WHERE ${renderExpr(ast.where, ctx)}` : \"\";\n\treturn `DELETE FROM ${renderTableSource(ast.table, ctx)}${where}`;\n}\nfunction renderLimitOffset(keyword, value, ctx) {\n\tif (value === void 0) return \"\";\n\tif (typeof value === \"number\") return `${keyword} ${value}`;\n\treturn `${keyword} ${value.kind === \"param-ref\" || value.kind === \"prepared-param-ref\" ? placeholder(value, ctx) : renderExpr(value, ctx)}`;\n}\nfunction renderSelect(ast, ctx) {\n\tif (ast.locking !== void 0 && ast.locking.length > 0) throw unsupported(\"locking-clause\", \"Row locks are not supported on MySQL yet, so a select cannot carry a locking clause such as FOR UPDATE\");\n\tif (ast.distinctOn !== void 0 && ast.distinctOn.length > 0) throw unsupported(\"distinct-on\", \"MySQL has no DISTINCT ON\");\n\treturn [\n\t\t`SELECT ${ast.distinct ? \"DISTINCT \" : \"\"}${renderProjection(ast.projection, ctx)}`,\n\t\tast.from === void 0 ? \"\" : `FROM ${renderSource(ast.from, ctx)}`,\n\t\tast.joins?.length ? ast.joins.map((join) => renderJoin(join, ctx)).join(\" \") : \"\",\n\t\tast.where ? `WHERE ${renderExpr(ast.where, ctx)}` : \"\",\n\t\tast.groupBy?.length ? `GROUP BY ${ast.groupBy.map((e) => renderExpr(e, ctx)).join(\", \")}` : \"\",\n\t\tast.having ? `HAVING ${renderExpr(ast.having, ctx)}` : \"\",\n\t\tast.orderBy?.length ? `ORDER BY ${renderOrderByItems(ast.orderBy, ctx)}` : \"\",\n\t\tast.limit === void 0 && ast.offset !== void 0 ? `LIMIT ${NO_LIMIT}` : renderLimitOffset(\"LIMIT\", ast.limit, ctx),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, ctx)\n\t].filter((part) => part.length > 0).join(\" \");\n}\nfunction renderProjection(projection, ctx) {\n\treturn projection.map((item) => `${renderExpr(item.expr, ctx)} AS ${quoteIdentifier(item.alias)}`).join(\", \");\n}\nfunction qualifyTable(table, ctx) {\n\tif (table.namespaceId === void 0) return quoteIdentifier(table.name);\n\tif (ctx.contract === void 0) throw new InternalError(`Table \"${table.name}\" carries namespace \"${table.namespaceId}\" but no contract was supplied to resolve it`);\n\tconst namespace = ctx.contract.storage.namespaces[table.namespaceId];\n\tif (namespace?.qualifyTable === void 0) throw structuredError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which the contract does not materialise for SQL rendering`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: namespace === void 0 ? \"not-present\" : \"not-materialised\"\n\t} });\n\treturn namespace.qualifyTable(table.name);\n}\nfunction renderTableSource(source, ctx) {\n\tconst qualified = qualifyTable(source, ctx);\n\treturn source.alias ? `${qualified} AS ${quoteIdentifier(source.alias)}` : qualified;\n}\nfunction renderSource(source, ctx) {\n\tswitch (source.kind) {\n\t\tcase \"table-source\": return renderTableSource(source, ctx);\n\t\tcase \"derived-table-source\": return `(${renderSelect(source.query, ctx)}) AS ${quoteIdentifier(source.alias)}`;\n\t\tcase \"function-source\": throw unsupported(\"function-source\", `MySQL cannot select from the set-returning function ${source.fn}`);\n\t\tdefault: return assertNever(source, `Unsupported source node kind: ${nodeKind(source)}`);\n\t}\n}\nfunction renderExpr(expr, ctx) {\n\tswitch (expr.kind) {\n\t\tcase \"column-ref\": return renderColumn(expr, ctx);\n\t\tcase \"identifier-ref\": return quoteIdentifier(expr.name);\n\t\tcase \"operation\": return renderOperation(expr, ctx);\n\t\tcase \"subquery\": return renderSubquery(expr, ctx);\n\t\tcase \"aggregate\": return renderAggregate(expr, ctx);\n\t\tcase \"window-func\": return renderWindowFunc(expr, ctx);\n\t\tcase \"function-call\": return renderFunctionCall(expr, ctx);\n\t\tcase \"cast\": return renderCast(expr, ctx);\n\t\tcase \"case\": return renderCase(expr, ctx);\n\t\tcase \"json-object\": return renderJsonObject(expr, ctx);\n\t\tcase \"json-array-agg\": return renderJsonArrayAgg(expr, ctx);\n\t\tcase \"binary\": return renderBinary(expr, ctx);\n\t\tcase \"and\": return expr.exprs.length === 0 ? \"TRUE\" : `(${expr.exprs.map((part) => renderExpr(part, ctx)).join(\" AND \")})`;\n\t\tcase \"or\": return expr.exprs.length === 0 ? \"FALSE\" : `(${expr.exprs.map((part) => renderExpr(part, ctx)).join(\" OR \")})`;\n\t\tcase \"exists\": return `${expr.notExists ? \"NOT \" : \"\"}EXISTS (${renderSelect(expr.subquery, ctx)})`;\n\t\tcase \"null-check\": return renderNullCheck(expr, ctx);\n\t\tcase \"not\": return `NOT (${renderExpr(expr.expr, ctx)})`;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParam(expr, ctx);\n\t\tcase \"literal\": return renderLiteral(expr);\n\t\tcase \"list\": return renderList(expr, ctx);\n\t\tcase \"raw-expr\": return renderParts(expr.parts, ctx);\n\t\tdefault: return assertNever(expr, `Unsupported expression node kind: ${nodeKind(expr)}`);\n\t}\n}\n/** Refuses raw SQL text that puts a digit right after an interpolated value: the value's `?N` and the digit would read as one larger placeholder, `?1` and `0` as `?10`. */\nfunction assertNoDigitAfterParam(parts) {\n\tparts.forEach((part, index) => {\n\t\tconst next = parts[index + 1];\n\t\tif (typeof part !== \"string\" && (part.kind === \"param-ref\" || part.kind === \"prepared-param-ref\") && typeof next === \"string\" && /^\\d/.test(next)) throw structuredError(\"RUNTIME.PARAM_PLACEHOLDER_MISMATCH\", \"Raw SQL puts a digit right after an interpolated value, which MySQL lowering would read as part of the value's placeholder\", {\n\t\t\twhy: \"Each value is written as a numbered placeholder, ?N, so a digit that follows it in the SQL text makes a different placeholder: ?1 followed by 0 reads as ?10.\",\n\t\t\tfix: \"Put a space or an operator between the interpolated value and the digit.\",\n\t\t\tmeta: {\n\t\t\t\treason: \"digit-after-value\",\n\t\t\t\tpart: index + 1\n\t\t\t}\n\t\t});\n\t});\n}\nfunction renderParts(parts, ctx) {\n\tassertNoDigitAfterParam(parts);\n\treturn parts.map((part) => {\n\t\tif (typeof part === \"string\") return part;\n\t\tswitch (part.kind) {\n\t\t\tcase \"select\": return renderSelect(part, ctx);\n\t\t\tcase \"insert\": return renderInsert(part, ctx);\n\t\t\tcase \"update\": return renderUpdate(part, ctx);\n\t\t\tcase \"delete\": return renderDelete(part, ctx);\n\t\t\tdefault: return renderExpr(part, ctx);\n\t\t}\n\t}).join(\"\");\n}\nfunction renderColumn(ref, ctx) {\n\tconst column = quoteIdentifier(ref.column);\n\tconst { insertInto } = ctx;\n\tif (insertInto !== void 0) {\n\t\tif (ref.table === \"excluded\") return `${quoteIdentifier(PROPOSED_ROW)}.${column}`;\n\t\tif (ref.table === insertInto.alias) return `${insertInto.name}.${column}`;\n\t}\n\treturn `${quoteIdentifier(ref.table)}.${column}`;\n}\n/**\n* A literal the code wrote: a number, a bigint, a boolean or NULL, such as the ORM's `1` and `fns.and(true, …)`. A `LiteralExpr` does not say where its value came from, and no part of Prisma writes a text, date or JSON literal into a MySQL runtime statement, so those are refused: a value of that kind can only be a caller's, which belongs in a param, sent apart from the SQL.\n*/\nfunction renderLiteral(expr) {\n\tconst { value } = expr;\n\tif (value === null || value === void 0) return \"NULL\";\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw unsupported(\"non-finite-number\", `MySQL has no literal for ${value}`);\n\t\treturn String(value);\n\t}\n\tif (typeof value === \"boolean\") return value ? \"TRUE\" : \"FALSE\";\n\tif (typeof value === \"bigint\") return String(value);\n\tthrow unsupported(\"value-literal\", `MySQL lowering writes only numbers, booleans and NULL as literals; a ${value instanceof Date ? \"date\" : Array.isArray(value) ? \"array\" : typeof value} value must be a param`);\n}\n/** Renders each `{{self}}` and `{{argN}}` where the template writes it. */\nfunction renderOperation(expr, ctx) {\n\treturn expr.lowering.template.replace(/\\{\\{(self|arg(\\d+))\\}\\}/g, (_match, _name, index) => {\n\t\tif (index === void 0) return renderExpr(expr.self, ctx);\n\t\tconst arg = expr.args[Number(index)];\n\t\treturn arg === void 0 ? \"\" : renderExpr(arg, ctx);\n\t});\n}\nfunction renderSubquery(expr, ctx, columns = 1) {\n\tif (expr.query.projection.length !== columns) throw structuredError(\"RUNTIME.AST_INVALID\", columns === 1 ? \"Subquery expressions must project exactly one column\" : `A subquery compared with a row value of ${columns} columns must project ${columns} columns`, { meta: { node: \"subquery\" } });\n\treturn `(${renderSelect(expr.query, ctx)})`;\n}\n/** Whether an operand must be parenthesised before an operator is written after it. A new expression kind fails to compile here until someone decides. */\nfunction needsGrouping(expr) {\n\tswitch (expr.kind) {\n\t\tcase \"operation\":\n\t\tcase \"subquery\": return true;\n\t\tcase \"column-ref\":\n\t\tcase \"identifier-ref\":\n\t\tcase \"aggregate\":\n\t\tcase \"window-func\":\n\t\tcase \"function-call\":\n\t\tcase \"cast\":\n\t\tcase \"case\":\n\t\tcase \"json-object\":\n\t\tcase \"json-array-agg\":\n\t\tcase \"binary\":\n\t\tcase \"and\":\n\t\tcase \"or\":\n\t\tcase \"exists\":\n\t\tcase \"null-check\":\n\t\tcase \"not\":\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\tcase \"literal\":\n\t\tcase \"list\":\n\t\tcase \"raw-expr\": return false;\n\t}\n}\nfunction grouped(expr, ctx) {\n\tconst rendered = renderExpr(expr, ctx);\n\treturn needsGrouping(expr) ? `(${rendered})` : rendered;\n}\nfunction renderNullCheck(expr, ctx) {\n\treturn `${grouped(expr.expr, ctx)} ${expr.isNull ? \"IS NULL\" : \"IS NOT NULL\"}`;\n}\nconst BINARY_OPERATORS = {\n\teq: \"=\",\n\tneq: \"<>\",\n\tisNotDistinctFrom: \"<=>\",\n\tgt: \">\",\n\tlt: \"<\",\n\tgte: \">=\",\n\tlte: \"<=\",\n\tlike: \"LIKE\",\n\tin: \"IN\",\n\tnotIn: \"NOT IN\"\n};\nfunction renderBinary(expr, ctx) {\n\tif (expr.right.kind === \"list\" && expr.right.values.length === 0) {\n\t\tif (expr.op === \"in\") return \"FALSE\";\n\t\tif (expr.op === \"notIn\") return \"TRUE\";\n\t}\n\tconst left = grouped(expr.left, ctx);\n\tconst right = expr.right.kind === \"subquery\" && expr.left.kind === \"list\" ? renderSubquery(expr.right, ctx, expr.left.values.length) : renderExpr(expr.right, ctx);\n\tif (expr.op === \"isDistinctFrom\") return `NOT (${left} <=> ${right})`;\n\treturn `${left} ${BINARY_OPERATORS[expr.op]} ${right}`;\n}\nfunction renderList(expr, ctx) {\n\tif (expr.values.length === 0) return \"(NULL)\";\n\treturn `(${expr.values.map((value) => renderExpr(value, ctx)).join(\", \")})`;\n}\nfunction renderAggregate(expr, ctx) {\n\tconst fn = expr.fn.toUpperCase();\n\treturn expr.expr ? `${fn}(${renderExpr(expr.expr, ctx)})` : `${fn}(*)`;\n}\nfunction renderWindowFunc(expr, ctx) {\n\tconst args = expr.args.map((arg) => renderExpr(arg, ctx)).join(\", \");\n\tconst over = [expr.partitionBy?.length ? `PARTITION BY ${expr.partitionBy.map((e) => renderExpr(e, ctx)).join(\", \")}` : \"\", expr.orderBy?.length ? `ORDER BY ${renderOrderByItems(expr.orderBy, ctx)}` : \"\"].filter((part) => part.length > 0).join(\" \");\n\treturn `${expr.fn.toUpperCase()}(${args}) OVER (${over})`;\n}\nfunction renderFunctionCall(expr, ctx) {\n\treturn `${expr.fn}(${expr.args.map((arg) => renderExpr(arg, ctx)).join(\", \")})`;\n}\nfunction renderCast(expr, ctx) {\n\treturn `CAST(${renderExpr(expr.expr, ctx)} AS ${expr.targetType})`;\n}\nfunction renderCase(expr, ctx) {\n\treturn `CASE ${expr.branches.map((branch) => `WHEN ${renderExpr(branch.condition, ctx)} THEN ${renderExpr(branch.value, ctx)}`).join(\" \")}${expr.elseExpr === void 0 ? \"\" : ` ELSE ${renderExpr(expr.elseExpr, ctx)}`} END`;\n}\nfunction descriptorOf(codec, ctx, use) {\n\tconst descriptor = ctx.codecs.descriptorFor(codec.codecId);\n\tif (descriptor === void 0) throw structuredError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `MySQL lowering: ${use} carries codecId \"${codec.codecId}\" but the MySQL codec registry has no entry for it. Register the extension pack that contributes this codec.`, { meta: { codecId: codec.codecId } });\n\treturn descriptor;\n}\nfunction placeholder(ref, ctx) {\n\tconst number = ctx.placeholderNumbers.get(ref);\n\tif (number === void 0) throw new InternalError(\"A param was written that the AST does not collect\");\n\treturn `?${number}`;\n}\n/** A param as its numbered placeholder, refusing one whose codec the MySQL registry lacks. */\nfunction renderParam(ref, ctx) {\n\tif (ref.codec !== void 0) descriptorOf(ref.codec, ctx, \"a parameter\");\n\treturn placeholder(ref, ctx);\n}\nfunction projectThroughCodec(value, codec, ctx) {\n\treturn descriptorOf(codec, ctx, \"a JSON projection\").projectJson(value, codec);\n}\nfunction renderJsonValue(projection, ctx) {\n\treturn projection.accept({\n\t\tcodec: ({ value, codec }) => renderExpr(projectThroughCodec(value, codec, ctx), ctx),\n\t\tnative: ({ value }) => renderExpr(value, ctx),\n\t\tdocument: ({ value }) => renderExpr(value, ctx)\n\t});\n}\nfunction renderJsonObject(expr, ctx) {\n\treturn `JSON_OBJECT(${expr.entries.flatMap((entry) => [`'${escapeLiteral(entry.key)}'`, renderJsonValue(entry.value, ctx)]).join(\", \")})`;\n}\n/**\n* The element of an ordered JSON array, as JSON text. A document already is JSON; a scalar goes through `JSON_ARRAY`, so a string arrives quoted and escaped.\n*/\nfunction renderJsonElementText(projection, ctx) {\n\tconst rendered = renderJsonValue(projection, ctx);\n\treturn projection.kind === \"document\" ? rendered : `JSON_EXTRACT(JSON_ARRAY(${rendered}), '$[0]')`;\n}\n/**\n* `JSON_ARRAYAGG` takes no `ORDER BY`, and MySQL drops a derived table's `ORDER BY` when the outer query aggregates, so an ordered array is built as text with `GROUP_CONCAT`, which keeps its own order, and cast to JSON. The statement raises `group_concat_max_len` past any result a connection can send (see `GROUP_CONCAT_HINT`), so `GROUP_CONCAT` never cuts the text short. Text longer than `max_allowed_packet` makes `CONCAT` return NULL with only a warning, which would read as an empty include; so an empty array is written only when there are no rows, and a NULL text with rows is replaced by text that is not JSON, which fails the cast and the statement with MySQL's invalid-JSON error. `JSON_ARRAYAGG` fails on its own when its result exceeds a packet. An empty array is `JSON_ARRAY()`, so the column stays JSON and a nested include stays an array.\n*/\nfunction renderJsonArrayAgg(expr, ctx) {\n\tif (expr.orderBy === void 0) {\n\t\tconst aggregated = `JSON_ARRAYAGG(${renderJsonValue(expr.expr, ctx)})`;\n\t\treturn expr.onEmpty === \"emptyArray\" ? `COALESCE(${aggregated}, JSON_ARRAY())` : aggregated;\n\t}\n\tctx.uses.groupConcat = true;\n\tconst text = `CONCAT('[', GROUP_CONCAT(${renderJsonElementText(expr.expr, ctx)} ORDER BY ${renderOrderByItems(expr.orderBy, ctx)} SEPARATOR ','), ']')`;\n\treturn `CASE WHEN COUNT(*) = 0 THEN ${expr.onEmpty === \"emptyArray\" ? \"JSON_ARRAY()\" : \"NULL\"} ELSE CAST(COALESCE(${text}, ${OVERSIZED_ARRAY_TEXT}) AS JSON) END`;\n}\n/** Text that is not JSON, written in place of an array MySQL could not build because it is larger than a packet, so the cast fails. MySQL's error does not show this text: the user sees `Invalid JSON text in argument 1 to function cast_as_json`, which names neither the include nor the packet size. The text counts the rows only so that MySQL evaluates it when it is reached, not while preparing the statement. */\nconst OVERSIZED_ARRAY_TEXT = \"CONCAT('array larger than max_allowed_packet: ', COUNT(*), ' rows')\";\nconst ORDER_DIRECTION = {\n\tasc: \"ASC\",\n\tdesc: \"DESC\"\n};\n/** A NULLS FIRST or NULLS LAST placement, which MySQL lacks, as a leading `IS NULL` sort key. */\nconst NULLS_KEY_DIRECTION = {\n\tfirst: \"DESC\",\n\tlast: \"ASC\"\n};\nfunction renderOrderByItem(item, ctx) {\n\treturn `${item.nulls === void 0 ? \"\" : `${grouped(item.expr, ctx)} IS NULL ${NULLS_KEY_DIRECTION[item.nulls]}, `}${renderExpr(item.expr, ctx)} ${ORDER_DIRECTION[item.dir]}`;\n}\nfunction renderOrderByItems(items, ctx) {\n\treturn items.map((item) => renderOrderByItem(item, ctx)).join(\", \");\n}\nfunction renderJoin(join, ctx) {\n\tif (join.joinType === \"full\") throw unsupported(\"full-join\", \"MySQL has no FULL JOIN\");\n\tif (join.lateral) throw unsupported(\"lateral-join\", \"LATERAL joins are not supported on MySQL yet\");\n\treturn `${join.joinType.toUpperCase()} JOIN ${renderSource(join.source, ctx)} ON ${renderJoinOn(join.on, ctx)}`;\n}\nfunction renderJoinOn(on, ctx) {\n\treturn on.kind === \"eq-col-join-on\" ? `${renderColumn(on.left, ctx)} = ${renderColumn(on.right, ctx)}` : renderExpr(on, ctx);\n}\n//#endregion\n//#region src/core/runtime/mysql-adapter.ts\nfunction markerQuery(queryable) {\n\treturn { async query(sql, params) {\n\t\tconst rows = [];\n\t\tfor await (const row of queryable.query({\n\t\t\tsql,\n\t\t\t...params ? { params } : {}\n\t\t})) rows.push(row);\n\t\treturn { rows };\n\t} };\n}\nvar MysqlAdapterImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"mysql\";\n\tprofile;\n\t#codecs;\n\tconstructor(codecs) {\n\t\tthis.#codecs = codecs;\n\t\tthis.profile = Object.freeze({\n\t\t\tid: \"mysql/default@1\",\n\t\t\ttarget: \"mysql\",\n\t\t\tcapabilities: mysqlAdapterCapabilities,\n\t\t\treadMarker: (queryable) => readMarkerResult(markerQuery(queryable), APP_SPACE_ID)\n\t\t});\n\t}\n\tlower(ast, context) {\n\t\tif (isDdlNode(ast)) throw structuredError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() does not lower DDL on the runtime adapter: DDL lowering belongs to the control adapter.\", { meta: { surface: \"runtime-adapter\" } });\n\t\treturn renderMysqlSql(ast, context.contract, this.#codecs);\n\t}\n};\n/** The MySQL runtime adapter: it lowers queries with the MySQL renderer and reads the marker 2b's control tables hold. */\nfunction createMysqlAdapter(codecs) {\n\treturn Object.freeze(new MysqlAdapterImpl(codecs));\n}\n//#endregion\n//#region src/core/runtime/runtime-adapter.ts\n/** The `now()` generators of the MySQL date and time types: the SQL family's `timestampNow` for a `Date`, and the target's for every other value. */\nfunction createMysqlMutationDefaultGenerators() {\n\treturn [timestampNowRuntimeGenerator(), ...mysqlNowGenerators.map(({ id, generate }) => ({\n\t\tid,\n\t\tgenerate,\n\t\tstability: \"query\"\n\t}))];\n}\nconst mysqlRuntimeAdapterDescriptor = {\n\t...mysqlAdapterDescriptorMeta,\n\tcodecs: () => Array.from(mysqlCodecDescriptorRegistry.values()),\n\tmutationDefaultGenerators: createMysqlMutationDefaultGenerators,\n\trawCodecInferer: mysqlRawCodecInferer,\n\tcreate(stack) {\n\t\treturn createMysqlAdapter(assembleMysqlCodecRegistry(stack.target, stack.extensions));\n\t}\n};\n//#endregion\nexport { mysqlRuntimeAdapterDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,UAAU,EAAE,KAAK;AACvB,MAAM,UAAU,KAAK,KAAK;AAC1B,SAAS,OAAO,OAAO;CACtB,MAAM,gBAAgB,6CAA6C,mGAAmG,EAAE,MAAM,EAAE,WAAW,OAAO,MAAM,EAAE,CAAC;AAC5M;;AAEA,MAAM,uBAAuB,EAAE,WAAW,OAAO;CAChD,QAAQ,OAAO,OAAf;EACC,KAAK;GACJ,IAAI,CAAC,OAAO,cAAc,KAAK,GAAG,OAAO,OAAO,KAAK;GACrD,OAAO,SAAS,WAAW,SAAS,UAAU,qBAAqB,OAAO,KAAK;EAChF,KAAK,UAAU,OAAO;EACtB,KAAK,UAAU,OAAO;EACtB,SAAS,OAAO,OAAO,KAAK;CAC7B;AACD,EAAE;;AAIF,SAAS,8BAA8B,KAAK,YAAY;CACvD,MAAM,SAAS,iBAAiB,GAAG,CAAC,CAAC,QAAQ,UAAU,MAAM,SAAS,aAAa;CACnF,MAAM,eAAe,OAAO,KAAK,UAAU,MAAM,IAAI;CACrD,MAAM,UAAU,OAAO,KAAK,UAAU,MAAM,UAAU,GAAG;CACzD,IAAI,QAAQ,OAAO,WAAW,UAAU,KAAK,UAAU,UAAU,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,SAAS,YAAY;CAC5G,MAAM,gBAAgB,sCAAsC,mDAAmD,KAAK,UAAU,YAAY,EAAE,OAAO,WAAW,sHAAsH;EACnR,KAAK;EACL,KAAK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ACA,MAAM,KAAK,SAAS;EACnB,IAAI,UAAU,GAAG,GAAG,MAAM,gBAAgB,2BAA2B,mGAAmG,EAAE,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;EAChN,OAAO,eAAe,KAAK,QAAQ,UAAU,KAAKA,OAAO;CAC1D;AACD;;AAEA,SAAS,mBAAmB,QAAQ;CACnC,OAAO,OAAO,OAAO,IAAI,iBAAiB,MAAM,CAAC;AAClD;;AAIA,SAAS,uCAAuC;CAC/C,OAAO,CAAC,6BAA6B,GAAG,GAAG,mBAAmB,KAAK,EAAE,IAAI,gBAAgB;EACxF;EACA;EACA,WAAW;CACZ,EAAE,CAAC;AACJ;AACA,MAAM,gCAAgC;CACrC,GAAG;CACH,cAAc,MAAM,KAAK,6BAA6B,OAAO,CAAC;CAC9D,2BAA2B;CAC3B,iBAAiB;CACjB,OAAO,OAAO;EACb,OAAO,mBAAmB,2BAA2B,MAAM,QAAQ,MAAM,UAAU,CAAC;CACrF;AACD"}
1
+ {"version":3,"file":"adapter__runtime.mjs","names":["#codecs"],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/runtime.mjs"],"sourcesContent":["import { r as mysqlAdapterCapabilities, t as mysqlAdapterDescriptorMeta } from \"./descriptor-meta-e29H69KN.mjs\";\nimport { r as readMarkerResult } from \"./marker-read-D1hp62hF.mjs\";\nimport { assembleMysqlCodecRegistry, mysqlCodecDescriptorRegistry } from \"@internal/target-mysql/codecs\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { collectOrderedParamRefs, isDdlNode } from \"@internal/sql-relational-core/ast\";\nimport { mysqlError } from \"@internal/target-mysql/errors\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { escapeLiteral, quoteIdentifier, tokenizeMysqlSql } from \"@internal/target-mysql/sql-utils\";\nimport { timestampNowRuntimeGenerator } from \"@internal/family-sql/runtime\";\nimport { mysqlNowGenerators } from \"@internal/target-mysql/runtime\";\nimport { MYSQL_BIGINT_CODEC_ID, MYSQL_INT_CODEC_ID, MYSQL_TEXT_CODEC_ID } from \"@internal/target-mysql/codec-ids\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\n//#region src/core/raw-codec-inferer.ts\nconst INT_MIN = -(2 ** 31);\nconst INT_MAX = 2 ** 31 - 1;\nfunction refuse(value) {\n\tthrow structuredError(\"RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION\", \"MySQL has no codec for this JS value in raw SQL: wrap it in `param(...)` with an explicit codec\", { meta: { valueType: typeof value } });\n}\n/** The codec of a bare value interpolated into `fns.raw` or the raw lane on a MySQL client: integers, bigints and strings. */\nconst mysqlRawCodecInferer = { inferCodec(value) {\n\tswitch (typeof value) {\n\t\tcase \"number\":\n\t\t\tif (!Number.isSafeInteger(value)) return refuse(value);\n\t\t\treturn value >= INT_MIN && value <= INT_MAX ? MYSQL_INT_CODEC_ID : refuse(value);\n\t\tcase \"bigint\": return MYSQL_BIGINT_CODEC_ID;\n\t\tcase \"string\": return MYSQL_TEXT_CODEC_ID;\n\t\tdefault: return refuse(value);\n\t}\n} };\n//#endregion\n//#region src/core/placeholders.ts\n/** Refuses a lowered statement unless every placeholder is a numbered `?N` naming one of its parameters and every parameter has a placeholder. */\nfunction assertPlaceholdersMatchParams(sql, paramCount) {\n\tconst tokens = tokenizeMysqlSql(sql).filter((token) => token.kind === \"placeholder\");\n\tconst placeholders = tokens.map((token) => token.text);\n\tconst numbers = tokens.map((token) => token.number ?? NaN);\n\tif (numbers.every((number) => number >= 1 && number <= paramCount) && new Set(numbers).size === paramCount) return;\n\tthrow structuredError(\"RUNTIME.PARAM_PLACEHOLDER_MISMATCH\", `The lowered MySQL statement writes placeholders ${JSON.stringify(placeholders)} for ${paramCount} parameter(s); each parameter must be written as its own numbered placeholder, and no other placeholder may appear.`, {\n\t\twhy: \"A placeholder that does not match a parameter binds a value to the wrong place in the statement, or leaves a value unbound.\",\n\t\tfix: \"Pass values into raw SQL through interpolation rather than writing a `?` in the SQL text.\",\n\t\tmeta: {\n\t\t\tplaceholders,\n\t\t\tparams: paramCount\n\t\t}\n\t});\n}\n//#endregion\n//#region src/core/sql-renderer.ts\n/** The name an upsert gives the row it proposes, which its update reads as `new`.`column`; the ORM writes that row as `excluded`, as Postgres names it. */\nconst PROPOSED_ROW = \"new\";\n/**\n* Raises `group_concat_max_len` for this statement only, past any result a connection can send, so an ordered include does not depend on how the driver set up its session. MySQL takes `SET_VAR` only on the outermost `SELECT`.\n*/\nconst GROUP_CONCAT_HINT = \"/*+ SET_VAR(group_concat_max_len = 4294967295) */\";\n/** MySQL's documented way to write an `OFFSET` with no `LIMIT`: the largest row count it takes. */\nconst NO_LIMIT = \"18446744073709551615\";\nfunction nodeKind(value) {\n\treturn typeof value === \"object\" && value !== null && \"kind\" in value ? String(value.kind) : \"unknown\";\n}\nfunction unsupported(feature, message) {\n\treturn mysqlError(\"RUNTIME.AST_UNSUPPORTED\", message, { meta: {\n\t\ttarget: \"mysql\",\n\t\tfeature\n\t} });\n}\n/**\n* Lowers a query AST to MySQL SQL. Each param is written as `?N`, N being its position in `collectOrderedParamRefs`, the order the runtime encodes and middleware edits params in; a param written twice is bound once. The driver fills the placeholders.\n*/\nfunction renderMysqlSql(ast, contract, codecs) {\n\tconst placeholderNumbers = /* @__PURE__ */ new Map();\n\tconst params = collectOrderedParamRefs(ast).map((ref, index) => {\n\t\tplaceholderNumbers.set(ref, index + 1);\n\t\treturn ref.kind === \"prepared-param-ref\" ? {\n\t\t\tkind: \"bind\",\n\t\t\tname: ref.name\n\t\t} : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: ref.value\n\t\t};\n\t});\n\tconst ctx = {\n\t\tcontract,\n\t\tcodecs,\n\t\tplaceholderNumbers,\n\t\tuses: { groupConcat: false }\n\t};\n\tconst rendered = renderStatement(ast, ctx);\n\tconst sql = ctx.uses.groupConcat ? withGroupConcatHint(ast, rendered) : rendered;\n\tassertPlaceholdersMatchParams(sql, params.length);\n\treturn Object.freeze({\n\t\tsql,\n\t\tparams\n\t});\n}\n/** Puts `GROUP_CONCAT_HINT` on the outermost `SELECT`; a statement without one would leave `GROUP_CONCAT` at the session's limit, which can cut an array after an element and still read as JSON, so it is refused. */\nfunction withGroupConcatHint(ast, rendered) {\n\tif (ast.kind !== \"select\" || !rendered.startsWith(\"SELECT \")) throw unsupported(\"ordered-array-outside-select\", \"MySQL can build an ordered JSON array only in a SELECT statement, whose outermost SELECT carries the hint that raises group_concat_max_len\");\n\treturn `SELECT ${GROUP_CONCAT_HINT} ${rendered.slice(7)}`;\n}\nfunction renderStatement(ast, ctx) {\n\tswitch (ast.kind) {\n\t\tcase \"select\": return renderSelect(ast, ctx);\n\t\tcase \"raw-query\": return renderParts(ast.parts, ctx);\n\t\tcase \"insert\": return renderInsert(ast, ctx);\n\t\tcase \"update\": return renderUpdate(ast, ctx);\n\t\tcase \"delete\": return renderDelete(ast, ctx);\n\t\tdefault: throw new InternalError(`Unsupported AST node kind: ${nodeKind(ast)}`);\n\t}\n}\nfunction invalid(node, message) {\n\treturn mysqlError(\"RUNTIME.AST_INVALID\", message, { meta: { node } });\n}\n/** MySQL has no `RETURNING`: the SQL family's ORM reads written rows back with a select when the contract does not report `returning`. */\nfunction refuseReturning(returning, what) {\n\tif (returning !== void 0 && returning.length > 0) throw unsupported(\"returning\", `MySQL cannot return the rows ${what} writes; it has no RETURNING`);\n}\nfunction renderInsertValue(value, ctx) {\n\tif (value === void 0 || value.kind === \"default-value\") return \"DEFAULT\";\n\treturn renderExpr(value, ctx);\n}\n/**\n* An insert, with the bare table name: MySQL's `INSERT` takes no alias, so a column of the table is qualified by its name. A row without a value for a column gets `DEFAULT`. An upsert names its proposed row `new` and updates the existing row on any duplicate key. MySQL cannot limit `ON DUPLICATE KEY UPDATE` to named conflict columns, so the adapter does not report `insertOnConflictTarget` and an upsert that names them is refused. Skipping a conflicting row is refused: `INSERT IGNORE` also hides foreign-key and `NOT NULL` errors.\n*/\nfunction renderInsert(ast, ctx) {\n\trefuseReturning(ast.returning, \"an insert\");\n\tif (ast.rows.length === 0) throw invalid(\"insert\", \"INSERT requires at least one row\");\n\tconst table = qualifyTable(ast.table, ctx);\n\tconst insertCtx = {\n\t\t...ctx,\n\t\tinsertInto: {\n\t\t\talias: ast.table.alias ?? ast.table.name,\n\t\t\tname: table\n\t\t}\n\t};\n\tconst columns = [...new Set(ast.rows.flatMap((row) => Object.keys(row)))];\n\tconst values = ast.rows.map((row) => `(${columns.map((column) => renderInsertValue(row[column], insertCtx)).join(\", \")})`).join(\", \");\n\tconst insert = `INSERT INTO ${table} (${columns.map(quoteIdentifier).join(\", \")}) VALUES ${values}`;\n\tconst conflict = ast.onConflict;\n\tif (conflict === void 0) return insert;\n\tconst action = conflict.action;\n\tswitch (action.kind) {\n\t\tcase \"do-nothing\": throw unsupported(\"insert-on-conflict-skip\", \"MySQL cannot skip a conflicting row without also hiding other errors: INSERT IGNORE turns foreign-key and NOT NULL errors into warnings\");\n\t\tcase \"do-update-set\": {\n\t\t\tif (conflict.columns.length > 0) throw unsupported(\"insert-on-conflict-target\", \"MySQL cannot limit ON DUPLICATE KEY UPDATE to named conflict columns: it fires on any unique key\");\n\t\t\tconst assignments = Object.entries(action.set);\n\t\t\tif (assignments.length === 0) throw invalid(\"insert-on-conflict\", \"An upsert requires at least one column to update\");\n\t\t\tconst set = assignments.map(([column, value]) => `${quoteIdentifier(column)} = ${renderExpr(value, insertCtx)}`).join(\", \");\n\t\t\treturn `${insert} AS ${quoteIdentifier(PROPOSED_ROW)} ON DUPLICATE KEY UPDATE ${set}`;\n\t\t}\n\t\tdefault: return assertNever(action, `Unsupported conflict action: ${nodeKind(action)}`);\n\t}\n}\nfunction renderUpdate(ast, ctx) {\n\trefuseReturning(ast.returning, \"an update\");\n\tconst assignments = Object.entries(ast.set);\n\tif (assignments.length === 0) throw invalid(\"update\", \"UPDATE requires at least one column to set\");\n\tconst set = assignments.map(([column, value]) => `${quoteIdentifier(column)} = ${renderExpr(value, ctx)}`).join(\", \");\n\tconst where = ast.where ? ` WHERE ${renderExpr(ast.where, ctx)}` : \"\";\n\treturn `UPDATE ${renderTableSource(ast.table, ctx)} SET ${set}${where}`;\n}\nfunction renderDelete(ast, ctx) {\n\trefuseReturning(ast.returning, \"a delete\");\n\tconst where = ast.where ? ` WHERE ${renderExpr(ast.where, ctx)}` : \"\";\n\treturn `DELETE FROM ${renderTableSource(ast.table, ctx)}${where}`;\n}\nfunction renderLimitOffset(keyword, value, ctx) {\n\tif (value === void 0) return \"\";\n\tif (typeof value === \"number\") return `${keyword} ${value}`;\n\treturn `${keyword} ${value.kind === \"param-ref\" || value.kind === \"prepared-param-ref\" ? placeholder(value, ctx) : renderExpr(value, ctx)}`;\n}\nfunction renderSelect(ast, ctx) {\n\tif (ast.locking !== void 0 && ast.locking.length > 0) throw unsupported(\"locking-clause\", \"Row locks are not supported on MySQL yet, so a select cannot carry a locking clause such as FOR UPDATE\");\n\tif (ast.distinctOn !== void 0 && ast.distinctOn.length > 0) throw unsupported(\"distinct-on\", \"MySQL has no DISTINCT ON\");\n\treturn [\n\t\t`SELECT ${ast.distinct ? \"DISTINCT \" : \"\"}${renderProjection(ast.projection, ctx)}`,\n\t\tast.from === void 0 ? \"\" : `FROM ${renderSource(ast.from, ctx)}`,\n\t\tast.joins?.length ? ast.joins.map((join) => renderJoin(join, ctx)).join(\" \") : \"\",\n\t\tast.where ? `WHERE ${renderExpr(ast.where, ctx)}` : \"\",\n\t\tast.groupBy?.length ? `GROUP BY ${ast.groupBy.map((e) => renderExpr(e, ctx)).join(\", \")}` : \"\",\n\t\tast.having ? `HAVING ${renderExpr(ast.having, ctx)}` : \"\",\n\t\tast.orderBy?.length ? `ORDER BY ${renderOrderByItems(ast.orderBy, ctx)}` : \"\",\n\t\tast.limit === void 0 && ast.offset !== void 0 ? `LIMIT ${NO_LIMIT}` : renderLimitOffset(\"LIMIT\", ast.limit, ctx),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, ctx)\n\t].filter((part) => part.length > 0).join(\" \");\n}\nfunction renderProjection(projection, ctx) {\n\treturn projection.map((item) => `${renderExpr(item.expr, ctx)} AS ${quoteIdentifier(item.alias)}`).join(\", \");\n}\nfunction qualifyTable(table, ctx) {\n\tif (table.namespaceId === void 0) return quoteIdentifier(table.name);\n\tif (ctx.contract === void 0) throw new InternalError(`Table \"${table.name}\" carries namespace \"${table.namespaceId}\" but no contract was supplied to resolve it`);\n\tconst namespace = ctx.contract.storage.namespaces[table.namespaceId];\n\tif (namespace?.qualifyTable === void 0) throw structuredError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which the contract does not materialise for SQL rendering`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: namespace === void 0 ? \"not-present\" : \"not-materialised\"\n\t} });\n\treturn namespace.qualifyTable(table.name);\n}\nfunction renderTableSource(source, ctx) {\n\tconst qualified = qualifyTable(source, ctx);\n\treturn source.alias ? `${qualified} AS ${quoteIdentifier(source.alias)}` : qualified;\n}\nfunction renderSource(source, ctx) {\n\tswitch (source.kind) {\n\t\tcase \"table-source\": return renderTableSource(source, ctx);\n\t\tcase \"derived-table-source\": return `(${renderSelect(source.query, ctx)}) AS ${quoteIdentifier(source.alias)}`;\n\t\tcase \"function-source\": throw unsupported(\"function-source\", `MySQL cannot select from the set-returning function ${source.fn}`);\n\t\tdefault: return assertNever(source, `Unsupported source node kind: ${nodeKind(source)}`);\n\t}\n}\nfunction renderExpr(expr, ctx) {\n\tswitch (expr.kind) {\n\t\tcase \"column-ref\": return renderColumn(expr, ctx);\n\t\tcase \"identifier-ref\": return quoteIdentifier(expr.name);\n\t\tcase \"operation\": return renderOperation(expr, ctx);\n\t\tcase \"subquery\": return renderSubquery(expr, ctx);\n\t\tcase \"aggregate\": return renderAggregate(expr, ctx);\n\t\tcase \"window-func\": return renderWindowFunc(expr, ctx);\n\t\tcase \"function-call\": return renderFunctionCall(expr, ctx);\n\t\tcase \"cast\": return renderCast(expr, ctx);\n\t\tcase \"case\": return renderCase(expr, ctx);\n\t\tcase \"json-object\": return renderJsonObject(expr, ctx);\n\t\tcase \"json-array-agg\": return renderJsonArrayAgg(expr, ctx);\n\t\tcase \"binary\": return renderBinary(expr, ctx);\n\t\tcase \"and\": return expr.exprs.length === 0 ? \"TRUE\" : `(${expr.exprs.map((part) => renderExpr(part, ctx)).join(\" AND \")})`;\n\t\tcase \"or\": return expr.exprs.length === 0 ? \"FALSE\" : `(${expr.exprs.map((part) => renderExpr(part, ctx)).join(\" OR \")})`;\n\t\tcase \"exists\": return `${expr.notExists ? \"NOT \" : \"\"}EXISTS (${renderSelect(expr.subquery, ctx)})`;\n\t\tcase \"null-check\": return renderNullCheck(expr, ctx);\n\t\tcase \"not\": return `NOT (${renderExpr(expr.expr, ctx)})`;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParam(expr, ctx);\n\t\tcase \"literal\": return renderLiteral(expr);\n\t\tcase \"list\": return renderList(expr, ctx);\n\t\tcase \"raw-expr\": return renderParts(expr.parts, ctx);\n\t\tdefault: return assertNever(expr, `Unsupported expression node kind: ${nodeKind(expr)}`);\n\t}\n}\n/** Refuses raw SQL text that puts a digit right after an interpolated value: the value's `?N` and the digit would read as one larger placeholder, `?1` and `0` as `?10`. */\nfunction assertNoDigitAfterParam(parts) {\n\tparts.forEach((part, index) => {\n\t\tconst next = parts[index + 1];\n\t\tif (typeof part !== \"string\" && (part.kind === \"param-ref\" || part.kind === \"prepared-param-ref\") && typeof next === \"string\" && /^\\d/.test(next)) throw structuredError(\"RUNTIME.PARAM_PLACEHOLDER_MISMATCH\", \"Raw SQL puts a digit right after an interpolated value, which MySQL lowering would read as part of the value's placeholder\", {\n\t\t\twhy: \"Each value is written as a numbered placeholder, ?N, so a digit that follows it in the SQL text makes a different placeholder: ?1 followed by 0 reads as ?10.\",\n\t\t\tfix: \"Put a space or an operator between the interpolated value and the digit.\",\n\t\t\tmeta: {\n\t\t\t\treason: \"digit-after-value\",\n\t\t\t\tpart: index + 1\n\t\t\t}\n\t\t});\n\t});\n}\nfunction renderParts(parts, ctx) {\n\tassertNoDigitAfterParam(parts);\n\treturn parts.map((part) => {\n\t\tif (typeof part === \"string\") return part;\n\t\tswitch (part.kind) {\n\t\t\tcase \"select\": return renderSelect(part, ctx);\n\t\t\tcase \"insert\": return renderInsert(part, ctx);\n\t\t\tcase \"update\": return renderUpdate(part, ctx);\n\t\t\tcase \"delete\": return renderDelete(part, ctx);\n\t\t\tdefault: return renderExpr(part, ctx);\n\t\t}\n\t}).join(\"\");\n}\nfunction renderColumn(ref, ctx) {\n\tconst column = quoteIdentifier(ref.column);\n\tconst { insertInto } = ctx;\n\tif (insertInto !== void 0) {\n\t\tif (ref.table === \"excluded\") return `${quoteIdentifier(PROPOSED_ROW)}.${column}`;\n\t\tif (ref.table === insertInto.alias) return `${insertInto.name}.${column}`;\n\t}\n\treturn `${quoteIdentifier(ref.table)}.${column}`;\n}\n/**\n* A literal the code wrote: a number, a bigint, a boolean or NULL, such as the ORM's `1` and `fns.and(true, …)`. A `LiteralExpr` does not say where its value came from, and no part of Prisma writes a text, date or JSON literal into a MySQL runtime statement, so those are refused: a value of that kind can only be a caller's, which belongs in a param, sent apart from the SQL.\n*/\nfunction renderLiteral(expr) {\n\tconst { value } = expr;\n\tif (value === null || value === void 0) return \"NULL\";\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw unsupported(\"non-finite-number\", `MySQL has no literal for ${value}`);\n\t\treturn String(value);\n\t}\n\tif (typeof value === \"boolean\") return value ? \"TRUE\" : \"FALSE\";\n\tif (typeof value === \"bigint\") return String(value);\n\tthrow unsupported(\"value-literal\", `MySQL lowering writes only numbers, booleans and NULL as literals; a ${value instanceof Date ? \"date\" : Array.isArray(value) ? \"array\" : typeof value} value must be a param`);\n}\n/** Renders each `{{self}}` and `{{argN}}` where the template writes it. */\nfunction renderOperation(expr, ctx) {\n\treturn expr.lowering.template.replace(/\\{\\{(self|arg(\\d+))\\}\\}/g, (_match, _name, index) => {\n\t\tif (index === void 0) return renderExpr(expr.self, ctx);\n\t\tconst arg = expr.args[Number(index)];\n\t\treturn arg === void 0 ? \"\" : renderExpr(arg, ctx);\n\t});\n}\nfunction renderSubquery(expr, ctx, columns = 1) {\n\tif (expr.query.projection.length !== columns) throw structuredError(\"RUNTIME.AST_INVALID\", columns === 1 ? \"Subquery expressions must project exactly one column\" : `A subquery compared with a row value of ${columns} columns must project ${columns} columns`, { meta: { node: \"subquery\" } });\n\treturn `(${renderSelect(expr.query, ctx)})`;\n}\n/** Whether an operand must be parenthesised before an operator is written after it. A new expression kind fails to compile here until someone decides. */\nfunction needsGrouping(expr) {\n\tswitch (expr.kind) {\n\t\tcase \"operation\":\n\t\tcase \"subquery\": return true;\n\t\tcase \"column-ref\":\n\t\tcase \"identifier-ref\":\n\t\tcase \"aggregate\":\n\t\tcase \"window-func\":\n\t\tcase \"function-call\":\n\t\tcase \"cast\":\n\t\tcase \"case\":\n\t\tcase \"json-object\":\n\t\tcase \"json-array-agg\":\n\t\tcase \"binary\":\n\t\tcase \"and\":\n\t\tcase \"or\":\n\t\tcase \"exists\":\n\t\tcase \"null-check\":\n\t\tcase \"not\":\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\tcase \"literal\":\n\t\tcase \"list\":\n\t\tcase \"raw-expr\": return false;\n\t}\n}\nfunction grouped(expr, ctx) {\n\tconst rendered = renderExpr(expr, ctx);\n\treturn needsGrouping(expr) ? `(${rendered})` : rendered;\n}\nfunction renderNullCheck(expr, ctx) {\n\treturn `${grouped(expr.expr, ctx)} ${expr.isNull ? \"IS NULL\" : \"IS NOT NULL\"}`;\n}\nconst BINARY_OPERATORS = {\n\teq: \"=\",\n\tneq: \"<>\",\n\tisNotDistinctFrom: \"<=>\",\n\tgt: \">\",\n\tlt: \"<\",\n\tgte: \">=\",\n\tlte: \"<=\",\n\tlike: \"LIKE\",\n\tin: \"IN\",\n\tnotIn: \"NOT IN\"\n};\nfunction renderBinary(expr, ctx) {\n\tif (expr.right.kind === \"list\" && expr.right.values.length === 0) {\n\t\tif (expr.op === \"in\") return \"FALSE\";\n\t\tif (expr.op === \"notIn\") return \"TRUE\";\n\t}\n\tconst left = grouped(expr.left, ctx);\n\tconst right = expr.right.kind === \"subquery\" && expr.left.kind === \"list\" ? renderSubquery(expr.right, ctx, expr.left.values.length) : renderExpr(expr.right, ctx);\n\tif (expr.op === \"isDistinctFrom\") return `NOT (${left} <=> ${right})`;\n\treturn `${left} ${BINARY_OPERATORS[expr.op]} ${right}`;\n}\nfunction renderList(expr, ctx) {\n\tif (expr.values.length === 0) return \"(NULL)\";\n\treturn `(${expr.values.map((value) => renderExpr(value, ctx)).join(\", \")})`;\n}\nfunction renderAggregate(expr, ctx) {\n\tconst fn = expr.fn.toUpperCase();\n\treturn expr.expr ? `${fn}(${renderExpr(expr.expr, ctx)})` : `${fn}(*)`;\n}\nfunction renderWindowFunc(expr, ctx) {\n\tconst args = expr.args.map((arg) => renderExpr(arg, ctx)).join(\", \");\n\tconst over = [expr.partitionBy?.length ? `PARTITION BY ${expr.partitionBy.map((e) => renderExpr(e, ctx)).join(\", \")}` : \"\", expr.orderBy?.length ? `ORDER BY ${renderOrderByItems(expr.orderBy, ctx)}` : \"\"].filter((part) => part.length > 0).join(\" \");\n\treturn `${expr.fn.toUpperCase()}(${args}) OVER (${over})`;\n}\nfunction renderFunctionCall(expr, ctx) {\n\treturn `${expr.fn}(${expr.args.map((arg) => renderExpr(arg, ctx)).join(\", \")})`;\n}\nfunction renderCast(expr, ctx) {\n\treturn `CAST(${renderExpr(expr.expr, ctx)} AS ${expr.targetType})`;\n}\nfunction renderCase(expr, ctx) {\n\treturn `CASE ${expr.branches.map((branch) => `WHEN ${renderExpr(branch.condition, ctx)} THEN ${renderExpr(branch.value, ctx)}`).join(\" \")}${expr.elseExpr === void 0 ? \"\" : ` ELSE ${renderExpr(expr.elseExpr, ctx)}`} END`;\n}\nfunction descriptorOf(codec, ctx, use) {\n\tconst descriptor = ctx.codecs.descriptorFor(codec.codecId);\n\tif (descriptor === void 0) throw structuredError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `MySQL lowering: ${use} carries codecId \"${codec.codecId}\" but the MySQL codec registry has no entry for it. Register the extension pack that contributes this codec.`, { meta: { codecId: codec.codecId } });\n\treturn descriptor;\n}\nfunction placeholder(ref, ctx) {\n\tconst number = ctx.placeholderNumbers.get(ref);\n\tif (number === void 0) throw new InternalError(\"A param was written that the AST does not collect\");\n\treturn `?${number}`;\n}\n/** A param as its numbered placeholder, refusing one whose codec the MySQL registry lacks. */\nfunction renderParam(ref, ctx) {\n\tif (ref.codec !== void 0) descriptorOf(ref.codec, ctx, \"a parameter\");\n\treturn placeholder(ref, ctx);\n}\nfunction projectThroughCodec(value, codec, ctx) {\n\treturn descriptorOf(codec, ctx, \"a JSON projection\").projectJson(value, codec);\n}\nfunction renderJsonValue(projection, ctx) {\n\treturn projection.accept({\n\t\tcodec: ({ value, codec }) => renderExpr(projectThroughCodec(value, codec, ctx), ctx),\n\t\tnative: ({ value }) => renderExpr(value, ctx),\n\t\tdocument: ({ value }) => renderExpr(value, ctx)\n\t});\n}\nfunction renderJsonObject(expr, ctx) {\n\treturn `JSON_OBJECT(${expr.entries.flatMap((entry) => [`'${escapeLiteral(entry.key)}'`, renderJsonValue(entry.value, ctx)]).join(\", \")})`;\n}\n/**\n* The element of an ordered JSON array, as JSON text. A document already is JSON; a scalar goes through `JSON_ARRAY`, so a string arrives quoted and escaped.\n*/\nfunction renderJsonElementText(projection, ctx) {\n\tconst rendered = renderJsonValue(projection, ctx);\n\treturn projection.kind === \"document\" ? rendered : `JSON_EXTRACT(JSON_ARRAY(${rendered}), '$[0]')`;\n}\n/**\n* `JSON_ARRAYAGG` takes no `ORDER BY`, and MySQL drops a derived table's `ORDER BY` when the outer query aggregates, so an ordered array is built as text with `GROUP_CONCAT`, which keeps its own order, and cast to JSON. The statement raises `group_concat_max_len` past any result a connection can send (see `GROUP_CONCAT_HINT`), so `GROUP_CONCAT` never cuts the text short. Text longer than `max_allowed_packet` makes `CONCAT` return NULL with only a warning, which would read as an empty include; so an empty array is written only when there are no rows, and a NULL text with rows is replaced by text that is not JSON, which fails the cast and the statement with MySQL's invalid-JSON error. `JSON_ARRAYAGG` fails on its own when its result exceeds a packet. An empty array is `JSON_ARRAY()`, so the column stays JSON and a nested include stays an array.\n*/\nfunction renderJsonArrayAgg(expr, ctx) {\n\tif (expr.orderBy === void 0) {\n\t\tconst aggregated = `JSON_ARRAYAGG(${renderJsonValue(expr.expr, ctx)})`;\n\t\treturn expr.onEmpty === \"emptyArray\" ? `COALESCE(${aggregated}, JSON_ARRAY())` : aggregated;\n\t}\n\tctx.uses.groupConcat = true;\n\tconst text = `CONCAT('[', GROUP_CONCAT(${renderJsonElementText(expr.expr, ctx)} ORDER BY ${renderOrderByItems(expr.orderBy, ctx)} SEPARATOR ','), ']')`;\n\treturn `CASE WHEN COUNT(*) = 0 THEN ${expr.onEmpty === \"emptyArray\" ? \"JSON_ARRAY()\" : \"NULL\"} ELSE CAST(COALESCE(${text}, ${OVERSIZED_ARRAY_TEXT}) AS JSON) END`;\n}\n/** Text that is not JSON, written in place of an array MySQL could not build because it is larger than a packet, so the cast fails. MySQL's error does not show this text: the user sees `Invalid JSON text in argument 1 to function cast_as_json`, which names neither the include nor the packet size. The text counts the rows only so that MySQL evaluates it when it is reached, not while preparing the statement. */\nconst OVERSIZED_ARRAY_TEXT = \"CONCAT('array larger than max_allowed_packet: ', COUNT(*), ' rows')\";\nconst ORDER_DIRECTION = {\n\tasc: \"ASC\",\n\tdesc: \"DESC\"\n};\n/** A NULLS FIRST or NULLS LAST placement, which MySQL lacks, as a leading `IS NULL` sort key. */\nconst NULLS_KEY_DIRECTION = {\n\tfirst: \"DESC\",\n\tlast: \"ASC\"\n};\nfunction renderOrderByItem(item, ctx) {\n\treturn `${item.nulls === void 0 ? \"\" : `${grouped(item.expr, ctx)} IS NULL ${NULLS_KEY_DIRECTION[item.nulls]}, `}${renderExpr(item.expr, ctx)} ${ORDER_DIRECTION[item.dir]}`;\n}\nfunction renderOrderByItems(items, ctx) {\n\treturn items.map((item) => renderOrderByItem(item, ctx)).join(\", \");\n}\nfunction renderJoin(join, ctx) {\n\tif (join.joinType === \"full\") throw unsupported(\"full-join\", \"MySQL has no FULL JOIN\");\n\tif (join.lateral) throw unsupported(\"lateral-join\", \"LATERAL joins are not supported on MySQL yet\");\n\treturn `${join.joinType.toUpperCase()} JOIN ${renderSource(join.source, ctx)} ON ${renderJoinOn(join.on, ctx)}`;\n}\nfunction renderJoinOn(on, ctx) {\n\treturn on.kind === \"eq-col-join-on\" ? `${renderColumn(on.left, ctx)} = ${renderColumn(on.right, ctx)}` : renderExpr(on, ctx);\n}\n//#endregion\n//#region src/core/runtime/mysql-adapter.ts\nfunction markerQuery(queryable) {\n\treturn { async query(sql, params) {\n\t\tconst rows = [];\n\t\tfor await (const row of queryable.query({\n\t\t\tsql,\n\t\t\t...params ? { params } : {}\n\t\t})) rows.push(row);\n\t\treturn { rows };\n\t} };\n}\nvar MysqlAdapterImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"mysql\";\n\tprofile;\n\t#codecs;\n\tconstructor(codecs) {\n\t\tthis.#codecs = codecs;\n\t\tthis.profile = Object.freeze({\n\t\t\tid: \"mysql/default@1\",\n\t\t\ttarget: \"mysql\",\n\t\t\tcapabilities: mysqlAdapterCapabilities,\n\t\t\treadMarker: (queryable) => readMarkerResult(markerQuery(queryable), APP_SPACE_ID)\n\t\t});\n\t}\n\tlower(ast, context) {\n\t\tif (isDdlNode(ast)) throw structuredError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() does not lower DDL on the runtime adapter: DDL lowering belongs to the control adapter.\", { meta: { surface: \"runtime-adapter\" } });\n\t\treturn renderMysqlSql(ast, context.contract, this.#codecs);\n\t}\n};\n/** The MySQL runtime adapter: it lowers queries with the MySQL renderer and reads the marker 2b's control tables hold. */\nfunction createMysqlAdapter(codecs) {\n\treturn Object.freeze(new MysqlAdapterImpl(codecs));\n}\n//#endregion\n//#region src/core/runtime/runtime-adapter.ts\n/** The `now()` generators of the MySQL date and time types: the SQL family's `timestampNow` for a `Date`, and the target's for every other value. */\nfunction createMysqlMutationDefaultGenerators() {\n\treturn [timestampNowRuntimeGenerator(), ...mysqlNowGenerators.map(({ id, generate }) => ({\n\t\tid,\n\t\tgenerate,\n\t\tstability: \"query\"\n\t}))];\n}\nconst mysqlRuntimeAdapterDescriptor = {\n\t...mysqlAdapterDescriptorMeta,\n\tcodecs: () => Array.from(mysqlCodecDescriptorRegistry.values()),\n\tmutationDefaultGenerators: createMysqlMutationDefaultGenerators,\n\trawCodecInferer: mysqlRawCodecInferer,\n\tcreate(stack) {\n\t\treturn createMysqlAdapter(assembleMysqlCodecRegistry(stack.target, stack.extensions));\n\t}\n};\n//#endregion\nexport { mysqlRuntimeAdapterDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,UAAU,EAAE,KAAK;AACvB,MAAM,UAAU,KAAK,KAAK;AAC1B,SAAS,OAAO,OAAO;CACtB,MAAM,gBAAgB,6CAA6C,mGAAmG,EAAE,MAAM,EAAE,WAAW,OAAO,MAAM,EAAE,CAAC;AAC5M;;AAEA,MAAM,uBAAuB,EAAE,WAAW,OAAO;CAChD,QAAQ,OAAO,OAAf;EACC,KAAK;GACJ,IAAI,CAAC,OAAO,cAAc,KAAK,GAAG,OAAO,OAAO,KAAK;GACrD,OAAO,SAAS,WAAW,SAAS,UAAU,qBAAqB,OAAO,KAAK;EAChF,KAAK,UAAU,OAAO;EACtB,KAAK,UAAU,OAAO;EACtB,SAAS,OAAO,OAAO,KAAK;CAC7B;AACD,EAAE;;AAIF,SAAS,8BAA8B,KAAK,YAAY;CACvD,MAAM,SAAS,iBAAiB,GAAG,CAAC,CAAC,QAAQ,UAAU,MAAM,SAAS,aAAa;CACn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EAC3B,CAAC,GAAG,KAAK,KAAK,GAAG;EACjB,OAAO,EAAE,KAAK;CACf,EAAE;AACH;AACA,IAAI,mBAAmB,MAAM;CAC5B,WAAW;CACX,WAAW;CACX;CACA;CACA,YAAY,QAAQ;EACnB,KAAKA,UAAU;EACf,KAAK,UAAU,OAAO,OAAO;GAC5B,IAAI;GACJ,QAAQ;GACR,cAAc;GACd,aAAa,cAAc,iBAAiB,YAAY,SAAS,GAAG,YAAY;EACjF,CAAC;CACF;CACA,MAAM,KAAK,SAAS;EACnB,IAAI,UAAU,GAAG,GAAG,MAAM,gBAAgB,2BAA2B,mGAAmG,EAAE,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;EAChN,OAAO,eAAe,KAAK,QAAQ,UAAU,KAAKA,OAAO;CAC1D;AACD;;AAEA,SAAS,mBAAmB,QAAQ;CACnC,OAAO,OAAO,OAAO,IAAI,iBAAiB,MAAM,CAAC;AAClD;;AAIA,SAAS,uCAAuC;CAC/C,OAAO,CAAC,6BAA6B,GAAG,GAAG,mBAAmB,KAAK,EAAE,IAAI,gBAAgB;EACxF;EACA;EACA,WAAW;CACZ,EAAE,CAAC;AACJ;AACA,MAAM,gCAAgC;CACrC,GAAG;CACH,cAAc,MAAM,KAAK,6BAA6B,OAAO,CAAC;CAC9D,2BAA2B;CAC3B,iBAAiB;CACjB,OAAO,OAAO;EACb,OAAO,mBAAmB,2BAA2B,MAAM,QAAQ,MAAM,UAAU,CAAC;CACrF;AACD"}
@@ -6,7 +6,7 @@ import { n as LEDGER_TABLE_NAME, r as MARKER_TABLE_NAME, t as CONTROL_TABLE_NAME
6
6
  import { n as buildSignMarkerBootstrapQueries, t as buildControlTableBootstrapQueries } from "./contract-free-DekbHRyr.mjs";
7
7
  import { n as readMysqlDefault } from "./default-normalizer-C8pc7SbL-BXd70q02.mjs";
8
8
  import { i as withMarkerLock } from "./marker-lock-Bwew7cAs-ElLxlCQp.mjs";
9
- import { r as mysqlAdapterDescriptorMeta } from "./descriptor-meta-pVdZBI-g-BJN4T_on.mjs";
9
+ import { r as mysqlAdapterDescriptorMeta } from "./descriptor-meta-e29H69KN-t-S8_DYh.mjs";
10
10
  import { a as tableExists, i as readMarkerRows, n as parseJsonColumn, r as readMarkerResult, t as decodeMysqlMarkerRow } from "./marker-read-D1hp62hF-3-4fEgDD.mjs";
11
11
  import { codecForRef } from "@prisma/orm-framework/components/codec";
12
12
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
@@ -610,4 +610,4 @@ const mysqlAdapterDescriptor = {
610
610
  //#endregion
611
611
  export { readMysqlCatalog as a, mysqlAdapterDescriptor as i, buildMysqlSchemaIR as n, createMysqlControlAdapter as r, MYSQL_CATALOG_QUERIES as t };
612
612
 
613
- //# sourceMappingURL=control-CyGJDPay.mjs.map
613
+ //# sourceMappingURL=control-DDjdwyGa.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-CyGJDPay.mjs","names":["#inTransaction"],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/control.mjs"],"sourcesContent":["import { t as mysqlAdapterDescriptorMeta } from \"./descriptor-meta-pVdZBI-g.mjs\";\nimport { a as tableExists, i as readMarkerRows, n as parseJsonColumn, r as readMarkerResult, t as decodeMysqlMarkerRow } from \"./marker-read-D1hp62hF.mjs\";\nimport { assembleMysqlCodecRegistry, decodeMysqlDatetime, encodeMysqlDatetime, mysqlCurrentValueFor, mysqlNowExpression } from \"@internal/target-mysql/codecs\";\nimport { checkSqlDefaultText, contractColumns, readColumnDefault, sqlDefaultFunctions } from \"@internal/family-sql/control\";\nimport { parseMarkerRowSafely, withMarkerReadErrorHandling } from \"@internal/errors/execution\";\nimport { codecForRef } from \"@internal/framework-components/codec\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { encodeLiteralDefault, isDdlNode, renderOpaqueSql } from \"@internal/sql-relational-core/ast\";\nimport { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries } from \"@internal/target-mysql/contract-free\";\nimport { CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME } from \"@internal/target-mysql/control-tables\";\nimport { mysqlQueryNotYetSupported } from \"@internal/target-mysql/errors\";\nimport { withMarkerLock } from \"@internal/target-mysql/marker-lock\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { quoteIdentifier, quoteLiteral } from \"@internal/target-mysql/sql-utils\";\nimport { REFERENTIAL_ACTION_SQL } from \"@internal/sql-contract/referential-action-sql\";\nimport { resolveIntrospectedColumnType } from \"@internal/family-sql/control-adapter\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { readMysqlDefault } from \"@internal/target-mysql/default-normalizer\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ledgerOriginFromStored } from \"@internal/migration-tools/ledger-origin\";\n//#region src/core/migrations/ddl-renderer.ts\n/** Column types MySQL gives a default only when it is written as an expression in parentheses. */\nconst EXPRESSION_DEFAULT_ONLY = /^(?:(?:tiny|medium|long)?(?:text|blob)|json|geometry)\\b/i;\nconst FRACTIONAL_SECONDS = /^(?:datetime|timestamp|time)\\((\\d)\\)$/i;\nfunction refusedDefault(where, why) {\n\tthrow structuredError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${where.table}\".\"${where.column}\" has a default MySQL cannot store: ${why}`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column\n\t} });\n}\n/** A wire value as the SQL literal MySQL reads for it. */\nfunction mysqlInlineLiteral(wire, where) {\n\tif (wire === null) return \"NULL\";\n\tif (typeof wire === \"boolean\") return wire ? \"1\" : \"0\";\n\tif (typeof wire === \"number\") {\n\t\tif (!Number.isFinite(wire)) return refusedDefault(where, `${wire} is not a finite number`);\n\t\treturn String(wire);\n\t}\n\tif (typeof wire === \"bigint\") return String(wire);\n\tif (typeof wire === \"string\") return quoteLiteral(wire);\n\tif (wire instanceof Date) return quoteLiteral(encodeMysqlDatetime(wire));\n\tif (wire instanceof Uint8Array) return `X'${Buffer.from(wire).toString(\"hex\")}'`;\n\tif (typeof wire === \"object\") return quoteLiteral(JSON.stringify(wire));\n\treturn refusedDefault(where, `a ${typeof wire} has no SQL literal`);\n}\nfunction withinParentheses(columnType, literal) {\n\treturn EXPRESSION_DEFAULT_ONLY.test(columnType.trim()) ? `(${literal})` : literal;\n}\n/**\n* The expression a `now()` default is written as: the current value the column's data type holds, `CURRENT_TIMESTAMP`, `CURRENT_DATE` or `CURRENT_TIME`, with the column's fractional-second precision, which MySQL requires to match. A column of a data type that holds no date or time is refused.\n*/\nfunction nowExpressionFor(columnType, codecLookup, codecRef, where) {\n\tconst dataType = codecRef === void 0 ? void 0 : codecLookup.descriptorFor(codecRef.codecId)?.dataType;\n\tconst current = mysqlCurrentValueFor(dataType);\n\tif (current === void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `The column \"${where.table}\".\"${where.column}\" has a now() default, but its data type ${dataType} stores no date or time, so there is no current value to write. Remove the default, or give the field a date or time type.`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column,\n\t\tdataType,\n\t\treason: \"now-default-not-date-or-time\"\n\t} });\n\tconst precision = FRACTIONAL_SECONDS.exec(columnType.trim())?.[1];\n\treturn mysqlNowExpression(current, precision === void 0 ? void 0 : Number(precision));\n}\n/**\n* The `DEFAULT …` clause of a column, or `''` for an `autoincrement()` default, which a column writes as `AUTO_INCREMENT` instead. A literal is read by the column's codec, and a text or blob column's literal is written as an expression, as MySQL requires.\n*/\nasync function renderMysqlColumnDefault(def, columnType, codecLookup, codecRef, where) {\n\tif (def.kind === \"function\") {\n\t\tconst text = def.expression.text;\n\t\tif (text === \"autoincrement()\") return \"\";\n\t\tif (text === \"now()\") return `DEFAULT (${nowExpressionFor(columnType, codecLookup, codecRef, where)})`;\n\t\tif (checkSqlDefaultText(text) !== void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `Unsafe default expression in contract: \"${text}\". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression: text } });\n\t\treturn `DEFAULT (${renderOpaqueSql(def.expression)})`;\n\t}\n\tconst encoded = codecRef === void 0 ? void 0 : await encodeLiteralDefault(codecLookup, codecRef, def.value, where);\n\tif (encoded?.kind === \"sql-null\") return \"DEFAULT NULL\";\n\treturn `DEFAULT ${withinParentheses(columnType, mysqlInlineLiteral(encoded === void 0 ? def.value : encoded.wire, where))}`;\n}\nfunction isAutoincrement(column) {\n\treturn column.default?.kind === \"function\" && column.default.expression.text === \"autoincrement()\";\n}\nasync function renderColumn(column, codecLookup, table) {\n\tconst parts = [quoteIdentifier(column.name), column.type];\n\tif (column.notNull) parts.push(\"NOT NULL\");\n\tif (column.default !== void 0) {\n\t\tconst clause = await renderMysqlColumnDefault(column.default, column.type, codecLookup, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t\tif (clause.length > 0) parts.push(clause);\n\t}\n\tif (isAutoincrement(column)) parts.push(\"AUTO_INCREMENT\");\n\tif (column.primaryKey) parts.push(\"PRIMARY KEY\");\n\treturn parts.join(\" \");\n}\nfunction columnList(columns) {\n\treturn columns.map(quoteIdentifier).join(\", \");\n}\nfunction named(name, body) {\n\treturn name === void 0 ? body : `CONSTRAINT ${quoteIdentifier(name)} ${body}`;\n}\nfunction renderConstraint(constraint) {\n\tswitch (constraint.kind) {\n\t\tcase \"primary-key\": return named(constraint.name, `PRIMARY KEY (${columnList(constraint.columns)})`);\n\t\tcase \"unique\": return named(constraint.name, `UNIQUE (${columnList(constraint.columns)})`);\n\t\tcase \"foreign-key\": {\n\t\t\tconst actions = [constraint.onDelete === void 0 ? void 0 : `ON DELETE ${REFERENTIAL_ACTION_SQL[constraint.onDelete]}`, constraint.onUpdate === void 0 ? void 0 : `ON UPDATE ${REFERENTIAL_ACTION_SQL[constraint.onUpdate]}`].filter((action) => action !== void 0);\n\t\t\treturn named(constraint.name, [`FOREIGN KEY (${columnList(constraint.columns)}) REFERENCES ${quoteIdentifier(constraint.refTable)} (${columnList(constraint.refColumns)})`, ...actions].join(\" \"));\n\t\t}\n\t\tcase \"check-expression\": throw structuredError(\"CONTRACT.CONSTRAINT_INVALID\", `The MySQL target does not write CHECK constraints yet (constraint \"${constraint.name}\").`, { meta: { constraintName: constraint.name } });\n\t}\n}\n/** The `CREATE TABLE` statement of a MySQL DDL node. */\nasync function renderMysqlCreateTable(node, codecLookup) {\n\tconst definitions = [...await Promise.all(node.columns.map((column) => renderColumn(column, codecLookup, node.table))), ...(node.constraints ?? []).map(renderConstraint)];\n\treturn {\n\t\tsql: `CREATE TABLE ${node.ifNotExists === true ? \"IF NOT EXISTS \" : \"\"}${quoteIdentifier(node.table)} (\\n ${definitions.join(\",\\n \")}\\n)`,\n\t\tparams: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/declared-indexes.ts\nfunction isLoose(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction child(value, key) {\n\tconst found = isLoose(value) ? value[key] : void 0;\n\treturn isLoose(found) ? found : void 0;\n}\nfunction tableIndexKey(tableName, indexName) {\n\treturn JSON.stringify([tableName, indexName]);\n}\n/** The indexes the contract handed to introspection declares, read from every contract space it holds. */\nfunction declaredIndexes(contract) {\n\tconst contracts = isLoose(contract) && Array.isArray(contract[\"contracts\"]) ? contract[\"contracts\"] : [contract];\n\tconst declared = /* @__PURE__ */ new Set();\n\tconst declaredUnique = /* @__PURE__ */ new Set();\n\tfor (const space of contracts) for (const namespace of Object.values(child(child(space, \"storage\"), \"namespaces\") ?? {})) for (const [tableName, table] of Object.entries(child(child(namespace, \"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) || typeof index[\"name\"] !== \"string\") continue;\n\t\t\tconst key = tableIndexKey(tableName, index[\"name\"]);\n\t\t\tdeclared.add(key);\n\t\t\tif (index[\"unique\"] === true) declaredUnique.add(key);\n\t\t}\n\t}\n\treturn {\n\t\tdeclaresIndex: (tableName, indexName) => declared.has(tableIndexKey(tableName, indexName)),\n\t\tdeclaresUniqueIndex: (tableName, indexName) => declaredUnique.has(tableIndexKey(tableName, indexName))\n\t};\n}\n//#endregion\n//#region src/core/migrations/introspection.ts\nconst NOTHING_DECLARED = {\n\tdeclaresIndex: () => false,\n\tdeclaresUniqueIndex: () => false\n};\nconst PRIMARY_INDEX = \"PRIMARY\";\nconst REFERENTIAL_ACTIONS = {\n\tRESTRICT: \"restrict\",\n\tCASCADE: \"cascade\",\n\t\"SET NULL\": \"setNull\",\n\t\"SET DEFAULT\": \"setDefault\"\n};\n/** A rule `REFERENTIAL_CONSTRAINTS` reports, with `NO ACTION`, MySQL's default, as no action at all. */\nfunction referentialAction(rule) {\n\tconst normalized = rule.toUpperCase();\n\tif (normalized === \"NO ACTION\") return void 0;\n\tconst action = REFERENTIAL_ACTIONS[normalized];\n\tif (action === void 0) throw structuredError(\"CONTRACT.INTROSPECTION_UNSUPPORTED\", `Unknown MySQL referential action rule: \"${rule}\". Expected one of: NO ACTION, RESTRICT, CASCADE, SET NULL, SET DEFAULT.`, { meta: { rule } });\n\treturn action;\n}\nfunction tableDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\nfunction columnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction groupBy(rows, key) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const row of rows) {\n\t\tconst group = groups.get(key(row));\n\t\tif (group === void 0) groups.set(key(row), [row]);\n\t\telse group.push(row);\n\t}\n\treturn groups;\n}\nfunction byPosition(position) {\n\treturn (a, b) => Number(position(a)) - Number(position(b));\n}\nasync function columnOf(row, dataTypes, readLiteralDefault) {\n\tconst reported = readMysqlDefault(row.column_default, row.extra);\n\tconst readDefault = reported === void 0 ? {} : reported.kind === \"function\" ? { resolvedDefault: reported } : await readLiteralDefault(row.table_name, row.column_name, reported.literal.body);\n\tconst reportedType = {\n\t\ttext: row.column_type,\n\t\tkind: void 0,\n\t\tschema: void 0,\n\t\tname: void 0\n\t};\n\treturn {\n\t\tname: row.column_name,\n\t\ttypeText: row.column_type,\n\t\tnullable: row.is_nullable === \"YES\",\n\t\t...ifDefined(\"default\", row.column_default ?? void 0),\n\t\t...readDefault,\n\t\treportedType,\n\t\t...resolveIntrospectedColumnType(reportedType, dataTypes)\n\t};\n}\nfunction indexesOf(rows) {\n\treturn [...groupBy(rows, (row) => row.index_name).entries()].map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.seq_in_index));\n\t\tconst expressions = ordered.flatMap((part) => part.expression === null ? [] : [part.expression]);\n\t\treturn {\n\t\t\tname,\n\t\t\tunique: ordered[0]?.non_unique === \"0\",\n\t\t\tcolumns: ordered.flatMap((part) => part.column_name === null ? [] : [part.column_name]),\n\t\t\texpression: expressions.length === 0 ? void 0 : expressions.join(\", \")\n\t\t};\n\t});\n}\nfunction sameColumns(a, b) {\n\treturn a.length === b.length && a.every((column, index) => column === b[index]);\n}\nfunction foreignKeysOf(tableName, rows) {\n\treturn [...groupBy(rows, (row) => row.constraint_name).entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.ordinal_position));\n\t\tconst [first] = ordered;\n\t\tconst columns = ordered.map((part) => part.column_name);\n\t\tconst referencedTable = first?.referenced_table_name ?? \"\";\n\t\tconst referencedSchema = first?.referenced_table_schema ?? void 0;\n\t\treturn {\n\t\t\tcolumns,\n\t\t\treferencedTable,\n\t\t\treferencedColumns: ordered.map((part) => part.referenced_column_name),\n\t\t\t...ifDefined(\"referencedSchema\", referencedSchema),\n\t\t\tname,\n\t\t\t...ifDefined(\"onDelete\", first === void 0 ? void 0 : referentialAction(first.delete_rule)),\n\t\t\t...ifDefined(\"onUpdate\", first === void 0 ? void 0 : referentialAction(first.update_rule)),\n\t\t\tdependsOn: [...referencedSchema === void 0 ? [tableDependsOn(referencedTable)] : [], ...columnDependsOn(tableName, columns)]\n\t\t};\n\t});\n}\n/**\n* The index InnoDB creates for a foreign key that no index already serves: it carries the key's name and exactly the key's columns. Introspection leaves it out, because the contract describes the key, not that index. An explicit index can look the same, so one the contract declares is kept.\n*/\nfunction isForeignKeyIndex(tableName, index, foreignKeys, declared) {\n\tif (declared.declaresIndex(tableName, index.name)) return false;\n\treturn foreignKeys.some((fk) => fk.name === index.name && index.expression === void 0 && sameColumns(fk.columns, index.columns));\n}\nasync function tableOf(tableName, rows, dataTypes, readLiteralDefault, declared) {\n\tconst columns = {};\n\tfor (const row of [...rows.columns].sort(byPosition((column) => column.ordinal_position))) columns[row.column_name] = await columnOf(row, dataTypes, readLiteralDefault);\n\tconst foreignKeys = foreignKeysOf(tableName, rows.foreignKeys);\n\tconst indexes = indexesOf(rows.indexes);\n\tconst expressionIndexNames = new Set(indexes.filter((index) => index.expression !== void 0).map((index) => index.name));\n\tconst uniqueConstraintNames = new Set(rows.constraints.filter((constraint) => constraint.constraint_type === \"UNIQUE\" && !expressionIndexNames.has(constraint.constraint_name) && !declared.declaresUniqueIndex(tableName, constraint.constraint_name)).map((constraint) => constraint.constraint_name));\n\tconst primary = indexes.find((index) => index.name === PRIMARY_INDEX);\n\tconst primaryKey = primary === void 0 ? void 0 : {\n\t\tcolumns: primary.columns,\n\t\tdependsOn: columnDependsOn(tableName, primary.columns)\n\t};\n\tconst uniques = indexes.filter((index) => uniqueConstraintNames.has(index.name)).map((index) => ({\n\t\tcolumns: index.columns,\n\t\tname: index.name,\n\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t}));\n\tconst plainIndexes = indexes.filter((index) => index.name !== PRIMARY_INDEX && !uniqueConstraintNames.has(index.name) && !isForeignKeyIndex(tableName, index, foreignKeys, declared)).map((index) => {\n\t\tconst base = {\n\t\t\tnaming: {\n\t\t\t\tkind: \"exact\",\n\t\t\t\tname: index.name\n\t\t\t},\n\t\t\twhere: void 0,\n\t\t\tunique: index.unique,\n\t\t\tpartial: false,\n\t\t\ttype: void 0,\n\t\t\toptions: void 0,\n\t\t\tannotations: void 0,\n\t\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t\t};\n\t\treturn index.expression === void 0 ? {\n\t\t\t...base,\n\t\t\tcolumns: index.columns\n\t\t} : {\n\t\t\t...base,\n\t\t\texpression: index.expression\n\t\t};\n\t});\n\treturn new SqlTableIR({\n\t\tname: tableName,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\tforeignKeys,\n\t\tuniques,\n\t\tindexes: plainIndexes\n\t});\n}\n/**\n* The schema IR of the database the rows describe: one flat tree of its tables. MySQL lists every unique index as a UNIQUE constraint, so one is reported as a unique constraint unless the contract declares a unique index of that name on the table, or it indexes an expression. The index InnoDB creates for a foreign key is left out, unless the contract declares an index of that name on the table.\n*/\nasync function buildMysqlSchemaIR(rows, dataTypes, readLiteralDefault, declared = NOTHING_DECLARED) {\n\tconst columnsByTable = groupBy(rows.columns, (row) => row.table_name);\n\tconst indexesByTable = groupBy(rows.indexes, (row) => row.table_name);\n\tconst constraintsByTable = groupBy(rows.constraints, (row) => row.table_name);\n\tconst foreignKeysByTable = groupBy(rows.foreignKeys, (row) => row.table_name);\n\tconst tables = {};\n\tfor (const tableName of rows.tables) tables[tableName] = await tableOf(tableName, {\n\t\tcolumns: columnsByTable.get(tableName) ?? [],\n\t\tindexes: indexesByTable.get(tableName) ?? [],\n\t\tconstraints: constraintsByTable.get(tableName) ?? [],\n\t\tforeignKeys: foreignKeysByTable.get(tableName) ?? []\n\t}, dataTypes, readLiteralDefault, declared);\n\treturn new SqlSchemaIR({ tables });\n}\n//#endregion\n//#region src/core/migrations/marker-ledger.ts\nconst LEDGER_COLUMNS = \"space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations, created_at\";\nfunction operationCount(operations) {\n\tconst parsed = typeof operations === \"string\" ? parseOperations(operations) : operations;\n\treturn Array.isArray(parsed) ? parsed.length : 0;\n}\nfunction parseOperations(text) {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction text(row, column) {\n\tconst value = row[column];\n\treturn typeof value === \"string\" ? value : String(value);\n}\n/** The ledger's entries for `space`, or for every space, in the order they were applied. */\nasync function readLedgerEntries(driver, space) {\n\tif (!await tableExists(driver, LEDGER_TABLE_NAME)) return [];\n\tconst select = `SELECT ${LEDGER_COLUMNS} FROM ${quoteIdentifier(LEDGER_TABLE_NAME)}`;\n\tconst { rows } = space === void 0 ? await driver.query(`${select} ORDER BY id`) : await driver.query(`${select} WHERE space = ? ORDER BY id`, [space]);\n\treturn rows.map((row) => {\n\t\tconst origin = row[\"origin_core_hash\"];\n\t\treturn {\n\t\t\tspace: text(row, \"space\"),\n\t\t\tmigrationName: text(row, \"migration_name\"),\n\t\t\tmigrationHash: text(row, \"migration_hash\"),\n\t\t\tfrom: ledgerOriginFromStored(typeof origin === \"string\" ? origin : null),\n\t\t\tto: text(row, \"destination_core_hash\"),\n\t\t\tappliedAt: decodeMysqlDatetime(text(row, \"created_at\")),\n\t\t\toperationCount: operationCount(row[\"operations\"])\n\t\t};\n\t});\n}\n/** Every column of the marker row except its key, `space`, with what both the insert and the upsert's update write to it. */\nconst MARKER_COLUMNS = [\n\t[\"core_hash\", (destination) => destination.storageHash],\n\t[\"profile_hash\", (destination) => destination.profileHash],\n\t[\"contract_json\", \"NULL\"],\n\t[\"canonical_version\", \"NULL\"],\n\t[\"updated_at\", \"CURRENT_TIMESTAMP(3)\"],\n\t[\"app_tag\", \"NULL\"],\n\t[\"meta\", \"'{}'\"],\n\t[\"invariants\", (destination) => JSON.stringify(destination.invariants ?? [])]\n];\nfunction markerValueSql(value) {\n\treturn typeof value === \"string\" ? value : \"?\";\n}\nconst MARKER_INSERT = `INSERT INTO ${quoteIdentifier(MARKER_TABLE_NAME)} (space, ${MARKER_COLUMNS.map(([column]) => column).join(\", \")}) VALUES (?, ${MARKER_COLUMNS.map(([, value]) => markerValueSql(value)).join(\", \")})`;\nconst MARKER_UPDATE = MARKER_COLUMNS.map(([column, value]) => `${column} = ${markerValueSql(value)}`).join(\", \");\nfunction markerColumnParams(destination) {\n\treturn MARKER_COLUMNS.flatMap(([, value]) => typeof value === \"string\" ? [] : [value(destination)]);\n}\n/** Inserts the marker row of `space`; fails when the space already has one. */\nasync function insertMarkerRow(driver, space, destination) {\n\tawait driver.query(MARKER_INSERT, [space, ...markerColumnParams(destination)]);\n}\n/** Writes the marker row of `space`, replacing the row the space already has. The update binds the values again instead of naming a row alias, which MariaDB does not accept, or `VALUES()`, which MySQL deprecates. */\nasync function upsertMarkerRow(driver, space, destination) {\n\tconst params = markerColumnParams(destination);\n\tawait driver.query(`${MARKER_INSERT} ON DUPLICATE KEY UPDATE ${MARKER_UPDATE}`, [\n\t\tspace,\n\t\t...params,\n\t\t...params\n\t]);\n}\nfunction invariantsOf(text) {\n\tconst parsed = parseJsonColumn(\"invariants\", text);\n\treturn Array.isArray(parsed) ? parsed.filter((item) => typeof item === \"string\") : [];\n}\n/**\n* Advances the marker row of `space` from `expectedFrom` to `destination`, and says whether it did. MySQL has no `RETURNING`, so the row is read and locked with `FOR UPDATE` first, inside the transaction the caller holds, and written only when it still holds `expectedFrom`. Supplied invariants are merged with the stored ones.\n*/\nasync function compareAndSwapMarkerRow(driver, space, expectedFrom, destination) {\n\tconst { rows } = await driver.query(`SELECT core_hash, invariants FROM ${quoteIdentifier(MARKER_TABLE_NAME)} WHERE space = ? FOR UPDATE`, [space]);\n\tconst [row] = rows;\n\tif (row === void 0 || row[\"core_hash\"] !== expectedFrom) return false;\n\tconst invariants = destination.invariants === void 0 ? void 0 : [.../* @__PURE__ */ new Set([...invariantsOf(row[\"invariants\"]), ...destination.invariants])].sort();\n\tawait driver.query(`UPDATE ${quoteIdentifier(MARKER_TABLE_NAME)} SET core_hash = ?, profile_hash = ?, updated_at = CURRENT_TIMESTAMP(3)${invariants === void 0 ? \"\" : \", invariants = ?\"} WHERE space = ? AND core_hash = ?`, [\n\t\tdestination.storageHash,\n\t\tdestination.profileHash,\n\t\t...invariants === void 0 ? [] : [JSON.stringify(invariants)],\n\t\tspace,\n\t\texpectedFrom\n\t]);\n\treturn true;\n}\n/** Appends a ledger entry for `space`. */\nasync function insertLedgerRow(driver, space, entry) {\n\tawait driver.query(`INSERT INTO ${quoteIdentifier(LEDGER_TABLE_NAME)} (space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations) VALUES (?, ?, ?, ?, ?, ?)`, [\n\t\tspace,\n\t\tentry.migrationName,\n\t\tentry.migrationHash,\n\t\tentry.from,\n\t\tentry.to,\n\t\tJSON.stringify(entry.operations)\n\t]);\n}\n//#endregion\n//#region src/core/migrations/control-adapter.ts\n/** A DDL node MySQL does not build, such as one another target's visitor accepts. */\nfunction unsupportedDdl(ast) {\n\treturn structuredError(\"RUNTIME.DDL_UNSUPPORTED\", `The MySQL control adapter cannot lower the DDL node \"${ast.kind}\".`, { meta: {\n\t\tsurface: \"control-adapter\",\n\t\tkind: ast.kind\n\t} });\n}\n/**\n* The MySQL control adapter, for MySQL or a target that extends it. It introspects the connection's database from `information_schema`, creates, reads and writes the marker and ledger tables, takes the marker lock, and runs work in a transaction. Query lowering refuses with `RUNTIME.AST_UNSUPPORTED`.\n*/\nvar MysqlControlAdapter = class {\n\tcodecRegistry;\n\tdeclaredDataTypes;\n\ttargetId;\n\treadCatalog;\n\tfamilyId = \"sql\";\n\tmarkerLocation = MARKER_TABLE_NAME;\n\t/** `declaredDataTypes` are the stack's data types, which introspection resolves each column's reported type over. */\n\tconstructor(codecRegistry, declaredDataTypes, targetId, readCatalog) {\n\t\tthis.codecRegistry = codecRegistry;\n\t\tthis.declaredDataTypes = declaredDataTypes;\n\t\tthis.targetId = targetId;\n\t\tthis.readCatalog = readCatalog;\n\t}\n\tbootstrapControlTableQueries() {\n\t\treturn buildControlTableBootstrapQueries();\n\t}\n\tbootstrapSignMarkerQueries() {\n\t\treturn buildSignMarkerBootstrapQueries();\n\t}\n\tlower(ast) {\n\t\tif (isDdlNode(ast)) throw structuredError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() cannot lower DDL: DDL default literals require inline codec encoding, which is async. Use lowerToExecuteRequest().\", { meta: { surface: \"control-adapter\" } });\n\t\tthrow mysqlQueryNotYetSupported(\"Lowering queries\");\n\t}\n\tasync lowerToExecuteRequest(ast) {\n\t\tif (!isDdlNode(ast)) throw mysqlQueryNotYetSupported(\"Lowering queries\");\n\t\tif (typeof ast.accept !== \"function\") throw unsupportedDdl(ast);\n\t\treturn ast.accept(new Proxy({ createTable: (node) => renderMysqlCreateTable(node, this.codecRegistry) }, { get: (target, method) => Reflect.get(target, method) ?? (() => Promise.reject(unsupportedDdl(ast))) }));\n\t}\n\tasync renderColumnDefault(column, table) {\n\t\tif (column.default === void 0) return \"\";\n\t\treturn renderMysqlColumnDefault(column.default, column.type, this.codecRegistry, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t}\n\tasync readMarker(driver, space) {\n\t\tconst result = await readMarkerResult(driver, space);\n\t\treturn result.kind === \"present\" ? result.record : null;\n\t}\n\tasync readAllMarkers(driver) {\n\t\treturn withMarkerReadErrorHandling(async () => {\n\t\t\tconst markers = /* @__PURE__ */ new Map();\n\t\t\tfor (const row of await readMarkerRows(driver, void 0) ?? []) {\n\t\t\t\tconst space = String(row[\"space\"]);\n\t\t\t\tmarkers.set(space, parseMarkerRowSafely(row, () => decodeMysqlMarkerRow(row), {\n\t\t\t\t\tspace,\n\t\t\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn markers;\n\t\t}, {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t});\n\t}\n\tasync readLedger(driver, space) {\n\t\treturn withMarkerReadErrorHandling(() => readLedgerEntries(driver, space), {\n\t\t\tspace: space ?? \"*\",\n\t\t\tmarkerLocation: LEDGER_TABLE_NAME\n\t\t});\n\t}\n\tasync insertMarker(driver, space, destination) {\n\t\tawait insertMarkerRow(driver, space, destination);\n\t}\n\tasync initMarker(driver, space, destination) {\n\t\tawait upsertMarkerRow(driver, space, destination);\n\t}\n\tasync updateMarker(driver, space, expectedFrom, destination) {\n\t\treturn compareAndSwapMarkerRow(driver, space, expectedFrom, destination);\n\t}\n\tasync writeLedgerEntry(driver, space, entry) {\n\t\tawait insertLedgerRow(driver, space, entry);\n\t}\n\t/** Takes no lock: MySQL's `GET_LOCK` lives for the session, not the transaction, so {@link holdMarkerLock} takes it around the transaction instead. */\n\tasync lockMarker(_driver) {}\n\t/** Takes `GET_LOCK` before `work` runs and releases it when `work` ends, so `db sign` creates the marker table, whose DDL would end a transaction, under the lock. */\n\tasync holdMarkerLock(driver, work) {\n\t\treturn withMarkerLock(driver, work);\n\t}\n\tasync withTransaction(driver, fn) {\n\t\treturn this.#inTransaction(driver, fn);\n\t}\n\tasync #inTransaction(driver, fn) {\n\t\tawait driver.query(\"START TRANSACTION\");\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await fn();\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait driver.query(\"ROLLBACK\");\n\t\t\t} catch (rollbackError) {\n\t\t\t\tif (error instanceof Error && error.cause === void 0) error.cause = rollbackError;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tawait driver.query(\"COMMIT\");\n\t\treturn result;\n\t}\n\tasync introspect(driver, contract) {\n\t\tconst columns = contractColumns(contract);\n\t\treturn buildMysqlSchemaIR(await this.readCatalog(driver), this.declaredDataTypes, async (tableName, columnName, rawDefault) => {\n\t\t\tconst column = columns.columnOf(void 0, tableName, columnName);\n\t\t\tconst codec = column === void 0 ? void 0 : codecForRef(this.codecRegistry, column.codecRef);\n\t\t\tif (codec === void 0) return {};\n\t\t\treturn readColumnDefault(codec, {\n\t\t\t\tliteral: {\n\t\t\t\t\tkind: \"value\",\n\t\t\t\t\tbody: rawDefault\n\t\t\t\t},\n\t\t\t\traw: rawDefault\n\t\t\t}, void 0);\n\t\t}, declaredIndexes(contract));\n\t}\n};\n/** The control adapter of MySQL, or of a target that extends it, for the stack the adapter descriptor is given. */\nfunction createMysqlControlAdapter(stack, options) {\n\treturn new MysqlControlAdapter(assembleMysqlCodecRegistry(stack.target, stack.extensions), stack.declaredDataTypes.map(({ type }) => type), stack.target.targetId, options.readCatalog);\n}\nconst MYSQL_CATALOG_QUERIES = {\n\ttables: `SELECT TABLE_NAME AS table_name\n FROM information_schema.TABLES\n WHERE TABLE_SCHEMA = DATABASE() AND TABLE_TYPE = 'BASE TABLE'\n ORDER BY TABLE_NAME`,\n\tcolumns: `SELECT TABLE_NAME AS table_name, COLUMN_NAME AS column_name,\n ORDINAL_POSITION AS ordinal_position, COLUMN_DEFAULT AS column_default,\n IS_NULLABLE AS is_nullable, COLUMN_TYPE AS column_type, EXTRA AS extra\n FROM information_schema.COLUMNS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, ORDINAL_POSITION`,\n\tindexes: `SELECT TABLE_NAME AS table_name, INDEX_NAME AS index_name,\n NON_UNIQUE AS non_unique, SEQ_IN_INDEX AS seq_in_index,\n COLUMN_NAME AS column_name, EXPRESSION AS expression\n FROM information_schema.STATISTICS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX`,\n\tconstraints: `SELECT TABLE_NAME AS table_name, CONSTRAINT_NAME AS constraint_name,\n CONSTRAINT_TYPE AS constraint_type\n FROM information_schema.TABLE_CONSTRAINTS\n WHERE TABLE_SCHEMA = DATABASE()`,\n\tforeignKeys: `SELECT k.TABLE_NAME AS table_name, k.CONSTRAINT_NAME AS constraint_name,\n k.COLUMN_NAME AS column_name, k.ORDINAL_POSITION AS ordinal_position,\n NULLIF(k.REFERENCED_TABLE_SCHEMA, k.TABLE_SCHEMA) AS referenced_table_schema,\n k.REFERENCED_TABLE_NAME AS referenced_table_name,\n k.REFERENCED_COLUMN_NAME AS referenced_column_name,\n r.UPDATE_RULE AS update_rule, r.DELETE_RULE AS delete_rule\n FROM information_schema.KEY_COLUMN_USAGE k\n JOIN information_schema.REFERENTIAL_CONSTRAINTS r\n ON r.CONSTRAINT_SCHEMA = k.CONSTRAINT_SCHEMA\n AND r.TABLE_NAME = k.TABLE_NAME\n AND r.CONSTRAINT_NAME = k.CONSTRAINT_NAME\n WHERE k.TABLE_SCHEMA = DATABASE() AND k.REFERENCED_TABLE_NAME IS NOT NULL\n ORDER BY k.TABLE_NAME, k.CONSTRAINT_NAME, k.ORDINAL_POSITION`\n};\n/** Reads the catalog rows of the connection's database, leaving out the runner's control tables. */\nasync function readMysqlCatalog(driver, queries = MYSQL_CATALOG_QUERIES) {\n\tconst keep = (rows) => rows.filter((row) => !CONTROL_TABLE_NAMES.has(row.table_name));\n\tconst tables = await driver.query(queries.tables);\n\tconst columns = await driver.query(queries.columns);\n\tconst indexes = await driver.query(queries.indexes);\n\tconst constraints = await driver.query(queries.constraints);\n\tconst foreignKeys = await driver.query(queries.foreignKeys);\n\treturn {\n\t\ttables: keep(tables.rows).map((row) => row.table_name),\n\t\tcolumns: keep(columns.rows),\n\t\tindexes: keep(indexes.rows),\n\t\tconstraints: keep(constraints.rows),\n\t\tforeignKeys: keep(foreignKeys.rows)\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nconst mysqlAdapterDescriptor = {\n\t...mysqlAdapterDescriptorMeta,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: new Map(Object.entries(sqlDefaultFunctions())),\n\t\tgeneratorDescriptors: []\n\t},\n\tcreate(stack) {\n\t\treturn createMysqlControlAdapter(stack, { readCatalog: readMysqlCatalog });\n\t}\n};\n//#endregion\nexport { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterDescriptor as default, readMysqlCatalog };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,0BAA0B;AAChC,MAAM,qBAAqB;AAC3B,SAAS,eAAe,OAAO,KAAK;CACnC,MAAM,gBAAgB,4BAA4B,WAAW,MAAM,MAAM,KAAK,MAAM,OAAO,sCAAsC,OAAO,EAAE,MAAM;EAC/I,OAAO,MAAM;EACb,QAAQ,MAAM;CACf,EAAE,CAAC;AACJ;;AAEA,SAAS,mBAAmB,MAAM,OAAO;CACxC,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,SAAS,WAAW,OAAO,OAAO,MAAM;CACnD,IAAI,OAAO,SAAS,UAAU;EAC7B,IAAI,CAAC,OAAO,SAAS,IAAI,GAAG,OAAO,eAAe,OAAO,GAAG,KAAK,wBAAwB;EACzF,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAChD,IAAI,OAAO,SAAS,UAAU,OAAO,aAAa,IAAI;CACtD,IAAI,gBAAgB,MAAM,OAAO,aAAa,oBAAoB,IAAI,CAAC;CACvE,IAAI,gBAAgB,YAAY,OAAO,KAAK,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS,KAAK,EAAE;CAC9E,IAAI,OAAO,SAAS,UAAU,OAAO,aAAa,KAAK,UAAU,IAAI,CAAC;CACtE,OAAO,eAAe,OAAO,KAAK,OAAO,KAAK,oBAAoB;AACnE;AACA,SAAS,kBAAkB,YAAY,SAAS;CAC/C,OAAO,wBAAwB,KAAK,WAAW,KAAK,CAAC,IAAI,IAAI,QAAQ,KAAK;AAC3E;;;;AAIA,SAAS,iBAAiB,YAAY,aAAa,UAAU,OAAO;CACnE,MAAM,WAAW,aAAa,KAAK,IAAI,KAAK,IAAI,YAAY,c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Q;;;;CAIR,SAAS;;;;;;CAMT,SAAS;;;;;;CAMT,aAAa;;;;CAIb,aAAa;;;;;;;;;;;;;AAad;;AAEA,eAAe,iBAAiB,QAAQ,UAAU,uBAAuB;CACxE,MAAM,QAAQ,SAAS,KAAK,QAAQ,QAAQ,CAAC,oBAAoB,IAAI,IAAI,UAAU,CAAC;CACpF,MAAM,SAAS,MAAM,OAAO,MAAM,QAAQ,MAAM;CAChD,MAAM,UAAU,MAAM,OAAO,MAAM,QAAQ,OAAO;CAClD,MAAM,UAAU,MAAM,OAAO,MAAM,QAAQ,OAAO;CAClD,MAAM,cAAc,MAAM,OAAO,MAAM,QAAQ,WAAW;CAC1D,MAAM,cAAc,MAAM,OAAO,MAAM,QAAQ,WAAW;CAC1D,OAAO;EACN,QAAQ,KAAK,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ,IAAI,UAAU;EACrD,SAAS,KAAK,QAAQ,IAAI;EAC1B,SAAS,KAAK,QAAQ,IAAI;EAC1B,aAAa,KAAK,YAAY,IAAI;EAClC,aAAa,KAAK,YAAY,IAAI;CACnC;AACD;AAGA,MAAM,yBAAyB;CAC9B,GAAG;CACH,yBAAyB;EACxB,yBAAyB,IAAI,IAAI,OAAO,QAAQ,oBAAoB,CAAC,CAAC;EACtE,sBAAsB,CAAC;CACxB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,OAAO,EAAE,aAAa,iBAAiB,CAAC;CAC1E;AACD"}
1
+ {"version":3,"file":"control-DDjdwyGa.mjs","names":["#inTransaction"],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/control.mjs"],"sourcesContent":["import { t as mysqlAdapterDescriptorMeta } from \"./descriptor-meta-e29H69KN.mjs\";\nimport { a as tableExists, i as readMarkerRows, n as parseJsonColumn, r as readMarkerResult, t as decodeMysqlMarkerRow } from \"./marker-read-D1hp62hF.mjs\";\nimport { assembleMysqlCodecRegistry, decodeMysqlDatetime, encodeMysqlDatetime, mysqlCurrentValueFor, mysqlNowExpression } from \"@internal/target-mysql/codecs\";\nimport { checkSqlDefaultText, contractColumns, readColumnDefault, sqlDefaultFunctions } from \"@internal/family-sql/control\";\nimport { parseMarkerRowSafely, withMarkerReadErrorHandling } from \"@internal/errors/execution\";\nimport { codecForRef } from \"@internal/framework-components/codec\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { encodeLiteralDefault, isDdlNode, renderOpaqueSql } from \"@internal/sql-relational-core/ast\";\nimport { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries } from \"@internal/target-mysql/contract-free\";\nimport { CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME } from \"@internal/target-mysql/control-tables\";\nimport { mysqlQueryNotYetSupported } from \"@internal/target-mysql/errors\";\nimport { withMarkerLock } from \"@internal/target-mysql/marker-lock\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { quoteIdentifier, quoteLiteral } from \"@internal/target-mysql/sql-utils\";\nimport { REFERENTIAL_ACTION_SQL } from \"@internal/sql-contract/referential-action-sql\";\nimport { resolveIntrospectedColumnType } from \"@internal/family-sql/control-adapter\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { readMysqlDefault } from \"@internal/target-mysql/default-normalizer\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ledgerOriginFromStored } from \"@internal/migration-tools/ledger-origin\";\n//#region src/core/migrations/ddl-renderer.ts\n/** Column types MySQL gives a default only when it is written as an expression in parentheses. */\nconst EXPRESSION_DEFAULT_ONLY = /^(?:(?:tiny|medium|long)?(?:text|blob)|json|geometry)\\b/i;\nconst FRACTIONAL_SECONDS = /^(?:datetime|timestamp|time)\\((\\d)\\)$/i;\nfunction refusedDefault(where, why) {\n\tthrow structuredError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${where.table}\".\"${where.column}\" has a default MySQL cannot store: ${why}`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column\n\t} });\n}\n/** A wire value as the SQL literal MySQL reads for it. */\nfunction mysqlInlineLiteral(wire, where) {\n\tif (wire === null) return \"NULL\";\n\tif (typeof wire === \"boolean\") return wire ? \"1\" : \"0\";\n\tif (typeof wire === \"number\") {\n\t\tif (!Number.isFinite(wire)) return refusedDefault(where, `${wire} is not a finite number`);\n\t\treturn String(wire);\n\t}\n\tif (typeof wire === \"bigint\") return String(wire);\n\tif (typeof wire === \"string\") return quoteLiteral(wire);\n\tif (wire instanceof Date) return quoteLiteral(encodeMysqlDatetime(wire));\n\tif (wire instanceof Uint8Array) return `X'${Buffer.from(wire).toString(\"hex\")}'`;\n\tif (typeof wire === \"object\") return quoteLiteral(JSON.stringify(wire));\n\treturn refusedDefault(where, `a ${typeof wire} has no SQL literal`);\n}\nfunction withinParentheses(columnType, literal) {\n\treturn EXPRESSION_DEFAULT_ONLY.test(columnType.trim()) ? `(${literal})` : literal;\n}\n/**\n* The expression a `now()` default is written as: the current value the column's data type holds, `CURRENT_TIMESTAMP`, `CURRENT_DATE` or `CURRENT_TIME`, with the column's fractional-second precision, which MySQL requires to match. A column of a data type that holds no date or time is refused.\n*/\nfunction nowExpressionFor(columnType, codecLookup, codecRef, where) {\n\tconst dataType = codecRef === void 0 ? void 0 : codecLookup.descriptorFor(codecRef.codecId)?.dataType;\n\tconst current = mysqlCurrentValueFor(dataType);\n\tif (current === void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `The column \"${where.table}\".\"${where.column}\" has a now() default, but its data type ${dataType} stores no date or time, so there is no current value to write. Remove the default, or give the field a date or time type.`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column,\n\t\tdataType,\n\t\treason: \"now-default-not-date-or-time\"\n\t} });\n\tconst precision = FRACTIONAL_SECONDS.exec(columnType.trim())?.[1];\n\treturn mysqlNowExpression(current, precision === void 0 ? void 0 : Number(precision));\n}\n/**\n* The `DEFAULT …` clause of a column, or `''` for an `autoincrement()` default, which a column writes as `AUTO_INCREMENT` instead. A literal is read by the column's codec, and a text or blob column's literal is written as an expression, as MySQL requires.\n*/\nasync function renderMysqlColumnDefault(def, columnType, codecLookup, codecRef, where) {\n\tif (def.kind === \"function\") {\n\t\tconst text = def.expression.text;\n\t\tif (text === \"autoincrement()\") return \"\";\n\t\tif (text === \"now()\") return `DEFAULT (${nowExpressionFor(columnType, codecLookup, codecRef, where)})`;\n\t\tif (checkSqlDefaultText(text) !== void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `Unsafe default expression in contract: \"${text}\". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression: text } });\n\t\treturn `DEFAULT (${renderOpaqueSql(def.expression)})`;\n\t}\n\tconst encoded = codecRef === void 0 ? void 0 : await encodeLiteralDefault(codecLookup, codecRef, def.value, where);\n\tif (encoded?.kind === \"sql-null\") return \"DEFAULT NULL\";\n\treturn `DEFAULT ${withinParentheses(columnType, mysqlInlineLiteral(encoded === void 0 ? def.value : encoded.wire, where))}`;\n}\nfunction isAutoincrement(column) {\n\treturn column.default?.kind === \"function\" && column.default.expression.text === \"autoincrement()\";\n}\nasync function renderColumn(column, codecLookup, table) {\n\tconst parts = [quoteIdentifier(column.name), column.type];\n\tif (column.notNull) parts.push(\"NOT NULL\");\n\tif (column.default !== void 0) {\n\t\tconst clause = await renderMysqlColumnDefault(column.default, column.type, codecLookup, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t\tif (clause.length > 0) parts.push(clause);\n\t}\n\tif (isAutoincrement(column)) parts.push(\"AUTO_INCREMENT\");\n\tif (column.primaryKey) parts.push(\"PRIMARY KEY\");\n\treturn parts.join(\" \");\n}\nfunction columnList(columns) {\n\treturn columns.map(quoteIdentifier).join(\", \");\n}\nfunction named(name, body) {\n\treturn name === void 0 ? body : `CONSTRAINT ${quoteIdentifier(name)} ${body}`;\n}\nfunction renderConstraint(constraint) {\n\tswitch (constraint.kind) {\n\t\tcase \"primary-key\": return named(constraint.name, `PRIMARY KEY (${columnList(constraint.columns)})`);\n\t\tcase \"unique\": return named(constraint.name, `UNIQUE (${columnList(constraint.columns)})`);\n\t\tcase \"foreign-key\": {\n\t\t\tconst actions = [constraint.onDelete === void 0 ? void 0 : `ON DELETE ${REFERENTIAL_ACTION_SQL[constraint.onDelete]}`, constraint.onUpdate === void 0 ? void 0 : `ON UPDATE ${REFERENTIAL_ACTION_SQL[constraint.onUpdate]}`].filter((action) => action !== void 0);\n\t\t\treturn named(constraint.name, [`FOREIGN KEY (${columnList(constraint.columns)}) REFERENCES ${quoteIdentifier(constraint.refTable)} (${columnList(constraint.refColumns)})`, ...actions].join(\" \"));\n\t\t}\n\t\tcase \"check-expression\": throw structuredError(\"CONTRACT.CONSTRAINT_INVALID\", `The MySQL target does not write CHECK constraints yet (constraint \"${constraint.name}\").`, { meta: { constraintName: constraint.name } });\n\t}\n}\n/** The `CREATE TABLE` statement of a MySQL DDL node. */\nasync function renderMysqlCreateTable(node, codecLookup) {\n\tconst definitions = [...await Promise.all(node.columns.map((column) => renderColumn(column, codecLookup, node.table))), ...(node.constraints ?? []).map(renderConstraint)];\n\treturn {\n\t\tsql: `CREATE TABLE ${node.ifNotExists === true ? \"IF NOT EXISTS \" : \"\"}${quoteIdentifier(node.table)} (\\n ${definitions.join(\",\\n \")}\\n)`,\n\t\tparams: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/declared-indexes.ts\nfunction isLoose(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction child(value, key) {\n\tconst found = isLoose(value) ? value[key] : void 0;\n\treturn isLoose(found) ? found : void 0;\n}\nfunction tableIndexKey(tableName, indexName) {\n\treturn JSON.stringify([tableName, indexName]);\n}\n/** The indexes the contract handed to introspection declares, read from every contract space it holds. */\nfunction declaredIndexes(contract) {\n\tconst contracts = isLoose(contract) && Array.isArray(contract[\"contracts\"]) ? contract[\"contracts\"] : [contract];\n\tconst declared = /* @__PURE__ */ new Set();\n\tconst declaredUnique = /* @__PURE__ */ new Set();\n\tfor (const space of contracts) for (const namespace of Object.values(child(child(space, \"storage\"), \"namespaces\") ?? {})) for (const [tableName, table] of Object.entries(child(child(namespace, \"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) || typeof index[\"name\"] !== \"string\") continue;\n\t\t\tconst key = tableIndexKey(tableName, index[\"name\"]);\n\t\t\tdeclared.add(key);\n\t\t\tif (index[\"unique\"] === true) declaredUnique.add(key);\n\t\t}\n\t}\n\treturn {\n\t\tdeclaresIndex: (tableName, indexName) => declared.has(tableIndexKey(tableName, indexName)),\n\t\tdeclaresUniqueIndex: (tableName, indexName) => declaredUnique.has(tableIndexKey(tableName, indexName))\n\t};\n}\n//#endregion\n//#region src/core/migrations/introspection.ts\nconst NOTHING_DECLARED = {\n\tdeclaresIndex: () => false,\n\tdeclaresUniqueIndex: () => false\n};\nconst PRIMARY_INDEX = \"PRIMARY\";\nconst REFERENTIAL_ACTIONS = {\n\tRESTRICT: \"restrict\",\n\tCASCADE: \"cascade\",\n\t\"SET NULL\": \"setNull\",\n\t\"SET DEFAULT\": \"setDefault\"\n};\n/** A rule `REFERENTIAL_CONSTRAINTS` reports, with `NO ACTION`, MySQL's default, as no action at all. */\nfunction referentialAction(rule) {\n\tconst normalized = rule.toUpperCase();\n\tif (normalized === \"NO ACTION\") return void 0;\n\tconst action = REFERENTIAL_ACTIONS[normalized];\n\tif (action === void 0) throw structuredError(\"CONTRACT.INTROSPECTION_UNSUPPORTED\", `Unknown MySQL referential action rule: \"${rule}\". Expected one of: NO ACTION, RESTRICT, CASCADE, SET NULL, SET DEFAULT.`, { meta: { rule } });\n\treturn action;\n}\nfunction tableDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\nfunction columnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction groupBy(rows, key) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const row of rows) {\n\t\tconst group = groups.get(key(row));\n\t\tif (group === void 0) groups.set(key(row), [row]);\n\t\telse group.push(row);\n\t}\n\treturn groups;\n}\nfunction byPosition(position) {\n\treturn (a, b) => Number(position(a)) - Number(position(b));\n}\nasync function columnOf(row, dataTypes, readLiteralDefault) {\n\tconst reported = readMysqlDefault(row.column_default, row.extra);\n\tconst readDefault = reported === void 0 ? {} : reported.kind === \"function\" ? { resolvedDefault: reported } : await readLiteralDefault(row.table_name, row.column_name, reported.literal.body);\n\tconst reportedType = {\n\t\ttext: row.column_type,\n\t\tkind: void 0,\n\t\tschema: void 0,\n\t\tname: void 0\n\t};\n\treturn {\n\t\tname: row.column_name,\n\t\ttypeText: row.column_type,\n\t\tnullable: row.is_nullable === \"YES\",\n\t\t...ifDefined(\"default\", row.column_default ?? void 0),\n\t\t...readDefault,\n\t\treportedType,\n\t\t...resolveIntrospectedColumnType(reportedType, dataTypes)\n\t};\n}\nfunction indexesOf(rows) {\n\treturn [...groupBy(rows, (row) => row.index_name).entries()].map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.seq_in_index));\n\t\tconst expressions = ordered.flatMap((part) => part.expression === null ? [] : [part.expression]);\n\t\treturn {\n\t\t\tname,\n\t\t\tunique: ordered[0]?.non_unique === \"0\",\n\t\t\tcolumns: ordered.flatMap((part) => part.column_name === null ? [] : [part.column_name]),\n\t\t\texpression: expressions.length === 0 ? void 0 : expressions.join(\", \")\n\t\t};\n\t});\n}\nfunction sameColumns(a, b) {\n\treturn a.length === b.length && a.every((column, index) => column === b[index]);\n}\nfunction foreignKeysOf(tableName, rows) {\n\treturn [...groupBy(rows, (row) => row.constraint_name).entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.ordinal_position));\n\t\tconst [first] = ordered;\n\t\tconst columns = ordered.map((part) => part.column_name);\n\t\tconst referencedTable = first?.referenced_table_name ?? \"\";\n\t\tconst referencedSchema = first?.referenced_table_schema ?? void 0;\n\t\treturn {\n\t\t\tcolumns,\n\t\t\treferencedTable,\n\t\t\treferencedColumns: ordered.map((part) => part.referenced_column_name),\n\t\t\t...ifDefined(\"referencedSchema\", referencedSchema),\n\t\t\tname,\n\t\t\t...ifDefined(\"onDelete\", first === void 0 ? void 0 : referentialAction(first.delete_rule)),\n\t\t\t...ifDefined(\"onUpdate\", first === void 0 ? void 0 : referentialAction(first.update_rule)),\n\t\t\tdependsOn: [...referencedSchema === void 0 ? [tableDependsOn(referencedTable)] : [], ...columnDependsOn(tableName, columns)]\n\t\t};\n\t});\n}\n/**\n* The index InnoDB creates for a foreign key that no index already serves: it carries the key's name and exactly the key's columns. Introspection leaves it out, because the contract describes the key, not that index. An explicit index can look the same, so one the contract declares is kept.\n*/\nfunction isForeignKeyIndex(tableName, index, foreignKeys, declared) {\n\tif (declared.declaresIndex(tableName, index.name)) return false;\n\treturn foreignKeys.some((fk) => fk.name === index.name && index.expression === void 0 && sameColumns(fk.columns, index.columns));\n}\nasync function tableOf(tableName, rows, dataTypes, readLiteralDefault, declared) {\n\tconst columns = {};\n\tfor (const row of [...rows.columns].sort(byPosition((column) => column.ordinal_position))) columns[row.column_name] = await columnOf(row, dataTypes, readLiteralDefault);\n\tconst foreignKeys = foreignKeysOf(tableName, rows.foreignKeys);\n\tconst indexes = indexesOf(rows.indexes);\n\tconst expressionIndexNames = new Set(indexes.filter((index) => index.expression !== void 0).map((index) => index.name));\n\tconst uniqueConstraintNames = new Set(rows.constraints.filter((constraint) => constraint.constraint_type === \"UNIQUE\" && !expressionIndexNames.has(constraint.constraint_name) && !declared.declaresUniqueIndex(tableName, constraint.constraint_name)).map((constraint) => constraint.constraint_name));\n\tconst primary = indexes.find((index) => index.name === PRIMARY_INDEX);\n\tconst primaryKey = primary === void 0 ? void 0 : {\n\t\tcolumns: primary.columns,\n\t\tdependsOn: columnDependsOn(tableName, primary.columns)\n\t};\n\tconst uniques = indexes.filter((index) => uniqueConstraintNames.has(index.name)).map((index) => ({\n\t\tcolumns: index.columns,\n\t\tname: index.name,\n\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t}));\n\tconst plainIndexes = indexes.filter((index) => index.name !== PRIMARY_INDEX && !uniqueConstraintNames.has(index.name) && !isForeignKeyIndex(tableName, index, foreignKeys, declared)).map((index) => {\n\t\tconst base = {\n\t\t\tnaming: {\n\t\t\t\tkind: \"exact\",\n\t\t\t\tname: index.name\n\t\t\t},\n\t\t\twhere: void 0,\n\t\t\tunique: index.unique,\n\t\t\tpartial: false,\n\t\t\ttype: void 0,\n\t\t\toptions: void 0,\n\t\t\tannotations: void 0,\n\t\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t\t};\n\t\treturn index.expression === void 0 ? {\n\t\t\t...base,\n\t\t\tcolumns: index.columns\n\t\t} : {\n\t\t\t...base,\n\t\t\texpression: index.expression\n\t\t};\n\t});\n\treturn new SqlTableIR({\n\t\tname: tableName,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\tforeignKeys,\n\t\tuniques,\n\t\tindexes: plainIndexes\n\t});\n}\n/**\n* The schema IR of the database the rows describe: one flat tree of its tables. MySQL lists every unique index as a UNIQUE constraint, so one is reported as a unique constraint unless the contract declares a unique index of that name on the table, or it indexes an expression. The index InnoDB creates for a foreign key is left out, unless the contract declares an index of that name on the table.\n*/\nasync function buildMysqlSchemaIR(rows, dataTypes, readLiteralDefault, declared = NOTHING_DECLARED) {\n\tconst columnsByTable = groupBy(rows.columns, (row) => row.table_name);\n\tconst indexesByTable = groupBy(rows.indexes, (row) => row.table_name);\n\tconst constraintsByTable = groupBy(rows.constraints, (row) => row.table_name);\n\tconst foreignKeysByTable = groupBy(rows.foreignKeys, (row) => row.table_name);\n\tconst tables = {};\n\tfor (const tableName of rows.tables) tables[tableName] = await tableOf(tableName, {\n\t\tcolumns: columnsByTable.get(tableName) ?? [],\n\t\tindexes: indexesByTable.get(tableName) ?? [],\n\t\tconstraints: constraintsByTable.get(tableName) ?? [],\n\t\tforeignKeys: foreignKeysByTable.get(tableName) ?? []\n\t}, dataTypes, readLiteralDefault, declared);\n\treturn new SqlSchemaIR({ tables });\n}\n//#endregion\n//#region src/core/migrations/marker-ledger.ts\nconst LEDGER_COLUMNS = \"space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations, created_at\";\nfunction operationCount(operations) {\n\tconst parsed = typeof operations === \"string\" ? parseOperations(operations) : operations;\n\treturn Array.isArray(parsed) ? parsed.length : 0;\n}\nfunction parseOperations(text) {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction text(row, column) {\n\tconst value = row[column];\n\treturn typeof value === \"string\" ? value : String(value);\n}\n/** The ledger's entries for `space`, or for every space, in the order they were applied. */\nasync function readLedgerEntries(driver, space) {\n\tif (!await tableExists(driver, LEDGER_TABLE_NAME)) return [];\n\tconst select = `SELECT ${LEDGER_COLUMNS} FROM ${quoteIdentifier(LEDGER_TABLE_NAME)}`;\n\tconst { rows } = space === void 0 ? await driver.query(`${select} ORDER BY id`) : await driver.query(`${select} WHERE space = ? ORDER BY id`, [space]);\n\treturn rows.map((row) => {\n\t\tconst origin = row[\"origin_core_hash\"];\n\t\treturn {\n\t\t\tspace: text(row, \"space\"),\n\t\t\tmigrationName: text(row, \"migration_name\"),\n\t\t\tmigrationHash: text(row, \"migration_hash\"),\n\t\t\tfrom: ledgerOriginFromStored(typeof origin === \"string\" ? origin : null),\n\t\t\tto: text(row, \"destination_core_hash\"),\n\t\t\tappliedAt: decodeMysqlDatetime(text(row, \"created_at\")),\n\t\t\toperationCount: operationCount(row[\"operations\"])\n\t\t};\n\t});\n}\n/** Every column of the marker row except its key, `space`, with what both the insert and the upsert's update write to it. */\nconst MARKER_COLUMNS = [\n\t[\"core_hash\", (destination) => destination.storageHash],\n\t[\"profile_hash\", (destination) => destination.profileHash],\n\t[\"contract_json\", \"NULL\"],\n\t[\"canonical_version\", \"NULL\"],\n\t[\"updated_at\", \"CURRENT_TIMESTAMP(3)\"],\n\t[\"app_tag\", \"NULL\"],\n\t[\"meta\", \"'{}'\"],\n\t[\"invariants\", (destination) => JSON.stringify(destination.invariants ?? [])]\n];\nfunction markerValueSql(value) {\n\treturn typeof value === \"string\" ? value : \"?\";\n}\nconst MARKER_INSERT = `INSERT INTO ${quoteIdentifier(MARKER_TABLE_NAME)} (space, ${MARKER_COLUMNS.map(([column]) => column).join(\", \")}) VALUES (?, ${MARKER_COLUMNS.map(([, value]) => markerValueSql(value)).join(\", \")})`;\nconst MARKER_UPDATE = MARKER_COLUMNS.map(([column, value]) => `${column} = ${markerValueSql(value)}`).join(\", \");\nfunction markerColumnParams(destination) {\n\treturn MARKER_COLUMNS.flatMap(([, value]) => typeof value === \"string\" ? [] : [value(destination)]);\n}\n/** Inserts the marker row of `space`; fails when the space already has one. */\nasync function insertMarkerRow(driver, space, destination) {\n\tawait driver.query(MARKER_INSERT, [space, ...markerColumnParams(destination)]);\n}\n/** Writes the marker row of `space`, replacing the row the space already has. The update binds the values again instead of naming a row alias, which MariaDB does not accept, or `VALUES()`, which MySQL deprecates. */\nasync function upsertMarkerRow(driver, space, destination) {\n\tconst params = markerColumnParams(destination);\n\tawait driver.query(`${MARKER_INSERT} ON DUPLICATE KEY UPDATE ${MARKER_UPDATE}`, [\n\t\tspace,\n\t\t...params,\n\t\t...params\n\t]);\n}\nfunction invariantsOf(text) {\n\tconst parsed = parseJsonColumn(\"invariants\", text);\n\treturn Array.isArray(parsed) ? parsed.filter((item) => typeof item === \"string\") : [];\n}\n/**\n* Advances the marker row of `space` from `expectedFrom` to `destination`, and says whether it did. MySQL has no `RETURNING`, so the row is read and locked with `FOR UPDATE` first, inside the transaction the caller holds, and written only when it still holds `expectedFrom`. Supplied invariants are merged with the stored ones.\n*/\nasync function compareAndSwapMarkerRow(driver, space, expectedFrom, destination) {\n\tconst { rows } = await driver.query(`SELECT core_hash, invariants FROM ${quoteIdentifier(MARKER_TABLE_NAME)} WHERE space = ? FOR UPDATE`, [space]);\n\tconst [row] = rows;\n\tif (row === void 0 || row[\"core_hash\"] !== expectedFrom) return false;\n\tconst invariants = destination.invariants === void 0 ? void 0 : [.../* @__PURE__ */ new Set([...invariantsOf(row[\"invariants\"]), ...destination.invariants])].sort();\n\tawait driver.query(`UPDATE ${quoteIdentifier(MARKER_TABLE_NAME)} SET core_hash = ?, profile_hash = ?, updated_at = CURRENT_TIMESTAMP(3)${invariants === void 0 ? \"\" : \", invariants = ?\"} WHERE space = ? AND core_hash = ?`, [\n\t\tdestination.storageHash,\n\t\tdestination.profileHash,\n\t\t...invariants === void 0 ? [] : [JSON.stringify(invariants)],\n\t\tspace,\n\t\texpectedFrom\n\t]);\n\treturn true;\n}\n/** Appends a ledger entry for `space`. */\nasync function insertLedgerRow(driver, space, entry) {\n\tawait driver.query(`INSERT INTO ${quoteIdentifier(LEDGER_TABLE_NAME)} (space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations) VALUES (?, ?, ?, ?, ?, ?)`, [\n\t\tspace,\n\t\tentry.migrationName,\n\t\tentry.migrationHash,\n\t\tentry.from,\n\t\tentry.to,\n\t\tJSON.stringify(entry.operations)\n\t]);\n}\n//#endregion\n//#region src/core/migrations/control-adapter.ts\n/** A DDL node MySQL does not build, such as one another target's visitor accepts. */\nfunction unsupportedDdl(ast) {\n\treturn structuredError(\"RUNTIME.DDL_UNSUPPORTED\", `The MySQL control adapter cannot lower the DDL node \"${ast.kind}\".`, { meta: {\n\t\tsurface: \"control-adapter\",\n\t\tkind: ast.kind\n\t} });\n}\n/**\n* The MySQL control adapter, for MySQL or a target that extends it. It introspects the connection's database from `information_schema`, creates, reads and writes the marker and ledger tables, takes the marker lock, and runs work in a transaction. Query lowering refuses with `RUNTIME.AST_UNSUPPORTED`.\n*/\nvar MysqlControlAdapter = class {\n\tcodecRegistry;\n\tdeclaredDataTypes;\n\ttargetId;\n\treadCatalog;\n\tfamilyId = \"sql\";\n\tmarkerLocation = MARKER_TABLE_NAME;\n\t/** `declaredDataTypes` are the stack's data types, which introspection resolves each column's reported type over. */\n\tconstructor(codecRegistry, declaredDataTypes, targetId, readCatalog) {\n\t\tthis.codecRegistry = codecRegistry;\n\t\tthis.declaredDataTypes = declaredDataTypes;\n\t\tthis.targetId = targetId;\n\t\tthis.readCatalog = readCatalog;\n\t}\n\tbootstrapControlTableQueries() {\n\t\treturn buildControlTableBootstrapQueries();\n\t}\n\tbootstrapSignMarkerQueries() {\n\t\treturn buildSignMarkerBootstrapQueries();\n\t}\n\tlower(ast) {\n\t\tif (isDdlNode(ast)) throw structuredError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() cannot lower DDL: DDL default literals require inline codec encoding, which is async. Use lowerToExecuteRequest().\", { meta: { surface: \"control-adapter\" } });\n\t\tthrow mysqlQueryNotYetSupported(\"Lowering queries\");\n\t}\n\tasync lowerToExecuteRequest(ast) {\n\t\tif (!isDdlNode(ast)) throw mysqlQueryNotYetSupported(\"Lowering queries\");\n\t\tif (typeof ast.accept !== \"function\") throw unsupportedDdl(ast);\n\t\treturn ast.accept(new Proxy({ createTable: (node) => renderMysqlCreateTable(node, this.codecRegistry) }, { get: (target, method) => Reflect.get(target, method) ?? (() => Promise.reject(unsupportedDdl(ast))) }));\n\t}\n\tasync renderColumnDefault(column, table) {\n\t\tif (column.default === void 0) return \"\";\n\t\treturn renderMysqlColumnDefault(column.default, column.type, this.codecRegistry, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t}\n\tasync readMarker(driver, space) {\n\t\tconst result = await readMarkerResult(driver, space);\n\t\treturn result.kind === \"present\" ? result.record : null;\n\t}\n\tasync readAllMarkers(driver) {\n\t\treturn withMarkerReadErrorHandling(async () => {\n\t\t\tconst markers = /* @__PURE__ */ new Map();\n\t\t\tfor (const row of await readMarkerRows(driver, void 0) ?? []) {\n\t\t\t\tconst space = String(row[\"space\"]);\n\t\t\t\tmarkers.set(space, parseMarkerRowSafely(row, () => decodeMysqlMarkerRow(row), {\n\t\t\t\t\tspace,\n\t\t\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn markers;\n\t\t}, {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t});\n\t}\n\tasync readLedger(driver, space) {\n\t\treturn withMarkerReadErrorHandling(() => readLedgerEntries(driver, space), {\n\t\t\tspace: space ?? \"*\",\n\t\t\tmarkerLocation: LEDGER_TABLE_NAME\n\t\t});\n\t}\n\tasync insertMarker(driver, space, destination) {\n\t\tawait insertMarkerRow(driver, space, destination);\n\t}\n\tasync initMarker(driver, space, destination) {\n\t\tawait upsertMarkerRow(driver, space, destination);\n\t}\n\tasync updateMarker(driver, space, expectedFrom, destination) {\n\t\treturn compareAndSwapMarkerRow(driver, space, expectedFrom, destination);\n\t}\n\tasync writeLedgerEntry(driver, space, entry) {\n\t\tawait insertLedgerRow(driver, space, entry);\n\t}\n\t/** Takes no lock: MySQL's `GET_LOCK` lives for the session, not the transaction, so {@link holdMarkerLock} takes it around the transaction instead. */\n\tasync lockMarker(_driver) {}\n\t/** Takes `GET_LOCK` before `work` runs and releases it when `work` ends, so `db sign` creates the marker table, whose DDL would end a transaction, under the lock. */\n\tasync holdMarkerLock(driver, work) {\n\t\treturn withMarkerLock(driver, work);\n\t}\n\tasync withTransaction(driver, fn) {\n\t\treturn this.#inTransaction(driver, fn);\n\t}\n\tasync #inTransaction(driver, fn) {\n\t\tawait driver.query(\"START TRANSACTION\");\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await fn();\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait driver.query(\"ROLLBACK\");\n\t\t\t} catch (rollbackError) {\n\t\t\t\tif (error instanceof Error && error.cause === void 0) error.cause = rollbackError;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tawait driver.query(\"COMMIT\");\n\t\treturn result;\n\t}\n\tasync introspect(driver, contract) {\n\t\tconst columns = contractColumns(contract);\n\t\treturn buildMysqlSchemaIR(await this.readCatalog(driver), this.declaredDataTypes, async (tableName, columnName, rawDefault) => {\n\t\t\tconst column = columns.columnOf(void 0, tableName, columnName);\n\t\t\tconst codec = column === void 0 ? void 0 : codecForRef(this.codecRegistry, column.codecRef);\n\t\t\tif (codec === void 0) return {};\n\t\t\treturn readColumnDefault(codec, {\n\t\t\t\tliteral: {\n\t\t\t\t\tkind: \"value\",\n\t\t\t\t\tbody: rawDefault\n\t\t\t\t},\n\t\t\t\traw: rawDefault\n\t\t\t}, void 0);\n\t\t}, declaredIndexes(contract));\n\t}\n};\n/** The control adapter of MySQL, or of a target that extends it, for the stack the adapter descriptor is given. */\nfunction createMysqlControlAdapter(stack, options) {\n\treturn new MysqlControlAdapter(assembleMysqlCodecRegistry(stack.target, stack.extensions), stack.declaredDataTypes.map(({ type }) => type), stack.target.targetId, options.readCatalog);\n}\nconst MYSQL_CATALOG_QUERIES = {\n\ttables: `SELECT TABLE_NAME AS table_name\n FROM information_schema.TABLES\n WHERE TABLE_SCHEMA = DATABASE() AND TABLE_TYPE = 'BASE TABLE'\n ORDER BY TABLE_NAME`,\n\tcolumns: `SELECT TABLE_NAME AS table_name, COLUMN_NAME AS column_name,\n ORDINAL_POSITION AS ordinal_position, COLUMN_DEFAULT AS column_default,\n IS_NULLABLE AS is_nullable, COLUMN_TYPE AS column_type, EXTRA AS extra\n FROM information_schema.COLUMNS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, ORDINAL_POSITION`,\n\tindexes: `SELECT TABLE_NAME AS table_name, INDEX_NAME AS index_name,\n NON_UNIQUE AS non_unique, SEQ_IN_INDEX AS seq_in_index,\n COLUMN_NAME AS column_name, EXPRESSION AS expression\n FROM information_schema.STATISTICS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX`,\n\tconstraints: `SELECT TABLE_NAME AS table_name, CONSTRAINT_NAME AS constraint_name,\n CONSTRAINT_TYPE AS constraint_type\n FROM information_schema.TABLE_CONSTRAINTS\n WHERE TABLE_SCHEMA = DATABASE()`,\n\tforeignKeys: `SELECT k.TABLE_NAME AS table_name, k.CONSTRAINT_NAME AS constraint_name,\n k.COLUMN_NAME AS column_name, k.ORDINAL_POSITION AS ordinal_position,\n NULLIF(k.REFERENCED_TABLE_SCHEMA, k.TABLE_SCHEMA) AS referenced_table_schema,\n k.REFERENCED_TABLE_NAME AS referenced_table_name,\n k.REFERENCED_COLUMN_NAME AS referenced_column_name,\n r.UPDATE_RULE AS update_rule, r.DELETE_RULE AS delete_rule\n FROM information_schema.KEY_COLUMN_USAGE k\n JOIN information_schema.REFERENTIAL_CONSTRAINTS r\n ON r.CONSTRAINT_SCHEMA = k.CONSTRAINT_SCHEMA\n AND r.TABLE_NAME = k.TABLE_NAME\n AND r.CONSTRAINT_NAME = k.CONSTRAINT_NAME\n WHERE k.TABLE_SCHEMA = DATABASE() AND k.REFERENCED_TABLE_NAME IS NOT NULL\n ORDER BY k.TABLE_NAME, k.CONSTRAINT_NAME, k.ORDINAL_POSITION`\n};\n/** Reads the catalog rows of the connection's database, leaving out the runner's control tables. */\nasync function readMysqlCatalog(driver, queries = MYSQL_CATALOG_QUERIES) {\n\tconst keep = (rows) => rows.filter((row) => !CONTROL_TABLE_NAMES.has(row.table_name));\n\tconst tables = await driver.query(queries.tables);\n\tconst columns = await driver.query(queries.columns);\n\tconst indexes = await driver.query(queries.indexes);\n\tconst constraints = await driver.query(queries.constraints);\n\tconst foreignKeys = await driver.query(queries.foreignKeys);\n\treturn {\n\t\ttables: keep(tables.rows).map((row) => row.table_name),\n\t\tcolumns: keep(columns.rows),\n\t\tindexes: keep(indexes.rows),\n\t\tconstraints: keep(constraints.rows),\n\t\tforeignKeys: keep(foreignKeys.rows)\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nconst mysqlAdapterDescriptor = {\n\t...mysqlAdapterDescriptorMeta,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: new Map(Object.entries(sqlDefaultFunctions())),\n\t\tgeneratorDescriptors: []\n\t},\n\tcreate(stack) {\n\t\treturn createMysqlControlAdapter(stack, { readCatalog: readMysqlCatalog });\n\t}\n};\n//#endregion\nexport { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterDescriptor as default, readMysqlCatalog };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,0BAA0B;AAChC,MAAM,qBAAqB;AAC3B,SAAS,eAAe,OAAO,KAAK;CACnC,MAAM,gBAAgB,4BAA4B,WAAW,MAAM,MAAM,KAAK,MAAM,OAAO,sCAAsC,OAAO,EAAE,MAAM;EAC/I,OAAO,MAAM;EACb,QAAQ,MAAM;CACf,EAAE,CAAC;AACJ;;AAEA,SAAS,mBAAmB,MAAM,OAAO;CACxC,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,SAAS,WAAW,OAAO,OAAO,MAAM;CACnD,IAAI,OAAO,SAAS,UAAU;EAC7B,IAAI,CAAC,OAAO,SAAS,IAAI,GAAG,OAAO,eAAe,OAAO,GAAG,KAAK,wBAAwB;EACzF,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAChD,IAAI,OAAO,SAAS,UAAU,OAAO,aAAa,IAAI;CACtD,IAAI,gBAAgB,MAAM,OAAO,aAAa,oBAAoB,IAAI,CAAC;CACvE,IAAI,gBAAgB,YAAY,OAAO,KAAK,OAAO,KAAK,IAAI,CAAC,CAAC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B,CAAC;CAC1E;AACD"}
@@ -1,12 +1,15 @@
1
1
  import { o as mysqlCodecRegistry } from "./codecs-wVJlFapM.mjs";
2
- //#region ../../../3-targets/mysql/1-mysql/2-adapter/dist/descriptor-meta-pVdZBI-g.mjs
2
+ //#region ../../../3-targets/mysql/1-mysql/2-adapter/dist/descriptor-meta-e29H69KN.mjs
3
3
  /** 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
4
  const mysqlAdapterCapabilities = Object.freeze({ sql: {
5
5
  orderBy: true,
6
6
  limit: true,
7
7
  foreignKeys: true,
8
8
  enums: true,
9
- defaultInInsert: true
9
+ defaultInInsert: true,
10
+ jsonAgg: true,
11
+ outerReferencesInDerivedTables: true,
12
+ jsonAggWithoutTruncation: true
10
13
  } });
11
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. */
12
15
  const mysqlAdapterContractContributions = { capabilities: mysqlAdapterCapabilities };
@@ -29,4 +32,4 @@ const mysqlAdapterDescriptorMeta = {
29
32
  //#endregion
30
33
  export { mysqlAdapterContractContributions as n, mysqlAdapterDescriptorMeta as r, mysqlAdapterCapabilities as t };
31
34
 
32
- //# sourceMappingURL=descriptor-meta-pVdZBI-g-BJN4T_on.mjs.map
35
+ //# sourceMappingURL=descriptor-meta-e29H69KN-t-S8_DYh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-e29H69KN-t-S8_DYh.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/descriptor-meta-e29H69KN.mjs"],"sourcesContent":["import { 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. `prisma contract emit` reads them through the adapter's descriptor, and the TypeScript `defineContract` passes them to the contract build. */\nconst mysqlAdapterContractContributions = { capabilities: mysqlAdapterCapabilities };\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: { codecTypes: {\n\t\tcodecDescriptors: Array.from(mysqlCodecRegistry.values()),\n\t\timport: {\n\t\t\tpackage: \"@internal/adapter-mysql/codec-types\",\n\t\t\tnamed: \"CodecTypes\",\n\t\t\talias: \"MysqlTypes\"\n\t\t}\n\t} }\n};\n//#endregion\nexport { mysqlAdapterContractContributions as n, mysqlAdapterCapabilities as r, mysqlAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-e29H69KN.mjs.map"],"mappings":";;;AAGA,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,EAAE,cAAc,yBAAyB;AAGnF,MAAM,6BAA6B;CAClC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,kCAAkC;CAChD,OAAO,EAAE,YAAY;EACpB,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC;EACxD,QAAQ;GACP,SAAS;GACT,OAAO;GACP,OAAO;EACR;CACD,EAAE;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-target-mysql",
3
- "version": "8.0.0-rc.24-dev.16",
3
+ "version": "8.0.0-rc.24-dev.17",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,21 +9,21 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-family-sql": "8.0.0-rc.24-dev.16",
13
- "@prisma/orm-framework": "8.0.0-rc.24-dev.16",
14
- "@prisma/orm-toolchain": "8.0.0-rc.24-dev.16",
12
+ "@prisma/orm-family-sql": "8.0.0-rc.24-dev.17",
13
+ "@prisma/orm-framework": "8.0.0-rc.24-dev.17",
14
+ "@prisma/orm-toolchain": "8.0.0-rc.24-dev.17",
15
15
  "@standard-schema/spec": "1.1.0",
16
16
  "arktype": "^2.2.2",
17
17
  "mariadb": "3.5.4",
18
18
  "temporal-spec": "1.0.1"
19
19
  },
20
20
  "devDependencies": {
21
- "@internal/adapter-mysql": "8.0.0-rc.24-dev.16",
22
- "@internal/driver-mysql": "8.0.0-rc.24-dev.16",
23
- "@internal/target-mysql": "8.0.0-rc.24-dev.16",
24
- "@repo/test-utils": "8.0.0-rc.24-dev.16",
25
- "@repo/tsconfig": "8.0.0-rc.24-dev.16",
26
- "@repo/tsdown": "8.0.0-rc.24-dev.16",
21
+ "@internal/adapter-mysql": "8.0.0-rc.24-dev.17",
22
+ "@internal/driver-mysql": "8.0.0-rc.24-dev.17",
23
+ "@internal/target-mysql": "8.0.0-rc.24-dev.17",
24
+ "@repo/test-utils": "8.0.0-rc.24-dev.17",
25
+ "@repo/tsconfig": "8.0.0-rc.24-dev.17",
26
+ "@repo/tsdown": "8.0.0-rc.24-dev.17",
27
27
  "tsdown": "0.22.14",
28
28
  "typescript": "5.9.3",
29
29
  "vitest": "5.0.0-rc.2"
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter-D0qXT1lj.d.mts","names":[],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/adapter.d.mts"],"mappings":";;;cAEc,0BAA0B;WAC7B;aACE;aACA;aACA;aACA;aACA;;;;;;cAMC;WACH,cAAc;aACZ;eACE;eACA;eACA;eACA;eACA;;;;;;cAMD;WACH;WACA;WACA;WACA;WACA;WACA,cAAc;aACZ;eACE;eACA;eACA;eACA;eACA;;;WAGJ;aACE;eACE,iEAAiE;eACjE;iBACE;iBACA;iBACA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-pVdZBI-g-BJN4T_on.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/descriptor-meta-pVdZBI-g.mjs"],"sourcesContent":["import { 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} });\n//#endregion\n//#region src/core/contract-contributions.ts\n/** 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. */\nconst mysqlAdapterContractContributions = { capabilities: mysqlAdapterCapabilities };\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: { codecTypes: {\n\t\tcodecDescriptors: Array.from(mysqlCodecRegistry.values()),\n\t\timport: {\n\t\t\tpackage: \"@internal/adapter-mysql/codec-types\",\n\t\t\tnamed: \"CodecTypes\",\n\t\t\talias: \"MysqlTypes\"\n\t\t}\n\t} }\n};\n//#endregion\nexport { mysqlAdapterContractContributions as n, mysqlAdapterCapabilities as r, mysqlAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-pVdZBI-g.mjs.map"],"mappings":";;;AAGA,MAAM,2BAA2B,OAAO,OAAO,EAAE,KAAK;CACrD,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;CACP,iBAAiB;AAClB,EAAE,CAAC;;AAIH,MAAM,oCAAoC,EAAE,cAAc,yBAAyB;AAGnF,MAAM,6BAA6B;CAClC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,kCAAkC;CAChD,OAAO,EAAE,YAAY;EACpB,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC;EACxD,QAAQ;GACP,SAAS;GACT,OAAO;GACP,OAAO;EACR;CACD,EAAE;AACH"}