@prisma-next/contract 0.5.0-dev.22 → 0.5.0-dev.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -11
- package/dist/{contract-types-CBpVDR8h.d.mts → contract-types-DULFYxpd.d.mts} +3 -36
- package/dist/{contract-types-CBpVDR8h.d.mts.map → contract-types-DULFYxpd.d.mts.map} +1 -1
- package/dist/hashing.d.mts +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/types-aMyNgejf.mjs.map +1 -1
- package/dist/types.d.mts +2 -2
- package/dist/validate-contract.d.mts +1 -1
- package/package.json +2 -2
- package/src/exports/types.ts +0 -2
- package/src/types.ts +1 -31
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Core contract data types and JSON schemas for Prisma Next.
|
|
|
11
11
|
This package provides the foundational type definitions for Prisma Next data contracts:
|
|
12
12
|
|
|
13
13
|
- **Contract data types**: The canonical description of an application's data model and storage layout (`ContractBase`, `DocumentContract`, `Source`, `FieldType`)
|
|
14
|
-
- **Plan metadata**: Target-family-agnostic plan metadata
|
|
14
|
+
- **Plan metadata**: Target-family-agnostic plan metadata (`PlanMeta`). The plan markers themselves (`QueryPlan`, `ExecutionPlan`) live in `@prisma-next/framework-components/runtime`; family-specific plans (`SqlExecutionPlan`, `MongoExecutionPlan`) live in their respective domains. Per [ADR 205](../../../../docs/architecture%20docs/adrs/ADR%20205%20-%20Execution%20metadata%20lives%20on%20AST.md), execution metadata (codec IDs, projection refs, parameter descriptors) lives on the family AST when one is present, not on `PlanMeta`.
|
|
15
15
|
- **Hash types**: Branded hash types for storage, execution, and profile hashing (`StorageHashBase`, `ExecutionHashBase`, `ProfileHashBase`)
|
|
16
16
|
- **JSON Schemas**: Validation schemas for contract files
|
|
17
17
|
- **Type guards**: Runtime type guards for narrowing contract types (`isDocumentContract`)
|
|
@@ -60,16 +60,6 @@ For SQL contracts, use `@prisma-next/sql-contract-ts/schema-sql` instead.
|
|
|
60
60
|
|
|
61
61
|
## Type System
|
|
62
62
|
|
|
63
|
-
### Plan Types
|
|
64
|
-
|
|
65
|
-
`ParamDescriptor` describes a single parameter in an execution plan:
|
|
66
|
-
|
|
67
|
-
- **`source`**: Origin of the parameter (`'dsl'`, `'raw'`, or `'lane'`)
|
|
68
|
-
- **`index`** (optional): 1-based position into `plan.params`
|
|
69
|
-
- **`name`** (optional): Parameter name for codec resolution
|
|
70
|
-
- **`codecId`**, **`nativeType`**, **`nullable`** (optional): Type metadata from contract
|
|
71
|
-
- **`refs`** (optional): `{ table, column }` when the param is used against a known column
|
|
72
|
-
|
|
73
63
|
### Column Defaults
|
|
74
64
|
|
|
75
65
|
- When adding column defaults, re-emit the contract and verify the emitted JSON includes the full default payload.
|
|
@@ -177,30 +177,6 @@ interface DocCollection {
|
|
|
177
177
|
readonly indexes?: ReadonlyArray<DocIndex>;
|
|
178
178
|
readonly readOnly?: boolean;
|
|
179
179
|
}
|
|
180
|
-
interface ParamDescriptor {
|
|
181
|
-
readonly index?: number;
|
|
182
|
-
readonly name?: string;
|
|
183
|
-
readonly codecId?: string;
|
|
184
|
-
readonly nativeType?: string;
|
|
185
|
-
readonly nullable?: boolean;
|
|
186
|
-
readonly source: 'dsl' | 'raw' | 'lane';
|
|
187
|
-
readonly refs?: {
|
|
188
|
-
table: string;
|
|
189
|
-
column: string;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
interface PlanRefs {
|
|
193
|
-
readonly tables?: readonly string[];
|
|
194
|
-
readonly columns?: ReadonlyArray<{
|
|
195
|
-
table: string;
|
|
196
|
-
column: string;
|
|
197
|
-
}>;
|
|
198
|
-
readonly indexes?: ReadonlyArray<{
|
|
199
|
-
readonly table: string;
|
|
200
|
-
readonly columns: ReadonlyArray<string>;
|
|
201
|
-
readonly name?: string;
|
|
202
|
-
}>;
|
|
203
|
-
}
|
|
204
180
|
interface PlanMeta {
|
|
205
181
|
readonly target: string;
|
|
206
182
|
readonly targetFamily?: string;
|
|
@@ -208,17 +184,8 @@ interface PlanMeta {
|
|
|
208
184
|
readonly profileHash?: string;
|
|
209
185
|
readonly lane: string;
|
|
210
186
|
readonly annotations?: {
|
|
211
|
-
|
|
212
|
-
[key: string]: unknown;
|
|
187
|
+
readonly [key: string]: unknown;
|
|
213
188
|
};
|
|
214
|
-
readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;
|
|
215
|
-
readonly refs?: PlanRefs;
|
|
216
|
-
readonly projection?: Record<string, string> | ReadonlyArray<string>;
|
|
217
|
-
/**
|
|
218
|
-
* Optional mapping of projection alias → column type ID (fully qualified ns/name@version).
|
|
219
|
-
* Used for codec resolution when AST+refs don't provide enough type info.
|
|
220
|
-
*/
|
|
221
|
-
readonly projectionTypes?: Record<string, string>;
|
|
222
189
|
}
|
|
223
190
|
/**
|
|
224
191
|
* Contract marker record stored in the database.
|
|
@@ -280,5 +247,5 @@ interface Contract<TStorage extends StorageBase = StorageBase, TModels extends R
|
|
|
280
247
|
readonly meta: Record<string, unknown>;
|
|
281
248
|
}
|
|
282
249
|
//#endregion
|
|
283
|
-
export {
|
|
284
|
-
//# sourceMappingURL=contract-types-
|
|
250
|
+
export { ContractField as A, ModelStorageBase as B, StorageBase as C, profileHash as D, executionHash as E, ContractRelation as F, ScalarFieldType as H, ContractRelationOn as I, ContractValueObject as L, ContractModel as M, ContractModelBase as N, ContractDiscriminator as O, ContractReferenceRelation as P, ContractVariantEntry as R, Source as S, coreHash as T, UnionFieldType as U, ReferenceRelationKeys as V, ValueObjectFieldType as W, GeneratedValueSpec as _, ColumnDefault as a, PlanMeta as b, ContractMarkerRecord as c, ExecutionHashBase as d, ExecutionMutationDefault as f, FieldType as g, Expr as h, Brand as i, ContractFieldType as j, ContractEmbedRelation as k, DocCollection as l, ExecutionSection as m, ContractExecutionSection as n, ColumnDefaultLiteralInputValue as o, ExecutionMutationDefaultValue as p, $ as r, ColumnDefaultLiteralValue as s, Contract as t, DocIndex as u, JsonPrimitive as v, StorageHashBase as w, ProfileHashBase as x, JsonValue as y, EmbedRelationKeys as z };
|
|
251
|
+
//# sourceMappingURL=contract-types-DULFYxpd.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-types-
|
|
1
|
+
{"version":3,"file":"contract-types-DULFYxpd.d.mts","names":[],"sources":["../src/domain-types.ts","../src/types.ts","../src/contract-types.ts"],"sourcesContent":[],"mappings":";KAAY,eAAA;EAAA,SAAA,IAAA,EAAA,QAAe;EAMf,SAAA,OAAA,EAAA,MAAoB;EAKpB,SAAA,UAAc,CAAA,EARF,MAQE,CAAA,MAAA,EAAA,OAAA,CAAA;CAEQ;AAAkB,KAPxC,oBAAA,GAOwC;EAAhC,SAAA,IAAA,EAAA,aAAA;EAAa,SAAA,IAAA,EAAA,MAAA;AAGjC,CAAA;AAAgC,KALpB,cAAA,GAKoB;EAAkB,SAAA,IAAA,EAAA,OAAA;EAAuB,SAAA,OAAA,EAHrD,aAGqD,CAHvC,eAGuC,GAHrB,oBAGqB,CAAA;CAAc;AAE3E,KAFA,iBAAA,GAAoB,eAIf,GAJiC,oBAIhB,GAJuC,cAIvC;AAKtB,KAPA,aAAA,GAOkB;EAKlB,SAAA,QAAA,EAAA,OAAA;EAMA,SAAA,IAAA,EAhBK,iBAgBgB;EAKrB,SAAA,IAAA,CAAA,EAAA,IAAgB;EAEhB,SAAA,IAAA,CAAA,EAAA,IAAA;AAIZ,CAAA;AAIY,KA1BA,kBAAA,GA0BmB;EAInB,SAAA,WAAgB,EAAA,SAAY,MAAA,EAAT;EAEd,SAAA,YAAiB,EAAA,SAAA,MAAA,EAAA;CAAuB;AAAmB,KA3BhE,yBAAA,GA2BgE;EAC1C,SAAA,EAAA,EAAA,MAAA;EAAf,SAAA,WAAA,EAAA,KAAA,GAAA,KAAA,GAAA,KAAA;EACkB,SAAA,EAAA,EA1BtB,kBA0BsB;CAAf;AACF,KAxBR,qBAAA,GAwBQ;EACO,SAAA,EAAA,EAAA,MAAA;EACU,SAAA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D6D,CAAA,cAAA,MAAA,GAAA,MAAA,CAAA,GAAA;EAAc,SAAA,aAAA,EEE7D,iBFF6D,CEE3C,KFF2C,CAAA;EAE3E,SAAA,SAAa,EAAA;IAOb,SAAA,QAAkB,EELP,aFKO,CELO,wBFKP,CAAA;EAKlB,CAAA;AAMZ,CAAA;AAKA;AAEA;AAIA;AAIA;AAIA;AAEA;;;;;;;;;;AAKsB,UEvBL,QFuBK,CAAA,iBEtBH,WFsBG,GEtBW,WFsBX,EAAA,gBErBJ,MFqBI,CAAA,MAAA,EErBW,iBFqBX,CAAA,GErBgC,MFqBhC,CAAA,MAAA,EErB+C,iBFqB/C,CAAA,CAAA,CAAA;EAAM,SAAA,MAAA,EAAA,MAAA;EAKX,SAAA,YAAa,EAAA,MAAA;EAAuB,SAAA,KAAA,EEtBnC,MFsBmC,CAAA,MAAA,EAAA,MAAA,CAAA;EAAmB,SAAA,MAAA,EErBrD,OFqBqD;EAC5C,SAAA,YAAA,CAAA,EErBF,MFqBE,CAAA,MAAA,EErBa,mBFqBb,CAAA;EACM,SAAA,OAAA,EErBd,QFqBc;EAAf,SAAA,YAAA,EEpBM,MFoBN,CAAA,MAAA,EEpBqB,MFoBrB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EADT,SAAA,cAAA,EElBiB,MFkBjB,CAAA,MAAA,EAAA,OAAA,CAAA;EAAiB,SAAA,SAAA,CAAA,EEjBJ,wBFiBI;EAMtB,SAAA,WAAA,EEtBmB,eFsBG,CAAA,MAAA,CAAA;EAC4C,SAAA,IAAA,EEtBtD,MFsBsD,CAAA,MAAA,EAAA,OAAA,CAAA"}
|
package/dist/hashing.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as ExecutionHashBase, t as Contract, w as StorageHashBase, x as ProfileHashBase } from "./contract-types-DULFYxpd.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/canonicalization.d.ts
|
|
4
4
|
declare function canonicalizeContractToObject(contract: Contract, options?: {
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as ModelStorageBase, C as StorageBase, L as ContractValueObject, M as ContractModel, N as ContractModelBase, m as ExecutionSection, t as Contract, w as StorageHashBase, x as ProfileHashBase } from "./contract-types-DULFYxpd.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/testing-factories.d.ts
|
|
4
4
|
type ContractOverrides<TStorage extends StorageBase = StorageBase, TModels extends Record<string, ContractModelBase> = Record<string, ContractModel>> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-aMyNgejf.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\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 * 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 executionHash<const T extends string>(value: T): ExecutionHashBase<T> {\n return value as ExecutionHashBase<T>;\n}\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\n/**\n * Base type for family-specific storage blocks.\n * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the\n * storage hash alongside family-specific data (tables, collections, etc.).\n */\nexport interface StorageBase<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\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 ColumnDefaultLiteralValue = JsonValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | 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<THash extends string = string> = {\n readonly executionHash: ExecutionHashBase<THash>;\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\
|
|
1
|
+
{"version":3,"file":"types-aMyNgejf.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\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 * 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 executionHash<const T extends string>(value: T): ExecutionHashBase<T> {\n return value as ExecutionHashBase<T>;\n}\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\n/**\n * Base type for family-specific storage blocks.\n * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the\n * storage hash alongside family-specific data (tables, collections, etc.).\n */\nexport interface StorageBase<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\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 ColumnDefaultLiteralValue = JsonValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | 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<THash extends string = string> = {\n readonly executionHash: ExecutionHashBase<THash>;\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 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 readonly [key: string]: unknown;\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 readonly invariants: readonly string[];\n}\n"],"mappings":";AA+BA,SAAgB,cAAsC,OAAgC;AACpF,QAAO;;AAGT,SAAgB,SAAiC,OAA8B;AAC7E,QAAO;;AAUT,SAAgB,YAAoC,OAA8B;AAChF,QAAO"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { type $, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractFieldType, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractValueObject, type ContractVariantEntry, type DocCollection, type DocIndex, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ModelStorageBase, type
|
|
1
|
+
import { A as ContractField, B as ModelStorageBase, C as StorageBase, D as profileHash, E as executionHash, F as ContractRelation, H as ScalarFieldType, I as ContractRelationOn, L as ContractValueObject, M as ContractModel, N as ContractModelBase, O as ContractDiscriminator, P as ContractReferenceRelation, R as ContractVariantEntry, S as Source, T as coreHash, U as UnionFieldType, V as ReferenceRelationKeys, W as ValueObjectFieldType, _ as GeneratedValueSpec, a as ColumnDefault, b as PlanMeta, c as ContractMarkerRecord, d as ExecutionHashBase, f as ExecutionMutationDefault, g as FieldType, h as Expr, i as Brand, j as ContractFieldType, k as ContractEmbedRelation, l as DocCollection, m as ExecutionSection, n as ContractExecutionSection, o as ColumnDefaultLiteralInputValue, p as ExecutionMutationDefaultValue, r as $, s as ColumnDefaultLiteralValue, t as Contract, u as DocIndex, v as JsonPrimitive, w as StorageHashBase, x as ProfileHashBase, y as JsonValue, z as EmbedRelationKeys } from "./contract-types-DULFYxpd.mjs";
|
|
2
|
+
export { type $, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractFieldType, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractValueObject, type ContractVariantEntry, type DocCollection, type DocIndex, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ModelStorageBase, type PlanMeta, type ProfileHashBase, type ReferenceRelationKeys, type ScalarFieldType, type Source, type StorageBase, type StorageHashBase, type UnionFieldType, type ValueObjectFieldType, coreHash, executionHash, profileHash };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/contract",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.24",
|
|
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
8
|
"arktype": "^2.1.29",
|
|
9
|
-
"@prisma-next/utils": "0.5.0-dev.
|
|
9
|
+
"@prisma-next/utils": "0.5.0-dev.24"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"tsdown": "0.18.4",
|
package/src/exports/types.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -135,27 +135,6 @@ export interface DocCollection {
|
|
|
135
135
|
readonly readOnly?: boolean;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
// Plan types - target-family agnostic execution types
|
|
139
|
-
export interface ParamDescriptor {
|
|
140
|
-
readonly index?: number;
|
|
141
|
-
readonly name?: string;
|
|
142
|
-
readonly codecId?: string;
|
|
143
|
-
readonly nativeType?: string;
|
|
144
|
-
readonly nullable?: boolean;
|
|
145
|
-
readonly source: 'dsl' | 'raw' | 'lane';
|
|
146
|
-
readonly refs?: { table: string; column: string };
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface PlanRefs {
|
|
150
|
-
readonly tables?: readonly string[];
|
|
151
|
-
readonly columns?: ReadonlyArray<{ table: string; column: string }>;
|
|
152
|
-
readonly indexes?: ReadonlyArray<{
|
|
153
|
-
readonly table: string;
|
|
154
|
-
readonly columns: ReadonlyArray<string>;
|
|
155
|
-
readonly name?: string;
|
|
156
|
-
}>;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
138
|
export interface PlanMeta {
|
|
160
139
|
readonly target: string;
|
|
161
140
|
readonly targetFamily?: string;
|
|
@@ -163,17 +142,8 @@ export interface PlanMeta {
|
|
|
163
142
|
readonly profileHash?: string;
|
|
164
143
|
readonly lane: string;
|
|
165
144
|
readonly annotations?: {
|
|
166
|
-
|
|
167
|
-
[key: string]: unknown;
|
|
145
|
+
readonly [key: string]: unknown;
|
|
168
146
|
};
|
|
169
|
-
readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;
|
|
170
|
-
readonly refs?: PlanRefs;
|
|
171
|
-
readonly projection?: Record<string, string> | ReadonlyArray<string>;
|
|
172
|
-
/**
|
|
173
|
-
* Optional mapping of projection alias → column type ID (fully qualified ns/name@version).
|
|
174
|
-
* Used for codec resolution when AST+refs don't provide enough type info.
|
|
175
|
-
*/
|
|
176
|
-
readonly projectionTypes?: Record<string, string>;
|
|
177
147
|
}
|
|
178
148
|
|
|
179
149
|
/**
|