@prisma/query-plan-executor 7.4.0-integration-parameterization.22 → 7.5.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2243,7 +2243,7 @@ export declare interface Options {
2243
2243
  }
2244
2244
 
2245
2245
  declare type Pagination = {
2246
- cursor: Record<string, PrismaValue> | null;
2246
+ cursor: Record<string, unknown> | null;
2247
2247
  take: number | null;
2248
2248
  skip: number | null;
2249
2249
  };
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.5.0-dev.1";
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) {
@@ -111180,6 +111180,7 @@ var QueryInterpreter = class _QueryInterpreter {
111180
111180
  }
111181
111181
  case "process": {
111182
111182
  const { value, lastInsertId } = await this.interpretNode(node.args.expr, context2);
111183
+ evaluateProcessingParameters(node.args.operations, context2.scope, context2.generators);
111183
111184
  return { value: processRecords(value, node.args.operations), lastInsertId };
111184
111185
  }
111185
111186
  case "initializeRecord": {
@@ -111355,6 +111356,17 @@ function applyComments(query2, sqlCommenter) {
111355
111356
  sql: appendSqlComment(query2.sql, comment)
111356
111357
  };
111357
111358
  }
111359
+ function evaluateProcessingParameters(ops, scope, generators) {
111360
+ const cursor = ops.pagination?.cursor;
111361
+ if (cursor) {
111362
+ for (const [key, value] of Object.entries(cursor)) {
111363
+ cursor[key] = evaluateArg(value, scope, generators);
111364
+ }
111365
+ }
111366
+ for (const nested of Object.values(ops.nested)) {
111367
+ evaluateProcessingParameters(nested, scope, generators);
111368
+ }
111369
+ }
111358
111370
  async function getCrypto() {
111359
111371
  return globalThis.crypto ?? await import("node:crypto");
111360
111372
  }
@@ -113886,8 +113898,9 @@ function mapArg(arg, argType) {
113886
113898
  return arg;
113887
113899
  }
113888
113900
  function mapRow(row, fields) {
113889
- return row.map((value, i2) => {
113890
- const type2 = fields?.[i2].type;
113901
+ const values = Array.isArray(row) ? row : Object.values(row);
113902
+ return values.map((value, i2) => {
113903
+ const type2 = fields?.[i2]?.type;
113891
113904
  if (value === null) {
113892
113905
  return null;
113893
113906
  }
@@ -114464,25 +114477,66 @@ function mapIsolationLevelFromString(level) {
114464
114477
  }
114465
114478
  }
114466
114479
  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();
114480
+ function splitRespectingBraces(str) {
114481
+ const parts = [];
114482
+ let current = "";
114483
+ let braceDepth = 0;
114484
+ let valueStartIndex = -1;
114485
+ for (let i2 = 0; i2 < str.length; i2++) {
114486
+ const char = str[i2];
114487
+ if (char === "=") {
114488
+ current += char;
114489
+ if (braceDepth === 0) {
114490
+ valueStartIndex = i2 + 1;
114491
+ }
114492
+ } else if (char === "{") {
114493
+ const isFirstCharOfValue = i2 === valueStartIndex;
114494
+ if (isFirstCharOfValue) {
114495
+ braceDepth++;
114496
+ } else if (braceDepth > 0) {
114497
+ throw new Error(`Malformed connection string: nested '{' braces are not supported`);
114498
+ }
114499
+ current += char;
114500
+ } else if (char === "}") {
114501
+ if (braceDepth > 0) {
114502
+ braceDepth--;
114503
+ }
114504
+ current += char;
114505
+ } else if (char === ";" && braceDepth === 0) {
114506
+ parts.push(current);
114507
+ current = "";
114508
+ valueStartIndex = -1;
114509
+ } else {
114510
+ current += char;
114474
114511
  }
114475
114512
  }
114476
- return void 0;
114513
+ if (current) {
114514
+ parts.push(current);
114515
+ }
114516
+ if (braceDepth !== 0) {
114517
+ throw new Error(`Malformed connection string: unclosed '{' brace (braceDepth=${braceDepth})`);
114518
+ }
114519
+ return parts;
114520
+ }
114521
+ function unescapeValue(value) {
114522
+ const trimmed = value.trim();
114523
+ if (trimmed.startsWith("{") && trimmed.endsWith("}") && trimmed.length >= 2) {
114524
+ return trimmed.slice(1, -1);
114525
+ }
114526
+ return trimmed;
114477
114527
  }
114478
114528
  function parseConnectionString(connectionString) {
114479
114529
  const withoutProtocol = connectionString.replace(/^sqlserver:\/\//, "");
114480
- const [hostPart, ...paramParts] = withoutProtocol.split(";");
114530
+ const parts = splitRespectingBraces(withoutProtocol);
114531
+ const [hostPart, ...paramParts] = parts;
114481
114532
  const config3 = {
114482
114533
  server: "",
114483
114534
  options: {},
114484
114535
  pool: {}
114485
114536
  };
114537
+ if (!hostPart || hostPart.trim() === "") {
114538
+ throw new Error("Server host is required in connection string");
114539
+ }
114486
114540
  const [host, portStr] = hostPart.split(":");
114487
114541
  config3.server = host.trim();
114488
114542
  if (portStr) {
@@ -114494,13 +114548,14 @@ function parseConnectionString(connectionString) {
114494
114548
  }
114495
114549
  const parameters = {};
114496
114550
  for (const part of paramParts) {
114497
- const [key, value] = part.split("=", 2);
114551
+ const [key, ...valueParts] = part.split("=");
114498
114552
  if (!key) continue;
114499
114553
  const trimmedKey = key.trim();
114500
114554
  if (trimmedKey in parameters) {
114501
114555
  throw new Error(`Duplication configuration parameter: ${trimmedKey}`);
114502
114556
  }
114503
- parameters[trimmedKey] = value.trim();
114557
+ const value = valueParts.join("=");
114558
+ parameters[trimmedKey] = unescapeValue(value);
114504
114559
  if (!handledParameters.includes(trimmedKey)) {
114505
114560
  debug5(`Unknown connection string parameter: ${trimmedKey}`);
114506
114561
  }
@@ -114591,7 +114646,8 @@ function parseConnectionString(connectionString) {
114591
114646
  if (!config3.server || config3.server.trim() === "") {
114592
114647
  throw new Error("Server host is required in connection string");
114593
114648
  }
114594
- return config3;
114649
+ const schema = firstKey(parameters, "schema") ?? void 0;
114650
+ return { config: config3, schema };
114595
114651
  }
114596
114652
  function parseAuthenticationOptions(parameters, authenticationValue) {
114597
114653
  switch (authenticationValue) {
@@ -114685,6 +114741,7 @@ var handledParameters = [
114685
114741
  "password",
114686
114742
  "poolTimeout",
114687
114743
  "pwd",
114744
+ "schema",
114688
114745
  "socketTimeout",
114689
114746
  "trustServerCertificate",
114690
114747
  "uid",
@@ -115077,17 +115134,27 @@ var MssqlTransaction = class extends MssqlQueryable {
115077
115134
  }
115078
115135
  async commit() {
115079
115136
  debug22(`[js::commit]`);
115080
- await this.transaction.commit();
115137
+ const release2 = await this.#mutex.acquire();
115138
+ try {
115139
+ await this.transaction.commit();
115140
+ } finally {
115141
+ release2();
115142
+ }
115081
115143
  }
115082
115144
  async rollback() {
115083
115145
  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
- });
115146
+ const release2 = await this.#mutex.acquire();
115147
+ try {
115148
+ await this.transaction.rollback().catch((e2) => {
115149
+ if (e2.code === "EABORT") {
115150
+ debug22(`[js::rollback] Transaction already aborted`);
115151
+ return;
115152
+ }
115153
+ throw e2;
115154
+ });
115155
+ } finally {
115156
+ release2();
115157
+ }
115091
115158
  }
115092
115159
  };
115093
115160
  var PrismaMssqlAdapter = class extends MssqlQueryable {
@@ -115138,11 +115205,11 @@ var PrismaMssqlAdapterFactory = class {
115138
115205
  #options;
115139
115206
  constructor(configOrString, options) {
115140
115207
  if (typeof configOrString === "string") {
115141
- this.#config = parseConnectionString(configOrString);
115142
- const extractedSchema = extractSchemaFromConnectionString(configOrString);
115208
+ const { config: config3, schema } = parseConnectionString(configOrString);
115209
+ this.#config = config3;
115143
115210
  this.#options = {
115144
115211
  ...options,
115145
- schema: options?.schema ?? extractedSchema
115212
+ schema: options?.schema ?? schema
115146
115213
  };
115147
115214
  } else {
115148
115215
  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.5.0-dev.1",
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.5.0-dev.1",
24
+ "@prisma/adapter-mariadb": "7.5.0-dev.1",
25
+ "@prisma/client-engine-runtime": "7.5.0-dev.1",
26
+ "@prisma/adapter-mssql": "7.5.0-dev.1",
27
+ "@prisma/driver-adapter-utils": "7.5.0-dev.1"
28
28
  },
29
29
  "files": [
30
30
  "dist"