@prisma/query-plan-executor 7.3.0-dev.12 → 7.3.0-dev.14

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 +82 -6
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -97773,7 +97773,7 @@ __export(index_exports, {
97773
97773
  module.exports = __toCommonJS(index_exports);
97774
97774
 
97775
97775
  // package.json
97776
- var version = "7.3.0-dev.12";
97776
+ var version = "7.3.0-dev.14";
97777
97777
 
97778
97778
  // ../../node_modules/.pnpm/temporal-polyfill@0.3.0/node_modules/temporal-polyfill/chunks/internal.js
97779
97779
  function clampProp(e2, n2, t2, o2, r2) {
@@ -110100,7 +110100,17 @@ var PrismaMariaDbAdapterFactory = class {
110100
110100
  this.#options = options;
110101
110101
  }
110102
110102
  async connect() {
110103
- const pool2 = mariadb.createPool(this.#config);
110103
+ let pool2;
110104
+ try {
110105
+ pool2 = mariadb.createPool(this.#config);
110106
+ } catch (error44) {
110107
+ if (error44 instanceof Error && error44.message.startsWith("error parsing connection string")) {
110108
+ throw new Error(
110109
+ "error parsing connection string, format must be 'mariadb://[<user>[:<password>]@]<host>[:<port>]/[<db>[?<opt1>=<value1>[&<opt2>=<value2>]]]'"
110110
+ );
110111
+ }
110112
+ throw error44;
110113
+ }
110104
110114
  if (this.#capabilities === void 0) {
110105
110115
  this.#capabilities = await getCapabilities(pool2);
110106
110116
  }
@@ -111850,10 +111860,11 @@ var PrismaPgAdapterFactory = class {
111850
111860
  };
111851
111861
 
111852
111862
  // src/logic/adapter.ts
111853
- function createAdapter(url2) {
111854
- for (const factory of factories) {
111863
+ function createAdapter(url2, supportedFactories = defaultFactories) {
111864
+ const allSupportedProtocols = supportedFactories.flatMap((factory) => factory.protocols);
111865
+ for (const factory of supportedFactories) {
111855
111866
  if (factory.protocols.some((protocol) => url2.startsWith(`${protocol}://`))) {
111856
- return factory.create(url2);
111867
+ return wrapFactory(allSupportedProtocols, factory.create(url2));
111857
111868
  }
111858
111869
  }
111859
111870
  let urlObj;
@@ -111864,7 +111875,7 @@ function createAdapter(url2) {
111864
111875
  }
111865
111876
  throw new Error(`Unsupported protocol in database URL: ${urlObj.protocol}`);
111866
111877
  }
111867
- var factories = [
111878
+ var defaultFactories = [
111868
111879
  {
111869
111880
  protocols: ["postgres", "postgresql"],
111870
111881
  create(connectionString) {
@@ -111894,6 +111905,71 @@ var factories = [
111894
111905
  }
111895
111906
  }
111896
111907
  ];
111908
+ function rethrowSanitizedError(protocols, error44) {
111909
+ if (typeof error44 === "object" && error44 !== null) {
111910
+ sanitizeError(error44, createConnectionStringRegex(protocols));
111911
+ }
111912
+ throw error44;
111913
+ }
111914
+ function sanitizeError(error44, regex, visited = /* @__PURE__ */ new WeakSet()) {
111915
+ if (visited.has(error44)) {
111916
+ return;
111917
+ }
111918
+ visited.add(error44);
111919
+ for (const key of Object.getOwnPropertyNames(error44)) {
111920
+ const value = error44[key];
111921
+ if (typeof value === "string") {
111922
+ try {
111923
+ error44[key] = value.replaceAll(regex, "[REDACTED]");
111924
+ } catch {
111925
+ }
111926
+ } else if (typeof value === "object" && value !== null) {
111927
+ sanitizeError(value, regex, visited);
111928
+ }
111929
+ }
111930
+ }
111931
+ function createConnectionStringRegex(protocols) {
111932
+ const escapedProtocols = protocols.join("|");
111933
+ const pattern = [
111934
+ `['"\`]?`,
111935
+ // Optional opening quote
111936
+ `(${escapedProtocols})`,
111937
+ // Protocol group
111938
+ `:\\/\\/`,
111939
+ // Protocol separator
111940
+ `[^\\s]+`,
111941
+ // Connection string body
111942
+ `['"\`]?`
111943
+ // Optional closing quote
111944
+ ].join("");
111945
+ return new RegExp(pattern, "gi");
111946
+ }
111947
+ function wrapFactory(protocols, factory) {
111948
+ return {
111949
+ ...factory,
111950
+ connect: () => factory.connect().then(wrapAdapter.bind(null, protocols), rethrowSanitizedError.bind(null, protocols))
111951
+ };
111952
+ }
111953
+ function wrapAdapter(protocols, adapter) {
111954
+ return {
111955
+ ...adapter,
111956
+ dispose: () => adapter.dispose().catch(rethrowSanitizedError.bind(null, protocols)),
111957
+ executeRaw: (query2) => adapter.executeRaw(query2).catch(rethrowSanitizedError.bind(null, protocols)),
111958
+ queryRaw: (query2) => adapter.queryRaw(query2).catch(rethrowSanitizedError.bind(null, protocols)),
111959
+ executeScript: (script) => adapter.executeScript(script).catch(rethrowSanitizedError.bind(null, protocols)),
111960
+ startTransaction: (isolationLevel) => adapter.startTransaction(isolationLevel).then(wrapTransaction.bind(null, protocols), rethrowSanitizedError.bind(null, protocols)),
111961
+ getConnectionInfo: adapter.getConnectionInfo?.bind(adapter)
111962
+ };
111963
+ }
111964
+ function wrapTransaction(protocols, tx) {
111965
+ return {
111966
+ ...tx,
111967
+ commit: () => tx.commit().catch(rethrowSanitizedError.bind(null, protocols)),
111968
+ rollback: () => tx.rollback().catch(rethrowSanitizedError.bind(null, protocols)),
111969
+ executeRaw: (query2) => tx.executeRaw(query2).catch(rethrowSanitizedError.bind(null, protocols)),
111970
+ queryRaw: (query2) => tx.queryRaw(query2).catch(rethrowSanitizedError.bind(null, protocols))
111971
+ };
111972
+ }
111897
111973
 
111898
111974
  // src/logic/resource-limits.ts
111899
111975
  var ResourceLimitError = class extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/query-plan-executor",
3
- "version": "7.3.0-dev.12",
3
+ "version": "7.3.0-dev.14",
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.3.0-dev.12",
24
- "@prisma/adapter-mariadb": "7.3.0-dev.12",
25
- "@prisma/client-engine-runtime": "7.3.0-dev.12",
26
- "@prisma/adapter-mssql": "7.3.0-dev.12",
27
- "@prisma/driver-adapter-utils": "7.3.0-dev.12"
23
+ "@prisma/adapter-pg": "7.3.0-dev.14",
24
+ "@prisma/adapter-mariadb": "7.3.0-dev.14",
25
+ "@prisma/adapter-mssql": "7.3.0-dev.14",
26
+ "@prisma/driver-adapter-utils": "7.3.0-dev.14",
27
+ "@prisma/client-engine-runtime": "7.3.0-dev.14"
28
28
  },
29
29
  "files": [
30
30
  "dist"