@stacksjs/types 0.70.93 → 0.70.95
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/model.d.ts +11 -0
- package/package.json +3 -3
package/dist/model.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export declare function defineModel<const T extends Model>(model: T): T;
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export declare function defineModels<const T extends Record<string, Model>>(models: T): T;
|
|
38
|
+
export declare interface ForeignKeyConfig {
|
|
39
|
+
table: string
|
|
40
|
+
column?: string
|
|
41
|
+
onDelete?: OnForeignKeyAction
|
|
42
|
+
onUpdate?: OnForeignKeyAction
|
|
43
|
+
nullable?: boolean
|
|
44
|
+
}
|
|
38
45
|
export declare interface BaseRelation {
|
|
39
46
|
foreignKey?: string
|
|
40
47
|
relationName?: string
|
|
@@ -196,6 +203,8 @@ export declare interface ModelOptions extends Base {
|
|
|
196
203
|
}
|
|
197
204
|
}
|
|
198
205
|
export declare interface Attribute {
|
|
206
|
+
required?: boolean
|
|
207
|
+
nullable?: boolean
|
|
199
208
|
type?: string
|
|
200
209
|
nullable?: boolean
|
|
201
210
|
default?: string | number | boolean | Date
|
|
@@ -204,6 +213,7 @@ export declare interface Attribute {
|
|
|
204
213
|
hidden?: boolean
|
|
205
214
|
fillable?: boolean
|
|
206
215
|
guarded?: boolean
|
|
216
|
+
foreignKey?: boolean | ForeignKeyConfig
|
|
207
217
|
factory?: (faker: Faker) => any
|
|
208
218
|
validation: {
|
|
209
219
|
rule: ValidationType
|
|
@@ -242,6 +252,7 @@ export declare interface RelationConfig {
|
|
|
242
252
|
* to generate the ORM classes, migrations, and API routes.
|
|
243
253
|
*/
|
|
244
254
|
export type Model = Partial<ModelOptions>;
|
|
255
|
+
export type OnForeignKeyAction = 'cascade' | 'set null' | 'restrict' | 'no action';
|
|
245
256
|
declare type ActionPath = string;
|
|
246
257
|
declare type ActionName = string;
|
|
247
258
|
declare type Action = ActionPath | ActionName | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/types",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.95",
|
|
5
5
|
"description": "The Stacks framework types.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@stacksjs/bunpress": "^0.1.12",
|
|
55
55
|
"@stacksjs/clapp": "^0.2.10",
|
|
56
56
|
"@stacksjs/ts-validation": "^0.5.0",
|
|
57
|
-
"bun-query-builder": "^0.1.
|
|
57
|
+
"bun-query-builder": "^0.1.52"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"meilisearch": "^0.59.0"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@stacksjs/validation": "0.70.
|
|
68
|
+
"@stacksjs/validation": "0.70.95",
|
|
69
69
|
"@types/bun": "^1.3.11",
|
|
70
70
|
"meilisearch": "^0.59.0",
|
|
71
71
|
"typescript": "^7.0.2"
|