@prisma/config 6.14.0-dev.4 → 6.14.0-dev.41

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.d.ts CHANGED
@@ -112,7 +112,102 @@ declare type EnumsConfigShape = {
112
112
  external?: string[];
113
113
  };
114
114
 
115
- declare type Error_2 = {
115
+ declare type Error_2 = MappedError & {
116
+ originalCode?: string;
117
+ originalMessage?: string;
118
+ };
119
+
120
+ declare type ErrorCapturingFunction<T> = T extends (...args: infer A) => Promise<infer R> ? (...args: A) => Promise<Result<ErrorCapturingInterface<R>>> : T extends (...args: infer A) => infer R ? (...args: A) => Result<ErrorCapturingInterface<R>> : T;
121
+
122
+ declare type ErrorCapturingInterface<T> = {
123
+ [K in keyof T]: ErrorCapturingFunction<T[K]>;
124
+ };
125
+
126
+ declare interface ErrorCapturingSqlMigrationAwareDriverAdapterFactory extends ErrorCapturingInterface<SqlMigrationAwareDriverAdapterFactory> {
127
+ readonly errorRegistry: ErrorRegistry;
128
+ }
129
+
130
+ declare type ErrorRecord = {
131
+ error: unknown;
132
+ };
133
+
134
+ declare interface ErrorRegistry {
135
+ consumeError(id: number): ErrorRecord | undefined;
136
+ }
137
+
138
+ declare type ExperimentalConfig = {
139
+ /**
140
+ * Enable experimental adapter support.
141
+ */
142
+ adapter?: boolean;
143
+ /**
144
+ * Enable experimental Prisma Studio features.
145
+ */
146
+ studio?: boolean;
147
+ /**
148
+ * Enable experimental external tables support.
149
+ */
150
+ externalTables?: boolean;
151
+ };
152
+
153
+ export declare type InjectFormatters = {
154
+ dim: (data: string) => string;
155
+ log: (data: string) => void;
156
+ warn: (data: string) => void;
157
+ link: (data: string) => string;
158
+ };
159
+
160
+ declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
161
+
162
+ /**
163
+ * Load a Prisma config file from the given directory.
164
+ * This function may fail, but it will never throw.
165
+ * The possible error is returned in the result object, so the caller can handle it as needed.
166
+ */
167
+ export declare function loadConfigFromFile({ configFile, configRoot, }: LoadConfigFromFileInput): Promise<ConfigFromFile>;
168
+
169
+ export declare type LoadConfigFromFileError = {
170
+ /**
171
+ * The config file was not found at the specified path.
172
+ */
173
+ _tag: 'ConfigFileNotFound';
174
+ } | {
175
+ _tag: 'ConfigLoadError';
176
+ error: Error;
177
+ } | {
178
+ _tag: 'ConfigFileSyntaxError';
179
+ error: Error;
180
+ } | {
181
+ _tag: 'UnknownError';
182
+ error: Error;
183
+ };
184
+
185
+ declare type LoadConfigFromFileInput = {
186
+ /**
187
+ * The path to the config file to load. If not provided, we will attempt to find a config file in the `configRoot` directory.
188
+ */
189
+ configFile?: string;
190
+ /**
191
+ * The directory to search for the config file in. Defaults to the current working directory.
192
+ */
193
+ configRoot?: string;
194
+ };
195
+
196
+ /**
197
+ * User's Prisma configuration should live in `prisma.config.ts` instead of `package.json#prisma`.
198
+ * See: https://pris.ly/prisma-config.
199
+ *
200
+ * This function returns `null` if no `package.json` is found, or if the `prisma` property is not defined therein.
201
+ *
202
+ * TODO: remove in Prisma 7.
203
+ * @deprecated
204
+ */
205
+ export declare function loadConfigFromPackageJson(cwd?: string): Promise<{
206
+ config: PrismaConfigPackageJson;
207
+ loadedFromFile: string;
208
+ } | null>;
209
+
210
+ declare type MappedError = {
116
211
  kind: 'GenericJs';
117
212
  id: number;
118
213
  } | {
@@ -222,96 +317,6 @@ declare type Error_2 = {
222
317
  message: string;
223
318
  };
224
319
 
225
- declare type ErrorCapturingFunction<T> = T extends (...args: infer A) => Promise<infer R> ? (...args: A) => Promise<Result<ErrorCapturingInterface<R>>> : T extends (...args: infer A) => infer R ? (...args: A) => Result<ErrorCapturingInterface<R>> : T;
226
-
227
- declare type ErrorCapturingInterface<T> = {
228
- [K in keyof T]: ErrorCapturingFunction<T[K]>;
229
- };
230
-
231
- declare interface ErrorCapturingSqlMigrationAwareDriverAdapterFactory extends ErrorCapturingInterface<SqlMigrationAwareDriverAdapterFactory> {
232
- readonly errorRegistry: ErrorRegistry;
233
- }
234
-
235
- declare type ErrorRecord = {
236
- error: unknown;
237
- };
238
-
239
- declare interface ErrorRegistry {
240
- consumeError(id: number): ErrorRecord | undefined;
241
- }
242
-
243
- declare type ExperimentalConfig = {
244
- /**
245
- * Enable experimental adapter support.
246
- */
247
- adapter?: boolean;
248
- /**
249
- * Enable experimental Prisma Studio features.
250
- */
251
- studio?: boolean;
252
- /**
253
- * Enable experimental external tables support.
254
- */
255
- externalTables?: boolean;
256
- };
257
-
258
- export declare type InjectFormatters = {
259
- dim: (data: string) => string;
260
- log: (data: string) => void;
261
- warn: (data: string) => void;
262
- link: (data: string) => string;
263
- };
264
-
265
- declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
266
-
267
- /**
268
- * Load a Prisma config file from the given directory.
269
- * This function may fail, but it will never throw.
270
- * The possible error is returned in the result object, so the caller can handle it as needed.
271
- */
272
- export declare function loadConfigFromFile({ configFile, configRoot, }: LoadConfigFromFileInput): Promise<ConfigFromFile>;
273
-
274
- export declare type LoadConfigFromFileError = {
275
- /**
276
- * The config file was not found at the specified path.
277
- */
278
- _tag: 'ConfigFileNotFound';
279
- } | {
280
- _tag: 'ConfigLoadError';
281
- error: Error;
282
- } | {
283
- _tag: 'ConfigFileSyntaxError';
284
- error: Error;
285
- } | {
286
- _tag: 'UnknownError';
287
- error: Error;
288
- };
289
-
290
- declare type LoadConfigFromFileInput = {
291
- /**
292
- * The path to the config file to load. If not provided, we will attempt to find a config file in the `configRoot` directory.
293
- */
294
- configFile?: string;
295
- /**
296
- * The directory to search for the config file in. Defaults to the current working directory.
297
- */
298
- configRoot?: string;
299
- };
300
-
301
- /**
302
- * User's Prisma configuration should live in `prisma.config.ts` instead of `package.json#prisma`.
303
- * See: https://pris.ly/prisma-config.
304
- *
305
- * This function returns `null` if no `package.json` is found, or if the `prisma` property is not defined therein.
306
- *
307
- * TODO: remove in Prisma 7.
308
- * @deprecated
309
- */
310
- export declare function loadConfigFromPackageJson(cwd?: string): Promise<{
311
- config: PrismaConfigPackageJson;
312
- loadedFromFile: string;
313
- } | null>;
314
-
315
320
  declare type MigrationsConfigShape = {
316
321
  /**
317
322
  * The path to the directory where Prisma should store migration files, and look for them.
package/dist/index.js CHANGED
@@ -483,19 +483,21 @@ function defineAdapterConfig(config, configInput) {
483
483
  }
484
484
 
485
485
  // src/loadConfigFromPackageJson.ts
486
+ var import_promises = require("node:fs/promises");
486
487
  var import_node_process = __toESM(require("node:process"));
487
488
  var import_effect2 = require("effect");
489
+ var import_package = require("empathic/package");
488
490
  var PrismaConfigPackageJsonShape = import_effect2.Schema.Struct({
489
491
  schema: import_effect2.Schema.optional(import_effect2.Schema.String),
490
492
  seed: import_effect2.Schema.optional(import_effect2.Schema.NonEmptyString)
491
493
  });
492
494
  async function loadConfigFromPackageJson(cwd = import_node_process.default.cwd()) {
493
- const { readPackageUp } = await import("read-package-up");
494
- const pkgJson = await readPackageUp({ cwd, normalize: false });
495
- if (pkgJson === void 0) {
495
+ const pkgPath = (0, import_package.up)({ cwd });
496
+ if (pkgPath === void 0) {
496
497
  return null;
497
498
  }
498
- const deprecatedConfig = pkgJson.packageJson["prisma"];
499
+ const pkgJson = await (0, import_promises.readFile)(pkgPath, { encoding: "utf-8" }).then((p) => JSON.parse(p));
500
+ const deprecatedConfig = pkgJson["prisma"];
499
501
  if (deprecatedConfig === void 0) {
500
502
  return null;
501
503
  }
@@ -504,7 +506,7 @@ async function loadConfigFromPackageJson(cwd = import_node_process.default.cwd()
504
506
  }
505
507
  return {
506
508
  config: deprecatedConfig,
507
- loadedFromFile: pkgJson.path
509
+ loadedFromFile: pkgPath
508
510
  };
509
511
  }
510
512
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/config",
3
- "version": "6.14.0-dev.4",
3
+ "version": "6.14.0-dev.41",
4
4
  "description": "Internal package used to define and read Prisma configuration files",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,12 +15,12 @@
15
15
  "c12": "3.1.0",
16
16
  "deepmerge-ts": "7.1.5",
17
17
  "effect": "3.16.12",
18
- "read-package-up": "11.0.0"
18
+ "empathic": "2.0.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "vitest": "3.2.4",
22
- "@prisma/get-platform": "6.14.0-dev.4",
23
- "@prisma/driver-adapter-utils": "6.14.0-dev.4"
22
+ "@prisma/driver-adapter-utils": "6.14.0-dev.41",
23
+ "@prisma/get-platform": "6.14.0-dev.41"
24
24
  },
25
25
  "files": [
26
26
  "dist"