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

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 +71 -5
  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.13";
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) {
@@ -111850,10 +111850,11 @@ var PrismaPgAdapterFactory = class {
111850
111850
  };
111851
111851
 
111852
111852
  // src/logic/adapter.ts
111853
- function createAdapter(url2) {
111854
- for (const factory of factories) {
111853
+ function createAdapter(url2, supportedFactories = defaultFactories) {
111854
+ const allSupportedProtocols = supportedFactories.flatMap((factory) => factory.protocols);
111855
+ for (const factory of supportedFactories) {
111855
111856
  if (factory.protocols.some((protocol) => url2.startsWith(`${protocol}://`))) {
111856
- return factory.create(url2);
111857
+ return wrapFactory(allSupportedProtocols, factory.create(url2));
111857
111858
  }
111858
111859
  }
111859
111860
  let urlObj;
@@ -111864,7 +111865,7 @@ function createAdapter(url2) {
111864
111865
  }
111865
111866
  throw new Error(`Unsupported protocol in database URL: ${urlObj.protocol}`);
111866
111867
  }
111867
- var factories = [
111868
+ var defaultFactories = [
111868
111869
  {
111869
111870
  protocols: ["postgres", "postgresql"],
111870
111871
  create(connectionString) {
@@ -111894,6 +111895,71 @@ var factories = [
111894
111895
  }
111895
111896
  }
111896
111897
  ];
111898
+ function rethrowSanitizedError(protocols, error44) {
111899
+ if (typeof error44 === "object" && error44 !== null) {
111900
+ sanitizeError(error44, createConnectionStringRegex(protocols));
111901
+ }
111902
+ throw error44;
111903
+ }
111904
+ function sanitizeError(error44, regex, visited = /* @__PURE__ */ new WeakSet()) {
111905
+ if (visited.has(error44)) {
111906
+ return;
111907
+ }
111908
+ visited.add(error44);
111909
+ for (const key of Object.getOwnPropertyNames(error44)) {
111910
+ const value = error44[key];
111911
+ if (typeof value === "string") {
111912
+ try {
111913
+ error44[key] = value.replaceAll(regex, "[REDACTED]");
111914
+ } catch {
111915
+ }
111916
+ } else if (typeof value === "object" && value !== null) {
111917
+ sanitizeError(value, regex, visited);
111918
+ }
111919
+ }
111920
+ }
111921
+ function createConnectionStringRegex(protocols) {
111922
+ const escapedProtocols = protocols.join("|");
111923
+ const pattern = [
111924
+ `['"\`]?`,
111925
+ // Optional opening quote
111926
+ `(${escapedProtocols})`,
111927
+ // Protocol group
111928
+ `:\\/\\/`,
111929
+ // Protocol separator
111930
+ `[^\\s]+`,
111931
+ // Connection string body
111932
+ `['"\`]?`
111933
+ // Optional closing quote
111934
+ ].join("");
111935
+ return new RegExp(pattern, "gi");
111936
+ }
111937
+ function wrapFactory(protocols, factory) {
111938
+ return {
111939
+ ...factory,
111940
+ connect: () => factory.connect().then(wrapAdapter.bind(null, protocols), rethrowSanitizedError.bind(null, protocols))
111941
+ };
111942
+ }
111943
+ function wrapAdapter(protocols, adapter) {
111944
+ return {
111945
+ ...adapter,
111946
+ dispose: () => adapter.dispose().catch(rethrowSanitizedError.bind(null, protocols)),
111947
+ executeRaw: (query2) => adapter.executeRaw(query2).catch(rethrowSanitizedError.bind(null, protocols)),
111948
+ queryRaw: (query2) => adapter.queryRaw(query2).catch(rethrowSanitizedError.bind(null, protocols)),
111949
+ executeScript: (script) => adapter.executeScript(script).catch(rethrowSanitizedError.bind(null, protocols)),
111950
+ startTransaction: (isolationLevel) => adapter.startTransaction(isolationLevel).then(wrapTransaction.bind(null, protocols), rethrowSanitizedError.bind(null, protocols)),
111951
+ getConnectionInfo: adapter.getConnectionInfo?.bind(adapter)
111952
+ };
111953
+ }
111954
+ function wrapTransaction(protocols, tx) {
111955
+ return {
111956
+ ...tx,
111957
+ commit: () => tx.commit().catch(rethrowSanitizedError.bind(null, protocols)),
111958
+ rollback: () => tx.rollback().catch(rethrowSanitizedError.bind(null, protocols)),
111959
+ executeRaw: (query2) => tx.executeRaw(query2).catch(rethrowSanitizedError.bind(null, protocols)),
111960
+ queryRaw: (query2) => tx.queryRaw(query2).catch(rethrowSanitizedError.bind(null, protocols))
111961
+ };
111962
+ }
111897
111963
 
111898
111964
  // src/logic/resource-limits.ts
111899
111965
  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.13",
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.13",
24
+ "@prisma/adapter-mssql": "7.3.0-dev.13",
25
+ "@prisma/adapter-mariadb": "7.3.0-dev.13",
26
+ "@prisma/driver-adapter-utils": "7.3.0-dev.13",
27
+ "@prisma/client-engine-runtime": "7.3.0-dev.13"
28
28
  },
29
29
  "files": [
30
30
  "dist"