@prisma-next/contract-authoring 0.3.0-dev.8 → 0.3.0-dev.81

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2026] [Prisma Data, Inc]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -12,8 +12,11 @@ This package provides generic builder primitives that can be composed with targe
12
12
 
13
13
  - **Generic Builder Core**: Provides target-agnostic builder state types and builder classes (`TableBuilder`, `ModelBuilder`, `ContractBuilder`)
14
14
  - **State Management**: Manages builder state for tables, columns, models, and relations without target-specific logic
15
+ - **Storage Type State**: Captures target-agnostic storage type entries and column `typeRef` metadata for family-specific composition
15
16
  - **Type Helpers**: Provides generic type-level helpers for transforming builder states into contract structures
16
17
  - **Composition Surface**: Enables target-family specific packages (e.g., `@prisma-next/sql-contract-ts`) to compose generic core with family-specific types
18
+ - **Defaults**: Reuses shared contract `ColumnDefault` for db-agnostic defaults (literal, function, and client-generated descriptors)
19
+ - **Foreign Keys Configuration**: Provides a `foreignKeys()` method on the base `ContractBuilder` to configure FK constraint and index emission behavior
17
20
 
18
21
  ## Package Status
19
22
 
@@ -33,7 +36,7 @@ This package was created in Phase 2 of the contract authoring extraction. It con
33
36
 
34
37
  ## Exports
35
38
 
36
- - Builder state types: `ColumnBuilderState`, `TableBuilderState`, `ModelBuilderState`, `ContractBuilderState`, `RelationDefinition`, `ColumnBuilder`
39
+ - Builder state types: `ColumnBuilderState`, `TableBuilderState`, `ModelBuilderState`, `ContractBuilderState`, `ForeignKeysConfigState`, `RelationDefinition`, `ColumnBuilder`
37
40
  - Builder classes: `TableBuilder`, `ModelBuilder`, `ContractBuilder`
38
41
  - Type helpers: `BuildStorageColumn`, `BuildStorage`, `BuildModels`, `BuildRelations`, extract helpers, `Mutable`
39
42
  - Factory function: `defineContract()` (generic)
@@ -0,0 +1,311 @@
1
+ import { ColumnDefault, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
2
+ import { TargetPackRef } from "@prisma-next/contract/framework-components";
3
+
4
+ //#region src/builder-state.d.ts
5
+
6
+ /**
7
+ * Duplicated from sql-contract to avoid cross-layer dependency
8
+ * (framework authoring cannot depend on the SQL domain's contract package).
9
+ */
10
+ type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';
11
+ /**
12
+ * Column type descriptor containing both codec ID and native type.
13
+ * Used when defining columns with descriptor objects instead of string IDs.
14
+ *
15
+ * For parameterized types (e.g., `vector(1536)`), the `typeParams` field
16
+ * carries codec-owned parameters that affect both TypeScript type generation
17
+ * and native DDL output.
18
+ */
19
+ type ColumnTypeDescriptor = {
20
+ readonly codecId: string;
21
+ readonly nativeType: string;
22
+ readonly typeParams?: Record<string, unknown>;
23
+ readonly typeRef?: string;
24
+ };
25
+ /**
26
+ * Base column properties shared by all column states.
27
+ */
28
+ type ColumnBuilderStateBase<Name extends string, Type extends string> = {
29
+ readonly name: Name;
30
+ readonly type: Type;
31
+ readonly nativeType: string;
32
+ readonly typeParams?: Record<string, unknown>;
33
+ readonly typeRef?: string;
34
+ };
35
+ type StorageTypeInstanceState = {
36
+ readonly codecId: string;
37
+ readonly nativeType: string;
38
+ readonly typeParams: Record<string, unknown>;
39
+ };
40
+ /**
41
+ * Column builder state.
42
+ *
43
+ * Both nullable and non-nullable columns can define defaults to match database behavior.
44
+ */
45
+ type ColumnBuilderState<Name extends string, Nullable extends boolean, Type extends string> = ColumnBuilderStateBase<Name, Type> & (Nullable extends true ? {
46
+ readonly nullable: true;
47
+ readonly default?: ColumnDefault;
48
+ } : {
49
+ readonly nullable: false;
50
+ readonly default?: ColumnDefault;
51
+ readonly executionDefault?: ExecutionMutationDefaultValue;
52
+ });
53
+ /**
54
+ * Unique constraint definition for table builder.
55
+ */
56
+ interface UniqueConstraintDef {
57
+ readonly columns: readonly string[];
58
+ readonly name?: string;
59
+ }
60
+ /**
61
+ * Index definition for table builder.
62
+ */
63
+ interface IndexDef {
64
+ readonly columns: readonly string[];
65
+ readonly name?: string;
66
+ /**
67
+ * Optional index access method. Extension-specific methods are represented
68
+ * as strings and interpreted by the owning extension package.
69
+ */
70
+ readonly using?: string;
71
+ /**
72
+ * Optional extension-owned index configuration payload.
73
+ */
74
+ readonly config?: Record<string, unknown>;
75
+ }
76
+ /**
77
+ * Options for configuring a foreign key's name and referential actions.
78
+ */
79
+ type ForeignKeyOptions = {
80
+ readonly name?: string;
81
+ readonly onDelete?: ReferentialAction;
82
+ readonly onUpdate?: ReferentialAction;
83
+ };
84
+ /**
85
+ * Foreign key definition for table builder.
86
+ */
87
+ interface ForeignKeyDef extends ForeignKeyOptions {
88
+ readonly columns: readonly string[];
89
+ readonly references: {
90
+ readonly table: string;
91
+ readonly columns: readonly string[];
92
+ };
93
+ readonly constraint?: boolean;
94
+ readonly index?: boolean;
95
+ }
96
+ interface TableBuilderState<Name extends string, Columns extends Record<string, ColumnBuilderState<string, boolean, string>>, PrimaryKey extends readonly string[] | undefined> {
97
+ readonly name: Name;
98
+ readonly columns: Columns;
99
+ readonly primaryKey?: PrimaryKey;
100
+ readonly primaryKeyName?: string;
101
+ readonly uniques: readonly UniqueConstraintDef[];
102
+ readonly indexes: readonly IndexDef[];
103
+ readonly foreignKeys: readonly ForeignKeyDef[];
104
+ }
105
+ type RelationDefinition = {
106
+ readonly to: string;
107
+ readonly cardinality: '1:1' | '1:N' | 'N:1' | 'N:M';
108
+ readonly on: {
109
+ readonly parentCols: readonly string[];
110
+ readonly childCols: readonly string[];
111
+ };
112
+ readonly through?: {
113
+ readonly table: string;
114
+ readonly parentCols: readonly string[];
115
+ readonly childCols: readonly string[];
116
+ };
117
+ };
118
+ interface ModelBuilderState<Name extends string, Table extends string, Fields extends Record<string, string>, Relations extends Record<string, RelationDefinition>> {
119
+ readonly name: Name;
120
+ readonly table: Table;
121
+ readonly fields: Fields;
122
+ readonly relations: Relations;
123
+ }
124
+ interface ForeignKeyDefaultsState {
125
+ readonly constraint: boolean;
126
+ readonly index: boolean;
127
+ }
128
+ interface ContractBuilderState<Target extends string | undefined = string | undefined, Tables extends Record<string, TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>> = Record<never, TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>>, Models extends Record<string, ModelBuilderState<string, string, Record<string, string>, Record<string, RelationDefinition>>> = Record<never, ModelBuilderState<string, string, Record<string, string>, Record<string, RelationDefinition>>>, StorageHash extends string | undefined = string | undefined, ExtensionPacks extends Record<string, unknown> | undefined = undefined, Capabilities extends Record<string, Record<string, boolean>> | undefined = undefined> {
129
+ readonly target?: Target;
130
+ readonly tables: Tables;
131
+ readonly models: Models;
132
+ readonly storageHash?: StorageHash;
133
+ readonly extensionPacks?: ExtensionPacks;
134
+ readonly capabilities?: Capabilities;
135
+ readonly storageTypes?: Record<string, StorageTypeInstanceState>;
136
+ readonly foreignKeyDefaults?: ForeignKeyDefaultsState;
137
+ /**
138
+ * Array of extension pack namespace identifiers (e.g., ['pgvector', 'postgis']).
139
+ * Populated when extension packs are registered during contract building.
140
+ * Used to track which extension packs are included in the contract.
141
+ * Can be undefined or empty if no extension packs are registered.
142
+ * Namespace format matches the extension pack ID (e.g., 'pgvector', not 'pgvector@1.0.0').
143
+ */
144
+ readonly extensionNamespaces?: readonly string[];
145
+ }
146
+ interface ColumnBuilder<Name extends string, Nullable extends boolean, Type extends string> {
147
+ nullable<Value extends boolean>(value?: Value): ColumnBuilder<Name, Value, Type>;
148
+ type<Id extends string>(id: Id): ColumnBuilder<Name, Nullable, Id>;
149
+ build(): ColumnBuilderState<Name, Nullable, Type>;
150
+ }
151
+ //#endregion
152
+ //#region src/model-builder.d.ts
153
+ declare class ModelBuilder<Name extends string, Table extends string, Fields extends Record<string, string> = Record<never, never>, Relations extends Record<string, RelationDefinition> = Record<never, never>> {
154
+ private readonly _name;
155
+ private readonly _table;
156
+ private readonly _fields;
157
+ private readonly _relations;
158
+ constructor(name: Name, table: Table, fields?: Fields, relations?: Relations);
159
+ field<FieldName extends string, ColumnName extends string>(fieldName: FieldName, columnName: ColumnName): ModelBuilder<Name, Table, Fields & Record<FieldName, ColumnName>, Relations>;
160
+ relation<RelationName extends string, ToModel extends string, ToTable extends string>(name: RelationName, options: {
161
+ toModel: ToModel;
162
+ toTable: ToTable;
163
+ cardinality: '1:1' | '1:N' | 'N:1';
164
+ on: {
165
+ parentTable: Table;
166
+ parentColumns: readonly string[];
167
+ childTable: ToTable;
168
+ childColumns: readonly string[];
169
+ };
170
+ }): ModelBuilder<Name, Table, Fields, Relations & Record<RelationName, RelationDefinition>>;
171
+ relation<RelationName extends string, ToModel extends string, ToTable extends string, JunctionTable extends string>(name: RelationName, options: {
172
+ toModel: ToModel;
173
+ toTable: ToTable;
174
+ cardinality: 'N:M';
175
+ through: {
176
+ table: JunctionTable;
177
+ parentColumns: readonly string[];
178
+ childColumns: readonly string[];
179
+ };
180
+ on: {
181
+ parentTable: Table;
182
+ parentColumns: readonly string[];
183
+ childTable: JunctionTable;
184
+ childColumns: readonly string[];
185
+ };
186
+ }): ModelBuilder<Name, Table, Fields, Relations & Record<RelationName, RelationDefinition>>;
187
+ build(): ModelBuilderState<Name, Table, Fields, Relations>;
188
+ }
189
+ //#endregion
190
+ //#region src/table-builder.d.ts
191
+ /**
192
+ * Column options for nullable columns.
193
+ */
194
+ interface NullableColumnOptions<Descriptor extends ColumnTypeDescriptor> {
195
+ type: Descriptor;
196
+ nullable: true;
197
+ typeParams?: Record<string, unknown>;
198
+ default?: ColumnDefault;
199
+ }
200
+ /**
201
+ * Column options for non-nullable columns.
202
+ * Non-nullable columns can optionally have a default value.
203
+ */
204
+ interface NonNullableColumnOptions<Descriptor extends ColumnTypeDescriptor> {
205
+ type: Descriptor;
206
+ nullable?: false;
207
+ typeParams?: Record<string, unknown>;
208
+ default?: ColumnDefault;
209
+ }
210
+ type GeneratedColumnOptions<Descriptor extends ColumnTypeDescriptor> = Omit<NonNullableColumnOptions<Descriptor>, 'default' | 'nullable'> & {
211
+ /**
212
+ * Generated columns are always non-nullable and use mutation-time defaults
213
+ * that the runtime injects when the column is omitted from insert input.
214
+ */
215
+ nullable?: false;
216
+ generated: ExecutionMutationDefaultValue;
217
+ };
218
+ type IndexOptions = {
219
+ readonly name?: string;
220
+ readonly using?: string;
221
+ readonly config?: Record<string, unknown>;
222
+ };
223
+ /**
224
+ * Creates a new table builder with the given name.
225
+ * This is the preferred way to create a TableBuilder - it ensures
226
+ * type parameters are inferred correctly without unsafe casts.
227
+ */
228
+ declare function createTable<Name extends string>(name: Name): TableBuilder<Name>;
229
+ /**
230
+ * Builder for defining table structure with type-safe chaining.
231
+ * Use `createTable(name)` to create instances.
232
+ */
233
+ declare class TableBuilder<Name extends string, Columns extends Record<string, ColumnBuilderState<string, boolean, string>> = Record<never, ColumnBuilderState<string, boolean, string>>, PrimaryKey extends readonly string[] | undefined = undefined> {
234
+ private readonly _state;
235
+ /** @internal Use createTable() instead */
236
+ constructor(name: Name, columns: Columns, primaryKey: PrimaryKey, primaryKeyName: string | undefined, uniques: readonly UniqueConstraintDef[], indexes: readonly IndexDef[], foreignKeys: readonly ForeignKeyDef[]);
237
+ private get _name();
238
+ private get _columns();
239
+ private get _primaryKey();
240
+ /** Add a nullable column to the table. */
241
+ column<ColName extends string, Descriptor extends ColumnTypeDescriptor>(name: ColName, options: NullableColumnOptions<Descriptor>): TableBuilder<Name, Columns & Record<ColName, ColumnBuilderState<ColName, true, Descriptor['codecId']>>, PrimaryKey>;
242
+ /**
243
+ * Add a non-nullable column to the table.
244
+ * Non-nullable columns can optionally have a default value.
245
+ */
246
+ column<ColName extends string, Descriptor extends ColumnTypeDescriptor>(name: ColName, options: NonNullableColumnOptions<Descriptor>): TableBuilder<Name, Columns & Record<ColName, ColumnBuilderState<ColName, false, Descriptor['codecId']>>, PrimaryKey>;
247
+ generated<ColName extends string, Descriptor extends ColumnTypeDescriptor>(name: ColName, options: GeneratedColumnOptions<Descriptor>): TableBuilder<Name, Columns & Record<ColName, ColumnBuilderState<ColName, false, Descriptor['codecId']>>, PrimaryKey>;
248
+ private columnInternal;
249
+ primaryKey<PK extends readonly string[]>(columns: PK, name?: string): TableBuilder<Name, Columns, PK>;
250
+ unique(columns: readonly string[], name?: string): TableBuilder<Name, Columns, PrimaryKey>;
251
+ index(columns: readonly string[], name?: string): TableBuilder<Name, Columns, PrimaryKey>;
252
+ index(columns: readonly string[], options?: IndexOptions): TableBuilder<Name, Columns, PrimaryKey>;
253
+ index(indexDef: IndexDef): TableBuilder<Name, Columns, PrimaryKey>;
254
+ foreignKey(columns: readonly string[], references: {
255
+ table: string;
256
+ columns: readonly string[];
257
+ }, opts?: string | (ForeignKeyOptions & {
258
+ constraint?: boolean;
259
+ index?: boolean;
260
+ })): TableBuilder<Name, Columns, PrimaryKey>;
261
+ build(): TableBuilderState<Name, Columns, PrimaryKey>;
262
+ }
263
+ //#endregion
264
+ //#region src/contract-builder.d.ts
265
+ declare class ContractBuilder<Target extends string | undefined = undefined, Tables extends Record<string, TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>> = Record<never, never>, Models extends Record<string, ModelBuilderState<string, string, Record<string, string>, Record<string, RelationDefinition>>> = Record<never, never>, StorageHash extends string | undefined = undefined, ExtensionPacks extends Record<string, unknown> | undefined = undefined, Capabilities extends Record<string, Record<string, boolean>> | undefined = undefined> {
266
+ protected readonly state: ContractBuilderState<Target, Tables, Models, StorageHash, ExtensionPacks, Capabilities>;
267
+ constructor(state?: ContractBuilderState<Target, Tables, Models, StorageHash, ExtensionPacks, Capabilities>);
268
+ target<T extends string>(packRef: TargetPackRef<string, T>): ContractBuilder<T, Tables, Models, StorageHash, ExtensionPacks, Capabilities>;
269
+ capabilities<C extends Record<string, Record<string, boolean>>>(capabilities: C): ContractBuilder<Target, Tables, Models, StorageHash, ExtensionPacks, C>;
270
+ table<TableName extends string, T extends TableBuilder<TableName, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>>(name: TableName, callback: (t: TableBuilder<TableName>) => T | undefined): ContractBuilder<Target, Tables & Record<TableName, ReturnType<T['build']>>, Models, StorageHash, ExtensionPacks, Capabilities>;
271
+ model<ModelName extends string, TableName extends string, M extends ModelBuilder<ModelName, TableName, Record<string, string>, Record<string, RelationDefinition>>>(name: ModelName, table: TableName, callback: (m: ModelBuilder<ModelName, TableName, Record<never, never>, Record<never, never>>) => M | undefined): ContractBuilder<Target, Tables, Models & Record<ModelName, ReturnType<M['build']>>, StorageHash, ExtensionPacks, Capabilities>;
272
+ storageHash<H extends string>(hash: H): ContractBuilder<Target, Tables, Models, H, ExtensionPacks, Capabilities>;
273
+ foreignKeyDefaults(config: ForeignKeyDefaultsState): ContractBuilder<Target, Tables, Models, StorageHash, ExtensionPacks, Capabilities>;
274
+ }
275
+ declare function defineContract(): ContractBuilder;
276
+ //#endregion
277
+ //#region src/types.d.ts
278
+ type BuildStorageColumn<Nullable extends boolean, Type extends string> = {
279
+ readonly nativeType: string;
280
+ readonly codecId: Type;
281
+ readonly nullable: Nullable;
282
+ readonly typeParams?: Record<string, unknown>;
283
+ readonly typeRef?: string;
284
+ readonly default?: ColumnDefault;
285
+ };
286
+ type ExtractColumns<T extends TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>> = T extends TableBuilderState<string, infer C, readonly string[] | undefined> ? C : never;
287
+ type ExtractPrimaryKey<T extends TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>> = T extends TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, infer PK> ? PK : never;
288
+ type BuildStorage<Tables extends Record<string, TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>>> = {
289
+ readonly tables: { readonly [K in keyof Tables]: {
290
+ readonly columns: { readonly [ColK in keyof ExtractColumns<Tables[K]>]: ExtractColumns<Tables[K]>[ColK] extends ColumnBuilderState<string, infer Null, infer TType> ? BuildStorageColumn<Null & boolean, TType> : never };
291
+ } };
292
+ };
293
+ type BuildStorageTables<Tables extends Record<string, TableBuilderState<string, Record<string, ColumnBuilderState<string, boolean, string>>, readonly string[] | undefined>>> = { readonly [K in keyof Tables]: {
294
+ readonly columns: { readonly [ColK in keyof ExtractColumns<Tables[K]>]: ExtractColumns<Tables[K]>[ColK] extends ColumnBuilderState<string, infer Null, infer TType> ? BuildStorageColumn<Null & boolean, TType> : never };
295
+ } };
296
+ type Mutable<T> = { -readonly [K in keyof T]-?: T[K] };
297
+ type BuildModelFields<Fields extends Record<string, string>> = { readonly [K in keyof Fields]: {
298
+ readonly column: Fields[K];
299
+ } };
300
+ type ExtractModelFields<T extends ModelBuilderState<string, string, Record<string, string>, Record<string, RelationDefinition>>> = T extends ModelBuilderState<string, string, infer F, Record<string, RelationDefinition>> ? F : never;
301
+ type ExtractModelRelations<T extends ModelBuilderState<string, string, Record<string, string>, Record<string, RelationDefinition>>> = T extends ModelBuilderState<string, string, Record<string, string>, infer R> ? R : never;
302
+ type BuildModels<Models extends Record<string, ModelBuilderState<string, string, Record<string, string>, Record<string, RelationDefinition>>>> = { readonly [K in keyof Models]: {
303
+ readonly storage: {
304
+ readonly table: Models[K]['table'];
305
+ };
306
+ readonly fields: BuildModelFields<ExtractModelFields<Models[K]>>;
307
+ } };
308
+ type BuildRelations<Models extends Record<string, ModelBuilderState<string, string, Record<string, string>, Record<string, RelationDefinition>>>> = { readonly [K in keyof Models as Models[K]['table']]: ExtractModelRelations<Models[K]> };
309
+ //#endregion
310
+ export { type BuildModelFields, type BuildModels, type BuildRelations, type BuildStorage, type BuildStorageColumn, type BuildStorageTables, type ColumnBuilder, type ColumnBuilderState, type ColumnTypeDescriptor, ContractBuilder, type ContractBuilderState, type ExtractColumns, type ExtractModelFields, type ExtractModelRelations, type ExtractPrimaryKey, type ForeignKeyDef, type ForeignKeyDefaultsState, type ForeignKeyOptions, type IndexDef, ModelBuilder, type ModelBuilderState, type Mutable, type RelationDefinition, TableBuilder, type TableBuilderState, type UniqueConstraintDef, createTable, defineContract };
311
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/builder-state.ts","../src/model-builder.ts","../src/table-builder.ts","../src/contract-builder.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAMA;AAUY,KAVA,iBAAA,GAUoB,UAGR,GAAA,UAAM,GAAA,SAAA,GAAA,SAAA,GAAA,YAAA;AAE5B;;;;;AAaF;AAWA;;AAIiC,KAjCrB,oBAAA,GAiCqB;EAA7B,SAAA,OAAA,EAAA,MAAA;EACD,SAAA,UAAA,EAAA,MAAA;EACiD,SAAA,UAAA,CAAA,EAhC5B,MAgC4B,CAAA,MAAA,EAAA,OAAA,CAAA;EAGzB,SAAA,OAAA,CAAA,EAAA,MAAA;CACS;;AAMpC;AAQA;AAiBA,KA5DK,sBA4DwB,CAAA,aAEP,MAAA,EAAA,aACA,MAAA,CAAA,GAAA;EAML,SAAA,IAAA,EApEA,IAoEc;EAUd,SAAA,IAAA,EA7EA,IA6EA;EAEgB,SAAA,UAAA,EAAA,MAAA;EAAf,SAAA,UAAA,CAAA,EA7EM,MA6EN,CAAA,MAAA,EAAA,OAAA,CAAA;EAGD,SAAA,OAAA,CAAA,EAAA,MAAA;CACG;AACI,KA9EZ,wBAAA,GA8EY;EAEK,SAAA,OAAA,EAAA,MAAA;EACA,SAAA,UAAA,EAAA,MAAA;EACI,SAAA,UAAA,EA/EV,MA+EU,CAAA,MAAA,EAAA,OAAA,CAAA;CAAa;AAG9C;AAcA;;;;AAMiB,KA9FL,kBA8FK,CAAA,aAAA,MAAA,EAAA,iBAAA,OAAA,EAAA,aAAA,MAAA,CAAA,GA1Fb,sBA0Fa,CA1FU,IA0FV,EA1FgB,IA0FhB,CAAA,GAAA,CAzFd,QAyFc,SAAA,IAAA,GAAA;EACC,SAAA,QAAA,EAAA,IAAA;EACC,S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