@prisma/config 6.5.0-dev.8 → 6.5.0-dev.81

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.js CHANGED
@@ -39,13 +39,198 @@ var __privateSet = (obj, member, value3, setter) => (__accessCheck(obj, member,
39
39
  // src/index.ts
40
40
  var index_exports = {};
41
41
  __export(index_exports, {
42
- defaultConfig: () => defaultConfig,
43
42
  defaultTestConfig: () => defaultTestConfig,
44
43
  defineConfig: () => defineConfig,
45
44
  loadConfigFromFile: () => loadConfigFromFile
46
45
  });
47
46
  module.exports = __toCommonJS(index_exports);
48
47
 
48
+ // ../debug/dist/index.mjs
49
+ var __defProp2 = Object.defineProperty;
50
+ var __export2 = (target, all5) => {
51
+ for (var name in all5)
52
+ __defProp2(target, name, { get: all5[name], enumerable: true });
53
+ };
54
+ var colors_exports = {};
55
+ __export2(colors_exports, {
56
+ $: () => $,
57
+ bgBlack: () => bgBlack,
58
+ bgBlue: () => bgBlue,
59
+ bgCyan: () => bgCyan,
60
+ bgGreen: () => bgGreen,
61
+ bgMagenta: () => bgMagenta,
62
+ bgRed: () => bgRed,
63
+ bgWhite: () => bgWhite,
64
+ bgYellow: () => bgYellow,
65
+ black: () => black,
66
+ blue: () => blue,
67
+ bold: () => bold,
68
+ cyan: () => cyan,
69
+ dim: () => dim,
70
+ gray: () => gray,
71
+ green: () => green,
72
+ grey: () => grey,
73
+ hidden: () => hidden,
74
+ inverse: () => inverse,
75
+ italic: () => italic,
76
+ magenta: () => magenta,
77
+ red: () => red,
78
+ reset: () => reset,
79
+ strikethrough: () => strikethrough,
80
+ underline: () => underline,
81
+ white: () => white,
82
+ yellow: () => yellow
83
+ });
84
+ var FORCE_COLOR;
85
+ var NODE_DISABLE_COLORS;
86
+ var NO_COLOR;
87
+ var TERM;
88
+ var isTTY = true;
89
+ if (typeof process !== "undefined") {
90
+ ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
91
+ isTTY = process.stdout && process.stdout.isTTY;
92
+ }
93
+ var $ = {
94
+ enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
95
+ };
96
+ function init(x, y) {
97
+ let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
98
+ let open = `\x1B[${x}m`, close2 = `\x1B[${y}m`;
99
+ return function(txt) {
100
+ if (!$.enabled || txt == null) return txt;
101
+ return open + (!!~("" + txt).indexOf(close2) ? txt.replace(rgx, close2 + open) : txt) + close2;
102
+ };
103
+ }
104
+ var reset = init(0, 0);
105
+ var bold = init(1, 22);
106
+ var dim = init(2, 22);
107
+ var italic = init(3, 23);
108
+ var underline = init(4, 24);
109
+ var inverse = init(7, 27);
110
+ var hidden = init(8, 28);
111
+ var strikethrough = init(9, 29);
112
+ var black = init(30, 39);
113
+ var red = init(31, 39);
114
+ var green = init(32, 39);
115
+ var yellow = init(33, 39);
116
+ var blue = init(34, 39);
117
+ var magenta = init(35, 39);
118
+ var cyan = init(36, 39);
119
+ var white = init(37, 39);
120
+ var gray = init(90, 39);
121
+ var grey = init(90, 39);
122
+ var bgBlack = init(40, 49);
123
+ var bgRed = init(41, 49);
124
+ var bgGreen = init(42, 49);
125
+ var bgYellow = init(43, 49);
126
+ var bgBlue = init(44, 49);
127
+ var bgMagenta = init(45, 49);
128
+ var bgCyan = init(46, 49);
129
+ var bgWhite = init(47, 49);
130
+ var MAX_ARGS_HISTORY = 100;
131
+ var COLORS = ["green", "yellow", "blue", "magenta", "cyan", "red"];
132
+ var argsHistory = [];
133
+ var lastTimestamp = Date.now();
134
+ var lastColor = 0;
135
+ var processEnv = typeof process !== "undefined" ? process.env : {};
136
+ globalThis.DEBUG ??= processEnv.DEBUG ?? "";
137
+ globalThis.DEBUG_COLORS ??= processEnv.DEBUG_COLORS ? processEnv.DEBUG_COLORS === "true" : true;
138
+ var topProps = {
139
+ enable(namespace) {
140
+ if (typeof namespace === "string") {
141
+ globalThis.DEBUG = namespace;
142
+ }
143
+ },
144
+ disable() {
145
+ const prev = globalThis.DEBUG;
146
+ globalThis.DEBUG = "";
147
+ return prev;
148
+ },
149
+ // this is the core logic to check if logging should happen or not
150
+ enabled(namespace) {
151
+ const listenedNamespaces = globalThis.DEBUG.split(",").map((s) => {
152
+ return s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
153
+ });
154
+ const isListened = listenedNamespaces.some((listenedNamespace) => {
155
+ if (listenedNamespace === "" || listenedNamespace[0] === "-") return false;
156
+ return namespace.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
157
+ });
158
+ const isExcluded = listenedNamespaces.some((listenedNamespace) => {
159
+ if (listenedNamespace === "" || listenedNamespace[0] !== "-") return false;
160
+ return namespace.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
161
+ });
162
+ return isListened && !isExcluded;
163
+ },
164
+ log: (...args2) => {
165
+ const [namespace, format7, ...rest] = args2;
166
+ const logWithFormatting = console.warn ?? console.log;
167
+ logWithFormatting(`${namespace} ${format7}`, ...rest);
168
+ },
169
+ formatters: {}
170
+ // not implemented
171
+ };
172
+ function debugCreate(namespace) {
173
+ const instanceProps = {
174
+ color: COLORS[lastColor++ % COLORS.length],
175
+ enabled: topProps.enabled(namespace),
176
+ namespace,
177
+ log: topProps.log,
178
+ extend: () => {
179
+ }
180
+ // not implemented
181
+ };
182
+ const debugCall = (...args2) => {
183
+ const { enabled: enabled2, namespace: namespace2, color, log } = instanceProps;
184
+ if (args2.length !== 0) {
185
+ argsHistory.push([namespace2, ...args2]);
186
+ }
187
+ if (argsHistory.length > MAX_ARGS_HISTORY) {
188
+ argsHistory.shift();
189
+ }
190
+ if (topProps.enabled(namespace2) || enabled2) {
191
+ const stringArgs = args2.map((arg) => {
192
+ if (typeof arg === "string") {
193
+ return arg;
194
+ }
195
+ return safeStringify(arg);
196
+ });
197
+ const ms = `+${Date.now() - lastTimestamp}ms`;
198
+ lastTimestamp = Date.now();
199
+ if (globalThis.DEBUG_COLORS) {
200
+ log(colors_exports[color](bold(namespace2)), ...stringArgs, colors_exports[color](ms));
201
+ } else {
202
+ log(namespace2, ...stringArgs, ms);
203
+ }
204
+ }
205
+ };
206
+ return new Proxy(debugCall, {
207
+ get: (_, prop) => instanceProps[prop],
208
+ set: (_, prop, value3) => instanceProps[prop] = value3
209
+ });
210
+ }
211
+ var Debug = new Proxy(debugCreate, {
212
+ get: (_, prop) => topProps[prop],
213
+ set: (_, prop, value3) => topProps[prop] = value3
214
+ });
215
+ function safeStringify(value3, indent = 2) {
216
+ const cache = /* @__PURE__ */ new Set();
217
+ return JSON.stringify(
218
+ value3,
219
+ (key, value22) => {
220
+ if (typeof value22 === "object" && value22 !== null) {
221
+ if (cache.has(value22)) {
222
+ return `[Circular *]`;
223
+ }
224
+ cache.add(value22);
225
+ } else if (typeof value22 === "bigint") {
226
+ return value22.toString();
227
+ }
228
+ return value22;
229
+ },
230
+ indent
231
+ );
232
+ }
233
+
49
234
  // ../../node_modules/.pnpm/effect@3.12.10/node_modules/effect/dist/esm/Function.js
50
235
  var isFunction = (input) => typeof input === "function";
51
236
  var dual = function(arity, body) {
@@ -11338,7 +11523,7 @@ var Fatal = logLevelFatal;
11338
11523
  var Error2 = logLevelError;
11339
11524
  var Warning = logLevelWarning;
11340
11525
  var Info = logLevelInfo;
11341
- var Debug = logLevelDebug;
11526
+ var Debug2 = logLevelDebug;
11342
11527
  var Trace = logLevelTrace;
11343
11528
  var None3 = logLevelNone;
11344
11529
  var Order5 = /* @__PURE__ */ pipe(Order, /* @__PURE__ */ mapInput2((level) => level.ordinal));
@@ -11348,7 +11533,7 @@ var fromLiteral = (literal2) => {
11348
11533
  case "All":
11349
11534
  return All;
11350
11535
  case "Debug":
11351
- return Debug;
11536
+ return Debug2;
11352
11537
  case "Error":
11353
11538
  return Error2;
11354
11539
  case "Fatal":
@@ -22273,290 +22458,158 @@ var ArrayFormatterIssue = class extends (/* @__PURE__ */ Struct({
22273
22458
  })) {
22274
22459
  };
22275
22460
 
22461
+ // src/defaultConfig.ts
22462
+ function defaultConfig() {
22463
+ return makePrismaConfigInternal({
22464
+ earlyAccess: true,
22465
+ loadedFromFile: null
22466
+ });
22467
+ }
22468
+
22469
+ // src/defineConfig.ts
22470
+ var debug = Debug("prisma:config:defineConfig");
22471
+ function defineConfig(configInput) {
22472
+ const config2 = defaultConfig();
22473
+ debug("Prisma config [default]: %o", config2);
22474
+ defineSchemaConfig(config2, configInput);
22475
+ defineStudioConfig(config2, configInput);
22476
+ return config2;
22477
+ }
22478
+ function defineSchemaConfig(config2, configInput) {
22479
+ if (!configInput.schema) {
22480
+ return;
22481
+ }
22482
+ config2.schema = configInput.schema;
22483
+ debug("Prisma config [schema]: %o", config2.schema);
22484
+ }
22485
+ function defineStudioConfig(config2, configInput) {
22486
+ if (!configInput.studio) {
22487
+ return;
22488
+ }
22489
+ config2.studio = {
22490
+ adapter: configInput.studio.adapter
22491
+ };
22492
+ debug("Prisma config [studio]: %o", config2.studio);
22493
+ }
22494
+
22276
22495
  // src/PrismaConfig.ts
22277
- var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22496
+ var debug2 = Debug("prisma:config:PrismaConfig");
22497
+ var adapterShape = () => Schema_exports.declare(
22498
+ (input) => {
22499
+ return input instanceof Function;
22500
+ },
22501
+ {
22502
+ identifier: "Adapter<Env>",
22503
+ encode: identity,
22504
+ decode: identity
22505
+ }
22506
+ );
22507
+ var createPrismaStudioConfigInternalShape = () => Schema_exports.Struct({
22278
22508
  /**
22279
- * Tell Prisma to use a single `.prisma` schema file.
22509
+ * Instantiates the Prisma driver adapter to use for Prisma Studio.
22280
22510
  */
22511
+ adapter: adapterShape()
22512
+ });
22513
+ var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22281
22514
  kind: Schema_exports.Literal("single"),
22282
- /**
22283
- * The path to a single `.prisma` schema file.
22284
- */
22285
22515
  filePath: Schema_exports.String
22286
22516
  });
22287
22517
  var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22288
- /**
22289
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
22290
- */
22291
22518
  kind: Schema_exports.Literal("multi"),
22292
- /**
22293
- * The path to a folder containing multiple `.prisma` schema files.
22294
- * All of the files in this folder will be used.
22295
- */
22296
22519
  folderPath: Schema_exports.String
22297
22520
  });
22298
22521
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22522
+ if (false) {
22523
+ __testPrismaSchemaConfigShapeValueA;
22524
+ __testPrismaSchemaConfigShapeValueB;
22525
+ __testPrismaStudioConfigShapeValueA;
22526
+ __testPrismaStudioConfigShapeValueB;
22527
+ }
22299
22528
  var createPrismaConfigShape = () => Schema_exports.Struct({
22300
- /**
22301
- * Whether features with an unstable API are enabled.
22302
- */
22303
22529
  earlyAccess: Schema_exports.Literal(true),
22304
- /**
22305
- * The configuration for the Prisma schema file(s).
22306
- */
22307
22530
  schema: Schema_exports.optional(PrismaSchemaConfigShape)
22308
22531
  });
22532
+ if (false) {
22533
+ __testPrismaConfigValueA;
22534
+ __testPrismaConfigValueB;
22535
+ }
22309
22536
  function parsePrismaConfigShape(input) {
22310
22537
  return Schema_exports.decodeUnknownEither(createPrismaConfigShape(), {})(input, {
22311
22538
  onExcessProperty: "error"
22312
22539
  });
22313
22540
  }
22314
- var createPrismaConfigInternalShape = () => pipe(
22315
- Schema_exports.Struct({
22316
- /**
22317
- * Whether features with an unstable API are enabled.
22318
- */
22319
- earlyAccess: Schema_exports.Literal(true),
22320
- /**
22321
- * The configuration for the Prisma schema file(s).
22322
- */
22323
- schema: Schema_exports.optional(PrismaSchemaConfigShape),
22324
- /**
22325
- * The path from where the config was loaded.
22326
- * It's set to `null` if no config file was found and only default config is applied.
22327
- */
22328
- loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22329
- }),
22330
- Schema_exports.brand("PrismaConfigInternal")
22331
- );
22332
- function parsePrismaConfigInternalShape(input) {
22333
- return Schema_exports.decodeUnknownEither(createPrismaConfigInternalShape(), {})(input, {
22334
- onExcessProperty: "error"
22335
- });
22541
+ var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22542
+ var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22543
+ earlyAccess: Schema_exports.Literal(true),
22544
+ schema: Schema_exports.optional(PrismaSchemaConfigShape),
22545
+ studio: Schema_exports.optional(createPrismaStudioConfigInternalShape()),
22546
+ loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22547
+ });
22548
+ if (false) {
22549
+ __testPrismaConfigInternalValueA;
22550
+ __testPrismaConfigInternalValueB;
22336
22551
  }
22337
-
22338
- // src/defaultConfig.ts
22339
- function defaultConfig() {
22340
- return createPrismaConfigInternalShape().make({
22341
- earlyAccess: true,
22342
- loadedFromFile: null
22552
+ function brandPrismaConfigInternal(config2) {
22553
+ Object.defineProperty(config2, "__brand", {
22554
+ value: PRISMA_CONFIG_INTERNAL_BRAND,
22555
+ writable: true,
22556
+ configurable: true,
22557
+ enumerable: false
22343
22558
  });
22559
+ return config2;
22560
+ }
22561
+ function parsePrismaConfigInternalShape(input) {
22562
+ debug2("Parsing PrismaConfigInternal: %o", input);
22563
+ if (typeof input === "object" && input !== null && input["__brand"] === PRISMA_CONFIG_INTERNAL_BRAND) {
22564
+ debug2("Short-circuit: input is already a PrismaConfigInternal object");
22565
+ return Either_exports.right(input);
22566
+ }
22567
+ return pipe(
22568
+ Schema_exports.decodeUnknownEither(createPrismaConfigInternalShape(), {})(input, {
22569
+ onExcessProperty: "error"
22570
+ }),
22571
+ // Brand the output type to make `PrismaConfigInternal` opaque, without exposing the `Effect/Brand` type
22572
+ // to the public API.
22573
+ // This is done to work around the following issues:
22574
+ // - https://github.com/microsoft/rushstack/issues/1308
22575
+ // - https://github.com/microsoft/rushstack/issues/4034
22576
+ // - https://github.com/microsoft/TypeScript/issues/58914
22577
+ Either_exports.map(brandPrismaConfigInternal)
22578
+ );
22579
+ }
22580
+ function makePrismaConfigInternal(makeArgs) {
22581
+ return pipe(createPrismaConfigInternalShape().make(makeArgs), brandPrismaConfigInternal);
22582
+ }
22583
+ function parseDefaultExport(defaultExport) {
22584
+ const parseResultEither = pipe(
22585
+ // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22586
+ parsePrismaConfigShape(defaultExport),
22587
+ Either_exports.map((config2) => {
22588
+ debug2("Parsed `PrismaConfig` shape: %o", config2);
22589
+ return defineConfig(config2);
22590
+ }),
22591
+ // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22592
+ Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22593
+ );
22594
+ if (Either_exports.isLeft(parseResultEither)) {
22595
+ throw parseResultEither.left;
22596
+ }
22597
+ return parseResultEither.right;
22344
22598
  }
22345
22599
 
22346
22600
  // src/defaultTestConfig.ts
22347
22601
  function defaultTestConfig() {
22348
- return createPrismaConfigInternalShape().make({
22602
+ return makePrismaConfigInternal({
22349
22603
  earlyAccess: true,
22350
22604
  loadedFromFile: null
22351
22605
  });
22352
22606
  }
22353
22607
 
22354
- // ../debug/dist/index.mjs
22355
- var __defProp2 = Object.defineProperty;
22356
- var __export2 = (target, all5) => {
22357
- for (var name in all5)
22358
- __defProp2(target, name, { get: all5[name], enumerable: true });
22359
- };
22360
- var colors_exports = {};
22361
- __export2(colors_exports, {
22362
- $: () => $,
22363
- bgBlack: () => bgBlack,
22364
- bgBlue: () => bgBlue,
22365
- bgCyan: () => bgCyan,
22366
- bgGreen: () => bgGreen,
22367
- bgMagenta: () => bgMagenta,
22368
- bgRed: () => bgRed,
22369
- bgWhite: () => bgWhite,
22370
- bgYellow: () => bgYellow,
22371
- black: () => black,
22372
- blue: () => blue,
22373
- bold: () => bold,
22374
- cyan: () => cyan,
22375
- dim: () => dim,
22376
- gray: () => gray,
22377
- green: () => green,
22378
- grey: () => grey,
22379
- hidden: () => hidden,
22380
- inverse: () => inverse2,
22381
- italic: () => italic,
22382
- magenta: () => magenta,
22383
- red: () => red,
22384
- reset: () => reset,
22385
- strikethrough: () => strikethrough,
22386
- underline: () => underline,
22387
- white: () => white,
22388
- yellow: () => yellow
22389
- });
22390
- var FORCE_COLOR;
22391
- var NODE_DISABLE_COLORS;
22392
- var NO_COLOR;
22393
- var TERM;
22394
- var isTTY = true;
22395
- if (typeof process !== "undefined") {
22396
- ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
22397
- isTTY = process.stdout && process.stdout.isTTY;
22398
- }
22399
- var $ = {
22400
- enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
22401
- };
22402
- function init(x, y) {
22403
- let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
22404
- let open = `\x1B[${x}m`, close2 = `\x1B[${y}m`;
22405
- return function(txt) {
22406
- if (!$.enabled || txt == null) return txt;
22407
- return open + (!!~("" + txt).indexOf(close2) ? txt.replace(rgx, close2 + open) : txt) + close2;
22408
- };
22409
- }
22410
- var reset = init(0, 0);
22411
- var bold = init(1, 22);
22412
- var dim = init(2, 22);
22413
- var italic = init(3, 23);
22414
- var underline = init(4, 24);
22415
- var inverse2 = init(7, 27);
22416
- var hidden = init(8, 28);
22417
- var strikethrough = init(9, 29);
22418
- var black = init(30, 39);
22419
- var red = init(31, 39);
22420
- var green = init(32, 39);
22421
- var yellow = init(33, 39);
22422
- var blue = init(34, 39);
22423
- var magenta = init(35, 39);
22424
- var cyan = init(36, 39);
22425
- var white = init(37, 39);
22426
- var gray = init(90, 39);
22427
- var grey = init(90, 39);
22428
- var bgBlack = init(40, 49);
22429
- var bgRed = init(41, 49);
22430
- var bgGreen = init(42, 49);
22431
- var bgYellow = init(43, 49);
22432
- var bgBlue = init(44, 49);
22433
- var bgMagenta = init(45, 49);
22434
- var bgCyan = init(46, 49);
22435
- var bgWhite = init(47, 49);
22436
- var MAX_ARGS_HISTORY = 100;
22437
- var COLORS = ["green", "yellow", "blue", "magenta", "cyan", "red"];
22438
- var argsHistory = [];
22439
- var lastTimestamp = Date.now();
22440
- var lastColor = 0;
22441
- var processEnv = typeof process !== "undefined" ? process.env : {};
22442
- globalThis.DEBUG ??= processEnv.DEBUG ?? "";
22443
- globalThis.DEBUG_COLORS ??= processEnv.DEBUG_COLORS ? processEnv.DEBUG_COLORS === "true" : true;
22444
- var topProps = {
22445
- enable(namespace) {
22446
- if (typeof namespace === "string") {
22447
- globalThis.DEBUG = namespace;
22448
- }
22449
- },
22450
- disable() {
22451
- const prev = globalThis.DEBUG;
22452
- globalThis.DEBUG = "";
22453
- return prev;
22454
- },
22455
- // this is the core logic to check if logging should happen or not
22456
- enabled(namespace) {
22457
- const listenedNamespaces = globalThis.DEBUG.split(",").map((s) => {
22458
- return s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
22459
- });
22460
- const isListened = listenedNamespaces.some((listenedNamespace) => {
22461
- if (listenedNamespace === "" || listenedNamespace[0] === "-") return false;
22462
- return namespace.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
22463
- });
22464
- const isExcluded = listenedNamespaces.some((listenedNamespace) => {
22465
- if (listenedNamespace === "" || listenedNamespace[0] !== "-") return false;
22466
- return namespace.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
22467
- });
22468
- return isListened && !isExcluded;
22469
- },
22470
- log: (...args2) => {
22471
- const [namespace, format7, ...rest] = args2;
22472
- const logWithFormatting = console.warn ?? console.log;
22473
- logWithFormatting(`${namespace} ${format7}`, ...rest);
22474
- },
22475
- formatters: {}
22476
- // not implemented
22477
- };
22478
- function debugCreate(namespace) {
22479
- const instanceProps = {
22480
- color: COLORS[lastColor++ % COLORS.length],
22481
- enabled: topProps.enabled(namespace),
22482
- namespace,
22483
- log: topProps.log,
22484
- extend: () => {
22485
- }
22486
- // not implemented
22487
- };
22488
- const debugCall = (...args2) => {
22489
- const { enabled: enabled2, namespace: namespace2, color, log } = instanceProps;
22490
- if (args2.length !== 0) {
22491
- argsHistory.push([namespace2, ...args2]);
22492
- }
22493
- if (argsHistory.length > MAX_ARGS_HISTORY) {
22494
- argsHistory.shift();
22495
- }
22496
- if (topProps.enabled(namespace2) || enabled2) {
22497
- const stringArgs = args2.map((arg) => {
22498
- if (typeof arg === "string") {
22499
- return arg;
22500
- }
22501
- return safeStringify(arg);
22502
- });
22503
- const ms = `+${Date.now() - lastTimestamp}ms`;
22504
- lastTimestamp = Date.now();
22505
- if (globalThis.DEBUG_COLORS) {
22506
- log(colors_exports[color](bold(namespace2)), ...stringArgs, colors_exports[color](ms));
22507
- } else {
22508
- log(namespace2, ...stringArgs, ms);
22509
- }
22510
- }
22511
- };
22512
- return new Proxy(debugCall, {
22513
- get: (_, prop) => instanceProps[prop],
22514
- set: (_, prop, value3) => instanceProps[prop] = value3
22515
- });
22516
- }
22517
- var Debug2 = new Proxy(debugCreate, {
22518
- get: (_, prop) => topProps[prop],
22519
- set: (_, prop, value3) => topProps[prop] = value3
22520
- });
22521
- function safeStringify(value3, indent = 2) {
22522
- const cache = /* @__PURE__ */ new Set();
22523
- return JSON.stringify(
22524
- value3,
22525
- (key, value22) => {
22526
- if (typeof value22 === "object" && value22 !== null) {
22527
- if (cache.has(value22)) {
22528
- return `[Circular *]`;
22529
- }
22530
- cache.add(value22);
22531
- } else if (typeof value22 === "bigint") {
22532
- return value22.toString();
22533
- }
22534
- return value22;
22535
- },
22536
- indent
22537
- );
22538
- }
22539
-
22540
- // src/defineConfig.ts
22541
- var debug = Debug2("prisma:config:defineConfig");
22542
- function defineConfig(configInput) {
22543
- const config2 = defaultConfig();
22544
- defineSchemaConfig(config2, configInput);
22545
- return config2;
22546
- }
22547
- function defineSchemaConfig(config2, configInput) {
22548
- if (!configInput.schema) {
22549
- return;
22550
- }
22551
- config2.schema = configInput.schema;
22552
- debug("Prisma config [schema]: %o", config2.schema);
22553
- }
22554
-
22555
22608
  // src/loadConfigFromFile.ts
22556
22609
  var import_node_fs = __toESM(require("node:fs"));
22557
22610
  var import_node_path = __toESM(require("node:path"));
22558
22611
  var import_node_process = __toESM(require("node:process"));
22559
- var debug2 = Debug2("prisma:config:loadConfigFromFile");
22612
+ var debug3 = Debug("prisma:config:loadConfigFromFile");
22560
22613
  async function loadConfigFromFile({
22561
22614
  configFile,
22562
22615
  configRoot = import_node_process.default.cwd()
@@ -22567,14 +22620,14 @@ async function loadConfigFromFile({
22567
22620
  if (configFile) {
22568
22621
  resolvedPath = import_node_path.default.resolve(configRoot, configFile);
22569
22622
  if (!import_node_fs.default.existsSync(resolvedPath)) {
22570
- debug2(`The given config file was not found at %s`, resolvedPath);
22623
+ debug3(`The given config file was not found at %s`, resolvedPath);
22571
22624
  return { resolvedPath, error: { _tag: "ConfigFileNotFound" } };
22572
22625
  }
22573
22626
  } else {
22574
22627
  resolvedPath = ["prisma.config.ts"].map((file) => import_node_path.default.resolve(configRoot, file)).find((file) => import_node_fs.default.existsSync(file)) ?? null;
22575
22628
  if (resolvedPath === null) {
22576
- debug2(`No config file found in the current working directory %s`, configRoot);
22577
- return { resolvedPath };
22629
+ debug3(`No config file found in the current working directory %s`, configRoot);
22630
+ return { resolvedPath, config: defaultConfig() };
22578
22631
  }
22579
22632
  }
22580
22633
  try {
@@ -22585,30 +22638,23 @@ async function loadConfigFromFile({
22585
22638
  error
22586
22639
  };
22587
22640
  }
22588
- debug2(`Config file loaded in %s`, getTime());
22589
- const defaultExport = required3["default"];
22590
- const parseResultEither = pipe(
22591
- // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22592
- parsePrismaConfigShape(defaultExport),
22593
- Either_exports.map((config2) => {
22594
- debug2("Parsed `PrismaConfig` shape: %o", config2);
22595
- return defineConfig(config2);
22596
- }),
22597
- // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22598
- Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22599
- );
22600
- if (Either_exports.isLeft(parseResultEither)) {
22641
+ debug3(`Config file loaded in %s`, getTime());
22642
+ let defaultExport;
22643
+ try {
22644
+ defaultExport = parseDefaultExport(required3["default"]);
22645
+ } catch (e) {
22646
+ const error2 = e;
22601
22647
  return {
22602
22648
  resolvedPath,
22603
22649
  error: {
22604
22650
  _tag: "ConfigFileParseError",
22605
- error: parseResultEither.left
22651
+ error: error2
22606
22652
  }
22607
22653
  };
22608
22654
  }
22609
22655
  import_node_process.default.stdout.write(`Loaded Prisma config from "${resolvedPath}".
22610
22656
  `);
22611
- const prismaConfig = transformPathsInConfigToAbsolute(parseResultEither.right, resolvedPath);
22657
+ const prismaConfig = transformPathsInConfigToAbsolute(defaultExport, resolvedPath);
22612
22658
  return {
22613
22659
  config: {
22614
22660
  ...prismaConfig,
@@ -22642,7 +22688,7 @@ async function requireTypeScriptFile(resolvedPath) {
22642
22688
  };
22643
22689
  } catch (e) {
22644
22690
  const error = e;
22645
- debug2("esbuild-register registration failed: %s", error.message);
22691
+ debug3("esbuild-register registration failed: %s", error.message);
22646
22692
  return {
22647
22693
  error: {
22648
22694
  _tag: "TypeScriptImportFailed",
@@ -22674,7 +22720,6 @@ function transformPathsInConfigToAbsolute(prismaConfig, resolvedPath) {
22674
22720
  }
22675
22721
  // Annotate the CommonJS export names for ESM import in node:
22676
22722
  0 && (module.exports = {
22677
- defaultConfig,
22678
22723
  defaultTestConfig,
22679
22724
  defineConfig,
22680
22725
  loadConfigFromFile