🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@prisma-next/config

Package Overview
Dependencies
Maintainers
4
Versions
617
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/config - npm Package Compare versions

Comparing version
0.16.0-dev.11
to
0.16.0-dev.12
+158
dist/config-types-DtsiIT_O.d.mts
import { AssembledAuthoringContributions, ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlMutationDefaults, ControlTargetDescriptor } from "@prisma-next/framework-components/control";
import { Contract } from "@prisma-next/contract/types";
import { CodecLookup } from "@prisma-next/framework-components/codec";
import { CapabilityMatrix } from "@prisma-next/framework-components/components";
import { Result } from "@prisma-next/utils/result";
//#region src/contract-source-types.d.ts
interface ContractSourceDiagnosticPosition {
readonly offset: number;
readonly line: number;
readonly column: number;
}
interface ContractSourceDiagnosticSpan {
readonly start: ContractSourceDiagnosticPosition;
readonly end: ContractSourceDiagnosticPosition;
}
interface ContractSourceDiagnostic {
readonly code: string;
readonly message: string;
readonly sourceId?: string;
readonly span?: ContractSourceDiagnosticSpan;
/**
* Optional structured payload for machine-readable consumers (agents,
* IDE extensions, CLI auto-fix). Human-readable prose lives in `message`;
* `data` carries the extracted facts (e.g. `{ namespace: 'pgvector' }`).
*/
readonly data?: Readonly<Record<string, unknown>>;
}
interface ContractSourceDiagnostics {
readonly summary: string;
readonly diagnostics: readonly ContractSourceDiagnostic[];
readonly meta?: Record<string, unknown>;
}
interface ContractSourceContext {
readonly composedExtensionPacks: readonly string[];
/** Extension contracts keyed by space ID, required for cross-space FK resolution. */
readonly composedExtensionContracts: ReadonlyMap<string, Contract>;
readonly authoringContributions: AssembledAuthoringContributions;
readonly codecLookup: CodecLookup;
readonly controlMutationDefaults: ControlMutationDefaults;
readonly resolvedInputs: readonly string[];
readonly capabilities: CapabilityMatrix;
}
/** Lets format-aware tooling avoid file-extension sniffing and opaque loader introspection. */
type ContractSourceFormat = 'psl' | 'typescript';
interface ContractSourceProviderBase {
readonly inputs?: readonly string[];
readonly load: (context: ContractSourceContext) => Promise<Result<Contract, ContractSourceDiagnostics>>;
}
interface PslContractSourceProvider extends ContractSourceProviderBase {
readonly sourceFormat: 'psl';
}
interface TypeScriptContractSourceProvider extends ContractSourceProviderBase {
readonly sourceFormat: 'typescript';
}
/**
* Third-party or unspecified source formats. Absent (or unrecognized)
* `sourceFormat` means format-aware tooling must leave the source untouched.
* Narrowing to a known format flows only through capability guards owned by
* the authoring layer.
*/
interface OpaqueContractSourceProvider extends ContractSourceProviderBase {
readonly sourceFormat?: string;
}
type ContractSourceProvider = PslContractSourceProvider | TypeScriptContractSourceProvider | OpaqueContractSourceProvider;
//#endregion
//#region src/config-types.d.ts
/**
* Contract configuration specifying source and artifact locations.
*/
interface ContractConfig {
/**
* Contract source provider. The provider is always async and must return
* a Result containing either a Contract or structured diagnostics.
*/
readonly source: ContractSourceProvider;
/**
* Path to contract.json artifact. Providers that know an input path (PSL,
* `typescriptContractFromPath`) derive an output colocated with that input
* so this rarely needs to be set explicitly. The `.d.ts` types file is
* always emitted next to the JSON (e.g., `contract.json` → `contract.d.ts`).
*/
readonly output?: string;
}
interface FormatterConfig {
readonly indent?: number | 'tab';
readonly newline?: 'LF' | 'CRLF';
}
/**
* Default *source* directory for the contract file the user authors at `init`
* time. Output artefacts colocate with source per the same rule path-bearing
* providers apply.
*/
declare const DEFAULT_CONTRACT_SOURCE_DIR = "src/prisma";
declare function normalizeContractConfig(contract: ContractConfig): ContractConfig & {
readonly output: string;
};
/**
* Configuration for Prisma Next CLI.
* Uses Control*Descriptor types for type-safe wiring with compile-time compatibility checks.
*
* @template TFamilyId - The family ID (e.g., 'sql', 'document')
* @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
* @template TConnection - The driver connection input type (defaults to `unknown` for config flexibility)
*/
interface PrismaNextConfig<TFamilyId extends string = string, TTargetId extends string = string, TConnection = unknown> {
readonly family: ControlFamilyDescriptor<TFamilyId>;
readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;
readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];
/**
* Driver descriptor for DB-connected CLI commands.
* Required for DB-connected commands (e.g., db verify).
* Optional for commands that don't need database access (e.g., emit).
* The driver's connection type matches the TConnection config parameter.
*/
readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId, ControlDriverInstance<TFamilyId, TTargetId>, TConnection>;
/**
* Database connection configuration.
* The connection type is driver-specific (e.g., URL string for Postgres).
*/
readonly db?: {
/**
* Driver-specific connection input.
* For Postgres: a connection string (URL).
* For other drivers: may be a structured object.
*/
readonly connection?: TConnection;
};
/**
* Contract configuration. Specifies source and artifact locations.
* Required for emit command; optional for other commands that only read artifacts.
*/
readonly contract?: ContractConfig;
/**
* Migration configuration. Controls where on-disk migration packages are stored.
*/
readonly migrations?: {
/** Directory for migration packages, relative to config file. Defaults to 'migrations'. */
readonly dir?: string;
};
readonly formatter?: FormatterConfig;
}
/**
* Helper function to define a Prisma Next config.
* Validates and normalizes the config using Arktype, then returns the normalized IR.
*
* Normalization:
* - contract.output defaults to a path colocated with DEFAULT_CONTRACT_SOURCE_DIR
* when missing (in-memory-only providers)
*
* @param config - Raw config input from user
* @returns Normalized config IR with defaults applied
* @throws Error if config structure is invalid
*/
declare function defineConfig<TFamilyId extends string = string, TTargetId extends string = string>(config: PrismaNextConfig<TFamilyId, TTargetId>): PrismaNextConfig<TFamilyId, TTargetId>;
//#endregion
export { TypeScriptContractSourceProvider as _, defineConfig as a, ContractSourceDiagnostic as c, ContractSourceDiagnostics as d, ContractSourceFormat as f, PslContractSourceProvider as g, OpaqueContractSourceProvider as h, PrismaNextConfig as i, ContractSourceDiagnosticPosition as l, ContractSourceProviderBase as m, DEFAULT_CONTRACT_SOURCE_DIR as n, normalizeContractConfig as o, ContractSourceProvider as p, FormatterConfig as r, ContractSourceContext as s, ContractConfig as t, ContractSourceDiagnosticSpan as u };
//# sourceMappingURL=config-types-DtsiIT_O.d.mts.map
{"version":3,"file":"config-types-DtsiIT_O.d.mts","names":[],"sources":["../src/contract-source-types.ts","../src/config-types.ts"],"mappings":";;;;;;UASiB;WACN;WACA;WACA;;UAGM;WACN,OAAO;WACP,KAAK;;UAGC;WACN;WACA;WACA;WACA,OAAO;;;;;;WAMP,OAAO,SAAS;;UAGV;WACN;WACA,sBAAsB;WACtB,OAAO;;UAGD;WACN;;WAEA,4BAA4B,oBAAoB;WAChD,wBAAwB;WACxB,aAAa;WACb,yBAAyB;WACzB;WACA,cAAc;;;KAIb;UAEK;WACN;WACA,OACP,SAAS,0BACN,QAAQ,OAAO,UAAU;;UAGf,kCAAkC;WACxC;;UAGM,yCAAyC;WAC/C;;;;;;;;UASM,qCAAqC;WAC3C;;KAGC,yBACR,4BACA,mCACA;;;;;;UC7Da;;;;;WAKN,QAAQ;;;;;;;WAOR;;UAGM;WACN;WACA;;;;;;;cAQE;iBAEG,wBACd,UAAU,iBACT;WAA4B;;;;;;;;;;UAmBd,iBACf,mCACA,mCACA;WAES,QAAQ,wBAAwB;WAChC,QAAQ,wBAAwB,WAAW;WAC3C,SAAS,yBAAyB,WAAW;WAC7C,0BAA0B,2BAA2B,WAAW;;;;;;;WAOhE,SAAS,wBAChB,WACA,WACA,sBAAsB,WAAW,YACjC;;;;;WAMO;;;;;;aAME,aAAa;;;;;;WAMf,WAAW;;;;WAIX;;aAEE;;WAEF,YAAY;;;;;;;;;;;;;;iBAuDP,aAAa,mCAAmC,mCAC9D,QAAQ,iBAAiB,WAAW,aACnC,iBAAiB,WAAW"}
+1
-1

@@ -1,2 +0,2 @@

import { _ as TypeScriptContractSourceProvider, a as defineConfig, c as ContractSourceDiagnostic, d as ContractSourceDiagnostics, f as ContractSourceFormat, g as PslContractSourceProvider, h as OpaqueContractSourceProvider, i as PrismaNextConfig, l as ContractSourceDiagnosticPosition, m as ContractSourceProviderBase, 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-DCF51N1A.mjs";
import { _ as TypeScriptContractSourceProvider, a as defineConfig, c as ContractSourceDiagnostic, d as ContractSourceDiagnostics, f as ContractSourceFormat, g as PslContractSourceProvider, h as OpaqueContractSourceProvider, i as PrismaNextConfig, l as ContractSourceDiagnosticPosition, m as ContractSourceProviderBase, 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-DtsiIT_O.mjs";
export { type ContractConfig, type ContractSourceContext, type ContractSourceDiagnostic, type ContractSourceDiagnosticPosition, type ContractSourceDiagnosticSpan, type ContractSourceDiagnostics, type ContractSourceFormat, type ContractSourceProvider, type ContractSourceProviderBase, DEFAULT_CONTRACT_SOURCE_DIR, type FormatterConfig, type OpaqueContractSourceProvider, type PrismaNextConfig, type PslContractSourceProvider, type TypeScriptContractSourceProvider, defineConfig, normalizeContractConfig };

@@ -1,2 +0,2 @@

import { i as PrismaNextConfig } from "./config-types-DCF51N1A.mjs";
import { i as PrismaNextConfig } from "./config-types-DtsiIT_O.mjs";
//#region src/config-validation.d.ts

@@ -3,0 +3,0 @@ /**

{
"name": "@prisma-next/config",
"version": "0.16.0-dev.11",
"version": "0.16.0-dev.12",
"license": "Apache-2.0",

@@ -9,5 +9,5 @@ "type": "module",

"dependencies": {
"@prisma-next/contract": "0.16.0-dev.11",
"@prisma-next/framework-components": "0.16.0-dev.11",
"@prisma-next/utils": "0.16.0-dev.11",
"@prisma-next/contract": "0.16.0-dev.12",
"@prisma-next/framework-components": "0.16.0-dev.12",
"@prisma-next/utils": "0.16.0-dev.12",
"arktype": "^2.2.2",

@@ -17,4 +17,4 @@ "pathe": "^2.0.3"

"devDependencies": {
"@prisma-next/tsconfig": "0.16.0-dev.11",
"@prisma-next/tsdown": "0.16.0-dev.11",
"@prisma-next/tsconfig": "0.16.0-dev.12",
"@prisma-next/tsdown": "0.16.0-dev.12",
"tsdown": "0.22.8",

@@ -21,0 +21,0 @@ "typescript": "5.9.3",

@@ -44,3 +44,2 @@ import type { Contract } from '@prisma-next/contract/types';

readonly composedExtensionContracts: ReadonlyMap<string, Contract>;
readonly scalarTypeDescriptors: ReadonlyMap<string, string>;
readonly authoringContributions: AssembledAuthoringContributions;

@@ -47,0 +46,0 @@ readonly codecLookup: CodecLookup;

import { AssembledAuthoringContributions, ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlMutationDefaults, ControlTargetDescriptor } from "@prisma-next/framework-components/control";
import { Contract } from "@prisma-next/contract/types";
import { CodecLookup } from "@prisma-next/framework-components/codec";
import { CapabilityMatrix } from "@prisma-next/framework-components/components";
import { Result } from "@prisma-next/utils/result";
//#region src/contract-source-types.d.ts
interface ContractSourceDiagnosticPosition {
readonly offset: number;
readonly line: number;
readonly column: number;
}
interface ContractSourceDiagnosticSpan {
readonly start: ContractSourceDiagnosticPosition;
readonly end: ContractSourceDiagnosticPosition;
}
interface ContractSourceDiagnostic {
readonly code: string;
readonly message: string;
readonly sourceId?: string;
readonly span?: ContractSourceDiagnosticSpan;
/**
* Optional structured payload for machine-readable consumers (agents,
* IDE extensions, CLI auto-fix). Human-readable prose lives in `message`;
* `data` carries the extracted facts (e.g. `{ namespace: 'pgvector' }`).
*/
readonly data?: Readonly<Record<string, unknown>>;
}
interface ContractSourceDiagnostics {
readonly summary: string;
readonly diagnostics: readonly ContractSourceDiagnostic[];
readonly meta?: Record<string, unknown>;
}
interface ContractSourceContext {
readonly composedExtensionPacks: readonly string[];
/** Extension contracts keyed by space ID, required for cross-space FK resolution. */
readonly composedExtensionContracts: ReadonlyMap<string, Contract>;
readonly scalarTypeDescriptors: ReadonlyMap<string, string>;
readonly authoringContributions: AssembledAuthoringContributions;
readonly codecLookup: CodecLookup;
readonly controlMutationDefaults: ControlMutationDefaults;
readonly resolvedInputs: readonly string[];
readonly capabilities: CapabilityMatrix;
}
/** Lets format-aware tooling avoid file-extension sniffing and opaque loader introspection. */
type ContractSourceFormat = 'psl' | 'typescript';
interface ContractSourceProviderBase {
readonly inputs?: readonly string[];
readonly load: (context: ContractSourceContext) => Promise<Result<Contract, ContractSourceDiagnostics>>;
}
interface PslContractSourceProvider extends ContractSourceProviderBase {
readonly sourceFormat: 'psl';
}
interface TypeScriptContractSourceProvider extends ContractSourceProviderBase {
readonly sourceFormat: 'typescript';
}
/**
* Third-party or unspecified source formats. Absent (or unrecognized)
* `sourceFormat` means format-aware tooling must leave the source untouched.
* Narrowing to a known format flows only through capability guards owned by
* the authoring layer.
*/
interface OpaqueContractSourceProvider extends ContractSourceProviderBase {
readonly sourceFormat?: string;
}
type ContractSourceProvider = PslContractSourceProvider | TypeScriptContractSourceProvider | OpaqueContractSourceProvider;
//#endregion
//#region src/config-types.d.ts
/**
* Contract configuration specifying source and artifact locations.
*/
interface ContractConfig {
/**
* Contract source provider. The provider is always async and must return
* a Result containing either a Contract or structured diagnostics.
*/
readonly source: ContractSourceProvider;
/**
* Path to contract.json artifact. Providers that know an input path (PSL,
* `typescriptContractFromPath`) derive an output colocated with that input
* so this rarely needs to be set explicitly. The `.d.ts` types file is
* always emitted next to the JSON (e.g., `contract.json` → `contract.d.ts`).
*/
readonly output?: string;
}
interface FormatterConfig {
readonly indent?: number | 'tab';
readonly newline?: 'LF' | 'CRLF';
}
/**
* Default *source* directory for the contract file the user authors at `init`
* time. Output artefacts colocate with source per the same rule path-bearing
* providers apply.
*/
declare const DEFAULT_CONTRACT_SOURCE_DIR = "src/prisma";
declare function normalizeContractConfig(contract: ContractConfig): ContractConfig & {
readonly output: string;
};
/**
* Configuration for Prisma Next CLI.
* Uses Control*Descriptor types for type-safe wiring with compile-time compatibility checks.
*
* @template TFamilyId - The family ID (e.g., 'sql', 'document')
* @template TTargetId - The target ID (e.g., 'postgres', 'mysql')
* @template TConnection - The driver connection input type (defaults to `unknown` for config flexibility)
*/
interface PrismaNextConfig<TFamilyId extends string = string, TTargetId extends string = string, TConnection = unknown> {
readonly family: ControlFamilyDescriptor<TFamilyId>;
readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;
readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];
/**
* Driver descriptor for DB-connected CLI commands.
* Required for DB-connected commands (e.g., db verify).
* Optional for commands that don't need database access (e.g., emit).
* The driver's connection type matches the TConnection config parameter.
*/
readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId, ControlDriverInstance<TFamilyId, TTargetId>, TConnection>;
/**
* Database connection configuration.
* The connection type is driver-specific (e.g., URL string for Postgres).
*/
readonly db?: {
/**
* Driver-specific connection input.
* For Postgres: a connection string (URL).
* For other drivers: may be a structured object.
*/
readonly connection?: TConnection;
};
/**
* Contract configuration. Specifies source and artifact locations.
* Required for emit command; optional for other commands that only read artifacts.
*/
readonly contract?: ContractConfig;
/**
* Migration configuration. Controls where on-disk migration packages are stored.
*/
readonly migrations?: {
/** Directory for migration packages, relative to config file. Defaults to 'migrations'. */
readonly dir?: string;
};
readonly formatter?: FormatterConfig;
}
/**
* Helper function to define a Prisma Next config.
* Validates and normalizes the config using Arktype, then returns the normalized IR.
*
* Normalization:
* - contract.output defaults to a path colocated with DEFAULT_CONTRACT_SOURCE_DIR
* when missing (in-memory-only providers)
*
* @param config - Raw config input from user
* @returns Normalized config IR with defaults applied
* @throws Error if config structure is invalid
*/
declare function defineConfig<TFamilyId extends string = string, TTargetId extends string = string>(config: PrismaNextConfig<TFamilyId, TTargetId>): PrismaNextConfig<TFamilyId, TTargetId>;
//#endregion
export { TypeScriptContractSourceProvider as _, defineConfig as a, ContractSourceDiagnostic as c, ContractSourceDiagnostics as d, ContractSourceFormat as f, PslContractSourceProvider as g, OpaqueContractSourceProvider as h, PrismaNextConfig as i, ContractSourceDiagnosticPosition as l, ContractSourceProviderBase as m, DEFAULT_CONTRACT_SOURCE_DIR as n, normalizeContractConfig as o, ContractSourceProvider as p, FormatterConfig as r, ContractSourceContext as s, ContractConfig as t, ContractSourceDiagnosticSpan as u };
//# sourceMappingURL=config-types-DCF51N1A.d.mts.map
{"version":3,"file":"config-types-DCF51N1A.d.mts","names":[],"sources":["../src/contract-source-types.ts","../src/config-types.ts"],"mappings":";;;;;;UASiB;WACN;WACA;WACA;;UAGM;WACN,OAAO;WACP,KAAK;;UAGC;WACN;WACA;WACA;WACA,OAAO;;;;;;WAMP,OAAO,SAAS;;UAGV;WACN;WACA,sBAAsB;WACtB,OAAO;;UAGD;WACN;;WAEA,4BAA4B,oBAAoB;WAChD,uBAAuB;WACvB,wBAAwB;WACxB,aAAa;WACb,yBAAyB;WACzB;WACA,cAAc;;;KAIb;UAEK;WACN;WACA,OACP,SAAS,0BACN,QAAQ,OAAO,UAAU;;UAGf,kCAAkC;WACxC;;UAGM,yCAAyC;WAC/C;;;;;;;;UASM,qCAAqC;WAC3C;;KAGC,yBACR,4BACA,mCACA;;;;;;UC9Da;;;;;WAKN,QAAQ;;;;;;;WAOR;;UAGM;WACN;WACA;;;;;;;cAQE;iBAEG,wBACd,UAAU,iBACT;WAA4B;;;;;;;;;;UAmBd,iBACf,mCACA,mCACA;WAES,QAAQ,wBAAwB;WAChC,QAAQ,wBAAwB,WAAW;WAC3C,SAAS,yBAAyB,WAAW;WAC7C,0BAA0B,2BAA2B,WAAW;;;;;;;WAOhE,SAAS,wBAChB,WACA,WACA,sBAAsB,WAAW,YACjC;;;;;WAMO;;;;;;aAME,aAAa;;;;;;WAMf,WAAW;;;;WAIX;;aAEE;;WAEF,YAAY;;;;;;;;;;;;;;iBAuDP,aAAa,mCAAmC,mCAC9D,QAAQ,iBAAiB,WAAW,aACnC,iBAAiB,WAAW"}