@prisma-next/sql-contract 0.3.0-dev.71 → 0.3.0-dev.72
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/dist/factories.d.mts +1 -1
- package/dist/{types-T6o5-ZB3.d.mts → types-BaAbD2Bc.d.mts} +11 -1
- package/dist/types-BaAbD2Bc.d.mts.map +1 -0
- package/dist/types-kacOgEya.mjs.map +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/validate.d.mts +2 -1
- package/dist/validate.d.mts.map +1 -1
- package/dist/validate.mjs +1 -1
- package/dist/{validators-Dz93b38w.mjs → validators-CQXvLZa7.mjs} +6 -4
- package/dist/validators-CQXvLZa7.mjs.map +1 -0
- package/dist/validators.d.mts +8 -2
- package/dist/validators.d.mts.map +1 -1
- package/dist/validators.mjs +2 -2
- package/package.json +2 -2
- package/src/types.ts +10 -0
- package/src/validators.ts +3 -2
- package/dist/types-T6o5-ZB3.d.mts.map +0 -1
- package/dist/validators-Dz93b38w.mjs.map +0 -1
package/dist/factories.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as StorageColumn, a as ForeignKey, b as UniqueConstraint, c as Index, f as PrimaryKey, g as SqlStorage, h as SqlMappings, l as ModelDefinition, m as SqlContract, o as ForeignKeyOptions, u as ModelField, v as StorageTable } from "./types-
|
|
1
|
+
import { _ as StorageColumn, a as ForeignKey, b as UniqueConstraint, c as Index, f as PrimaryKey, g as SqlStorage, h as SqlMappings, l as ModelDefinition, m as SqlContract, o as ForeignKeyOptions, u as ModelField, v as StorageTable } from "./types-BaAbD2Bc.mjs";
|
|
2
2
|
import { ExecutionHashBase, ProfileHashBase, StorageHashBase } from "@prisma-next/contract/types";
|
|
3
3
|
|
|
4
4
|
//#region src/factories.d.ts
|
|
@@ -41,6 +41,16 @@ type UniqueConstraint = {
|
|
|
41
41
|
type Index = {
|
|
42
42
|
readonly columns: readonly string[];
|
|
43
43
|
readonly name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional access method identifier.
|
|
46
|
+
* Extension-specific methods are represented as strings and interpreted
|
|
47
|
+
* by the owning extension package.
|
|
48
|
+
*/
|
|
49
|
+
readonly using?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional extension-owned index configuration payload.
|
|
52
|
+
*/
|
|
53
|
+
readonly config?: Record<string, unknown>;
|
|
44
54
|
};
|
|
45
55
|
type ForeignKeyReferences = {
|
|
46
56
|
readonly table: string;
|
|
@@ -142,4 +152,4 @@ type ExtractCodecTypes<TContract extends SqlContract<SqlStorage>> = TContract['m
|
|
|
142
152
|
type ExtractOperationTypes<TContract extends SqlContract<SqlStorage>> = TContract['mappings']['operationTypes'];
|
|
143
153
|
//#endregion
|
|
144
154
|
export { StorageColumn as _, ForeignKey as a, UniqueConstraint as b, Index as c, ModelStorage as d, PrimaryKey as f, SqlStorage as g, SqlMappings as h, ExtractOperationTypes as i, ModelDefinition as l, SqlContract as m, DEFAULT_FK_INDEX as n, ForeignKeyOptions as o, ReferentialAction as p, ExtractCodecTypes as r, ForeignKeyReferences as s, DEFAULT_FK_CONSTRAINT as t, ModelField as u, StorageTable as v, applyFkDefaults as x, StorageTypeInstance as y };
|
|
145
|
-
//# sourceMappingURL=types-
|
|
155
|
+
//# sourceMappingURL=types-BaAbD2Bc.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BaAbD2Bc.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;AAgBA;AAsBA;AAKA;AAKA;AAeA;AAKY,KApDA,aAAA,GAoDiB;EAEjB,SAAA,UAAA,EAAiB,MAAA;EAMjB,SAAA,OAAU,EAAA,MAAA;EAEC,SAAA,QAAA,EAAA,OAAA;EAED;;;AAQtB;;EACoB,SAAA,UAAA,CAAA,EAhEI,MAgEJ,CAAA,MAAA,EAAA,OAAA,CAAA;EACI;;;;EAEJ,SAAA,OAAA,CAAA,EAAA,MAAA;EACkB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MAgFhB,CAAA,MAAA,EAhF+B,aAgF/B,CAAA;EAEgB,SAAA,UAAA,CAAA,EAjFI,UAiFJ;EACD,SAAA,OAAA,EAjFC,aAiFD,CAjFe,gBAiFf,CAAA;EACG,SAAA,OAAA,EAjFF,aAiFE,CAjFY,KAiFZ,CAAA;EACD,SAAA,WAAA,EAjFG,aAiFH,CAjFiB,UAiFjB,CAAA;CACE;;AAGvB;;;;;AAGA;;;;AACW,KA5EC,mBAAA,GA4ED;;;uBAzEY;;KAGX,UAAA;mBACO,eAAe;;;;;mBAKf,eAAe;;KAGtB,UAAA;;;KAIA,YAAA;;;KAIA,eAAA;oBACQ;mBACD,eAAe;sBACZ;;KAGV,WAAA;0BACc;0BACA;2BACC,eAAe;2BACf,eAAe;uBACnB;;;2BACI,eAAe;;cAG7B,qBAAA;cACA,gBAAA;;;;;iBAMG,eAAA;;;;;;;;;;KAUJ,sBACA,aAAa,sBACb,0BAA0B,mCAC1B,0BAA0B,qCACxB,cAAc,kCACL,0BAA0B,gDACxB,4BAA4B,gDAC9B,0BAA0B,2BAC7C,aAAa,cAAc,gBAAgB;;oBAE3B;mBACD;sBACG;qBACD;uBACE;;KAGX,oCAAoC,YAAY,eAC1D;KAEU,wCAAwC,YAAY,eAC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-kacOgEya.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type {\n ColumnDefault,\n ContractBase,\n ExecutionHashBase,\n ExecutionSection,\n ProfileHashBase,\n StorageHashBase,\n} from '@prisma-next/contract/types';\n\n/**\n * A column definition in storage.\n *\n * `typeParams` is optional because most columns use non-parameterized types.\n * Columns with parameterized types can either inline `typeParams` or reference\n * a named {@link StorageTypeInstance} via `typeRef`.\n */\nexport type StorageColumn = {\n readonly nativeType: string;\n readonly codecId: string;\n readonly nullable: boolean;\n /**\n * Opaque, codec-owned JS/type parameters.\n * The codec that owns `codecId` defines the shape and semantics.\n * Mutually exclusive with `typeRef`.\n */\n readonly typeParams?: Record<string, unknown>;\n /**\n * Reference to a named type instance in `storage.types`.\n * Mutually exclusive with `typeParams`.\n */\n readonly typeRef?: string;\n /**\n * Default value for the column.\n * Can be a literal value or database function.\n */\n readonly default?: ColumnDefault;\n};\n\nexport type PrimaryKey = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type UniqueConstraint = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type Index = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type ForeignKeyReferences = {\n readonly table: string;\n readonly columns: readonly string[];\n};\n\nexport type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';\n\nexport type ForeignKeyOptions = {\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n};\n\nexport type ForeignKey = {\n readonly columns: readonly string[];\n readonly references: ForeignKeyReferences;\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n /** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */\n readonly constraint: boolean;\n /** Whether to emit a backing index for the FK columns. */\n readonly index: boolean;\n};\n\nexport type StorageTable = {\n readonly columns: Record<string, StorageColumn>;\n readonly primaryKey?: PrimaryKey;\n readonly uniques: ReadonlyArray<UniqueConstraint>;\n readonly indexes: ReadonlyArray<Index>;\n readonly foreignKeys: ReadonlyArray<ForeignKey>;\n};\n\n/**\n * A named, parameterized type instance.\n * These are registered in `storage.types` for reuse across columns\n * and to enable ergonomic schema surfaces like `schema.types.MyType`.\n *\n * Unlike {@link StorageColumn}, `typeParams` is required here because\n * `StorageTypeInstance` exists specifically to define reusable parameterized types.\n * A type instance without parameters would be redundant—columns can reference\n * the codec directly via `codecId`.\n */\nexport type StorageTypeInstance = {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams: Record<string, unknown>;\n};\n\nexport type SqlStorage = {\n readonly tables: Record<string, StorageTable>;\n /**\n * Named type instances for parameterized/custom types.\n * Columns can reference these via `typeRef`.\n */\n readonly types?: Record<string, StorageTypeInstance>;\n};\n\nexport type ModelField = {\n readonly column: string;\n};\n\nexport type ModelStorage = {\n readonly table: string;\n};\n\nexport type ModelDefinition = {\n readonly storage: ModelStorage;\n readonly fields: Record<string, ModelField>;\n readonly relations: Record<string, unknown>;\n};\n\nexport type SqlMappings = {\n readonly modelToTable?: Record<string, string>;\n readonly tableToModel?: Record<string, string>;\n readonly fieldToColumn?: Record<string, Record<string, string>>;\n readonly columnToField?: Record<string, Record<string, string>>;\n readonly codecTypes: Record<string, { readonly output: unknown }>;\n readonly operationTypes: Record<string, Record<string, unknown>>;\n};\n\nexport const DEFAULT_FK_CONSTRAINT = true;\nexport const DEFAULT_FK_INDEX = true;\n\n/**\n * Resolves foreign key `constraint` and `index` fields to their effective boolean values,\n * falling back through optional override defaults, then to the global defaults.\n */\nexport function applyFkDefaults(\n fk: { constraint?: boolean | undefined; index?: boolean | undefined },\n overrideDefaults?: { constraint?: boolean | undefined; index?: boolean | undefined },\n): { constraint: boolean; index: boolean } {\n return {\n constraint: fk.constraint ?? overrideDefaults?.constraint ?? DEFAULT_FK_CONSTRAINT,\n index: fk.index ?? overrideDefaults?.index ?? DEFAULT_FK_INDEX,\n };\n}\n\nexport type SqlContract<\n S extends SqlStorage = SqlStorage,\n M extends Record<string, unknown> = Record<string, unknown>,\n R extends Record<string, unknown> = Record<string, unknown>,\n Map extends SqlMappings = SqlMappings,\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n> = ContractBase<TStorageHash, TExecutionHash, TProfileHash> & {\n readonly targetFamily: string;\n readonly storage: S;\n readonly models: M;\n readonly relations: R;\n readonly mappings: Map;\n readonly execution?: ExecutionSection;\n};\n\nexport type ExtractCodecTypes<TContract extends SqlContract<SqlStorage>> =\n TContract['mappings']['codecTypes'];\n\nexport type ExtractOperationTypes<TContract extends SqlContract<SqlStorage>> =\n TContract['mappings']['operationTypes'];\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"types-kacOgEya.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type {\n ColumnDefault,\n ContractBase,\n ExecutionHashBase,\n ExecutionSection,\n ProfileHashBase,\n StorageHashBase,\n} from '@prisma-next/contract/types';\n\n/**\n * A column definition in storage.\n *\n * `typeParams` is optional because most columns use non-parameterized types.\n * Columns with parameterized types can either inline `typeParams` or reference\n * a named {@link StorageTypeInstance} via `typeRef`.\n */\nexport type StorageColumn = {\n readonly nativeType: string;\n readonly codecId: string;\n readonly nullable: boolean;\n /**\n * Opaque, codec-owned JS/type parameters.\n * The codec that owns `codecId` defines the shape and semantics.\n * Mutually exclusive with `typeRef`.\n */\n readonly typeParams?: Record<string, unknown>;\n /**\n * Reference to a named type instance in `storage.types`.\n * Mutually exclusive with `typeParams`.\n */\n readonly typeRef?: string;\n /**\n * Default value for the column.\n * Can be a literal value or database function.\n */\n readonly default?: ColumnDefault;\n};\n\nexport type PrimaryKey = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type UniqueConstraint = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type Index = {\n readonly columns: readonly string[];\n readonly name?: string;\n /**\n * Optional access method identifier.\n * Extension-specific methods are represented as strings and interpreted\n * by the owning extension package.\n */\n readonly using?: string;\n /**\n * Optional extension-owned index configuration payload.\n */\n readonly config?: Record<string, unknown>;\n};\n\nexport type ForeignKeyReferences = {\n readonly table: string;\n readonly columns: readonly string[];\n};\n\nexport type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';\n\nexport type ForeignKeyOptions = {\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n};\n\nexport type ForeignKey = {\n readonly columns: readonly string[];\n readonly references: ForeignKeyReferences;\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n /** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */\n readonly constraint: boolean;\n /** Whether to emit a backing index for the FK columns. */\n readonly index: boolean;\n};\n\nexport type StorageTable = {\n readonly columns: Record<string, StorageColumn>;\n readonly primaryKey?: PrimaryKey;\n readonly uniques: ReadonlyArray<UniqueConstraint>;\n readonly indexes: ReadonlyArray<Index>;\n readonly foreignKeys: ReadonlyArray<ForeignKey>;\n};\n\n/**\n * A named, parameterized type instance.\n * These are registered in `storage.types` for reuse across columns\n * and to enable ergonomic schema surfaces like `schema.types.MyType`.\n *\n * Unlike {@link StorageColumn}, `typeParams` is required here because\n * `StorageTypeInstance` exists specifically to define reusable parameterized types.\n * A type instance without parameters would be redundant—columns can reference\n * the codec directly via `codecId`.\n */\nexport type StorageTypeInstance = {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams: Record<string, unknown>;\n};\n\nexport type SqlStorage = {\n readonly tables: Record<string, StorageTable>;\n /**\n * Named type instances for parameterized/custom types.\n * Columns can reference these via `typeRef`.\n */\n readonly types?: Record<string, StorageTypeInstance>;\n};\n\nexport type ModelField = {\n readonly column: string;\n};\n\nexport type ModelStorage = {\n readonly table: string;\n};\n\nexport type ModelDefinition = {\n readonly storage: ModelStorage;\n readonly fields: Record<string, ModelField>;\n readonly relations: Record<string, unknown>;\n};\n\nexport type SqlMappings = {\n readonly modelToTable?: Record<string, string>;\n readonly tableToModel?: Record<string, string>;\n readonly fieldToColumn?: Record<string, Record<string, string>>;\n readonly columnToField?: Record<string, Record<string, string>>;\n readonly codecTypes: Record<string, { readonly output: unknown }>;\n readonly operationTypes: Record<string, Record<string, unknown>>;\n};\n\nexport const DEFAULT_FK_CONSTRAINT = true;\nexport const DEFAULT_FK_INDEX = true;\n\n/**\n * Resolves foreign key `constraint` and `index` fields to their effective boolean values,\n * falling back through optional override defaults, then to the global defaults.\n */\nexport function applyFkDefaults(\n fk: { constraint?: boolean | undefined; index?: boolean | undefined },\n overrideDefaults?: { constraint?: boolean | undefined; index?: boolean | undefined },\n): { constraint: boolean; index: boolean } {\n return {\n constraint: fk.constraint ?? overrideDefaults?.constraint ?? DEFAULT_FK_CONSTRAINT,\n index: fk.index ?? overrideDefaults?.index ?? DEFAULT_FK_INDEX,\n };\n}\n\nexport type SqlContract<\n S extends SqlStorage = SqlStorage,\n M extends Record<string, unknown> = Record<string, unknown>,\n R extends Record<string, unknown> = Record<string, unknown>,\n Map extends SqlMappings = SqlMappings,\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n> = ContractBase<TStorageHash, TExecutionHash, TProfileHash> & {\n readonly targetFamily: string;\n readonly storage: S;\n readonly models: M;\n readonly relations: R;\n readonly mappings: Map;\n readonly execution?: ExecutionSection;\n};\n\nexport type ExtractCodecTypes<TContract extends SqlContract<SqlStorage>> =\n TContract['mappings']['codecTypes'];\n\nexport type ExtractOperationTypes<TContract extends SqlContract<SqlStorage>> =\n TContract['mappings']['operationTypes'];\n"],"mappings":";AAgJA,MAAa,wBAAwB;AACrC,MAAa,mBAAmB;;;;;AAMhC,SAAgB,gBACd,IACA,kBACyC;AACzC,QAAO;EACL,YAAY,GAAG,cAAc,kBAAkB,cAAc;EAC7D,OAAO,GAAG,SAAS,kBAAkB,SAAS;EAC/C"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as StorageColumn, a as ForeignKey, b as UniqueConstraint, c as Index, d as ModelStorage, f as PrimaryKey, g as SqlStorage, h as SqlMappings, i as ExtractOperationTypes, l as ModelDefinition, m as SqlContract, n as DEFAULT_FK_INDEX, o as ForeignKeyOptions, p as ReferentialAction, r as ExtractCodecTypes, s as ForeignKeyReferences, t as DEFAULT_FK_CONSTRAINT, u as ModelField, v as StorageTable, x as applyFkDefaults, y as StorageTypeInstance } from "./types-
|
|
1
|
+
import { _ as StorageColumn, a as ForeignKey, b as UniqueConstraint, c as Index, d as ModelStorage, f as PrimaryKey, g as SqlStorage, h as SqlMappings, i as ExtractOperationTypes, l as ModelDefinition, m as SqlContract, n as DEFAULT_FK_INDEX, o as ForeignKeyOptions, p as ReferentialAction, r as ExtractCodecTypes, s as ForeignKeyReferences, t as DEFAULT_FK_CONSTRAINT, u as ModelField, v as StorageTable, x as applyFkDefaults, y as StorageTypeInstance } from "./types-BaAbD2Bc.mjs";
|
|
2
2
|
export { DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, type ExtractCodecTypes, type ExtractOperationTypes, type ForeignKey, type ForeignKeyOptions, type ForeignKeyReferences, type Index, type ModelDefinition, type ModelField, type ModelStorage, type PrimaryKey, type ReferentialAction, type SqlContract, type SqlMappings, type SqlStorage, type StorageColumn, type StorageTable, type StorageTypeInstance, type UniqueConstraint, applyFkDefaults };
|
package/dist/validate.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { _ as StorageColumn, g as SqlStorage, m as SqlContract } from "./types-
|
|
1
|
+
import { _ as StorageColumn, g as SqlStorage, m as SqlContract } from "./types-BaAbD2Bc.mjs";
|
|
2
|
+
import "@prisma-next/contract/types";
|
|
2
3
|
|
|
3
4
|
//#region src/validate.d.ts
|
|
4
5
|
declare function isBigIntColumn(column: StorageColumn): boolean;
|
package/dist/validate.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.mts","names":[],"sources":["../src/validate.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.mts","names":[],"sources":["../src/validate.ts"],"sourcesContent":[],"mappings":";;;;iBA6PgB,cAAA,SAAuB;AAAvB,iBAkCA,sBAlCuB,CAAa,UAkCH,WAlCG,CAkCS,UAlCT,CAAA,CAAA,CAAA,QAAA,EAkCgC,CAlChC,CAAA,EAkCoC,CAlCpC;AAkCpC,iBAqDA,iBAAA,CArDsB,QAAA,EAAA,OAAA,CAAA,EAqDgB,WArDhB,CAqD4B,UArD5B,CAAA;AAAuB,iBAwI7C,gBAxI6C,CAAA,kBAwIV,WAxIU,CAwIE,UAxIF,CAAA,CAAA,CAAA,KAAA,EAAA,OAAA,CAAA,EA0I1D,SA1I0D"}
|
package/dist/validate.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as applyFkDefaults } from "./types-kacOgEya.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as validateStorageSemantics, l as validateSqlContract } from "./validators-CQXvLZa7.mjs";
|
|
3
3
|
import { isTaggedBigInt, isTaggedRaw } from "@prisma-next/contract/types";
|
|
4
4
|
|
|
5
5
|
//#region src/validate.ts
|
|
@@ -62,9 +62,11 @@ const UniqueConstraintSchema = type.declare().type({
|
|
|
62
62
|
columns: type.string.array().readonly(),
|
|
63
63
|
"name?": "string"
|
|
64
64
|
});
|
|
65
|
-
const IndexSchema = type
|
|
65
|
+
const IndexSchema = type({
|
|
66
66
|
columns: type.string.array().readonly(),
|
|
67
|
-
"name?": "string"
|
|
67
|
+
"name?": "string",
|
|
68
|
+
"using?": "string",
|
|
69
|
+
"config?": "Record<string, unknown>"
|
|
68
70
|
});
|
|
69
71
|
const ForeignKeyReferencesSchema = type.declare().type({
|
|
70
72
|
table: "string",
|
|
@@ -210,5 +212,5 @@ function validateStorageSemantics(storage) {
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
//#endregion
|
|
213
|
-
export { ForeignKeySchema as a,
|
|
214
|
-
//# sourceMappingURL=validators-
|
|
215
|
+
export { ForeignKeySchema as a, validateModel as c, validateStorageSemantics as d, ForeignKeyReferencesSchema as i, validateSqlContract as l, ColumnDefaultLiteralSchema as n, IndexSchema as o, ColumnDefaultSchema as r, ReferentialActionSchema as s, ColumnDefaultFunctionSchema as t, validateStorage as u };
|
|
216
|
+
//# sourceMappingURL=validators-CQXvLZa7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators-CQXvLZa7.mjs","names":["errors: string[]"],"sources":["../src/validators.ts"],"sourcesContent":["import { type } from 'arktype';\nimport type {\n ForeignKey,\n ForeignKeyReferences,\n ModelDefinition,\n ModelField,\n ModelStorage,\n PrimaryKey,\n ReferentialAction,\n SqlContract,\n SqlStorage,\n StorageTypeInstance,\n UniqueConstraint,\n} from './types';\n\ntype ColumnDefaultLiteral = {\n readonly kind: 'literal';\n readonly value: string | number | boolean | Record<string, unknown> | unknown[] | null;\n};\ntype ColumnDefaultFunction = { readonly kind: 'function'; readonly expression: string };\nconst literalKindSchema = type(\"'literal'\");\nconst functionKindSchema = type(\"'function'\");\nconst generatorKindSchema = type(\"'generator'\");\nconst generatorIdSchema = type(\"'ulid' | 'nanoid' | 'uuidv7' | 'uuidv4' | 'cuid2' | 'ksuid'\");\n\nexport const ColumnDefaultLiteralSchema = type.declare<ColumnDefaultLiteral>().type({\n kind: literalKindSchema,\n value: 'string | number | boolean | null | unknown[] | Record<string, unknown>',\n});\n\nexport const ColumnDefaultFunctionSchema = type.declare<ColumnDefaultFunction>().type({\n kind: functionKindSchema,\n expression: 'string',\n});\n\nexport const ColumnDefaultSchema = ColumnDefaultLiteralSchema.or(ColumnDefaultFunctionSchema);\n\nconst ExecutionMutationDefaultValueSchema = type({\n '+': 'reject',\n kind: generatorKindSchema,\n id: generatorIdSchema,\n 'params?': 'Record<string, unknown>',\n});\n\nconst ExecutionMutationDefaultSchema = type({\n '+': 'reject',\n ref: {\n '+': 'reject',\n table: 'string',\n column: 'string',\n },\n 'onCreate?': ExecutionMutationDefaultValueSchema,\n 'onUpdate?': ExecutionMutationDefaultValueSchema,\n});\n\nconst ExecutionSchema = type({\n '+': 'reject',\n mutations: {\n '+': 'reject',\n defaults: ExecutionMutationDefaultSchema.array().readonly(),\n },\n});\n\nconst StorageColumnSchema = type({\n '+': 'reject',\n nativeType: 'string',\n codecId: 'string',\n nullable: 'boolean',\n 'typeParams?': 'Record<string, unknown>',\n 'typeRef?': 'string',\n 'default?': ColumnDefaultSchema,\n}).narrow((col, ctx) => {\n if (col.typeParams !== undefined && col.typeRef !== undefined) {\n return ctx.mustBe('a column with either typeParams or typeRef, not both');\n }\n return true;\n});\n\nconst StorageTypeInstanceSchema = type.declare<StorageTypeInstance>().type({\n codecId: 'string',\n nativeType: 'string',\n typeParams: 'Record<string, unknown>',\n});\n\nconst PrimaryKeySchema = type.declare<PrimaryKey>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst UniqueConstraintSchema = type.declare<UniqueConstraint>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nexport const IndexSchema = type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n 'using?': 'string',\n 'config?': 'Record<string, unknown>',\n});\n\nexport const ForeignKeyReferencesSchema = type.declare<ForeignKeyReferences>().type({\n table: 'string',\n columns: type.string.array().readonly(),\n});\n\nexport const ReferentialActionSchema = type\n .declare<ReferentialAction>()\n .type(\"'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault'\");\n\nexport const ForeignKeySchema = type.declare<ForeignKey>().type({\n columns: type.string.array().readonly(),\n references: ForeignKeyReferencesSchema,\n 'name?': 'string',\n 'onDelete?': ReferentialActionSchema,\n 'onUpdate?': ReferentialActionSchema,\n constraint: 'boolean',\n index: 'boolean',\n});\n\nconst StorageTableSchema = type({\n '+': 'reject',\n columns: type({ '[string]': StorageColumnSchema }),\n 'primaryKey?': PrimaryKeySchema,\n uniques: UniqueConstraintSchema.array().readonly(),\n indexes: IndexSchema.array().readonly(),\n foreignKeys: ForeignKeySchema.array().readonly(),\n});\n\nconst StorageSchema = type({\n '+': 'reject',\n tables: type({ '[string]': StorageTableSchema }),\n 'types?': type({ '[string]': StorageTypeInstanceSchema }),\n});\n\nconst ModelFieldSchema = type.declare<ModelField>().type({\n column: 'string',\n});\n\nconst ModelStorageSchema = type.declare<ModelStorage>().type({\n table: 'string',\n});\n\nconst ModelSchema = type.declare<ModelDefinition>().type({\n storage: ModelStorageSchema,\n fields: type({ '[string]': ModelFieldSchema }),\n relations: type({ '[string]': 'unknown' }),\n});\n\nconst MappingsSchema = type({\n '+': 'reject',\n 'modelToTable?': 'null | Record<string, string>',\n 'tableToModel?': 'null | Record<string, string>',\n 'fieldToColumn?': 'null | Record<string, Record<string, string>>',\n 'columnToField?': 'null | Record<string, Record<string, string>>',\n 'codecTypes?': 'null | Record<string, unknown>',\n 'operationTypes?': 'null | Record<string, Record<string, unknown>>',\n});\n\nconst ContractMetaSchema = type({\n '[string]': 'unknown',\n});\n\nconst SqlContractSchema = type({\n '+': 'reject',\n 'schemaVersion?': \"'1'\",\n target: 'string',\n targetFamily: \"'sql'\",\n 'coreHash?': 'string',\n storageHash: 'string',\n 'executionHash?': 'string',\n 'profileHash?': 'string',\n '_generated?': 'Record<string, unknown>',\n 'capabilities?': 'Record<string, Record<string, boolean>>',\n 'extensionPacks?': 'Record<string, unknown>',\n 'meta?': ContractMetaSchema,\n 'sources?': 'Record<string, unknown>',\n 'relations?': type({ '[string]': 'unknown' }),\n 'mappings?': MappingsSchema,\n models: type({ '[string]': ModelSchema }),\n storage: StorageSchema,\n 'execution?': ExecutionSchema,\n});\n\n// NOTE: StorageColumnSchema, StorageTableSchema, and StorageSchema use bare type()\n// instead of type.declare<T>().type() because the ColumnDefault union's value field\n// includes bigint | Date (runtime-only types after decoding) which cannot be expressed\n// in Arktype's JSON validation DSL. The `as SqlStorage` cast in validateStorage() bridges\n// the gap between the JSON-safe Arktype output and the runtime TypeScript type.\n// See decodeContractDefaults() in validate.ts for the decoding step.\n\n/**\n * Validates the structural shape of SqlStorage using Arktype.\n *\n * @param value - The storage value to validate\n * @returns The validated storage if structure is valid\n * @throws Error if the storage structure is invalid\n */\nexport function validateStorage(value: unknown): SqlStorage {\n const result = StorageSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Storage validation failed: ${messages}`);\n }\n return result as SqlStorage;\n}\n\n/**\n * Validates the structural shape of ModelDefinition using Arktype.\n *\n * @param value - The model value to validate\n * @returns The validated model if structure is valid\n * @throws Error if the model structure is invalid\n */\nexport function validateModel(value: unknown): ModelDefinition {\n const result = ModelSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Model validation failed: ${messages}`);\n }\n return result;\n}\n\n/**\n * Validates the structural shape of a SqlContract using Arktype.\n *\n * **Responsibility: Validation Only**\n * This function validates that the contract has the correct structure and types.\n * It does NOT normalize the contract - normalization must happen in the contract builder.\n *\n * The contract passed to this function must already be normalized (all required fields present).\n * If normalization is needed, it should be done by the contract builder before calling this function.\n *\n * This ensures all required fields are present and have the correct types.\n *\n * @param value - The contract value to validate (typically from a JSON import)\n * @returns The validated contract if structure is valid\n * @throws Error if the contract structure is invalid\n */\nexport function validateSqlContract<T extends SqlContract<SqlStorage>>(value: unknown): T {\n if (typeof value !== 'object' || value === null) {\n throw new Error('Contract structural validation failed: value must be an object');\n }\n\n // Check targetFamily first to provide a clear error message for unsupported target families\n const rawValue = value as { targetFamily?: string };\n if (rawValue.targetFamily !== undefined && rawValue.targetFamily !== 'sql') {\n throw new Error(`Unsupported target family: ${rawValue.targetFamily}`);\n }\n\n const contractResult = SqlContractSchema(value);\n\n if (contractResult instanceof type.errors) {\n const messages = contractResult.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Contract structural validation failed: ${messages}`);\n }\n\n // After validation, contractResult matches the schema and preserves the input structure\n // TypeScript needs an assertion here due to exactOptionalPropertyTypes differences\n // between Arktype's inferred type and the generic T, but runtime-wise they're compatible\n return contractResult as T;\n}\n\n/**\n * Validates semantic constraints on SqlStorage that cannot be expressed in Arktype schemas.\n *\n * Returns an array of human-readable error strings. Empty array = valid.\n *\n * Currently checks:\n * - `setNull` referential action on a non-nullable FK column (would fail at runtime)\n * - `setDefault` referential action on a non-nullable FK column without a DEFAULT (would fail at runtime)\n */\nexport function validateStorageSemantics(storage: SqlStorage): string[] {\n const errors: string[] = [];\n\n for (const [tableName, table] of Object.entries(storage.tables)) {\n for (const fk of table.foreignKeys) {\n for (const colName of fk.columns) {\n const column = table.columns[colName];\n if (!column) continue;\n\n if (fk.onDelete === 'setNull' && !column.nullable) {\n errors.push(\n `Table \"${tableName}\": onDelete setNull on foreign key column \"${colName}\" which is NOT NULL`,\n );\n }\n if (fk.onUpdate === 'setNull' && !column.nullable) {\n errors.push(\n `Table \"${tableName}\": onUpdate setNull on foreign key column \"${colName}\" which is NOT NULL`,\n );\n }\n if (fk.onDelete === 'setDefault' && !column.nullable && column.default === undefined) {\n errors.push(\n `Table \"${tableName}\": onDelete setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`,\n );\n }\n if (fk.onUpdate === 'setDefault' && !column.nullable && column.default === undefined) {\n errors.push(\n `Table \"${tableName}\": onUpdate setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`,\n );\n }\n }\n }\n }\n\n return errors;\n}\n"],"mappings":";;;AAoBA,MAAM,oBAAoB,KAAK,YAAY;AAC3C,MAAM,qBAAqB,KAAK,aAAa;AAC7C,MAAM,sBAAsB,KAAK,cAAc;AAC/C,MAAM,oBAAoB,KAAK,8DAA8D;AAE7F,MAAa,6BAA6B,KAAK,SAA+B,CAAC,KAAK;CAClF,MAAM;CACN,OAAO;CACR,CAAC;AAEF,MAAa,8BAA8B,KAAK,SAAgC,CAAC,KAAK;CACpF,MAAM;CACN,YAAY;CACb,CAAC;AAEF,MAAa,sBAAsB,2BAA2B,GAAG,4BAA4B;AAE7F,MAAM,sCAAsC,KAAK;CAC/C,KAAK;CACL,MAAM;CACN,IAAI;CACJ,WAAW;CACZ,CAAC;AAEF,MAAM,iCAAiC,KAAK;CAC1C,KAAK;CACL,KAAK;EACH,KAAK;EACL,OAAO;EACP,QAAQ;EACT;CACD,aAAa;CACb,aAAa;CACd,CAA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AAQ,wCAC7E;AAEH,MAAI,GAAG,aAAa,gBAAgB,CAAC,OAAO,YAAY,OAAO,YAAY,OACzE,QAAO,KACL,UAAU,UAAU,gDAAgD,QAAQ,wCAC7E;;AAMT,QAAO"}
|
package/dist/validators.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ForeignKey, g as SqlStorage, l as ModelDefinition, m as SqlContract, p as ReferentialAction, s as ForeignKeyReferences } from "./types-
|
|
1
|
+
import { a as ForeignKey, g as SqlStorage, l as ModelDefinition, m as SqlContract, p as ReferentialAction, s as ForeignKeyReferences } from "./types-BaAbD2Bc.mjs";
|
|
2
2
|
import * as arktype_internal_variants_object_ts0 from "arktype/internal/variants/object.ts";
|
|
3
3
|
import * as arktype_internal_variants_string_ts0 from "arktype/internal/variants/string.ts";
|
|
4
4
|
|
|
@@ -14,6 +14,12 @@ type ColumnDefaultFunction = {
|
|
|
14
14
|
declare const ColumnDefaultLiteralSchema: arktype_internal_variants_object_ts0.ObjectType<ColumnDefaultLiteral, {}>;
|
|
15
15
|
declare const ColumnDefaultFunctionSchema: arktype_internal_variants_object_ts0.ObjectType<ColumnDefaultFunction, {}>;
|
|
16
16
|
declare const ColumnDefaultSchema: arktype_internal_variants_object_ts0.ObjectType<ColumnDefaultLiteral | ColumnDefaultFunction, {}>;
|
|
17
|
+
declare const IndexSchema: arktype_internal_variants_object_ts0.ObjectType<{
|
|
18
|
+
columns: readonly string[];
|
|
19
|
+
name?: string;
|
|
20
|
+
using?: string;
|
|
21
|
+
config?: Record<string, unknown>;
|
|
22
|
+
}, {}>;
|
|
17
23
|
declare const ForeignKeyReferencesSchema: arktype_internal_variants_object_ts0.ObjectType<ForeignKeyReferences, {}>;
|
|
18
24
|
declare const ReferentialActionSchema: arktype_internal_variants_string_ts0.StringType<ReferentialAction, {}>;
|
|
19
25
|
declare const ForeignKeySchema: arktype_internal_variants_object_ts0.ObjectType<ForeignKey, {}>;
|
|
@@ -61,5 +67,5 @@ declare function validateSqlContract<T extends SqlContract<SqlStorage>>(value: u
|
|
|
61
67
|
*/
|
|
62
68
|
declare function validateStorageSemantics(storage: SqlStorage): string[];
|
|
63
69
|
//#endregion
|
|
64
|
-
export { ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ForeignKeyReferencesSchema, ForeignKeySchema, ReferentialActionSchema, validateModel, validateSqlContract, validateStorage, validateStorageSemantics };
|
|
70
|
+
export { ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ForeignKeyReferencesSchema, ForeignKeySchema, IndexSchema, ReferentialActionSchema, validateModel, validateSqlContract, validateStorage, validateStorageSemantics };
|
|
65
71
|
//# sourceMappingURL=validators.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","names":[],"sources":["../src/validators.ts"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"validators.d.mts","names":[],"sources":["../src/validators.ts"],"sourcesContent":[],"mappings":";;;;;KAeK,oBAAA;;8CAEyC;;AAJ7B,KAMZ,qBAAA,GAJoB;EAIpB,SAAA,IAAA,EAAA,UAAqB;EAMb,SAAA,UAAA,EAAA,MAAA;AAKb,CAAA;AAKa,cAVA,0BAUgF,EAVtD,oCAAA,CAAA,UAUsD,CAVtD,oBAUsD,EAAA,CAAA,CAAA,CAAA;AAA7D,cALnB,2BAKmB,EALQ,oCAAA,CAAA,UAKR,CALQ,qBAKR,EAAA,CAAA,CAAA,CAAA;AAAA,cAAnB,mBAAmB,EAAA,oCAAA,CAAA,UAAA,CAAA,oBAAA,GAAA,qBAAA,EAAA,CAAA,CAAA,CAAA;AAAA,cA2DnB,WA3DmB,EAgE9B,oCAAA,CALsB,UA3DQ,CAAA;EAAA,OAAA,EAAA,SAAA,MAAA,EAAA;EA2DnB,IAAA,CAAA,EAAA,MAAA;EAOA,KAAA,CAAA,EAAA,MAAA;EAKA,MAAA,CAAA,EAPX,MAOW,CAAA,MAAA,EAAA,OAE4D,CAAA;AAEzE,CAAA,EAAA,CAAa,CAAA,CAAA;AAwFG,cAjGH,0BAiG8C,EAjGpB,oCAAA,CAAA,UAiGoB,CAjGpB,oBAiGoB,EAAA,CAAA,CAAA,CAAA;AAgB3C,cA5GH,uBA4GkC,EA5GX,oCAAA,CAAA,UA4G0B,CA5G1B,iBA4G0B,EAAA,CAAA,CAAA,CAAA;AAyB9C,cAjIH,gBAiIsB,EAjIN,oCAAA,CAAA,UAiIM,CAjIN,UAiIM,EAAA,CAAA,CAAA,CAAA;;;;;AAiCnC;;;iBA1EgB,eAAA,kBAAiC;;;;;;;;iBAgBjC,aAAA,kBAA+B;;;;;;;;;;;;;;;;;iBAyB/B,8BAA8B,YAAY,8BAA8B;;;;;;;;;;iBAiCxE,wBAAA,UAAkC"}
|
package/dist/validators.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ForeignKeySchema, c as
|
|
1
|
+
import { a as ForeignKeySchema, c as validateModel, d as validateStorageSemantics, i as ForeignKeyReferencesSchema, l as validateSqlContract, n as ColumnDefaultLiteralSchema, o as IndexSchema, r as ColumnDefaultSchema, s as ReferentialActionSchema, t as ColumnDefaultFunctionSchema, u as validateStorage } from "./validators-CQXvLZa7.mjs";
|
|
2
2
|
|
|
3
|
-
export { ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ForeignKeyReferencesSchema, ForeignKeySchema, ReferentialActionSchema, validateModel, validateSqlContract, validateStorage, validateStorageSemantics };
|
|
3
|
+
export { ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ForeignKeyReferencesSchema, ForeignKeySchema, IndexSchema, ReferentialActionSchema, validateModel, validateSqlContract, validateStorage, validateStorageSemantics };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/sql-contract",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.72",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "SQL contract types, validators, and IR factories for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.1.25",
|
|
9
|
-
"@prisma-next/contract": "0.3.0-dev.
|
|
9
|
+
"@prisma-next/contract": "0.3.0-dev.72"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"tsdown": "0.18.4",
|
package/src/types.ts
CHANGED
|
@@ -49,6 +49,16 @@ export type UniqueConstraint = {
|
|
|
49
49
|
export type Index = {
|
|
50
50
|
readonly columns: readonly string[];
|
|
51
51
|
readonly name?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Optional access method identifier.
|
|
54
|
+
* Extension-specific methods are represented as strings and interpreted
|
|
55
|
+
* by the owning extension package.
|
|
56
|
+
*/
|
|
57
|
+
readonly using?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Optional extension-owned index configuration payload.
|
|
60
|
+
*/
|
|
61
|
+
readonly config?: Record<string, unknown>;
|
|
52
62
|
};
|
|
53
63
|
|
|
54
64
|
export type ForeignKeyReferences = {
|
package/src/validators.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { type } from 'arktype';
|
|
|
2
2
|
import type {
|
|
3
3
|
ForeignKey,
|
|
4
4
|
ForeignKeyReferences,
|
|
5
|
-
Index,
|
|
6
5
|
ModelDefinition,
|
|
7
6
|
ModelField,
|
|
8
7
|
ModelStorage,
|
|
@@ -93,9 +92,11 @@ const UniqueConstraintSchema = type.declare<UniqueConstraint>().type({
|
|
|
93
92
|
'name?': 'string',
|
|
94
93
|
});
|
|
95
94
|
|
|
96
|
-
const IndexSchema = type
|
|
95
|
+
export const IndexSchema = type({
|
|
97
96
|
columns: type.string.array().readonly(),
|
|
98
97
|
'name?': 'string',
|
|
98
|
+
'using?': 'string',
|
|
99
|
+
'config?': 'Record<string, unknown>',
|
|
99
100
|
});
|
|
100
101
|
|
|
101
102
|
export const ForeignKeyReferencesSchema = type.declare<ForeignKeyReferences>().type({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-T6o5-ZB3.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;AAgBA;AAsBA;AAKA;AAKA;AAKA;AAKY,KA1CA,aAAA,GA0CiB;EAEjB,SAAA,UAAA,EAAiB,MAAA;EAMjB,SAAA,OAAU,EAAA,MAAA;EAEC,SAAA,QAAA,EAAA,OAAA;EAED;;;AAQtB;;EACoB,SAAA,UAAA,CAAA,EAtDI,MAsDJ,CAAA,MAAA,EAAA,OAAA,CAAA;EACI;;;;EAEJ,SAAA,OAAA,CAAA,EAAA,MAAA;EACkB;;;AAatC;EAMY,SAAA,OAAU,CAAA,EAnED,aAmEC;CACY;AAAf,KAjEP,UAAA,GAiEO;EAKe,SAAA,OAAA,EAAA,SAAA,MAAA,EAAA;EAAf,SAAA,IAAA,CAAA,EAAA,MAAA;CAAM;AAGb,KApEA,gBAAA,GAoEU;EAIV,SAAA,OAAY,EAAA,SAAA,MAAA,EAAA;EAIZ,SAAA,IAAA,CAAA,EAAA,MAAe;CACP;AACc,KAzEtB,KAAA,GAyEsB;EAAf,SAAA,OAAA,EAAA,SAAA,MAAA,EAAA;EACG,SAAA,IAAA,CAAA,EAAA,MAAA;CAAM;AAGhB,KAxEA,oBAAA,GAwEW;EACG,SAAA,KAAA,EAAA,MAAA;EACA,SAAA,OAAA,EAAA,SAAA,MAAA,EAAA;CACgB;AAAf,KAtEf,iBAAA,GAsEe,UAAA,GAAA,UAAA,GAAA,SAAA,GAAA,SAAA,GAAA,YAAA;AACe,KArE9B,iBAAA,GAqE8B;EAAf,SAAA,IAAA,CAAA,EAAA,MAAA;EACJ,SAAA,QAAA,CAAA,EApED,iBAoEC;EACmB,SAAA,QAAA,CAAA,EApEpB,iBAoEoB;CAAf;AAAM,KAjErB,UAAA,GAiEqB;EAGpB,SAAA,O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;;KAGX,oCAAoC,YAAY,eAC1D;KAEU,wCAAwC,YAAY,eAC9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators-Dz93b38w.mjs","names":["errors: string[]"],"sources":["../src/validators.ts"],"sourcesContent":["import { type } from 'arktype';\nimport type {\n ForeignKey,\n ForeignKeyReferences,\n Index,\n ModelDefinition,\n ModelField,\n ModelStorage,\n PrimaryKey,\n ReferentialAction,\n SqlContract,\n SqlStorage,\n StorageTypeInstance,\n UniqueConstraint,\n} from './types';\n\ntype ColumnDefaultLiteral = {\n readonly kind: 'literal';\n readonly value: string | number | boolean | Record<string, unknown> | unknown[] | null;\n};\ntype ColumnDefaultFunction = { readonly kind: 'function'; readonly expression: string };\nconst literalKindSchema = type(\"'literal'\");\nconst functionKindSchema = type(\"'function'\");\nconst generatorKindSchema = type(\"'generator'\");\nconst generatorIdSchema = type(\"'ulid' | 'nanoid' | 'uuidv7' | 'uuidv4' | 'cuid2' | 'ksuid'\");\n\nexport const ColumnDefaultLiteralSchema = type.declare<ColumnDefaultLiteral>().type({\n kind: literalKindSchema,\n value: 'string | number | boolean | null | unknown[] | Record<string, unknown>',\n});\n\nexport const ColumnDefaultFunctionSchema = type.declare<ColumnDefaultFunction>().type({\n kind: functionKindSchema,\n expression: 'string',\n});\n\nexport const ColumnDefaultSchema = ColumnDefaultLiteralSchema.or(ColumnDefaultFunctionSchema);\n\nconst ExecutionMutationDefaultValueSchema = type({\n '+': 'reject',\n kind: generatorKindSchema,\n id: generatorIdSchema,\n 'params?': 'Record<string, unknown>',\n});\n\nconst ExecutionMutationDefaultSchema = type({\n '+': 'reject',\n ref: {\n '+': 'reject',\n table: 'string',\n column: 'string',\n },\n 'onCreate?': ExecutionMutationDefaultValueSchema,\n 'onUpdate?': ExecutionMutationDefaultValueSchema,\n});\n\nconst ExecutionSchema = type({\n '+': 'reject',\n mutations: {\n '+': 'reject',\n defaults: ExecutionMutationDefaultSchema.array().readonly(),\n },\n});\n\nconst StorageColumnSchema = type({\n '+': 'reject',\n nativeType: 'string',\n codecId: 'string',\n nullable: 'boolean',\n 'typeParams?': 'Record<string, unknown>',\n 'typeRef?': 'string',\n 'default?': ColumnDefaultSchema,\n}).narrow((col, ctx) => {\n if (col.typeParams !== undefined && col.typeRef !== undefined) {\n return ctx.mustBe('a column with either typeParams or typeRef, not both');\n }\n return true;\n});\n\nconst StorageTypeInstanceSchema = type.declare<StorageTypeInstance>().type({\n codecId: 'string',\n nativeType: 'string',\n typeParams: 'Record<string, unknown>',\n});\n\nconst PrimaryKeySchema = type.declare<PrimaryKey>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst UniqueConstraintSchema = type.declare<UniqueConstraint>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst IndexSchema = type.declare<Index>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nexport const ForeignKeyReferencesSchema = type.declare<ForeignKeyReferences>().type({\n table: 'string',\n columns: type.string.array().readonly(),\n});\n\nexport const ReferentialActionSchema = type\n .declare<ReferentialAction>()\n .type(\"'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault'\");\n\nexport const ForeignKeySchema = type.declare<ForeignKey>().type({\n columns: type.string.array().readonly(),\n references: ForeignKeyReferencesSchema,\n 'name?': 'string',\n 'onDelete?': ReferentialActionSchema,\n 'onUpdate?': ReferentialActionSchema,\n constraint: 'boolean',\n index: 'boolean',\n});\n\nconst StorageTableSchema = type({\n '+': 'reject',\n columns: type({ '[string]': StorageColumnSchema }),\n 'primaryKey?': PrimaryKeySchema,\n uniques: UniqueConstraintSchema.array().readonly(),\n indexes: IndexSchema.array().readonly(),\n foreignKeys: ForeignKeySchema.array().readonly(),\n});\n\nconst StorageSchema = type({\n '+': 'reject',\n tables: type({ '[string]': StorageTableSchema }),\n 'types?': type({ '[string]': StorageTypeInstanceSchema }),\n});\n\nconst ModelFieldSchema = type.declare<ModelField>().type({\n column: 'string',\n});\n\nconst ModelStorageSchema = type.declare<ModelStorage>().type({\n table: 'string',\n});\n\nconst ModelSchema = type.declare<ModelDefinition>().type({\n storage: ModelStorageSchema,\n fields: type({ '[string]': ModelFieldSchema }),\n relations: type({ '[string]': 'unknown' }),\n});\n\nconst MappingsSchema = type({\n '+': 'reject',\n 'modelToTable?': 'null | Record<string, string>',\n 'tableToModel?': 'null | Record<string, string>',\n 'fieldToColumn?': 'null | Record<string, Record<string, string>>',\n 'columnToField?': 'null | Record<string, Record<string, string>>',\n 'codecTypes?': 'null | Record<string, unknown>',\n 'operationTypes?': 'null | Record<string, Record<string, unknown>>',\n});\n\nconst ContractMetaSchema = type({\n '[string]': 'unknown',\n});\n\nconst SqlContractSchema = type({\n '+': 'reject',\n 'schemaVersion?': \"'1'\",\n target: 'string',\n targetFamily: \"'sql'\",\n 'coreHash?': 'string',\n storageHash: 'string',\n 'executionHash?': 'string',\n 'profileHash?': 'string',\n '_generated?': 'Record<string, unknown>',\n 'capabilities?': 'Record<string, Record<string, boolean>>',\n 'extensionPacks?': 'Record<string, unknown>',\n 'meta?': ContractMetaSchema,\n 'sources?': 'Record<string, unknown>',\n 'relations?': type({ '[string]': 'unknown' }),\n 'mappings?': MappingsSchema,\n models: type({ '[string]': ModelSchema }),\n storage: StorageSchema,\n 'execution?': ExecutionSchema,\n});\n\n// NOTE: StorageColumnSchema, StorageTableSchema, and StorageSchema use bare type()\n// instead of type.declare<T>().type() because the ColumnDefault union's value field\n// includes bigint | Date (runtime-only types after decoding) which cannot be expressed\n// in Arktype's JSON validation DSL. The `as SqlStorage` cast in validateStorage() bridges\n// the gap between the JSON-safe Arktype output and the runtime TypeScript type.\n// See decodeContractDefaults() in validate.ts for the decoding step.\n\n/**\n * Validates the structural shape of SqlStorage using Arktype.\n *\n * @param value - The storage value to validate\n * @returns The validated storage if structure is valid\n * @throws Error if the storage structure is invalid\n */\nexport function validateStorage(value: unknown): SqlStorage {\n const result = StorageSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Storage validation failed: ${messages}`);\n }\n return result as SqlStorage;\n}\n\n/**\n * Validates the structural shape of ModelDefinition using Arktype.\n *\n * @param value - The model value to validate\n * @returns The validated model if structure is valid\n * @throws Error if the model structure is invalid\n */\nexport function validateModel(value: unknown): ModelDefinition {\n const result = ModelSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Model validation failed: ${messages}`);\n }\n return result;\n}\n\n/**\n * Validates the structural shape of a SqlContract using Arktype.\n *\n * **Responsibility: Validation Only**\n * This function validates that the contract has the correct structure and types.\n * It does NOT normalize the contract - normalization must happen in the contract builder.\n *\n * The contract passed to this function must already be normalized (all required fields present).\n * If normalization is needed, it should be done by the contract builder before calling this function.\n *\n * This ensures all required fields are present and have the correct types.\n *\n * @param value - The contract value to validate (typically from a JSON import)\n * @returns The validated contract if structure is valid\n * @throws Error if the contract structure is invalid\n */\nexport function validateSqlContract<T extends SqlContract<SqlStorage>>(value: unknown): T {\n if (typeof value !== 'object' || value === null) {\n throw new Error('Contract structural validation failed: value must be an object');\n }\n\n // Check targetFamily first to provide a clear error message for unsupported target families\n const rawValue = value as { targetFamily?: string };\n if (rawValue.targetFamily !== undefined && rawValue.targetFamily !== 'sql') {\n throw new Error(`Unsupported target family: ${rawValue.targetFamily}`);\n }\n\n const contractResult = SqlContractSchema(value);\n\n if (contractResult instanceof type.errors) {\n const messages = contractResult.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Contract structural validation failed: ${messages}`);\n }\n\n // After validation, contractResult matches the schema and preserves the input structure\n // TypeScript needs an assertion here due to exactOptionalPropertyTypes differences\n // between Arktype's inferred type and the generic T, but runtime-wise they're compatible\n return contractResult as T;\n}\n\n/**\n * Validates semantic constraints on SqlStorage that cannot be expressed in Arktype schemas.\n *\n * Returns an array of human-readable error strings. Empty array = valid.\n *\n * Currently checks:\n * - `setNull` referential action on a non-nullable FK column (would fail at runtime)\n * - `setDefault` referential action on a non-nullable FK column without a DEFAULT (would fail at runtime)\n */\nexport function validateStorageSemantics(storage: SqlStorage): string[] {\n const errors: string[] = [];\n\n for (const [tableName, table] of Object.entries(storage.tables)) {\n for (const fk of table.foreignKeys) {\n for (const colName of fk.columns) {\n const column = table.columns[colName];\n if (!column) continue;\n\n if (fk.onDelete === 'setNull' && !column.nullable) {\n errors.push(\n `Table \"${tableName}\": onDelete setNull on foreign key column \"${colName}\" which is NOT NULL`,\n );\n }\n if (fk.onUpdate === 'setNull' && !column.nullable) {\n errors.push(\n `Table \"${tableName}\": onUpdate setNull on foreign key column \"${colName}\" which is NOT NULL`,\n );\n }\n if (fk.onDelete === 'setDefault' && !column.nullable && column.default === undefined) {\n errors.push(\n `Table \"${tableName}\": onDelete setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`,\n );\n }\n if (fk.onUpdate === 'setDefault' && !column.nullable && column.default === undefined) {\n errors.push(\n `Table \"${tableName}\": onUpdate setDefault on foreign key column \"${colName}\" which is NOT NULL and has no DEFAULT`,\n );\n }\n }\n }\n }\n\n return errors;\n}\n"],"mappings":";;;AAqBA,MAAM,oBAAoB,KAAK,YAAY;AAC3C,MAAM,qBAAqB,KAAK,aAAa;AAC7C,MAAM,sBAAsB,KAAK,cAAc;AAC/C,MAAM,oBAAoB,KAAK,8DAA8D;AAE7F,MAAa,6BAA6B,KAAK,SAA+B,CAAC,KAAK;CAClF,MAAM;CACN,OAAO;CACR,CAAC;AAEF,MAAa,8BAA8B,KAAK,SAAgC,CAAC,KAAK;CACpF,MAAM;CACN,YAAY;CACb,CAAC;AAEF,MAAa,sBAAsB,2BAA2B,GAAG,4BAA4B;AAE7F,MAAM,sCAAsC,KAAK;CAC/C,KAAK;CACL,MAAM;CACN,IAAI;CACJ,WAAW;CACZ,CAAC;AAEF,MAAM,iCAAiC,KAAK;CAC1C,KAAK;CACL,KAAK;EACH,KAAK;EACL,OAAO;EACP,QAAQ;EACT;CACD,aAAa;CACb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