@prisma-next/config 0.14.0-dev.3 → 0.14.0-dev.5

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/README.md CHANGED
@@ -25,7 +25,7 @@ This package owns the shared config contract used by tooling and authoring packa
25
25
 
26
26
  ## Non-responsibilities
27
27
 
28
- - Config file discovery/loading (`c12`, file I/O) - handled by `@prisma-next/cli`
28
+ - Config file discovery/loading (`c12`, file I/O) - handled by `@prisma-next/config-loader`
29
29
  - CLI error envelope formatting and rendering - handled by CLI/errors package error utilities
30
30
  - Control-plane migration operations and runtime actions
31
31
 
@@ -54,5 +54,5 @@ validateConfig(config);
54
54
  Declare `source.inputs` only for source files that are not already covered by the config module
55
55
  graph, such as PSL schema paths or TypeScript contract paths passed as strings. Do not include
56
56
  emitted artifact paths derived from `contract.output` (for example `contract.json` or the
57
- colocated `contract.d.ts`); the CLI loader resolves and validates those paths before emit/watch
58
- commands run. Tooling should always treat the config module graph as watched by default.
57
+ colocated `contract.d.ts`); `@prisma-next/config-loader` resolves and validates those paths
58
+ before emit/watch commands run. Tooling should always treat the config module graph as watched by default.
@@ -40,7 +40,11 @@ interface ContractSourceContext {
40
40
  readonly controlMutationDefaults: ControlMutationDefaults;
41
41
  readonly resolvedInputs: readonly string[];
42
42
  }
43
+ /** Lets format-aware tooling avoid file-extension sniffing and opaque loader introspection. */
44
+ type ContractSourceFormat = 'psl' | 'typescript';
43
45
  interface ContractSourceProvider {
46
+ /** Absent means format-aware tooling must leave the source untouched. */
47
+ readonly sourceFormat?: ContractSourceFormat;
44
48
  readonly inputs?: readonly string[];
45
49
  readonly load: (context: ContractSourceContext) => Promise<Result<Contract, ContractSourceDiagnostics>>;
46
50
  }
@@ -63,6 +67,10 @@ interface ContractConfig {
63
67
  */
64
68
  readonly output?: string;
65
69
  }
70
+ interface FormatterConfig {
71
+ readonly indent?: number | 'tab';
72
+ readonly newline?: 'LF' | 'CRLF';
73
+ }
66
74
  /**
67
75
  * Default *source* directory for the contract file the user authors at `init`
68
76
  * time. Output artefacts colocate with source per the same rule path-bearing
@@ -115,6 +123,7 @@ interface PrismaNextConfig<TFamilyId extends string = string, TTargetId extends
115
123
  readonly migrations?: {
116
124
  /** Directory for migration packages, relative to config file. Defaults to 'migrations'. */readonly dir?: string;
117
125
  };
126
+ readonly formatter?: FormatterConfig;
118
127
  }
119
128
  /**
120
129
  * Helper function to define a Prisma Next config.
@@ -130,5 +139,5 @@ interface PrismaNextConfig<TFamilyId extends string = string, TTargetId extends
130
139
  */
131
140
  declare function defineConfig<TFamilyId extends string = string, TTargetId extends string = string>(config: PrismaNextConfig<TFamilyId, TTargetId>): PrismaNextConfig<TFamilyId, TTargetId>;
132
141
  //#endregion
133
- export { normalizeContractConfig as a, ContractSourceDiagnosticPosition as c, ContractSourceProvider as d, defineConfig as i, ContractSourceDiagnosticSpan as l, DEFAULT_CONTRACT_SOURCE_DIR as n, ContractSourceContext as o, PrismaNextConfig as r, ContractSourceDiagnostic as s, ContractConfig as t, ContractSourceDiagnostics as u };
134
- //# sourceMappingURL=config-types-6ihajZrZ.d.mts.map
142
+ export { defineConfig as a, ContractSourceDiagnostic as c, ContractSourceDiagnostics as d, ContractSourceFormat as f, PrismaNextConfig as i, ContractSourceDiagnosticPosition as l, DEFAULT_CONTRACT_SOURCE_DIR as n, normalizeContractConfig as o, ContractSourceProvider as p, FormatterConfig as r, ContractSourceContext as s, ContractConfig as t, ContractSourceDiagnosticSpan as u };
143
+ //# sourceMappingURL=config-types-BxURjD5t.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-types-BxURjD5t.d.mts","names":[],"sources":["../src/contract-source-types.ts","../src/config-types.ts"],"mappings":";;;;;;UAQiB,gCAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,4BAAA;EAAA,SACN,KAAA,EAAO,gCAAA;EAAA,SACP,GAAA,EAAK,gCAAgC;AAAA;AAAA,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SCgDA,MAAA,GAAS,uBAAA,CAChB,SAAA,EACA,SAAA,EACA,qBAAA,CAAsB,SAAA,EAAW,SAAA,GACjC,WAAA;ED9CuD;;;;EAAA,SCoDhD,EAAA;IDhDyB;;;;;IAAA,SCsDvB,UAAA,GAAa,WAAA;EAAA;EDzDf;;;;EAAA,SC+DA,QAAA,GAAW,cAAA;ED7DE;;;EAAA,SCiEb,UAAA;ID/Dc,oGCiEZ,GAAA;EAAA;EAAA,SAEF,SAAA,GAAY,eAAA;AAAA;;;;;;;;ADvDkC;;;;ACtCzD;iBAoJgB,YAAA,uEACd,MAAA,EAAQ,gBAAA,CAAiB,SAAA,EAAW,SAAA,IACnC,gBAAA,CAAiB,SAAA,EAAW,SAAA"}
@@ -1,2 +1,2 @@
1
- import { a as normalizeContractConfig, c as ContractSourceDiagnosticPosition, d as ContractSourceProvider, i as defineConfig, l as ContractSourceDiagnosticSpan, n as DEFAULT_CONTRACT_SOURCE_DIR, o as ContractSourceContext, r as PrismaNextConfig, s as ContractSourceDiagnostic, t as ContractConfig, u as ContractSourceDiagnostics } from "./config-types-6ihajZrZ.mjs";
2
- export { type ContractConfig, type ContractSourceContext, type ContractSourceDiagnostic, type ContractSourceDiagnosticPosition, type ContractSourceDiagnosticSpan, type ContractSourceDiagnostics, type ContractSourceProvider, DEFAULT_CONTRACT_SOURCE_DIR, type PrismaNextConfig, defineConfig, normalizeContractConfig };
1
+ import { a as defineConfig, c as ContractSourceDiagnostic, d as ContractSourceDiagnostics, f as ContractSourceFormat, i as PrismaNextConfig, l as ContractSourceDiagnosticPosition, n as DEFAULT_CONTRACT_SOURCE_DIR, o as normalizeContractConfig, p as ContractSourceProvider, r as FormatterConfig, s as ContractSourceContext, t as ContractConfig, u as ContractSourceDiagnosticSpan } from "./config-types-BxURjD5t.mjs";
2
+ export { type ContractConfig, type ContractSourceContext, type ContractSourceDiagnostic, type ContractSourceDiagnosticPosition, type ContractSourceDiagnosticSpan, type ContractSourceDiagnostics, type ContractSourceFormat, type ContractSourceProvider, DEFAULT_CONTRACT_SOURCE_DIR, type FormatterConfig, type PrismaNextConfig, defineConfig, normalizeContractConfig };
@@ -22,12 +22,17 @@ const PrismaNextConfigSchema = type({
22
22
  "db?": "unknown",
23
23
  "contract?": type({
24
24
  source: type({
25
+ "sourceFormat?": "'psl' | 'typescript'",
25
26
  "inputs?": type("string").array(),
26
27
  load: "Function"
27
28
  }),
28
29
  "output?": "string"
29
30
  }),
30
- "migrations?": type({ "dir?": "string" })
31
+ "migrations?": type({ "dir?": "string" }),
32
+ "formatter?": type({
33
+ "indent?": type("number.integer >= 1").or("'tab'"),
34
+ "newline?": "'LF' | 'CRLF'"
35
+ })
31
36
  });
32
37
  /**
33
38
  * Helper function to define a Prisma Next config.
@@ -1 +1 @@
1
- {"version":3,"file":"config-types.mjs","names":[],"sources":["../src/config-types.ts"],"sourcesContent":["import type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlDriverInstance,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from '@prisma-next/framework-components/control';\nimport { type } from 'arktype';\nimport type { ContractSourceProvider } from './contract-source-types';\n\n/**\n * Type alias for CLI driver instances.\n * Uses string for both family and target IDs for maximum flexibility.\n */\nexport type CliDriver = ControlDriverInstance<string, string>;\n\n/**\n * Contract configuration specifying source and artifact locations.\n */\nexport interface ContractConfig {\n /**\n * Contract source provider. The provider is always async and must return\n * a Result containing either a Contract or structured diagnostics.\n */\n readonly source: ContractSourceProvider;\n /**\n * Path to contract.json artifact. Providers that know an input path (PSL,\n * `typescriptContractFromPath`) derive an output colocated with that input\n * so this rarely needs to be set explicitly. The `.d.ts` types file is\n * always emitted next to the JSON (e.g., `contract.json` → `contract.d.ts`).\n */\n readonly output?: string;\n}\n\n/**\n * Default *source* directory for the contract file the user authors at `init`\n * time. Output artefacts colocate with source per the same rule path-bearing\n * providers apply.\n */\nexport const DEFAULT_CONTRACT_SOURCE_DIR = 'src/prisma';\n\nexport function normalizeContractConfig(\n contract: ContractConfig,\n): ContractConfig & { readonly output: string } {\n // In-memory-only fallback: `typescriptContract(contract)` has no source path\n // to anchor on, so normalization supplies a default output colocated with\n // the default source directory.\n const inMemoryFallbackOutput = `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.json`;\n return {\n source: contract.source,\n output: contract.output ?? inMemoryFallbackOutput,\n };\n}\n\n/**\n * Configuration for Prisma Next CLI.\n * Uses Control*Descriptor types for type-safe wiring with compile-time compatibility checks.\n *\n * @template TFamilyId - The family ID (e.g., 'sql', 'document')\n * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')\n * @template TConnection - The driver connection input type (defaults to `unknown` for config flexibility)\n */\nexport interface PrismaNextConfig<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n TConnection = unknown,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n /**\n * Driver descriptor for DB-connected CLI commands.\n * Required for DB-connected commands (e.g., db verify).\n * Optional for commands that don't need database access (e.g., emit).\n * The driver's connection type matches the TConnection config parameter.\n */\n readonly driver?: ControlDriverDescriptor<\n TFamilyId,\n TTargetId,\n ControlDriverInstance<TFamilyId, TTargetId>,\n TConnection\n >;\n /**\n * Database connection configuration.\n * The connection type is driver-specific (e.g., URL string for Postgres).\n */\n readonly db?: {\n /**\n * Driver-specific connection input.\n * For Postgres: a connection string (URL).\n * For other drivers: may be a structured object.\n */\n readonly connection?: TConnection;\n };\n /**\n * Contract configuration. Specifies source and artifact locations.\n * Required for emit command; optional for other commands that only read artifacts.\n */\n readonly contract?: ContractConfig;\n /**\n * Migration configuration. Controls where on-disk migration packages are stored.\n */\n readonly migrations?: {\n /** Directory for migration packages, relative to config file. Defaults to 'migrations'. */\n readonly dir?: string;\n };\n}\n\nconst ContractSourceInputSchema = type('string');\n\nexport const ContractSourceProviderSchema = type({\n 'inputs?': ContractSourceInputSchema.array(),\n load: 'Function',\n});\n\nexport const ContractConfigSchema = type({\n source: ContractSourceProviderSchema,\n 'output?': 'string',\n});\n\n/**\n * Arktype schema for PrismaNextConfig validation.\n * Note: This validates structure only. Descriptor objects (family, target, adapter) are validated separately.\n */\nconst MigrationsConfigSchema = type({\n 'dir?': 'string',\n});\n\nconst PrismaNextConfigSchema = type({\n family: 'unknown', // ControlFamilyDescriptor - validated separately\n target: 'unknown', // ControlTargetDescriptor - validated separately\n adapter: 'unknown', // ControlAdapterDescriptor - validated separately\n 'extensionPacks?': 'unknown[]',\n 'driver?': 'unknown', // ControlDriverDescriptor - validated separately (optional)\n 'db?': 'unknown',\n 'contract?': ContractConfigSchema,\n 'migrations?': MigrationsConfigSchema,\n});\n\n/**\n * Helper function to define a Prisma Next config.\n * Validates and normalizes the config using Arktype, then returns the normalized IR.\n *\n * Normalization:\n * - contract.output defaults to a path colocated with DEFAULT_CONTRACT_SOURCE_DIR\n * when missing (in-memory-only providers)\n *\n * @param config - Raw config input from user\n * @returns Normalized config IR with defaults applied\n * @throws Error if config structure is invalid\n */\nexport function defineConfig<TFamilyId extends string = string, TTargetId extends string = string>(\n config: PrismaNextConfig<TFamilyId, TTargetId>,\n): PrismaNextConfig<TFamilyId, TTargetId> {\n // Validate structure using Arktype\n const validated = PrismaNextConfigSchema(config);\n if (validated instanceof type.errors) {\n const messages = validated.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Config validation failed: ${messages}`);\n }\n\n // Normalize contract config if present\n if (config.contract) {\n // Return normalized config\n return {\n ...config,\n contract: normalizeContractConfig(config.contract),\n };\n }\n\n // Return config as-is if no contract (preserve literal types)\n return config;\n}\n"],"mappings":";;;;;;;AAwCA,MAAa,8BAA8B;AAE3C,SAAgB,wBACd,UAC8C;CAI9C,MAAM,yBAAyB,GAAG,4BAA4B;CAC9D,OAAO;EACL,QAAQ,SAAS;EACjB,QAAQ,SAAS,UAAU;CAC7B;AACF;AA6EA,MAAM,yBAAyB,KAAK;CAClC,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,mBAAmB;CACnB,WAAW;CACX,OAAO;CACP,aApBkC,KAAK;EACvC,QAN0C,KAAK;GAC/C,WAHgC,KAAK,QAG1B,CAAA,CAA0B,MAAM;GAC3C,MAAM;EACR,CAGU;EACR,WAAW;CACb,CAiBe;CACb,eAZ6B,KAAK,EAClC,QAAQ,SACV,CAUsC;AACtC,CAAC;;;;;;;;;;;;;AAcD,SAAgB,aACd,QACwC;CAExC,MAAM,YAAY,uBAAuB,MAAM;CAC/C,IAAI,qBAAqB,KAAK,QAAQ;EACpC,MAAM,WAAW,UAAU,KAAK,MAA2B,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI;EAC/E,MAAM,IAAI,MAAM,6BAA6B,UAAU;CACzD;CAGA,IAAI,OAAO,UAET,OAAO;EACL,GAAG;EACH,UAAU,wBAAwB,OAAO,QAAQ;CACnD;CAIF,OAAO;AACT"}
1
+ {"version":3,"file":"config-types.mjs","names":[],"sources":["../src/config-types.ts"],"sourcesContent":["import type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlDriverInstance,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from '@prisma-next/framework-components/control';\nimport { type } from 'arktype';\nimport type { ContractSourceProvider } from './contract-source-types';\n\n/**\n * Type alias for CLI driver instances.\n * Uses string for both family and target IDs for maximum flexibility.\n */\nexport type CliDriver = ControlDriverInstance<string, string>;\n\n/**\n * Contract configuration specifying source and artifact locations.\n */\nexport interface ContractConfig {\n /**\n * Contract source provider. The provider is always async and must return\n * a Result containing either a Contract or structured diagnostics.\n */\n readonly source: ContractSourceProvider;\n /**\n * Path to contract.json artifact. Providers that know an input path (PSL,\n * `typescriptContractFromPath`) derive an output colocated with that input\n * so this rarely needs to be set explicitly. The `.d.ts` types file is\n * always emitted next to the JSON (e.g., `contract.json` → `contract.d.ts`).\n */\n readonly output?: string;\n}\n\nexport interface FormatterConfig {\n readonly indent?: number | 'tab';\n readonly newline?: 'LF' | 'CRLF';\n}\n\n/**\n * Default *source* directory for the contract file the user authors at `init`\n * time. Output artefacts colocate with source per the same rule path-bearing\n * providers apply.\n */\nexport const DEFAULT_CONTRACT_SOURCE_DIR = 'src/prisma';\n\nexport function normalizeContractConfig(\n contract: ContractConfig,\n): ContractConfig & { readonly output: string } {\n // In-memory-only fallback: `typescriptContract(contract)` has no source path\n // to anchor on, so normalization supplies a default output colocated with\n // the default source directory.\n const inMemoryFallbackOutput = `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.json`;\n return {\n source: contract.source,\n output: contract.output ?? inMemoryFallbackOutput,\n };\n}\n\n/**\n * Configuration for Prisma Next CLI.\n * Uses Control*Descriptor types for type-safe wiring with compile-time compatibility checks.\n *\n * @template TFamilyId - The family ID (e.g., 'sql', 'document')\n * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')\n * @template TConnection - The driver connection input type (defaults to `unknown` for config flexibility)\n */\nexport interface PrismaNextConfig<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n TConnection = unknown,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n /**\n * Driver descriptor for DB-connected CLI commands.\n * Required for DB-connected commands (e.g., db verify).\n * Optional for commands that don't need database access (e.g., emit).\n * The driver's connection type matches the TConnection config parameter.\n */\n readonly driver?: ControlDriverDescriptor<\n TFamilyId,\n TTargetId,\n ControlDriverInstance<TFamilyId, TTargetId>,\n TConnection\n >;\n /**\n * Database connection configuration.\n * The connection type is driver-specific (e.g., URL string for Postgres).\n */\n readonly db?: {\n /**\n * Driver-specific connection input.\n * For Postgres: a connection string (URL).\n * For other drivers: may be a structured object.\n */\n readonly connection?: TConnection;\n };\n /**\n * Contract configuration. Specifies source and artifact locations.\n * Required for emit command; optional for other commands that only read artifacts.\n */\n readonly contract?: ContractConfig;\n /**\n * Migration configuration. Controls where on-disk migration packages are stored.\n */\n readonly migrations?: {\n /** Directory for migration packages, relative to config file. Defaults to 'migrations'. */\n readonly dir?: string;\n };\n readonly formatter?: FormatterConfig;\n}\n\nconst ContractSourceInputSchema = type('string');\n\nexport const ContractSourceProviderSchema = type({\n 'sourceFormat?': \"'psl' | 'typescript'\",\n 'inputs?': ContractSourceInputSchema.array(),\n load: 'Function',\n});\n\nexport const ContractConfigSchema = type({\n source: ContractSourceProviderSchema,\n 'output?': 'string',\n});\n\n/**\n * Arktype schema for PrismaNextConfig validation.\n * Note: This validates structure only. Descriptor objects (family, target, adapter) are validated separately.\n */\nconst MigrationsConfigSchema = type({\n 'dir?': 'string',\n});\n\nconst FormatterIndentSchema = type('number.integer >= 1').or(\"'tab'\");\n\nexport const FormatterConfigSchema = type({\n 'indent?': FormatterIndentSchema,\n 'newline?': \"'LF' | 'CRLF'\",\n});\n\nconst PrismaNextConfigSchema = type({\n family: 'unknown', // ControlFamilyDescriptor - validated separately\n target: 'unknown', // ControlTargetDescriptor - validated separately\n adapter: 'unknown', // ControlAdapterDescriptor - validated separately\n 'extensionPacks?': 'unknown[]',\n 'driver?': 'unknown', // ControlDriverDescriptor - validated separately (optional)\n 'db?': 'unknown',\n 'contract?': ContractConfigSchema,\n 'migrations?': MigrationsConfigSchema,\n 'formatter?': FormatterConfigSchema,\n});\n\n/**\n * Helper function to define a Prisma Next config.\n * Validates and normalizes the config using Arktype, then returns the normalized IR.\n *\n * Normalization:\n * - contract.output defaults to a path colocated with DEFAULT_CONTRACT_SOURCE_DIR\n * when missing (in-memory-only providers)\n *\n * @param config - Raw config input from user\n * @returns Normalized config IR with defaults applied\n * @throws Error if config structure is invalid\n */\nexport function defineConfig<TFamilyId extends string = string, TTargetId extends string = string>(\n config: PrismaNextConfig<TFamilyId, TTargetId>,\n): PrismaNextConfig<TFamilyId, TTargetId> {\n // Validate structure using Arktype\n const validated = PrismaNextConfigSchema(config);\n if (validated instanceof type.errors) {\n const messages = validated.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Config validation failed: ${messages}`);\n }\n\n // Normalize contract config if present\n if (config.contract) {\n // Return normalized config\n return {\n ...config,\n contract: normalizeContractConfig(config.contract),\n };\n }\n\n // Return config as-is if no contract (preserve literal types)\n return config;\n}\n"],"mappings":";;;;;;;AA6CA,MAAa,8BAA8B;AAE3C,SAAgB,wBACd,UAC8C;CAI9C,MAAM,yBAAyB,GAAG,4BAA4B;CAC9D,OAAO;EACL,QAAQ,SAAS;EACjB,QAAQ,SAAS,UAAU;CAC7B;AACF;AAsFA,MAAM,yBAAyB,KAAK;CAClC,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,mBAAmB;CACnB,WAAW;CACX,OAAO;CACP,aA3BkC,KAAK;EACvC,QAP0C,KAAK;GAC/C,iBAAiB;GACjB,WAJgC,KAAK,QAI1B,CAAA,CAA0B,MAAM;GAC3C,MAAM;EACR,CAGU;EACR,WAAW;CACb,CAwBe;CACb,eAnB6B,KAAK,EAClC,QAAQ,SACV,CAiBiB;CACf,cAdmC,KAAK;EACxC,WAH4B,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAGhD;EACX,YAAY;CACd,CAWgB;AAChB,CAAC;;;;;;;;;;;;;AAcD,SAAgB,aACd,QACwC;CAExC,MAAM,YAAY,uBAAuB,MAAM;CAC/C,IAAI,qBAAqB,KAAK,QAAQ;EACpC,MAAM,WAAW,UAAU,KAAK,MAA2B,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI;EAC/E,MAAM,IAAI,MAAM,6BAA6B,UAAU;CACzD;CAGA,IAAI,OAAO,UAET,OAAO;EACL,GAAG;EACH,UAAU,wBAAwB,OAAO,QAAQ;CACnD;CAIF,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { r as PrismaNextConfig } from "./config-types-6ihajZrZ.mjs";
1
+ import { i as PrismaNextConfig } from "./config-types-BxURjD5t.mjs";
2
2
 
3
3
  //#region src/config-validation.d.ts
4
4
  /**
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@prisma-next/config",
3
- "version": "0.14.0-dev.3",
3
+ "version": "0.14.0-dev.5",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "Prisma Next config authoring types and validation",
8
8
  "dependencies": {
9
- "@prisma-next/contract": "0.14.0-dev.3",
10
- "@prisma-next/framework-components": "0.14.0-dev.3",
11
- "@prisma-next/utils": "0.14.0-dev.3",
12
- "arktype": "^2.2.0"
9
+ "@prisma-next/contract": "0.14.0-dev.5",
10
+ "@prisma-next/framework-components": "0.14.0-dev.5",
11
+ "@prisma-next/utils": "0.14.0-dev.5",
12
+ "arktype": "^2.2.0",
13
+ "pathe": "^2.0.3"
13
14
  },
14
15
  "devDependencies": {
15
- "@prisma-next/tsconfig": "0.14.0-dev.3",
16
- "@prisma-next/tsdown": "0.14.0-dev.3",
16
+ "@prisma-next/tsconfig": "0.14.0-dev.5",
17
+ "@prisma-next/tsdown": "0.14.0-dev.5",
17
18
  "tsdown": "0.22.1",
18
19
  "typescript": "5.9.3",
19
20
  "vitest": "4.1.8"
@@ -33,6 +33,11 @@ export interface ContractConfig {
33
33
  readonly output?: string;
34
34
  }
35
35
 
36
+ export interface FormatterConfig {
37
+ readonly indent?: number | 'tab';
38
+ readonly newline?: 'LF' | 'CRLF';
39
+ }
40
+
36
41
  /**
37
42
  * Default *source* directory for the contract file the user authors at `init`
38
43
  * time. Output artefacts colocate with source per the same rule path-bearing
@@ -106,11 +111,13 @@ export interface PrismaNextConfig<
106
111
  /** Directory for migration packages, relative to config file. Defaults to 'migrations'. */
107
112
  readonly dir?: string;
108
113
  };
114
+ readonly formatter?: FormatterConfig;
109
115
  }
110
116
 
111
117
  const ContractSourceInputSchema = type('string');
112
118
 
113
119
  export const ContractSourceProviderSchema = type({
120
+ 'sourceFormat?': "'psl' | 'typescript'",
114
121
  'inputs?': ContractSourceInputSchema.array(),
115
122
  load: 'Function',
116
123
  });
@@ -128,6 +135,13 @@ const MigrationsConfigSchema = type({
128
135
  'dir?': 'string',
129
136
  });
130
137
 
138
+ const FormatterIndentSchema = type('number.integer >= 1').or("'tab'");
139
+
140
+ export const FormatterConfigSchema = type({
141
+ 'indent?': FormatterIndentSchema,
142
+ 'newline?': "'LF' | 'CRLF'",
143
+ });
144
+
131
145
  const PrismaNextConfigSchema = type({
132
146
  family: 'unknown', // ControlFamilyDescriptor - validated separately
133
147
  target: 'unknown', // ControlTargetDescriptor - validated separately
@@ -137,6 +151,7 @@ const PrismaNextConfigSchema = type({
137
151
  'db?': 'unknown',
138
152
  'contract?': ContractConfigSchema,
139
153
  'migrations?': MigrationsConfigSchema,
154
+ 'formatter?': FormatterConfigSchema,
140
155
  });
141
156
 
142
157
  /**
@@ -47,7 +47,12 @@ export interface ContractSourceContext {
47
47
  readonly resolvedInputs: readonly string[];
48
48
  }
49
49
 
50
+ /** Lets format-aware tooling avoid file-extension sniffing and opaque loader introspection. */
51
+ export type ContractSourceFormat = 'psl' | 'typescript';
52
+
50
53
  export interface ContractSourceProvider {
54
+ /** Absent means format-aware tooling must leave the source untouched. */
55
+ readonly sourceFormat?: ContractSourceFormat;
51
56
  readonly inputs?: readonly string[];
52
57
  readonly load: (
53
58
  context: ContractSourceContext,
@@ -1,4 +1,4 @@
1
- export type { ContractConfig, PrismaNextConfig } from '../config-types';
1
+ export type { ContractConfig, FormatterConfig, PrismaNextConfig } from '../config-types';
2
2
  export {
3
3
  DEFAULT_CONTRACT_SOURCE_DIR,
4
4
  defineConfig,
@@ -10,5 +10,6 @@ export type {
10
10
  ContractSourceDiagnosticPosition,
11
11
  ContractSourceDiagnosticSpan,
12
12
  ContractSourceDiagnostics,
13
+ ContractSourceFormat,
13
14
  ContractSourceProvider,
14
15
  } from '../contract-source-types';
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-types-6ihajZrZ.d.mts","names":[],"sources":["../src/contract-source-types.ts","../src/config-types.ts"],"mappings":";;;;;;UAQiB,gCAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,4BAAA;EAAA,SACN,KAAA,EAAO,gCAAA;EAAA,SACP,GAAA,EAAK,gCAAgC;AAAA;AAAA,UAG/B,wBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA,GAAO,4BAAA;EAP8B;;;;;EAAA,SAarC,IAAA,GAAO,QAAA,CAAS,MAAA;AAAA;AAAA,UAGV,yBAAA;EAAA,SACN,OAAA;EAAA,SACA,WAAA,WAAsB,wBAAA;EAAA,SACtB,IAAA,GAAO,MAAM;AAAA;AAAA,UAGP,qBAAA;EAAA,SACN,sBAAA;EAVe;EAAA,SAYf,0BAAA,EAA4B,WAAA,SAAoB,QAAA;EAAA,SAChD,qBAAA,EAAuB,WAAA;EAAA,SACvB,sBAAA,EAAwB,+BAAA;EAAA,SACxB,WAAA,EAAa,WAAA;EAAA,SACb,uBAAA,EAAyB,uBAAA;EAAA,SACzB,cAAA;AAAA;AAAA,UAGM,sBAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA,GACP,OAAA,EAAS,qBAAA,KACN,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,yBAAA;AAAA;;;;;;UCjCf,cAAA;EDVN;;;AACM;EADN,SCeA,MAAA,EAAQ,sBAAsB;EDXI;;;;;;EAAA,SCkBlC,MAAA;AAAA;ADhBqC;AAGhD;;;;AAHgD,cCwBnC,2BAAA;AAAA,iBAEG,uBAAA,CACd,QAAA,EAAU,cAAA,GACT,cAAc;EAAA,SAAc,MAAA;AAAA;;;;;;;;;UAmBd,gBAAA;EAAA,SAKN,MAAA,EAAQ,uBAAA,CAAwB,SAAA;EAAA,SAChC,MAAA,EAAQ,uBAAA,CAAwB,SAAA,E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