@prisma/query-plan-executor 7.4.0-dev.23 → 7.4.0-dev.24

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 +60 -16
  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-dev.23";
101328
+ var version = "7.4.0-dev.24";
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) {
@@ -114465,25 +114465,66 @@ function mapIsolationLevelFromString(level) {
114465
114465
  }
114466
114466
  }
114467
114467
  var debug5 = Debug("prisma:driver-adapter:mssql:connection-string");
114468
- function extractSchemaFromConnectionString(connectionString) {
114469
- const withoutProtocol = connectionString.replace(/^sqlserver:\/\//, "");
114470
- const parts = withoutProtocol.split(";");
114471
- for (const part of parts) {
114472
- const [key, value] = part.split("=", 2);
114473
- if (key?.trim() === "schema") {
114474
- 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;
114475
114499
  }
114476
114500
  }
114477
- 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;
114478
114515
  }
114479
114516
  function parseConnectionString(connectionString) {
114480
114517
  const withoutProtocol = connectionString.replace(/^sqlserver:\/\//, "");
114481
- const [hostPart, ...paramParts] = withoutProtocol.split(";");
114518
+ const parts = splitRespectingBraces(withoutProtocol);
114519
+ const [hostPart, ...paramParts] = parts;
114482
114520
  const config3 = {
114483
114521
  server: "",
114484
114522
  options: {},
114485
114523
  pool: {}
114486
114524
  };
114525
+ if (!hostPart || hostPart.trim() === "") {
114526
+ throw new Error("Server host is required in connection string");
114527
+ }
114487
114528
  const [host, portStr] = hostPart.split(":");
114488
114529
  config3.server = host.trim();
114489
114530
  if (portStr) {
@@ -114495,13 +114536,14 @@ function parseConnectionString(connectionString) {
114495
114536
  }
114496
114537
  const parameters = {};
114497
114538
  for (const part of paramParts) {
114498
- const [key, value] = part.split("=", 2);
114539
+ const [key, ...valueParts] = part.split("=");
114499
114540
  if (!key) continue;
114500
114541
  const trimmedKey = key.trim();
114501
114542
  if (trimmedKey in parameters) {
114502
114543
  throw new Error(`Duplication configuration parameter: ${trimmedKey}`);
114503
114544
  }
114504
- parameters[trimmedKey] = value.trim();
114545
+ const value = valueParts.join("=");
114546
+ parameters[trimmedKey] = unescapeValue(value);
114505
114547
  if (!handledParameters.includes(trimmedKey)) {
114506
114548
  debug5(`Unknown connection string parameter: ${trimmedKey}`);
114507
114549
  }
@@ -114592,7 +114634,8 @@ function parseConnectionString(connectionString) {
114592
114634
  if (!config3.server || config3.server.trim() === "") {
114593
114635
  throw new Error("Server host is required in connection string");
114594
114636
  }
114595
- return config3;
114637
+ const schema = firstKey(parameters, "schema") ?? void 0;
114638
+ return { config: config3, schema };
114596
114639
  }
114597
114640
  function parseAuthenticationOptions(parameters, authenticationValue) {
114598
114641
  switch (authenticationValue) {
@@ -114686,6 +114729,7 @@ var handledParameters = [
114686
114729
  "password",
114687
114730
  "poolTimeout",
114688
114731
  "pwd",
114732
+ "schema",
114689
114733
  "socketTimeout",
114690
114734
  "trustServerCertificate",
114691
114735
  "uid",
@@ -115149,11 +115193,11 @@ var PrismaMssqlAdapterFactory = class {
115149
115193
  #options;
115150
115194
  constructor(configOrString, options) {
115151
115195
  if (typeof configOrString === "string") {
115152
- this.#config = parseConnectionString(configOrString);
115153
- const extractedSchema = extractSchemaFromConnectionString(configOrString);
115196
+ const { config: config3, schema } = parseConnectionString(configOrString);
115197
+ this.#config = config3;
115154
115198
  this.#options = {
115155
115199
  ...options,
115156
- schema: options?.schema ?? extractedSchema
115200
+ schema: options?.schema ?? schema
115157
115201
  };
115158
115202
  } else {
115159
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-dev.23",
3
+ "version": "7.4.0-dev.24",
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-pg": "7.4.0-dev.23",
24
- "@prisma/adapter-mssql": "7.4.0-dev.23",
25
- "@prisma/client-engine-runtime": "7.4.0-dev.23",
26
- "@prisma/adapter-mariadb": "7.4.0-dev.23",
27
- "@prisma/driver-adapter-utils": "7.4.0-dev.23"
23
+ "@prisma/adapter-pg": "7.4.0-dev.24",
24
+ "@prisma/adapter-mariadb": "7.4.0-dev.24",
25
+ "@prisma/client-engine-runtime": "7.4.0-dev.24",
26
+ "@prisma/driver-adapter-utils": "7.4.0-dev.24",
27
+ "@prisma/adapter-mssql": "7.4.0-dev.24"
28
28
  },
29
29
  "files": [
30
30
  "dist"