@prisma/config 6.4.0-dev.60 → 6.4.0-dev.62

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.
@@ -22,6 +22,45 @@ declare const PrismaSchemaConfigShape: Shape.Union<[Shape.Struct<{
22
22
  folderPath: typeof Shape.String;
23
23
  }>]>;
24
24
  export type PrismaSchemaConfigShape = typeof PrismaSchemaConfigShape.Type;
25
+ export declare const createPrismaConfigShape: () => Shape.Struct<{
26
+ /**
27
+ * Whether features with an unstable API are enabled.
28
+ */
29
+ earlyAccess: Shape.Literal<[true]>;
30
+ /**
31
+ * The configuration for the Prisma schema file(s).
32
+ */
33
+ schema: Shape.optional<Shape.Union<[Shape.Struct<{
34
+ /**
35
+ * Tell Prisma to use a single `.prisma` schema file.
36
+ */
37
+ kind: Shape.Literal<["single"]>;
38
+ /**
39
+ * The path to a single `.prisma` schema file.
40
+ */
41
+ filePath: typeof Shape.String;
42
+ }>, Shape.Struct<{
43
+ /**
44
+ * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
45
+ */
46
+ kind: Shape.Literal<["multi"]>;
47
+ /**
48
+ * The path to a folder containing multiple `.prisma` schema files.
49
+ * All of the files in this folder will be used.
50
+ */
51
+ folderPath: typeof Shape.String;
52
+ }>]>>;
53
+ }>;
54
+ /**
55
+ * The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
56
+ * Thanks to the branding, this type is opaque and cannot be constructed directly.
57
+ */
58
+ export type PrismaConfig = ReturnType<typeof createPrismaConfigShape>['Type'];
59
+ /**
60
+ * Parse a given input object to ensure it conforms to the `PrismaConfig` type Shape.
61
+ * This function may fail, but it will never throw.
62
+ */
63
+ export declare function parsePrismaConfigShape(input: unknown): Either<PrismaConfig, ParseError>;
25
64
  export declare const createPrismaConfigInternalShape: () => Shape.brand<Shape.Struct<{
26
65
  /**
27
66
  * Whether features with an unstable API are enabled.
@@ -63,7 +102,7 @@ export declare const createPrismaConfigInternalShape: () => Shape.brand<Shape.St
63
102
  */
64
103
  export type PrismaConfigInternal = ReturnType<typeof createPrismaConfigInternalShape>['Type'];
65
104
  /**
66
- * Parse a given input object to ensure it conforms to the `PrismaConfig` type Shape.
105
+ * Parse a given input object to ensure it conforms to the `PrismaConfigInternal` type Shape.
67
106
  * This function may fail, but it will never throw.
68
107
  */
69
108
  export declare function parsePrismaConfigInternalShape(input: unknown): Either<PrismaConfigInternal, ParseError>;
@@ -30,7 +30,9 @@ var __privateSet = (obj, member, value3, setter) => (__accessCheck(obj, member,
30
30
  var PrismaConfig_exports = {};
31
31
  __export(PrismaConfig_exports, {
32
32
  createPrismaConfigInternalShape: () => createPrismaConfigInternalShape,
33
- parsePrismaConfigInternalShape: () => parsePrismaConfigInternalShape
33
+ createPrismaConfigShape: () => createPrismaConfigShape,
34
+ parsePrismaConfigInternalShape: () => parsePrismaConfigInternalShape,
35
+ parsePrismaConfigShape: () => parsePrismaConfigShape
34
36
  });
35
37
  module.exports = __toCommonJS(PrismaConfig_exports);
36
38
 
@@ -22166,6 +22168,21 @@ var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22166
22168
  folderPath: Schema_exports.String
22167
22169
  });
22168
22170
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22171
+ var createPrismaConfigShape = () => Schema_exports.Struct({
22172
+ /**
22173
+ * Whether features with an unstable API are enabled.
22174
+ */
22175
+ earlyAccess: Schema_exports.Literal(true),
22176
+ /**
22177
+ * The configuration for the Prisma schema file(s).
22178
+ */
22179
+ schema: Schema_exports.optional(PrismaSchemaConfigShape)
22180
+ });
22181
+ function parsePrismaConfigShape(input) {
22182
+ return Schema_exports.decodeUnknownEither(createPrismaConfigShape(), {})(input, {
22183
+ onExcessProperty: "error"
22184
+ });
22185
+ }
22169
22186
  var createPrismaConfigInternalShape = () => pipe(
22170
22187
  Schema_exports.Struct({
22171
22188
  /**
@@ -22192,5 +22209,7 @@ function parsePrismaConfigInternalShape(input) {
22192
22209
  // Annotate the CommonJS export names for ESM import in node:
22193
22210
  0 && (module.exports = {
22194
22211
  createPrismaConfigInternalShape,
22195
- parsePrismaConfigInternalShape
22212
+ createPrismaConfigShape,
22213
+ parsePrismaConfigInternalShape,
22214
+ parsePrismaConfigShape
22196
22215
  });
@@ -1,19 +1,5 @@
1
- import type { PrismaConfigInternal, PrismaSchemaConfigShape } from './PrismaConfig';
1
+ import type { PrismaConfig, PrismaConfigInternal } from './PrismaConfig';
2
2
  export type { PrismaConfigInternal };
3
- /**
4
- * Define the input configuration for the Prisma Development Kit.
5
- */
6
- export type PrismaConfig = {
7
- /**
8
- * Whether to enable experimental features.
9
- * Currently, every feature is considered experimental.
10
- */
11
- earlyAccess: true;
12
- /**
13
- * The location of the Prisma schema file(s).
14
- */
15
- schema?: PrismaSchemaConfigShape;
16
- };
17
3
  /**
18
4
  * Define the configuration for the Prisma Development Kit.
19
5
  */
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { defaultConfig } from './defaultConfig';
2
2
  export { defaultTestConfig } from './defaultTestConfig';
3
3
  export { defineConfig } from './defineConfig';
4
4
  export { type ConfigFromFile, loadConfigFromFile, type LoadConfigFromFileError } from './loadConfigFromFile';
5
- export type { PrismaConfigInternal } from './PrismaConfig';
5
+ export type { PrismaConfig, PrismaConfigInternal } from './PrismaConfig';
package/dist/index.js CHANGED
@@ -22296,6 +22296,21 @@ var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22296
22296
  folderPath: Schema_exports.String
22297
22297
  });
22298
22298
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22299
+ var createPrismaConfigShape = () => Schema_exports.Struct({
22300
+ /**
22301
+ * Whether features with an unstable API are enabled.
22302
+ */
22303
+ earlyAccess: Schema_exports.Literal(true),
22304
+ /**
22305
+ * The configuration for the Prisma schema file(s).
22306
+ */
22307
+ schema: Schema_exports.optional(PrismaSchemaConfigShape)
22308
+ });
22309
+ function parsePrismaConfigShape(input) {
22310
+ return Schema_exports.decodeUnknownEither(createPrismaConfigShape(), {})(input, {
22311
+ onExcessProperty: "error"
22312
+ });
22313
+ }
22299
22314
  var createPrismaConfigInternalShape = () => pipe(
22300
22315
  Schema_exports.Struct({
22301
22316
  /**
@@ -22571,7 +22586,17 @@ async function loadConfigFromFile({
22571
22586
  };
22572
22587
  }
22573
22588
  debug2(`Config file loaded in %s`, getTime());
22574
- const parseResultEither = parsePrismaConfigInternalShape(required3["default"]);
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
+ );
22575
22600
  if (Either_exports.isLeft(parseResultEither)) {
22576
22601
  return {
22577
22602
  resolvedPath,
@@ -1,5 +1,5 @@
1
1
  import { ParseError } from 'effect/ParseResult';
2
- import type { PrismaConfigInternal } from './defineConfig';
2
+ import { type PrismaConfigInternal } from './defineConfig';
3
3
  type LoadConfigFromFileInput = {
4
4
  /**
5
5
  * The path to the config file to load. If not provided, we will attempt to find a config file in the `configRoot` directory.
@@ -22482,6 +22482,21 @@ var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22482
22482
  folderPath: Schema_exports.String
22483
22483
  });
22484
22484
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22485
+ var createPrismaConfigShape = () => Schema_exports.Struct({
22486
+ /**
22487
+ * Whether features with an unstable API are enabled.
22488
+ */
22489
+ earlyAccess: Schema_exports.Literal(true),
22490
+ /**
22491
+ * The configuration for the Prisma schema file(s).
22492
+ */
22493
+ schema: Schema_exports.optional(PrismaSchemaConfigShape)
22494
+ });
22495
+ function parsePrismaConfigShape(input) {
22496
+ return Schema_exports.decodeUnknownEither(createPrismaConfigShape(), {})(input, {
22497
+ onExcessProperty: "error"
22498
+ });
22499
+ }
22485
22500
  var createPrismaConfigInternalShape = () => pipe(
22486
22501
  Schema_exports.Struct({
22487
22502
  /**
@@ -22506,8 +22521,31 @@ function parsePrismaConfigInternalShape(input) {
22506
22521
  });
22507
22522
  }
22508
22523
 
22524
+ // src/defaultConfig.ts
22525
+ function defaultConfig() {
22526
+ return createPrismaConfigInternalShape().make({
22527
+ earlyAccess: true,
22528
+ loadedFromFile: null
22529
+ });
22530
+ }
22531
+
22532
+ // src/defineConfig.ts
22533
+ var debug = Debug("prisma:config:defineConfig");
22534
+ function defineConfig(configInput) {
22535
+ const config2 = defaultConfig();
22536
+ defineSchemaConfig(config2, configInput);
22537
+ return config2;
22538
+ }
22539
+ function defineSchemaConfig(config2, configInput) {
22540
+ if (!configInput.schema) {
22541
+ return;
22542
+ }
22543
+ config2.schema = configInput.schema;
22544
+ debug("Prisma config [schema]: %o", config2.schema);
22545
+ }
22546
+
22509
22547
  // src/loadConfigFromFile.ts
22510
- var debug = Debug("prisma:config:loadConfigFromFile");
22548
+ var debug2 = Debug("prisma:config:loadConfigFromFile");
22511
22549
  async function loadConfigFromFile({
22512
22550
  configFile,
22513
22551
  configRoot = import_node_process.default.cwd()
@@ -22518,13 +22556,13 @@ async function loadConfigFromFile({
22518
22556
  if (configFile) {
22519
22557
  resolvedPath = import_node_path.default.resolve(configRoot, configFile);
22520
22558
  if (!import_node_fs.default.existsSync(resolvedPath)) {
22521
- debug(`The given config file was not found at %s`, resolvedPath);
22559
+ debug2(`The given config file was not found at %s`, resolvedPath);
22522
22560
  return { resolvedPath, error: { _tag: "ConfigFileNotFound" } };
22523
22561
  }
22524
22562
  } else {
22525
22563
  resolvedPath = ["prisma.config.ts"].map((file) => import_node_path.default.resolve(configRoot, file)).find((file) => import_node_fs.default.existsSync(file)) ?? null;
22526
22564
  if (resolvedPath === null) {
22527
- debug(`No config file found in the current working directory %s`, configRoot);
22565
+ debug2(`No config file found in the current working directory %s`, configRoot);
22528
22566
  return { resolvedPath };
22529
22567
  }
22530
22568
  }
@@ -22536,8 +22574,18 @@ async function loadConfigFromFile({
22536
22574
  error
22537
22575
  };
22538
22576
  }
22539
- debug(`Config file loaded in %s`, getTime());
22540
- const parseResultEither = parsePrismaConfigInternalShape(required3["default"]);
22577
+ debug2(`Config file loaded in %s`, getTime());
22578
+ const defaultExport = required3["default"];
22579
+ const parseResultEither = pipe(
22580
+ // If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
22581
+ parsePrismaConfigShape(defaultExport),
22582
+ Either_exports.map((config2) => {
22583
+ debug2("Parsed `PrismaConfig` shape: %o", config2);
22584
+ return defineConfig(config2);
22585
+ }),
22586
+ // Otherwise, try to parse it as a `PrismaConfigInternal` shape.
22587
+ Either_exports.orElse(() => parsePrismaConfigInternalShape(defaultExport))
22588
+ );
22541
22589
  if (Either_exports.isLeft(parseResultEither)) {
22542
22590
  return {
22543
22591
  resolvedPath,
@@ -22583,7 +22631,7 @@ async function requireTypeScriptFile(resolvedPath) {
22583
22631
  };
22584
22632
  } catch (e) {
22585
22633
  const error = e;
22586
- debug("esbuild-register registration failed: %s", error.message);
22634
+ debug2("esbuild-register registration failed: %s", error.message);
22587
22635
  return {
22588
22636
  error: {
22589
22637
  _tag: "TypeScriptImportFailed",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/config",
3
- "version": "6.4.0-dev.60",
3
+ "version": "6.4.0-dev.62",
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",
@@ -18,8 +18,8 @@
18
18
  "esbuild-register": "3.6.0",
19
19
  "jest": "29.7.0",
20
20
  "jest-junit": "16.0.0",
21
- "@prisma/get-platform": "6.4.0-dev.60",
22
- "@prisma/driver-adapter-utils": "6.4.0-dev.60"
21
+ "@prisma/get-platform": "6.4.0-dev.62",
22
+ "@prisma/driver-adapter-utils": "6.4.0-dev.62"
23
23
  },
24
24
  "files": [
25
25
  "dist"