@prisma/internals 7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1 → 7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.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.
Files changed (137) hide show
  1. package/dist/{chunk-VBLGRBF2.js → chunk-262R2PBW.js} +5 -5
  2. package/dist/chunk-3FP46GUV.js +471 -0
  3. package/dist/chunk-46ABODUM.js +186 -0
  4. package/dist/{chunk-GJSFP4V4.js → chunk-4CGPN5SR.js} +9 -3
  5. package/dist/{chunk-TCDF53CN.js → chunk-4JCVHBYR.js} +6 -6
  6. package/dist/{chunk-Q6D7PXUU.js → chunk-55ZV2II2.js} +38 -16
  7. package/dist/{chunk-YQYFLEMT.js → chunk-5ETP2F4G.js} +5 -5
  8. package/dist/{chunk-Z64WCHZR.js → chunk-5PEHPZHO.js} +11 -11
  9. package/dist/{chunk-PNYEHZAU.js → chunk-656EKQL7.js} +5 -5
  10. package/dist/{chunk-OWVQILDA.js → chunk-65XSDXPY.js} +13 -13
  11. package/dist/chunk-6TTRTZXU.js +37 -0
  12. package/dist/{chunk-Q5XW7CMJ.js → chunk-75BIJ5PX.js} +9 -9
  13. package/dist/{chunk-DXWYZA7B.js → chunk-7QC5VORA.js} +4 -3
  14. package/dist/{chunk-5YZKJGXV.js → chunk-7QKLIARO.js} +10 -8
  15. package/dist/{chunk-CQVWHHIJ.js → chunk-AX5N26KG.js} +6 -11
  16. package/dist/{chunk-NBWRGVYR.js → chunk-BCQZ6JQE.js} +6 -4
  17. package/dist/{chunk-BXIKQUP5.js → chunk-BVJP43JS.js} +7 -7
  18. package/dist/chunk-D4VDA2TZ.js +66 -0
  19. package/dist/{chunk-EQ6XBXVV.js → chunk-D6JNJJI7.js} +146 -58
  20. package/dist/chunk-DZYINYAA.js +68 -0
  21. package/dist/{chunk-4QR3X56D.js → chunk-E2QTLJH5.js} +13 -13
  22. package/dist/chunk-ERSH2BQA.js +58 -0
  23. package/dist/{chunk-42R3EIRM.js → chunk-EYVG6XQS.js} +67 -55
  24. package/dist/{chunk-GH2WAX5Y.js → chunk-F2OZV76L.js} +7 -7
  25. package/dist/{chunk-R3J2O23S.js → chunk-FCYHZHVW.js} +4 -4
  26. package/dist/{chunk-DQWKFZPY.js → chunk-FYZCPL2Z.js} +7 -4
  27. package/dist/{chunk-2GPDFPDR.js → chunk-GMW36QQF.js} +7 -7
  28. package/dist/{chunk-US23KCBP.js → chunk-H43XC5ET.js} +5 -5
  29. package/dist/{chunk-YXCPS3WU.js → chunk-HFFWZTVM.js} +15 -5
  30. package/dist/chunk-HO5HRHFZ.js +30 -0
  31. package/dist/chunk-HW5RCZSE.js +1 -0
  32. package/dist/{chunk-YV4IFLW4.js → chunk-JOIIWB3U.js} +129 -128
  33. package/dist/chunk-KDHESRKE.js +49 -0
  34. package/dist/{chunk-B4NUBXXO.js → chunk-KH7FI42S.js} +11 -11
  35. package/dist/chunk-L6KOIJJ5.js +125 -0
  36. package/dist/{chunk-3U4QB2G3.js → chunk-LYFOJ5NK.js} +6 -4
  37. package/dist/{chunk-Q75TMXCR.js → chunk-OAT7ZJED.js} +20 -7
  38. package/dist/{chunk-WK3RWN6T.js → chunk-OPLMJ5WZ.js} +146 -58
  39. package/dist/{chunk-SP2ETLT2.js → chunk-OSHZ4P3G.js} +5 -5
  40. package/dist/{chunk-QFQIWWVN.js → chunk-OWUYXGDF.js} +12 -12
  41. package/dist/chunk-PZMRR772.js +41 -0
  42. package/dist/{chunk-RR7B6GH2.js → chunk-QDT7TGYZ.js} +5 -5
  43. package/dist/{chunk-QNSOKYEF.js → chunk-QLOP3Z4E.js} +38 -16
  44. package/dist/{chunk-Y5TWK45J.js → chunk-QPQF4VGD.js} +12 -12
  45. package/dist/chunk-RFB2U4GQ.js +41 -0
  46. package/dist/{chunk-5I4ERIIY.js → chunk-RS2R7COT.js} +9 -3
  47. package/dist/chunk-T2PM5TKT.js +55 -0
  48. package/dist/{chunk-X2DGDDLX.js → chunk-THADADEM.js} +9 -7
  49. package/dist/{chunk-5BRXEOYH.js → chunk-TQFONRJP.js} +5 -5
  50. package/dist/{chunk-WSZXPLJQ.js → chunk-TZJROXB3.js} +4 -4
  51. package/dist/{chunk-YJVCIN4F.js → chunk-UHI6VYFX.js} +14 -16
  52. package/dist/{chunk-NYNXYKR4.js → chunk-UQUWZJVN.js} +7 -7
  53. package/dist/{chunk-N3FJZLFP.js → chunk-W6J5YFD2.js} +5 -5
  54. package/dist/{chunk-AJALNZEH.js → chunk-WDPDHAFW.js} +5 -5
  55. package/dist/{chunk-ARC7TW3L.js → chunk-WFNB7VRA.js} +14 -4
  56. package/dist/{chunk-5IS5OH7Z.js → chunk-WKP2TVYB.js} +5 -5
  57. package/dist/cli/checkUnsupportedDataProxy.d.ts +9 -7
  58. package/dist/cli/checkUnsupportedDataProxy.js +65 -53
  59. package/dist/cli/checkUnsupportedSchemaEngineWasm.d.ts +22 -0
  60. package/dist/cli/checkUnsupportedSchemaEngineWasm.js +135 -0
  61. package/dist/cli/directoryConfig.d.ts +2 -5
  62. package/dist/cli/directoryConfig.js +2 -2
  63. package/dist/cli/getGeneratorSuccessMessage.js +3 -2
  64. package/dist/cli/getSchema.d.ts +20 -28
  65. package/dist/cli/getSchema.js +5 -7
  66. package/dist/cli/hashes.d.ts +1 -2
  67. package/dist/cli/hashes.js +4 -4
  68. package/dist/cli/schemaContext.d.ts +22 -5
  69. package/dist/cli/schemaContext.js +65 -54
  70. package/dist/cli/types.d.ts +1 -1
  71. package/dist/client/getClientEngineType.d.ts +7 -0
  72. package/dist/client/getClientEngineType.js +26 -0
  73. package/dist/convertCredentials.js +4 -4
  74. package/dist/dotenvExpand.d.ts +35 -0
  75. package/dist/dotenvExpand.js +25 -0
  76. package/dist/engine-commands/errorHelpers.js +4 -4
  77. package/dist/engine-commands/formatSchema.js +64 -52
  78. package/dist/engine-commands/getConfig.d.ts +5 -1
  79. package/dist/engine-commands/getConfig.js +13 -10
  80. package/dist/engine-commands/getDmmf.js +10 -10
  81. package/dist/engine-commands/getEngineVersion.js +9 -5
  82. package/dist/engine-commands/getEnginesInfo.d.ts +1 -0
  83. package/dist/engine-commands/getEnginesInfo.js +9 -6
  84. package/dist/engine-commands/index.d.ts +1 -1
  85. package/dist/engine-commands/index.js +76 -62
  86. package/dist/engine-commands/lintSchema.js +9 -9
  87. package/dist/engine-commands/mergeSchemas.js +10 -10
  88. package/dist/engine-commands/queryEngineCommons.js +6 -6
  89. package/dist/engine-commands/validate.js +10 -10
  90. package/dist/get-generators/getGenerators.d.ts +2 -0
  91. package/dist/get-generators/getGenerators.js +67 -55
  92. package/dist/get-generators/utils/binaryTypeToEngineType.js +2 -2
  93. package/dist/get-generators/utils/engineTypeToBinaryType.js +2 -2
  94. package/dist/get-generators/utils/getBinaryPathsByVersion.js +4 -4
  95. package/dist/getPackedPackage.js +3 -3
  96. package/dist/index.d.ts +19 -5
  97. package/dist/index.js +125 -99
  98. package/dist/resolveBinary.js +7 -7
  99. package/dist/schemaEngineCommands.js +8 -8
  100. package/dist/sendPanic.js +3 -2
  101. package/dist/tracing/types.d.ts +54 -0
  102. package/dist/tracing/types.js +2 -0
  103. package/dist/types.d.ts +0 -15
  104. package/dist/utils/__tests__/maskSchema.test.js +23 -0
  105. package/dist/utils/byline.d.ts +4 -0
  106. package/dist/utils/byline.js +28 -0
  107. package/dist/utils/canPrompt.js +3 -3
  108. package/dist/utils/cloudflareD1.d.ts +5 -0
  109. package/dist/utils/cloudflareD1.js +27 -0
  110. package/dist/utils/fs-functional.js +10 -10
  111. package/dist/utils/fs-utils.js +8 -8
  112. package/dist/utils/getEnvPaths.d.ts +14 -0
  113. package/dist/utils/{validatePrismaConfigWithDatasource.js → getEnvPaths.js} +8 -7
  114. package/dist/utils/getMigrateConfigDir.d.ts +2 -0
  115. package/dist/utils/getMigrateConfigDir.js +25 -0
  116. package/dist/utils/getVersionFromPackageJson.js +3 -3
  117. package/dist/utils/handleEngineLoadingErrors.d.ts +8 -0
  118. package/dist/utils/handleEngineLoadingErrors.js +27 -0
  119. package/dist/utils/handlePanic.js +7 -6
  120. package/dist/utils/load.d.ts +6 -0
  121. package/dist/utils/load.js +28 -0
  122. package/dist/utils/loadEnvFile.d.ts +10 -0
  123. package/dist/utils/loadEnvFile.js +30 -0
  124. package/dist/utils/maskSchema.d.ts +4 -0
  125. package/dist/utils/maskSchema.js +27 -0
  126. package/dist/utils/missingDatasource.js +2 -2
  127. package/dist/utils/missingGeneratorMessage.js +4 -4
  128. package/dist/utils/serializeQueryEngineName.d.ts +4 -0
  129. package/dist/utils/serializeQueryEngineName.js +25 -0
  130. package/dist/utils/toSchemasContainer.d.ts +1 -1
  131. package/dist/utils/toSchemasContainer.js +3 -3
  132. package/dist/utils/tryLoadEnvs.d.ts +25 -0
  133. package/dist/utils/tryLoadEnvs.js +30 -0
  134. package/dist/wasm.js +5 -5
  135. package/package.json +17 -15
  136. package/dist/chunk-5SAWCTGN.js +0 -46
  137. package/dist/utils/validatePrismaConfigWithDatasource.d.ts +0 -15
@@ -16,15 +16,21 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_GJSFP4V4_exports = {};
20
- __export(chunk_GJSFP4V4_exports, {
19
+ var chunk_4CGPN5SR_exports = {};
20
+ __export(chunk_4CGPN5SR_exports, {
21
21
  engineTypeToBinaryType: () => engineTypeToBinaryType
22
22
  });
23
- module.exports = __toCommonJS(chunk_GJSFP4V4_exports);
23
+ module.exports = __toCommonJS(chunk_4CGPN5SR_exports);
24
24
  var import_fetch_engine = require("@prisma/fetch-engine");
25
25
  function engineTypeToBinaryType(engineType) {
26
26
  if (engineType === "schemaEngine") {
27
27
  return import_fetch_engine.BinaryType.SchemaEngineBinary;
28
28
  }
29
+ if (engineType === "queryEngine") {
30
+ return import_fetch_engine.BinaryType.QueryEngineBinary;
31
+ }
32
+ if (engineType === "libqueryEngine") {
33
+ return import_fetch_engine.BinaryType.QueryEngineLibrary;
34
+ }
29
35
  throw new Error(`Could not convert engine type ${engineType}`);
30
36
  }
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_TCDF53CN_exports = {};
30
- __export(chunk_TCDF53CN_exports, {
29
+ var chunk_4JCVHBYR_exports = {};
30
+ __export(chunk_4JCVHBYR_exports, {
31
31
  getCLIPathHash: () => getCLIPathHash,
32
32
  getProjectHash: () => getProjectHash
33
33
  });
34
- module.exports = __toCommonJS(chunk_TCDF53CN_exports);
35
- var import_chunk_42R3EIRM = require("./chunk-42R3EIRM.js");
34
+ module.exports = __toCommonJS(chunk_4JCVHBYR_exports);
35
+ var import_chunk_EYVG6XQS = require("./chunk-EYVG6XQS.js");
36
36
  var import_crypto = __toESM(require("crypto"));
37
- async function getProjectHash(schemaPath) {
38
- const projectPath = (await (0, import_chunk_42R3EIRM.getSchemaWithPath)({ schemaPath }))?.schemaPath ?? process.cwd();
37
+ async function getProjectHash(schemaPathFromArgs, schemaPathFromConfig) {
38
+ const projectPath = (await (0, import_chunk_EYVG6XQS.getSchemaWithPath)(schemaPathFromArgs, schemaPathFromConfig))?.schemaPath ?? process.cwd();
39
39
  return import_crypto.default.createHash("sha256").update(projectPath).digest("hex").substring(0, 8);
40
40
  }
41
41
  function getCLIPathHash() {
@@ -26,17 +26,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_Q6D7PXUU_exports = {};
30
- __export(chunk_Q6D7PXUU_exports, {
29
+ var chunk_55ZV2II2_exports = {};
30
+ __export(chunk_55ZV2II2_exports, {
31
31
  GetConfigError: () => GetConfigError,
32
- getConfig: () => getConfig
32
+ getConfig: () => getConfig,
33
+ getDirectUrl: () => getDirectUrl,
34
+ getEffectiveUrl: () => getEffectiveUrl,
35
+ resolveUrl: () => resolveUrl
33
36
  });
34
- module.exports = __toCommonJS(chunk_Q6D7PXUU_exports);
35
- var import_chunk_WSZXPLJQ = require("./chunk-WSZXPLJQ.js");
36
- var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
37
+ module.exports = __toCommonJS(chunk_55ZV2II2_exports);
38
+ var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
37
39
  var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
38
- var import_chunk_AJALNZEH = require("./chunk-AJALNZEH.js");
39
- var import_chunk_VBLGRBF2 = require("./chunk-VBLGRBF2.js");
40
+ var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
41
+ var import_chunk_QDT7TGYZ = require("./chunk-QDT7TGYZ.js");
42
+ var import_chunk_WKP2TVYB = require("./chunk-WKP2TVYB.js");
40
43
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
41
44
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
42
45
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
@@ -61,22 +64,41 @@ ${detailsHeader} ${message}`;
61
64
  }).exhaustive();
62
65
  const errorMessageWithContext = `${constructedErrorMessage}
63
66
  [Context: getConfig]`;
64
- super((0, import_chunk_AJALNZEH.addVersionDetailsToErrorMessage)(errorMessageWithContext));
67
+ super((0, import_chunk_QDT7TGYZ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
65
68
  this.name = "GetConfigError";
66
69
  }
67
70
  };
71
+ function getEffectiveUrl(ds) {
72
+ if (ds.directUrl !== void 0) return ds.directUrl;
73
+ return ds.url;
74
+ }
75
+ function getDirectUrl(ds) {
76
+ return ds.directUrl;
77
+ }
78
+ function resolveUrl(envValue) {
79
+ const urlFromValue = envValue?.value;
80
+ const urlEnvVarName = envValue?.fromEnvVar;
81
+ const urlEnvVarValue = urlEnvVarName ? process.env[urlEnvVarName] : void 0;
82
+ return urlFromValue ?? urlEnvVarValue;
83
+ }
68
84
  async function getConfig(options) {
69
- const debugErrorType = (0, import_chunk_WSZXPLJQ.createDebugErrorType)(debug, "getConfigWasm");
85
+ const debugErrorType = (0, import_chunk_TZJROXB3.createDebugErrorType)(debug, "getConfigWasm");
70
86
  debug(`Using getConfig Wasm`);
71
87
  const configEither = (0, import_function.pipe)(
72
88
  (0, import_chunk_5DBOS77Y.tryCatch)(
73
89
  () => {
74
- if (process.env.FORCE_PANIC_GET_CONFIG) {
90
+ if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {
75
91
  debug("Triggering a Rust panic...");
76
- import_chunk_VBLGRBF2.prismaSchemaWasm.debug_panic();
92
+ import_chunk_WKP2TVYB.prismaSchemaWasm.debug_panic();
77
93
  }
78
- const params = JSON.stringify({ prismaSchema: options.datamodel });
79
- return import_chunk_VBLGRBF2.prismaSchemaWasm.get_config(params);
94
+ const params = JSON.stringify({
95
+ prismaSchema: options.datamodel,
96
+ datasourceOverrides: {},
97
+ ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
98
+ env: process.env
99
+ });
100
+ const data = import_chunk_WKP2TVYB.prismaSchemaWasm.get_config(params);
101
+ return data;
80
102
  },
81
103
  (e) => ({
82
104
  type: "wasm-error",
@@ -134,12 +156,12 @@ async function getConfig(options) {
134
156
  return panic;
135
157
  }
136
158
  const errorOutput = e.error.message;
137
- return new GetConfigError((0, import_chunk_WSZXPLJQ.parseQueryEngineError)({ errorOutput, reason: e.reason }));
159
+ return new GetConfigError((0, import_chunk_TZJROXB3.parseQueryEngineError)({ errorOutput, reason: e.reason }));
138
160
  }).with({ type: "validation-error" }, (e) => {
139
161
  return new GetConfigError({
140
162
  _tag: "parsed",
141
163
  errorCode: SCHEMA_VALIDATION_ERROR_CODE,
142
- reason: (0, import_chunk_WSZXPLJQ.createSchemaValidationError)(e.reason),
164
+ reason: (0, import_chunk_TZJROXB3.createSchemaValidationError)(e.reason),
143
165
  message: formatErrors(e.error)
144
166
  });
145
167
  }).otherwise((e) => {
@@ -16,20 +16,20 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_YQYFLEMT_exports = {};
20
- __export(chunk_YQYFLEMT_exports, {
19
+ var chunk_5ETP2F4G_exports = {};
20
+ __export(chunk_5ETP2F4G_exports, {
21
21
  getLintWarnings: () => getLintWarnings,
22
22
  getLintWarningsAsText: () => getLintWarningsAsText,
23
23
  handleLintPanic: () => handleLintPanic,
24
24
  lintSchema: () => lintSchema,
25
25
  warningToString: () => warningToString
26
26
  });
27
- module.exports = __toCommonJS(chunk_YQYFLEMT_exports);
28
- var import_chunk_VBLGRBF2 = require("./chunk-VBLGRBF2.js");
27
+ module.exports = __toCommonJS(chunk_5ETP2F4G_exports);
28
+ var import_chunk_WKP2TVYB = require("./chunk-WKP2TVYB.js");
29
29
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
30
30
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
31
31
  function lintSchema({ schemas }) {
32
- const lintResult = import_chunk_VBLGRBF2.prismaSchemaWasm.lint(JSON.stringify(schemas));
32
+ const lintResult = import_chunk_WKP2TVYB.prismaSchemaWasm.lint(JSON.stringify(schemas));
33
33
  const lintDiagnostics = JSON.parse(lintResult);
34
34
  return lintDiagnostics;
35
35
  }
@@ -26,17 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_Z64WCHZR_exports = {};
30
- __export(chunk_Z64WCHZR_exports, {
29
+ var chunk_5PEHPZHO_exports = {};
30
+ __export(chunk_5PEHPZHO_exports, {
31
31
  MergeSchemasError: () => MergeSchemasError,
32
32
  mergeSchemas: () => mergeSchemas
33
33
  });
34
- module.exports = __toCommonJS(chunk_Z64WCHZR_exports);
35
- var import_chunk_WSZXPLJQ = require("./chunk-WSZXPLJQ.js");
36
- var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
34
+ module.exports = __toCommonJS(chunk_5PEHPZHO_exports);
35
+ var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
37
36
  var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
38
- var import_chunk_AJALNZEH = require("./chunk-AJALNZEH.js");
39
- var import_chunk_VBLGRBF2 = require("./chunk-VBLGRBF2.js");
37
+ var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
38
+ var import_chunk_QDT7TGYZ = require("./chunk-QDT7TGYZ.js");
39
+ var import_chunk_WKP2TVYB = require("./chunk-WKP2TVYB.js");
40
40
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
41
41
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
42
42
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
@@ -59,12 +59,12 @@ ${detailsHeader} ${message}`;
59
59
  }).exhaustive();
60
60
  const errorMessageWithContext = `${constructedErrorMessage}
61
61
  [Context: mergeSchemas]`;
62
- super((0, import_chunk_AJALNZEH.addVersionDetailsToErrorMessage)(errorMessageWithContext));
62
+ super((0, import_chunk_QDT7TGYZ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
63
  this.name = "MergeSchemasError";
64
64
  }
65
65
  };
66
66
  function mergeSchemas(options) {
67
- const debugErrorType = (0, import_chunk_WSZXPLJQ.createDebugErrorType)(debug, "mergeSchemasWasm");
67
+ const debugErrorType = (0, import_chunk_TZJROXB3.createDebugErrorType)(debug, "mergeSchemasWasm");
68
68
  debug(`Using mergeSchemas Wasm`);
69
69
  const mergeSchemasEither = (0, import_function.pipe)(
70
70
  (0, import_chunk_5DBOS77Y.tryCatch)(
@@ -72,7 +72,7 @@ function mergeSchemas(options) {
72
72
  const params = JSON.stringify({
73
73
  schema: options.schemas
74
74
  });
75
- return import_chunk_VBLGRBF2.prismaSchemaWasm.merge_schemas(params);
75
+ return import_chunk_WKP2TVYB.prismaSchemaWasm.merge_schemas(params);
76
76
  },
77
77
  (e) => ({
78
78
  type: "wasm-error",
@@ -104,7 +104,7 @@ function mergeSchemas(options) {
104
104
  return panic;
105
105
  }
106
106
  const errorOutput = e.error.message;
107
- return new MergeSchemasError((0, import_chunk_WSZXPLJQ.parseQueryEngineError)({ errorOutput, reason: e.reason }));
107
+ return new MergeSchemasError((0, import_chunk_TZJROXB3.parseQueryEngineError)({ errorOutput, reason: e.reason }));
108
108
  }).exhaustive();
109
109
  throw error;
110
110
  }
@@ -16,20 +16,20 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_PNYEHZAU_exports = {};
20
- __export(chunk_PNYEHZAU_exports, {
19
+ var chunk_656EKQL7_exports = {};
20
+ __export(chunk_656EKQL7_exports, {
21
21
  getLintWarnings: () => getLintWarnings,
22
22
  getLintWarningsAsText: () => getLintWarningsAsText,
23
23
  handleLintPanic: () => handleLintPanic,
24
24
  lintSchema: () => lintSchema,
25
25
  warningToString: () => warningToString
26
26
  });
27
- module.exports = __toCommonJS(chunk_PNYEHZAU_exports);
28
- var import_chunk_5IS5OH7Z = require("./chunk-5IS5OH7Z.js");
27
+ module.exports = __toCommonJS(chunk_656EKQL7_exports);
28
+ var import_chunk_262R2PBW = require("./chunk-262R2PBW.js");
29
29
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
30
30
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
31
31
  function lintSchema({ schemas }) {
32
- const lintResult = import_chunk_5IS5OH7Z.prismaSchemaWasm.lint(JSON.stringify(schemas));
32
+ const lintResult = import_chunk_262R2PBW.prismaSchemaWasm.lint(JSON.stringify(schemas));
33
33
  const lintDiagnostics = JSON.parse(lintResult);
34
34
  return lintDiagnostics;
35
35
  }
@@ -26,17 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_OWVQILDA_exports = {};
30
- __export(chunk_OWVQILDA_exports, {
29
+ var chunk_65XSDXPY_exports = {};
30
+ __export(chunk_65XSDXPY_exports, {
31
31
  ValidateError: () => ValidateError,
32
32
  validate: () => validate
33
33
  });
34
- module.exports = __toCommonJS(chunk_OWVQILDA_exports);
35
- var import_chunk_WSZXPLJQ = require("./chunk-WSZXPLJQ.js");
36
- var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
34
+ module.exports = __toCommonJS(chunk_65XSDXPY_exports);
35
+ var import_chunk_TZJROXB3 = require("./chunk-TZJROXB3.js");
37
36
  var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
38
- var import_chunk_AJALNZEH = require("./chunk-AJALNZEH.js");
39
- var import_chunk_VBLGRBF2 = require("./chunk-VBLGRBF2.js");
37
+ var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
38
+ var import_chunk_QDT7TGYZ = require("./chunk-QDT7TGYZ.js");
39
+ var import_chunk_WKP2TVYB = require("./chunk-WKP2TVYB.js");
40
40
  var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
41
41
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
42
42
  var import_chunk_LMVSIVKQ = require("./chunk-LMVSIVKQ.js");
@@ -59,25 +59,25 @@ ${detailsHeader} ${message}`;
59
59
  }).exhaustive();
60
60
  const errorMessageWithContext = `${constructedErrorMessage}
61
61
  [Context: validate]`;
62
- super((0, import_chunk_AJALNZEH.addVersionDetailsToErrorMessage)(errorMessageWithContext));
62
+ super((0, import_chunk_QDT7TGYZ.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
63
  this.name = "ValidateError";
64
64
  }
65
65
  };
66
66
  function validate(options) {
67
- const debugErrorType = (0, import_chunk_WSZXPLJQ.createDebugErrorType)(debug, "validateWasm");
67
+ const debugErrorType = (0, import_chunk_TZJROXB3.createDebugErrorType)(debug, "validateWasm");
68
68
  debug(`Using validate Wasm`);
69
69
  const validateEither = (0, import_function.pipe)(
70
70
  (0, import_chunk_5DBOS77Y.tryCatch)(
71
71
  () => {
72
- if (process.env.FORCE_PANIC_GET_DMMF) {
72
+ if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
73
73
  debug("Triggering a Rust panic...");
74
- import_chunk_VBLGRBF2.prismaSchemaWasm.debug_panic();
74
+ import_chunk_WKP2TVYB.prismaSchemaWasm.debug_panic();
75
75
  }
76
76
  const params = JSON.stringify({
77
77
  prismaSchema: options.schemas,
78
78
  noColor: Boolean(process.env.NO_COLOR)
79
79
  });
80
- import_chunk_VBLGRBF2.prismaSchemaWasm.validate(params);
80
+ import_chunk_WKP2TVYB.prismaSchemaWasm.validate(params);
81
81
  },
82
82
  (e) => ({
83
83
  type: "wasm-error",
@@ -109,7 +109,7 @@ function validate(options) {
109
109
  return panic;
110
110
  }
111
111
  const errorOutput = e.error.message;
112
- return new ValidateError((0, import_chunk_WSZXPLJQ.parseQueryEngineError)({ errorOutput, reason: e.reason }));
112
+ return new ValidateError((0, import_chunk_TZJROXB3.parseQueryEngineError)({ errorOutput, reason: e.reason }));
113
113
  }).exhaustive();
114
114
  throw error;
115
115
  }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_6TTRTZXU_exports = {};
20
+ __export(chunk_6TTRTZXU_exports, {
21
+ loadLibrary: () => loadLibrary
22
+ });
23
+ module.exports = __toCommonJS(chunk_6TTRTZXU_exports);
24
+ var import_chunk_DZYINYAA = require("./chunk-DZYINYAA.js");
25
+ var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
26
+ function loadLibrary(id, platformInfo) {
27
+ try {
28
+ return (0, import_chunk_4VNS5WPM.__require)(id);
29
+ } catch (e) {
30
+ const errorMessage = (0, import_chunk_DZYINYAA.handleLibraryLoadingErrors)({
31
+ e,
32
+ platformInfo,
33
+ id
34
+ });
35
+ throw new Error(errorMessage);
36
+ }
37
+ }
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_Q5XW7CMJ_exports = {};
30
- __export(chunk_Q5XW7CMJ_exports, {
29
+ var chunk_75BIJ5PX_exports = {};
30
+ __export(chunk_75BIJ5PX_exports, {
31
31
  createDirIfNotExists: () => createDirIfNotExists2,
32
32
  fs_functional_exports: () => fs_functional_exports,
33
33
  getFilesInDir: () => getFilesInDir2,
@@ -37,8 +37,8 @@ __export(chunk_Q5XW7CMJ_exports, {
37
37
  removeFile: () => removeFile,
38
38
  writeFile: () => writeFile2
39
39
  });
40
- module.exports = __toCommonJS(chunk_Q5XW7CMJ_exports);
41
- var import_chunk_5BRXEOYH = require("./chunk-5BRXEOYH.js");
40
+ module.exports = __toCommonJS(chunk_75BIJ5PX_exports);
41
+ var import_chunk_TQFONRJP = require("./chunk-TQFONRJP.js");
42
42
  var import_chunk_R6QH57HZ = require("./chunk-R6QH57HZ.js");
43
43
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
44
44
  var import_promises = __toESM(require("fs/promises"));
@@ -3981,13 +3981,13 @@ var fs_functional_exports = {};
3981
3981
  });
3982
3982
  var import_function = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_R6QH57HZ.require_function)());
3983
3983
  var TE = (0, import_chunk_4VNS5WPM.__toESM)(require_TaskEither());
3984
- var createDirIfNotExists2 = (dir) => TE.tryCatch(() => (0, import_chunk_5BRXEOYH.createDirIfNotExists)(dir), createTaggedSystemError("fs-create-dir", { dir }));
3985
- var writeFile2 = (params) => TE.tryCatch(() => (0, import_chunk_5BRXEOYH.writeFile)(params), createTaggedSystemError("fs-write-file", params));
3986
- var removeEmptyDirs2 = (dir) => TE.tryCatch(() => (0, import_chunk_5BRXEOYH.removeEmptyDirs)(dir), createTaggedSystemError("fs-remove-empty-dirs", { dir }));
3984
+ var createDirIfNotExists2 = (dir) => TE.tryCatch(() => (0, import_chunk_TQFONRJP.createDirIfNotExists)(dir), createTaggedSystemError("fs-create-dir", { dir }));
3985
+ var writeFile2 = (params) => TE.tryCatch(() => (0, import_chunk_TQFONRJP.writeFile)(params), createTaggedSystemError("fs-write-file", params));
3986
+ var removeEmptyDirs2 = (dir) => TE.tryCatch(() => (0, import_chunk_TQFONRJP.removeEmptyDirs)(dir), createTaggedSystemError("fs-remove-empty-dirs", { dir }));
3987
3987
  var removeDir = (dir) => (0, import_function.pipe)(TE.tryCatch(() => import_promises.default.rm(dir, { recursive: true }), createTaggedSystemError("fs-remove-dir", { dir })));
3988
3988
  var removeFile = (filePath) => (0, import_function.pipe)(TE.tryCatch(() => import_promises.default.unlink(filePath), createTaggedSystemError("fs-remove-file", { filePath })));
3989
- var getNestedFoldersInDir2 = (dir) => () => (0, import_chunk_5BRXEOYH.getNestedFoldersInDir)(dir);
3990
- var getFilesInDir2 = (dir, pattern = "**") => () => (0, import_chunk_5BRXEOYH.getFilesInDir)(dir, pattern);
3989
+ var getNestedFoldersInDir2 = (dir) => () => (0, import_chunk_TQFONRJP.getNestedFoldersInDir)(dir);
3990
+ var getFilesInDir2 = (dir, pattern = "**") => () => (0, import_chunk_TQFONRJP.getFilesInDir)(dir, pattern);
3991
3991
  function createTaggedSystemError(type, meta) {
3992
3992
  return (e) => ({
3993
3993
  type,
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_DXWYZA7B_exports = {};
20
- __export(chunk_DXWYZA7B_exports, {
19
+ var chunk_7QC5VORA_exports = {};
20
+ __export(chunk_7QC5VORA_exports, {
21
21
  missingDatasource: () => missingDatasource
22
22
  });
23
- module.exports = __toCommonJS(chunk_DXWYZA7B_exports);
23
+ module.exports = __toCommonJS(chunk_7QC5VORA_exports);
24
24
  var import_chunk_I6WLABB2 = require("./chunk-I6WLABB2.js");
25
25
  var import_chunk_TQCLUNM2 = require("./chunk-TQCLUNM2.js");
26
26
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
@@ -31,6 +31,7 @@ You can define a datasource like this:
31
31
  ${(0, import_chunk_PG5FDKSF.bold)(
32
32
  (0, import_chunk_TQCLUNM2.highlightDatamodel)(`datasource db {
33
33
  provider = "postgresql"
34
+ url = env("DB_URL")
34
35
  }`)
35
36
  )}
36
37
 
@@ -16,17 +16,17 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_5YZKJGXV_exports = {};
20
- __export(chunk_5YZKJGXV_exports, {
19
+ var chunk_7QKLIARO_exports = {};
20
+ __export(chunk_7QKLIARO_exports, {
21
21
  require_package: () => require_package
22
22
  });
23
- module.exports = __toCommonJS(chunk_5YZKJGXV_exports);
23
+ module.exports = __toCommonJS(chunk_7QKLIARO_exports);
24
24
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
25
25
  var require_package = (0, import_chunk_4VNS5WPM.__commonJS)({
26
26
  "package.json"(exports, module2) {
27
27
  module2.exports = {
28
28
  name: "@prisma/internals",
29
- version: "7.2.0-integration-engines-7-2-0-3-aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab.1",
29
+ version: "7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1",
30
30
  description: "This package is intended for Prisma's internal use",
31
31
  main: "dist/index.js",
32
32
  types: "dist/index.d.ts",
@@ -48,6 +48,7 @@ var require_package = (0, import_chunk_4VNS5WPM.__commonJS)({
48
48
  files: [
49
49
  "README.md",
50
50
  "dist",
51
+ "!**/libquery_engine*",
51
52
  "!dist/get-generators/engines/*",
52
53
  "scripts"
53
54
  ],
@@ -58,11 +59,12 @@ var require_package = (0, import_chunk_4VNS5WPM.__commonJS)({
58
59
  "@swc/jest": "0.2.37",
59
60
  "@types/babel__helper-validator-identifier": "7.15.2",
60
61
  "@types/jest": "29.5.14",
61
- "@types/node": "~20.19.24",
62
+ "@types/node": "18.19.76",
62
63
  "@types/resolve": "1.20.6",
63
64
  archiver: "6.0.2",
64
65
  "checkpoint-client": "1.1.33",
65
66
  "cli-truncate": "4.0.0",
67
+ dotenv: "16.5.0",
66
68
  empathic: "2.0.0",
67
69
  "escape-string-regexp": "5.0.0",
68
70
  execa: "8.0.1",
@@ -107,14 +109,14 @@ var require_package = (0, import_chunk_4VNS5WPM.__commonJS)({
107
109
  "@prisma/generator": "workspace:*",
108
110
  "@prisma/generator-helper": "workspace:*",
109
111
  "@prisma/get-platform": "workspace:*",
110
- "@prisma/prisma-schema-wasm": "7.2.0-3.aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab",
111
- "@prisma/schema-engine-wasm": "7.2.0-3.aqrln-zpupkzknszlw-04d61c41ec1a025cabe14093fa3121a5f45040ab",
112
+ "@prisma/prisma-schema-wasm": "7.1.1-3.c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
113
+ "@prisma/schema-engine-wasm": "7.1.1-3.c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
112
114
  "@prisma/schema-files-loader": "workspace:*",
113
115
  arg: "5.0.2",
114
116
  prompts: "2.4.2"
115
117
  },
116
118
  peerDependencies: {
117
- typescript: ">=5.4.0"
119
+ typescript: ">=5.1.0"
118
120
  },
119
121
  peerDependenciesMeta: {
120
122
  typescript: {
@@ -16,13 +16,13 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_CQVWHHIJ_exports = {};
20
- __export(chunk_CQVWHHIJ_exports, {
19
+ var chunk_AX5N26KG_exports = {};
20
+ __export(chunk_AX5N26KG_exports, {
21
21
  missingGeneratorMessage: () => missingGeneratorMessage,
22
22
  missingModelMessage: () => missingModelMessage,
23
23
  missingModelMessageMongoDB: () => missingModelMessageMongoDB
24
24
  });
25
- module.exports = __toCommonJS(chunk_CQVWHHIJ_exports);
25
+ module.exports = __toCommonJS(chunk_AX5N26KG_exports);
26
26
  var import_chunk_I6WLABB2 = require("./chunk-I6WLABB2.js");
27
27
  var import_chunk_TQCLUNM2 = require("./chunk-TQCLUNM2.js");
28
28
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
@@ -30,18 +30,13 @@ var missingGeneratorMessage = `
30
30
  ${(0, import_chunk_PG5FDKSF.blue)("info")} You don't have any generators defined in your ${(0, import_chunk_PG5FDKSF.bold)(
31
31
  "schema.prisma"
32
32
  )}, so nothing will be generated.
33
- Add the Prisma Client generator like this:
33
+ You can define them like this:
34
34
 
35
35
  ${(0, import_chunk_PG5FDKSF.bold)(
36
36
  (0, import_chunk_TQCLUNM2.highlightDatamodel)(`generator client {
37
- provider = "prisma-client"
38
- output = "../src/generated/prisma"
37
+ provider = "prisma-client-js"
39
38
  }`)
40
- )}
41
-
42
- More information in our documentation:
43
- ${(0, import_chunk_I6WLABB2.link)("https://pris.ly/d/prisma-schema")}
44
- `;
39
+ )}`;
45
40
  var missingModelMessage = `
46
41
  You don't have any ${(0, import_chunk_PG5FDKSF.bold)("models")} defined in your ${(0, import_chunk_PG5FDKSF.bold)(
47
42
  "schema.prisma"
@@ -26,15 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_NBWRGVYR_exports = {};
30
- __export(chunk_NBWRGVYR_exports, {
29
+ var chunk_BCQZ6JQE_exports = {};
30
+ __export(chunk_BCQZ6JQE_exports, {
31
31
  inferDirectoryConfig: () => inferDirectoryConfig
32
32
  });
33
- module.exports = __toCommonJS(chunk_NBWRGVYR_exports);
33
+ module.exports = __toCommonJS(chunk_BCQZ6JQE_exports);
34
34
  var import_node_path = __toESM(require("node:path"));
35
35
  function inferDirectoryConfig(schemaContext, config, cwd = process.cwd()) {
36
36
  const baseDir = (
37
- // If no primary datasource exists we use the schemaRootDir.
37
+ // All default paths are relative to the `schema.prisma` file that contains the primary datasource.
38
+ // That schema file should usually be the users "root" aka main schema file.
39
+ schemaContext?.primaryDatasourceDirectory ?? // If no primary datasource exists we use the schemaRootDir.
38
40
  // `schemaRootDir` is either the directory the user supplied as schemaPath or the directory the single schema file is in.
39
41
  schemaContext?.schemaRootDir ?? // Should also that not be defined because there is no schema yet we fallback to CWD + `/prisma`.
40
42
  import_node_path.default.join(cwd, "prisma")
@@ -26,14 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_BXIKQUP5_exports = {};
30
- __export(chunk_BXIKQUP5_exports, {
29
+ var chunk_BVJP43JS_exports = {};
30
+ __export(chunk_BVJP43JS_exports, {
31
31
  getPackedPackage: () => getPackedPackage,
32
32
  require_p_map: () => require_p_map
33
33
  });
34
- module.exports = __toCommonJS(chunk_BXIKQUP5_exports);
34
+ module.exports = __toCommonJS(chunk_BVJP43JS_exports);
35
35
  var import_chunk_KDP6C3CB = require("./chunk-KDP6C3CB.js");
36
- var import_chunk_YV4IFLW4 = require("./chunk-YV4IFLW4.js");
36
+ var import_chunk_JOIIWB3U = require("./chunk-JOIIWB3U.js");
37
37
  var import_chunk_UMM35VP5 = require("./chunk-UMM35VP5.js");
38
38
  var import_chunk_5VQNKCKW = require("./chunk-5VQNKCKW.js");
39
39
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
@@ -6254,9 +6254,9 @@ var require_del = (0, import_chunk_4VNS5WPM.__commonJS)({
6254
6254
  "use strict";
6255
6255
  var { promisify } = (0, import_chunk_4VNS5WPM.__require)("util");
6256
6256
  var path2 = (0, import_chunk_4VNS5WPM.__require)("path");
6257
- var globby = (0, import_chunk_YV4IFLW4.require_globby)();
6258
- var isGlob = (0, import_chunk_YV4IFLW4.require_is_glob)();
6259
- var slash = (0, import_chunk_YV4IFLW4.require_slash)();
6257
+ var globby = (0, import_chunk_JOIIWB3U.require_globby)();
6258
+ var isGlob = (0, import_chunk_JOIIWB3U.require_is_glob)();
6259
+ var slash = (0, import_chunk_JOIIWB3U.require_slash)();
6260
6260
  var gracefulFs = require_graceful_fs();
6261
6261
  var isPathCwd = require_is_path_cwd();
6262
6262
  var isPathInside = require_is_path_inside();
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_D4VDA2TZ_exports = {};
30
+ __export(chunk_D4VDA2TZ_exports, {
31
+ locateLocalCloudflareD1: () => locateLocalCloudflareD1
32
+ });
33
+ module.exports = __toCommonJS(chunk_D4VDA2TZ_exports);
34
+ var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
35
+ var import_chunk_JOIIWB3U = require("./chunk-JOIIWB3U.js");
36
+ var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
37
+ var import_node_path = __toESM(require("node:path"));
38
+ var import_node_process = __toESM(require("node:process"));
39
+ var import_fast_glob = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_JOIIWB3U.require_out)());
40
+ var import_globby = (0, import_chunk_4VNS5WPM.__toESM)((0, import_chunk_JOIIWB3U.require_globby)());
41
+ var defaultD1DirPath = import_node_path.default.join(".wrangler", "state", "v3", "d1", "miniflare-D1DatabaseObject");
42
+ async function locateLocalCloudflareD1({ arg }) {
43
+ const cwd = import_node_process.default.cwd();
44
+ const d1DirPath = import_node_path.default.posix.join(cwd, defaultD1DirPath);
45
+ const pathConverted = (0, import_fast_glob.convertPathToPattern)(d1DirPath);
46
+ const d1Databases = await (0, import_globby.default)(import_node_path.default.posix.join(pathConverted, "*.sqlite"), {});
47
+ if (d1Databases.length === 0) {
48
+ throw new Error(
49
+ `No Cloudflare D1 databases found in ${defaultD1DirPath}. Did you run \`wrangler d1 create <DATABASE_NAME>\` and \`wrangler dev\`?`
50
+ );
51
+ }
52
+ if (d1Databases.length > 1) {
53
+ const { originalArg, recommendedArg } = (0, import_chunk_XKZ6CBLA.z)(arg).with("--to-local-d1", (originalArg2) => ({
54
+ originalArg: originalArg2,
55
+ recommendedArg: "--to-url file:"
56
+ })).with("--from-local-d1", (originalArg2) => ({
57
+ originalArg: originalArg2,
58
+ recommendedArg: "--from-url file:"
59
+ })).exhaustive();
60
+ throw new Error(
61
+ `Multiple Cloudflare D1 databases found in ${defaultD1DirPath}. Please manually specify the local D1 database with \`${recommendedArg}\`, without using the \`${originalArg}\` flag.`
62
+ );
63
+ }
64
+ const d1Database = d1Databases[0];
65
+ return d1Database;
66
+ }