mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 08:53:13 +00:00
fix(studio): the book tools state every field once, and the server typechecks within its memory again
- The element, spread, document, page operation and card unions carry a name of their own, so the declarations of every schema that holds them refer to them instead of spelling them out again. The shared declarations shrink from 9 to 5.5 MB and the server's typecheck from 4.4 to 2.9 GB, so the build fits the image's 4 GB again. - edit_book_page and revise_book_design take add by what the element is, with an id of its own; its look follows with style by that id in the same call, every look field described once. A change an assistant card kept with its look on add still reads and runs. - restore_book_page states what every element has once, then each kind's own fields and the type the five travel kinds share, without defaults; the page is read as a spread again before it goes back. - The theme links are explained once in the page edit's description, and style points a text's face, a shape's paint and outline and a photo's crop look at their one full description. - The lockup roles live in a module of their own, so the operation schemas no longer import the lockup engine, whose cycle left the operations unset in the shared tests. - The theme switches no longer fall through a comment, the newer document test follows the current revision, the line inspector names its stroke keys, a text's anchor reads no physical side, two shapes record the proportions they are drawn at, and the photo look and line tests follow the slider and the folded ornaments.
This commit is contained in:
@@ -36,7 +36,7 @@ export * from './vacay.contract';
|
||||
* `<pkg>.contract.ts`; the server builds every card from the tool's own
|
||||
* answer and checks it against this union before it is sent.
|
||||
*/
|
||||
export const trekCardSchema = z.discriminatedUnion('kind', [
|
||||
const trekCardUnion = z.discriminatedUnion('kind', [
|
||||
...TOUR_CARD_SCHEMAS,
|
||||
...ROADTRIP_CARD_SCHEMAS,
|
||||
...BUDGET_CARD_SCHEMAS,
|
||||
@@ -51,6 +51,17 @@ export const trekCardSchema = z.discriminatedUnion('kind', [
|
||||
...BOOK_DESIGN_CARD_SCHEMAS,
|
||||
...HOME_CARD_SCHEMAS,
|
||||
]);
|
||||
type TrekCardUnion = typeof trekCardUnion;
|
||||
/**
|
||||
* The card union under a name of its own: the message, part and thread
|
||||
* schemas that hold cards then refer to it instead of spelling out every kind
|
||||
* again, which made the server's typecheck run out of memory. The one member
|
||||
* keeps the interface from being empty; it is the union's own.
|
||||
*/
|
||||
export interface TrekCardSchema extends TrekCardUnion {
|
||||
readonly options: TrekCardUnion['options'];
|
||||
}
|
||||
export const trekCardSchema: TrekCardSchema = trekCardUnion;
|
||||
export type TrekCard = z.infer<typeof trekCardSchema>;
|
||||
export type TrekCardKind = TrekCard['kind'];
|
||||
export type TrekCardOf<K extends TrekCardKind> = Extract<TrekCard, { kind: K }>;
|
||||
|
||||
Reference in New Issue
Block a user