Skip to content

Commit c4ee20a

Browse files
authored
chore: regenerate ts schemas (#583)
1 parent 9033211 commit c4ee20a

File tree

10 files changed

+452
-330
lines changed

10 files changed

+452
-330
lines changed

samples/sveltekit/src/zenstack/input.ts

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,18 @@
66
/* eslint-disable */
77

88
import { type SchemaType as $Schema } from "./schema-lite";
9-
import type {
10-
FindManyArgs as $FindManyArgs,
11-
FindUniqueArgs as $FindUniqueArgs,
12-
FindFirstArgs as $FindFirstArgs,
13-
ExistsArgs as $ExistsArgs,
14-
CreateArgs as $CreateArgs,
15-
CreateManyArgs as $CreateManyArgs,
16-
CreateManyAndReturnArgs as $CreateManyAndReturnArgs,
17-
UpdateArgs as $UpdateArgs,
18-
UpdateManyArgs as $UpdateManyArgs,
19-
UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs,
20-
UpsertArgs as $UpsertArgs,
21-
DeleteArgs as $DeleteArgs,
22-
DeleteManyArgs as $DeleteManyArgs,
23-
CountArgs as $CountArgs,
24-
AggregateArgs as $AggregateArgs,
25-
GroupByArgs as $GroupByArgs,
26-
WhereInput as $WhereInput,
27-
SelectInput as $SelectInput,
28-
IncludeInput as $IncludeInput,
29-
OmitInput as $OmitInput,
30-
QueryOptions as $QueryOptions,
31-
} from "@zenstackhq/orm";
32-
import type {
33-
SimplifiedPlainResult as $Result,
34-
SelectIncludeOmit as $SelectIncludeOmit,
35-
} from "@zenstackhq/orm";
9+
import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, ExistsArgs as $ExistsArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, QueryOptions as $QueryOptions } from "@zenstackhq/orm";
10+
import type { SimplifiedPlainResult as $Result, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm";
3611
export type UserFindManyArgs = $FindManyArgs<$Schema, "User">;
3712
export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">;
3813
export type UserFindFirstArgs = $FindFirstArgs<$Schema, "User">;
3914
export type UserExistsArgs = $ExistsArgs<$Schema, "User">;
4015
export type UserCreateArgs = $CreateArgs<$Schema, "User">;
4116
export type UserCreateManyArgs = $CreateManyArgs<$Schema, "User">;
42-
export type UserCreateManyAndReturnArgs = $CreateManyAndReturnArgs<
43-
$Schema,
44-
"User"
45-
>;
17+
export type UserCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "User">;
4618
export type UserUpdateArgs = $UpdateArgs<$Schema, "User">;
4719
export type UserUpdateManyArgs = $UpdateManyArgs<$Schema, "User">;
48-
export type UserUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<
49-
$Schema,
50-
"User"
51-
>;
20+
export type UserUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "User">;
5221
export type UserUpsertArgs = $UpsertArgs<$Schema, "User">;
5322
export type UserDeleteArgs = $DeleteArgs<$Schema, "User">;
5423
export type UserDeleteManyArgs = $DeleteManyArgs<$Schema, "User">;
@@ -59,26 +28,17 @@ export type UserWhereInput = $WhereInput<$Schema, "User">;
5928
export type UserSelect = $SelectInput<$Schema, "User">;
6029
export type UserInclude = $IncludeInput<$Schema, "User">;
6130
export type UserOmit = $OmitInput<$Schema, "User">;
62-
export type UserGetPayload<
63-
Args extends $SelectIncludeOmit<$Schema, "User", true>,
64-
Options extends $QueryOptions<$Schema> = $QueryOptions<$Schema>,
65-
> = $Result<$Schema, "User", Args, Options>;
31+
export type UserGetPayload<Args extends $SelectIncludeOmit<$Schema, "User", true>, Options extends $QueryOptions<$Schema> = $QueryOptions<$Schema>> = $Result<$Schema, "User", Args, Options>;
6632
export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">;
6733
export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">;
6834
export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">;
6935
export type PostExistsArgs = $ExistsArgs<$Schema, "Post">;
7036
export type PostCreateArgs = $CreateArgs<$Schema, "Post">;
7137
export type PostCreateManyArgs = $CreateManyArgs<$Schema, "Post">;
72-
export type PostCreateManyAndReturnArgs = $CreateManyAndReturnArgs<
73-
$Schema,
74-
"Post"
75-
>;
38+
export type PostCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "Post">;
7639
export type PostUpdateArgs = $UpdateArgs<$Schema, "Post">;
7740
export type PostUpdateManyArgs = $UpdateManyArgs<$Schema, "Post">;
78-
export type PostUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<
79-
$Schema,
80-
"Post"
81-
>;
41+
export type PostUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "Post">;
8242
export type PostUpsertArgs = $UpsertArgs<$Schema, "Post">;
8343
export type PostDeleteArgs = $DeleteArgs<$Schema, "Post">;
8444
export type PostDeleteManyArgs = $DeleteManyArgs<$Schema, "Post">;
@@ -89,7 +49,4 @@ export type PostWhereInput = $WhereInput<$Schema, "Post">;
8949
export type PostSelect = $SelectInput<$Schema, "Post">;
9050
export type PostInclude = $IncludeInput<$Schema, "Post">;
9151
export type PostOmit = $OmitInput<$Schema, "Post">;
92-
export type PostGetPayload<
93-
Args extends $SelectIncludeOmit<$Schema, "Post", true>,
94-
Options extends $QueryOptions<$Schema> = $QueryOptions<$Schema>,
95-
> = $Result<$Schema, "Post", Args, Options>;
52+
export type PostGetPayload<Args extends $SelectIncludeOmit<$Schema, "Post", true>, Options extends $QueryOptions<$Schema> = $QueryOptions<$Schema>> = $Result<$Schema, "Post", Args, Options>;

samples/sveltekit/src/zenstack/schema-lite.ts

Lines changed: 107 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -7,118 +7,114 @@
77

88
import { type SchemaDef, ExpressionUtils } from "@zenstackhq/orm/schema";
99
export class SchemaType implements SchemaDef {
10-
provider = {
11-
type: "sqlite",
12-
} as const;
13-
models = {
14-
User: {
15-
name: "User",
16-
fields: {
17-
id: {
18-
name: "id",
19-
type: "String",
20-
id: true,
21-
default: ExpressionUtils.call("cuid"),
10+
provider = {
11+
type: "sqlite"
12+
} as const;
13+
models = {
14+
User: {
15+
name: "User",
16+
fields: {
17+
id: {
18+
name: "id",
19+
type: "String",
20+
id: true,
21+
default: ExpressionUtils.call("cuid")
22+
},
23+
createdAt: {
24+
name: "createdAt",
25+
type: "DateTime",
26+
default: ExpressionUtils.call("now")
27+
},
28+
updatedAt: {
29+
name: "updatedAt",
30+
type: "DateTime",
31+
updatedAt: true
32+
},
33+
email: {
34+
name: "email",
35+
type: "String",
36+
unique: true
37+
},
38+
name: {
39+
name: "name",
40+
type: "String",
41+
optional: true
42+
},
43+
posts: {
44+
name: "posts",
45+
type: "Post",
46+
array: true,
47+
relation: { opposite: "author" }
48+
}
49+
},
50+
idFields: ["id"],
51+
uniqueFields: {
52+
id: { type: "String" },
53+
email: { type: "String" }
54+
}
2255
},
23-
createdAt: {
24-
name: "createdAt",
25-
type: "DateTime",
26-
default: ExpressionUtils.call("now"),
56+
Post: {
57+
name: "Post",
58+
fields: {
59+
id: {
60+
name: "id",
61+
type: "String",
62+
id: true,
63+
default: ExpressionUtils.call("cuid")
64+
},
65+
createdAt: {
66+
name: "createdAt",
67+
type: "DateTime",
68+
default: ExpressionUtils.call("now")
69+
},
70+
updatedAt: {
71+
name: "updatedAt",
72+
type: "DateTime",
73+
updatedAt: true
74+
},
75+
title: {
76+
name: "title",
77+
type: "String"
78+
},
79+
published: {
80+
name: "published",
81+
type: "Boolean",
82+
default: false
83+
},
84+
author: {
85+
name: "author",
86+
type: "User",
87+
relation: { opposite: "posts", fields: ["authorId"], references: ["id"], onUpdate: "Cascade", onDelete: "Cascade" }
88+
},
89+
authorId: {
90+
name: "authorId",
91+
type: "String",
92+
foreignKeyFor: [
93+
"author"
94+
]
95+
}
96+
},
97+
idFields: ["id"],
98+
uniqueFields: {
99+
id: { type: "String" }
100+
}
101+
}
102+
} as const;
103+
authType = "User" as const;
104+
procedures = {
105+
signUp: {
106+
params: {
107+
email: { name: "email", type: "String" }
108+
},
109+
returnType: "User",
110+
mutation: true
27111
},
28-
updatedAt: {
29-
name: "updatedAt",
30-
type: "DateTime",
31-
updatedAt: true,
32-
},
33-
email: {
34-
name: "email",
35-
type: "String",
36-
unique: true,
37-
},
38-
name: {
39-
name: "name",
40-
type: "String",
41-
optional: true,
42-
},
43-
posts: {
44-
name: "posts",
45-
type: "Post",
46-
array: true,
47-
relation: { opposite: "author" },
48-
},
49-
},
50-
idFields: ["id"],
51-
uniqueFields: {
52-
id: { type: "String" },
53-
email: { type: "String" },
54-
},
55-
},
56-
Post: {
57-
name: "Post",
58-
fields: {
59-
id: {
60-
name: "id",
61-
type: "String",
62-
id: true,
63-
default: ExpressionUtils.call("cuid"),
64-
},
65-
createdAt: {
66-
name: "createdAt",
67-
type: "DateTime",
68-
default: ExpressionUtils.call("now"),
69-
},
70-
updatedAt: {
71-
name: "updatedAt",
72-
type: "DateTime",
73-
updatedAt: true,
74-
},
75-
title: {
76-
name: "title",
77-
type: "String",
78-
},
79-
published: {
80-
name: "published",
81-
type: "Boolean",
82-
default: false,
83-
},
84-
author: {
85-
name: "author",
86-
type: "User",
87-
relation: {
88-
opposite: "posts",
89-
fields: ["authorId"],
90-
references: ["id"],
91-
onUpdate: "Cascade",
92-
onDelete: "Cascade",
93-
},
94-
},
95-
authorId: {
96-
name: "authorId",
97-
type: "String",
98-
foreignKeyFor: ["author"],
99-
},
100-
},
101-
idFields: ["id"],
102-
uniqueFields: {
103-
id: { type: "String" },
104-
},
105-
},
106-
} as const;
107-
authType = "User" as const;
108-
procedures = {
109-
signUp: {
110-
params: {
111-
email: { name: "email", type: "String" },
112-
},
113-
returnType: "User",
114-
mutation: true,
115-
},
116-
listPublicPosts: {
117-
params: {},
118-
returnType: "Post",
119-
returnArray: true,
120-
},
121-
} as const;
122-
plugins = {};
112+
listPublicPosts: {
113+
params: {},
114+
returnType: "Post",
115+
returnArray: true
116+
}
117+
} as const;
118+
plugins = {};
123119
}
124120
export const schema = new SchemaType();

0 commit comments

Comments
 (0)