🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@prisma-next/config

Package Overview
Dependencies
Maintainers
4
Versions
515
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.14.0-dev.33
to
0.14.0-dev.36
+145
dist/config-types-DYfiKSrh.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 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 ContractSourceProvider {
/** Absent means format-aware tooling must leave the source untouched. */
readonly sourceFormat?: ContractSourceFormat;
readonly inputs?: readonly string[];
readonly load: (context: ContractSourceContext) => Promise<Result<Contract, ContractSourceDiagnostics>>;
}
//#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 { 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 };
//# sourceMappingURL=config-types-DYfiKSrh.d.mts.map
{"version":3,"file":"config-types-DYfiKSrh.d.mts","names":[],"sources":["../src/contract-source-types.ts","../src/config-types.ts"],"mappings":";;;;;;;UASiB,gCAAA;EAAA,SACN,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,4BAAA;EAAA,SACN,KAAA,EAAO,gCAAA;EAAA,SACP,GAAA,EAAK,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0BAAA,CAA2B,SAAA,EAAW,SAAA;EDzC1C;;;;AACT;AAGxB;EAJiC,SCgDtB,MAAA,GAAS,uBAAA,CAChB,SAAA,EACA,SAAA,EACA,qBAAA,CAAsB,SAAA,EAAW,SAAA,GACjC,WAAA;;;;;WAMO,EAAA;IDhDa;;;;;IAAA,SCsDX,UAAA,GAAa,WAAA;EAAA;EDzDa;;;;EAAA,SC+D5B,QAAA,GAAW,cAAA;ED7Da;;;EAAA,SCiExB,UAAA;ID/DyB,oGCiEvB,GAAA;EAAA;EAAA,SAEF,SAAA,GAAY,eAAA;AAAA;;;;;;;;;;;;ADrDkC;iBC4GzC,YAAA,uEACd,MAAA,EAAQ,gBAAA,CAAiB,SAAA,EAAW,SAAA,IACnC,gBAAA,CAAiB,SAAA,EAAW,SAAA"}
+1
-1

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

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";
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-DYfiKSrh.mjs";
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 };

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

import { i as PrismaNextConfig } from "./config-types-BxURjD5t.mjs";
import { i as PrismaNextConfig } from "./config-types-DYfiKSrh.mjs";

@@ -3,0 +3,0 @@ //#region src/config-validation.d.ts

{
"name": "@prisma-next/config",
"version": "0.14.0-dev.33",
"version": "0.14.0-dev.36",
"license": "Apache-2.0",

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

"dependencies": {
"@prisma-next/contract": "0.14.0-dev.33",
"@prisma-next/framework-components": "0.14.0-dev.33",
"@prisma-next/utils": "0.14.0-dev.33",
"@prisma-next/contract": "0.14.0-dev.36",
"@prisma-next/framework-components": "0.14.0-dev.36",
"@prisma-next/utils": "0.14.0-dev.36",
"arktype": "^2.2.0",

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

"devDependencies": {
"@prisma-next/tsconfig": "0.14.0-dev.33",
"@prisma-next/tsdown": "0.14.0-dev.33",
"@prisma-next/tsconfig": "0.14.0-dev.36",
"@prisma-next/tsdown": "0.14.0-dev.36",
"tsdown": "0.22.1",

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

import type { Contract } from '@prisma-next/contract/types';
import type { CodecLookup } from '@prisma-next/framework-components/codec';
import type { CapabilityMatrix } from '@prisma-next/framework-components/components';
import type {

@@ -48,2 +49,3 @@ AssembledAuthoringContributions,

readonly resolvedInputs: readonly string[];
readonly capabilities: CapabilityMatrix;
}

@@ -50,0 +52,0 @@

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 { 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[];
}
/** Lets format-aware tooling avoid file-extension sniffing and opaque loader introspection. */
type ContractSourceFormat = 'psl' | 'typescript';
interface ContractSourceProvider {
/** Absent means format-aware tooling must leave the source untouched. */
readonly sourceFormat?: ContractSourceFormat;
readonly inputs?: readonly string[];
readonly load: (context: ContractSourceContext) => Promise<Result<Contract, ContractSourceDiagnostics>>;
}
//#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 { 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 };
//# sourceMappingURL=config-types-BxURjD5t.d.mts.map
{"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,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;;KAIC,oBAAA;AAAA,UAEK,sBAAA;EApBA;EAAA,SAsBN,YAAA,GAAe,oBAAA;EAAA,SACf,MAAA;EAAA,SACA,IAAA,GACP,OAAA,EAAS,qBAAA,KACN,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,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