@baasix/types 1.0.9 → 1.0.10

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/index.d.mts CHANGED
@@ -404,6 +404,19 @@ interface IndexDefinition {
404
404
  nullsNotDistinct?: boolean;
405
405
  type?: "btree" | "hash" | "gin" | "gist";
406
406
  }
407
+ /**
408
+ * Partitioning options
409
+ */
410
+ interface PartitioningOptions {
411
+ /** Partitioning strategy: LIST by tenant, RANGE by time, or composite */
412
+ strategy: "tenant" | "time" | "tenant+time";
413
+ /** DateTime field used for RANGE partitioning (default "createdAt") */
414
+ timeField?: string;
415
+ /** Time partition width (default "year") */
416
+ interval?: "month" | "quarter" | "year";
417
+ /** Future periods to pre-create (default 1) */
418
+ premake?: number;
419
+ }
407
420
  /**
408
421
  * Schema definition
409
422
  */
@@ -419,6 +432,8 @@ interface SchemaDefinition {
419
432
  * - undefined: use default runtime behavior
420
433
  */
421
434
  tenantScoped?: boolean;
435
+ /** Partitioning configuration for this collection */
436
+ partitioning?: PartitioningOptions;
422
437
  /**
423
438
  * Track user who created/updated records (adds createdBy_Id, updatedBy_Id)
424
439
  */
package/dist/index.d.ts CHANGED
@@ -404,6 +404,19 @@ interface IndexDefinition {
404
404
  nullsNotDistinct?: boolean;
405
405
  type?: "btree" | "hash" | "gin" | "gist";
406
406
  }
407
+ /**
408
+ * Partitioning options
409
+ */
410
+ interface PartitioningOptions {
411
+ /** Partitioning strategy: LIST by tenant, RANGE by time, or composite */
412
+ strategy: "tenant" | "time" | "tenant+time";
413
+ /** DateTime field used for RANGE partitioning (default "createdAt") */
414
+ timeField?: string;
415
+ /** Time partition width (default "year") */
416
+ interval?: "month" | "quarter" | "year";
417
+ /** Future periods to pre-create (default 1) */
418
+ premake?: number;
419
+ }
407
420
  /**
408
421
  * Schema definition
409
422
  */
@@ -419,6 +432,8 @@ interface SchemaDefinition {
419
432
  * - undefined: use default runtime behavior
420
433
  */
421
434
  tenantScoped?: boolean;
435
+ /** Partitioning configuration for this collection */
436
+ partitioning?: PartitioningOptions;
422
437
  /**
423
438
  * Track user who created/updated records (adds createdBy_Id, updatedBy_Id)
424
439
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baasix/types",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Shared TypeScript types for Baasix packages",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/schema.ts CHANGED
@@ -1,352 +1,368 @@
1
- /**
2
- * Schema & Field Types
3
- * Shared across core, sdk, cli, and app packages
4
- */
5
-
6
- // ============================================================================
7
- // Field Types
8
- // ============================================================================
9
-
10
- /**
11
- * Supported field types in Baasix
12
- */
13
- export type FieldType =
14
- | "String"
15
- | "Text"
16
- | "HTML"
17
- | "Integer"
18
- | "BigInt"
19
- | "Float"
20
- | "Real"
21
- | "Double"
22
- | "Decimal"
23
- | "Boolean"
24
- | "Date"
25
- | "DateTime"
26
- | "Time"
27
- | "UUID"
28
- | "SUID"
29
- | "JSON"
30
- | "JSONB"
31
- | "Array"
32
- | "Geometry"
33
- | "Point"
34
- | "LineString"
35
- | "Polygon"
36
- | "Enum";
37
-
38
- /**
39
- * Default value types supported by Baasix
40
- */
41
- export type DefaultValueType =
42
- | { type: "UUIDV4" }
43
- | { type: "SUID" }
44
- | { type: "NOW" }
45
- | { type: "AUTOINCREMENT" }
46
- | { type: "SQL"; value: string }
47
- | { type: "CURRENT_USER" }
48
- | { type: "CURRENT_TENANT" };
49
-
50
- /**
51
- * Field validation rules
52
- */
53
- export interface FieldValidationRules {
54
- /** Minimum value for numeric fields */
55
- min?: number;
56
- /** Maximum value for numeric fields */
57
- max?: number;
58
- /** Validate as integer */
59
- isInt?: boolean;
60
- /** Validate email format */
61
- isEmail?: boolean;
62
- /** Validate URL format */
63
- isUrl?: boolean;
64
- /** Validate IP address format */
65
- isIP?: boolean;
66
- /** Validate UUID format */
67
- isUUID?: boolean;
68
- /** String must not be empty */
69
- notEmpty?: boolean;
70
- /** String length range [min, max] */
71
- len?: [number, number];
72
- /** Pattern matching with regex */
73
- is?: string;
74
- /** Pattern matching with regex (alias for is) */
75
- matches?: string;
76
- /** @deprecated Use 'is' or 'matches' instead */
77
- regex?: string;
78
- }
79
-
80
- /**
81
- * Field values configuration (for type-specific options)
82
- */
83
- export interface FieldValues {
84
- /** String length (varchar) */
85
- length?: number;
86
- /** String length (alias for length) */
87
- stringLength?: number;
88
- /** Decimal precision */
89
- precision?: number;
90
- /** Decimal scale */
91
- scale?: number;
92
- /** Array element type */
93
- type?: string;
94
- /** Enum values */
95
- values?: string[];
96
- /** Spatial reference system identifier (for geometry types) */
97
- srid?: number;
98
- /** Vector dimensions (for pgvector types: Vector, HalfVec, SparseVec) */
99
- dimensions?: number;
100
- }
101
-
102
- /**
103
- * Field definition
104
- * Note: `type` is optional because relation fields use `relType` instead
105
- */
106
- export interface FieldDefinition {
107
- /** Field type (required for data fields, not used for relation fields) */
108
- type?: FieldType | string;
109
- primaryKey?: boolean;
110
- allowNull?: boolean;
111
- unique?: boolean;
112
- /**
113
- * Default value for the field
114
- * Can be a static value or a dynamic type
115
- */
116
- defaultValue?: DefaultValueType | string | number | boolean | null | unknown[] | Record<string, unknown>;
117
- /** Field values configuration (for type-specific options like length, precision, enum values) */
118
- values?: FieldValues;
119
- validate?: FieldValidationRules;
120
- comment?: string;
121
- /** Field description for documentation */
122
- description?: string;
123
- /** Relation type (if this is a relation field) */
124
- relType?: RelationshipType | string;
125
- /** Target collection for relations */
126
- target?: string;
127
- /** Alias for relation (used in queries) */
128
- as?: string;
129
- /** Display format for relations */
130
- showAs?: string;
131
- /** Foreign key field name or boolean indicating it's a foreign key */
132
- foreignKey?: string | boolean;
133
- /** Target key for relations */
134
- targetKey?: string;
135
- /** Junction table name for M2M (or junction config object) */
136
- through?: string | Record<string, unknown>;
137
- /** Other key in junction table */
138
- otherKey?: string;
139
- /** Display format string */
140
- displayFormat?: string;
141
- /** Display options */
142
- displayOptions?: Record<string, unknown>;
143
- /** Calculated field expression */
144
- calculated?: string;
145
- /** Hide field from API responses */
146
- hidden?: boolean;
147
- /** Mark field as system-generated (not user-editable) */
148
- SystemGenerated?: string | boolean;
149
- /** Whether to add constraints */
150
- constraints?: boolean;
151
- /** Delete behavior for relations */
152
- onDelete?: "CASCADE" | "RESTRICT" | "SET NULL" | string;
153
- /** Update behavior for relations */
154
- onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL" | string;
155
- /** Whether this is a polymorphic relation (M2A) */
156
- polymorphic?: boolean;
157
- /** Target tables for polymorphic (M2A) relations */
158
- tables?: string[];
159
- }
160
-
161
- /**
162
- * Flattened field info (used in core services)
163
- */
164
- export interface FlattenedField {
165
- name: string;
166
- type: FieldType;
167
- allowNull?: boolean;
168
- unique?: boolean;
169
- primaryKey?: boolean;
170
- defaultValue?: unknown;
171
- validate?: FieldValidationRules;
172
- relType?: RelationshipType;
173
- target?: string;
174
- }
175
-
176
- /**
177
- * Field info with full metadata
178
- */
179
- export interface FieldInfo extends FlattenedField {
180
- path: string;
181
- isRelation: boolean;
182
- isNested: boolean;
183
- }
184
-
185
- // ============================================================================
186
- // Schema Types
187
- // ============================================================================
188
-
189
- /**
190
- * Index definition
191
- */
192
- export interface IndexDefinition {
193
- /** Index name (auto-generated if not provided) */
194
- name?: string;
195
- fields: string[];
196
- unique?: boolean;
197
- /** When true, NULL values are considered equal for unique indexes (PostgreSQL 15+) */
198
- nullsNotDistinct?: boolean;
199
- type?: "btree" | "hash" | "gin" | "gist";
200
- }
201
-
202
- /**
203
- * Schema definition
204
- */
205
- export interface SchemaDefinition {
206
- name: string;
207
- timestamps?: boolean;
208
- paranoid?: boolean;
209
- sortEnabled?: boolean;
210
- /**
211
- * Controls tenant context enforcement for this collection.
212
- * - true: enforce tenant scoping
213
- * - false: global/shared collection (no tenant enforcement)
214
- * - undefined: use default runtime behavior
215
- */
216
- tenantScoped?: boolean;
217
- /**
218
- * Track user who created/updated records (adds createdBy_Id, updatedBy_Id)
219
- */
220
- usertrack?: boolean;
221
- /**
222
- * True for M2M/M2A junction tables (system-generated)
223
- */
224
- isJunction?: boolean;
225
- fields: Record<string, FieldDefinition>;
226
- indexes?: IndexDefinition[];
227
- }
228
-
229
- /**
230
- * Schema info (full schema with collection name)
231
- */
232
- export interface SchemaInfo {
233
- collectionName: string;
234
- schema: SchemaDefinition;
235
- relationships?: RelationshipDefinition[];
236
- }
237
-
238
- /**
239
- * Validation result (generic base)
240
- */
241
- export interface ValidationResult {
242
- valid: boolean;
243
- errors: string[];
244
- warnings: string[];
245
- }
246
-
247
- /**
248
- * Field validation result
249
- */
250
- export interface FieldValidation extends ValidationResult {
251
- fieldName: string;
252
- }
253
-
254
- /**
255
- * Schema validation result
256
- */
257
- export interface SchemaValidation extends ValidationResult {
258
- collectionName: string;
259
- fieldValidations?: FieldValidation[];
260
- }
261
-
262
- // ============================================================================
263
- // Relationship Types
264
- // ============================================================================
265
-
266
- /**
267
- * Relationship types
268
- * - M2O: Many-to-One (creates foreign key with auto-index)
269
- * - O2M: One-to-Many (virtual reverse of M2O)
270
- * - O2O: One-to-One (creates foreign key with unique constraint)
271
- * - M2M: Many-to-Many (creates junction table)
272
- * - M2A: Many-to-Any (polymorphic junction table)
273
- *
274
- * Legacy aliases (deprecated, use M2O/O2M/M2M/O2O instead):
275
- * - BelongsTo: alias for M2O
276
- * - HasMany: alias for O2M
277
- * - HasOne: alias for O2O
278
- * - BelongsToMany: alias for M2M
279
- */
280
- export type RelationshipType =
281
- | "M2O"
282
- | "O2M"
283
- | "M2M"
284
- | "M2A"
285
- | "O2O"
286
- // Legacy aliases for backward compatibility
287
- | "BelongsTo"
288
- | "HasMany"
289
- | "HasOne"
290
- | "BelongsToMany";
291
-
292
- /**
293
- * Association type (alias for RelationshipType)
294
- */
295
- export type AssociationType = RelationshipType;
296
-
297
- /**
298
- * Relationship definition
299
- */
300
- export interface RelationshipDefinition {
301
- type: RelationshipType;
302
- target: string;
303
- name: string;
304
- alias?: string;
305
- /**
306
- * Custom junction table name for M2M/M2A relationships
307
- */
308
- through?: string;
309
- onDelete?: "CASCADE" | "RESTRICT" | "SET NULL";
310
- onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL";
311
- /** Target tables for M2A (polymorphic) relationships */
312
- tables?: string[];
313
- }
314
-
315
- /**
316
- * Association definition (used internally in core)
317
- */
318
- export interface AssociationDefinition {
319
- type: AssociationType;
320
- foreignKey?: string;
321
- sourceKey?: string;
322
- targetKey?: string;
323
- through?: string;
324
- as?: string;
325
- target: string;
326
- onDelete?: "CASCADE" | "RESTRICT" | "SET NULL";
327
- onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL";
328
- }
329
-
330
- /**
331
- * Include configuration for relation fetching
332
- */
333
- export interface IncludeConfig {
334
- model: string;
335
- as?: string;
336
- attributes?: string[];
337
- where?: Record<string, unknown>;
338
- required?: boolean;
339
- include?: IncludeConfig[];
340
- }
341
-
342
- /**
343
- * Processed include (after parsing)
344
- */
345
- export interface ProcessedInclude {
346
- association: string;
347
- as: string;
348
- attributes?: string[];
349
- where?: Record<string, unknown>;
350
- required?: boolean;
351
- include?: ProcessedInclude[];
352
- }
1
+ /**
2
+ * Schema & Field Types
3
+ * Shared across core, sdk, cli, and app packages
4
+ */
5
+
6
+ // ============================================================================
7
+ // Field Types
8
+ // ============================================================================
9
+
10
+ /**
11
+ * Supported field types in Baasix
12
+ */
13
+ export type FieldType =
14
+ | "String"
15
+ | "Text"
16
+ | "HTML"
17
+ | "Integer"
18
+ | "BigInt"
19
+ | "Float"
20
+ | "Real"
21
+ | "Double"
22
+ | "Decimal"
23
+ | "Boolean"
24
+ | "Date"
25
+ | "DateTime"
26
+ | "Time"
27
+ | "UUID"
28
+ | "SUID"
29
+ | "JSON"
30
+ | "JSONB"
31
+ | "Array"
32
+ | "Geometry"
33
+ | "Point"
34
+ | "LineString"
35
+ | "Polygon"
36
+ | "Enum";
37
+
38
+ /**
39
+ * Default value types supported by Baasix
40
+ */
41
+ export type DefaultValueType =
42
+ | { type: "UUIDV4" }
43
+ | { type: "SUID" }
44
+ | { type: "NOW" }
45
+ | { type: "AUTOINCREMENT" }
46
+ | { type: "SQL"; value: string }
47
+ | { type: "CURRENT_USER" }
48
+ | { type: "CURRENT_TENANT" };
49
+
50
+ /**
51
+ * Field validation rules
52
+ */
53
+ export interface FieldValidationRules {
54
+ /** Minimum value for numeric fields */
55
+ min?: number;
56
+ /** Maximum value for numeric fields */
57
+ max?: number;
58
+ /** Validate as integer */
59
+ isInt?: boolean;
60
+ /** Validate email format */
61
+ isEmail?: boolean;
62
+ /** Validate URL format */
63
+ isUrl?: boolean;
64
+ /** Validate IP address format */
65
+ isIP?: boolean;
66
+ /** Validate UUID format */
67
+ isUUID?: boolean;
68
+ /** String must not be empty */
69
+ notEmpty?: boolean;
70
+ /** String length range [min, max] */
71
+ len?: [number, number];
72
+ /** Pattern matching with regex */
73
+ is?: string;
74
+ /** Pattern matching with regex (alias for is) */
75
+ matches?: string;
76
+ /** @deprecated Use 'is' or 'matches' instead */
77
+ regex?: string;
78
+ }
79
+
80
+ /**
81
+ * Field values configuration (for type-specific options)
82
+ */
83
+ export interface FieldValues {
84
+ /** String length (varchar) */
85
+ length?: number;
86
+ /** String length (alias for length) */
87
+ stringLength?: number;
88
+ /** Decimal precision */
89
+ precision?: number;
90
+ /** Decimal scale */
91
+ scale?: number;
92
+ /** Array element type */
93
+ type?: string;
94
+ /** Enum values */
95
+ values?: string[];
96
+ /** Spatial reference system identifier (for geometry types) */
97
+ srid?: number;
98
+ /** Vector dimensions (for pgvector types: Vector, HalfVec, SparseVec) */
99
+ dimensions?: number;
100
+ }
101
+
102
+ /**
103
+ * Field definition
104
+ * Note: `type` is optional because relation fields use `relType` instead
105
+ */
106
+ export interface FieldDefinition {
107
+ /** Field type (required for data fields, not used for relation fields) */
108
+ type?: FieldType | string;
109
+ primaryKey?: boolean;
110
+ allowNull?: boolean;
111
+ unique?: boolean;
112
+ /**
113
+ * Default value for the field
114
+ * Can be a static value or a dynamic type
115
+ */
116
+ defaultValue?: DefaultValueType | string | number | boolean | null | unknown[] | Record<string, unknown>;
117
+ /** Field values configuration (for type-specific options like length, precision, enum values) */
118
+ values?: FieldValues;
119
+ validate?: FieldValidationRules;
120
+ comment?: string;
121
+ /** Field description for documentation */
122
+ description?: string;
123
+ /** Relation type (if this is a relation field) */
124
+ relType?: RelationshipType | string;
125
+ /** Target collection for relations */
126
+ target?: string;
127
+ /** Alias for relation (used in queries) */
128
+ as?: string;
129
+ /** Display format for relations */
130
+ showAs?: string;
131
+ /** Foreign key field name or boolean indicating it's a foreign key */
132
+ foreignKey?: string | boolean;
133
+ /** Target key for relations */
134
+ targetKey?: string;
135
+ /** Junction table name for M2M (or junction config object) */
136
+ through?: string | Record<string, unknown>;
137
+ /** Other key in junction table */
138
+ otherKey?: string;
139
+ /** Display format string */
140
+ displayFormat?: string;
141
+ /** Display options */
142
+ displayOptions?: Record<string, unknown>;
143
+ /** Calculated field expression */
144
+ calculated?: string;
145
+ /** Hide field from API responses */
146
+ hidden?: boolean;
147
+ /** Mark field as system-generated (not user-editable) */
148
+ SystemGenerated?: string | boolean;
149
+ /** Whether to add constraints */
150
+ constraints?: boolean;
151
+ /** Delete behavior for relations */
152
+ onDelete?: "CASCADE" | "RESTRICT" | "SET NULL" | string;
153
+ /** Update behavior for relations */
154
+ onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL" | string;
155
+ /** Whether this is a polymorphic relation (M2A) */
156
+ polymorphic?: boolean;
157
+ /** Target tables for polymorphic (M2A) relations */
158
+ tables?: string[];
159
+ }
160
+
161
+ /**
162
+ * Flattened field info (used in core services)
163
+ */
164
+ export interface FlattenedField {
165
+ name: string;
166
+ type: FieldType;
167
+ allowNull?: boolean;
168
+ unique?: boolean;
169
+ primaryKey?: boolean;
170
+ defaultValue?: unknown;
171
+ validate?: FieldValidationRules;
172
+ relType?: RelationshipType;
173
+ target?: string;
174
+ }
175
+
176
+ /**
177
+ * Field info with full metadata
178
+ */
179
+ export interface FieldInfo extends FlattenedField {
180
+ path: string;
181
+ isRelation: boolean;
182
+ isNested: boolean;
183
+ }
184
+
185
+ // ============================================================================
186
+ // Schema Types
187
+ // ============================================================================
188
+
189
+ /**
190
+ * Index definition
191
+ */
192
+ export interface IndexDefinition {
193
+ /** Index name (auto-generated if not provided) */
194
+ name?: string;
195
+ fields: string[];
196
+ unique?: boolean;
197
+ /** When true, NULL values are considered equal for unique indexes (PostgreSQL 15+) */
198
+ nullsNotDistinct?: boolean;
199
+ type?: "btree" | "hash" | "gin" | "gist";
200
+ }
201
+
202
+ /**
203
+ * Partitioning options
204
+ */
205
+ export interface PartitioningOptions {
206
+ /** Partitioning strategy: LIST by tenant, RANGE by time, or composite */
207
+ strategy: "tenant" | "time" | "tenant+time";
208
+ /** DateTime field used for RANGE partitioning (default "createdAt") */
209
+ timeField?: string;
210
+ /** Time partition width (default "year") */
211
+ interval?: "month" | "quarter" | "year";
212
+ /** Future periods to pre-create (default 1) */
213
+ premake?: number;
214
+ }
215
+
216
+ /**
217
+ * Schema definition
218
+ */
219
+ export interface SchemaDefinition {
220
+ name: string;
221
+ timestamps?: boolean;
222
+ paranoid?: boolean;
223
+ sortEnabled?: boolean;
224
+ /**
225
+ * Controls tenant context enforcement for this collection.
226
+ * - true: enforce tenant scoping
227
+ * - false: global/shared collection (no tenant enforcement)
228
+ * - undefined: use default runtime behavior
229
+ */
230
+ tenantScoped?: boolean;
231
+ /** Partitioning configuration for this collection */
232
+ partitioning?: PartitioningOptions;
233
+ /**
234
+ * Track user who created/updated records (adds createdBy_Id, updatedBy_Id)
235
+ */
236
+ usertrack?: boolean;
237
+ /**
238
+ * True for M2M/M2A junction tables (system-generated)
239
+ */
240
+ isJunction?: boolean;
241
+ fields: Record<string, FieldDefinition>;
242
+ indexes?: IndexDefinition[];
243
+ }
244
+
245
+ /**
246
+ * Schema info (full schema with collection name)
247
+ */
248
+ export interface SchemaInfo {
249
+ collectionName: string;
250
+ schema: SchemaDefinition;
251
+ relationships?: RelationshipDefinition[];
252
+ }
253
+
254
+ /**
255
+ * Validation result (generic base)
256
+ */
257
+ export interface ValidationResult {
258
+ valid: boolean;
259
+ errors: string[];
260
+ warnings: string[];
261
+ }
262
+
263
+ /**
264
+ * Field validation result
265
+ */
266
+ export interface FieldValidation extends ValidationResult {
267
+ fieldName: string;
268
+ }
269
+
270
+ /**
271
+ * Schema validation result
272
+ */
273
+ export interface SchemaValidation extends ValidationResult {
274
+ collectionName: string;
275
+ fieldValidations?: FieldValidation[];
276
+ }
277
+
278
+ // ============================================================================
279
+ // Relationship Types
280
+ // ============================================================================
281
+
282
+ /**
283
+ * Relationship types
284
+ * - M2O: Many-to-One (creates foreign key with auto-index)
285
+ * - O2M: One-to-Many (virtual reverse of M2O)
286
+ * - O2O: One-to-One (creates foreign key with unique constraint)
287
+ * - M2M: Many-to-Many (creates junction table)
288
+ * - M2A: Many-to-Any (polymorphic junction table)
289
+ *
290
+ * Legacy aliases (deprecated, use M2O/O2M/M2M/O2O instead):
291
+ * - BelongsTo: alias for M2O
292
+ * - HasMany: alias for O2M
293
+ * - HasOne: alias for O2O
294
+ * - BelongsToMany: alias for M2M
295
+ */
296
+ export type RelationshipType =
297
+ | "M2O"
298
+ | "O2M"
299
+ | "M2M"
300
+ | "M2A"
301
+ | "O2O"
302
+ // Legacy aliases for backward compatibility
303
+ | "BelongsTo"
304
+ | "HasMany"
305
+ | "HasOne"
306
+ | "BelongsToMany";
307
+
308
+ /**
309
+ * Association type (alias for RelationshipType)
310
+ */
311
+ export type AssociationType = RelationshipType;
312
+
313
+ /**
314
+ * Relationship definition
315
+ */
316
+ export interface RelationshipDefinition {
317
+ type: RelationshipType;
318
+ target: string;
319
+ name: string;
320
+ alias?: string;
321
+ /**
322
+ * Custom junction table name for M2M/M2A relationships
323
+ */
324
+ through?: string;
325
+ onDelete?: "CASCADE" | "RESTRICT" | "SET NULL";
326
+ onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL";
327
+ /** Target tables for M2A (polymorphic) relationships */
328
+ tables?: string[];
329
+ }
330
+
331
+ /**
332
+ * Association definition (used internally in core)
333
+ */
334
+ export interface AssociationDefinition {
335
+ type: AssociationType;
336
+ foreignKey?: string;
337
+ sourceKey?: string;
338
+ targetKey?: string;
339
+ through?: string;
340
+ as?: string;
341
+ target: string;
342
+ onDelete?: "CASCADE" | "RESTRICT" | "SET NULL";
343
+ onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL";
344
+ }
345
+
346
+ /**
347
+ * Include configuration for relation fetching
348
+ */
349
+ export interface IncludeConfig {
350
+ model: string;
351
+ as?: string;
352
+ attributes?: string[];
353
+ where?: Record<string, unknown>;
354
+ required?: boolean;
355
+ include?: IncludeConfig[];
356
+ }
357
+
358
+ /**
359
+ * Processed include (after parsing)
360
+ */
361
+ export interface ProcessedInclude {
362
+ association: string;
363
+ as: string;
364
+ attributes?: string[];
365
+ where?: Record<string, unknown>;
366
+ required?: boolean;
367
+ include?: ProcessedInclude[];
368
+ }