@prisma/internals 5.17.0-integration-show-platform-auth-token.3 → 5.17.0-integration-show-platform-auth-token.4

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 (64) hide show
  1. package/dist/{chunk-EOTOEWEG.js → chunk-2QFQJTM3.js} +16 -16
  2. package/dist/{chunk-JM6ICT4D.js → chunk-4A5ZK522.js} +3 -3
  3. package/dist/{chunk-22WWDCBL.js → chunk-5R627ZMI.js} +7 -7
  4. package/dist/chunk-5XRQ7ONW.js +122 -0
  5. package/dist/{chunk-7QFKPVEI.js → chunk-63WDBN55.js} +5 -5
  6. package/dist/{chunk-KRU3ZK3W.js → chunk-6GOPQDH2.js} +19 -19
  7. package/dist/{chunk-3CRBDWPU.js → chunk-6QMBX5PW.js} +5 -5
  8. package/dist/{chunk-HNFCHBPX.js → chunk-6WETF56C.js} +5 -5
  9. package/dist/{chunk-V3GTH2TA.js → chunk-7GBD3GZZ.js} +5 -5
  10. package/dist/{chunk-IEOLMIMU.js → chunk-ALIEF3BE.js} +15 -15
  11. package/dist/{chunk-OI5GDSG6.js → chunk-EDDYQ5ZF.js} +5 -5
  12. package/dist/{chunk-6HXOL3QF.js → chunk-EYOPVHNV.js} +28 -28
  13. package/dist/{chunk-Z2NHAREC.js → chunk-GHYJGM56.js} +5 -5
  14. package/dist/{chunk-BDXNOGJ3.js → chunk-GJMGCWTR.js} +5 -5
  15. package/dist/chunk-JTMEVPXK.js +177 -0
  16. package/dist/chunk-JUIG32DW.js +110 -0
  17. package/dist/{chunk-EKSAMZHR.js → chunk-KUMD5MBR.js} +10 -10
  18. package/dist/{chunk-IJK3NGWG.js → chunk-NCYBGN3M.js} +5 -5
  19. package/dist/chunk-PN2OFBAO.js +166 -0
  20. package/dist/{chunk-5TGIEWON.js → chunk-QCERIVWN.js} +22 -22
  21. package/dist/chunk-QIVUAERL.js +2202 -0
  22. package/dist/chunk-QL3K6JIN.js +54 -0
  23. package/dist/{chunk-SMHAELKS.js → chunk-QOTVZEEZ.js} +17 -17
  24. package/dist/{chunk-LQD72ZI2.js → chunk-QTT3VIQ3.js} +15 -15
  25. package/dist/{chunk-WPDXG7BG.js → chunk-QVK4UV4F.js} +5 -5
  26. package/dist/{chunk-4SKD6RMZ.js → chunk-TEGKDZJW.js} +6 -6
  27. package/dist/{chunk-HHHZRX5T.js → chunk-TWCV53Y5.js} +16 -16
  28. package/dist/{chunk-ZMLBYV2S.js → chunk-U3FOR7Z4.js} +24 -795
  29. package/dist/{chunk-FTFPVECN.js → chunk-UGBKVZL5.js} +5 -5
  30. package/dist/{chunk-P6T3CL5R.js → chunk-W4W3SS5M.js} +5 -5
  31. package/dist/{chunk-5SEXCYQP.js → chunk-WZYDGIB3.js} +23 -23
  32. package/dist/{chunk-BQ3ZVZLP.js → chunk-XY27KEAX.js} +22 -22
  33. package/dist/{chunk-QEMHOJR6.js → chunk-YM3CE76B.js} +147 -160
  34. package/dist/{chunk-2HYB2BOP.js → chunk-ZH2S54SA.js} +23 -23
  35. package/dist/cli/checkUnsupportedDataProxy.js +20 -20
  36. package/dist/cli/getSchema.js +25 -25
  37. package/dist/cli/hashes.js +20 -20
  38. package/dist/engine-commands/errorHelpers.js +4 -4
  39. package/dist/engine-commands/formatSchema.js +19 -19
  40. package/dist/engine-commands/getConfig.js +13 -13
  41. package/dist/engine-commands/getDmmf.js +10 -10
  42. package/dist/engine-commands/getEngineVersion.js +5 -5
  43. package/dist/engine-commands/getEnginesMetaInfo.js +8 -8
  44. package/dist/engine-commands/index.js +30 -30
  45. package/dist/engine-commands/lintSchema.js +8 -8
  46. package/dist/engine-commands/mergeSchemas.js +10 -10
  47. package/dist/engine-commands/queryEngineCommons.js +7 -7
  48. package/dist/engine-commands/validate.js +10 -10
  49. package/dist/get-generators/generatorResolvers/generatorResolvers.js +19 -19
  50. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +19 -19
  51. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.js +19 -19
  52. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +20 -20
  53. package/dist/get-generators/getGenerators.js +22 -22
  54. package/dist/index.js +57 -57
  55. package/dist/resolveBinary.js +7 -7
  56. package/dist/schemaEngineCommands.js +8 -8
  57. package/dist/sendPanic.js +19 -19
  58. package/dist/utils/fs-functional.js +9 -9
  59. package/dist/utils/getEnvPaths.js +19 -19
  60. package/dist/utils/getVersionFromPackageJson.js +3 -3
  61. package/dist/utils/handlePanic.js +19 -19
  62. package/dist/utils/loadEnvFile.js +19 -19
  63. package/dist/wasm.js +4 -4
  64. package/package.json +9 -9
@@ -0,0 +1,166 @@
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_PN2OFBAO_exports = {};
20
+ __export(chunk_PN2OFBAO_exports, {
21
+ SchemaEngineExitCode: () => SchemaEngineExitCode,
22
+ canConnectToDatabase: () => canConnectToDatabase,
23
+ createDatabase: () => createDatabase,
24
+ dropDatabase: () => dropDatabase,
25
+ execaCommand: () => execaCommand
26
+ });
27
+ module.exports = __toCommonJS(chunk_PN2OFBAO_exports);
28
+ var import_chunk_7XNZDY2V = require("./chunk-7XNZDY2V.js");
29
+ var import_chunk_GHYJGM56 = require("./chunk-GHYJGM56.js");
30
+ var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
31
+ var import_fetch_engine = require("@prisma/fetch-engine");
32
+ var import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_7XNZDY2V.require_execa)());
33
+ var SchemaEngineExitCode = /* @__PURE__ */ ((SchemaEngineExitCode2) => {
34
+ SchemaEngineExitCode2[SchemaEngineExitCode2["Success"] = 0] = "Success";
35
+ SchemaEngineExitCode2[SchemaEngineExitCode2["Error"] = 1] = "Error";
36
+ SchemaEngineExitCode2[SchemaEngineExitCode2["Panic"] = 101] = "Panic";
37
+ return SchemaEngineExitCode2;
38
+ })(SchemaEngineExitCode || {});
39
+ function parseJsonFromStderr(stderr) {
40
+ const lines = stderr.split(/\r?\n/).slice(1);
41
+ const logs = [];
42
+ for (const line of lines) {
43
+ const data = String(line);
44
+ try {
45
+ const json = JSON.parse(data);
46
+ logs.push(json);
47
+ } catch (e) {
48
+ throw new Error(`Could not parse schema engine response: ${e}`);
49
+ }
50
+ }
51
+ return logs;
52
+ }
53
+ async function canConnectToDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
54
+ if (!connectionString) {
55
+ throw new Error(
56
+ "Connection url is empty. See https://www.prisma.io/docs/reference/database-reference/connection-urls"
57
+ );
58
+ }
59
+ try {
60
+ await execaCommand({
61
+ connectionString,
62
+ cwd,
63
+ schemaEnginePath,
64
+ engineCommandName: "can-connect-to-database"
65
+ });
66
+ } catch (_e) {
67
+ const e = _e;
68
+ if (e.stderr) {
69
+ const logs = parseJsonFromStderr(e.stderr);
70
+ const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
71
+ if (error && error.fields.error_code && error.fields.message) {
72
+ return {
73
+ code: error.fields.error_code,
74
+ message: error.fields.message
75
+ };
76
+ } else {
77
+ throw new Error(`Schema engine error:
78
+ ${logs.map((log) => log.fields.message).join("\n")}`);
79
+ }
80
+ } else {
81
+ throw new Error(`Schema engine exited. ${_e}`);
82
+ }
83
+ }
84
+ return true;
85
+ }
86
+ async function createDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
87
+ const dbExists = await canConnectToDatabase(connectionString, cwd, schemaEnginePath);
88
+ if (dbExists === true) {
89
+ return false;
90
+ }
91
+ try {
92
+ await execaCommand({
93
+ connectionString,
94
+ cwd,
95
+ schemaEnginePath,
96
+ engineCommandName: "create-database"
97
+ });
98
+ return true;
99
+ } catch (_e) {
100
+ const e = _e;
101
+ if (e.stderr) {
102
+ const logs = parseJsonFromStderr(e.stderr);
103
+ const error = logs.find((it) => it.level === "ERROR" && it.target === "schema_engine::logger");
104
+ if (error && error.fields.error_code && error.fields.message) {
105
+ throw new Error(`${error.fields.error_code}: ${error.fields.message}`);
106
+ } else {
107
+ throw new Error(`Schema engine error:
108
+ ${logs.map((log) => log.fields.message).join("\n")}`);
109
+ }
110
+ } else {
111
+ throw new Error(`Schema engine exited. ${_e}`);
112
+ }
113
+ }
114
+ }
115
+ async function dropDatabase(connectionString, cwd = process.cwd(), schemaEnginePath) {
116
+ try {
117
+ const result = await execaCommand({
118
+ connectionString,
119
+ cwd,
120
+ schemaEnginePath,
121
+ engineCommandName: "drop-database"
122
+ });
123
+ if (result && result.exitCode === 0 && result.stderr.includes("The database was successfully dropped")) {
124
+ return true;
125
+ } else {
126
+ throw Error(`An error occurred during the drop: ${JSON.stringify(result, void 0, 2)}`);
127
+ }
128
+ } catch (e) {
129
+ if (e.stderr) {
130
+ const logs = parseJsonFromStderr(e.stderr);
131
+ throw new Error(`Schema engine error:
132
+ ${logs.map((log) => log.fields.message).join("\n")}`);
133
+ } else {
134
+ throw new Error(`Schema engine exited. ${e}`);
135
+ }
136
+ }
137
+ }
138
+ async function execaCommand({
139
+ connectionString,
140
+ cwd,
141
+ schemaEnginePath,
142
+ engineCommandName
143
+ }) {
144
+ schemaEnginePath = schemaEnginePath || await (0, import_chunk_GHYJGM56.resolveBinary)(import_fetch_engine.BinaryType.SchemaEngineBinary);
145
+ try {
146
+ return await (0, import_execa.default)(schemaEnginePath, ["cli", "--datasource", connectionString, engineCommandName], {
147
+ cwd,
148
+ env: {
149
+ RUST_BACKTRACE: process.env.RUST_BACKTRACE ?? "1",
150
+ RUST_LOG: process.env.RUST_LOG ?? "info"
151
+ }
152
+ });
153
+ } catch (_e) {
154
+ const e = _e;
155
+ if (e.message) {
156
+ e.message = e.message.replace(connectionString, "<REDACTED>");
157
+ }
158
+ if (e.stdout) {
159
+ e.stdout = e.stdout.replace(connectionString, "<REDACTED>");
160
+ }
161
+ if (e.stderr) {
162
+ e.stderr = e.stderr.replace(connectionString, "<REDACTED>");
163
+ }
164
+ throw e;
165
+ }
166
+ }
@@ -26,25 +26,25 @@ 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_5TGIEWON_exports = {};
30
- __export(chunk_5TGIEWON_exports, {
29
+ var chunk_QCERIVWN_exports = {};
30
+ __export(chunk_QCERIVWN_exports, {
31
31
  GetDmmfError: () => GetDmmfError,
32
32
  getDMMF: () => getDMMF
33
33
  });
34
- module.exports = __toCommonJS(chunk_5TGIEWON_exports);
34
+ module.exports = __toCommonJS(chunk_QCERIVWN_exports);
35
35
  var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
36
- var import_chunk_EKSAMZHR = require("./chunk-EKSAMZHR.js");
37
- var import_chunk_7QFKPVEI = require("./chunk-7QFKPVEI.js");
38
- var import_chunk_SMHAELKS = require("./chunk-SMHAELKS.js");
36
+ var import_chunk_KUMD5MBR = require("./chunk-KUMD5MBR.js");
37
+ var import_chunk_UGBKVZL5 = require("./chunk-UGBKVZL5.js");
38
+ var import_chunk_QOTVZEEZ = require("./chunk-QOTVZEEZ.js");
39
39
  var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
40
- var import_chunk_HNFCHBPX = require("./chunk-HNFCHBPX.js");
40
+ var import_chunk_6WETF56C = require("./chunk-6WETF56C.js");
41
41
  var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
42
- var import_chunk_JM6ICT4D = require("./chunk-JM6ICT4D.js");
42
+ var import_chunk_4A5ZK522 = require("./chunk-4A5ZK522.js");
43
43
  var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
44
44
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
45
45
  var import_debug = __toESM(require("@prisma/debug"));
46
46
  var import_fs = __toESM(require("fs"));
47
- var import_function = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_SMHAELKS.require_function)());
47
+ var import_function = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_QOTVZEEZ.require_function)());
48
48
  var debug = (0, import_debug.default)("prisma:getDMMF");
49
49
  var GetDmmfError = class extends Error {
50
50
  constructor(params) {
@@ -60,16 +60,16 @@ ${detailsHeader} ${message}`;
60
60
  }).exhaustive();
61
61
  const errorMessageWithContext = `${constructedErrorMessage}
62
62
  [Context: getDmmf]`;
63
- super((0, import_chunk_7QFKPVEI.addVersionDetailsToErrorMessage)(errorMessageWithContext));
63
+ super((0, import_chunk_UGBKVZL5.addVersionDetailsToErrorMessage)(errorMessageWithContext));
64
64
  this.name = "GetDmmfError";
65
65
  }
66
66
  };
67
67
  async function getDMMF(options) {
68
68
  warnOnDeprecatedFeatureFlag(options.previewFeatures);
69
- const debugErrorType = (0, import_chunk_EKSAMZHR.createDebugErrorType)(debug, "getDmmfWasm");
69
+ const debugErrorType = (0, import_chunk_KUMD5MBR.createDebugErrorType)(debug, "getDmmfWasm");
70
70
  debug(`Using getDmmf Wasm`);
71
71
  const dmmfPipeline = (0, import_function.pipe)(
72
- (0, import_chunk_JM6ICT4D.tryCatch2)(
72
+ (0, import_chunk_4A5ZK522.tryCatch2)(
73
73
  () => {
74
74
  if (options.datamodel) {
75
75
  debug("Using given datamodel");
@@ -85,19 +85,19 @@ async function getDMMF(options) {
85
85
  datamodelPath: options.datamodelPath
86
86
  })
87
87
  ),
88
- (0, import_chunk_JM6ICT4D.chainW2)((datamodel) => {
88
+ (0, import_chunk_4A5ZK522.chainW2)((datamodel) => {
89
89
  return (0, import_function.pipe)(
90
- (0, import_chunk_JM6ICT4D.tryCatch)(
90
+ (0, import_chunk_4A5ZK522.tryCatch)(
91
91
  () => {
92
92
  if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
93
93
  debug("Triggering a Rust panic...");
94
- import_chunk_HNFCHBPX.prismaSchemaWasm.debug_panic();
94
+ import_chunk_6WETF56C.prismaSchemaWasm.debug_panic();
95
95
  }
96
96
  const params = JSON.stringify({
97
97
  prismaSchema: datamodel,
98
98
  noColor: Boolean(process.env.NO_COLOR)
99
99
  });
100
- const data = import_chunk_HNFCHBPX.prismaSchemaWasm.get_dmmf(params);
100
+ const data = import_chunk_6WETF56C.prismaSchemaWasm.get_dmmf(params);
101
101
  return data;
102
102
  },
103
103
  (e) => ({
@@ -106,11 +106,11 @@ async function getDMMF(options) {
106
106
  error: e
107
107
  })
108
108
  ),
109
- (0, import_chunk_JM6ICT4D.map)((result) => ({ result })),
110
- (0, import_chunk_JM6ICT4D.chainW)(
109
+ (0, import_chunk_4A5ZK522.map)((result) => ({ result })),
110
+ (0, import_chunk_4A5ZK522.chainW)(
111
111
  ({ result }) => (
112
112
  // NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings
113
- (0, import_chunk_JM6ICT4D.tryCatch)(
113
+ (0, import_chunk_4A5ZK522.tryCatch)(
114
114
  () => JSON.parse(result),
115
115
  (e) => ({
116
116
  type: "parse-json",
@@ -120,12 +120,12 @@ async function getDMMF(options) {
120
120
  )
121
121
  )
122
122
  ),
123
- import_chunk_JM6ICT4D.fromEither
123
+ import_chunk_4A5ZK522.fromEither
124
124
  );
125
125
  })
126
126
  );
127
127
  const dmmfEither = await dmmfPipeline();
128
- if ((0, import_chunk_JM6ICT4D.isRight)(dmmfEither)) {
128
+ if ((0, import_chunk_4A5ZK522.isRight)(dmmfEither)) {
129
129
  debug("dmmf data retrieved without errors in getDmmf Wasm");
130
130
  const { right: data } = dmmfEither;
131
131
  return Promise.resolve(data);
@@ -158,7 +158,7 @@ Datamodel path: "${e.datamodelPath}"`,
158
158
  return panic;
159
159
  }
160
160
  const errorOutput = e.error.message;
161
- return new GetDmmfError((0, import_chunk_EKSAMZHR.parseQueryEngineError)({ errorOutput, reason: e.reason }));
161
+ return new GetDmmfError((0, import_chunk_KUMD5MBR.parseQueryEngineError)({ errorOutput, reason: e.reason }));
162
162
  }).with({ type: "parse-json" }, (e) => {
163
163
  debugErrorType(e);
164
164
  return new GetDmmfError({ _tag: "unparsed", message: e.error.message, reason: e.reason });