@prisma-next/contract 0.3.0-dev.131 → 0.3.0-dev.132

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.
@@ -1,4 +1,4 @@
1
- import { O as RenderTypeContext, z as TypesImportSpec } from "./types-C-8ymVYK.mjs";
1
+ import { O as RenderTypeContext, z as TypesImportSpec } from "./types-BwcW0HFt.mjs";
2
2
 
3
3
  //#region src/framework-components.d.ts
4
4
 
@@ -14,7 +14,7 @@ interface ContractIR<TStorage extends Record<string, unknown> = Record<string, u
14
14
  readonly target: string;
15
15
  readonly roots?: Record<string, string>;
16
16
  readonly models: TModels;
17
- readonly relations: TRelations;
17
+ readonly relations?: TRelations;
18
18
  readonly storage: TStorage;
19
19
  readonly execution?: TExecution;
20
20
  readonly extensionPacks: Record<string, unknown>;
@@ -78,9 +78,9 @@ declare function contractIR<TStorage extends Record<string, unknown>, TModels ex
78
78
  roots?: Record<string, string>;
79
79
  storage: TStorage;
80
80
  models: TModels;
81
- relations: TRelations;
81
+ relations?: TRelations;
82
82
  execution?: TExecution;
83
83
  }): ContractIR<TStorage, TModels, TRelations, TExecution>;
84
84
  //#endregion
85
85
  export { irMeta as i, contractIR as n, irHeader as r, ContractIR as t };
86
- //# sourceMappingURL=ir-Cw7KOtte.d.mts.map
86
+ //# sourceMappingURL=ir-BPkihpFL.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir-BPkihpFL.d.mts","names":[],"sources":["../src/ir.ts"],"sourcesContent":[],"mappings":";;AAiBA;;;;;;;;AAI+C,UAJ9B,UAI8B,CAAA,iBAH5B,MAG4B,CAAA,MAAA,EAAA,OAAA,CAAA,GAHF,MAGE,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,gBAF7B,MAE6B,CAAA,MAAA,EAAA,OAAA,CAAA,GAFH,MAEG,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,mBAD1B,MAC0B,CAAA,MAAA,EAAA,OAAA,CAAA,G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H,CAAA,MAAA,EA7CkB,MA6ClB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,GAAA,SAAA;EACA,cAAA,CAAA,EA7CK,MA6CL,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;EACC,IAAA,CAAA,EA7CN,MA6CM,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;EAAU,OAAA,CAAA,EA5Cb,MA4Ca,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;CAAS,CAAA,EAAA;EAAY,SAAA,YAAA,EA1CrB,MA0CqB,CAAA,MAAA,EA1CN,MA0CM,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EAA1C,SAAA,cAAA,EAzCuB,MAyCvB,CAAA,MAAA,EAAA,OAAA,CAAA;EAAU,SAAA,IAAA,EAxCG,MAwCH,CAAA,MAAA,EAAA,OAAA,CAAA;oBAvCM;;;;;;iBAcJ,4BACG,yCACD,4CACG,4CACA;;;;;;;;;;2BAWM,eAAe;6BACb;mBACV;sBACG;;UAEZ;WACC;UACD;cACI;cACA;IACV,WAAW,UAAU,SAAS,YAAY"}
package/dist/ir.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as irMeta, n as contractIR, r as irHeader, t as ContractIR } from "./ir-Cw7KOtte.mjs";
1
+ import { i as irMeta, n as contractIR, r as irHeader, t as ContractIR } from "./ir-BPkihpFL.mjs";
2
2
  export { ContractIR, contractIR, irHeader, irMeta };
package/dist/ir.mjs CHANGED
@@ -42,7 +42,7 @@ function contractIR(opts) {
42
42
  ...ifDefined("roots", opts.roots),
43
43
  storage: opts.storage,
44
44
  models: opts.models,
45
- relations: opts.relations,
45
+ ...ifDefined("relations", opts.relations),
46
46
  ...ifDefined("execution", opts.execution)
47
47
  };
48
48
  }
package/dist/ir.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ir.mjs","names":[],"sources":["../src/ir.ts"],"sourcesContent":["function ifDefined<K extends string, V>(\n key: K,\n value: V | undefined,\n): Record<never, never> | { [P in K]: V } {\n return value !== undefined ? ({ [key]: value } as { [P in K]: V }) : {};\n}\n\n/**\n * ContractIR types and factories for building contract intermediate representation.\n * ContractIR is family-agnostic and used by authoring, emitter, and no-emit runtime.\n */\n\n/**\n * ContractIR represents the intermediate representation of a contract.\n * It is family-agnostic and contains generic storage, models, and relations.\n * Note: storageHash/executionHash and profileHash are computed by the emitter, not part of the IR.\n */\nexport interface ContractIR<\n TStorage extends Record<string, unknown> = Record<string, unknown>,\n TModels extends Record<string, unknown> = Record<string, unknown>,\n TRelations extends Record<string, unknown> = Record<string, unknown>,\n TExecution extends Record<string, unknown> = Record<string, unknown>,\n> {\n readonly schemaVersion: string;\n readonly targetFamily: string;\n readonly target: string;\n readonly roots?: Record<string, string>;\n readonly models: TModels;\n readonly relations: TRelations;\n readonly storage: TStorage;\n readonly execution?: TExecution;\n readonly extensionPacks: Record<string, unknown>;\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, unknown>;\n}\n\n/**\n * Creates the header portion of a ContractIR.\n * Contains schema version, target, target family, storage hash, and optional profile hash.\n */\nexport function irHeader(opts: {\n target: string;\n targetFamily: string;\n storageHash: string;\n executionHash?: string | undefined;\n profileHash?: string | undefined;\n}): {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly storageHash: string;\n readonly executionHash?: string | undefined;\n readonly profileHash?: string | undefined;\n} {\n return {\n schemaVersion: '1',\n target: opts.target,\n targetFamily: opts.targetFamily,\n storageHash: opts.storageHash,\n ...ifDefined('executionHash', opts.executionHash),\n ...ifDefined('profileHash', opts.profileHash),\n };\n}\n\n/**\n * Creates the meta portion of a ContractIR.\n * Contains capabilities, extensionPacks, meta, and sources with empty object defaults.\n * If a field is explicitly `undefined`, it will be omitted (for testing validation).\n */\nexport function irMeta(opts?: {\n capabilities?: Record<string, Record<string, boolean>> | undefined;\n extensionPacks?: Record<string, unknown> | undefined;\n meta?: Record<string, unknown> | undefined;\n sources?: Record<string, unknown> | undefined;\n}): {\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, unknown>;\n} {\n return {\n capabilities: opts?.capabilities ?? {},\n extensionPacks: opts?.extensionPacks ?? {},\n meta: opts?.meta ?? {},\n sources: opts?.sources ?? {},\n };\n}\n\n/**\n * Creates a complete ContractIR by combining header, meta, and family-specific sections.\n * This is a family-agnostic factory that accepts generic storage, models, and relations.\n */\nexport function contractIR<\n TStorage extends Record<string, unknown>,\n TModels extends Record<string, unknown>,\n TRelations extends Record<string, unknown>,\n TExecution extends Record<string, unknown>,\n>(opts: {\n header: {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly storageHash: string;\n readonly executionHash?: string | undefined;\n readonly profileHash?: string | undefined;\n };\n meta: {\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, unknown>;\n };\n roots?: Record<string, string>;\n storage: TStorage;\n models: TModels;\n relations: TRelations;\n execution?: TExecution;\n}): ContractIR<TStorage, TModels, TRelations, TExecution> {\n return {\n schemaVersion: opts.header.schemaVersion,\n target: opts.header.target,\n targetFamily: opts.header.targetFamily,\n ...opts.meta,\n ...ifDefined('roots', opts.roots),\n storage: opts.storage,\n models: opts.models,\n relations: opts.relations,\n ...ifDefined('execution', opts.execution),\n };\n}\n"],"mappings":";AAAA,SAAS,UACP,KACA,OACwC;AACxC,QAAO,UAAU,SAAa,GAAG,MAAM,OAAO,GAAuB,EAAE;;;;;;AAqCzE,SAAgB,SAAS,MAavB;AACA,QAAO;EACL,eAAe;EACf,QAAQ,KAAK;EACb,cAAc,KAAK;EACnB,aAAa,KAAK;EAClB,GAAG,UAAU,iBAAiB,KAAK,cAAc;EACjD,GAAG,UAAU,eAAe,KAAK,YAAY;EAC9C;;;;;;;AAQH,SAAgB,OAAO,MAUrB;AACA,QAAO;EACL,cAAc,MAAM,gBAAgB,EAAE;EACtC,gBAAgB,MAAM,kBAAkB,EAAE;EAC1C,MAAM,MAAM,QAAQ,EAAE;EACtB,SAAS,MAAM,WAAW,EAAE;EAC7B;;;;;;AAOH,SAAgB,WAKd,MAoBwD;AACxD,QAAO;EACL,eAAe,KAAK,OAAO;EAC3B,QAAQ,KAAK,OAAO;EACpB,cAAc,KAAK,OAAO;EAC1B,GAAG,KAAK;EACR,GAAG,UAAU,SAAS,KAAK,MAAM;EACjC,SAAS,KAAK;EACd,QAAQ,KAAK;EACb,WAAW,KAAK;EAChB,GAAG,UAAU,aAAa,KAAK,UAAU;EAC1C"}
1
+ {"version":3,"file":"ir.mjs","names":[],"sources":["../src/ir.ts"],"sourcesContent":["function ifDefined<K extends string, V>(\n key: K,\n value: V | undefined,\n): Record<never, never> | { [P in K]: V } {\n return value !== undefined ? ({ [key]: value } as { [P in K]: V }) : {};\n}\n\n/**\n * ContractIR types and factories for building contract intermediate representation.\n * ContractIR is family-agnostic and used by authoring, emitter, and no-emit runtime.\n */\n\n/**\n * ContractIR represents the intermediate representation of a contract.\n * It is family-agnostic and contains generic storage, models, and relations.\n * Note: storageHash/executionHash and profileHash are computed by the emitter, not part of the IR.\n */\nexport interface ContractIR<\n TStorage extends Record<string, unknown> = Record<string, unknown>,\n TModels extends Record<string, unknown> = Record<string, unknown>,\n TRelations extends Record<string, unknown> = Record<string, unknown>,\n TExecution extends Record<string, unknown> = Record<string, unknown>,\n> {\n readonly schemaVersion: string;\n readonly targetFamily: string;\n readonly target: string;\n readonly roots?: Record<string, string>;\n readonly models: TModels;\n readonly relations?: TRelations;\n readonly storage: TStorage;\n readonly execution?: TExecution;\n readonly extensionPacks: Record<string, unknown>;\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, unknown>;\n}\n\n/**\n * Creates the header portion of a ContractIR.\n * Contains schema version, target, target family, storage hash, and optional profile hash.\n */\nexport function irHeader(opts: {\n target: string;\n targetFamily: string;\n storageHash: string;\n executionHash?: string | undefined;\n profileHash?: string | undefined;\n}): {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly storageHash: string;\n readonly executionHash?: string | undefined;\n readonly profileHash?: string | undefined;\n} {\n return {\n schemaVersion: '1',\n target: opts.target,\n targetFamily: opts.targetFamily,\n storageHash: opts.storageHash,\n ...ifDefined('executionHash', opts.executionHash),\n ...ifDefined('profileHash', opts.profileHash),\n };\n}\n\n/**\n * Creates the meta portion of a ContractIR.\n * Contains capabilities, extensionPacks, meta, and sources with empty object defaults.\n * If a field is explicitly `undefined`, it will be omitted (for testing validation).\n */\nexport function irMeta(opts?: {\n capabilities?: Record<string, Record<string, boolean>> | undefined;\n extensionPacks?: Record<string, unknown> | undefined;\n meta?: Record<string, unknown> | undefined;\n sources?: Record<string, unknown> | undefined;\n}): {\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, unknown>;\n} {\n return {\n capabilities: opts?.capabilities ?? {},\n extensionPacks: opts?.extensionPacks ?? {},\n meta: opts?.meta ?? {},\n sources: opts?.sources ?? {},\n };\n}\n\n/**\n * Creates a complete ContractIR by combining header, meta, and family-specific sections.\n * This is a family-agnostic factory that accepts generic storage, models, and relations.\n */\nexport function contractIR<\n TStorage extends Record<string, unknown>,\n TModels extends Record<string, unknown>,\n TRelations extends Record<string, unknown>,\n TExecution extends Record<string, unknown>,\n>(opts: {\n header: {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly storageHash: string;\n readonly executionHash?: string | undefined;\n readonly profileHash?: string | undefined;\n };\n meta: {\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, unknown>;\n };\n roots?: Record<string, string>;\n storage: TStorage;\n models: TModels;\n relations?: TRelations;\n execution?: TExecution;\n}): ContractIR<TStorage, TModels, TRelations, TExecution> {\n return {\n schemaVersion: opts.header.schemaVersion,\n target: opts.header.target,\n targetFamily: opts.header.targetFamily,\n ...opts.meta,\n ...ifDefined('roots', opts.roots),\n storage: opts.storage,\n models: opts.models,\n ...ifDefined('relations', opts.relations),\n ...ifDefined('execution', opts.execution),\n };\n}\n"],"mappings":";AAAA,SAAS,UACP,KACA,OACwC;AACxC,QAAO,UAAU,SAAa,GAAG,MAAM,OAAO,GAAuB,EAAE;;;;;;AAqCzE,SAAgB,SAAS,MAavB;AACA,QAAO;EACL,eAAe;EACf,QAAQ,KAAK;EACb,cAAc,KAAK;EACnB,aAAa,KAAK;EAClB,GAAG,UAAU,iBAAiB,KAAK,cAAc;EACjD,GAAG,UAAU,eAAe,KAAK,YAAY;EAC9C;;;;;;;AAQH,SAAgB,OAAO,MAUrB;AACA,QAAO;EACL,cAAc,MAAM,gBAAgB,EAAE;EACtC,gBAAgB,MAAM,kBAAkB,EAAE;EAC1C,MAAM,MAAM,QAAQ,EAAE;EACtB,SAAS,MAAM,WAAW,EAAE;EAC7B;;;;;;AAOH,SAAgB,WAKd,MAoBwD;AACxD,QAAO;EACL,eAAe,KAAK,OAAO;EAC3B,QAAQ,KAAK,OAAO;EACpB,cAAc,KAAK,OAAO;EAC1B,GAAG,KAAK;EACR,GAAG,UAAU,SAAS,KAAK,MAAM;EACjC,SAAS,KAAK;EACd,QAAQ,KAAK;EACb,GAAG,UAAU,aAAa,KAAK,UAAU;EACzC,GAAG,UAAU,aAAa,KAAK,UAAU;EAC1C"}
@@ -1,4 +1,4 @@
1
- import { t as ContractIR } from "./ir-Cw7KOtte.mjs";
1
+ import { t as ContractIR } from "./ir-BPkihpFL.mjs";
2
2
  import { OperationRegistry } from "@prisma-next/operations";
3
3
 
4
4
  //#region src/domain-types.d.ts
@@ -84,7 +84,7 @@ declare function coreHash<const T extends string>(value: T): StorageHashBase<T>;
84
84
  */
85
85
  type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
86
86
  declare function profileHash<const T extends string>(value: T): ProfileHashBase<T>;
87
- interface ContractBase<TStorageHash extends StorageHashBase<string> = StorageHashBase<string>, TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>, TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>, TModels extends Record<string, unknown> = Record<string, DomainModel>> {
87
+ interface ContractBase<TStorageHash extends StorageHashBase<string> = StorageHashBase<string>, TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>, TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>> {
88
88
  readonly schemaVersion: string;
89
89
  readonly target: string;
90
90
  readonly targetFamily: string;
@@ -97,7 +97,7 @@ interface ContractBase<TStorageHash extends StorageHashBase<string> = StorageHas
97
97
  readonly sources: Record<string, Source>;
98
98
  readonly execution?: ExecutionSection;
99
99
  readonly roots: Record<string, string>;
100
- readonly models: TModels;
100
+ readonly models: Record<string, DomainModel>;
101
101
  }
102
102
  interface FieldType {
103
103
  readonly type: string;
@@ -440,4 +440,4 @@ interface ParameterizedCodecDescriptor {
440
440
  }
441
441
  //#endregion
442
442
  export { DomainRelationOn as $, Source as A, ValidationContext as B, ParamDescriptor as C, ProfileHashBase as D, PlanRefs as E, TargetFamilyHook as F, isTaggedRaw as G, coreHash as H, TypeRenderContext as I, DomainEmbedRelation as J, profileHash as K, TypeRenderEntry as L, TaggedBigInt as M, TaggedLiteralValue as N, RenderTypeContext as O, TaggedRaw as P, DomainRelation as Q, TypeRenderer as R, JsonValue as S, PlanMeta as T, isDocumentContract as U, bigintJsonReplacer as V, isTaggedBigInt as W, DomainModel as X, DomainField as Y, DomainReferenceRelation as Z, Expr as _, ColumnDefaultLiteralValue as a, GeneratedValueSpec as b, DocCollection as c, DocumentStorage as d, DomainVariantEntry as et, ExecutionHashBase as f, ExecutionSection as g, ExecutionPlan as h, ColumnDefaultLiteralInputValue as i, StorageHashBase as j, ResultType as k, DocIndex as l, ExecutionMutationDefaultValue as m, Brand as n, ReferenceRelationKeys as nt, ContractBase as o, ExecutionMutationDefault as p, DomainDiscriminator as q, ColumnDefault as r, ContractMarkerRecord as s, $ as t, EmbedRelationKeys as tt, DocumentContract as u, FieldType as v, ParameterizedCodecDescriptor as w, JsonPrimitive as x, GenerateContractTypesOptions as y, TypesImportSpec as z };
443
- //# sourceMappingURL=types-C-8ymVYK.d.mts.map
443
+ //# sourceMappingURL=types-BwcW0HFt.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BwcW0HFt.d.mts","names":[],"sources":["../src/domain-types.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;;KAAY,WAAA;;;;AAAA,KAKA,gBAAA,GALW;EAKX,SAAA,WAAgB,EAAA,SAAA,MAAA,EAAA;EAKhB,SAAA,YAAA,EAAA,SAAuB,MAGpB,EAAA;AAGf,CAAA;AAKY,KAXA,uBAAA,GAWiB;EAEjB,SAAA,EAAA,EAAA,MAAA;EAIA,SAAA,WAAA,EAAkB,KAAA,GAAA,KAAA,GAAA,KAAA;EAIlB,SAAA,EAAA,EAlBG,gBAkBQ;CACW;AAAf,KAhBP,mBAAA,GAgBO;EACkB,SAAA,EAAA,EAAA,MAAA;EAAf,SAAA,WAAA,EAAA,KAAA,GAAA,KAAA;CACF;AACO,KAdf,cAAA,GAAiB,uBAcF,GAd4B,mBAc5B;AACU,KAbzB,mBAAA,GAayB;EAAf,SAAA,KAAA,EAAA,MAAA;CAAM;AAKvB,KAdO,kBAAA,GAce;EAC4C,SAAA,KAAA,EAAA,MAAA;CAAf;AAArC,KAXP,WAAA,GAWO;EAAM,SAAA,MAAA,EAVN,MAUM,CAAA,MAAA,EAVS,WAUT,CAAA;EAGb,SAAA,SAAA,EAZU,MAYW,CAAA,MAAA,EAZI,cAYJ,CAAA;EACb,SAAA,OAAA,EAZA,MAYA,CAAA,MAAA,EAAA,OAAA,CAAA;EACe,SAAA,aAAA,CAAA,EAZR,mBAYQ;EAErB,S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uHS,CAAA,MAAA,EAAA,MAAA,CAAA;;;;AAYtC;;;;;;;AA4BwC,UAnJvB,aAmJuB,CAAA,MAAA,OAAA,EAAA,MAAA,OAAA,CAAA,CAAA;EAAd,SAAA,GAAA,EAAA,MAAA;EAMZ,SAAA,MAAA,EAAA,SAAA,OAAA,EAAA;EAA4B,SAAA,GAAA,CAAA,EAtJzB,GAsJyB;EA+B9B,SAAA,IAAA,EApLK,QAoLO;EAwBP;;;;EA4BuB,SAAA,IAAA,CAAA,EAnOtB,GAmOsB;;;;;;;;;;KAxN5B,gBACV,UAAU,sCAAsC;;;;;;iBAKlC,kBAAA,iCAAmD;;;;;UAalD,oBAAA;;;;;sBAKK;;iBAEL;;;;;;UAQA,eAAA;;;;;;;;;UAUA,iBAAA;+BACc;8BACD,cAAc;kCACV,cAAc;0BACtB;;;;;iCAKO,YAAY;;;;;;UAO5B,iBAAA;;;;;;;UAQA,eAAA;;4BAEW,8BAA8B;;;;;UAMzC,4BAAA;;;;;;oCAMmB,YAAY;;;;;sCAKV,cAAc;;;;;uCAKb,cAAc;;;;;;UAOpC,gBAAA;;;;;;;oBAQG,iBAAiB;;;;;wBAMb;;;;;;;;;;4BAYhB,8BACc,cAAc,wCACV,cAAc;;;;eAM1B;;;;;;;;;;;;;;;;;;;KA+BF,YAAA,sBAEE,8BAA8B;;;;;;;;;;;;;;;;;;;;;UAsB3B,4BAAA;;;;;;;;;;+BAWc;;;;;;;;;;+BAWA;;;;;yBAMN"}
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as DomainRelationOn, A as Source, B as ValidationContext, C as ParamDescriptor, D as ProfileHashBase, E as PlanRefs, F as TargetFamilyHook, G as isTaggedRaw, H as coreHash, I as TypeRenderContext, J as DomainEmbedRelation, K as profileHash, L as TypeRenderEntry, M as TaggedBigInt, N as TaggedLiteralValue, O as RenderTypeContext, P as TaggedRaw, Q as DomainRelation, R as TypeRenderer, S as JsonValue, T as PlanMeta, U as isDocumentContract, V as bigintJsonReplacer, W as isTaggedBigInt, X as DomainModel, Y as DomainField, Z as DomainReferenceRelation, _ as Expr, a as ColumnDefaultLiteralValue, b as GeneratedValueSpec, c as DocCollection, d as DocumentStorage, et as DomainVariantEntry, f as ExecutionHashBase, g as ExecutionSection, h as ExecutionPlan, i as ColumnDefaultLiteralInputValue, j as StorageHashBase, k as ResultType, l as DocIndex, m as ExecutionMutationDefaultValue, n as Brand, nt as ReferenceRelationKeys, o as ContractBase, p as ExecutionMutationDefault, q as DomainDiscriminator, r as ColumnDefault, s as ContractMarkerRecord, t as $, tt as EmbedRelationKeys, u as DocumentContract, v as FieldType, w as ParameterizedCodecDescriptor, x as JsonPrimitive, y as GenerateContractTypesOptions, z as TypesImportSpec } from "./types-C-8ymVYK.mjs";
1
+ import { $ as DomainRelationOn, A as Source, B as ValidationContext, C as ParamDescriptor, D as ProfileHashBase, E as PlanRefs, F as TargetFamilyHook, G as isTaggedRaw, H as coreHash, I as TypeRenderContext, J as DomainEmbedRelation, K as profileHash, L as TypeRenderEntry, M as TaggedBigInt, N as TaggedLiteralValue, O as RenderTypeContext, P as TaggedRaw, Q as DomainRelation, R as TypeRenderer, S as JsonValue, T as PlanMeta, U as isDocumentContract, V as bigintJsonReplacer, W as isTaggedBigInt, X as DomainModel, Y as DomainField, Z as DomainReferenceRelation, _ as Expr, a as ColumnDefaultLiteralValue, b as GeneratedValueSpec, c as DocCollection, d as DocumentStorage, et as DomainVariantEntry, f as ExecutionHashBase, g as ExecutionSection, h as ExecutionPlan, i as ColumnDefaultLiteralInputValue, j as StorageHashBase, k as ResultType, l as DocIndex, m as ExecutionMutationDefaultValue, n as Brand, nt as ReferenceRelationKeys, o as ContractBase, p as ExecutionMutationDefault, q as DomainDiscriminator, r as ColumnDefault, s as ContractMarkerRecord, t as $, tt as EmbedRelationKeys, u as DocumentContract, v as FieldType, w as ParameterizedCodecDescriptor, x as JsonPrimitive, y as GenerateContractTypesOptions, z as TypesImportSpec } from "./types-BwcW0HFt.mjs";
2
2
  export { type $, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type ContractBase, type ContractMarkerRecord, type DocCollection, type DocIndex, type DocumentContract, type DocumentStorage, type DomainDiscriminator, type DomainEmbedRelation, type DomainField, type DomainModel, type DomainReferenceRelation, type DomainRelation, type DomainRelationOn, type DomainVariantEntry, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultValue, type ExecutionPlan, type ExecutionSection, type Expr, type FieldType, type GenerateContractTypesOptions, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ParamDescriptor, type ParameterizedCodecDescriptor, type PlanMeta, type PlanRefs, type ProfileHashBase, type ReferenceRelationKeys, type RenderTypeContext, type ResultType, type Source, type StorageHashBase, type TaggedBigInt, type TaggedLiteralValue, type TaggedRaw, type TargetFamilyHook, type TypeRenderContext, type TypeRenderEntry, type TypeRenderer, type TypesImportSpec, type ValidationContext, bigintJsonReplacer, coreHash, isDocumentContract, isTaggedBigInt, isTaggedRaw, profileHash };
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { OperationRegistry } from '@prisma-next/operations';\nimport type { DomainModel } from './domain-types';\nimport type { ContractIR } from './ir';\n\n/**\n * Unique symbol used as the key for branding types.\n */\nexport const $: unique symbol = Symbol('__prisma_next_brand__');\n\n/**\n * A helper type to brand a given type with a unique identifier.\n *\n * @template TKey Text used as the brand key.\n * @template TValue Optional value associated with the brand key. Defaults to `true`.\n */\nexport type Brand<TKey extends string | number | symbol, TValue = true> = {\n [$]: {\n [K in TKey]: TValue;\n };\n};\n\n/**\n * Context passed to type renderers during contract.d.ts generation.\n */\nexport interface RenderTypeContext {\n /** The name of the CodecTypes type alias (typically 'CodecTypes') */\n readonly codecTypesName: string;\n}\n\n/**\n * Base type for storage contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type StorageHash = StorageHashBase<'sha256:abc123...'>`\n */\nexport type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;\n\n/**\n * Base type for execution contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`\n */\nexport type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;\n\nexport function coreHash<const T extends string>(value: T): StorageHashBase<T> {\n return value as StorageHashBase<T>;\n}\n\n/**\n * Base type for profile contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`\n */\nexport type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;\n\nexport function profileHash<const T extends string>(value: T): ProfileHashBase<T> {\n return value as ProfileHashBase<T>;\n}\n\nexport interface ContractBase<\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n TModels extends Record<string, unknown> = Record<string, DomainModel>,\n> {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly storageHash: TStorageHash;\n readonly executionHash?: TExecutionHash | undefined;\n readonly profileHash?: TProfileHash | undefined;\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, Source>;\n readonly execution?: ExecutionSection;\n readonly roots: Record<string, string>;\n readonly models: TModels;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport type GeneratedValueSpec = {\n readonly id: string;\n readonly params?: Record<string, unknown>;\n};\n\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue =\n | JsonPrimitive\n | { readonly [key: string]: JsonValue }\n | readonly JsonValue[];\n\nexport type TaggedBigInt = { readonly $type: 'bigint'; readonly value: string };\n\nexport function isTaggedBigInt(value: unknown): value is TaggedBigInt {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { $type?: unknown }).$type === 'bigint' &&\n typeof (value as { value?: unknown }).value === 'string'\n );\n}\n\nexport function bigintJsonReplacer(_key: string, value: unknown): unknown {\n if (typeof value === 'bigint') {\n return { $type: 'bigint', value: value.toString() } satisfies TaggedBigInt;\n }\n return value;\n}\n\nexport type TaggedRaw = { readonly $type: 'raw'; readonly value: JsonValue };\n\nexport function isTaggedRaw(value: unknown): value is TaggedRaw {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { $type?: unknown }).$type === 'raw' &&\n 'value' in (value as object)\n );\n}\n\nexport type TaggedLiteralValue = TaggedBigInt | TaggedRaw;\n\nexport type ColumnDefaultLiteralValue = JsonValue | TaggedLiteralValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | bigint | Date;\n\nexport type ColumnDefault =\n | {\n readonly kind: 'literal';\n readonly value: ColumnDefaultLiteralInputValue;\n }\n | { readonly kind: 'function'; readonly expression: string };\n\nexport type ExecutionMutationDefaultValue = {\n readonly kind: 'generator';\n readonly id: GeneratedValueSpec['id'];\n readonly params?: Record<string, unknown>;\n};\n\nexport type ExecutionMutationDefault = {\n readonly ref: { readonly table: string; readonly column: string };\n readonly onCreate?: ExecutionMutationDefaultValue;\n readonly onUpdate?: ExecutionMutationDefaultValue;\n};\n\nexport type ExecutionSection = {\n readonly mutations: {\n readonly defaults: ReadonlyArray<ExecutionMutationDefault>;\n };\n};\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface DocumentStorage {\n readonly document: {\n readonly collections: Record<string, DocCollection>;\n };\n}\n\nexport interface DocumentContract<\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n> extends ContractBase<TStorageHash, TExecutionHash, TProfileHash> {\n // Accept string to work with JSON imports; runtime validation ensures 'document'\n readonly targetFamily: string;\n readonly storage: DocumentStorage;\n}\n\n// Plan types - target-family agnostic execution types\nexport interface ParamDescriptor {\n readonly index?: number;\n readonly name?: string;\n readonly codecId?: string;\n readonly nativeType?: string;\n readonly nullable?: boolean;\n readonly source: 'dsl' | 'raw' | 'lane';\n readonly refs?: { table: string; column: string };\n}\n\nexport interface PlanRefs {\n readonly tables?: readonly string[];\n readonly columns?: ReadonlyArray<{ table: string; column: string }>;\n readonly indexes?: ReadonlyArray<{\n readonly table: string;\n readonly columns: ReadonlyArray<string>;\n readonly name?: string;\n }>;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly storageHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n codecs?: Record<string, string>; // alias/param → codec id ('ns/name@v')\n [key: string]: unknown;\n };\n readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;\n readonly refs?: PlanRefs;\n readonly projection?: Record<string, string> | ReadonlyArray<string>;\n /**\n * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).\n * Used for codec resolution when AST+refs don't provide enough type info.\n */\n readonly projectionTypes?: Record<string, string>;\n}\n\n/**\n * Canonical execution plan shape used by runtimes.\n *\n * - Row is the inferred result row type (TypeScript-only).\n * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).\n *\n * The payload executed by the runtime is represented by the sql + params pair\n * for now; future families can specialize this via Ast or additional metadata.\n */\nexport interface ExecutionPlan<Row = unknown, Ast = unknown> {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly ast?: Ast;\n readonly meta: PlanMeta;\n /**\n * Phantom property to carry the Row generic for type-level utilities.\n * Not set at runtime; used only for ResultType extraction.\n */\n readonly _row?: Row;\n}\n\n/**\n * Utility type to extract the Row type from an ExecutionPlan.\n * Example: `type Row = ResultType<typeof plan>`\n *\n * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).\n * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter\n * for type extraction.\n */\nexport type ResultType<P> =\n P extends ExecutionPlan<infer R, unknown> ? R : P extends { readonly _Row?: infer R } ? R : never;\n\n/**\n * Type guard to check if a contract is a Document contract\n */\nexport function isDocumentContract(contract: unknown): contract is DocumentContract {\n return (\n typeof contract === 'object' &&\n contract !== null &&\n 'targetFamily' in contract &&\n contract.targetFamily === 'document'\n );\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n}\n\n// Emitter types - moved from @prisma-next/emitter to shared location\n/**\n * Specifies how to import TypeScript types from a package.\n * Used in extension pack manifests to declare codec and operation type imports.\n */\nexport interface TypesImportSpec {\n readonly package: string;\n readonly named: string;\n readonly alias: string;\n}\n\n/**\n * Validation context passed to TargetFamilyHook.validateTypes().\n * Contains pre-assembled operation registry, type imports, and extension IDs.\n */\nexport interface ValidationContext {\n readonly operationRegistry?: OperationRegistry;\n readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds?: ReadonlyArray<string>;\n /**\n * Parameterized codec descriptors collected from adapters and extensions.\n * Map of codecId → descriptor for quick lookup during type generation.\n */\n readonly parameterizedCodecs?: Map<string, ParameterizedCodecDescriptor>;\n}\n\n/**\n * Context for rendering parameterized types during contract.d.ts generation.\n * Passed to type renderers so they can reference CodecTypes by name.\n */\nexport interface TypeRenderContext {\n readonly codecTypesName: string;\n}\n\n/**\n * A normalized type renderer for parameterized codecs.\n * This is the interface expected by TargetFamilyHook.generateContractTypes.\n */\nexport interface TypeRenderEntry {\n readonly codecId: string;\n readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;\n}\n\n/**\n * Additional options for generateContractTypes.\n */\nexport interface GenerateContractTypesOptions {\n /**\n * Normalized parameterized type renderers, keyed by codecId.\n * When a column has typeParams and a renderer exists for its codecId,\n * the renderer is called to produce the TypeScript type expression.\n */\n readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;\n /**\n * Type imports for parameterized codecs.\n * These are merged with codec and operation type imports in contract.d.ts.\n */\n readonly parameterizedTypeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Query operation type imports for the query builder.\n * Flat operation signatures keyed by operation name, emitted as standalone QueryOperationTypes.\n */\n readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;\n}\n\n/**\n * SPI interface for target family hooks that extend emission behavior.\n * Implemented by family-specific emitter hooks (e.g., SQL family).\n */\nexport interface TargetFamilyHook {\n readonly id: string;\n\n /**\n * Validates that all type IDs in the contract come from referenced extension packs.\n * @param ir - Contract IR to validate\n * @param ctx - Validation context with operation registry and extension IDs\n */\n validateTypes(ir: ContractIR, ctx: ValidationContext): void;\n\n /**\n * Validates family-specific contract structure.\n * @param ir - Contract IR to validate\n */\n validateStructure(ir: ContractIR): void;\n\n /**\n * Generates contract.d.ts file content.\n * @param ir - Contract IR\n * @param codecTypeImports - Array of codec type import specs\n * @param operationTypeImports - Array of operation type import specs\n * @param hashes - Contract hash values (storageHash, executionHash, profileHash)\n * @param options - Additional options including parameterized type renderers\n * @returns Generated TypeScript type definitions as string\n */\n generateContractTypes(\n ir: ContractIR,\n codecTypeImports: ReadonlyArray<TypesImportSpec>,\n operationTypeImports: ReadonlyArray<TypesImportSpec>,\n hashes: {\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n },\n options?: GenerateContractTypesOptions,\n ): string;\n}\n\n// ============================================================================\n// Parameterized Codec Descriptor Types\n// ============================================================================\n//\n// Types for codecs that support type parameters (e.g., Vector<1536>, Decimal<2>).\n// These enable precise TypeScript types for parameterized columns without\n// coupling the SQL family emitter to specific adapter codec IDs.\n//\n// ============================================================================\n\n/**\n * Declarative type renderer that produces a TypeScript type expression.\n *\n * Renderers can be:\n * - A template string with `{{paramName}}` placeholders (e.g., `Vector<{{length}}>`)\n * - A function that receives typeParams and context and returns a type expression\n *\n * **Prefer template strings** for most cases:\n * - Templates are JSON-serializable (safe for pack-ref metadata)\n * - Templates can be statically analyzed by tooling\n *\n * Function renderers are allowed but have tradeoffs:\n * - Require runtime execution during emission (the emitter runs code)\n * - Not JSON-serializable (can't be stored in contract.json)\n * - The emitted artifacts (contract.json, contract.d.ts) still contain no\n * executable code - this constraint applies to outputs, not the emission process\n */\nexport type TypeRenderer =\n | string\n | ((params: Record<string, unknown>, ctx: RenderTypeContext) => string);\n\n/**\n * Descriptor for a codec that supports type parameters.\n *\n * Parameterized codecs allow columns to carry additional metadata (typeParams)\n * that affects the generated TypeScript types. For example:\n * - A vector codec can use `{ length: 1536 }` to generate `Vector<1536>`\n * - A decimal codec can use `{ precision: 10, scale: 2 }` to generate `Decimal<10, 2>`\n *\n * The SQL family emitter uses these descriptors to generate precise types\n * without hard-coding knowledge of specific codec IDs.\n *\n * @example\n * ```typescript\n * const vectorCodecDescriptor: ParameterizedCodecDescriptor = {\n * codecId: 'pg/vector@1',\n * outputTypeRenderer: 'Vector<{{length}}>',\n * // Optional: paramsSchema for runtime validation\n * };\n * ```\n */\nexport interface ParameterizedCodecDescriptor {\n /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */\n readonly codecId: string;\n\n /**\n * Renderer for the output (read) type.\n * Can be a template string or function.\n *\n * This is the primary renderer used by SQL emission to generate\n * model field types in contract.d.ts.\n */\n readonly outputTypeRenderer: TypeRenderer;\n\n /**\n * Optional renderer for the input (write) type.\n * If not provided, outputTypeRenderer is used for both.\n *\n * **Reserved for future use**: Currently, SQL emission only uses\n * outputTypeRenderer. This field is defined for future support of\n * asymmetric codecs where input and output types differ (e.g., a\n * codec that accepts `string | number` but always returns `number`).\n */\n readonly inputTypeRenderer?: TypeRenderer;\n\n /**\n * Optional import spec for types used by this codec's renderers.\n * The emitter will add this import to contract.d.ts.\n */\n readonly typesImport?: TypesImportSpec;\n}\n"],"mappings":";AA2CA,SAAgB,SAAiC,OAA8B;AAC7E,QAAO;;AAUT,SAAgB,YAAoC,OAA8B;AAChF,QAAO;;AA6CT,SAAgB,eAAe,OAAuC;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA8B,UAAU,YACzC,OAAQ,MAA8B,UAAU;;AAIpD,SAAgB,mBAAmB,MAAc,OAAyB;AACxE,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,OAAO;EAAU,OAAO,MAAM,UAAU;EAAE;AAErD,QAAO;;AAKT,SAAgB,YAAY,OAAoC;AAC9D,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA8B,UAAU,SACzC,WAAY;;;;;AA4JhB,SAAgB,mBAAmB,UAAiD;AAClF,QACE,OAAO,aAAa,YACpB,aAAa,QACb,kBAAkB,YAClB,SAAS,iBAAiB"}
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { OperationRegistry } from '@prisma-next/operations';\nimport type { DomainModel } from './domain-types';\nimport type { ContractIR } from './ir';\n\n/**\n * Unique symbol used as the key for branding types.\n */\nexport const $: unique symbol = Symbol('__prisma_next_brand__');\n\n/**\n * A helper type to brand a given type with a unique identifier.\n *\n * @template TKey Text used as the brand key.\n * @template TValue Optional value associated with the brand key. Defaults to `true`.\n */\nexport type Brand<TKey extends string | number | symbol, TValue = true> = {\n [$]: {\n [K in TKey]: TValue;\n };\n};\n\n/**\n * Context passed to type renderers during contract.d.ts generation.\n */\nexport interface RenderTypeContext {\n /** The name of the CodecTypes type alias (typically 'CodecTypes') */\n readonly codecTypesName: string;\n}\n\n/**\n * Base type for storage contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type StorageHash = StorageHashBase<'sha256:abc123...'>`\n */\nexport type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;\n\n/**\n * Base type for execution contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`\n */\nexport type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;\n\nexport function coreHash<const T extends string>(value: T): StorageHashBase<T> {\n return value as StorageHashBase<T>;\n}\n\n/**\n * Base type for profile contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`\n */\nexport type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;\n\nexport function profileHash<const T extends string>(value: T): ProfileHashBase<T> {\n return value as ProfileHashBase<T>;\n}\n\nexport interface ContractBase<\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n> {\n readonly schemaVersion: string;\n readonly target: string;\n readonly targetFamily: string;\n readonly storageHash: TStorageHash;\n readonly executionHash?: TExecutionHash | undefined;\n readonly profileHash?: TProfileHash | undefined;\n readonly capabilities: Record<string, Record<string, boolean>>;\n readonly extensionPacks: Record<string, unknown>;\n readonly meta: Record<string, unknown>;\n readonly sources: Record<string, Source>;\n readonly execution?: ExecutionSection;\n readonly roots: Record<string, string>;\n readonly models: Record<string, DomainModel>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport type GeneratedValueSpec = {\n readonly id: string;\n readonly params?: Record<string, unknown>;\n};\n\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue =\n | JsonPrimitive\n | { readonly [key: string]: JsonValue }\n | readonly JsonValue[];\n\nexport type TaggedBigInt = { readonly $type: 'bigint'; readonly value: string };\n\nexport function isTaggedBigInt(value: unknown): value is TaggedBigInt {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { $type?: unknown }).$type === 'bigint' &&\n typeof (value as { value?: unknown }).value === 'string'\n );\n}\n\nexport function bigintJsonReplacer(_key: string, value: unknown): unknown {\n if (typeof value === 'bigint') {\n return { $type: 'bigint', value: value.toString() } satisfies TaggedBigInt;\n }\n return value;\n}\n\nexport type TaggedRaw = { readonly $type: 'raw'; readonly value: JsonValue };\n\nexport function isTaggedRaw(value: unknown): value is TaggedRaw {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { $type?: unknown }).$type === 'raw' &&\n 'value' in (value as object)\n );\n}\n\nexport type TaggedLiteralValue = TaggedBigInt | TaggedRaw;\n\nexport type ColumnDefaultLiteralValue = JsonValue | TaggedLiteralValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | bigint | Date;\n\nexport type ColumnDefault =\n | {\n readonly kind: 'literal';\n readonly value: ColumnDefaultLiteralInputValue;\n }\n | { readonly kind: 'function'; readonly expression: string };\n\nexport type ExecutionMutationDefaultValue = {\n readonly kind: 'generator';\n readonly id: GeneratedValueSpec['id'];\n readonly params?: Record<string, unknown>;\n};\n\nexport type ExecutionMutationDefault = {\n readonly ref: { readonly table: string; readonly column: string };\n readonly onCreate?: ExecutionMutationDefaultValue;\n readonly onUpdate?: ExecutionMutationDefaultValue;\n};\n\nexport type ExecutionSection = {\n readonly mutations: {\n readonly defaults: ReadonlyArray<ExecutionMutationDefault>;\n };\n};\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface DocumentStorage {\n readonly document: {\n readonly collections: Record<string, DocCollection>;\n };\n}\n\nexport interface DocumentContract<\n TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,\n TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,\n TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,\n> extends ContractBase<TStorageHash, TExecutionHash, TProfileHash> {\n // Accept string to work with JSON imports; runtime validation ensures 'document'\n readonly targetFamily: string;\n readonly storage: DocumentStorage;\n}\n\n// Plan types - target-family agnostic execution types\nexport interface ParamDescriptor {\n readonly index?: number;\n readonly name?: string;\n readonly codecId?: string;\n readonly nativeType?: string;\n readonly nullable?: boolean;\n readonly source: 'dsl' | 'raw' | 'lane';\n readonly refs?: { table: string; column: string };\n}\n\nexport interface PlanRefs {\n readonly tables?: readonly string[];\n readonly columns?: ReadonlyArray<{ table: string; column: string }>;\n readonly indexes?: ReadonlyArray<{\n readonly table: string;\n readonly columns: ReadonlyArray<string>;\n readonly name?: string;\n }>;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly storageHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n codecs?: Record<string, string>; // alias/param → codec id ('ns/name@v')\n [key: string]: unknown;\n };\n readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;\n readonly refs?: PlanRefs;\n readonly projection?: Record<string, string> | ReadonlyArray<string>;\n /**\n * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).\n * Used for codec resolution when AST+refs don't provide enough type info.\n */\n readonly projectionTypes?: Record<string, string>;\n}\n\n/**\n * Canonical execution plan shape used by runtimes.\n *\n * - Row is the inferred result row type (TypeScript-only).\n * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).\n *\n * The payload executed by the runtime is represented by the sql + params pair\n * for now; future families can specialize this via Ast or additional metadata.\n */\nexport interface ExecutionPlan<Row = unknown, Ast = unknown> {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly ast?: Ast;\n readonly meta: PlanMeta;\n /**\n * Phantom property to carry the Row generic for type-level utilities.\n * Not set at runtime; used only for ResultType extraction.\n */\n readonly _row?: Row;\n}\n\n/**\n * Utility type to extract the Row type from an ExecutionPlan.\n * Example: `type Row = ResultType<typeof plan>`\n *\n * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).\n * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter\n * for type extraction.\n */\nexport type ResultType<P> =\n P extends ExecutionPlan<infer R, unknown> ? R : P extends { readonly _Row?: infer R } ? R : never;\n\n/**\n * Type guard to check if a contract is a Document contract\n */\nexport function isDocumentContract(contract: unknown): contract is DocumentContract {\n return (\n typeof contract === 'object' &&\n contract !== null &&\n 'targetFamily' in contract &&\n contract.targetFamily === 'document'\n );\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n}\n\n// Emitter types - moved from @prisma-next/emitter to shared location\n/**\n * Specifies how to import TypeScript types from a package.\n * Used in extension pack manifests to declare codec and operation type imports.\n */\nexport interface TypesImportSpec {\n readonly package: string;\n readonly named: string;\n readonly alias: string;\n}\n\n/**\n * Validation context passed to TargetFamilyHook.validateTypes().\n * Contains pre-assembled operation registry, type imports, and extension IDs.\n */\nexport interface ValidationContext {\n readonly operationRegistry?: OperationRegistry;\n readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds?: ReadonlyArray<string>;\n /**\n * Parameterized codec descriptors collected from adapters and extensions.\n * Map of codecId → descriptor for quick lookup during type generation.\n */\n readonly parameterizedCodecs?: Map<string, ParameterizedCodecDescriptor>;\n}\n\n/**\n * Context for rendering parameterized types during contract.d.ts generation.\n * Passed to type renderers so they can reference CodecTypes by name.\n */\nexport interface TypeRenderContext {\n readonly codecTypesName: string;\n}\n\n/**\n * A normalized type renderer for parameterized codecs.\n * This is the interface expected by TargetFamilyHook.generateContractTypes.\n */\nexport interface TypeRenderEntry {\n readonly codecId: string;\n readonly render: (params: Record<string, unknown>, ctx: TypeRenderContext) => string;\n}\n\n/**\n * Additional options for generateContractTypes.\n */\nexport interface GenerateContractTypesOptions {\n /**\n * Normalized parameterized type renderers, keyed by codecId.\n * When a column has typeParams and a renderer exists for its codecId,\n * the renderer is called to produce the TypeScript type expression.\n */\n readonly parameterizedRenderers?: Map<string, TypeRenderEntry>;\n /**\n * Type imports for parameterized codecs.\n * These are merged with codec and operation type imports in contract.d.ts.\n */\n readonly parameterizedTypeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Query operation type imports for the query builder.\n * Flat operation signatures keyed by operation name, emitted as standalone QueryOperationTypes.\n */\n readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;\n}\n\n/**\n * SPI interface for target family hooks that extend emission behavior.\n * Implemented by family-specific emitter hooks (e.g., SQL family).\n */\nexport interface TargetFamilyHook {\n readonly id: string;\n\n /**\n * Validates that all type IDs in the contract come from referenced extension packs.\n * @param ir - Contract IR to validate\n * @param ctx - Validation context with operation registry and extension IDs\n */\n validateTypes(ir: ContractIR, ctx: ValidationContext): void;\n\n /**\n * Validates family-specific contract structure.\n * @param ir - Contract IR to validate\n */\n validateStructure(ir: ContractIR): void;\n\n /**\n * Generates contract.d.ts file content.\n * @param ir - Contract IR\n * @param codecTypeImports - Array of codec type import specs\n * @param operationTypeImports - Array of operation type import specs\n * @param hashes - Contract hash values (storageHash, executionHash, profileHash)\n * @param options - Additional options including parameterized type renderers\n * @returns Generated TypeScript type definitions as string\n */\n generateContractTypes(\n ir: ContractIR,\n codecTypeImports: ReadonlyArray<TypesImportSpec>,\n operationTypeImports: ReadonlyArray<TypesImportSpec>,\n hashes: {\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n },\n options?: GenerateContractTypesOptions,\n ): string;\n}\n\n// ============================================================================\n// Parameterized Codec Descriptor Types\n// ============================================================================\n//\n// Types for codecs that support type parameters (e.g., Vector<1536>, Decimal<2>).\n// These enable precise TypeScript types for parameterized columns without\n// coupling the SQL family emitter to specific adapter codec IDs.\n//\n// ============================================================================\n\n/**\n * Declarative type renderer that produces a TypeScript type expression.\n *\n * Renderers can be:\n * - A template string with `{{paramName}}` placeholders (e.g., `Vector<{{length}}>`)\n * - A function that receives typeParams and context and returns a type expression\n *\n * **Prefer template strings** for most cases:\n * - Templates are JSON-serializable (safe for pack-ref metadata)\n * - Templates can be statically analyzed by tooling\n *\n * Function renderers are allowed but have tradeoffs:\n * - Require runtime execution during emission (the emitter runs code)\n * - Not JSON-serializable (can't be stored in contract.json)\n * - The emitted artifacts (contract.json, contract.d.ts) still contain no\n * executable code - this constraint applies to outputs, not the emission process\n */\nexport type TypeRenderer =\n | string\n | ((params: Record<string, unknown>, ctx: RenderTypeContext) => string);\n\n/**\n * Descriptor for a codec that supports type parameters.\n *\n * Parameterized codecs allow columns to carry additional metadata (typeParams)\n * that affects the generated TypeScript types. For example:\n * - A vector codec can use `{ length: 1536 }` to generate `Vector<1536>`\n * - A decimal codec can use `{ precision: 10, scale: 2 }` to generate `Decimal<10, 2>`\n *\n * The SQL family emitter uses these descriptors to generate precise types\n * without hard-coding knowledge of specific codec IDs.\n *\n * @example\n * ```typescript\n * const vectorCodecDescriptor: ParameterizedCodecDescriptor = {\n * codecId: 'pg/vector@1',\n * outputTypeRenderer: 'Vector<{{length}}>',\n * // Optional: paramsSchema for runtime validation\n * };\n * ```\n */\nexport interface ParameterizedCodecDescriptor {\n /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */\n readonly codecId: string;\n\n /**\n * Renderer for the output (read) type.\n * Can be a template string or function.\n *\n * This is the primary renderer used by SQL emission to generate\n * model field types in contract.d.ts.\n */\n readonly outputTypeRenderer: TypeRenderer;\n\n /**\n * Optional renderer for the input (write) type.\n * If not provided, outputTypeRenderer is used for both.\n *\n * **Reserved for future use**: Currently, SQL emission only uses\n * outputTypeRenderer. This field is defined for future support of\n * asymmetric codecs where input and output types differ (e.g., a\n * codec that accepts `string | number` but always returns `number`).\n */\n readonly inputTypeRenderer?: TypeRenderer;\n\n /**\n * Optional import spec for types used by this codec's renderers.\n * The emitter will add this import to contract.d.ts.\n */\n readonly typesImport?: TypesImportSpec;\n}\n"],"mappings":";AA2CA,SAAgB,SAAiC,OAA8B;AAC7E,QAAO;;AAUT,SAAgB,YAAoC,OAA8B;AAChF,QAAO;;AA4CT,SAAgB,eAAe,OAAuC;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA8B,UAAU,YACzC,OAAQ,MAA8B,UAAU;;AAIpD,SAAgB,mBAAmB,MAAc,OAAyB;AACxE,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,OAAO;EAAU,OAAO,MAAM,UAAU;EAAE;AAErD,QAAO;;AAKT,SAAgB,YAAY,OAAoC;AAC9D,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA8B,UAAU,SACzC,WAAY;;;;;AA4JhB,SAAgB,mBAAmB,UAAiD;AAClF,QACE,OAAO,aAAa,YACpB,aAAa,QACb,kBAAkB,YAClB,SAAS,iBAAiB"}
@@ -1,7 +1,7 @@
1
1
  //#region src/validate-domain.d.ts
2
2
  interface DomainModelShape {
3
3
  readonly fields: Record<string, unknown>;
4
- readonly relations: Record<string, {
4
+ readonly relations?: Record<string, {
5
5
  readonly to: string;
6
6
  }>;
7
7
  readonly discriminator?: {
@@ -1 +1 @@
1
- {"version":3,"file":"validate-domain.d.mts","names":[],"sources":["../src/validate-domain.ts"],"sourcesContent":[],"mappings":";UAAiB,gBAAA;EAAA,SAAA,MAAA,EACE,MADc,CAAA,MAAA,EAAA,OAAA,CAAA;EACd,SAAA,SAAA,EACG,MADH,CAAA,MAAA,EAAA;IACG,SAAA,EAAA,EAAA,MAAA;EAEA,CAAA,CAAA;EAAM,SAAA,aAAA,CAAA,EAAA;IAKX,SAAA,KAAA,EAAA,MAAmB;EAClB,CAAA;EACgB,SAAA,QAAA,CAAA,EAPZ,MAOY,CAAA,MAAA,EAAA,OAAA,CAAA;EAAf,SAAA,IAAA,CAAA,EAAA,MAAA;EAAM,SAAA,KAAA,CAAA,EAAA,MAAA;AAGzB;AAIgB,UATC,mBAAA,CASqB;kBARpB;mBACC,eAAe;;UAGjB,sBAAA;;;iBAID,sBAAA,WAAiC,sBAAsB"}
1
+ {"version":3,"file":"validate-domain.d.mts","names":[],"sources":["../src/validate-domain.ts"],"sourcesContent":[],"mappings":";UAAiB,gBAAA;EAAA,SAAA,MAAA,EACE,MADc,CAAA,MAAA,EAAA,OAAA,CAAA;EACd,SAAA,SAAA,CAAA,EACI,MADJ,CAAA,MAAA,EAAA;IACI,SAAA,EAAA,EAAA,MAAA;EAED,CAAA,CAAA;EAAM,SAAA,aAAA,CAAA,EAAA;IAKX,SAAA,KAAA,EAAA,MAAmB;EAClB,CAAA;EACgB,SAAA,QAAA,CAAA,EAPZ,MAOY,CAAA,MAAA,EAAA,OAAA,CAAA;EAAf,SAAA,IAAA,CAAA,EAAA,MAAA;EAAM,SAAA,KAAA,CAAA,EAAA,MAAA;AAGzB;AAIgB,UATC,mBAAA,CASqB;kBARpB;mBACC,eAAe;;UAGjB,sBAAA;;;iBAID,sBAAA,WAAiC,sBAAsB"}
@@ -21,13 +21,14 @@ function validateRoots(contract, modelNames, errors) {
21
21
  }
22
22
  }
23
23
  function validateVariantsAndBases(contract, modelNames, errors) {
24
- for (const [modelName, model] of Object.entries(contract.models)) {
24
+ const models = new Map(Object.entries(contract.models));
25
+ for (const [modelName, model] of models) {
25
26
  if (model.variants) for (const variantName of Object.keys(model.variants)) {
26
27
  if (!modelNames.has(variantName)) {
27
28
  errors.push(`Model "${modelName}" lists variant "${variantName}" which does not exist in models`);
28
29
  continue;
29
30
  }
30
- const variantModel = contract.models[variantName];
31
+ const variantModel = models.get(variantName);
31
32
  if (!variantModel) continue;
32
33
  if (variantModel.base !== modelName) errors.push(`Variant "${variantName}" has base "${variantModel.base ?? "(none)"}" but expected "${modelName}"`);
33
34
  }
@@ -36,14 +37,14 @@ function validateVariantsAndBases(contract, modelNames, errors) {
36
37
  errors.push(`Model "${modelName}" has base "${model.base}" which does not exist in models`);
37
38
  continue;
38
39
  }
39
- const baseModel = contract.models[model.base];
40
+ const baseModel = models.get(model.base);
40
41
  if (!baseModel) continue;
41
42
  if (!baseModel.variants || !Object.hasOwn(baseModel.variants, modelName)) errors.push(`Model "${modelName}" has base "${model.base}" which does not list it as a variant`);
42
43
  }
43
44
  }
44
45
  }
45
46
  function validateRelationTargets(contract, modelNames, errors) {
46
- for (const [modelName, model] of Object.entries(contract.models)) for (const [relName, relation] of Object.entries(model.relations)) if (!modelNames.has(relation.to)) errors.push(`Relation "${relName}" on model "${modelName}" targets "${relation.to}" which does not exist in models`);
47
+ for (const [modelName, model] of Object.entries(contract.models)) for (const [relName, relation] of Object.entries(model.relations ?? {})) if (!modelNames.has(relation.to)) errors.push(`Relation "${relName}" on model "${modelName}" targets "${relation.to}" which does not exist in models`);
47
48
  }
48
49
  function validateDiscriminators(contract, errors) {
49
50
  for (const [modelName, model] of Object.entries(contract.models)) {
@@ -70,7 +71,7 @@ function detectOrphanedModels(contract, modelNames, warnings) {
70
71
  const referenced = /* @__PURE__ */ new Set();
71
72
  for (const modelName of Object.values(contract.roots)) referenced.add(modelName);
72
73
  for (const [modelName, model] of Object.entries(contract.models)) {
73
- for (const relation of Object.values(model.relations)) referenced.add(relation.to);
74
+ for (const relation of Object.values(model.relations ?? {})) referenced.add(relation.to);
74
75
  if (model.variants) for (const variantName of Object.keys(model.variants)) referenced.add(variantName);
75
76
  if (model.base) referenced.add(model.base);
76
77
  if (model.owner) referenced.add(modelName);
@@ -1 +1 @@
1
- {"version":3,"file":"validate-domain.mjs","names":["errors: string[]","warnings: string[]"],"sources":["../src/validate-domain.ts"],"sourcesContent":["export interface DomainModelShape {\n readonly fields: Record<string, unknown>;\n readonly relations: Record<string, { readonly to: string }>;\n readonly discriminator?: { readonly field: string };\n readonly variants?: Record<string, unknown>;\n readonly base?: string;\n readonly owner?: string;\n}\n\nexport interface DomainContractShape {\n readonly roots: Record<string, string>;\n readonly models: Record<string, DomainModelShape>;\n}\n\nexport interface DomainValidationResult {\n readonly warnings: string[];\n}\n\nexport function validateContractDomain(contract: DomainContractShape): DomainValidationResult {\n const errors: string[] = [];\n const warnings: string[] = [];\n const modelNames = new Set(Object.keys(contract.models));\n\n validateRoots(contract, modelNames, errors);\n validateVariantsAndBases(contract, modelNames, errors);\n validateRelationTargets(contract, modelNames, errors);\n validateDiscriminators(contract, errors);\n validateOwnership(contract, modelNames, errors);\n detectOrphanedModels(contract, modelNames, warnings);\n\n if (errors.length > 0) {\n throw new Error(`Contract domain validation failed:\\n- ${errors.join('\\n- ')}`);\n }\n\n return { warnings };\n}\n\nfunction validateRoots(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n const seenValues = new Set<string>();\n for (const [rootKey, modelName] of Object.entries(contract.roots)) {\n if (seenValues.has(modelName)) {\n errors.push(`Duplicate root value: \"${modelName}\" is mapped by multiple root keys`);\n }\n seenValues.add(modelName);\n\n if (!modelNames.has(modelName)) {\n errors.push(\n `Root \"${rootKey}\" references model \"${modelName}\" which does not exist in models`,\n );\n }\n }\n}\n\nfunction validateVariantsAndBases(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n for (const [modelName, model] of Object.entries(contract.models)) {\n if (model.variants) {\n for (const variantName of Object.keys(model.variants)) {\n if (!modelNames.has(variantName)) {\n errors.push(\n `Model \"${modelName}\" lists variant \"${variantName}\" which does not exist in models`,\n );\n continue;\n }\n const variantModel = contract.models[variantName];\n if (!variantModel) continue;\n if (variantModel.base !== modelName) {\n errors.push(\n `Variant \"${variantName}\" has base \"${variantModel.base ?? '(none)'}\" but expected \"${modelName}\"`,\n );\n }\n }\n }\n\n if (model.base) {\n if (!modelNames.has(model.base)) {\n errors.push(`Model \"${modelName}\" has base \"${model.base}\" which does not exist in models`);\n continue;\n }\n const baseModel = contract.models[model.base];\n if (!baseModel) continue;\n if (!baseModel.variants || !Object.hasOwn(baseModel.variants, modelName)) {\n errors.push(\n `Model \"${modelName}\" has base \"${model.base}\" which does not list it as a variant`,\n );\n }\n }\n }\n}\n\nfunction validateRelationTargets(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n for (const [modelName, model] of Object.entries(contract.models)) {\n for (const [relName, relation] of Object.entries(model.relations)) {\n if (!modelNames.has(relation.to)) {\n errors.push(\n `Relation \"${relName}\" on model \"${modelName}\" targets \"${relation.to}\" which does not exist in models`,\n );\n }\n }\n }\n}\n\nfunction validateDiscriminators(contract: DomainContractShape, errors: string[]): void {\n for (const [modelName, model] of Object.entries(contract.models)) {\n if (model.discriminator) {\n if (!model.variants || Object.keys(model.variants).length === 0) {\n errors.push(`Model \"${modelName}\" has discriminator but no variants`);\n }\n if (!Object.hasOwn(model.fields, model.discriminator.field)) {\n errors.push(\n `Discriminator field \"${model.discriminator.field}\" is not a field on model \"${modelName}\"`,\n );\n }\n }\n\n if (model.variants && Object.keys(model.variants).length > 0 && !model.discriminator) {\n errors.push(`Model \"${modelName}\" has variants but no discriminator`);\n }\n\n if (model.base) {\n if (model.discriminator) {\n errors.push(`Model \"${modelName}\" has base and must not have discriminator`);\n }\n if (model.variants && Object.keys(model.variants).length > 0) {\n errors.push(`Model \"${modelName}\" has base and must not have variants`);\n }\n }\n }\n}\n\nfunction validateOwnership(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n for (const [modelName, model] of Object.entries(contract.models)) {\n if (!model.owner) continue;\n\n if (model.owner === modelName) {\n errors.push(`Model \"${modelName}\" cannot own itself`);\n }\n\n if (!modelNames.has(model.owner)) {\n errors.push(`Model \"${modelName}\" has owner \"${model.owner}\" which does not exist in models`);\n }\n\n for (const [rootKey, rootModel] of Object.entries(contract.roots)) {\n if (rootModel === modelName) {\n errors.push(\n `Owned model \"${modelName}\" must not appear in roots (found as root \"${rootKey}\")`,\n );\n }\n }\n }\n}\n\nfunction detectOrphanedModels(\n contract: DomainContractShape,\n modelNames: Set<string>,\n warnings: string[],\n): void {\n const referenced = new Set<string>();\n\n for (const modelName of Object.values(contract.roots)) {\n referenced.add(modelName);\n }\n\n for (const [modelName, model] of Object.entries(contract.models)) {\n for (const relation of Object.values(model.relations)) {\n referenced.add(relation.to);\n }\n if (model.variants) {\n for (const variantName of Object.keys(model.variants)) {\n referenced.add(variantName);\n }\n }\n if (model.base) {\n referenced.add(model.base);\n }\n if (model.owner) {\n referenced.add(modelName);\n }\n }\n\n for (const modelName of modelNames) {\n if (!referenced.has(modelName)) {\n warnings.push(\n `Orphaned model: \"${modelName}\" is not referenced by any root, relation, or variant`,\n );\n }\n }\n}\n"],"mappings":";AAkBA,SAAgB,uBAAuB,UAAuD;CAC5F,MAAMA,SAAmB,EAAE;CAC3B,MAAMC,WAAqB,EAAE;CAC7B,MAAM,aAAa,IAAI,IAAI,OAAO,KAAK,SAAS,OAAO,CAAC;AAExD,eAAc,UAAU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;AAGvD,MAAI,CAAC,WAAW,IAAI,MAAM,MAAM,CAC9B,QAAO,KAAK,UAAU,UAAU,eAAe,MAAM,MAAM,kCAAkC;AAG/F,OAAK,MAAM,CAAC,SAAS,cAAc,OAAO,QAAQ,SAAS,MAAM,CAC/D,KAAI,cAAc,UAChB,QAAO,KACL,gBAAgB,UAAU,6CAA6C,QAAQ,IAChF;;;AAMT,SAAS,qBACP,UACA,YACA,UACM;CACN,MAAM,6BAAa,IAAI,KAAa;AAEpC,MAAK,MAAM,aAAa,OAAO,OAAO,SAAS,MAAM,CACnD,YAAW,IAAI,UAAU;AAG3B,MAAK,MAAM,CAAC,WAAW,UAAU,OAAO,QAAQ,SAAS,OAAO,EAAE;AAChE,OAAK,MAAM,YAAY,OAAO,OAAO,MAAM,UAAU,CACnD,YAAW,IAAI,SAAS,GAAG;AAE7B,MAAI,MAAM,SACR,MAAK,MAAM,eAAe,OAAO,KAAK,MAAM,SAAS,CACnD,YAAW,IAAI,YAAY;AAG/B,MAAI,MAAM,KACR,YAAW,IAAI,MAAM,KAAK;AAE5B,MAAI,MAAM,MACR,YAAW,IAAI,UAAU;;AAI7B,MAAK,MAAM,aAAa,WACtB,KAAI,CAAC,WAAW,IAAI,UAAU,CAC5B,UAAS,KACP,oBAAoB,UAAU,uDAC/B"}
1
+ {"version":3,"file":"validate-domain.mjs","names":["errors: string[]","warnings: string[]"],"sources":["../src/validate-domain.ts"],"sourcesContent":["export interface DomainModelShape {\n readonly fields: Record<string, unknown>;\n readonly relations?: Record<string, { readonly to: string }>;\n readonly discriminator?: { readonly field: string };\n readonly variants?: Record<string, unknown>;\n readonly base?: string;\n readonly owner?: string;\n}\n\nexport interface DomainContractShape {\n readonly roots: Record<string, string>;\n readonly models: Record<string, DomainModelShape>;\n}\n\nexport interface DomainValidationResult {\n readonly warnings: string[];\n}\n\nexport function validateContractDomain(contract: DomainContractShape): DomainValidationResult {\n const errors: string[] = [];\n const warnings: string[] = [];\n const modelNames = new Set(Object.keys(contract.models));\n\n validateRoots(contract, modelNames, errors);\n validateVariantsAndBases(contract, modelNames, errors);\n validateRelationTargets(contract, modelNames, errors);\n validateDiscriminators(contract, errors);\n validateOwnership(contract, modelNames, errors);\n detectOrphanedModels(contract, modelNames, warnings);\n\n if (errors.length > 0) {\n throw new Error(`Contract domain validation failed:\\n- ${errors.join('\\n- ')}`);\n }\n\n return { warnings };\n}\n\nfunction validateRoots(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n const seenValues = new Set<string>();\n for (const [rootKey, modelName] of Object.entries(contract.roots)) {\n if (seenValues.has(modelName)) {\n errors.push(`Duplicate root value: \"${modelName}\" is mapped by multiple root keys`);\n }\n seenValues.add(modelName);\n\n if (!modelNames.has(modelName)) {\n errors.push(\n `Root \"${rootKey}\" references model \"${modelName}\" which does not exist in models`,\n );\n }\n }\n}\n\nfunction validateVariantsAndBases(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n const models = new Map(Object.entries(contract.models));\n\n for (const [modelName, model] of models) {\n if (model.variants) {\n for (const variantName of Object.keys(model.variants)) {\n if (!modelNames.has(variantName)) {\n errors.push(\n `Model \"${modelName}\" lists variant \"${variantName}\" which does not exist in models`,\n );\n continue;\n }\n const variantModel = models.get(variantName);\n if (!variantModel) continue;\n if (variantModel.base !== modelName) {\n errors.push(\n `Variant \"${variantName}\" has base \"${variantModel.base ?? '(none)'}\" but expected \"${modelName}\"`,\n );\n }\n }\n }\n\n if (model.base) {\n if (!modelNames.has(model.base)) {\n errors.push(`Model \"${modelName}\" has base \"${model.base}\" which does not exist in models`);\n continue;\n }\n const baseModel = models.get(model.base);\n if (!baseModel) continue;\n if (!baseModel.variants || !Object.hasOwn(baseModel.variants, modelName)) {\n errors.push(\n `Model \"${modelName}\" has base \"${model.base}\" which does not list it as a variant`,\n );\n }\n }\n }\n}\n\nfunction validateRelationTargets(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n for (const [modelName, model] of Object.entries(contract.models)) {\n for (const [relName, relation] of Object.entries(model.relations ?? {})) {\n if (!modelNames.has(relation.to)) {\n errors.push(\n `Relation \"${relName}\" on model \"${modelName}\" targets \"${relation.to}\" which does not exist in models`,\n );\n }\n }\n }\n}\n\nfunction validateDiscriminators(contract: DomainContractShape, errors: string[]): void {\n for (const [modelName, model] of Object.entries(contract.models)) {\n if (model.discriminator) {\n if (!model.variants || Object.keys(model.variants).length === 0) {\n errors.push(`Model \"${modelName}\" has discriminator but no variants`);\n }\n if (!Object.hasOwn(model.fields, model.discriminator.field)) {\n errors.push(\n `Discriminator field \"${model.discriminator.field}\" is not a field on model \"${modelName}\"`,\n );\n }\n }\n\n if (model.variants && Object.keys(model.variants).length > 0 && !model.discriminator) {\n errors.push(`Model \"${modelName}\" has variants but no discriminator`);\n }\n\n if (model.base) {\n if (model.discriminator) {\n errors.push(`Model \"${modelName}\" has base and must not have discriminator`);\n }\n if (model.variants && Object.keys(model.variants).length > 0) {\n errors.push(`Model \"${modelName}\" has base and must not have variants`);\n }\n }\n }\n}\n\nfunction validateOwnership(\n contract: DomainContractShape,\n modelNames: Set<string>,\n errors: string[],\n): void {\n for (const [modelName, model] of Object.entries(contract.models)) {\n if (!model.owner) continue;\n\n if (model.owner === modelName) {\n errors.push(`Model \"${modelName}\" cannot own itself`);\n }\n\n if (!modelNames.has(model.owner)) {\n errors.push(`Model \"${modelName}\" has owner \"${model.owner}\" which does not exist in models`);\n }\n\n for (const [rootKey, rootModel] of Object.entries(contract.roots)) {\n if (rootModel === modelName) {\n errors.push(\n `Owned model \"${modelName}\" must not appear in roots (found as root \"${rootKey}\")`,\n );\n }\n }\n }\n}\n\nfunction detectOrphanedModels(\n contract: DomainContractShape,\n modelNames: Set<string>,\n warnings: string[],\n): void {\n const referenced = new Set<string>();\n\n for (const modelName of Object.values(contract.roots)) {\n referenced.add(modelName);\n }\n\n for (const [modelName, model] of Object.entries(contract.models)) {\n for (const relation of Object.values(model.relations ?? {})) {\n referenced.add(relation.to);\n }\n if (model.variants) {\n for (const variantName of Object.keys(model.variants)) {\n referenced.add(variantName);\n }\n }\n if (model.base) {\n referenced.add(model.base);\n }\n if (model.owner) {\n referenced.add(modelName);\n }\n }\n\n for (const modelName of modelNames) {\n if (!referenced.has(modelName)) {\n warnings.push(\n `Orphaned model: \"${modelName}\" is not referenced by any root, relation, or variant`,\n );\n }\n }\n}\n"],"mappings":";AAkBA,SAAgB,uBAAuB,UAAuD;CAC5F,MAAMA,SAAmB,EAAE;CAC3B,MAAMC,WAAqB,EAAE;CAC7B,MAAM,aAAa,IAAI,IAAI,OAAO,KAAK,SAAS,OAAO,CAAC;AAExD,eAAc,UAAU,YAAY,OAAO;AAC3C,0BAAyB,UAAU,YAAY,OAAO;AACtD,yBAAwB,UAAU,YAAY,OAAO;AACrD,wBAAuB,UAAU,OAAO;AACxC,mBAAkB,UAAU,YAAY,OAAO;AAC/C,sBAAqB,UAAU,YAAY,SAAS;AAEpD,KAAI,OAAO,SAAS,EAClB,OAAM,IAAI,MAAM,yCAAyC,OAAO,KAAK,OAAO,GAAG;AAGjF,QAAO,EAAE,UAAU;;AAGrB,SAAS,cACP,UACA,YACA,QACM;CACN,MAAM,6BAAa,IAAI,KAAa;AACpC,MAAK,MAAM,CAAC,SAAS,cAAc,OAAO,QAAQ,SAAS,MAAM,EAAE;AACjE,MAAI,WAAW,IAAI,UAAU,CAC3B,QAAO,KAAK,0BAA0B,UAAU,mCAAmC;AAErF,aAAW,IAAI,UAAU;AAEzB,MAAI,CAAC,WAAW,IAAI,UAAU,CAC5B,QAAO,KACL,SAAS,QAAQ,sBAAsB,UAAU,kCAClD;;;AAKP,SAAS,yBACP,UACA,YACA,QACM;CACN,MAAM,SAAS,IAAI,IAAI,OAAO,QAAQ,SAAS,OAAO,CAAC;AAEvD,MAAK,MAAM,CAAC,WAAW,UAAU,QAAQ;AACvC,MAAI,MAAM,SACR,MAAK,MAAM,eAAe,OAAO,KAAK,MAAM,SAAS,EAAE;AACr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AAI,CAAC,WAAW,IAAI,UAAU,CAC5B,UAAS,KACP,oBAAoB,UAAU,uDAC/B"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@prisma-next/contract",
3
- "version": "0.3.0-dev.131",
3
+ "version": "0.3.0-dev.132",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Data contract type definitions and JSON schema for Prisma Next",
7
7
  "dependencies": {
8
- "@prisma-next/operations": "0.3.0-dev.131"
8
+ "@prisma-next/operations": "0.3.0-dev.132"
9
9
  },
10
10
  "devDependencies": {
11
11
  "tsdown": "0.18.4",
@@ -49,7 +49,7 @@
49
49
  }
50
50
  }
51
51
  },
52
- "extensions": {
52
+ "extensionPacks": {
53
53
  "type": "object",
54
54
  "description": "Extension packs and their configuration",
55
55
  "additionalProperties": true
package/src/ir.ts CHANGED
@@ -26,7 +26,7 @@ export interface ContractIR<
26
26
  readonly target: string;
27
27
  readonly roots?: Record<string, string>;
28
28
  readonly models: TModels;
29
- readonly relations: TRelations;
29
+ readonly relations?: TRelations;
30
30
  readonly storage: TStorage;
31
31
  readonly execution?: TExecution;
32
32
  readonly extensionPacks: Record<string, unknown>;
@@ -114,7 +114,7 @@ export function contractIR<
114
114
  roots?: Record<string, string>;
115
115
  storage: TStorage;
116
116
  models: TModels;
117
- relations: TRelations;
117
+ relations?: TRelations;
118
118
  execution?: TExecution;
119
119
  }): ContractIR<TStorage, TModels, TRelations, TExecution> {
120
120
  return {
@@ -125,7 +125,7 @@ export function contractIR<
125
125
  ...ifDefined('roots', opts.roots),
126
126
  storage: opts.storage,
127
127
  models: opts.models,
128
- relations: opts.relations,
128
+ ...ifDefined('relations', opts.relations),
129
129
  ...ifDefined('execution', opts.execution),
130
130
  };
131
131
  }
package/src/types.ts CHANGED
@@ -60,7 +60,6 @@ export interface ContractBase<
60
60
  TStorageHash extends StorageHashBase<string> = StorageHashBase<string>,
61
61
  TExecutionHash extends ExecutionHashBase<string> = ExecutionHashBase<string>,
62
62
  TProfileHash extends ProfileHashBase<string> = ProfileHashBase<string>,
63
- TModels extends Record<string, unknown> = Record<string, DomainModel>,
64
63
  > {
65
64
  readonly schemaVersion: string;
66
65
  readonly target: string;
@@ -74,7 +73,7 @@ export interface ContractBase<
74
73
  readonly sources: Record<string, Source>;
75
74
  readonly execution?: ExecutionSection;
76
75
  readonly roots: Record<string, string>;
77
- readonly models: TModels;
76
+ readonly models: Record<string, DomainModel>;
78
77
  }
79
78
 
80
79
  export interface FieldType {
@@ -1,6 +1,6 @@
1
1
  export interface DomainModelShape {
2
2
  readonly fields: Record<string, unknown>;
3
- readonly relations: Record<string, { readonly to: string }>;
3
+ readonly relations?: Record<string, { readonly to: string }>;
4
4
  readonly discriminator?: { readonly field: string };
5
5
  readonly variants?: Record<string, unknown>;
6
6
  readonly base?: string;
@@ -60,7 +60,9 @@ function validateVariantsAndBases(
60
60
  modelNames: Set<string>,
61
61
  errors: string[],
62
62
  ): void {
63
- for (const [modelName, model] of Object.entries(contract.models)) {
63
+ const models = new Map(Object.entries(contract.models));
64
+
65
+ for (const [modelName, model] of models) {
64
66
  if (model.variants) {
65
67
  for (const variantName of Object.keys(model.variants)) {
66
68
  if (!modelNames.has(variantName)) {
@@ -69,7 +71,7 @@ function validateVariantsAndBases(
69
71
  );
70
72
  continue;
71
73
  }
72
- const variantModel = contract.models[variantName];
74
+ const variantModel = models.get(variantName);
73
75
  if (!variantModel) continue;
74
76
  if (variantModel.base !== modelName) {
75
77
  errors.push(
@@ -84,7 +86,7 @@ function validateVariantsAndBases(
84
86
  errors.push(`Model "${modelName}" has base "${model.base}" which does not exist in models`);
85
87
  continue;
86
88
  }
87
- const baseModel = contract.models[model.base];
89
+ const baseModel = models.get(model.base);
88
90
  if (!baseModel) continue;
89
91
  if (!baseModel.variants || !Object.hasOwn(baseModel.variants, modelName)) {
90
92
  errors.push(
@@ -101,7 +103,7 @@ function validateRelationTargets(
101
103
  errors: string[],
102
104
  ): void {
103
105
  for (const [modelName, model] of Object.entries(contract.models)) {
104
- for (const [relName, relation] of Object.entries(model.relations)) {
106
+ for (const [relName, relation] of Object.entries(model.relations ?? {})) {
105
107
  if (!modelNames.has(relation.to)) {
106
108
  errors.push(
107
109
  `Relation "${relName}" on model "${modelName}" targets "${relation.to}" which does not exist in models`,
@@ -177,7 +179,7 @@ function detectOrphanedModels(
177
179
  }
178
180
 
179
181
  for (const [modelName, model] of Object.entries(contract.models)) {
180
- for (const relation of Object.values(model.relations)) {
182
+ for (const relation of Object.values(model.relations ?? {})) {
181
183
  referenced.add(relation.to);
182
184
  }
183
185
  if (model.variants) {
@@ -1 +0,0 @@
1
- {"version":3,"file":"ir-Cw7KOtte.d.mts","names":[],"sources":["../src/ir.ts"],"sourcesContent":[],"mappings":";;AAiBA;;;;;;;;AAI+C,UAJ9B,UAI8B,CAAA,iBAH5B,MAG4B,CAAA,MAAA,EAAA,OAAA,CAAA,GAHF,MAGE,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,gBAF7B,MAE6B,CAAA,MAAA,EAAA,OAAA,CAAA,GAFH,MAEG,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,mBAD1B,MAC0B,CAAA,MAAA,EAAA,OAAA,CAAA,GADA,MACA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,mBAA1B,MAA0B,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,MAAA,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA;EAK5B,SAAA,aAAA,EAAA,MAAA;EACA,SAAA,YAAA,EAAA,MAAA;EACG,SAAA,MAAA,EAAA,MAAA;EACF,SAAA,KAAA,CAAA,EAHD,MAGC,CAAA,MAAA,EAAA,MAAA,CAAA;EACG,SAAA,MAAA,EAHJ,OAGI;EACI,SAAA,SAAA,EAHL,UAGK;EACa,SAAA,OAAA,EAHpB,QAGoB;EAAf,SAAA,SAAA,CAAA,EAFF,UAEE;EACR,SAAA,cAAA,EAFU,MAEV,CAAA,MAAA,EAAA,OAAA,C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