@vibeorm/adapter-mysql 2.1.1 → 2.2.0

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.
@@ -0,0 +1,12 @@
1
+ import type { MysqlAdapterOptions, MysqlPoolConfig } from "./index.ts";
2
+ /** The mysql2 typeCast surface used for JSON; other scalars keep the driver decoder. */
3
+ export type MysqlTypeCast = (field: {
4
+ readonly type: string;
5
+ readonly extendedFormat?: string;
6
+ string(encoding?: string): string | null;
7
+ }, next: () => unknown) => unknown;
8
+ /** Parse once, overlay explicit options, then pin the wire and statement contracts. */
9
+ export declare function mysqlPoolConfig(params: {
10
+ options?: MysqlAdapterOptions;
11
+ }): MysqlPoolConfig;
12
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMvE,wFAAwF;AACxF,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC1C,EAAE,IAAI,EAAE,MAAM,OAAO,KAAK,OAAO,CAAC;AASnC,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAAE,GAAG,eAAe,CAwC1F"}
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@
18
18
  * (packages/runtime/src/codecs.ts) — see {@link MysqlPoolConfig}.
19
19
  */
20
20
  import type { DatabaseAdapter } from "@vibeorm/runtime";
21
+ import { type MysqlTypeCast } from "./config.ts";
21
22
  /** The parts of a mysql2 `PoolConnection` this adapter uses. */
22
23
  export type MysqlConnectionLike = {
23
24
  /** Binary protocol — prepared statements, cached per connection by mysql2. */
@@ -51,8 +52,8 @@ export type MysqlPoolLike = {
51
52
  * the BigInt codec decodes strings exactly.
52
53
  * - `dateStrings: false` — DATETIME comes back as a JS `Date`; the DateTime
53
54
  * codec passes `Date` through in both directions.
54
- * - `jsonStrings: false` — JSON columns come back already parsed, which is
55
- * what the Json codec's decode expects from mysql2.
55
+ * - `jsonStrings: false` + JSON-specific `typeCast` — parsed JSON with ordinary
56
+ * JSON.parse number semantics, independent of BIGINT string decoding.
56
57
  * - `namedPlaceholders: false` — the mysql dialect renders positional `?`.
57
58
  * - `multipleStatements` defaults to false: the ORM never batches, and
58
59
  * @vibeorm/migrate's mysql runner applies DDL per-statement anyway (DDL
@@ -74,13 +75,17 @@ export type MysqlPoolConfig = {
74
75
  readonly dateStrings: false;
75
76
  readonly jsonStrings: false;
76
77
  readonly namedPlaceholders: false;
78
+ readonly rowsAsArray: false;
79
+ readonly nestTables: undefined;
80
+ readonly typeCast: MysqlTypeCast;
81
+ readonly flags: string[];
77
82
  readonly multipleStatements: boolean;
78
83
  };
79
84
  /**
80
85
  * Options for {@link mysqlAdapter}. Point it at a connection URL **or** at
81
86
  * discrete `host`/`port`/`user`/`password`/`database` fields (mysql2 accepts
82
- * both; when both are given the discrete fields win — mysql2 merges the parsed
83
- * URL underneath explicit config), or hand it a pool you already own.
87
+ * both; when both are given the discrete fields win — the adapter parses the
88
+ * URL once before overlaying explicit config), or hand it a pool you already own.
84
89
  */
85
90
  export type MysqlAdapterOptions = {
86
91
  /** MySQL connection URL (`mysql://user:pw@host:3306/db`). Defaults to `process.env.MYSQL_URL`. */
@@ -162,8 +167,8 @@ export type MysqlAdapterOptions = {
162
167
  * ORM path (`execute`) uses mysql2's binary protocol (`pool.execute`), which
163
168
  * prepares statements and caches them per connection keyed by statement text
164
169
  * (mysql2's `maxPreparedStatements` LRU, default 16000). Raw path
165
- * (`executeUnsafe`) uses the text protocol (`pool.query`) — no statement
166
- * cache, and DDL (which the binary protocol cannot prepare) works.
170
+ * (`executeUnsafe`) uses the text protocol (`pool.query`) when parameterless;
171
+ * nonempty values always use prepared binding, with the same raw-session pin.
167
172
  *
168
173
  * Parameters arrive PRE-ENCODED by the runtime codec table: Json is already a
169
174
  * string, DateTime is a `Date` (mysql2 serializes it per `timezone`), BigInt
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAEV,eAAe,EAIhB,MAAM,kBAAkB,CAAC;AA8B1B,gEAAgE;AAChE,MAAM,MAAM,mBAAmB,GAAG;IAChC,8EAA8E;IAC9E,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,mEAAmE;IACnE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACrE,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,IAAI,IAAI,CAAC;CACjB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,KAAK,CAAC,IAAI,EAAE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B,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,eAAe,CA6a3E;AAID,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzF,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  // @bun
2
2
  // packages/adapter-mysql/src/index.ts
3
3
  import {
4
+ runPinnedSession,
4
5
  createSavepointScope,
5
6
  isTransactionDeadlineError,
7
+ isSavepointRollbackFailedError,
6
8
  runNestedSavepoint,
7
9
  runRootScope,
8
10
  scopeTurn,
@@ -10,7 +12,7 @@ import {
10
12
  transactionOutcomeUnknownError,
11
13
  validateTransactionDeadline
12
14
  } from "@vibeorm/runtime/adapter-kit";
13
- import { internalError } from "@vibeorm/schema";
15
+ import { internalError, VibeError as VibeError6 } from "@vibeorm/schema";
14
16
  import { createPool as mysql2CreatePool } from "mysql2/promise";
15
17
 
16
18
  // packages/adapter-mysql/src/acquire.ts
@@ -61,8 +63,61 @@ async function acquireWithTimeout(params) {
61
63
  }
62
64
  }
63
65
 
64
- // packages/adapter-mysql/src/errors.ts
66
+ // packages/adapter-mysql/src/config.ts
67
+ import * as mysql2 from "mysql2";
65
68
  import { VibeError as VibeError2 } from "@vibeorm/schema";
69
+ var connectionConfig = mysql2.ConnectionConfig;
70
+ var typeCast = (field, next) => {
71
+ if (field.type !== "JSON" && field.extendedFormat !== "json")
72
+ return next();
73
+ const text = field.string("utf8");
74
+ return text === null ? null : JSON.parse(text);
75
+ };
76
+ function mysqlPoolConfig(params) {
77
+ const options = params.options;
78
+ const url = options?.url ?? process.env.MYSQL_URL;
79
+ let parsed;
80
+ try {
81
+ parsed = url === undefined ? {} : connectionConfig.parseUrl(url);
82
+ } catch (cause) {
83
+ throw new VibeError2({ code: "VIBE_CONFIG", message: "Invalid MySQL connection URL", cause });
84
+ }
85
+ delete parsed.uri;
86
+ const explicit = {
87
+ host: options?.host,
88
+ port: options?.port,
89
+ user: options?.user,
90
+ password: options?.password,
91
+ database: options?.database,
92
+ connectionLimit: options?.connectionLimit,
93
+ charset: options?.charset
94
+ };
95
+ for (const [key, value] of Object.entries(explicit)) {
96
+ if (value !== undefined)
97
+ parsed[key] = value;
98
+ }
99
+ if (options?.password !== undefined)
100
+ delete parsed.password1;
101
+ const flags = (Array.isArray(parsed.flags) ? parsed.flags : String(parsed.flags ?? "").split(/\s*,+\s*/)).map((flag) => String(flag).toUpperCase()).filter((flag) => !["-FOUND_ROWS", "MULTI_STATEMENTS", "-MULTI_STATEMENTS"].includes(flag));
102
+ return {
103
+ ...parsed,
104
+ timezone: options?.timezone ?? "Z",
105
+ decimalNumbers: false,
106
+ supportBigNumbers: true,
107
+ bigNumberStrings: true,
108
+ dateStrings: false,
109
+ jsonStrings: false,
110
+ namedPlaceholders: false,
111
+ rowsAsArray: false,
112
+ nestTables: undefined,
113
+ typeCast,
114
+ flags,
115
+ multipleStatements: options?.multipleStatements ?? false
116
+ };
117
+ }
118
+
119
+ // packages/adapter-mysql/src/errors.ts
120
+ import { VibeError as VibeError3 } from "@vibeorm/schema";
66
121
  var MYSQL_ERRNO_ERROR_CODES = Object.freeze({
67
122
  1062: "VIBE_UNIQUE_VIOLATION",
68
123
  1586: "VIBE_UNIQUE_VIOLATION",
@@ -104,7 +159,7 @@ function mysqlErrorErrno(params) {
104
159
  }
105
160
  function mapMysqlDriverError(params) {
106
161
  const { error } = params;
107
- if (error instanceof VibeError2)
162
+ if (error instanceof VibeError3)
108
163
  return error;
109
164
  const source = error !== null && typeof error === "object" ? error : {};
110
165
  const errno = mysqlErrorErrno({ error });
@@ -125,7 +180,7 @@ function mapMysqlDriverError(params) {
125
180
  if (reason !== undefined)
126
181
  meta.reason = reason;
127
182
  const message = readStringField({ source, key: "message" }) ?? (sqlMessage !== undefined ? sqlMessage.trim() : undefined) ?? (typeof error === "string" ? error : "unknown mysql driver error");
128
- return new VibeError2({ code, message, meta, cause: error });
183
+ return new VibeError3({ code, message, meta, cause: error });
129
184
  }
130
185
  async function runMapped(fn) {
131
186
  try {
@@ -136,7 +191,7 @@ async function runMapped(fn) {
136
191
  }
137
192
 
138
193
  // packages/adapter-mysql/src/placeholders.ts
139
- import { VibeError as VibeError3 } from "@vibeorm/schema";
194
+ import { VibeError as VibeError4 } from "@vibeorm/schema";
140
195
  var ROW_COUNT_HINT = /\b(?:limit|offset)\b/i;
141
196
  function isIdentChar(char) {
142
197
  return char !== undefined && /[A-Za-z0-9_$]/.test(char);
@@ -226,7 +281,7 @@ function scanPlaceholders(params) {
226
281
  function toRowCount(params) {
227
282
  const { value, ordinal, text } = params;
228
283
  const refuse = (reason) => {
229
- throw new VibeError3({
284
+ throw new VibeError4({
230
285
  code: "VIBE_VALIDATION",
231
286
  message: `parameter $${ordinal} sits in a LIMIT/OFFSET position and ${reason} \u2014 ` + "a row count must be a non-negative integer",
232
287
  meta: { placeholder: ordinal, value: String(value), text }
@@ -273,24 +328,27 @@ function normalizeSingle(value) {
273
328
  return { rows: value, affectedRows: 0 };
274
329
  }
275
330
  if (isResultSetHeader({ value })) {
276
- return { rows: [], affectedRows: value.affectedRows };
331
+ const header = value;
332
+ const insertId = header.insertId;
333
+ const hasIdentity = typeof insertId === "number" && Number.isSafeInteger(insertId) && insertId !== 0 || typeof insertId === "string" && /^-?\d+$/.test(insertId) && !/^-?0+$/.test(insertId);
334
+ return { rows: [], affectedRows: header.affectedRows, ...hasIdentity ? { insertId } : {} };
277
335
  }
278
336
  return { rows: [], affectedRows: 0 };
279
337
  }
280
338
  function normalizeDriverResult(params) {
281
- const { result } = params;
339
+ const { result, fields } = params;
282
340
  if (Array.isArray(result)) {
283
- const last = result.at(-1);
284
- if (last !== undefined && (Array.isArray(last) || isResultSetHeader({ value: last }))) {
285
- return normalizeSingle(last);
286
- }
341
+ const multiple = Array.isArray(fields) ? fields.some((field) => field === undefined || Array.isArray(field)) : result.some((value) => Array.isArray(value));
342
+ if (multiple)
343
+ return normalizeSingle(result.at(-1));
287
344
  return { rows: result, affectedRows: 0 };
288
345
  }
289
346
  return normalizeSingle(result);
290
347
  }
291
348
 
292
349
  // packages/adapter-mysql/src/transaction-sql.ts
293
- import { VibeError as VibeError4 } from "@vibeorm/schema";
350
+ import { VibeError as VibeError5 } from "@vibeorm/schema";
351
+ import { refuseNestedTransactionOptions } from "@vibeorm/runtime/adapter-kit";
294
352
  var ISOLATION_LEVEL_SQL = Object.freeze({
295
353
  ReadCommitted: "READ COMMITTED",
296
354
  RepeatableRead: "REPEATABLE READ",
@@ -302,7 +360,7 @@ function setIsolationLevelStatement(params) {
302
360
  function maxExecutionTimeStatement(params) {
303
361
  const { timeout } = params;
304
362
  if (!Number.isInteger(timeout) || timeout < 0) {
305
- throw new VibeError4({
363
+ throw new VibeError5({
306
364
  code: "VIBE_VALIDATION",
307
365
  message: `transaction timeout must be a non-negative integer of milliseconds, received ${String(timeout)}`,
308
366
  meta: { timeout }
@@ -320,32 +378,6 @@ function classifyRawTransactionControl(params) {
320
378
  return "close";
321
379
  return null;
322
380
  }
323
- function refuseNestedTransactionOptions(params) {
324
- const { options, provider } = params;
325
- if (options === undefined)
326
- return;
327
- const passed = [];
328
- if (options.isolationLevel !== undefined)
329
- passed.push("isolationLevel");
330
- if (options.timeout !== undefined)
331
- passed.push("timeout");
332
- if (options.deadline !== undefined)
333
- passed.push("deadline");
334
- if (passed.length === 0)
335
- return;
336
- const meta = { provider, nested: true };
337
- if (options.isolationLevel !== undefined)
338
- meta.isolationLevel = options.isolationLevel;
339
- if (options.timeout !== undefined)
340
- meta.timeout = options.timeout;
341
- if (options.deadline !== undefined)
342
- meta.deadline = options.deadline;
343
- throw new VibeError4({
344
- code: "VIBE_VALIDATION",
345
- message: `nested transactions run as savepoints and cannot honor ${passed.join(" or ")} \u2014 a savepoint cannot change the isolation level of the transaction it joins, a nested timeout is not enforceable, and a nested deadline would need its own session setting on a connection it does not own (it inherits the top-level one instead); pass options on the top-level $transaction`,
346
- meta
347
- });
348
- }
349
381
 
350
382
  // packages/adapter-mysql/src/index.ts
351
383
  import { createSavepointCounter, nextSavepointName } from "@vibeorm/runtime/adapter-kit";
@@ -370,6 +402,14 @@ var BUDGETS = Object.freeze({
370
402
  function defaultCreatePool(config) {
371
403
  return mysql2CreatePool(config);
372
404
  }
405
+ function finalizationOutcomeUnknown(params) {
406
+ return new VibeError6({
407
+ code: "VIBE_TRANSACTION",
408
+ message: "MySQL transaction finalization failed; its outcome is unknown. The connection was discarded. Inspect the data before retrying.",
409
+ meta: { provider: PROVIDER, reason: "transaction-outcome-unknown", outcome: "unknown", stage: params.stage },
410
+ cause: params.cause
411
+ });
412
+ }
373
413
  function throwOnArrayParam(values) {
374
414
  throw internalError({
375
415
  message: "formatArrayParam called on the mysql adapter \u2014 the mysql dialect expands scalar-list parameters into IN (?, ?, \u2026) placeholders, so the runtime should have expanded this array before binding",
@@ -390,24 +430,7 @@ function mysqlAdapter(options) {
390
430
  ownsPool = false;
391
431
  return pool;
392
432
  }
393
- const config = {
394
- uri: options?.url ?? process.env.MYSQL_URL,
395
- host: options?.host,
396
- port: options?.port,
397
- user: options?.user,
398
- password: options?.password,
399
- database: options?.database,
400
- connectionLimit: options?.connectionLimit,
401
- charset: options?.charset,
402
- timezone: options?.timezone ?? "Z",
403
- decimalNumbers: false,
404
- supportBigNumbers: true,
405
- bigNumberStrings: true,
406
- dateStrings: false,
407
- jsonStrings: false,
408
- namedPlaceholders: false,
409
- multipleStatements: options?.multipleStatements ?? false
410
- };
433
+ const config = mysqlPoolConfig({ options });
411
434
  pool = (options?.createPool ?? defaultCreatePool)(config);
412
435
  ownsPool = true;
413
436
  return pool;
@@ -420,20 +443,39 @@ function mysqlAdapter(options) {
420
443
  return runMapped(() => acquireWithTimeout({ pool: active, timeoutMs: acquireTimeoutMs, poolSize }));
421
444
  }
422
445
  async function runExecute(params) {
423
- const [result] = await runMapped(() => params.queryable.execute(params.text, params.values));
424
- return normalizeDriverResult({ result }).rows;
446
+ const [result, fields] = await runMapped(() => params.queryable.execute(params.text, params.values));
447
+ return normalizeDriverResult({ result, fields }).rows;
425
448
  }
426
449
  async function runExecuteAffected(params) {
427
450
  const values = bindRowCountParams({ text: params.text, values: params.values });
428
- const [result] = await runMapped(() => params.queryable.execute(params.text, values));
429
- return normalizeDriverResult({ result });
451
+ const [result, fields] = await runMapped(() => params.queryable.execute(params.text, values));
452
+ return normalizeDriverResult({ result, fields });
430
453
  }
431
454
  async function runExecuteUnsafe(params) {
432
- const [result] = await runMapped(() => params.queryable.query(params.text, params.values));
433
- return normalizeDriverResult({ result });
455
+ if (params.values !== undefined && params.values.length > 0) {
456
+ return runExecuteAffected({ ...params, values: params.values });
457
+ }
458
+ const [result, fields] = await runMapped(() => params.queryable.query(params.text, params.values));
459
+ return normalizeDriverResult({ result, fields });
434
460
  }
435
461
  function createConnectionAdapter(params) {
436
462
  const { conn, scope, budget } = params;
463
+ function invalidate(error) {
464
+ if (!(error instanceof VibeError6))
465
+ throw error;
466
+ const mapped = error;
467
+ if (mapped.meta.errno === 1213) {
468
+ scope.state.poisoned = new VibeError6({
469
+ code: mapped.code,
470
+ message: mapped.message,
471
+ meta: { ...mapped.meta, outcome: "rolled-back" },
472
+ cause: mapped
473
+ });
474
+ }
475
+ if (isSavepointRollbackFailedError(mapped))
476
+ budget.close({ outcome: "unknown" });
477
+ throw mapped;
478
+ }
437
479
  return {
438
480
  dialect: DIALECT,
439
481
  provider: PROVIDER,
@@ -444,30 +486,33 @@ function mysqlAdapter(options) {
444
486
  if (turn !== undefined)
445
487
  await turn;
446
488
  budget.assertUsable({ stage: "statement" });
447
- return runExecute({ queryable: conn, ...execParams });
489
+ return runExecute({ queryable: conn, ...execParams }).catch(invalidate);
490
+ },
491
+ async executeRawBound(execParams) {
492
+ return this.executeUnsafe(execParams);
448
493
  },
449
494
  async executeUnsafe(execParams) {
450
495
  const turn = scopeTurn({ scope });
451
496
  if (turn !== undefined)
452
497
  await turn;
453
498
  budget.assertUsable({ stage: "statement" });
454
- return runExecuteUnsafe({ queryable: conn, ...execParams });
499
+ return runExecuteUnsafe({ queryable: conn, ...execParams }).catch(invalidate);
455
500
  },
456
501
  async executeAffected(execParams) {
457
502
  const turn = scopeTurn({ scope });
458
503
  if (turn !== undefined)
459
504
  await turn;
460
505
  budget.assertUsable({ stage: "statement" });
461
- return runExecuteAffected({ queryable: conn, ...execParams });
506
+ return runExecuteAffected({ queryable: conn, ...execParams }).catch(invalidate);
462
507
  },
463
508
  async transaction(fn, nestedOptions) {
464
509
  refuseNestedTransactionOptions({ options: nestedOptions, provider: PROVIDER });
465
510
  budget.assertUsable({ stage: "nested" });
466
511
  return runNestedSavepoint({
467
512
  scope,
468
- execute: (statement) => runMapped(() => conn.query(statement)),
513
+ execute: (statement) => runMapped(() => conn.query(statement)).catch(invalidate),
469
514
  body: (child) => fn(createConnectionAdapter({ conn, scope: child, budget }))
470
- });
515
+ }).catch(invalidate);
471
516
  },
472
517
  async connect() {},
473
518
  async disconnect() {},
@@ -481,6 +526,17 @@ function mysqlAdapter(options) {
481
526
  provider: PROVIDER,
482
527
  wire: WIRE,
483
528
  budgets: BUDGETS,
529
+ async withSession({ run }) {
530
+ const conn = await acquireConnection();
531
+ return runPinnedSession({
532
+ run,
533
+ execute: async (query) => (await runExecuteUnsafe({ queryable: conn, ...query })).rows,
534
+ isLost: (error) => error instanceof VibeError6 && (typeof error.meta.errno !== "number" || [2006, 2013, 2055, 4031].includes(error.meta.errno)),
535
+ release: async () => {
536
+ conn.destroy();
537
+ }
538
+ });
539
+ },
484
540
  async execute(params) {
485
541
  if (acquireTimeoutMs === undefined) {
486
542
  return runExecute({ queryable: getPool(), ...params });
@@ -503,6 +559,9 @@ function mysqlAdapter(options) {
503
559
  conn.release();
504
560
  }
505
561
  },
562
+ async executeRawBound(params) {
563
+ return this.executeUnsafe(params);
564
+ },
506
565
  async executeUnsafe(params) {
507
566
  const control = classifyRawTransactionControl({ text: params.text });
508
567
  if (rawSession !== null) {
@@ -510,9 +569,12 @@ function mysqlAdapter(options) {
510
569
  const session = rawSession;
511
570
  rawSession = null;
512
571
  try {
513
- return await runExecuteUnsafe({ queryable: session, ...params });
514
- } finally {
572
+ const result = await runExecuteUnsafe({ queryable: session, ...params });
515
573
  session.release();
574
+ return result;
575
+ } catch (cause) {
576
+ session.destroy();
577
+ throw finalizationOutcomeUnknown({ cause, stage: "raw-close" });
516
578
  }
517
579
  }
518
580
  return runExecuteUnsafe({ queryable: rawSession, ...params });
@@ -564,11 +626,22 @@ function mysqlAdapter(options) {
564
626
  scope,
565
627
  body: () => fn(createConnectionAdapter({ conn, scope, budget }))
566
628
  });
629
+ const turn = scopeTurn({ scope });
630
+ if (turn !== undefined)
631
+ await turn;
567
632
  budget.assertUsable({ stage: "commit" });
568
- await runMapped(() => conn.commit());
633
+ await runMapped(() => conn.commit()).catch((cause) => {
634
+ budget.close({ outcome: "unknown" });
635
+ rollbackFailed = true;
636
+ throw finalizationOutcomeUnknown({ cause, stage: "commit" });
637
+ });
569
638
  budget.close({ outcome: "committed" });
570
639
  return result;
571
640
  } catch (error) {
641
+ if (isSavepointRollbackFailedError(error) || budget.outcome === "unknown") {
642
+ budget.close({ outcome: "unknown" });
643
+ rollbackFailed = true;
644
+ }
572
645
  try {
573
646
  await conn.rollback();
574
647
  budget.close({ outcome: "rolled-back" });
@@ -660,4 +733,4 @@ export {
660
733
  DEFAULT_ACQUIRE_TIMERS
661
734
  };
662
735
 
663
- //# debugId=FE2CBF50E43C3F8B64756E2164756E21
736
+ //# debugId=40CD59F30C5F625164756E2164756E21
package/dist/index.js.map CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/acquire.ts", "../src/errors.ts", "../src/placeholders.ts", "../src/results.ts", "../src/transaction-sql.ts"],
3
+ "sources": ["../src/index.ts", "../src/acquire.ts", "../src/config.ts", "../src/errors.ts", "../src/placeholders.ts", "../src/results.ts", "../src/transaction-sql.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * @vibeorm/adapter-mysql — mysql2 adapter for VibeORM v2.\n *\n * Runs on Bun and Node over `mysql2/promise`. Owns pooling, transactions\n * (nested → savepoints on the same pinned connection) and driver-error\n * mapping. Only `VibeError` ever escapes.\n *\n * SAME-CONNECTION GUARANTEE (board #7): `transaction()` checks ONE connection\n * out of the pool and every operation on the callback's adapter — `execute`,\n * `executeUnsafe`, nested `transaction` — runs on that same connection until\n * commit/rollback. That pinning is what makes `LAST_INSERT_ID()` sound: the\n * runtime wraps DB-assigned-key creates in `adapter.transaction` and issues\n * `SELECT LAST_INSERT_ID() AS id` via `executeUnsafe`, and LAST_INSERT_ID() is\n * per-connection state in MySQL — on any other connection it would answer for\n * someone else's INSERT.\n *\n * Driver configuration is pinned to the runtime's MYSQL_CODECS contract\n * (packages/runtime/src/codecs.ts) — see {@link MysqlPoolConfig}.\n */\n\nimport type {\n AdapterBudgetSupport,\n DatabaseAdapter,\n QueryResult,\n TransactionOptions,\n WireFidelity,\n} from \"@vibeorm/runtime\";\nimport {\n createSavepointScope,\n isTransactionDeadlineError,\n runNestedSavepoint,\n runRootScope,\n type SavepointScope,\n scopeTurn,\n startTransactionBudget,\n type TransactionBudget,\n transactionOutcomeUnknownError,\n validateTransactionDeadline,\n} from \"@vibeorm/runtime/adapter-kit\";\nimport type { Dialect, Provider } from \"@vibeorm/schema\";\nimport { internalError } from \"@vibeorm/schema\";\nimport { createPool as mysql2CreatePool } from \"mysql2/promise\";\nimport { MYSQL_DEFAULT_CONNECTION_LIMIT, acquireWithTimeout } from \"./acquire.ts\";\nimport { mapMysqlDriverError, runMapped } from \"./errors.ts\";\nimport { bindRowCountParams } from \"./placeholders.ts\";\nimport { normalizeDriverResult } from \"./results.ts\";\nimport {\n RESET_MAX_EXECUTION_TIME_SQL,\n classifyRawTransactionControl,\n maxExecutionTimeStatement,\n refuseNestedTransactionOptions,\n setIsolationLevelStatement,\n} from \"./transaction-sql.ts\";\n\n// ─── Minimal mysql2 surface ───────────────────────────────────────\n\n/** The parts of a mysql2 `PoolConnection` this adapter uses. */\nexport type MysqlConnectionLike = {\n /** Binary protocol — prepared statements, cached per connection by mysql2. */\n execute(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n /** Text protocol — raw path and transaction-control statements. */\n query(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n beginTransaction(): Promise<void>;\n commit(): Promise<void>;\n rollback(): Promise<void>;\n ping(): Promise<void>;\n release(): void;\n destroy(): void;\n};\n\n/** The parts of a mysql2 promise `Pool` this adapter uses. */\nexport type MysqlPoolLike = {\n execute(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n query(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n getConnection(): Promise<MysqlConnectionLike>;\n end(): Promise<void>;\n};\n\n/** Anything that can run a statement: the pool itself or a pinned connection. */\ntype Queryable = Pick<MysqlConnectionLike, \"execute\" | \"query\">;\n\n// ─── Pool config ──────────────────────────────────────────────────\n\n/**\n * The exact configuration this adapter hands to `mysql2.createPool`. The\n * literal-typed fields are pinned to the runtime's MYSQL_CODECS contract and\n * are not user-overridable:\n *\n * - `decimalNumbers: false` — DECIMAL comes back as a string; the Decimal\n * codec keeps it a string (no float rounding) and trims the fixed-scale\n * padding MySQL reports (`DECIMAL(65, 30)` → `\"42.420…00\"` → `\"42.42\"`).\n * - `supportBigNumbers: true` + `bigNumberStrings: true` — BIGINT (and\n * DECIMAL) always come back as strings, never a precision-lossy JS number;\n * the BigInt codec decodes strings exactly.\n * - `dateStrings: false` — DATETIME comes back as a JS `Date`; the DateTime\n * codec passes `Date` through in both directions.\n * - `jsonStrings: false` — JSON columns come back already parsed, which is\n * what the Json codec's decode expects from mysql2.\n * - `namedPlaceholders: false` — the mysql dialect renders positional `?`.\n * - `multipleStatements` defaults to false: the ORM never batches, and\n * @vibeorm/migrate's mysql runner applies DDL per-statement anyway (DDL\n * auto-commits, so per-statement progress tracking needs it).\n */\nexport type MysqlPoolConfig = {\n readonly uri?: string;\n readonly host?: string;\n readonly port?: number;\n readonly user?: string;\n readonly password?: string;\n readonly database?: string;\n readonly connectionLimit?: number;\n readonly charset?: string;\n readonly timezone: string;\n readonly decimalNumbers: false;\n readonly supportBigNumbers: true;\n readonly bigNumberStrings: true;\n readonly dateStrings: false;\n readonly jsonStrings: false;\n readonly namedPlaceholders: false;\n readonly multipleStatements: boolean;\n};\n\n// ─── Options ──────────────────────────────────────────────────────\n\n/**\n * Options for {@link mysqlAdapter}. Point it at a connection URL **or** at\n * discrete `host`/`port`/`user`/`password`/`database` fields (mysql2 accepts\n * both; when both are given the discrete fields win — mysql2 merges the parsed\n * URL underneath explicit config), or hand it a pool you already own.\n */\nexport type MysqlAdapterOptions = {\n /** MySQL connection URL (`mysql://user:pw@host:3306/db`). Defaults to `process.env.MYSQL_URL`. */\n readonly url?: string;\n readonly host?: string;\n readonly port?: number;\n readonly user?: string;\n readonly password?: string;\n readonly database?: string;\n /**\n * An existing mysql2 promise pool to use instead of creating one. The\n * adapter never ends a pool it did not create, so `disconnect()` is a no-op\n * in this mode. The pool MUST be configured to the codec contract\n * ({@link MysqlPoolConfig}) — the adapter cannot verify it.\n */\n readonly pool?: MysqlPoolLike;\n /** Maximum pooled connections (mysql2 default 10). Ignored when `pool` is given. */\n readonly connectionLimit?: number;\n /**\n * mysql2 `timezone`, default `\"Z\"`: the codec table stores DateTime as UTC\n * in `DATETIME(3)` columns, and DATETIME has no zone of its own — with\n * `\"Z\"` mysql2 serializes outgoing `Date`s as UTC and parses incoming\n * DATETIME text as UTC, so the instant round-trips regardless of the server\n * or process time zone. mysql2's own default (`\"local\"`) would silently\n * shift values by the process offset.\n */\n readonly timezone?: string;\n /** Connection charset/collation (mysql2 default `utf8mb4_general_ci`). */\n readonly charset?: string;\n /**\n * Milliseconds to wait for a pool connection before refusing with a\n * `VibeError` (`VIBE_ADAPTER`, `meta.reason: \"acquire-timeout\"`).\n *\n * **Unset (the default) keeps mysql2's own behaviour**: the pool is created\n * with `waitForConnections: true` and no time bound, so a caller whose\n * connections are all busy QUEUES until one frees. Setting this bounds EVERY\n * pool checkout the adapter makes — the caller gets a coded refusal instead\n * of an unbounded wait.\n *\n * Adapter-owned: mysql2 has no acquire timeout at all (its pool knobs are\n * `waitForConnections` and `queueLimit`, which bounds queue DEPTH, not time),\n * so this value is never passed to `mysql2.createPool`.\n *\n * **Not mysql2's `connectTimeout`**, which is the deadline for establishing a\n * NEW connection rather than for waiting on a busy pool. The equivalent\n * option on `@vibeorm/adapter-pg` is `connectionTimeout`; the name differs\n * here precisely because mysql2 already uses that word for something else.\n */\n readonly acquireTimeout?: number;\n /**\n * Allow multiple statements per `executeUnsafe` call (default false). Leave\n * it off: the ORM never batches, @vibeorm/migrate applies DDL per statement,\n * and enabling it widens the SQL-injection blast radius of raw queries.\n */\n readonly multipleStatements?: boolean;\n /**\n * Pool factory — a test seam. Defaults to `mysql2/promise`'s `createPool`;\n * tests inject a recording fake here to assert the exact config the adapter\n * builds. Ignored when `pool` is given.\n */\n readonly createPool?: (config: MysqlPoolConfig) => MysqlPoolLike;\n};\n\n// ─── Adapter ──────────────────────────────────────────────────────\n\nconst DIALECT: Dialect = \"mysql\";\nconst PROVIDER: Provider = \"mysql\";\n\n/**\n * mysql2 wire (board #30, live-verified on both execute paths, 8.4):\n * datetime(3) → `Date` (under the adapter's pinned `timezone: \"Z\"`), JSON →\n * parsed values, int/double → numbers. (BIGINT arrives as a string and\n * TINYINT(1) as 0/1 — BigInt/Boolean decoding stays.)\n */\nconst WIRE: WireFidelity = Object.freeze({ dateTime: \"native\", json: \"parsed\", numbers: \"native\" } as const);\n\n/**\n * Timing budgets this adapter genuinely enforces (EPIC 6).\n *\n * - `acquireTimeout: true` — {@link MysqlAdapterOptions.acquireTimeout} bounds\n * the checkout wait (mysql2 itself has none; ./acquire.ts explains why).\n * Declared as a capability; it is OFF until the option is set.\n * - `statementTimeout: \"select-only\"` — **MySQL's `MAX_EXECUTION_TIME` bounds\n * SELECT statements only.** INSERT/UPDATE/DELETE/DDL run unbounded, so this\n * is NOT general write cancellation and is not declared as one.\n * - `transactionDeadline: \"between-statements\"` — the budget is honoured before\n * each statement and at the commit. `\"cancel-running-statements\"` is REFUSED:\n * an in-flight write cannot be stopped through this connection, and killing\n * it from a second pooled connection would risk cancelling a session that had\n * already moved on.\n */\nconst BUDGETS: AdapterBudgetSupport = Object.freeze({\n acquireTimeout: true,\n statementTimeout: \"select-only\",\n transactionDeadline: \"between-statements\",\n} as const);\n\nfunction defaultCreatePool(config: MysqlPoolConfig): MysqlPoolLike {\n // Single cast seam: mysql2's Pool satisfies MysqlPoolLike structurally, but\n // its generic overloads don't reduce to our plain signatures.\n return mysql2CreatePool(config as Parameters<typeof mysql2CreatePool>[0]) as unknown as MysqlPoolLike;\n}\n\n/** Scalar-array params must never reach this adapter — the dialect expands IN. */\nfunction throwOnArrayParam(values: unknown[]): never {\n throw internalError({\n message:\n \"formatArrayParam called on the mysql adapter — the mysql dialect expands scalar-list parameters into IN (?, ?, …) placeholders, so the runtime should have expanded this array before binding\",\n meta: { length: values.length },\n });\n}\n\n/**\n * Create a VibeORM adapter backed by mysql2.\n *\n * @example\n * ```ts\n * const adapter = mysqlAdapter({ url: process.env.MYSQL_URL, connectionLimit: 20 });\n * await adapter.connect();\n * const rows = await adapter.execute({ text: \"SELECT * FROM `User` WHERE `id` = ?\", values: [1] });\n * ```\n *\n * @example Discrete fields, or reusing a pool you already own\n * ```ts\n * const adapter = mysqlAdapter({ host: \"127.0.0.1\", port: 3306, user: \"app\", password: \"pw\", database: \"app\" });\n * const shared = mysqlAdapter({ pool: existingPool });\n * ```\n *\n * ORM path (`execute`) uses mysql2's binary protocol (`pool.execute`), which\n * prepares statements and caches them per connection keyed by statement text\n * (mysql2's `maxPreparedStatements` LRU, default 16000). Raw path\n * (`executeUnsafe`) uses the text protocol (`pool.query`) — no statement\n * cache, and DDL (which the binary protocol cannot prepare) works.\n *\n * Parameters arrive PRE-ENCODED by the runtime codec table: Json is already a\n * string, DateTime is a `Date` (mysql2 serializes it per `timezone`), BigInt\n * is a string. The adapter forwards values verbatim — no second conversion.\n */\nexport function mysqlAdapter(options?: MysqlAdapterOptions): DatabaseAdapter {\n let pool: MysqlPoolLike | null = null;\n let ownsPool = false;\n\n /**\n * The pinned connection of an OPEN raw transaction — session affinity for\n * the raw path. A raw `BEGIN` … `COMMIT` sequence over `executeUnsafe` is\n * sound only when every statement in between rides the SAME pooled\n * connection, so a pure `BEGIN` checks one out, raw statements ride it, and\n * the matching `COMMIT`/`ROLLBACK` releases it (same semantics as the pg and\n * bun adapters). The ORM path (`execute`) and `transaction()` stay on the\n * pool. Concurrent raw transactions on one adapter are unsupported.\n */\n let rawSession: MysqlConnectionLike | null = null;\n\n const acquireTimeoutMs = options?.acquireTimeout;\n\n /**\n * Effective pool size for the refusal message. Unknown — and reported as\n * such — when the caller supplied the pool, since `connectionLimit` is\n * ignored in that mode.\n */\n const poolSize: number | undefined =\n options?.pool === undefined ? (options?.connectionLimit ?? MYSQL_DEFAULT_CONNECTION_LIMIT) : undefined;\n\n function getPool(): MysqlPoolLike {\n if (pool !== null) return pool;\n\n if (options?.pool !== undefined) {\n pool = options.pool;\n ownsPool = false;\n return pool;\n }\n\n const config: MysqlPoolConfig = {\n uri: options?.url ?? process.env.MYSQL_URL,\n host: options?.host,\n port: options?.port,\n user: options?.user,\n password: options?.password,\n database: options?.database,\n connectionLimit: options?.connectionLimit,\n charset: options?.charset,\n timezone: options?.timezone ?? \"Z\",\n decimalNumbers: false,\n supportBigNumbers: true,\n bigNumberStrings: true,\n dateStrings: false,\n jsonStrings: false,\n namedPlaceholders: false,\n multipleStatements: options?.multipleStatements ?? false,\n };\n pool = (options?.createPool ?? defaultCreatePool)(config);\n ownsPool = true;\n return pool;\n }\n\n /**\n * The ONE place a connection is checked out. Without `acquireTimeout` this is\n * mysql2's own unbounded checkout, byte for byte; with it, the wait is\n * bounded and a caller that cannot be served refuses instead of queueing.\n * `runMapped` maps driver failures — the timeout error is already a\n * `VibeError` and passes through untouched (errors.ts:121).\n */\n async function acquireConnection(): Promise<MysqlConnectionLike> {\n const active = getPool();\n if (acquireTimeoutMs === undefined) {\n return runMapped(() => active.getConnection());\n }\n return runMapped(() => acquireWithTimeout({ pool: active, timeoutMs: acquireTimeoutMs, poolSize }));\n }\n\n async function runExecute(params: {\n queryable: Queryable;\n text: string;\n values: unknown[];\n }): Promise<Record<string, unknown>[]> {\n const [result] = await runMapped(() => params.queryable.execute(params.text, params.values));\n return normalizeDriverResult({ result }).rows;\n }\n\n /**\n * The ORM's affected-row path (F01). Same PREPARED protocol as `execute()` —\n * mysql2 sends the statement and its parameters separately — but keeping the\n * OK-packet's `affectedRows` instead of dropping it.\n *\n * Never `query()`: that is the TEXT protocol, which interpolates values into\n * the SQL client-side. mysql2 cannot know the server's `sql_mode`, so under\n * `NO_BACKSLASH_ESCAPES` its `\\'` is not an escape and a hostile string\n * predicate breaks out of its literal — a `deleteMany` deleted rows a bound\n * read did not match. There is deliberately NO fallback from a failed\n * preparation to interpolation: an unpreparable statement fails loudly.\n *\n * RAW STATEMENTS RIDE THIS PATH TOO, so `bindRowCountParams` first rewrites\n * integers sitting in a `LIMIT` / `OFFSET` position into their decimal text:\n * mysql2's prepared protocol types a JS number in a way the server refuses\n * there (errno 1210), and only user-written raw SQL can produce that shape —\n * the ORM inlines its limits as literal text. Nothing else is touched.\n */\n async function runExecuteAffected(params: {\n queryable: Queryable;\n text: string;\n values: unknown[];\n }): Promise<QueryResult> {\n const values = bindRowCountParams({ text: params.text, values: params.values });\n const [result] = await runMapped(() => params.queryable.execute(params.text, values));\n return normalizeDriverResult({ result });\n }\n\n async function runExecuteUnsafe(params: {\n queryable: Queryable;\n text: string;\n values?: unknown[];\n }): Promise<QueryResult> {\n const [result] = await runMapped(() => params.queryable.query(params.text, params.values));\n return normalizeDriverResult({ result });\n }\n\n /**\n * Adapter bound to the ONE pinned connection of an open transaction — the\n * same-connection guarantee. Nested `transaction()` calls open savepoints on\n * that connection, and their LIFETIMES are serialized by the savepoint gate\n * (F14): overlapping siblings share one savepoint stack, so the earlier\n * one's rollback would erase the later one's already released work.\n */\n function createConnectionAdapter(params: {\n conn: MysqlConnectionLike;\n scope: SavepointScope;\n budget: TransactionBudget;\n }): DatabaseAdapter {\n const { conn, scope, budget } = params;\n\n return {\n dialect: DIALECT,\n provider: PROVIDER,\n wire: WIRE,\n budgets: BUDGETS,\n\n async execute(execParams) {\n const turn = scopeTurn({ scope });\n if (turn !== undefined) await turn;\n // After the turn, not before: waiting for a sibling savepoint spends\n // the same budget the statement is about to run against.\n budget.assertUsable({ stage: \"statement\" });\n return runExecute({ queryable: conn, ...execParams });\n },\n\n async executeUnsafe(execParams) {\n const turn = scopeTurn({ scope });\n if (turn !== undefined) await turn;\n budget.assertUsable({ stage: \"statement\" });\n return runExecuteUnsafe({ queryable: conn, ...execParams });\n },\n\n async executeAffected(execParams) {\n const turn = scopeTurn({ scope });\n if (turn !== undefined) await turn;\n budget.assertUsable({ stage: \"statement\" });\n return runExecuteAffected({ queryable: conn, ...execParams });\n },\n\n async transaction<T>(\n fn: (txAdapter: DatabaseAdapter) => Promise<T>,\n nestedOptions?: TransactionOptions,\n ): Promise<T> {\n refuseNestedTransactionOptions({ options: nestedOptions, provider: PROVIDER });\n budget.assertUsable({ stage: \"nested\" });\n return runNestedSavepoint({\n scope,\n execute: (statement) => runMapped(() => conn.query(statement)),\n // The child shares the ROOT budget by reference: a savepoint never\n // gets an independent clock or session setting.\n body: (child) => fn(createConnectionAdapter({ conn, scope: child, budget })),\n });\n },\n\n async connect(): Promise<void> {\n // Already connected — this adapter is bound to a pinned connection.\n },\n\n async disconnect(): Promise<void> {\n // The pool owns the connection lifecycle; releasing happens at the\n // top-level transaction boundary.\n },\n\n formatArrayParam(values: unknown[]): unknown {\n return throwOnArrayParam(values);\n },\n };\n }\n\n return {\n dialect: DIALECT,\n provider: PROVIDER,\n wire: WIRE,\n budgets: BUDGETS,\n\n async execute(params) {\n // Default path: mysql2's `pool.execute` does its own implicit checkout.\n // With `acquireTimeout` set that checkout has to be visible to be\n // bounded, so the statement is routed over an explicit connection\n // instead (mysql2 caches prepared statements per connection either way).\n if (acquireTimeoutMs === undefined) {\n return runExecute({ queryable: getPool(), ...params });\n }\n const conn = await acquireConnection();\n try {\n return await runExecute({ queryable: conn, ...params });\n } finally {\n conn.release();\n }\n },\n\n async executeAffected(params) {\n // Same checkout rules as `execute()` above: implicit with mysql2's own\n // pool, explicit (and therefore boundable) when `acquireTimeout` is set.\n if (acquireTimeoutMs === undefined) {\n return runExecuteAffected({ queryable: getPool(), ...params });\n }\n const conn = await acquireConnection();\n try {\n return await runExecuteAffected({ queryable: conn, ...params });\n } finally {\n conn.release();\n }\n },\n\n async executeUnsafe(params) {\n const control = classifyRawTransactionControl({ text: params.text });\n if (rawSession !== null) {\n if (control === \"close\") {\n const session = rawSession;\n rawSession = null;\n try {\n return await runExecuteUnsafe({ queryable: session, ...params });\n } finally {\n session.release();\n }\n }\n return runExecuteUnsafe({ queryable: rawSession, ...params });\n }\n if (control === \"open\") {\n const conn = await acquireConnection();\n try {\n const result = await runExecuteUnsafe({ queryable: conn, ...params });\n rawSession = conn;\n return result;\n } catch (error) {\n conn.release();\n throw error;\n }\n }\n // Default path: mysql2's `pool.query` checks a connection out\n // implicitly. Same reroute as `execute()` above, for the same reason —\n // a checkout has to be visible to be bounded, so with `acquireTimeout`\n // set the raw statement runs on an explicit connection too.\n if (acquireTimeoutMs === undefined) {\n return runExecuteUnsafe({ queryable: getPool(), ...params });\n }\n const conn = await acquireConnection();\n try {\n return await runExecuteUnsafe({ queryable: conn, ...params });\n } finally {\n conn.release();\n }\n },\n\n async transaction<T>(\n fn: (txAdapter: DatabaseAdapter) => Promise<T>,\n transactionOptions?: TransactionOptions,\n ): Promise<T> {\n // Validate the timeout before taking a connection, so a bad option fails\n // fast instead of wasting a checkout.\n const timeoutText =\n transactionOptions?.timeout === undefined\n ? undefined\n : maxExecutionTimeStatement({ timeout: transactionOptions.timeout });\n // Same rule for the deadline: an unsupportable budget is refused before a\n // connection is taken, so it never costs a checkout.\n validateTransactionDeadline({\n options: transactionOptions,\n support: BUDGETS.transactionDeadline,\n provider: PROVIDER,\n });\n\n const conn = await acquireConnection();\n /** Set when the session state can no longer be asserted (see below). */\n let rollbackFailed = false;\n // The deadline clock starts with the connection already in hand:\n // acquisition has its own budget (`acquireTimeout`) and is not charged here.\n const budget = startTransactionBudget({ options: transactionOptions, provider: PROVIDER });\n try {\n // Session-scoped SELECT bound — see transaction-sql.ts for the loud\n // \"SELECT statements only\" caveat. Reset in finally below.\n if (timeoutText !== undefined) {\n await runMapped(() => conn.query(timeoutText));\n }\n // Applies to the NEXT transaction in the session → must precede begin.\n const isolationLevel = transactionOptions?.isolationLevel;\n if (isolationLevel !== undefined) {\n const isolationText = setIsolationLevelStatement({ isolationLevel });\n await runMapped(() => conn.query(isolationText));\n }\n await runMapped(() => conn.beginTransaction());\n const scope = createSavepointScope();\n try {\n const result = await runRootScope({\n scope,\n body: () => fn(createConnectionAdapter({ conn, scope, budget })),\n });\n // An expired budget must never commit, however the callback ended.\n budget.assertUsable({ stage: \"commit\" });\n await runMapped(() => conn.commit());\n budget.close({ outcome: \"committed\" });\n return result;\n } catch (error) {\n // Best effort: never mask the original failure with a rollback failure.\n try {\n await conn.rollback();\n budget.close({ outcome: \"rolled-back\" });\n } catch {\n // The rollback that should have cleaned up failed: the commit state\n // is genuinely unknown and the connection is destroyed below rather\n // than pooled while it may still be inside a transaction.\n rollbackFailed = true;\n budget.close({ outcome: \"unknown\" });\n if (budget.totalMs !== null && isTransactionDeadlineError(error)) {\n throw transactionOutcomeUnknownError({\n provider: PROVIDER,\n totalMs: budget.totalMs,\n cause: error,\n });\n }\n }\n throw error;\n }\n } finally {\n let poisoned = rollbackFailed;\n if (timeoutText !== undefined && !poisoned) {\n try {\n await conn.query(RESET_MAX_EXECUTION_TIME_SQL);\n } catch {\n poisoned = true;\n }\n }\n // A connection whose session default could not be restored — or whose\n // rollback failed, so it may still be inside a transaction — must never\n // return to the pool.\n if (poisoned) {\n conn.destroy();\n } else {\n conn.release();\n }\n }\n },\n\n async connect(): Promise<void> {\n const conn = await acquireConnection();\n try {\n await runMapped(() => conn.ping());\n } finally {\n conn.release();\n }\n },\n\n async disconnect(): Promise<void> {\n if (rawSession !== null) {\n // An abandoned raw transaction must not leak an in-transaction\n // connection; roll it back best-effort before the pool ends.\n const session = rawSession;\n rawSession = null;\n try {\n await session.query(\"ROLLBACK\");\n } catch {\n /* the pool is closing; the session is going away regardless */\n }\n session.release();\n }\n if (pool !== null && ownsPool) {\n const closing = pool;\n pool = null;\n await runMapped(() => closing.end());\n }\n },\n\n formatArrayParam(values: unknown[]): unknown {\n return throwOnArrayParam(values);\n },\n };\n}\n\n// ─── Re-exports (driver-error table, helpers) ─────────────────────\n\nexport {\n DEFAULT_ACQUIRE_TIMERS,\n MYSQL_DEFAULT_CONNECTION_LIMIT,\n acquireTimeoutError,\n acquireWithTimeout,\n} from \"./acquire.ts\";\nexport type { AcquireSource, AcquireTimers, ReleasableConnection, TimerHandle } from \"./acquire.ts\";\nexport {\n MYSQL_ERRNO_ERROR_CODES,\n MYSQL_ERRNO_REASONS,\n mapMysqlDriverError,\n mysqlErrorErrno,\n runMapped,\n} from \"./errors.ts\";\nexport { isResultSetHeader, normalizeDriverResult } from \"./results.ts\";\nexport { createSavepointCounter, nextSavepointName } from \"@vibeorm/runtime/adapter-kit\";\nexport type { SavepointCounter } from \"@vibeorm/runtime/adapter-kit\";\nexport {\n ISOLATION_LEVEL_SQL,\n RESET_MAX_EXECUTION_TIME_SQL,\n classifyRawTransactionControl,\n maxExecutionTimeStatement,\n refuseNestedTransactionOptions,\n setIsolationLevelStatement,\n} from \"./transaction-sql.ts\";\nexport type { RawTransactionControl } from \"./transaction-sql.ts\";\n// ─── EPIC 6: transaction budgets (shared, @vibeorm/runtime/adapter-kit) ───\nexport {\n DEFAULT_DEADLINE_CLOCK,\n engineStatementBudgetMs,\n isTransactionDeadlineError,\n startTransactionBudget,\n transactionClosedError,\n transactionDeadlineError,\n transactionOutcomeUnknownError,\n validateTransactionDeadline,\n} from \"@vibeorm/runtime/adapter-kit\";\nexport type { BudgetStage, DeadlineClock, TransactionBudget, TransactionOutcome } from \"@vibeorm/runtime/adapter-kit\";\n",
5
+ "/**\n * @vibeorm/adapter-mysql — mysql2 adapter for VibeORM v2.\n *\n * Runs on Bun and Node over `mysql2/promise`. Owns pooling, transactions\n * (nested → savepoints on the same pinned connection) and driver-error\n * mapping. Only `VibeError` ever escapes.\n *\n * SAME-CONNECTION GUARANTEE (board #7): `transaction()` checks ONE connection\n * out of the pool and every operation on the callback's adapter — `execute`,\n * `executeUnsafe`, nested `transaction` — runs on that same connection until\n * commit/rollback. That pinning is what makes `LAST_INSERT_ID()` sound: the\n * runtime wraps DB-assigned-key creates in `adapter.transaction` and issues\n * `SELECT LAST_INSERT_ID() AS id` via `executeUnsafe`, and LAST_INSERT_ID() is\n * per-connection state in MySQL — on any other connection it would answer for\n * someone else's INSERT.\n *\n * Driver configuration is pinned to the runtime's MYSQL_CODECS contract\n * (packages/runtime/src/codecs.ts) — see {@link MysqlPoolConfig}.\n */\n\nimport type {\n AdapterBudgetSupport,\n DatabaseAdapter,\n QueryResult,\n TransactionOptions,\n WireFidelity,\n} from \"@vibeorm/runtime\";\nimport {\n runPinnedSession,\n createSavepointScope,\n isTransactionDeadlineError,\n isSavepointRollbackFailedError,\n runNestedSavepoint,\n runRootScope,\n type SavepointScope,\n scopeTurn,\n startTransactionBudget,\n type TransactionBudget,\n transactionOutcomeUnknownError,\n validateTransactionDeadline,\n} from \"@vibeorm/runtime/adapter-kit\";\nimport type { Dialect, Provider } from \"@vibeorm/schema\";\nimport { internalError, VibeError } from \"@vibeorm/schema\";\nimport { createPool as mysql2CreatePool } from \"mysql2/promise\";\nimport { MYSQL_DEFAULT_CONNECTION_LIMIT, acquireWithTimeout } from \"./acquire.ts\";\nimport { mysqlPoolConfig, type MysqlTypeCast } from \"./config.ts\";\nimport { mapMysqlDriverError, runMapped } from \"./errors.ts\";\nimport { bindRowCountParams } from \"./placeholders.ts\";\nimport { normalizeDriverResult } from \"./results.ts\";\nimport {\n RESET_MAX_EXECUTION_TIME_SQL,\n classifyRawTransactionControl,\n maxExecutionTimeStatement,\n refuseNestedTransactionOptions,\n setIsolationLevelStatement,\n} from \"./transaction-sql.ts\";\n\n// ─── Minimal mysql2 surface ───────────────────────────────────────\n\n/** The parts of a mysql2 `PoolConnection` this adapter uses. */\nexport type MysqlConnectionLike = {\n /** Binary protocol — prepared statements, cached per connection by mysql2. */\n execute(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n /** Text protocol — raw path and transaction-control statements. */\n query(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n beginTransaction(): Promise<void>;\n commit(): Promise<void>;\n rollback(): Promise<void>;\n ping(): Promise<void>;\n release(): void;\n destroy(): void;\n};\n\n/** The parts of a mysql2 promise `Pool` this adapter uses. */\nexport type MysqlPoolLike = {\n execute(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n query(text: string, values?: unknown[]): Promise<[unknown, unknown]>;\n getConnection(): Promise<MysqlConnectionLike>;\n end(): Promise<void>;\n};\n\n/** Anything that can run a statement: the pool itself or a pinned connection. */\ntype Queryable = Pick<MysqlConnectionLike, \"execute\" | \"query\">;\n\n// ─── Pool config ──────────────────────────────────────────────────\n\n/**\n * The exact configuration this adapter hands to `mysql2.createPool`. The\n * literal-typed fields are pinned to the runtime's MYSQL_CODECS contract and\n * are not user-overridable:\n *\n * - `decimalNumbers: false` — DECIMAL comes back as a string; the Decimal\n * codec keeps it a string (no float rounding) and trims the fixed-scale\n * padding MySQL reports (`DECIMAL(65, 30)` → `\"42.420…00\"` → `\"42.42\"`).\n * - `supportBigNumbers: true` + `bigNumberStrings: true` — BIGINT (and\n * DECIMAL) always come back as strings, never a precision-lossy JS number;\n * the BigInt codec decodes strings exactly.\n * - `dateStrings: false` — DATETIME comes back as a JS `Date`; the DateTime\n * codec passes `Date` through in both directions.\n * - `jsonStrings: false` + JSON-specific `typeCast` — parsed JSON with ordinary\n * JSON.parse number semantics, independent of BIGINT string decoding.\n * - `namedPlaceholders: false` — the mysql dialect renders positional `?`.\n * - `multipleStatements` defaults to false: the ORM never batches, and\n * @vibeorm/migrate's mysql runner applies DDL per-statement anyway (DDL\n * auto-commits, so per-statement progress tracking needs it).\n */\nexport type MysqlPoolConfig = {\n readonly uri?: string;\n readonly host?: string;\n readonly port?: number;\n readonly user?: string;\n readonly password?: string;\n readonly database?: string;\n readonly connectionLimit?: number;\n readonly charset?: string;\n readonly timezone: string;\n readonly decimalNumbers: false;\n readonly supportBigNumbers: true;\n readonly bigNumberStrings: true;\n readonly dateStrings: false;\n readonly jsonStrings: false;\n readonly namedPlaceholders: false;\n readonly rowsAsArray: false;\n readonly nestTables: undefined;\n readonly typeCast: MysqlTypeCast;\n readonly flags: string[];\n readonly multipleStatements: boolean;\n};\n\n// ─── Options ──────────────────────────────────────────────────────\n\n/**\n * Options for {@link mysqlAdapter}. Point it at a connection URL **or** at\n * discrete `host`/`port`/`user`/`password`/`database` fields (mysql2 accepts\n * both; when both are given the discrete fields win — the adapter parses the\n * URL once before overlaying explicit config), or hand it a pool you already own.\n */\nexport type MysqlAdapterOptions = {\n /** MySQL connection URL (`mysql://user:pw@host:3306/db`). Defaults to `process.env.MYSQL_URL`. */\n readonly url?: string;\n readonly host?: string;\n readonly port?: number;\n readonly user?: string;\n readonly password?: string;\n readonly database?: string;\n /**\n * An existing mysql2 promise pool to use instead of creating one. The\n * adapter never ends a pool it did not create, so `disconnect()` is a no-op\n * in this mode. The pool MUST be configured to the codec contract\n * ({@link MysqlPoolConfig}) — the adapter cannot verify it.\n */\n readonly pool?: MysqlPoolLike;\n /** Maximum pooled connections (mysql2 default 10). Ignored when `pool` is given. */\n readonly connectionLimit?: number;\n /**\n * mysql2 `timezone`, default `\"Z\"`: the codec table stores DateTime as UTC\n * in `DATETIME(3)` columns, and DATETIME has no zone of its own — with\n * `\"Z\"` mysql2 serializes outgoing `Date`s as UTC and parses incoming\n * DATETIME text as UTC, so the instant round-trips regardless of the server\n * or process time zone. mysql2's own default (`\"local\"`) would silently\n * shift values by the process offset.\n */\n readonly timezone?: string;\n /** Connection charset/collation (mysql2 default `utf8mb4_general_ci`). */\n readonly charset?: string;\n /**\n * Milliseconds to wait for a pool connection before refusing with a\n * `VibeError` (`VIBE_ADAPTER`, `meta.reason: \"acquire-timeout\"`).\n *\n * **Unset (the default) keeps mysql2's own behaviour**: the pool is created\n * with `waitForConnections: true` and no time bound, so a caller whose\n * connections are all busy QUEUES until one frees. Setting this bounds EVERY\n * pool checkout the adapter makes — the caller gets a coded refusal instead\n * of an unbounded wait.\n *\n * Adapter-owned: mysql2 has no acquire timeout at all (its pool knobs are\n * `waitForConnections` and `queueLimit`, which bounds queue DEPTH, not time),\n * so this value is never passed to `mysql2.createPool`.\n *\n * **Not mysql2's `connectTimeout`**, which is the deadline for establishing a\n * NEW connection rather than for waiting on a busy pool. The equivalent\n * option on `@vibeorm/adapter-pg` is `connectionTimeout`; the name differs\n * here precisely because mysql2 already uses that word for something else.\n */\n readonly acquireTimeout?: number;\n /**\n * Allow multiple statements per `executeUnsafe` call (default false). Leave\n * it off: the ORM never batches, @vibeorm/migrate applies DDL per statement,\n * and enabling it widens the SQL-injection blast radius of raw queries.\n */\n readonly multipleStatements?: boolean;\n /**\n * Pool factory — a test seam. Defaults to `mysql2/promise`'s `createPool`;\n * tests inject a recording fake here to assert the exact config the adapter\n * builds. Ignored when `pool` is given.\n */\n readonly createPool?: (config: MysqlPoolConfig) => MysqlPoolLike;\n};\n\n// ─── Adapter ──────────────────────────────────────────────────────\n\nconst DIALECT: Dialect = \"mysql\";\nconst PROVIDER: Provider = \"mysql\";\n\n/**\n * mysql2 wire (board #30, live-verified on both execute paths, 8.4):\n * datetime(3) → `Date` (under the adapter's pinned `timezone: \"Z\"`), JSON →\n * parsed values, int/double → numbers. (BIGINT arrives as a string and\n * TINYINT(1) as 0/1 — BigInt/Boolean decoding stays.)\n */\nconst WIRE: WireFidelity = Object.freeze({ dateTime: \"native\", json: \"parsed\", numbers: \"native\" } as const);\n\n/**\n * Timing budgets this adapter genuinely enforces (EPIC 6).\n *\n * - `acquireTimeout: true` — {@link MysqlAdapterOptions.acquireTimeout} bounds\n * the checkout wait (mysql2 itself has none; ./acquire.ts explains why).\n * Declared as a capability; it is OFF until the option is set.\n * - `statementTimeout: \"select-only\"` — **MySQL's `MAX_EXECUTION_TIME` bounds\n * SELECT statements only.** INSERT/UPDATE/DELETE/DDL run unbounded, so this\n * is NOT general write cancellation and is not declared as one.\n * - `transactionDeadline: \"between-statements\"` — the budget is honoured before\n * each statement and at the commit. `\"cancel-running-statements\"` is REFUSED:\n * an in-flight write cannot be stopped through this connection, and killing\n * it from a second pooled connection would risk cancelling a session that had\n * already moved on.\n */\nconst BUDGETS: AdapterBudgetSupport = Object.freeze({\n acquireTimeout: true,\n statementTimeout: \"select-only\",\n transactionDeadline: \"between-statements\",\n} as const);\n\nfunction defaultCreatePool(config: MysqlPoolConfig): MysqlPoolLike {\n // Single cast seam: mysql2's Pool satisfies MysqlPoolLike structurally, but\n // its generic overloads don't reduce to our plain signatures.\n return mysql2CreatePool(config as Parameters<typeof mysql2CreatePool>[0]) as unknown as MysqlPoolLike;\n}\n\n/** A failed finalization reply cannot establish whether the transaction committed. */\nfunction finalizationOutcomeUnknown(params: { cause: unknown; stage: \"commit\" | \"raw-close\" }): VibeError {\n return new VibeError({\n code: \"VIBE_TRANSACTION\",\n message: \"MySQL transaction finalization failed; its outcome is unknown. The connection was discarded. Inspect the data before retrying.\",\n meta: { provider: PROVIDER, reason: \"transaction-outcome-unknown\", outcome: \"unknown\", stage: params.stage },\n cause: params.cause,\n });\n}\n\n/** Scalar-array params must never reach this adapter — the dialect expands IN. */\nfunction throwOnArrayParam(values: unknown[]): never {\n throw internalError({\n message:\n \"formatArrayParam called on the mysql adapter — the mysql dialect expands scalar-list parameters into IN (?, ?, …) placeholders, so the runtime should have expanded this array before binding\",\n meta: { length: values.length },\n });\n}\n\n/**\n * Create a VibeORM adapter backed by mysql2.\n *\n * @example\n * ```ts\n * const adapter = mysqlAdapter({ url: process.env.MYSQL_URL, connectionLimit: 20 });\n * await adapter.connect();\n * const rows = await adapter.execute({ text: \"SELECT * FROM `User` WHERE `id` = ?\", values: [1] });\n * ```\n *\n * @example Discrete fields, or reusing a pool you already own\n * ```ts\n * const adapter = mysqlAdapter({ host: \"127.0.0.1\", port: 3306, user: \"app\", password: \"pw\", database: \"app\" });\n * const shared = mysqlAdapter({ pool: existingPool });\n * ```\n *\n * ORM path (`execute`) uses mysql2's binary protocol (`pool.execute`), which\n * prepares statements and caches them per connection keyed by statement text\n * (mysql2's `maxPreparedStatements` LRU, default 16000). Raw path\n * (`executeUnsafe`) uses the text protocol (`pool.query`) when parameterless;\n * nonempty values always use prepared binding, with the same raw-session pin.\n *\n * Parameters arrive PRE-ENCODED by the runtime codec table: Json is already a\n * string, DateTime is a `Date` (mysql2 serializes it per `timezone`), BigInt\n * is a string. The adapter forwards values verbatim — no second conversion.\n */\nexport function mysqlAdapter(options?: MysqlAdapterOptions): DatabaseAdapter {\n let pool: MysqlPoolLike | null = null;\n let ownsPool = false;\n\n /**\n * The pinned connection of an OPEN raw transaction — session affinity for\n * the raw path. A raw `BEGIN` … `COMMIT` sequence over `executeUnsafe` is\n * sound only when every statement in between rides the SAME pooled\n * connection, so a pure `BEGIN` checks one out, raw statements ride it, and\n * the matching `COMMIT`/`ROLLBACK` releases it (same semantics as the pg and\n * bun adapters). The ORM path (`execute`) and `transaction()` stay on the\n * pool. Concurrent raw transactions on one adapter are unsupported.\n */\n let rawSession: MysqlConnectionLike | null = null;\n\n const acquireTimeoutMs = options?.acquireTimeout;\n\n /**\n * Effective pool size for the refusal message. Unknown — and reported as\n * such — when the caller supplied the pool, since `connectionLimit` is\n * ignored in that mode.\n */\n const poolSize: number | undefined =\n options?.pool === undefined ? (options?.connectionLimit ?? MYSQL_DEFAULT_CONNECTION_LIMIT) : undefined;\n\n function getPool(): MysqlPoolLike {\n if (pool !== null) return pool;\n\n if (options?.pool !== undefined) {\n pool = options.pool;\n ownsPool = false;\n return pool;\n }\n\n const config = mysqlPoolConfig({ options });\n pool = (options?.createPool ?? defaultCreatePool)(config);\n ownsPool = true;\n return pool;\n }\n\n /**\n * The ONE place a connection is checked out. Without `acquireTimeout` this is\n * mysql2's own unbounded checkout, byte for byte; with it, the wait is\n * bounded and a caller that cannot be served refuses instead of queueing.\n * `runMapped` maps driver failures — the timeout error is already a\n * `VibeError` and passes through untouched (errors.ts:121).\n */\n async function acquireConnection(): Promise<MysqlConnectionLike> {\n const active = getPool();\n if (acquireTimeoutMs === undefined) {\n return runMapped(() => active.getConnection());\n }\n return runMapped(() => acquireWithTimeout({ pool: active, timeoutMs: acquireTimeoutMs, poolSize }));\n }\n\n async function runExecute(params: {\n queryable: Queryable;\n text: string;\n values: unknown[];\n }): Promise<Record<string, unknown>[]> {\n const [result, fields] = await runMapped(() => params.queryable.execute(params.text, params.values));\n return normalizeDriverResult({ result, fields }).rows;\n }\n\n /**\n * The ORM's affected-row path (F01). Same PREPARED protocol as `execute()` —\n * mysql2 sends the statement and its parameters separately — but keeping the\n * OK-packet's `affectedRows` instead of dropping it.\n *\n * Never `query()`: that is the TEXT protocol, which interpolates values into\n * the SQL client-side. mysql2 cannot know the server's `sql_mode`, so under\n * `NO_BACKSLASH_ESCAPES` its `\\'` is not an escape and a hostile string\n * predicate breaks out of its literal — a `deleteMany` deleted rows a bound\n * read did not match. There is deliberately NO fallback from a failed\n * preparation to interpolation: an unpreparable statement fails loudly.\n *\n * RAW STATEMENTS RIDE THIS PATH TOO, so `bindRowCountParams` first rewrites\n * integers sitting in a `LIMIT` / `OFFSET` position into their decimal text:\n * mysql2's prepared protocol types a JS number in a way the server refuses\n * there (errno 1210), and only user-written raw SQL can produce that shape —\n * the ORM inlines its limits as literal text. Nothing else is touched.\n */\n async function runExecuteAffected(params: {\n queryable: Queryable;\n text: string;\n values: unknown[];\n }): Promise<QueryResult> {\n const values = bindRowCountParams({ text: params.text, values: params.values });\n const [result, fields] = await runMapped(() => params.queryable.execute(params.text, values));\n return normalizeDriverResult({ result, fields });\n }\n\n async function runExecuteUnsafe(params: {\n queryable: Queryable;\n text: string;\n values?: unknown[];\n }): Promise<QueryResult> {\n if (params.values !== undefined && params.values.length > 0) {\n return runExecuteAffected({ ...params, values: params.values });\n }\n const [result, fields] = await runMapped(() => params.queryable.query(params.text, params.values));\n return normalizeDriverResult({ result, fields });\n }\n\n /**\n * Adapter bound to the ONE pinned connection of an open transaction — the\n * same-connection guarantee. Nested `transaction()` calls open savepoints on\n * that connection, and their LIFETIMES are serialized by the savepoint gate\n * (F14): overlapping siblings share one savepoint stack, so the earlier\n * one's rollback would erase the later one's already released work.\n */\n function createConnectionAdapter(params: {\n conn: MysqlConnectionLike;\n scope: SavepointScope;\n budget: TransactionBudget;\n }): DatabaseAdapter {\n const { conn, scope, budget } = params;\n\n function invalidate(error: unknown): never {\n // Driver calls already map errors. A nested callback's own error must\n // retain its identity rather than being relabelled as a driver failure.\n if (!(error instanceof VibeError)) throw error;\n const mapped = error;\n if (mapped.meta.errno === 1213) {\n // InnoDB has rolled back the whole transaction, not just this statement.\n // Keep this terminal for every handle even when the callback catches it.\n scope.state.poisoned = new VibeError({\n code: mapped.code, message: mapped.message,\n meta: { ...mapped.meta, outcome: \"rolled-back\" }, cause: mapped,\n });\n }\n if (isSavepointRollbackFailedError(mapped)) budget.close({ outcome: \"unknown\" });\n throw mapped;\n }\n\n return {\n dialect: DIALECT,\n provider: PROVIDER,\n wire: WIRE,\n budgets: BUDGETS,\n\n async execute(execParams) {\n const turn = scopeTurn({ scope });\n if (turn !== undefined) await turn;\n // After the turn, not before: waiting for a sibling savepoint spends\n // the same budget the statement is about to run against.\n budget.assertUsable({ stage: \"statement\" });\n return runExecute({ queryable: conn, ...execParams }).catch(invalidate);\n },\n\n async executeRawBound(execParams) {\n return this.executeUnsafe(execParams);\n },\n\n async executeUnsafe(execParams) {\n const turn = scopeTurn({ scope });\n if (turn !== undefined) await turn;\n budget.assertUsable({ stage: \"statement\" });\n return runExecuteUnsafe({ queryable: conn, ...execParams }).catch(invalidate);\n },\n\n async executeAffected(execParams) {\n const turn = scopeTurn({ scope });\n if (turn !== undefined) await turn;\n budget.assertUsable({ stage: \"statement\" });\n return runExecuteAffected({ queryable: conn, ...execParams }).catch(invalidate);\n },\n\n async transaction<T>(\n fn: (txAdapter: DatabaseAdapter) => Promise<T>,\n nestedOptions?: TransactionOptions,\n ): Promise<T> {\n refuseNestedTransactionOptions({ options: nestedOptions, provider: PROVIDER });\n budget.assertUsable({ stage: \"nested\" });\n return runNestedSavepoint({\n scope,\n execute: (statement) => runMapped(() => conn.query(statement)).catch(invalidate),\n // The child shares the ROOT budget by reference: a savepoint never\n // gets an independent clock or session setting.\n body: (child) => fn(createConnectionAdapter({ conn, scope: child, budget })),\n }).catch(invalidate);\n },\n\n async connect(): Promise<void> {\n // Already connected — this adapter is bound to a pinned connection.\n },\n\n async disconnect(): Promise<void> {\n // The pool owns the connection lifecycle; releasing happens at the\n // top-level transaction boundary.\n },\n\n formatArrayParam(values: unknown[]): unknown {\n return throwOnArrayParam(values);\n },\n };\n }\n\n return {\n dialect: DIALECT,\n provider: PROVIDER,\n wire: WIRE,\n budgets: BUDGETS,\n\n async withSession({ run }) {\n const conn = await acquireConnection();\n return runPinnedSession({\n run,\n execute: async (query) => (await runExecuteUnsafe({ queryable: conn, ...query })).rows,\n isLost: (error) => error instanceof VibeError && (\n typeof error.meta.errno !== \"number\" || [2006, 2013, 2055, 4031].includes(error.meta.errno)\n ),\n // Discard session settings and any open transaction, even on success.\n release: async () => { conn.destroy(); },\n });\n },\n\n async execute(params) {\n // Default path: mysql2's `pool.execute` does its own implicit checkout.\n // With `acquireTimeout` set that checkout has to be visible to be\n // bounded, so the statement is routed over an explicit connection\n // instead (mysql2 caches prepared statements per connection either way).\n if (acquireTimeoutMs === undefined) {\n return runExecute({ queryable: getPool(), ...params });\n }\n const conn = await acquireConnection();\n try {\n return await runExecute({ queryable: conn, ...params });\n } finally {\n conn.release();\n }\n },\n\n async executeAffected(params) {\n // Same checkout rules as `execute()` above: implicit with mysql2's own\n // pool, explicit (and therefore boundable) when `acquireTimeout` is set.\n if (acquireTimeoutMs === undefined) {\n return runExecuteAffected({ queryable: getPool(), ...params });\n }\n const conn = await acquireConnection();\n try {\n return await runExecuteAffected({ queryable: conn, ...params });\n } finally {\n conn.release();\n }\n },\n\n async executeRawBound(params) {\n return this.executeUnsafe(params);\n },\n\n async executeUnsafe(params) {\n const control = classifyRawTransactionControl({ text: params.text });\n if (rawSession !== null) {\n if (control === \"close\") {\n const session = rawSession;\n rawSession = null;\n try {\n const result = await runExecuteUnsafe({ queryable: session, ...params });\n session.release();\n return result;\n } catch (cause) {\n session.destroy();\n throw finalizationOutcomeUnknown({ cause, stage: \"raw-close\" });\n }\n }\n return runExecuteUnsafe({ queryable: rawSession, ...params });\n }\n if (control === \"open\") {\n const conn = await acquireConnection();\n try {\n const result = await runExecuteUnsafe({ queryable: conn, ...params });\n rawSession = conn;\n return result;\n } catch (error) {\n conn.release();\n throw error;\n }\n }\n // Default path: mysql2's `pool.query` checks a connection out\n // implicitly. Same reroute as `execute()` above, for the same reason —\n // a checkout has to be visible to be bounded, so with `acquireTimeout`\n // set the raw statement runs on an explicit connection too.\n if (acquireTimeoutMs === undefined) {\n return runExecuteUnsafe({ queryable: getPool(), ...params });\n }\n const conn = await acquireConnection();\n try {\n return await runExecuteUnsafe({ queryable: conn, ...params });\n } finally {\n conn.release();\n }\n },\n\n async transaction<T>(\n fn: (txAdapter: DatabaseAdapter) => Promise<T>,\n transactionOptions?: TransactionOptions,\n ): Promise<T> {\n // Validate the timeout before taking a connection, so a bad option fails\n // fast instead of wasting a checkout.\n const timeoutText =\n transactionOptions?.timeout === undefined\n ? undefined\n : maxExecutionTimeStatement({ timeout: transactionOptions.timeout });\n // Same rule for the deadline: an unsupportable budget is refused before a\n // connection is taken, so it never costs a checkout.\n validateTransactionDeadline({\n options: transactionOptions,\n support: BUDGETS.transactionDeadline,\n provider: PROVIDER,\n });\n\n const conn = await acquireConnection();\n /** Set when the session state can no longer be asserted (see below). */\n let rollbackFailed = false;\n // The deadline clock starts with the connection already in hand:\n // acquisition has its own budget (`acquireTimeout`) and is not charged here.\n const budget = startTransactionBudget({ options: transactionOptions, provider: PROVIDER });\n try {\n // Session-scoped SELECT bound — see transaction-sql.ts for the loud\n // \"SELECT statements only\" caveat. Reset in finally below.\n if (timeoutText !== undefined) {\n await runMapped(() => conn.query(timeoutText));\n }\n // Applies to the NEXT transaction in the session → must precede begin.\n const isolationLevel = transactionOptions?.isolationLevel;\n if (isolationLevel !== undefined) {\n const isolationText = setIsolationLevelStatement({ isolationLevel });\n await runMapped(() => conn.query(isolationText));\n }\n await runMapped(() => conn.beginTransaction());\n const scope = createSavepointScope();\n try {\n const result = await runRootScope({\n scope,\n body: () => fn(createConnectionAdapter({ conn, scope, budget })),\n });\n // The callback may have caught a driver error that invalidated the\n // whole transaction. Check the shared scope as well as the deadline.\n const turn = scopeTurn({ scope });\n if (turn !== undefined) await turn;\n budget.assertUsable({ stage: \"commit\" });\n await runMapped(() => conn.commit()).catch((cause: unknown) => {\n // A later successful ROLLBACK does not disprove a committed write\n // whose acknowledgement was lost. Close unknown before cleanup.\n budget.close({ outcome: \"unknown\" });\n rollbackFailed = true;\n throw finalizationOutcomeUnknown({ cause, stage: \"commit\" });\n });\n budget.close({ outcome: \"committed\" });\n return result;\n } catch (error) {\n if (isSavepointRollbackFailedError(error) || budget.outcome === \"unknown\") {\n budget.close({ outcome: \"unknown\" });\n rollbackFailed = true;\n }\n // Best effort: never mask the original failure with a rollback failure.\n try {\n await conn.rollback();\n budget.close({ outcome: \"rolled-back\" });\n } catch {\n // The rollback that should have cleaned up failed: the commit state\n // is genuinely unknown and the connection is destroyed below rather\n // than pooled while it may still be inside a transaction.\n rollbackFailed = true;\n budget.close({ outcome: \"unknown\" });\n if (budget.totalMs !== null && isTransactionDeadlineError(error)) {\n throw transactionOutcomeUnknownError({\n provider: PROVIDER,\n totalMs: budget.totalMs,\n cause: error,\n });\n }\n }\n throw error;\n }\n } finally {\n let poisoned = rollbackFailed;\n if (timeoutText !== undefined && !poisoned) {\n try {\n await conn.query(RESET_MAX_EXECUTION_TIME_SQL);\n } catch {\n poisoned = true;\n }\n }\n // A connection whose session default could not be restored — or whose\n // rollback failed, so it may still be inside a transaction — must never\n // return to the pool.\n if (poisoned) {\n conn.destroy();\n } else {\n conn.release();\n }\n }\n },\n\n async connect(): Promise<void> {\n const conn = await acquireConnection();\n try {\n await runMapped(() => conn.ping());\n } finally {\n conn.release();\n }\n },\n\n async disconnect(): Promise<void> {\n if (rawSession !== null) {\n // An abandoned raw transaction must not leak an in-transaction\n // connection; roll it back best-effort before the pool ends.\n const session = rawSession;\n rawSession = null;\n try {\n await session.query(\"ROLLBACK\");\n } catch {\n /* the pool is closing; the session is going away regardless */\n }\n session.release();\n }\n if (pool !== null && ownsPool) {\n const closing = pool;\n pool = null;\n await runMapped(() => closing.end());\n }\n },\n\n formatArrayParam(values: unknown[]): unknown {\n return throwOnArrayParam(values);\n },\n };\n}\n\n// ─── Re-exports (driver-error table, helpers) ─────────────────────\n\nexport {\n DEFAULT_ACQUIRE_TIMERS,\n MYSQL_DEFAULT_CONNECTION_LIMIT,\n acquireTimeoutError,\n acquireWithTimeout,\n} from \"./acquire.ts\";\nexport type { AcquireSource, AcquireTimers, ReleasableConnection, TimerHandle } from \"./acquire.ts\";\nexport {\n MYSQL_ERRNO_ERROR_CODES,\n MYSQL_ERRNO_REASONS,\n mapMysqlDriverError,\n mysqlErrorErrno,\n runMapped,\n} from \"./errors.ts\";\nexport { isResultSetHeader, normalizeDriverResult } from \"./results.ts\";\nexport { createSavepointCounter, nextSavepointName } from \"@vibeorm/runtime/adapter-kit\";\nexport type { SavepointCounter } from \"@vibeorm/runtime/adapter-kit\";\nexport {\n ISOLATION_LEVEL_SQL,\n RESET_MAX_EXECUTION_TIME_SQL,\n classifyRawTransactionControl,\n maxExecutionTimeStatement,\n refuseNestedTransactionOptions,\n setIsolationLevelStatement,\n} from \"./transaction-sql.ts\";\nexport type { RawTransactionControl } from \"./transaction-sql.ts\";\n// ─── EPIC 6: transaction budgets (shared, @vibeorm/runtime/adapter-kit) ───\nexport {\n DEFAULT_DEADLINE_CLOCK,\n engineStatementBudgetMs,\n isTransactionDeadlineError,\n startTransactionBudget,\n transactionClosedError,\n transactionDeadlineError,\n transactionOutcomeUnknownError,\n validateTransactionDeadline,\n} from \"@vibeorm/runtime/adapter-kit\";\nexport type { BudgetStage, DeadlineClock, TransactionBudget, TransactionOutcome } from \"@vibeorm/runtime/adapter-kit\";\n",
6
6
  "/**\n * Bounded pool acquisition — the adapter's own acquire timeout.\n *\n * mysql2 has NO acquire timeout of its own (verified against mysql2 3.23.3:\n * neither `acquireTimeout` nor `acquire_timeout` exists anywhere in its\n * sources). Its pool backpressure knobs are `waitForConnections`\n * (`node_modules/mysql2/lib/pool_config.js:11-14`, default `true`) and\n * `queueLimit` (`:24-26`, default `0` = unlimited), which bounds queue DEPTH,\n * not TIME; `connectTimeout` is the TCP deadline for establishing a NEW\n * connection, not for waiting on a busy pool. So an exhausted pool queues the\n * caller forever unless something above the driver bounds the wait — which is\n * what this module does.\n *\n * The trap this module exists to get right: when the deadline wins the race,\n * the driver's `getConnection()` promise is STILL PENDING and will later hand\n * back a real connection nobody holds. Dropping it would turn \"waits too long\"\n * into \"the pool is dead forever\", so the losing promise is always released.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\n\n// ─── Seams ────────────────────────────────────────────────────────\n\n/** Timer handle, as the ambient `setTimeout` returns it. */\nexport type TimerHandle = ReturnType<typeof setTimeout>;\n\n/**\n * Timer seam — a test injects a counting pair to prove the deadline timer is\n * cleared exactly once, rather than asserting on wall-clock luck.\n */\nexport type AcquireTimers = {\n readonly set: (fn: () => void, ms: number) => TimerHandle;\n readonly clear: (handle: TimerHandle) => void;\n};\n\n/** The ambient timers, used whenever no seam is injected. */\nexport const DEFAULT_ACQUIRE_TIMERS: AcquireTimers = Object.freeze({\n set: (fn: () => void, ms: number): TimerHandle => setTimeout(fn, ms),\n clear: (handle: TimerHandle): void => clearTimeout(handle),\n});\n\n/** The one connection capability the late-release path needs. */\nexport type ReleasableConnection = {\n release(): void;\n};\n\n/** The one pool capability bounded acquisition needs. */\nexport type AcquireSource<TConnection extends ReleasableConnection> = {\n getConnection(): Promise<TConnection>;\n};\n\n// ─── Error ────────────────────────────────────────────────────────\n\n/** mysql2's own pool default when `connectionLimit` is unset (`lib/pool_config.js:15-17`). */\nexport const MYSQL_DEFAULT_CONNECTION_LIMIT: number = 10;\n\n/**\n * The refusal a bounded acquisition raises. `VIBE_ADAPTER` for parity with\n * `@vibeorm/adapter-pg`, whose `connectionTimeout` surfaces the same way, and\n * `meta.reason: \"acquire-timeout\"` so a caller can tell an exhausted pool from\n * any other adapter failure without reading message text.\n */\nexport function acquireTimeoutError(params: { timeoutMs: number; poolSize?: number }): VibeError {\n const { timeoutMs, poolSize } = params;\n const size =\n poolSize === undefined\n ? \"pool size unknown — the pool was supplied by the caller\"\n : `connectionLimit ${poolSize}`;\n return new VibeError({\n code: \"VIBE_ADAPTER\",\n message:\n `timed out after ${timeoutMs} ms waiting for a mysql pool connection — every pooled connection ` +\n `is busy (${size}). Raise \\`connectionLimit\\`, shorten the work holding a connection, or raise ` +\n \"the adapter's `acquireTimeout` option.\",\n meta: {\n reason: \"acquire-timeout\",\n timeoutMs,\n ...(poolSize === undefined ? {} : { connectionLimit: poolSize }),\n },\n });\n}\n\n// ─── Bounded acquisition ──────────────────────────────────────────\n\n/**\n * Check a connection out of `pool`, refusing with {@link acquireTimeoutError}\n * when it takes longer than `timeoutMs`.\n *\n * Two invariants make this safe:\n *\n * 1. **The lost acquire is released.** When the deadline wins, the pending\n * `getConnection()` is not abandoned: a handler released it as soon as it\n * lands, so a `connectionLimit: 1` pool keeps working after a timeout\n * instead of being permanently starved of its only connection.\n * 2. **The deadline timer never outlives the call.** It is cleared in a\n * `finally`, so a successful acquire leaves nothing pending that could keep\n * the event loop (or a test runner) alive.\n */\nexport async function acquireWithTimeout<TConnection extends ReleasableConnection>(params: {\n pool: AcquireSource<TConnection>;\n timeoutMs: number;\n /** Effective pool size, named in the refusal; omit when the pool is the caller's. */\n poolSize?: number;\n timers?: AcquireTimers;\n}): Promise<TConnection> {\n const { pool, timeoutMs, poolSize } = params;\n const timers = params.timers ?? DEFAULT_ACQUIRE_TIMERS;\n\n const pending = pool.getConnection();\n let timedOut = false;\n let handle: TimerHandle | undefined;\n\n const deadline = new Promise<never>((_resolve, reject) => {\n handle = timers.set(() => {\n timedOut = true;\n reject(acquireTimeoutError({ timeoutMs, poolSize }));\n }, timeoutMs);\n });\n\n // Trap: the loser of the race still settles. A connection that arrives after\n // the refusal belongs to nobody, so it goes straight back to the pool; a\n // rejection is already the race's business and is swallowed here so it can\n // never surface as an unhandled rejection.\n void pending\n .then(\n (connection) => {\n if (timedOut) connection.release();\n },\n () => undefined,\n )\n .catch(() => undefined);\n\n try {\n return await Promise.race([pending, deadline]);\n } finally {\n if (handle !== undefined) timers.clear(handle);\n }\n}\n",
7
+ "import * as mysql2 from \"mysql2\";\nimport { VibeError } from \"@vibeorm/schema\";\nimport type { MysqlAdapterOptions, MysqlPoolConfig } from \"./index.ts\";\n\n/** mysql2's runtime export has static methods but its declarations only expose an interface. */\nconst connectionConfig: { parseUrl(url: string): Record<string, unknown> } =\n (mysql2 as unknown as { ConnectionConfig: { parseUrl(url: string): Record<string, unknown> } }).ConnectionConfig;\n\n/** The mysql2 typeCast surface used for JSON; other scalars keep the driver decoder. */\nexport type MysqlTypeCast = (field: {\n readonly type: string;\n readonly extendedFormat?: string;\n string(encoding?: string): string | null;\n}, next: () => unknown) => unknown;\n\n/** Retain JSON.parse number semantics independently of mysql2's BIGINT configuration. */\nconst typeCast: MysqlTypeCast = (field, next): unknown => {\n if (field.type !== \"JSON\" && field.extendedFormat !== \"json\") return next();\n const text = field.string(\"utf8\");\n return text === null ? null : JSON.parse(text);\n};\n\n/** Parse once, overlay explicit options, then pin the wire and statement contracts. */\nexport function mysqlPoolConfig(params: { options?: MysqlAdapterOptions }): MysqlPoolConfig {\n const options = params.options;\n const url = options?.url ?? process.env.MYSQL_URL;\n let parsed: Record<string, unknown>;\n try {\n parsed = url === undefined ? {} : connectionConfig.parseUrl(url);\n } catch (cause) {\n throw new VibeError({ code: \"VIBE_CONFIG\", message: \"Invalid MySQL connection URL\", cause });\n }\n // Never let a URL query parameter re-enter mysql2's falsy-value URI merge.\n delete parsed.uri;\n const explicit = {\n host: options?.host, port: options?.port, user: options?.user,\n password: options?.password, database: options?.database,\n connectionLimit: options?.connectionLimit, charset: options?.charset,\n };\n for (const [key, value] of Object.entries(explicit)) {\n if (value !== undefined) parsed[key] = value;\n }\n if (options?.password !== undefined) delete parsed.password1;\n // Preserve transport flags, but the driver may not disable matched-row counts\n // or enable multi-statements behind the explicit adapter opt-in.\n const flags = (Array.isArray(parsed.flags) ? parsed.flags : String(parsed.flags ?? \"\").split(/\\s*,+\\s*/))\n .map((flag: unknown) => String(flag).toUpperCase())\n .filter((flag: string) => ![\"-FOUND_ROWS\", \"MULTI_STATEMENTS\", \"-MULTI_STATEMENTS\"].includes(flag));\n return {\n ...parsed,\n timezone: options?.timezone ?? \"Z\",\n decimalNumbers: false,\n supportBigNumbers: true,\n bigNumberStrings: true,\n dateStrings: false,\n jsonStrings: false,\n namedPlaceholders: false,\n rowsAsArray: false,\n nestTables: undefined,\n typeCast,\n flags,\n multipleStatements: options?.multipleStatements ?? false,\n };\n}\n",
7
8
  "/**\n * Driver-error mapping for mysql2.\n *\n * Constitution rule 5: a raw driver error never escapes an adapter. Every\n * failure becomes a `VibeError` with a stable code, the driver error attached\n * as `cause`, and the MySQL errno / symbolic code / SQLSTATE / server message\n * in `meta`.\n *\n * mysql2 errors carry `errno` (the numeric MySQL server error, e.g. 1062),\n * `code` (the symbolic name, `ER_DUP_ENTRY`, or a client-side string like\n * `ECONNREFUSED` / `PROTOCOL_CONNECTION_LOST`), `sqlState` and `sqlMessage`.\n * The table is keyed by `errno` because it is the stable server-side identity;\n * client-side failures have no errno and fall through to `VIBE_ADAPTER`.\n */\n\nimport { VibeError, type VibeErrorCode } from \"@vibeorm/schema\";\n\n// ─── Errno table ──────────────────────────────────────────────────\n\n/**\n * MySQL server errno → stable VibeError code. Frozen and mirrored by tests;\n * anything absent from this table maps to `VIBE_ADAPTER` — including access\n * failures (1044 `ER_DBACCESS_DENIED_ERROR`, 1045 `ER_ACCESS_DENIED_ERROR`)\n * and every client-side connection error (`ECONNREFUSED`,\n * `PROTOCOL_CONNECTION_LOST`, `ETIMEDOUT`), which carry no errno at all.\n */\nexport const MYSQL_ERRNO_ERROR_CODES: Readonly<Record<number, VibeErrorCode>> = Object.freeze({\n /** ER_DUP_ENTRY */\n 1062: \"VIBE_UNIQUE_VIOLATION\",\n /** ER_DUP_ENTRY_WITH_KEY_NAME */\n 1586: \"VIBE_UNIQUE_VIOLATION\",\n /** ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO */\n 1761: \"VIBE_UNIQUE_VIOLATION\",\n /** ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO */\n 1762: \"VIBE_UNIQUE_VIOLATION\",\n /** ER_NO_REFERENCED_ROW */\n 1216: \"VIBE_FK_VIOLATION\",\n /** ER_ROW_IS_REFERENCED */\n 1217: \"VIBE_FK_VIOLATION\",\n /** ER_ROW_IS_REFERENCED_2 */\n 1451: \"VIBE_FK_VIOLATION\",\n /** ER_NO_REFERENCED_ROW_2 */\n 1452: \"VIBE_FK_VIOLATION\",\n /** ER_BAD_NULL_ERROR — NOT NULL column set to NULL */\n 1048: \"VIBE_VALIDATION\",\n /** ER_WARN_DATA_OUT_OF_RANGE — value out of column range */\n 1264: \"VIBE_VALIDATION\",\n /** ER_NO_DEFAULT_FOR_FIELD — column without default omitted */\n 1364: \"VIBE_VALIDATION\",\n /** ER_DATA_TOO_LONG */\n 1406: \"VIBE_VALIDATION\",\n /**\n * WARN_DATA_TRUNCATED — despite the WARN_ name, strict mode raises it as a\n * hard error: an out-of-range ENUM value or a truncated numeric string\n * (live-verified on 8.4: `role = \"SUPERUSER\"` and `n = \"12abc\"` → 1265).\n * The same bad input is a CHECK violation on sqlite and SQLSTATE 22P02 on\n * postgres — all VIBE_VALIDATION (board #9).\n */\n 1265: \"VIBE_VALIDATION\",\n /**\n * ER_TRUNCATED_WRONG_VALUE_FOR_FIELD — a wrong-TYPED value for the column\n * (live-verified on 8.4: `\"abc\"` into INT, `\"12.x9\"` into DECIMAL → 1366).\n */\n 1366: \"VIBE_VALIDATION\",\n /**\n * ER_TRUNCATED_WRONG_VALUE — an unparseable literal, e.g. a bad datetime\n * (live-verified on 8.4: `\"not-a-date\"` into DATETIME(3) → 1292,\n * SQLSTATE 22007).\n */\n 1292: \"VIBE_VALIDATION\",\n /** ER_CHECK_CONSTRAINT_VIOLATED */\n 3819: \"VIBE_VALIDATION\",\n /** ER_LOCK_DEADLOCK */\n 1213: \"VIBE_TRANSACTION\",\n /**\n * ER_LOCK_WAIT_TIMEOUT — `innodb_lock_wait_timeout` expired while waiting for\n * a row lock. This is MySQL's spelling of PostgreSQL's `lock_timeout` case,\n * which is SQLSTATE 55P03 there, so it carries the same VibeORM code: a\n * caller asking \"was the row locked?\" must branch identically on both\n * engines. (Before EPIC 5 it was VIBE_TRANSACTION with reason \"timeout\",\n * which read the same as a STATEMENT timeout — a different failure.)\n */\n 1205: \"VIBE_LOCK_NOT_AVAILABLE\",\n /**\n * ER_LOCK_NOWAIT — \"Statement aborted because lock(s) could not be acquired\n * immediately and NOWAIT is set\" (verified on mysql 26.7.0, SQLSTATE HY000).\n */\n 3572: \"VIBE_LOCK_NOT_AVAILABLE\",\n /** ER_QUERY_TIMEOUT — max_execution_time exceeded, statement interrupted */\n 3024: \"VIBE_TRANSACTION\",\n});\n\n/** Errnos that additionally explain themselves through `meta.reason`. */\nexport const MYSQL_ERRNO_REASONS: Readonly<Record<number, string>> = Object.freeze({\n /** ER_LOCK_DEADLOCK */\n 1213: \"deadlock\",\n /** ER_LOCK_WAIT_TIMEOUT — the wait for a row lock ran out. */\n 1205: \"lock-not-available\",\n /** ER_LOCK_NOWAIT — the row was locked and the caller asked not to wait. */\n 3572: \"lock-not-available\",\n /** ER_QUERY_TIMEOUT */\n 3024: \"timeout\",\n});\n\n// ─── Reading driver errors ────────────────────────────────────────\n\nfunction readStringField(params: { source: Record<string, unknown>; key: string }): string | undefined {\n const value = params.source[params.key];\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n\n/**\n * Extract the numeric MySQL errno from a mysql2 error. Client-side failures\n * (`ECONNREFUSED`, `PROTOCOL_CONNECTION_LOST`, …) have no numeric errno and\n * yield `undefined`.\n */\nexport function mysqlErrorErrno(params: { error: unknown }): number | undefined {\n const { error } = params;\n if (error === null || typeof error !== \"object\") return undefined;\n const errno = (error as Record<string, unknown>).errno;\n return typeof errno === \"number\" && Number.isInteger(errno) ? errno : undefined;\n}\n\n// ─── Mapping ──────────────────────────────────────────────────────\n\n/**\n * Map any error thrown by mysql2 onto a `VibeError`.\n *\n * A `VibeError` passes through unchanged, so an error raised deeper inside the\n * ORM (or by a nested adapter call) is never re-wrapped, and a user callback's\n * error is rethrown identically.\n */\nexport function mapMysqlDriverError(params: { error: unknown }): VibeError {\n const { error } = params;\n if (error instanceof VibeError) return error;\n\n const source: Record<string, unknown> =\n error !== null && typeof error === \"object\" ? (error as Record<string, unknown>) : {};\n const errno = mysqlErrorErrno({ error });\n const code: VibeErrorCode =\n (errno === undefined ? undefined : MYSQL_ERRNO_ERROR_CODES[errno]) ?? \"VIBE_ADAPTER\";\n\n const meta: Record<string, unknown> = {};\n if (errno !== undefined) meta.errno = errno;\n const symbolicCode = readStringField({ source, key: \"code\" });\n if (symbolicCode !== undefined) meta.code = symbolicCode;\n const sqlState = readStringField({ source, key: \"sqlState\" });\n if (sqlState !== undefined) meta.sqlState = sqlState;\n const sqlMessage = readStringField({ source, key: \"sqlMessage\" });\n if (sqlMessage !== undefined) meta.sqlMessage = sqlMessage.trim();\n const reason = errno === undefined ? undefined : MYSQL_ERRNO_REASONS[errno];\n if (reason !== undefined) meta.reason = reason;\n\n const message =\n readStringField({ source, key: \"message\" }) ??\n (sqlMessage !== undefined ? sqlMessage.trim() : undefined) ??\n (typeof error === \"string\" ? error : \"unknown mysql driver error\");\n\n return new VibeError({ code, message, meta, cause: error });\n}\n\n/** Run a driver call, mapping anything it throws onto a `VibeError`. */\nexport async function runMapped<T>(fn: () => Promise<T>): Promise<T> {\n try {\n return await fn();\n } catch (error) {\n throw mapMysqlDriverError({ error });\n }\n}\n",
8
9
  "/**\n * Raw-path `?` placeholder analysis for mysql2's PREPARED protocol.\n *\n * WHY THIS EXISTS. F01 moved raw calls that carry parameters off mysql2's text\n * protocol (which interpolates values client-side and cannot know the server's\n * `sql_mode`) onto its prepared protocol. The prepared protocol types a JS\n * **number** in a way the server refuses in a ROW-COUNT position:\n *\n * execute(\"SELECT 1 LIMIT ?\", [2]) → errno 1210 ER_WRONG_ARGUMENTS\n * execute(\"SELECT 1 LIMIT ?\", [\"2\"]) → OK\n * execute(\"SELECT ? AS a\", [2]) → OK\n *\n * so the ONE narrow repair is: bind a row-count placeholder's integer as its\n * decimal TEXT, and leave every other binding byte-for-byte as it was.\n * Stringifying an integer at a `LIMIT`/`OFFSET` position is lossless — MySQL\n * parses it back to the same unsigned integer — while stringifying anywhere\n * else would change the wire type of ordinary comparisons.\n *\n * The ORM never emits `LIMIT ?` (the renderer inlines its limits as literal\n * text), so this only ever fires for user-written `$queryRaw` /\n * `$queryRawUnsafe` / `$executeRaw*`.\n *\n * SCANNING IS CONSERVATIVE. Finding row-count placeholders means finding the\n * REAL `?` tokens first, so the scanner skips string literals, backtick-quoted\n * identifiers and all three MySQL comment forms. Two self-checks keep a\n * mis-scan from ever mis-binding: the placeholder count must match the\n * parameter count, and only placeholders in a row-count position are touched.\n * When either check fails the values pass through EXACTLY as they do today.\n *\n * Known scanner limits, all of which fail into that pass-through:\n * - `NO_BACKSLASH_ESCAPES`: a backslash is treated as an escape here, so under\n * that mode a literal ending in `\\` can be mis-measured. The count check then\n * disagrees and nothing is transformed.\n * - `/*! … *\\/` executable comments are skipped like ordinary comments, so a\n * placeholder inside one is not counted — again a count mismatch.\n */\n\nimport { VibeError } from \"@vibeorm/schema\";\n\n/** Where the real `?` placeholders are, and which of them are row counts. */\nexport type ScannedPlaceholders = {\n /** How many real placeholders the statement has. */\n readonly count: number;\n /** 0-based ordinals of the placeholders governed by `LIMIT` / `OFFSET`. */\n readonly rowCountPositions: ReadonlySet<number>;\n};\n\n/** Cheap pre-filter: no row-count clause is possible without one of these words. */\nconst ROW_COUNT_HINT = /\\b(?:limit|offset)\\b/i;\n\nfunction isIdentChar(char: string | undefined): boolean {\n return char !== undefined && /[A-Za-z0-9_$]/.test(char);\n}\n\n/**\n * Index just past a quoted run starting at `start` — `'…'`, `\"…\"` or\n * `` `…` ``. A doubled quote continues the run (MySQL's own escape) and a\n * backslash escapes the next character (MySQL's default mode).\n */\nfunction skipQuoted(text: string, start: number, quote: string): number {\n let index = start + 1;\n while (index < text.length) {\n const char = text[index];\n if (char === \"\\\\\") {\n index += 2;\n continue;\n }\n if (char === quote) {\n if (text[index + 1] === quote) {\n index += 2;\n continue;\n }\n return index + 1;\n }\n index += 1;\n }\n return text.length; // unterminated — the driver reports it, not this scanner\n}\n\n/** Index just past a line comment (`-- ` or `#`). */\nfunction skipLineComment(text: string, start: number): number {\n const newline = text.indexOf(\"\\n\", start);\n return newline === -1 ? text.length : newline + 1;\n}\n\n/** Index just past a block comment. MySQL does not nest them. */\nfunction skipBlockComment(text: string, start: number): number {\n const close = text.indexOf(\"*/\", start + 2);\n return close === -1 ? text.length : close + 2;\n}\n\n/**\n * Scan a statement for its real `?` placeholders, marking the ones a `LIMIT` or\n * `OFFSET` keyword governs.\n *\n * The row-count context opens on the word `LIMIT` or `OFFSET` and survives only\n * whitespace, comments, commas, integer literals and further placeholders —\n * exactly the tokens MySQL's `LIMIT {[offset,] count | count OFFSET offset}`\n * grammar allows. Any other word or symbol closes it, so `?` anywhere else is\n * left alone.\n */\nexport function scanPlaceholders(params: { text: string }): ScannedPlaceholders {\n const { text } = params;\n const rowCountPositions = new Set<number>();\n let count = 0;\n let inRowCount = false;\n let index = 0;\n\n while (index < text.length) {\n const char = text[index] as string;\n\n if (char === \"'\" || char === '\"' || char === \"`\") {\n index = skipQuoted(text, index, char);\n inRowCount = false;\n continue;\n }\n // `--` is a comment only when whitespace follows it (MySQL, unlike others).\n if (char === \"-\" && text[index + 1] === \"-\" && (text[index + 2] === undefined || /\\s/.test(text[index + 2] as string))) {\n index = skipLineComment(text, index);\n continue;\n }\n if (char === \"#\") {\n index = skipLineComment(text, index);\n continue;\n }\n if (char === \"/\" && text[index + 1] === \"*\") {\n index = skipBlockComment(text, index);\n continue;\n }\n if (char === \"?\") {\n if (inRowCount) rowCountPositions.add(count);\n count += 1;\n index += 1;\n continue;\n }\n // Whitespace and commas carry the context across `LIMIT ?, ?`.\n if (/\\s/.test(char) || char === \",\") {\n index += 1;\n continue;\n }\n // An integer literal is a legal row count — the context survives it.\n if (/[0-9]/.test(char)) {\n while (index < text.length && /[0-9]/.test(text[index] as string)) index += 1;\n continue;\n }\n if (/[A-Za-z_$]/.test(char)) {\n const start = index;\n while (isIdentChar(text[index])) index += 1;\n const word = text.slice(start, index).toUpperCase();\n inRowCount = word === \"LIMIT\" || word === \"OFFSET\";\n continue;\n }\n inRowCount = false;\n index += 1;\n }\n\n return { count, rowCountPositions };\n}\n\n/**\n * A row count as mysql2's prepared protocol will accept it: the integer's\n * decimal text.\n *\n * A number that is not a non-negative safe integer is REFUSED with a typed\n * error rather than rounded or guessed — `LIMIT 1.5` has no meaning, and a\n * value past `Number.MAX_SAFE_INTEGER` has already lost digits before this\n * function can see it. A `bigint` of any size converts losslessly, so it is\n * accepted whenever it is non-negative. Every other type (strings, `null`,\n * `undefined`) passes through untouched: mysql2 already sends those verbatim,\n * and MySQL's own error names anything it dislikes.\n */\nfunction toRowCount(params: { value: unknown; ordinal: number; text: string }): unknown {\n const { value, ordinal, text } = params;\n const refuse = (reason: string): never => {\n throw new VibeError({\n code: \"VIBE_VALIDATION\",\n message:\n `parameter $${ordinal} sits in a LIMIT/OFFSET position and ${reason} — ` +\n \"a row count must be a non-negative integer\",\n meta: { placeholder: ordinal, value: String(value), text },\n });\n };\n if (typeof value === \"number\") {\n if (!Number.isSafeInteger(value)) return refuse(\"is not a safe integer\");\n if (value < 0) return refuse(\"is negative\");\n return String(value);\n }\n if (typeof value === \"bigint\") {\n if (value < 0n) return refuse(\"is negative\");\n return value.toString();\n }\n return value;\n}\n\n/**\n * The parameter list to hand mysql2's prepared protocol: identical to the one\n * passed in, except that integers in a `LIMIT` / `OFFSET` position become their\n * decimal text.\n *\n * Returns the SAME array when nothing needs changing, so the ORM's own\n * affected-row path — which never emits a row-count placeholder — pays only a\n * word test.\n */\nexport function bindRowCountParams(params: { text: string; values: unknown[] }): unknown[] {\n const { text, values } = params;\n if (values.length === 0) return values;\n if (!values.some((value) => typeof value === \"number\" || typeof value === \"bigint\")) return values;\n if (!ROW_COUNT_HINT.test(text)) return values;\n\n const scanned = scanPlaceholders({ text });\n // Self-check: an unparsed shape must never shift a binding.\n if (scanned.rowCountPositions.size === 0 || scanned.count !== values.length) return values;\n\n return values.map((value, index) =>\n scanned.rowCountPositions.has(index) ? toRowCount({ value, ordinal: index + 1, text }) : value,\n );\n}\n",
9
- "/**\n * Result normalization for mysql2.\n *\n * mysql2 resolves `execute()` / `query()` with a `[result, fields]` tuple where\n * `result` is one of:\n * - `RowDataPacket[]` — a SELECT's rows (plain objects; `rowsAsArray` is off);\n * - `ResultSetHeader` — an INSERT / UPDATE / DELETE / DDL OK-packet carrying\n * `affectedRows` and `insertId`;\n * - an array of the above — only when `multipleStatements` is enabled, one\n * entry per statement.\n *\n * The adapter's contract: `execute` returns rows (a header normalizes to `[]`);\n * `executeUnsafe` returns `{ rows, affectedRows }` (a SELECT has\n * `affectedRows: 0`, a mutation has `rows: []`). With `multipleStatements`\n * enabled the LAST statement's result wins, mirroring adapter-pglite's `exec`.\n */\n\nimport type { QueryResult } from \"@vibeorm/runtime\";\n\n// ─── Header detection ─────────────────────────────────────────────\n\n/**\n * True when a driver result value is shaped like mysql2's `ResultSetHeader`\n * (an OK-packet). Checks `affectedRows` + `serverStatus` together so a row\n * object that merely aliases a column as `affectedRows` is not misread.\n */\nexport function isResultSetHeader(params: { value: unknown }): boolean {\n const { value } = params;\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n const source = value as Record<string, unknown>;\n return typeof source.affectedRows === \"number\" && typeof source.serverStatus === \"number\";\n}\n\n// ─── Normalization ────────────────────────────────────────────────\n\n/** One result set (never a multi-statement array) → the adapter contract. */\nfunction normalizeSingle(value: unknown): QueryResult {\n if (Array.isArray(value)) {\n return { rows: value as Record<string, unknown>[], affectedRows: 0 };\n }\n if (isResultSetHeader({ value })) {\n return { rows: [], affectedRows: (value as { affectedRows: number }).affectedRows };\n }\n return { rows: [], affectedRows: 0 };\n}\n\n/**\n * Normalize the first element of mysql2's `[result, fields]` tuple. A\n * multi-statement result (array whose last entry is itself a result set or an\n * OK-packet) collapses to its LAST statement's result.\n */\nexport function normalizeDriverResult(params: { result: unknown }): QueryResult {\n const { result } = params;\n if (Array.isArray(result)) {\n const last: unknown = result.at(-1);\n if (last !== undefined && (Array.isArray(last) || isResultSetHeader({ value: last }))) {\n return normalizeSingle(last);\n }\n // A plain result set: row objects (or an empty SELECT).\n return { rows: result as Record<string, unknown>[], affectedRows: 0 };\n }\n return normalizeSingle(result);\n}\n",
10
- "/**\n * Transaction-control SQL text (mysql dialect).\n *\n * Kept apart from the adapter so the mapping from `TransactionOptions` to SQL\n * is unit-testable without a server, and so the timeout value is validated\n * before it is ever interpolated into a statement.\n *\n * MySQL specifics:\n * - `SET TRANSACTION ISOLATION LEVEL <level>` applies to the NEXT transaction\n * started in the session, so the adapter issues it BEFORE\n * `conn.beginTransaction()` — never inside the open transaction.\n * - MySQL has no general per-transaction statement timeout.\n * `MAX_EXECUTION_TIME` is the closest tool and it bounds **SELECT statements\n * only** — see {@link maxExecutionTimeStatement}.\n */\n\nimport type { IsolationLevel, TransactionOptions } from \"@vibeorm/runtime\";\nimport { VibeError } from \"@vibeorm/schema\";\n\n/** VibeORM isolation level → MySQL isolation level keyword. */\nexport const ISOLATION_LEVEL_SQL: Readonly<Record<IsolationLevel, string>> = Object.freeze({\n ReadCommitted: \"READ COMMITTED\",\n RepeatableRead: \"REPEATABLE READ\",\n Serializable: \"SERIALIZABLE\",\n});\n\n/**\n * `SET TRANSACTION ISOLATION LEVEL <level>` — scoped to the next transaction\n * in the session, which is why the adapter sends it before\n * `conn.beginTransaction()` on the pinned connection.\n *\n * Observability trap (verified live on MySQL 8.4): the one-shot value IS\n * applied to the next transaction — `performance_schema.\n * events_transactions_current` reports the requested level — but\n * `@@transaction_isolation` NEVER reflects it; that variable keeps answering\n * the session value both before and inside the transaction. Tests must assert\n * the level's behavior (e.g. SERIALIZABLE turning plain SELECTs into locking\n * reads), not the variable — see tests/live.test.ts.\n */\nexport function setIsolationLevelStatement(params: { isolationLevel: IsolationLevel }): string {\n return `SET TRANSACTION ISOLATION LEVEL ${ISOLATION_LEVEL_SQL[params.isolationLevel]}`;\n}\n\n/**\n * `SET SESSION MAX_EXECUTION_TIME = <ms>` — the closest MySQL gets to a\n * transaction timeout, and the semantics differ LOUDLY from postgres:\n *\n * **`MAX_EXECUTION_TIME` bounds SELECT statements only.** INSERT / UPDATE /\n * DELETE / DDL inside the transaction run unbounded; MySQL simply has no\n * per-statement timeout for mutations. An over-long SELECT is interrupted with\n * errno 3024 (`ER_QUERY_TIMEOUT`), mapped to `VIBE_TRANSACTION` with\n * `meta.reason = \"timeout\"`. The setting is session-scoped (not\n * transaction-scoped), so the adapter resets it to DEFAULT in `finally` before\n * the connection returns to the pool.\n *\n * One more caveat (verified live on MySQL 8.4): `SELECT SLEEP(n)` cannot\n * observe the bound — an interrupted `SLEEP()` swallows the kill and returns\n * `1` with NO error, so the statement comes back \"successfully\" at ~timeout.\n * Only a SELECT doing real work is cancelled with errno 3024.\n *\n * @throws VibeError `VIBE_VALIDATION` when the timeout is not a non-negative\n * integer — the value is interpolated into SQL, so it is never trusted blindly.\n */\nexport function maxExecutionTimeStatement(params: { timeout: number }): string {\n const { timeout } = params;\n if (!Number.isInteger(timeout) || timeout < 0) {\n throw new VibeError({\n code: \"VIBE_VALIDATION\",\n message: `transaction timeout must be a non-negative integer of milliseconds, received ${String(timeout)}`,\n meta: { timeout },\n });\n }\n return `SET SESSION MAX_EXECUTION_TIME = ${timeout}`;\n}\n\n/**\n * Restores the session default after a transaction that set a timeout. Issued\n * in `finally`; if it fails the adapter destroys the connection instead of\n * releasing it, so a poisoned session never returns to the pool.\n */\nexport const RESET_MAX_EXECUTION_TIME_SQL: string = \"SET SESSION MAX_EXECUTION_TIME = DEFAULT\";\n\n// ─── Raw transaction control (session affinity) ─────────────────\n\n/** How a raw statement steers the adapter's session-affine raw transaction. */\nexport type RawTransactionControl = \"open\" | \"close\" | null;\n\nconst RAW_OPEN_PATTERN: RegExp = /^\\s*(?:begin|start\\s+transaction)\\b[^;]*;?\\s*$/i;\nconst RAW_CLOSE_PATTERN: RegExp = /^\\s*(?:commit|rollback)(?:\\s+work)?\\s*;?\\s*$/i;\n\n/**\n * Classify a raw statement as transaction control. A raw `BEGIN` … `COMMIT`\n * sequence over `executeUnsafe` is sound only when every statement in between\n * rides the SAME pooled connection, so the adapter pins one connection for\n * the whole raw transaction (\"open\" checks out, \"close\" releases). MySQL DDL\n * auto-commits, so @vibeorm/migrate never wraps here — this exists for raw\n * user sequences and keeps the three pool adapters' semantics identical.\n *\n * Deliberately strict: only PURE single-statement control text matches.\n * Compound scripts, `ROLLBACK TO SAVEPOINT` and `COMMIT AND CHAIN` (which\n * keeps a transaction open) never engage the pinning.\n */\nexport function classifyRawTransactionControl(params: { text: string }): RawTransactionControl {\n if (RAW_OPEN_PATTERN.test(params.text)) return \"open\";\n if (RAW_CLOSE_PATTERN.test(params.text)) return \"close\";\n return null;\n}\n\n// ─── Nested transaction options (the cross-adapter contract) ──────\n\n/**\n * Refuse options on a NESTED `transaction()` call — the same contract on every\n * adapter (see the `DatabaseAdapter.transaction` JSDoc in @vibeorm/runtime):\n * a nested transaction is a SAVEPOINT, and a savepoint can neither change the\n * isolation level of the transaction it joins nor enforce its own timeout.\n * Silently dropping the option (the pre-#3 behaviour) hid exactly that.\n *\n * @throws VibeError `VIBE_VALIDATION` when `isolationLevel` or `timeout` is\n * present (an `undefined` or empty options object is accepted).\n */\nexport function refuseNestedTransactionOptions(params: {\n options?: TransactionOptions;\n provider: string;\n}): void {\n const { options, provider } = params;\n if (options === undefined) return;\n\n const passed: string[] = [];\n if (options.isolationLevel !== undefined) passed.push(\"isolationLevel\");\n if (options.timeout !== undefined) passed.push(\"timeout\");\n if (options.deadline !== undefined) passed.push(\"deadline\");\n if (passed.length === 0) return;\n\n const meta: Record<string, unknown> = { provider, nested: true };\n if (options.isolationLevel !== undefined) meta.isolationLevel = options.isolationLevel;\n if (options.timeout !== undefined) meta.timeout = options.timeout;\n if (options.deadline !== undefined) meta.deadline = options.deadline;\n\n throw new VibeError({\n code: \"VIBE_VALIDATION\",\n message: `nested transactions run as savepoints and cannot honor ${passed.join(\" or \")} — a savepoint cannot change the isolation level of the transaction it joins, a nested timeout is not enforceable, and a nested deadline would need its own session setting on a connection it does not own (it inherits the top-level one instead); pass options on the top-level $transaction`,\n meta,\n });\n}\n"
10
+ "/**\n * Result normalization for mysql2.\n *\n * mysql2 resolves `execute()` / `query()` with a `[result, fields]` tuple where\n * `result` is one of:\n * - `RowDataPacket[]` — a SELECT's rows (plain objects; `rowsAsArray` is off);\n * - `ResultSetHeader` — an INSERT / UPDATE / DELETE / DDL OK-packet carrying\n * `affectedRows` and `insertId`;\n * - an array of the above — only when `multipleStatements` is enabled, one\n * entry per statement.\n *\n * The adapter's contract: `execute` returns rows (a header normalizes to `[]`);\n * `executeUnsafe` returns `{ rows, affectedRows }` (a SELECT has\n * `affectedRows: 0`, a mutation has `rows: []`). With `multipleStatements`\n * enabled the LAST statement's result wins, mirroring adapter-pglite's `exec`.\n */\n\nimport type { QueryResult } from \"@vibeorm/runtime\";\n\n// ─── Header detection ─────────────────────────────────────────────\n\n/**\n * True when a driver result value is shaped like mysql2's `ResultSetHeader`\n * (an OK-packet). This shape check is only sound at a driver-result boundary,\n * never for members of a SELECT's row array; those can have any column names.\n */\nexport function isResultSetHeader(params: { value: unknown }): boolean {\n const { value } = params;\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n const source = value as Record<string, unknown>;\n return typeof source.affectedRows === \"number\" && typeof source.serverStatus === \"number\";\n}\n\n// ─── Normalization ────────────────────────────────────────────────\n\n/** One result set (never a multi-statement array) → the adapter contract. */\nfunction normalizeSingle(value: unknown): QueryResult {\n if (Array.isArray(value)) {\n return { rows: value as Record<string, unknown>[], affectedRows: 0 };\n }\n if (isResultSetHeader({ value })) {\n const header = value as { affectedRows: number; insertId?: unknown };\n const insertId = header.insertId;\n // mysql2 uses zero for OK packets without an auto-generated identity.\n // Keep that sentinel absent so callers retain their last-id fallback.\n const hasIdentity = (typeof insertId === \"number\" && Number.isSafeInteger(insertId) && insertId !== 0) ||\n (typeof insertId === \"string\" && /^-?\\d+$/.test(insertId) && !/^-?0+$/.test(insertId));\n return { rows: [], affectedRows: header.affectedRows, ...(hasIdentity ? { insertId: insertId as number | string } : {}) };\n }\n return { rows: [], affectedRows: 0 };\n}\n\n/**\n * Normalize mysql2's result and field metadata. Multi-statement arrays collapse\n * to their LAST statement's result; field metadata distinguishes headers from\n * legal SELECT rows with header-like aliases.\n */\nexport function normalizeDriverResult(params: { result: unknown; fields?: unknown }): QueryResult {\n const { result, fields } = params;\n if (Array.isArray(result)) {\n // mysql2 supplies a parallel fields array for multiple results: each entry\n // is a field list for a SELECT, or undefined for an OK packet. A single\n // SELECT has a flat field list, regardless of its user-chosen column names.\n const multiple = Array.isArray(fields)\n ? fields.some((field: unknown) => field === undefined || Array.isArray(field))\n : result.some((value: unknown) => Array.isArray(value));\n if (multiple) return normalizeSingle(result.at(-1));\n // A plain result set: row objects (or an empty SELECT).\n return { rows: result as Record<string, unknown>[], affectedRows: 0 };\n }\n return normalizeSingle(result);\n}\n",
11
+ "/**\n * Transaction-control SQL text (mysql dialect).\n *\n * Kept apart from the adapter so the mapping from `TransactionOptions` to SQL\n * is unit-testable without a server, and so the timeout value is validated\n * before it is ever interpolated into a statement.\n *\n * MySQL specifics:\n * - `SET TRANSACTION ISOLATION LEVEL <level>` applies to the NEXT transaction\n * started in the session, so the adapter issues it BEFORE\n * `conn.beginTransaction()` — never inside the open transaction.\n * - MySQL has no general per-transaction statement timeout.\n * `MAX_EXECUTION_TIME` is the closest tool and it bounds **SELECT statements\n * only** — see {@link maxExecutionTimeStatement}.\n */\n\nimport type { IsolationLevel, TransactionOptions } from \"@vibeorm/runtime\";\nimport { VibeError } from \"@vibeorm/schema\";\n\n/** VibeORM isolation level → MySQL isolation level keyword. */\nexport const ISOLATION_LEVEL_SQL: Readonly<Record<IsolationLevel, string>> = Object.freeze({\n ReadCommitted: \"READ COMMITTED\",\n RepeatableRead: \"REPEATABLE READ\",\n Serializable: \"SERIALIZABLE\",\n});\n\n/**\n * `SET TRANSACTION ISOLATION LEVEL <level>` — scoped to the next transaction\n * in the session, which is why the adapter sends it before\n * `conn.beginTransaction()` on the pinned connection.\n *\n * Observability trap (verified live on MySQL 8.4): the one-shot value IS\n * applied to the next transaction — `performance_schema.\n * events_transactions_current` reports the requested level — but\n * `@@transaction_isolation` NEVER reflects it; that variable keeps answering\n * the session value both before and inside the transaction. Tests must assert\n * the level's behavior (e.g. SERIALIZABLE turning plain SELECTs into locking\n * reads), not the variable — see tests/live.test.ts.\n */\nexport function setIsolationLevelStatement(params: { isolationLevel: IsolationLevel }): string {\n return `SET TRANSACTION ISOLATION LEVEL ${ISOLATION_LEVEL_SQL[params.isolationLevel]}`;\n}\n\n/**\n * `SET SESSION MAX_EXECUTION_TIME = <ms>` — the closest MySQL gets to a\n * transaction timeout, and the semantics differ LOUDLY from postgres:\n *\n * **`MAX_EXECUTION_TIME` bounds SELECT statements only.** INSERT / UPDATE /\n * DELETE / DDL inside the transaction run unbounded; MySQL simply has no\n * per-statement timeout for mutations. An over-long SELECT is interrupted with\n * errno 3024 (`ER_QUERY_TIMEOUT`), mapped to `VIBE_TRANSACTION` with\n * `meta.reason = \"timeout\"`. The setting is session-scoped (not\n * transaction-scoped), so the adapter resets it to DEFAULT in `finally` before\n * the connection returns to the pool.\n *\n * One more caveat (verified live on MySQL 8.4): `SELECT SLEEP(n)` cannot\n * observe the bound — an interrupted `SLEEP()` swallows the kill and returns\n * `1` with NO error, so the statement comes back \"successfully\" at ~timeout.\n * Only a SELECT doing real work is cancelled with errno 3024.\n *\n * @throws VibeError `VIBE_VALIDATION` when the timeout is not a non-negative\n * integer — the value is interpolated into SQL, so it is never trusted blindly.\n */\nexport function maxExecutionTimeStatement(params: { timeout: number }): string {\n const { timeout } = params;\n if (!Number.isInteger(timeout) || timeout < 0) {\n throw new VibeError({\n code: \"VIBE_VALIDATION\",\n message: `transaction timeout must be a non-negative integer of milliseconds, received ${String(timeout)}`,\n meta: { timeout },\n });\n }\n return `SET SESSION MAX_EXECUTION_TIME = ${timeout}`;\n}\n\n/**\n * Restores the session default after a transaction that set a timeout. Issued\n * in `finally`; if it fails the adapter destroys the connection instead of\n * releasing it, so a poisoned session never returns to the pool.\n */\nexport const RESET_MAX_EXECUTION_TIME_SQL: string = \"SET SESSION MAX_EXECUTION_TIME = DEFAULT\";\n\n// ─── Raw transaction control (session affinity) ─────────────────\n\n/** How a raw statement steers the adapter's session-affine raw transaction. */\nexport type RawTransactionControl = \"open\" | \"close\" | null;\n\nconst RAW_OPEN_PATTERN: RegExp = /^\\s*(?:begin|start\\s+transaction)\\b[^;]*;?\\s*$/i;\nconst RAW_CLOSE_PATTERN: RegExp = /^\\s*(?:commit|rollback)(?:\\s+work)?\\s*;?\\s*$/i;\n\n/**\n * Classify a raw statement as transaction control. A raw `BEGIN` … `COMMIT`\n * sequence over `executeUnsafe` is sound only when every statement in between\n * rides the SAME pooled connection, so the adapter pins one connection for\n * the whole raw transaction (\"open\" checks out, \"close\" releases). MySQL DDL\n * auto-commits, so @vibeorm/migrate never wraps here — this exists for raw\n * user sequences and keeps the three pool adapters' semantics identical.\n *\n * Deliberately strict: only PURE single-statement control text matches.\n * Compound scripts, `ROLLBACK TO SAVEPOINT` and `COMMIT AND CHAIN` (which\n * keeps a transaction open) never engage the pinning.\n */\nexport function classifyRawTransactionControl(params: { text: string }): RawTransactionControl {\n if (RAW_OPEN_PATTERN.test(params.text)) return \"open\";\n if (RAW_CLOSE_PATTERN.test(params.text)) return \"close\";\n return null;\n}\n\n// ─── Nested transaction options (the cross-adapter contract) ──────\n\n// ONE copy, shared by every adapter through the runtime's adapter-kit;\n// re-exported here so this adapter's public surface is unchanged.\nexport { refuseNestedTransactionOptions } from \"@vibeorm/runtime/adapter-kit\";\n"
11
12
  ],
12
- "mappings": ";;AA2BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA;AACA,uBAAS;;;ACtBT;AAiBO,IAAM,yBAAwC,OAAO,OAAO;AAAA,EACjE,KAAK,CAAC,IAAgB,OAA4B,WAAW,IAAI,EAAE;AAAA,EACnE,OAAO,CAAC,WAA8B,aAAa,MAAM;AAC3D,CAAC;AAeM,IAAM,iCAAyC;AAQ/C,SAAS,mBAAmB,CAAC,QAA6D;AAAA,EAC/F,QAAQ,WAAW,aAAa;AAAA,EAChC,MAAM,OACJ,aAAa,YACT,iEACA,mBAAmB;AAAA,EACzB,OAAO,IAAI,UAAU;AAAA,IACnB,MAAM;AAAA,IACN,SACE,mBAAmB,qFACnB,YAAY,uFACZ;AAAA,IACF,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,SACI,aAAa,YAAY,CAAC,IAAI,EAAE,iBAAiB,SAAS;AAAA,IAChE;AAAA,EACF,CAAC;AAAA;AAmBH,eAAsB,kBAA4D,CAAC,QAM1D;AAAA,EACvB,QAAQ,MAAM,WAAW,aAAa;AAAA,EACtC,MAAM,SAAS,OAAO,UAAU;AAAA,EAEhC,MAAM,UAAU,KAAK,cAAc;AAAA,EACnC,IAAI,WAAW;AAAA,EACf,IAAI;AAAA,EAEJ,MAAM,WAAW,IAAI,QAAe,CAAC,UAA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AC;AAAA,gBACjC;AAAA,QACA,KAAK,QAAQ;AAAA;AAAA;AAAA,SAIX,WAAU,GAAkB;AAAA,MAChC,IAAI,eAAe,MAAM;AAAA,QAGvB,MAAM,UAAU;AAAA,QAChB,aAAa;AAAA,QACb,IAAI;AAAA,UACF,MAAM,QAAQ,MAAM,UAAU;AAAA,UAC9B,MAAM;AAAA,QAGR,QAAQ,QAAQ;AAAA,MAClB;AAAA,MACA,IAAI,SAAS,QAAQ,UAAU;AAAA,QAC7B,MAAM,UAAU;AAAA,QAChB,OAAO;AAAA,QACP,MAAM,UAAU,MAAM,QAAQ,IAAI,CAAC;AAAA,MACrC;AAAA;AAAA,IAGF,gBAAgB,CAAC,QAA4B;AAAA,MAC3C,OAAO,kBAAkB,MAAM;AAAA;AAAA,EAEnC;AAAA;",
14
+ "debugId": "40CD59F30C5F625164756E2164756E21",
14
15
  "names": []
15
16
  }
package/dist/results.d.ts CHANGED
@@ -17,18 +17,19 @@
17
17
  import type { QueryResult } from "@vibeorm/runtime";
18
18
  /**
19
19
  * True when a driver result value is shaped like mysql2's `ResultSetHeader`
20
- * (an OK-packet). Checks `affectedRows` + `serverStatus` together so a row
21
- * object that merely aliases a column as `affectedRows` is not misread.
20
+ * (an OK-packet). This shape check is only sound at a driver-result boundary,
21
+ * never for members of a SELECT's row array; those can have any column names.
22
22
  */
23
23
  export declare function isResultSetHeader(params: {
24
24
  value: unknown;
25
25
  }): boolean;
26
26
  /**
27
- * Normalize the first element of mysql2's `[result, fields]` tuple. A
28
- * multi-statement result (array whose last entry is itself a result set or an
29
- * OK-packet) collapses to its LAST statement's result.
27
+ * Normalize mysql2's result and field metadata. Multi-statement arrays collapse
28
+ * to their LAST statement's result; field metadata distinguishes headers from
29
+ * legal SELECT rows with header-like aliases.
30
30
  */
31
31
  export declare function normalizeDriverResult(params: {
32
32
  result: unknown;
33
+ fields?: unknown;
33
34
  }): QueryResult;
34
35
  //# sourceMappingURL=results.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAKrE;AAeD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,WAAW,CAW9E"}
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAKrE;AAqBD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,WAAW,CAchG"}
@@ -13,7 +13,7 @@
13
13
  * `MAX_EXECUTION_TIME` is the closest tool and it bounds **SELECT statements
14
14
  * only** — see {@link maxExecutionTimeStatement}.
15
15
  */
16
- import type { IsolationLevel, TransactionOptions } from "@vibeorm/runtime";
16
+ import type { IsolationLevel } from "@vibeorm/runtime";
17
17
  /** VibeORM isolation level → MySQL isolation level keyword. */
18
18
  export declare const ISOLATION_LEVEL_SQL: Readonly<Record<IsolationLevel, string>>;
19
19
  /**
@@ -78,18 +78,5 @@ export type RawTransactionControl = "open" | "close" | null;
78
78
  export declare function classifyRawTransactionControl(params: {
79
79
  text: string;
80
80
  }): RawTransactionControl;
81
- /**
82
- * Refuse options on a NESTED `transaction()` call — the same contract on every
83
- * adapter (see the `DatabaseAdapter.transaction` JSDoc in @vibeorm/runtime):
84
- * a nested transaction is a SAVEPOINT, and a savepoint can neither change the
85
- * isolation level of the transaction it joins nor enforce its own timeout.
86
- * Silently dropping the option (the pre-#3 behaviour) hid exactly that.
87
- *
88
- * @throws VibeError `VIBE_VALIDATION` when `isolationLevel` or `timeout` is
89
- * present (an `undefined` or empty options object is accepted).
90
- */
91
- export declare function refuseNestedTransactionOptions(params: {
92
- options?: TransactionOptions;
93
- provider: string;
94
- }): void;
81
+ export { refuseNestedTransactionOptions } from "@vibeorm/runtime/adapter-kit";
95
82
  //# sourceMappingURL=transaction-sql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-sql.d.ts","sourceRoot":"","sources":["../src/transaction-sql.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3E,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAIvE,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,GAAG,MAAM,CAE7F;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAU7E;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAmD,CAAC;AAI/F,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAK5D;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,CAI7F;AAID;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE;IACrD,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAoBP"}
1
+ {"version":3,"file":"transaction-sql.d.ts","sourceRoot":"","sources":["../src/transaction-sql.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AAG3E,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAIvE,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,GAAG,MAAM,CAE7F;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAU7E;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAmD,CAAC;AAI/F,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAK5D;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,CAI7F;AAMD,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibeorm/adapter-mysql",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "mysql2 adapter for VibeORM v2",
5
5
  "keywords": [
6
6
  "orm",
@@ -42,8 +42,8 @@
42
42
  "bun": ">=1.2.0"
43
43
  },
44
44
  "dependencies": {
45
- "@vibeorm/runtime": "2.2.0",
46
- "@vibeorm/schema": "2.1.1",
45
+ "@vibeorm/runtime": "2.3.0",
46
+ "@vibeorm/schema": "2.2.0",
47
47
  "mysql2": "^3.15.0"
48
48
  },
49
49
  "publishConfig": {