@prisma/query-plan-executor 7.4.0-integration-parameterization.22 → 7.4.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.
Files changed (2) hide show
  1. package/dist/index.js +81 -26
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -101325,7 +101325,7 @@ __export(index_exports, {
101325
101325
  module.exports = __toCommonJS(index_exports);
101326
101326
 
101327
101327
  // package.json
101328
- var version = "7.4.0-integration-parameterization.22";
101328
+ var version = "7.4.0";
101329
101329
 
101330
101330
  // ../../node_modules/.pnpm/temporal-polyfill@0.3.0/node_modules/temporal-polyfill/chunks/internal.js
101331
101331
  function clampProp(e2, n2, t2, o2, r2) {
@@ -113886,8 +113886,9 @@ function mapArg(arg, argType) {
113886
113886
  return arg;
113887
113887
  }
113888
113888
  function mapRow(row, fields) {
113889
- return row.map((value, i2) => {
113890
- const type2 = fields?.[i2].type;
113889
+ const values = Array.isArray(row) ? row : Object.values(row);
113890
+ return values.map((value, i2) => {
113891
+ const type2 = fields?.[i2]?.type;
113891
113892
  if (value === null) {
113892
113893
  return null;
113893
113894
  }
@@ -114464,25 +114465,66 @@ function mapIsolationLevelFromString(level) {
114464
114465
  }
114465
114466
  }
114466
114467
  var debug5 = Debug("prisma:driver-adapter:mssql:connection-string");
114467
- function extractSchemaFromConnectionString(connectionString) {
114468
- const withoutProtocol = connectionString.replace(/^sqlserver:\/\//, "");
114469
- const parts = withoutProtocol.split(";");
114470
- for (const part of parts) {
114471
- const [key, value] = part.split("=", 2);
114472
- if (key?.trim() === "schema") {
114473
- return value?.trim();
114468
+ function splitRespectingBraces(str) {
114469
+ const parts = [];
114470
+ let current = "";
114471
+ let braceDepth = 0;
114472
+ let valueStartIndex = -1;
114473
+ for (let i2 = 0; i2 < str.length; i2++) {
114474
+ const char = str[i2];
114475
+ if (char === "=") {
114476
+ current += char;
114477
+ if (braceDepth === 0) {
114478
+ valueStartIndex = i2 + 1;
114479
+ }
114480
+ } else if (char === "{") {
114481
+ const isFirstCharOfValue = i2 === valueStartIndex;
114482
+ if (isFirstCharOfValue) {
114483
+ braceDepth++;
114484
+ } else if (braceDepth > 0) {
114485
+ throw new Error(`Malformed connection string: nested '{' braces are not supported`);
114486
+ }
114487
+ current += char;
114488
+ } else if (char === "}") {
114489
+ if (braceDepth > 0) {
114490
+ braceDepth--;
114491
+ }
114492
+ current += char;
114493
+ } else if (char === ";" && braceDepth === 0) {
114494
+ parts.push(current);
114495
+ current = "";
114496
+ valueStartIndex = -1;
114497
+ } else {
114498
+ current += char;
114474
114499
  }
114475
114500
  }
114476
- return void 0;
114501
+ if (current) {
114502
+ parts.push(current);
114503
+ }
114504
+ if (braceDepth !== 0) {
114505
+ throw new Error(`Malformed connection string: unclosed '{' brace (braceDepth=${braceDepth})`);
114506
+ }
114507
+ return parts;
114508
+ }
114509
+ function unescapeValue(value) {
114510
+ const trimmed = value.trim();
114511
+ if (trimmed.startsWith("{") && trimmed.endsWith("}") && trimmed.length >= 2) {
114512
+ return trimmed.slice(1, -1);
114513
+ }
114514
+ return trimmed;
114477
114515
  }
114478
114516
  function parseConnectionString(connectionString) {
114479
114517
  const withoutProtocol = connectionString.replace(/^sqlserver:\/\//, "");
114480
- const [hostPart, ...paramParts] = withoutProtocol.split(";");
114518
+ const parts = splitRespectingBraces(withoutProtocol);
114519
+ const [hostPart, ...paramParts] = parts;
114481
114520
  const config3 = {
114482
114521
  server: "",
114483
114522
  options: {},
114484
114523
  pool: {}
114485
114524
  };
114525
+ if (!hostPart || hostPart.trim() === "") {
114526
+ throw new Error("Server host is required in connection string");
114527
+ }
114486
114528
  const [host, portStr] = hostPart.split(":");
114487
114529
  config3.server = host.trim();
114488
114530
  if (portStr) {
@@ -114494,13 +114536,14 @@ function parseConnectionString(connectionString) {
114494
114536
  }
114495
114537
  const parameters = {};
114496
114538
  for (const part of paramParts) {
114497
- const [key, value] = part.split("=", 2);
114539
+ const [key, ...valueParts] = part.split("=");
114498
114540
  if (!key) continue;
114499
114541
  const trimmedKey = key.trim();
114500
114542
  if (trimmedKey in parameters) {
114501
114543
  throw new Error(`Duplication configuration parameter: ${trimmedKey}`);
114502
114544
  }
114503
- parameters[trimmedKey] = value.trim();
114545
+ const value = valueParts.join("=");
114546
+ parameters[trimmedKey] = unescapeValue(value);
114504
114547
  if (!handledParameters.includes(trimmedKey)) {
114505
114548
  debug5(`Unknown connection string parameter: ${trimmedKey}`);
114506
114549
  }
@@ -114591,7 +114634,8 @@ function parseConnectionString(connectionString) {
114591
114634
  if (!config3.server || config3.server.trim() === "") {
114592
114635
  throw new Error("Server host is required in connection string");
114593
114636
  }
114594
- return config3;
114637
+ const schema = firstKey(parameters, "schema") ?? void 0;
114638
+ return { config: config3, schema };
114595
114639
  }
114596
114640
  function parseAuthenticationOptions(parameters, authenticationValue) {
114597
114641
  switch (authenticationValue) {
@@ -114685,6 +114729,7 @@ var handledParameters = [
114685
114729
  "password",
114686
114730
  "poolTimeout",
114687
114731
  "pwd",
114732
+ "schema",
114688
114733
  "socketTimeout",
114689
114734
  "trustServerCertificate",
114690
114735
  "uid",
@@ -115077,17 +115122,27 @@ var MssqlTransaction = class extends MssqlQueryable {
115077
115122
  }
115078
115123
  async commit() {
115079
115124
  debug22(`[js::commit]`);
115080
- await this.transaction.commit();
115125
+ const release2 = await this.#mutex.acquire();
115126
+ try {
115127
+ await this.transaction.commit();
115128
+ } finally {
115129
+ release2();
115130
+ }
115081
115131
  }
115082
115132
  async rollback() {
115083
115133
  debug22(`[js::rollback]`);
115084
- await this.transaction.rollback().catch((e2) => {
115085
- if (e2.code === "EABORT") {
115086
- debug22(`[js::rollback] Transaction already aborted`);
115087
- return;
115088
- }
115089
- throw e2;
115090
- });
115134
+ const release2 = await this.#mutex.acquire();
115135
+ try {
115136
+ await this.transaction.rollback().catch((e2) => {
115137
+ if (e2.code === "EABORT") {
115138
+ debug22(`[js::rollback] Transaction already aborted`);
115139
+ return;
115140
+ }
115141
+ throw e2;
115142
+ });
115143
+ } finally {
115144
+ release2();
115145
+ }
115091
115146
  }
115092
115147
  };
115093
115148
  var PrismaMssqlAdapter = class extends MssqlQueryable {
@@ -115138,11 +115193,11 @@ var PrismaMssqlAdapterFactory = class {
115138
115193
  #options;
115139
115194
  constructor(configOrString, options) {
115140
115195
  if (typeof configOrString === "string") {
115141
- this.#config = parseConnectionString(configOrString);
115142
- const extractedSchema = extractSchemaFromConnectionString(configOrString);
115196
+ const { config: config3, schema } = parseConnectionString(configOrString);
115197
+ this.#config = config3;
115143
115198
  this.#options = {
115144
115199
  ...options,
115145
- schema: options?.schema ?? extractedSchema
115200
+ schema: options?.schema ?? schema
115146
115201
  };
115147
115202
  } else {
115148
115203
  this.#config = configOrString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/query-plan-executor",
3
- "version": "7.4.0-integration-parameterization.22",
3
+ "version": "7.4.0",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,11 +20,11 @@
20
20
  "temporal-polyfill": "0.3.0",
21
21
  "vitest": "3.2.4",
22
22
  "zod": "4.1.3",
23
- "@prisma/adapter-mariadb": "7.4.0-integration-parameterization.22",
24
- "@prisma/adapter-mssql": "7.4.0-integration-parameterization.22",
25
- "@prisma/adapter-pg": "7.4.0-integration-parameterization.22",
26
- "@prisma/driver-adapter-utils": "7.4.0-integration-parameterization.22",
27
- "@prisma/client-engine-runtime": "7.4.0-integration-parameterization.22"
23
+ "@prisma/adapter-pg": "7.4.0",
24
+ "@prisma/adapter-mariadb": "7.4.0",
25
+ "@prisma/client-engine-runtime": "7.4.0",
26
+ "@prisma/adapter-mssql": "7.4.0",
27
+ "@prisma/driver-adapter-utils": "7.4.0"
28
28
  },
29
29
  "files": [
30
30
  "dist"