@prisma/query-plan-executor 7.4.0-integration-parameterization.22 → 7.4.1-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.4.1-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) {
@@ -109757,7 +109757,10 @@ function normalizeJsonProtocolValues(result) {
109757
109757
  function isTaggedValue(value) {
109758
109758
  return value !== null && typeof value == "object" && typeof value["$type"] === "string";
109759
109759
  }
109760
- function normalizeTaggedValue({ $type, value }) {
109760
+ function normalizeTaggedValue({
109761
+ $type,
109762
+ value
109763
+ }) {
109761
109764
  switch ($type) {
109762
109765
  case "BigInt":
109763
109766
  return { $type, value: String(value) };
@@ -109769,6 +109772,12 @@ function normalizeTaggedValue({ $type, value }) {
109769
109772
  return { $type, value: String(new Decimal(value)) };
109770
109773
  case "Json":
109771
109774
  return { $type, value: JSON.stringify(JSON.parse(value)) };
109775
+ case "Raw":
109776
+ return { $type, value };
109777
+ case "FieldRef":
109778
+ return { $type, value };
109779
+ case "Enum":
109780
+ return { $type, value };
109772
109781
  default:
109773
109782
  assertNever(value, "Unknown tagged value");
109774
109783
  }
@@ -111180,6 +111189,7 @@ var QueryInterpreter = class _QueryInterpreter {
111180
111189
  }
111181
111190
  case "process": {
111182
111191
  const { value, lastInsertId } = await this.interpretNode(node.args.expr, context2);
111192
+ evaluateProcessingParameters(node.args.operations, context2.scope, context2.generators);
111183
111193
  return { value: processRecords(value, node.args.operations), lastInsertId };
111184
111194
  }
111185
111195
  case "initializeRecord": {
@@ -111355,6 +111365,17 @@ function applyComments(query2, sqlCommenter) {
111355
111365
  sql: appendSqlComment(query2.sql, comment)
111356
111366
  };
111357
111367
  }
111368
+ function evaluateProcessingParameters(ops, scope, generators) {
111369
+ const cursor = ops.pagination?.cursor;
111370
+ if (cursor) {
111371
+ for (const [key, value] of Object.entries(cursor)) {
111372
+ cursor[key] = evaluateArg(value, scope, generators);
111373
+ }
111374
+ }
111375
+ for (const nested of Object.values(ops.nested)) {
111376
+ evaluateProcessingParameters(nested, scope, generators);
111377
+ }
111378
+ }
111358
111379
  async function getCrypto() {
111359
111380
  return globalThis.crypto ?? await import("node:crypto");
111360
111381
  }
@@ -113886,8 +113907,9 @@ function mapArg(arg, argType) {
113886
113907
  return arg;
113887
113908
  }
113888
113909
  function mapRow(row, fields) {
113889
- return row.map((value, i2) => {
113890
- const type2 = fields?.[i2].type;
113910
+ const values = Array.isArray(row) ? row : Object.values(row);
113911
+ return values.map((value, i2) => {
113912
+ const type2 = fields?.[i2]?.type;
113891
113913
  if (value === null) {
113892
113914
  return null;
113893
113915
  }
@@ -114464,25 +114486,66 @@ function mapIsolationLevelFromString(level) {
114464
114486
  }
114465
114487
  }
114466
114488
  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();
114489
+ function splitRespectingBraces(str) {
114490
+ const parts = [];
114491
+ let current = "";
114492
+ let braceDepth = 0;
114493
+ let valueStartIndex = -1;
114494
+ for (let i2 = 0; i2 < str.length; i2++) {
114495
+ const char = str[i2];
114496
+ if (char === "=") {
114497
+ current += char;
114498
+ if (braceDepth === 0) {
114499
+ valueStartIndex = i2 + 1;
114500
+ }
114501
+ } else if (char === "{") {
114502
+ const isFirstCharOfValue = i2 === valueStartIndex;
114503
+ if (isFirstCharOfValue) {
114504
+ braceDepth++;
114505
+ } else if (braceDepth > 0) {
114506
+ throw new Error(`Malformed connection string: nested '{' braces are not supported`);
114507
+ }
114508
+ current += char;
114509
+ } else if (char === "}") {
114510
+ if (braceDepth > 0) {
114511
+ braceDepth--;
114512
+ }
114513
+ current += char;
114514
+ } else if (char === ";" && braceDepth === 0) {
114515
+ parts.push(current);
114516
+ current = "";
114517
+ valueStartIndex = -1;
114518
+ } else {
114519
+ current += char;
114474
114520
  }
114475
114521
  }
114476
- return void 0;
114522
+ if (current) {
114523
+ parts.push(current);
114524
+ }
114525
+ if (braceDepth !== 0) {
114526
+ throw new Error(`Malformed connection string: unclosed '{' brace (braceDepth=${braceDepth})`);
114527
+ }
114528
+ return parts;
114529
+ }
114530
+ function unescapeValue(value) {
114531
+ const trimmed = value.trim();
114532
+ if (trimmed.startsWith("{") && trimmed.endsWith("}") && trimmed.length >= 2) {
114533
+ return trimmed.slice(1, -1);
114534
+ }
114535
+ return trimmed;
114477
114536
  }
114478
114537
  function parseConnectionString(connectionString) {
114479
114538
  const withoutProtocol = connectionString.replace(/^sqlserver:\/\//, "");
114480
- const [hostPart, ...paramParts] = withoutProtocol.split(";");
114539
+ const parts = splitRespectingBraces(withoutProtocol);
114540
+ const [hostPart, ...paramParts] = parts;
114481
114541
  const config3 = {
114482
114542
  server: "",
114483
114543
  options: {},
114484
114544
  pool: {}
114485
114545
  };
114546
+ if (!hostPart || hostPart.trim() === "") {
114547
+ throw new Error("Server host is required in connection string");
114548
+ }
114486
114549
  const [host, portStr] = hostPart.split(":");
114487
114550
  config3.server = host.trim();
114488
114551
  if (portStr) {
@@ -114494,13 +114557,14 @@ function parseConnectionString(connectionString) {
114494
114557
  }
114495
114558
  const parameters = {};
114496
114559
  for (const part of paramParts) {
114497
- const [key, value] = part.split("=", 2);
114560
+ const [key, ...valueParts] = part.split("=");
114498
114561
  if (!key) continue;
114499
114562
  const trimmedKey = key.trim();
114500
114563
  if (trimmedKey in parameters) {
114501
114564
  throw new Error(`Duplication configuration parameter: ${trimmedKey}`);
114502
114565
  }
114503
- parameters[trimmedKey] = value.trim();
114566
+ const value = valueParts.join("=");
114567
+ parameters[trimmedKey] = unescapeValue(value);
114504
114568
  if (!handledParameters.includes(trimmedKey)) {
114505
114569
  debug5(`Unknown connection string parameter: ${trimmedKey}`);
114506
114570
  }
@@ -114591,7 +114655,8 @@ function parseConnectionString(connectionString) {
114591
114655
  if (!config3.server || config3.server.trim() === "") {
114592
114656
  throw new Error("Server host is required in connection string");
114593
114657
  }
114594
- return config3;
114658
+ const schema = firstKey(parameters, "schema") ?? void 0;
114659
+ return { config: config3, schema };
114595
114660
  }
114596
114661
  function parseAuthenticationOptions(parameters, authenticationValue) {
114597
114662
  switch (authenticationValue) {
@@ -114685,6 +114750,7 @@ var handledParameters = [
114685
114750
  "password",
114686
114751
  "poolTimeout",
114687
114752
  "pwd",
114753
+ "schema",
114688
114754
  "socketTimeout",
114689
114755
  "trustServerCertificate",
114690
114756
  "uid",
@@ -115077,17 +115143,27 @@ var MssqlTransaction = class extends MssqlQueryable {
115077
115143
  }
115078
115144
  async commit() {
115079
115145
  debug22(`[js::commit]`);
115080
- await this.transaction.commit();
115146
+ const release2 = await this.#mutex.acquire();
115147
+ try {
115148
+ await this.transaction.commit();
115149
+ } finally {
115150
+ release2();
115151
+ }
115081
115152
  }
115082
115153
  async rollback() {
115083
115154
  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
- });
115155
+ const release2 = await this.#mutex.acquire();
115156
+ try {
115157
+ await this.transaction.rollback().catch((e2) => {
115158
+ if (e2.code === "EABORT") {
115159
+ debug22(`[js::rollback] Transaction already aborted`);
115160
+ return;
115161
+ }
115162
+ throw e2;
115163
+ });
115164
+ } finally {
115165
+ release2();
115166
+ }
115091
115167
  }
115092
115168
  };
115093
115169
  var PrismaMssqlAdapter = class extends MssqlQueryable {
@@ -115138,11 +115214,11 @@ var PrismaMssqlAdapterFactory = class {
115138
115214
  #options;
115139
115215
  constructor(configOrString, options) {
115140
115216
  if (typeof configOrString === "string") {
115141
- this.#config = parseConnectionString(configOrString);
115142
- const extractedSchema = extractSchemaFromConnectionString(configOrString);
115217
+ const { config: config3, schema } = parseConnectionString(configOrString);
115218
+ this.#config = config3;
115143
115219
  this.#options = {
115144
115220
  ...options,
115145
- schema: options?.schema ?? extractedSchema
115221
+ schema: options?.schema ?? schema
115146
115222
  };
115147
115223
  } else {
115148
115224
  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.1-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-mariadb": "7.4.1-dev.1",
24
+ "@prisma/adapter-pg": "7.4.1-dev.1",
25
+ "@prisma/adapter-mssql": "7.4.1-dev.1",
26
+ "@prisma/client-engine-runtime": "7.4.1-dev.1",
27
+ "@prisma/driver-adapter-utils": "7.4.1-dev.1"
28
28
  },
29
29
  "files": [
30
30
  "dist"