Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 4d221dd

Browse files
committed
WIP: more aggressive caching of validation zod schemas
1 parent 8fdd349 commit 4d221dd

16 files changed

Lines changed: 1668 additions & 1117 deletions

File tree

packages/orm/src/client/crud/validator/index.ts

Lines changed: 1541 additions & 1115 deletions
Large diffs are not rendered by default.

packages/schema/src/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export type EnumField = {
106106
};
107107

108108
export type EnumDef = {
109+
name: string;
109110
fields?: Record<string, EnumField>;
110111
values: Record<string, string>;
111112
attributes?: readonly AttributeApplication[];

packages/sdk/src/ts-schema-generator.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,8 @@ export class TsSchemaGenerator {
10301030
private createEnumObject(e: Enum) {
10311031
return ts.factory.createObjectLiteralExpression(
10321032
[
1033+
ts.factory.createPropertyAssignment('name', ts.factory.createStringLiteral(e.name)),
1034+
10331035
ts.factory.createPropertyAssignment(
10341036
'values',
10351037
ts.factory.createObjectLiteralExpression(

pnpm-lock.yaml

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/orm/zenstack/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ export class SchemaType implements SchemaDef {
232232
} as const;
233233
enums = {
234234
Role: {
235+
name: "Role",
235236
values: {
236237
ADMIN: "ADMIN",
237238
USER: "USER"

tests/e2e/apps/rally/zenstack/schema.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,6 +2391,7 @@ export class SchemaType implements SchemaDef {
23912391
} as const;
23922392
enums = {
23932393
TimeFormat: {
2394+
name: "TimeFormat",
23942395
values: {
23952396
hours12: "hours12",
23962397
hours24: "hours24"
@@ -2400,6 +2401,7 @@ export class SchemaType implements SchemaDef {
24002401
]
24012402
},
24022403
UserRole: {
2404+
name: "UserRole",
24032405
values: {
24042406
admin: "admin",
24052407
user: "user"
@@ -2409,6 +2411,7 @@ export class SchemaType implements SchemaDef {
24092411
]
24102412
},
24112413
ParticipantVisibility: {
2414+
name: "ParticipantVisibility",
24122415
values: {
24132416
full: "full",
24142417
scoresOnly: "scoresOnly",
@@ -2419,6 +2422,7 @@ export class SchemaType implements SchemaDef {
24192422
]
24202423
},
24212424
PollStatus: {
2425+
name: "PollStatus",
24222426
values: {
24232427
live: "live",
24242428
paused: "paused",
@@ -2429,6 +2433,7 @@ export class SchemaType implements SchemaDef {
24292433
]
24302434
},
24312435
VoteType: {
2436+
name: "VoteType",
24322437
values: {
24332438
yes: "yes",
24342439
no: "no",
@@ -2439,12 +2444,14 @@ export class SchemaType implements SchemaDef {
24392444
]
24402445
},
24412446
SpaceMemberRole: {
2447+
name: "SpaceMemberRole",
24422448
values: {
24432449
ADMIN: "ADMIN",
24442450
MEMBER: "MEMBER"
24452451
}
24462452
},
24472453
SpaceTier: {
2454+
name: "SpaceTier",
24482455
values: {
24492456
hobby: "hobby",
24502457
pro: "pro"
@@ -2454,6 +2461,7 @@ export class SchemaType implements SchemaDef {
24542461
]
24552462
},
24562463
SubscriptionStatus: {
2464+
name: "SubscriptionStatus",
24572465
values: {
24582466
incomplete: "incomplete",
24592467
incomplete_expired: "incomplete_expired",
@@ -2469,6 +2477,7 @@ export class SchemaType implements SchemaDef {
24692477
]
24702478
},
24712479
SubscriptionInterval: {
2480+
name: "SubscriptionInterval",
24722481
values: {
24732482
month: "month",
24742483
year: "year"
@@ -2478,6 +2487,7 @@ export class SchemaType implements SchemaDef {
24782487
]
24792488
},
24802489
ScheduledEventStatus: {
2490+
name: "ScheduledEventStatus",
24812491
values: {
24822492
confirmed: "confirmed",
24832493
canceled: "canceled",
@@ -2488,6 +2498,7 @@ export class SchemaType implements SchemaDef {
24882498
]
24892499
},
24902500
ScheduledEventInviteStatus: {
2501+
name: "ScheduledEventInviteStatus",
24912502
values: {
24922503
pending: "pending",
24932504
accepted: "accepted",
@@ -2499,18 +2510,21 @@ export class SchemaType implements SchemaDef {
24992510
]
25002511
},
25012512
CredentialType: {
2513+
name: "CredentialType",
25022514
values: {
25032515
OAUTH: "OAUTH"
25042516
}
25052517
},
25062518
LicenseType: {
2519+
name: "LicenseType",
25072520
values: {
25082521
PLUS: "PLUS",
25092522
ORGANIZATION: "ORGANIZATION",
25102523
ENTERPRISE: "ENTERPRISE"
25112524
}
25122525
},
25132526
LicenseStatus: {
2527+
name: "LicenseStatus",
25142528
values: {
25152529
ACTIVE: "ACTIVE",
25162530
REVOKED: "REVOKED"

0 commit comments

Comments
 (0)