@prisma/config 6.5.0-integration-fix-e2e-prisma-config-2.4 → 6.5.0-integration-fix-e2e-prisma-config-2.6

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.
@@ -1,101 +1,53 @@
1
- import { Either, Schema as Shape } from 'effect';
2
- import type { ParseError } from 'effect/ParseResult';
3
- declare const PrismaSchemaConfigShape: Shape.Union<[Shape.Struct<{
1
+ export type PrismaSchemaConfigShape = {
4
2
  /**
5
3
  * Tell Prisma to use a single `.prisma` schema file.
6
4
  */
7
- kind: Shape.Literal<["single"]>;
5
+ kind: 'single';
8
6
  /**
9
7
  * The path to a single `.prisma` schema file.
10
8
  */
11
- filePath: typeof Shape.String;
12
- }>, Shape.Struct<{
9
+ filePath: string;
10
+ } | {
13
11
  /**
14
12
  * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
15
13
  */
16
- kind: Shape.Literal<["multi"]>;
14
+ kind: 'multi';
17
15
  /**
18
16
  * The path to a folder containing multiple `.prisma` schema files.
19
17
  * All of the files in this folder will be used.
20
18
  */
21
- folderPath: typeof Shape.String;
22
- }>]>;
23
- export type PrismaSchemaConfigShape = typeof PrismaSchemaConfigShape.Type;
24
- export declare const createPrismaConfigShape: () => Shape.Struct<{
19
+ folderPath: string;
20
+ };
21
+ /**
22
+ * The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
23
+ * Thanks to the branding, this type is opaque and cannot be constructed directly.
24
+ */
25
+ export type PrismaConfig = {
25
26
  /**
26
27
  * Whether features with an unstable API are enabled.
27
28
  */
28
- earlyAccess: Shape.Literal<[true]>;
29
+ earlyAccess: true;
29
30
  /**
30
31
  * The configuration for the Prisma schema file(s).
31
32
  */
32
- schema: Shape.optional<Shape.Union<[Shape.Struct<{
33
- /**
34
- * Tell Prisma to use a single `.prisma` schema file.
35
- */
36
- kind: Shape.Literal<["single"]>;
37
- /**
38
- * The path to a single `.prisma` schema file.
39
- */
40
- filePath: typeof Shape.String;
41
- }>, Shape.Struct<{
42
- /**
43
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
44
- */
45
- kind: Shape.Literal<["multi"]>;
46
- /**
47
- * The path to a folder containing multiple `.prisma` schema files.
48
- * All of the files in this folder will be used.
49
- */
50
- folderPath: typeof Shape.String;
51
- }>]>>;
52
- }>;
53
- /**
54
- * The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
55
- * Thanks to the branding, this type is opaque and cannot be constructed directly.
56
- */
57
- export type PrismaConfig = ReturnType<typeof createPrismaConfigShape>['Type'];
58
- /**
59
- * Parse a given input object to ensure it conforms to the `PrismaConfig` type Shape.
60
- * This function may fail, but it will never throw.
61
- */
62
- export declare function parsePrismaConfigShape(input: unknown): Either.Either<PrismaConfig, ParseError>;
33
+ schema?: PrismaSchemaConfigShape;
34
+ };
63
35
  declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol;
64
- export declare const createPrismaConfigInternalShape: () => Shape.Struct<{
36
+ type _PrismaConfigInternal = {
65
37
  /**
66
38
  * Whether features with an unstable API are enabled.
67
39
  */
68
- earlyAccess: Shape.Literal<[true]>;
40
+ earlyAccess: true;
69
41
  /**
70
42
  * The configuration for the Prisma schema file(s).
71
43
  */
72
- schema: Shape.optional<Shape.Union<[Shape.Struct<{
73
- /**
74
- * Tell Prisma to use a single `.prisma` schema file.
75
- */
76
- kind: Shape.Literal<["single"]>;
77
- /**
78
- * The path to a single `.prisma` schema file.
79
- */
80
- filePath: typeof Shape.String;
81
- }>, Shape.Struct<{
82
- /**
83
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
84
- */
85
- kind: Shape.Literal<["multi"]>;
86
- /**
87
- * The path to a folder containing multiple `.prisma` schema files.
88
- * All of the files in this folder will be used.
89
- */
90
- folderPath: typeof Shape.String;
91
- }>]>>;
44
+ schema?: PrismaSchemaConfigShape;
92
45
  /**
93
46
  * The path from where the config was loaded.
94
47
  * It's set to `null` if no config file was found and only default config is applied.
95
48
  */
96
- loadedFromFile: Shape.NullOr<typeof Shape.String>;
97
- }>;
98
- type _PrismaConfigInternal = ReturnType<typeof createPrismaConfigInternalShape>['Type'];
49
+ loadedFromFile: string | null;
50
+ };
99
51
  /**
100
52
  * The configuration for the Prisma Development Kit, after it has been parsed and processed
101
53
  * by the `defineConfig` function.
@@ -104,11 +56,6 @@ type _PrismaConfigInternal = ReturnType<typeof createPrismaConfigInternalShape>[
104
56
  export type PrismaConfigInternal = _PrismaConfigInternal & {
105
57
  __brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
106
58
  };
107
- /**
108
- * Parse a given input object to ensure it conforms to the `PrismaConfigInternal` type Shape.
109
- * This function may fail, but it will never throw.
110
- */
111
- export declare function parsePrismaConfigInternalShape(input: unknown): Either.Either<PrismaConfigInternal, ParseError>;
112
- type MakeArgs = Parameters<ReturnType<typeof createPrismaConfigInternalShape>['make']>[0];
113
- export declare function makePrismaConfigInternal(makeArgs: MakeArgs): PrismaConfigInternal;
59
+ export declare function makePrismaConfigInternal(makeArgs: _PrismaConfigInternal): PrismaConfigInternal;
60
+ export declare function parseDefaultExport(defaultExport: unknown): PrismaConfigInternal;
114
61
  export {};
@@ -29,11 +29,8 @@ var __privateSet = (obj, member, value3, setter) => (__accessCheck(obj, member,
29
29
  // src/PrismaConfig.ts
30
30
  var PrismaConfig_exports = {};
31
31
  __export(PrismaConfig_exports, {
32
- createPrismaConfigInternalShape: () => createPrismaConfigInternalShape,
33
- createPrismaConfigShape: () => createPrismaConfigShape,
34
32
  makePrismaConfigInternal: () => makePrismaConfigInternal,
35
- parsePrismaConfigInternalShape: () => parsePrismaConfigInternalShape,
36
- parsePrismaConfigShape: () => parsePrismaConfigShape
33
+ parseDefaultExport: () => parseDefaultExport
37
34
  });
38
35
  module.exports = __toCommonJS(PrismaConfig_exports);
39
36
 
@@ -22450,38 +22447,43 @@ var ArrayFormatterIssue = class extends (/* @__PURE__ */ Struct({
22450
22447
  })) {
22451
22448
  };
22452
22449
 
22450
+ // src/defaultConfig.ts
22451
+ function defaultConfig() {
22452
+ return makePrismaConfigInternal({
22453
+ earlyAccess: true,
22454
+ loadedFromFile: null
22455
+ });
22456
+ }
22457
+
22458
+ // src/defineConfig.ts
22459
+ var debug = Debug("prisma:config:defineConfig");
22460
+ function defineConfig(configInput) {
22461
+ const config2 = defaultConfig();
22462
+ debug("Prisma config [default]: %o", config2);
22463
+ defineSchemaConfig(config2, configInput);
22464
+ return config2;
22465
+ }
22466
+ function defineSchemaConfig(config2, configInput) {
22467
+ if (!configInput.schema) {
22468
+ return;
22469
+ }
22470
+ config2.schema = configInput.schema;
22471
+ debug("Prisma config [schema]: %o", config2.schema);
22472
+ }
22473
+
22453
22474
  // src/PrismaConfig.ts
22454
- var debug = Debug("prisma:config:PrismaConfig");
22475
+ var debug2 = Debug("prisma:config:PrismaConfig");
22455
22476
  var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22456
- /**
22457
- * Tell Prisma to use a single `.prisma` schema file.
22458
- */
22459
22477
  kind: Schema_exports.Literal("single"),
22460
- /**
22461
- * The path to a single `.prisma` schema file.
22462
- */
22463
22478
  filePath: Schema_exports.String
22464
22479
  });
22465
22480
  var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22466
- /**
22467
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
22468
- */
22469
22481
  kind: Schema_exports.Literal("multi"),
22470
- /**
22471
- * The path to a folder containing multiple `.prisma` schema files.
22472
- * All of the files in this folder will be used.
22473
- */
22474
22482
  folderPath: Schema_exports.String
22475
22483
  });
22476
22484
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22477
22485
  var createPrismaConfigShape = () => Schema_exports.Struct({
22478
- /**
22479
- * Whether features with an unstable API are enabled.
22480
- */
22481
22486
  earlyAccess: Schema_exports.Literal(true),
22482
- /**
22483
- * The configuration for the Prisma schema file(s).
22484
- */
22485
22487
  schema: Schema_exports.optional(PrismaSchemaConfigShape)
22486
22488
  });
22487
22489
  function parsePrismaConfigShape(input) {
@@ -22491,24 +22493,23 @@ function parsePrismaConfigShape(input) {
22491
22493
  }
22492
22494
  var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22493
22495
  var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22494
- /**
22495
- * Whether features with an unstable API are enabled.
22496
- */
22497
22496
  earlyAccess: Schema_exports.Literal(true),
22498
- /**
22499
- * The configuration for the Prisma schema file(s).
22500
- */
22501
22497
  schema: Schema_exports.optional(PrismaSchemaConfigShape),
22502
- /**
22503
- * The path from where the config was loaded.
22504
- * It's set to `null` if no config file was found and only default config is applied.
22505
- */
22506
22498
  loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22507
22499
  });
22500
+ function brandPrismaConfigInternal(config2) {
22501
+ Object.defineProperty(config2, "__brand", {
22502
+ value: PRISMA_CONFIG_INTERNAL_BRAND,
22503
+ writable: true,
22504
+ configurable: true,
22505
+ enumerable: false
22506
+ });
22507
+ return config2;
22508
+ }
22508
22509
  function parsePrismaConfigInternalShape(input) {
22509
- debug("Parsing PrismaConfigInternal: %o", input);
22510
+ debug2("Parsing PrismaConfigInternal: %o", input);
22510
22511
  if (typeof input === "object" && input !== null && input["__brand"] === PRISMA_CONFIG_INTERNAL_BRAND) {
22511
- debug("Short-circuit: input is already a PrismaConfigInternal object");
22512
+ debug2("Short-circuit: input is already a PrismaConfigInternal object");
22512
22513
  return Either_exports.right(input);
22513
22514
  }
22514
22515
  return pipe(
@@ -22521,23 +22522,30 @@ function parsePrismaConfigInternalShape(input) {
22521
22522
  // - https://github.com/microsoft/rushstack/issues/1308
22522
22523
  // - https://github.com/microsoft/rushstack/issues/4034
22523
22524
  // - https://github.com/microsoft/TypeScript/issues/58914
22524
- Either_exports.map((config2) => {
22525
- debug("Parsing PrismaConfigInternal succeeded, branding the output");
22526
- return { ...config2, __brand: PRISMA_CONFIG_INTERNAL_BRAND };
22527
- })
22525
+ Either_exports.map(brandPrismaConfigInternal)
22528
22526
  );
22529
22527
  }
22530
22528
  function makePrismaConfigInternal(makeArgs) {
22531
- return {
22532
- ...createPrismaConfigInternalShape().make(makeArgs),
22533
- __brand: PRISMA_CONFIG_INTERNAL_BRAND
22534
- };
22529
+ return pipe(createPrismaConfigInternalShape().make(makeArgs), brandPrismaConfigInternal);
22530
+ }
22531
+ function parseDefaultExport(defaultExport) {
22532
+ const parseResultEither = pipe(
22533
+ // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22534
+ parsePrismaConfigShape(defaultExport),
22535
+ Either_exports.map((config2) => {
22536
+ debug2("Parsed `PrismaConfig` shape: %o", config2);
22537
+ return defineConfig(config2);
22538
+ }),
22539
+ // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22540
+ Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22541
+ );
22542
+ if (Either_exports.isLeft(parseResultEither)) {
22543
+ throw parseResultEither.left;
22544
+ }
22545
+ return parseResultEither.right;
22535
22546
  }
22536
22547
  // Annotate the CommonJS export names for ESM import in node:
22537
22548
  0 && (module.exports = {
22538
- createPrismaConfigInternalShape,
22539
- createPrismaConfigShape,
22540
22549
  makePrismaConfigInternal,
22541
- parsePrismaConfigInternalShape,
22542
- parsePrismaConfigShape
22550
+ parseDefaultExport
22543
22551
  });
@@ -22331,48 +22331,31 @@ var ArrayFormatterIssue = class extends (/* @__PURE__ */ Struct({
22331
22331
  // src/PrismaConfig.ts
22332
22332
  var debug = Debug("prisma:config:PrismaConfig");
22333
22333
  var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22334
- /**
22335
- * Tell Prisma to use a single `.prisma` schema file.
22336
- */
22337
22334
  kind: Schema_exports.Literal("single"),
22338
- /**
22339
- * The path to a single `.prisma` schema file.
22340
- */
22341
22335
  filePath: Schema_exports.String
22342
22336
  });
22343
22337
  var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22344
- /**
22345
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
22346
- */
22347
22338
  kind: Schema_exports.Literal("multi"),
22348
- /**
22349
- * The path to a folder containing multiple `.prisma` schema files.
22350
- * All of the files in this folder will be used.
22351
- */
22352
22339
  folderPath: Schema_exports.String
22353
22340
  });
22354
22341
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22355
22342
  var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22356
22343
  var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22357
- /**
22358
- * Whether features with an unstable API are enabled.
22359
- */
22360
22344
  earlyAccess: Schema_exports.Literal(true),
22361
- /**
22362
- * The configuration for the Prisma schema file(s).
22363
- */
22364
22345
  schema: Schema_exports.optional(PrismaSchemaConfigShape),
22365
- /**
22366
- * The path from where the config was loaded.
22367
- * It's set to `null` if no config file was found and only default config is applied.
22368
- */
22369
22346
  loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22370
22347
  });
22348
+ function brandPrismaConfigInternal(config2) {
22349
+ Object.defineProperty(config2, "__brand", {
22350
+ value: PRISMA_CONFIG_INTERNAL_BRAND,
22351
+ writable: true,
22352
+ configurable: true,
22353
+ enumerable: false
22354
+ });
22355
+ return config2;
22356
+ }
22371
22357
  function makePrismaConfigInternal(makeArgs) {
22372
- return {
22373
- ...createPrismaConfigInternalShape().make(makeArgs),
22374
- __brand: PRISMA_CONFIG_INTERNAL_BRAND
22375
- };
22358
+ return pipe(createPrismaConfigInternalShape().make(makeArgs), brandPrismaConfigInternal);
22376
22359
  }
22377
22360
 
22378
22361
  // src/defaultConfig.ts
@@ -1,6 +1,5 @@
1
- import type { DeepMutable } from 'effect/Types';
2
1
  import { type PrismaConfigInternal } from './PrismaConfig';
3
2
  /**
4
3
  * This default config can be used as basis for unit and integration tests.
5
4
  */
6
- export declare function defaultTestConfig(): DeepMutable<PrismaConfigInternal>;
5
+ export declare function defaultTestConfig(): PrismaConfigInternal;
@@ -22331,48 +22331,31 @@ var ArrayFormatterIssue = class extends (/* @__PURE__ */ Struct({
22331
22331
  // src/PrismaConfig.ts
22332
22332
  var debug = Debug("prisma:config:PrismaConfig");
22333
22333
  var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22334
- /**
22335
- * Tell Prisma to use a single `.prisma` schema file.
22336
- */
22337
22334
  kind: Schema_exports.Literal("single"),
22338
- /**
22339
- * The path to a single `.prisma` schema file.
22340
- */
22341
22335
  filePath: Schema_exports.String
22342
22336
  });
22343
22337
  var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22344
- /**
22345
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
22346
- */
22347
22338
  kind: Schema_exports.Literal("multi"),
22348
- /**
22349
- * The path to a folder containing multiple `.prisma` schema files.
22350
- * All of the files in this folder will be used.
22351
- */
22352
22339
  folderPath: Schema_exports.String
22353
22340
  });
22354
22341
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22355
22342
  var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22356
22343
  var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22357
- /**
22358
- * Whether features with an unstable API are enabled.
22359
- */
22360
22344
  earlyAccess: Schema_exports.Literal(true),
22361
- /**
22362
- * The configuration for the Prisma schema file(s).
22363
- */
22364
22345
  schema: Schema_exports.optional(PrismaSchemaConfigShape),
22365
- /**
22366
- * The path from where the config was loaded.
22367
- * It's set to `null` if no config file was found and only default config is applied.
22368
- */
22369
22346
  loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22370
22347
  });
22348
+ function brandPrismaConfigInternal(config2) {
22349
+ Object.defineProperty(config2, "__brand", {
22350
+ value: PRISMA_CONFIG_INTERNAL_BRAND,
22351
+ writable: true,
22352
+ configurable: true,
22353
+ enumerable: false
22354
+ });
22355
+ return config2;
22356
+ }
22371
22357
  function makePrismaConfigInternal(makeArgs) {
22372
- return {
22373
- ...createPrismaConfigInternalShape().make(makeArgs),
22374
- __brand: PRISMA_CONFIG_INTERNAL_BRAND
22375
- };
22358
+ return pipe(createPrismaConfigInternalShape().make(makeArgs), brandPrismaConfigInternal);
22376
22359
  }
22377
22360
 
22378
22361
  // src/defaultTestConfig.ts
@@ -22331,48 +22331,31 @@ var ArrayFormatterIssue = class extends (/* @__PURE__ */ Struct({
22331
22331
  // src/PrismaConfig.ts
22332
22332
  var debug = Debug("prisma:config:PrismaConfig");
22333
22333
  var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22334
- /**
22335
- * Tell Prisma to use a single `.prisma` schema file.
22336
- */
22337
22334
  kind: Schema_exports.Literal("single"),
22338
- /**
22339
- * The path to a single `.prisma` schema file.
22340
- */
22341
22335
  filePath: Schema_exports.String
22342
22336
  });
22343
22337
  var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22344
- /**
22345
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
22346
- */
22347
22338
  kind: Schema_exports.Literal("multi"),
22348
- /**
22349
- * The path to a folder containing multiple `.prisma` schema files.
22350
- * All of the files in this folder will be used.
22351
- */
22352
22339
  folderPath: Schema_exports.String
22353
22340
  });
22354
22341
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22355
22342
  var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22356
22343
  var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22357
- /**
22358
- * Whether features with an unstable API are enabled.
22359
- */
22360
22344
  earlyAccess: Schema_exports.Literal(true),
22361
- /**
22362
- * The configuration for the Prisma schema file(s).
22363
- */
22364
22345
  schema: Schema_exports.optional(PrismaSchemaConfigShape),
22365
- /**
22366
- * The path from where the config was loaded.
22367
- * It's set to `null` if no config file was found and only default config is applied.
22368
- */
22369
22346
  loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22370
22347
  });
22348
+ function brandPrismaConfigInternal(config2) {
22349
+ Object.defineProperty(config2, "__brand", {
22350
+ value: PRISMA_CONFIG_INTERNAL_BRAND,
22351
+ writable: true,
22352
+ configurable: true,
22353
+ enumerable: false
22354
+ });
22355
+ return config2;
22356
+ }
22371
22357
  function makePrismaConfigInternal(makeArgs) {
22372
- return {
22373
- ...createPrismaConfigInternalShape().make(makeArgs),
22374
- __brand: PRISMA_CONFIG_INTERNAL_BRAND
22375
- };
22358
+ return pipe(createPrismaConfigInternalShape().make(makeArgs), brandPrismaConfigInternal);
22376
22359
  }
22377
22360
 
22378
22361
  // src/defaultConfig.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export { defaultConfig } from './defaultConfig';
2
1
  export { defaultTestConfig } from './defaultTestConfig';
3
2
  export { defineConfig } from './defineConfig';
4
3
  export { type ConfigFromFile, loadConfigFromFile, type LoadConfigFromFileError } from './loadConfigFromFile';
package/dist/index.js CHANGED
@@ -39,7 +39,6 @@ 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
@@ -22459,38 +22458,43 @@ var ArrayFormatterIssue = class extends (/* @__PURE__ */ Struct({
22459
22458
  })) {
22460
22459
  };
22461
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
+ return config2;
22476
+ }
22477
+ function defineSchemaConfig(config2, configInput) {
22478
+ if (!configInput.schema) {
22479
+ return;
22480
+ }
22481
+ config2.schema = configInput.schema;
22482
+ debug("Prisma config [schema]: %o", config2.schema);
22483
+ }
22484
+
22462
22485
  // src/PrismaConfig.ts
22463
- var debug = Debug("prisma:config:PrismaConfig");
22486
+ var debug2 = Debug("prisma:config:PrismaConfig");
22464
22487
  var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22465
- /**
22466
- * Tell Prisma to use a single `.prisma` schema file.
22467
- */
22468
22488
  kind: Schema_exports.Literal("single"),
22469
- /**
22470
- * The path to a single `.prisma` schema file.
22471
- */
22472
22489
  filePath: Schema_exports.String
22473
22490
  });
22474
22491
  var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22475
- /**
22476
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
22477
- */
22478
22492
  kind: Schema_exports.Literal("multi"),
22479
- /**
22480
- * The path to a folder containing multiple `.prisma` schema files.
22481
- * All of the files in this folder will be used.
22482
- */
22483
22493
  folderPath: Schema_exports.String
22484
22494
  });
22485
22495
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22486
22496
  var createPrismaConfigShape = () => Schema_exports.Struct({
22487
- /**
22488
- * Whether features with an unstable API are enabled.
22489
- */
22490
22497
  earlyAccess: Schema_exports.Literal(true),
22491
- /**
22492
- * The configuration for the Prisma schema file(s).
22493
- */
22494
22498
  schema: Schema_exports.optional(PrismaSchemaConfigShape)
22495
22499
  });
22496
22500
  function parsePrismaConfigShape(input) {
@@ -22500,24 +22504,23 @@ function parsePrismaConfigShape(input) {
22500
22504
  }
22501
22505
  var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22502
22506
  var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22503
- /**
22504
- * Whether features with an unstable API are enabled.
22505
- */
22506
22507
  earlyAccess: Schema_exports.Literal(true),
22507
- /**
22508
- * The configuration for the Prisma schema file(s).
22509
- */
22510
22508
  schema: Schema_exports.optional(PrismaSchemaConfigShape),
22511
- /**
22512
- * The path from where the config was loaded.
22513
- * It's set to `null` if no config file was found and only default config is applied.
22514
- */
22515
22509
  loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22516
22510
  });
22511
+ function brandPrismaConfigInternal(config2) {
22512
+ Object.defineProperty(config2, "__brand", {
22513
+ value: PRISMA_CONFIG_INTERNAL_BRAND,
22514
+ writable: true,
22515
+ configurable: true,
22516
+ enumerable: false
22517
+ });
22518
+ return config2;
22519
+ }
22517
22520
  function parsePrismaConfigInternalShape(input) {
22518
- debug("Parsing PrismaConfigInternal: %o", input);
22521
+ debug2("Parsing PrismaConfigInternal: %o", input);
22519
22522
  if (typeof input === "object" && input !== null && input["__brand"] === PRISMA_CONFIG_INTERNAL_BRAND) {
22520
- debug("Short-circuit: input is already a PrismaConfigInternal object");
22523
+ debug2("Short-circuit: input is already a PrismaConfigInternal object");
22521
22524
  return Either_exports.right(input);
22522
22525
  }
22523
22526
  return pipe(
@@ -22530,25 +22533,27 @@ function parsePrismaConfigInternalShape(input) {
22530
22533
  // - https://github.com/microsoft/rushstack/issues/1308
22531
22534
  // - https://github.com/microsoft/rushstack/issues/4034
22532
22535
  // - https://github.com/microsoft/TypeScript/issues/58914
22533
- Either_exports.map((config2) => {
22534
- debug("Parsing PrismaConfigInternal succeeded, branding the output");
22535
- return { ...config2, __brand: PRISMA_CONFIG_INTERNAL_BRAND };
22536
- })
22536
+ Either_exports.map(brandPrismaConfigInternal)
22537
22537
  );
22538
22538
  }
22539
22539
  function makePrismaConfigInternal(makeArgs) {
22540
- return {
22541
- ...createPrismaConfigInternalShape().make(makeArgs),
22542
- __brand: PRISMA_CONFIG_INTERNAL_BRAND
22543
- };
22540
+ return pipe(createPrismaConfigInternalShape().make(makeArgs), brandPrismaConfigInternal);
22544
22541
  }
22545
-
22546
- // src/defaultConfig.ts
22547
- function defaultConfig() {
22548
- return makePrismaConfigInternal({
22549
- earlyAccess: true,
22550
- loadedFromFile: null
22551
- });
22542
+ function parseDefaultExport(defaultExport) {
22543
+ const parseResultEither = pipe(
22544
+ // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22545
+ parsePrismaConfigShape(defaultExport),
22546
+ Either_exports.map((config2) => {
22547
+ debug2("Parsed `PrismaConfig` shape: %o", config2);
22548
+ return defineConfig(config2);
22549
+ }),
22550
+ // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22551
+ Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22552
+ );
22553
+ if (Either_exports.isLeft(parseResultEither)) {
22554
+ throw parseResultEither.left;
22555
+ }
22556
+ return parseResultEither.right;
22552
22557
  }
22553
22558
 
22554
22559
  // src/defaultTestConfig.ts
@@ -22559,22 +22564,6 @@ function defaultTestConfig() {
22559
22564
  });
22560
22565
  }
22561
22566
 
22562
- // src/defineConfig.ts
22563
- var debug2 = Debug("prisma:config:defineConfig");
22564
- function defineConfig(configInput) {
22565
- const config2 = defaultConfig();
22566
- debug2("Prisma config [default]: %o", config2);
22567
- defineSchemaConfig(config2, configInput);
22568
- return config2;
22569
- }
22570
- function defineSchemaConfig(config2, configInput) {
22571
- if (!configInput.schema) {
22572
- return;
22573
- }
22574
- config2.schema = configInput.schema;
22575
- debug2("Prisma config [schema]: %o", config2.schema);
22576
- }
22577
-
22578
22567
  // src/loadConfigFromFile.ts
22579
22568
  var import_node_fs = __toESM(require("node:fs"));
22580
22569
  var import_node_path = __toESM(require("node:path"));
@@ -22597,7 +22586,7 @@ async function loadConfigFromFile({
22597
22586
  resolvedPath = ["prisma.config.ts"].map((file) => import_node_path.default.resolve(configRoot, file)).find((file) => import_node_fs.default.existsSync(file)) ?? null;
22598
22587
  if (resolvedPath === null) {
22599
22588
  debug3(`No config file found in the current working directory %s`, configRoot);
22600
- return { resolvedPath };
22589
+ return { resolvedPath, config: defaultConfig() };
22601
22590
  }
22602
22591
  }
22603
22592
  try {
@@ -22609,29 +22598,22 @@ async function loadConfigFromFile({
22609
22598
  };
22610
22599
  }
22611
22600
  debug3(`Config file loaded in %s`, getTime());
22612
- const defaultExport = required3["default"];
22613
- const parseResultEither = pipe(
22614
- // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22615
- parsePrismaConfigShape(defaultExport),
22616
- Either_exports.map((config2) => {
22617
- debug3("Parsed `PrismaConfig` shape: %o", config2);
22618
- return defineConfig(config2);
22619
- }),
22620
- // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22621
- Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22622
- );
22623
- if (Either_exports.isLeft(parseResultEither)) {
22601
+ let defaultExport;
22602
+ try {
22603
+ defaultExport = parseDefaultExport(required3["default"]);
22604
+ } catch (e) {
22605
+ const error2 = e;
22624
22606
  return {
22625
22607
  resolvedPath,
22626
22608
  error: {
22627
22609
  _tag: "ConfigFileParseError",
22628
- error: parseResultEither.left
22610
+ error: error2
22629
22611
  }
22630
22612
  };
22631
22613
  }
22632
22614
  import_node_process.default.stdout.write(`Loaded Prisma config from "${resolvedPath}".
22633
22615
  `);
22634
- const prismaConfig = transformPathsInConfigToAbsolute(parseResultEither.right, resolvedPath);
22616
+ const prismaConfig = transformPathsInConfigToAbsolute(defaultExport, resolvedPath);
22635
22617
  return {
22636
22618
  config: {
22637
22619
  ...prismaConfig,
@@ -22697,7 +22679,6 @@ function transformPathsInConfigToAbsolute(prismaConfig, resolvedPath) {
22697
22679
  }
22698
22680
  // Annotate the CommonJS export names for ESM import in node:
22699
22681
  0 && (module.exports = {
22700
- defaultConfig,
22701
22682
  defaultTestConfig,
22702
22683
  defineConfig,
22703
22684
  loadConfigFromFile
@@ -1,5 +1,4 @@
1
- import { ParseError } from 'effect/ParseResult';
2
- import { type PrismaConfigInternal } from './defineConfig';
1
+ import type { PrismaConfigInternal } from './defineConfig';
3
2
  type LoadConfigFromFileInput = {
4
3
  /**
5
4
  * The path to the config file to load. If not provided, we will attempt to find a config file in the `configRoot` directory.
@@ -17,7 +16,7 @@ export type LoadConfigFromFileError = {
17
16
  error: Error;
18
17
  } | {
19
18
  _tag: 'ConfigFileParseError';
20
- error: ParseError;
19
+ error: Error;
21
20
  } | {
22
21
  _tag: 'UnknownError';
23
22
  error: Error;
@@ -32,7 +31,7 @@ export type ConfigFromFile = {
32
31
  error: LoadConfigFromFileError;
33
32
  } | {
34
33
  resolvedPath: null;
35
- config?: never;
34
+ config: PrismaConfigInternal;
36
35
  error?: never;
37
36
  };
38
37
  /**
@@ -22459,38 +22459,35 @@ var ArrayFormatterIssue = class extends (/* @__PURE__ */ Struct({
22459
22459
  })) {
22460
22460
  };
22461
22461
 
22462
+ // src/defineConfig.ts
22463
+ var debug = Debug("prisma:config:defineConfig");
22464
+ function defineConfig(configInput) {
22465
+ const config2 = defaultConfig();
22466
+ debug("Prisma config [default]: %o", config2);
22467
+ defineSchemaConfig(config2, configInput);
22468
+ return config2;
22469
+ }
22470
+ function defineSchemaConfig(config2, configInput) {
22471
+ if (!configInput.schema) {
22472
+ return;
22473
+ }
22474
+ config2.schema = configInput.schema;
22475
+ debug("Prisma config [schema]: %o", config2.schema);
22476
+ }
22477
+
22462
22478
  // src/PrismaConfig.ts
22463
- var debug = Debug("prisma:config:PrismaConfig");
22479
+ var debug2 = Debug("prisma:config:PrismaConfig");
22464
22480
  var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22465
- /**
22466
- * Tell Prisma to use a single `.prisma` schema file.
22467
- */
22468
22481
  kind: Schema_exports.Literal("single"),
22469
- /**
22470
- * The path to a single `.prisma` schema file.
22471
- */
22472
22482
  filePath: Schema_exports.String
22473
22483
  });
22474
22484
  var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22475
- /**
22476
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
22477
- */
22478
22485
  kind: Schema_exports.Literal("multi"),
22479
- /**
22480
- * The path to a folder containing multiple `.prisma` schema files.
22481
- * All of the files in this folder will be used.
22482
- */
22483
22486
  folderPath: Schema_exports.String
22484
22487
  });
22485
22488
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22486
22489
  var createPrismaConfigShape = () => Schema_exports.Struct({
22487
- /**
22488
- * Whether features with an unstable API are enabled.
22489
- */
22490
22490
  earlyAccess: Schema_exports.Literal(true),
22491
- /**
22492
- * The configuration for the Prisma schema file(s).
22493
- */
22494
22491
  schema: Schema_exports.optional(PrismaSchemaConfigShape)
22495
22492
  });
22496
22493
  function parsePrismaConfigShape(input) {
@@ -22500,24 +22497,23 @@ function parsePrismaConfigShape(input) {
22500
22497
  }
22501
22498
  var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22502
22499
  var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22503
- /**
22504
- * Whether features with an unstable API are enabled.
22505
- */
22506
22500
  earlyAccess: Schema_exports.Literal(true),
22507
- /**
22508
- * The configuration for the Prisma schema file(s).
22509
- */
22510
22501
  schema: Schema_exports.optional(PrismaSchemaConfigShape),
22511
- /**
22512
- * The path from where the config was loaded.
22513
- * It's set to `null` if no config file was found and only default config is applied.
22514
- */
22515
22502
  loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22516
22503
  });
22504
+ function brandPrismaConfigInternal(config2) {
22505
+ Object.defineProperty(config2, "__brand", {
22506
+ value: PRISMA_CONFIG_INTERNAL_BRAND,
22507
+ writable: true,
22508
+ configurable: true,
22509
+ enumerable: false
22510
+ });
22511
+ return config2;
22512
+ }
22517
22513
  function parsePrismaConfigInternalShape(input) {
22518
- debug("Parsing PrismaConfigInternal: %o", input);
22514
+ debug2("Parsing PrismaConfigInternal: %o", input);
22519
22515
  if (typeof input === "object" && input !== null && input["__brand"] === PRISMA_CONFIG_INTERNAL_BRAND) {
22520
- debug("Short-circuit: input is already a PrismaConfigInternal object");
22516
+ debug2("Short-circuit: input is already a PrismaConfigInternal object");
22521
22517
  return Either_exports.right(input);
22522
22518
  }
22523
22519
  return pipe(
@@ -22530,17 +22526,27 @@ function parsePrismaConfigInternalShape(input) {
22530
22526
  // - https://github.com/microsoft/rushstack/issues/1308
22531
22527
  // - https://github.com/microsoft/rushstack/issues/4034
22532
22528
  // - https://github.com/microsoft/TypeScript/issues/58914
22533
- Either_exports.map((config2) => {
22534
- debug("Parsing PrismaConfigInternal succeeded, branding the output");
22535
- return { ...config2, __brand: PRISMA_CONFIG_INTERNAL_BRAND };
22536
- })
22529
+ Either_exports.map(brandPrismaConfigInternal)
22537
22530
  );
22538
22531
  }
22539
22532
  function makePrismaConfigInternal(makeArgs) {
22540
- return {
22541
- ...createPrismaConfigInternalShape().make(makeArgs),
22542
- __brand: PRISMA_CONFIG_INTERNAL_BRAND
22543
- };
22533
+ return pipe(createPrismaConfigInternalShape().make(makeArgs), brandPrismaConfigInternal);
22534
+ }
22535
+ function parseDefaultExport(defaultExport) {
22536
+ const parseResultEither = pipe(
22537
+ // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22538
+ parsePrismaConfigShape(defaultExport),
22539
+ Either_exports.map((config2) => {
22540
+ debug2("Parsed `PrismaConfig` shape: %o", config2);
22541
+ return defineConfig(config2);
22542
+ }),
22543
+ // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22544
+ Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22545
+ );
22546
+ if (Either_exports.isLeft(parseResultEither)) {
22547
+ throw parseResultEither.left;
22548
+ }
22549
+ return parseResultEither.right;
22544
22550
  }
22545
22551
 
22546
22552
  // src/defaultConfig.ts
@@ -22551,22 +22557,6 @@ function defaultConfig() {
22551
22557
  });
22552
22558
  }
22553
22559
 
22554
- // src/defineConfig.ts
22555
- var debug2 = Debug("prisma:config:defineConfig");
22556
- function defineConfig(configInput) {
22557
- const config2 = defaultConfig();
22558
- debug2("Prisma config [default]: %o", config2);
22559
- defineSchemaConfig(config2, configInput);
22560
- return config2;
22561
- }
22562
- function defineSchemaConfig(config2, configInput) {
22563
- if (!configInput.schema) {
22564
- return;
22565
- }
22566
- config2.schema = configInput.schema;
22567
- debug2("Prisma config [schema]: %o", config2.schema);
22568
- }
22569
-
22570
22560
  // src/loadConfigFromFile.ts
22571
22561
  var debug3 = Debug("prisma:config:loadConfigFromFile");
22572
22562
  async function loadConfigFromFile({
@@ -22586,7 +22576,7 @@ async function loadConfigFromFile({
22586
22576
  resolvedPath = ["prisma.config.ts"].map((file) => import_node_path.default.resolve(configRoot, file)).find((file) => import_node_fs.default.existsSync(file)) ?? null;
22587
22577
  if (resolvedPath === null) {
22588
22578
  debug3(`No config file found in the current working directory %s`, configRoot);
22589
- return { resolvedPath };
22579
+ return { resolvedPath, config: defaultConfig() };
22590
22580
  }
22591
22581
  }
22592
22582
  try {
@@ -22598,29 +22588,22 @@ async function loadConfigFromFile({
22598
22588
  };
22599
22589
  }
22600
22590
  debug3(`Config file loaded in %s`, getTime());
22601
- const defaultExport = required3["default"];
22602
- const parseResultEither = pipe(
22603
- // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22604
- parsePrismaConfigShape(defaultExport),
22605
- Either_exports.map((config2) => {
22606
- debug3("Parsed `PrismaConfig` shape: %o", config2);
22607
- return defineConfig(config2);
22608
- }),
22609
- // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22610
- Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22611
- );
22612
- if (Either_exports.isLeft(parseResultEither)) {
22591
+ let defaultExport;
22592
+ try {
22593
+ defaultExport = parseDefaultExport(required3["default"]);
22594
+ } catch (e) {
22595
+ const error2 = e;
22613
22596
  return {
22614
22597
  resolvedPath,
22615
22598
  error: {
22616
22599
  _tag: "ConfigFileParseError",
22617
- error: parseResultEither.left
22600
+ error: error2
22618
22601
  }
22619
22602
  };
22620
22603
  }
22621
22604
  import_node_process.default.stdout.write(`Loaded Prisma config from "${resolvedPath}".
22622
22605
  `);
22623
- const prismaConfig = transformPathsInConfigToAbsolute(parseResultEither.right, resolvedPath);
22606
+ const prismaConfig = transformPathsInConfigToAbsolute(defaultExport, resolvedPath);
22624
22607
  return {
22625
22608
  config: {
22626
22609
  ...prismaConfig,
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Simplifies the type signature of a type.
3
+ * Re-exported from `effect/Types`.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * type Res = Simplify<{ a: number } & { b: number }> // { a: number; b: number; }
8
+ * ```
9
+ */
10
+ export type Simplify<A> = {
11
+ [K in keyof A]: A[K];
12
+ } extends infer B ? B : never;
package/dist/utils.js ADDED
@@ -0,0 +1,18 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/utils.ts
17
+ var utils_exports = {};
18
+ module.exports = __toCommonJS(utils_exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/config",
3
- "version": "6.5.0-integration-fix-e2e-prisma-config-2.4",
3
+ "version": "6.5.0-integration-fix-e2e-prisma-config-2.6",
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",
@@ -22,8 +22,8 @@
22
22
  "esbuild-register": "3.6.0",
23
23
  "jest": "29.7.0",
24
24
  "jest-junit": "16.0.0",
25
- "@prisma/driver-adapter-utils": "6.5.0-integration-fix-e2e-prisma-config-2.4",
26
- "@prisma/get-platform": "6.5.0-integration-fix-e2e-prisma-config-2.4"
25
+ "@prisma/driver-adapter-utils": "6.5.0-integration-fix-e2e-prisma-config-2.6",
26
+ "@prisma/get-platform": "6.5.0-integration-fix-e2e-prisma-config-2.6"
27
27
  },
28
28
  "files": [
29
29
  "dist"