@prisma-next/contract 0.3.0-dev.4 → 0.3.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ir.d.ts ADDED
@@ -0,0 +1,76 @@
1
+ /**
2
+ * ContractIR types and factories for building contract intermediate representation.
3
+ * ContractIR is family-agnostic and used by authoring, emitter, and no-emit runtime.
4
+ */
5
+ /**
6
+ * ContractIR represents the intermediate representation of a contract.
7
+ * It is family-agnostic and contains generic storage, models, and relations.
8
+ * Note: coreHash and profileHash are computed by the emitter, not part of the IR.
9
+ */
10
+ export interface ContractIR<TStorage extends Record<string, unknown> = Record<string, unknown>, TModels extends Record<string, unknown> = Record<string, unknown>, TRelations extends Record<string, unknown> = Record<string, unknown>> {
11
+ readonly schemaVersion: string;
12
+ readonly targetFamily: string;
13
+ readonly target: string;
14
+ readonly models: TModels;
15
+ readonly relations: TRelations;
16
+ readonly storage: TStorage;
17
+ readonly extensionPacks: Record<string, unknown>;
18
+ readonly capabilities: Record<string, Record<string, boolean>>;
19
+ readonly meta: Record<string, unknown>;
20
+ readonly sources: Record<string, unknown>;
21
+ }
22
+ /**
23
+ * Creates the header portion of a ContractIR.
24
+ * Contains schema version, target, target family, core hash, and optional profile hash.
25
+ */
26
+ export declare function irHeader(opts: {
27
+ target: string;
28
+ targetFamily: string;
29
+ coreHash: string;
30
+ profileHash?: string;
31
+ }): {
32
+ readonly schemaVersion: string;
33
+ readonly target: string;
34
+ readonly targetFamily: string;
35
+ readonly coreHash: string;
36
+ readonly profileHash?: string;
37
+ };
38
+ /**
39
+ * Creates the meta portion of a ContractIR.
40
+ * Contains capabilities, extensionPacks, meta, and sources with empty object defaults.
41
+ * If a field is explicitly `undefined`, it will be omitted (for testing validation).
42
+ */
43
+ export declare function irMeta(opts?: {
44
+ capabilities?: Record<string, Record<string, boolean>> | undefined;
45
+ extensionPacks?: Record<string, unknown> | undefined;
46
+ meta?: Record<string, unknown> | undefined;
47
+ sources?: Record<string, unknown> | undefined;
48
+ }): {
49
+ readonly capabilities: Record<string, Record<string, boolean>>;
50
+ readonly extensionPacks: Record<string, unknown>;
51
+ readonly meta: Record<string, unknown>;
52
+ readonly sources: Record<string, unknown>;
53
+ };
54
+ /**
55
+ * Creates a complete ContractIR by combining header, meta, and family-specific sections.
56
+ * This is a family-agnostic factory that accepts generic storage, models, and relations.
57
+ */
58
+ export declare function contractIR<TStorage extends Record<string, unknown>, TModels extends Record<string, unknown>, TRelations extends Record<string, unknown>>(opts: {
59
+ header: {
60
+ readonly schemaVersion: string;
61
+ readonly target: string;
62
+ readonly targetFamily: string;
63
+ readonly coreHash: string;
64
+ readonly profileHash?: string;
65
+ };
66
+ meta: {
67
+ readonly capabilities: Record<string, Record<string, boolean>>;
68
+ readonly extensionPacks: Record<string, unknown>;
69
+ readonly meta: Record<string, unknown>;
70
+ readonly sources: Record<string, unknown>;
71
+ };
72
+ storage: TStorage;
73
+ models: TModels;
74
+ relations: TRelations;
75
+ }): ContractIR<TStorage, TModels, TRelations>;
76
+ //# sourceMappingURL=ir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,WAAW,UAAU,CACzB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEpE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM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CAAC;KAC3C,CAAC;IACF,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,UAAU,CAAC;CACvB,GAAG,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAW5C"}
@@ -0,0 +1,222 @@
1
+ import type { OperationRegistry } from '@prisma-next/operations';
2
+ import type { ContractIR } from './ir';
3
+ export interface ContractBase {
4
+ readonly schemaVersion: string;
5
+ readonly target: string;
6
+ readonly targetFamily: string;
7
+ readonly coreHash: string;
8
+ readonly profileHash?: string;
9
+ readonly capabilities?: Record<string, Record<string, boolean>>;
10
+ readonly extensionPacks?: Record<string, unknown>;
11
+ readonly meta?: Record<string, unknown>;
12
+ readonly sources?: Record<string, Source>;
13
+ }
14
+ export interface FieldType {
15
+ readonly type: string;
16
+ readonly nullable: boolean;
17
+ readonly items?: FieldType;
18
+ readonly properties?: Record<string, FieldType>;
19
+ }
20
+ export interface Source {
21
+ readonly readOnly: boolean;
22
+ readonly projection: Record<string, FieldType>;
23
+ readonly origin?: Record<string, unknown>;
24
+ readonly capabilities?: Record<string, boolean>;
25
+ }
26
+ export interface DocIndex {
27
+ readonly name: string;
28
+ readonly keys: Record<string, 'asc' | 'desc'>;
29
+ readonly unique?: boolean;
30
+ readonly where?: Expr;
31
+ }
32
+ export type Expr = {
33
+ readonly kind: 'eq';
34
+ readonly path: ReadonlyArray<string>;
35
+ readonly value: unknown;
36
+ } | {
37
+ readonly kind: 'exists';
38
+ readonly path: ReadonlyArray<string>;
39
+ };
40
+ export interface DocCollection {
41
+ readonly name: string;
42
+ readonly id?: {
43
+ readonly strategy: 'auto' | 'client' | 'uuid' | 'cuid' | 'objectId';
44
+ };
45
+ readonly fields: Record<string, FieldType>;
46
+ readonly indexes?: ReadonlyArray<DocIndex>;
47
+ readonly readOnly?: boolean;
48
+ }
49
+ export interface DocumentStorage {
50
+ readonly document: {
51
+ readonly collections: Record<string, DocCollection>;
52
+ };
53
+ }
54
+ export interface DocumentContract extends ContractBase {
55
+ readonly targetFamily: string;
56
+ readonly storage: DocumentStorage;
57
+ }
58
+ export interface ParamDescriptor {
59
+ readonly index?: number;
60
+ readonly name?: string;
61
+ readonly codecId?: string;
62
+ readonly nativeType?: string;
63
+ readonly nullable?: boolean;
64
+ readonly source: 'dsl' | 'raw';
65
+ readonly refs?: {
66
+ table: string;
67
+ column: string;
68
+ };
69
+ }
70
+ export interface PlanRefs {
71
+ readonly tables?: readonly string[];
72
+ readonly columns?: ReadonlyArray<{
73
+ table: string;
74
+ column: string;
75
+ }>;
76
+ readonly indexes?: ReadonlyArray<{
77
+ readonly table: string;
78
+ readonly columns: ReadonlyArray<string>;
79
+ readonly name?: string;
80
+ }>;
81
+ }
82
+ export interface PlanMeta {
83
+ readonly target: string;
84
+ readonly targetFamily?: string;
85
+ readonly coreHash: string;
86
+ readonly profileHash?: string;
87
+ readonly lane: string;
88
+ readonly annotations?: {
89
+ codecs?: Record<string, string>;
90
+ [key: string]: unknown;
91
+ };
92
+ readonly paramDescriptors: ReadonlyArray<ParamDescriptor>;
93
+ readonly refs?: PlanRefs;
94
+ readonly projection?: Record<string, string> | ReadonlyArray<string>;
95
+ /**
96
+ * Optional mapping of projection alias → column type ID (fully qualified ns/name@version).
97
+ * Used for codec resolution when AST+refs don't provide enough type info.
98
+ */
99
+ readonly projectionTypes?: Record<string, string>;
100
+ }
101
+ /**
102
+ * Canonical execution plan shape used by runtimes.
103
+ *
104
+ * - Row is the inferred result row type (TypeScript-only).
105
+ * - Ast is the optional, family-specific AST type (e.g. SQL QueryAst).
106
+ *
107
+ * The payload executed by the runtime is represented by the sql + params pair
108
+ * for now; future families can specialize this via Ast or additional metadata.
109
+ */
110
+ export interface ExecutionPlan<Row = unknown, Ast = unknown> {
111
+ readonly sql: string;
112
+ readonly params: readonly unknown[];
113
+ readonly ast?: Ast;
114
+ readonly meta: PlanMeta;
115
+ /**
116
+ * Phantom property to carry the Row generic for type-level utilities.
117
+ * Not set at runtime; used only for ResultType extraction.
118
+ */
119
+ readonly _row?: Row;
120
+ }
121
+ /**
122
+ * Utility type to extract the Row type from an ExecutionPlan.
123
+ * Example: `type Row = ResultType<typeof plan>`
124
+ *
125
+ * Works with both ExecutionPlan and SqlQueryPlan (SQL query plans before lowering).
126
+ * SqlQueryPlan includes a phantom `_Row` property to preserve the generic parameter
127
+ * for type extraction.
128
+ */
129
+ export type ResultType<P> = P extends ExecutionPlan<infer R, unknown> ? R : P extends {
130
+ readonly _Row?: infer R;
131
+ } ? R : never;
132
+ /**
133
+ * Type guard to check if a contract is a Document contract
134
+ */
135
+ export declare function isDocumentContract(contract: unknown): contract is DocumentContract;
136
+ /**
137
+ * Contract marker record stored in the database.
138
+ * Represents the current contract identity for a database.
139
+ */
140
+ export interface ContractMarkerRecord {
141
+ readonly coreHash: string;
142
+ readonly profileHash: string;
143
+ readonly contractJson: unknown | null;
144
+ readonly canonicalVersion: number | null;
145
+ readonly updatedAt: Date;
146
+ readonly appTag: string | null;
147
+ readonly meta: Record<string, unknown>;
148
+ }
149
+ /**
150
+ * Specifies how to import TypeScript types from a package.
151
+ * Used in extension pack manifests to declare codec and operation type imports.
152
+ */
153
+ export interface TypesImportSpec {
154
+ readonly package: string;
155
+ readonly named: string;
156
+ readonly alias: string;
157
+ }
158
+ /**
159
+ * Validation context passed to TargetFamilyHook.validateTypes().
160
+ * Contains pre-assembled operation registry, type imports, and extension IDs.
161
+ */
162
+ export interface ValidationContext {
163
+ readonly operationRegistry?: OperationRegistry;
164
+ readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
165
+ readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
166
+ readonly extensionIds?: ReadonlyArray<string>;
167
+ }
168
+ /**
169
+ * SPI interface for target family hooks that extend emission behavior.
170
+ * Implemented by family-specific emitter hooks (e.g., SQL family).
171
+ */
172
+ export interface TargetFamilyHook {
173
+ readonly id: string;
174
+ /**
175
+ * Validates that all type IDs in the contract come from referenced extension packs.
176
+ * @param ir - Contract IR to validate
177
+ * @param ctx - Validation context with operation registry and extension IDs
178
+ */
179
+ validateTypes(ir: ContractIR, ctx: ValidationContext): void;
180
+ /**
181
+ * Validates family-specific contract structure.
182
+ * @param ir - Contract IR to validate
183
+ */
184
+ validateStructure(ir: ContractIR): void;
185
+ /**
186
+ * Generates contract.d.ts file content.
187
+ * @param ir - Contract IR
188
+ * @param codecTypeImports - Array of codec type import specs
189
+ * @param operationTypeImports - Array of operation type import specs
190
+ * @returns Generated TypeScript type definitions as string
191
+ */
192
+ generateContractTypes(ir: ContractIR, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>): string;
193
+ }
194
+ export type ArgSpecManifest = {
195
+ readonly kind: 'typeId';
196
+ readonly type: string;
197
+ } | {
198
+ readonly kind: 'param';
199
+ } | {
200
+ readonly kind: 'literal';
201
+ };
202
+ export type ReturnSpecManifest = {
203
+ readonly kind: 'typeId';
204
+ readonly type: string;
205
+ } | {
206
+ readonly kind: 'builtin';
207
+ readonly type: 'number' | 'boolean' | 'string';
208
+ };
209
+ export interface LoweringSpecManifest {
210
+ readonly targetFamily: 'sql';
211
+ readonly strategy: 'infix' | 'function';
212
+ readonly template: string;
213
+ }
214
+ export interface OperationManifest {
215
+ readonly for: string;
216
+ readonly method: string;
217
+ readonly args: ReadonlyArray<ArgSpecManifest>;
218
+ readonly returns: ReturnSpecManifest;
219
+ readonly lowering: LoweringSpecManifest;
220
+ readonly capabilities?: ReadonlyArray<string>;
221
+ }
222
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,aAAa,EAA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AAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;CAAE,CAAC;AAEjF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/C"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@prisma-next/contract",
3
- "version": "0.3.0-dev.4",
3
+ "version": "0.3.0-dev.5",
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.4"
8
+ "@prisma-next/operations": "0.3.0-dev.5"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@vitest/coverage-v8": "4.0.16",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "src",
19
20
  "schemas"
20
21
  ],
21
22
  "exports": {
@@ -38,7 +39,7 @@
38
39
  "./schema-document": "./schemas/data-contract-document-v1.json"
39
40
  },
40
41
  "scripts": {
41
- "build": "tsup --config tsup.config.ts",
42
+ "build": "tsup --config tsup.config.ts && tsc --project tsconfig.build.json",
42
43
  "test": "vitest run --passWithNoTests",
43
44
  "test:coverage": "vitest run --coverage --passWithNoTests",
44
45
  "typecheck": "tsc --project tsconfig.json --noEmit",
@@ -0,0 +1,26 @@
1
+ export type {
2
+ // Descriptors
3
+ AdapterDescriptor,
4
+ // Instances
5
+ AdapterInstance,
6
+ AdapterPackRef,
7
+ ComponentDescriptor,
8
+ ComponentMetadata,
9
+ ContractComponentRequirementsCheckInput,
10
+ ContractComponentRequirementsCheckResult,
11
+ DriverDescriptor,
12
+ DriverInstance,
13
+ DriverPackRef,
14
+ ExtensionDescriptor,
15
+ ExtensionInstance,
16
+ ExtensionPackRef,
17
+ FamilyDescriptor,
18
+ FamilyInstance,
19
+ PackRefBase,
20
+ TargetBoundComponentDescriptor,
21
+ TargetDescriptor,
22
+ TargetInstance,
23
+ TargetPackRef,
24
+ } from '../framework-components';
25
+
26
+ export { checkContractComponentRequirements } from '../framework-components';
@@ -0,0 +1 @@
1
+ export * from '../ir';
@@ -0,0 +1,6 @@
1
+ export type {
2
+ ArgSpecManifest,
3
+ LoweringSpecManifest,
4
+ OperationManifest,
5
+ ReturnSpecManifest,
6
+ } from '../types';
@@ -0,0 +1,26 @@
1
+ // Shared types
2
+ // Document family types
3
+ // Plan types - target-family agnostic execution types
4
+ // Emitter types (moved from @prisma-next/emitter)
5
+ export type {
6
+ ContractBase,
7
+ ContractMarkerRecord,
8
+ DocCollection,
9
+ DocIndex,
10
+ DocumentContract,
11
+ DocumentStorage,
12
+ ExecutionPlan,
13
+ Expr,
14
+ FieldType,
15
+ OperationManifest,
16
+ ParamDescriptor,
17
+ PlanMeta,
18
+ PlanRefs,
19
+ ResultType,
20
+ Source,
21
+ TargetFamilyHook,
22
+ TypesImportSpec,
23
+ ValidationContext,
24
+ } from '../types';
25
+ // Type guards
26
+ export { isDocumentContract } from '../types';