88// included in the file licenses/APL.txt.
99
1010import { sendRequired , type UnaryClient } from "@synnaxlabs/freighter" ;
11- import { array , caseconv , record } from "@synnaxlabs/x" ;
11+ import { array } from "@synnaxlabs/x" ;
1212import { z } from "zod" ;
1313
1414import { symbol } from "@/schematic/symbol" ;
1515import {
1616 type Key ,
1717 keyZ ,
18+ type Legend ,
1819 type New ,
1920 newZ ,
2021 type Schematic ,
@@ -25,10 +26,9 @@ import { workspace } from "@/workspace";
2526
2627const renameReqZ = z . object ( { key : keyZ , name : z . string ( ) } ) ;
2728
28- const setDataReqZ = z . object ( {
29- key : keyZ ,
30- data : caseconv . preserveCase ( record . unknownZ ( ) ) ,
31- } ) ;
29+ const setDataBodyZ = schematicZ . omit ( { key : true , name : true , snapshot : true } ) ;
30+ export type SetDataBody = z . input < typeof setDataBodyZ > ;
31+ const setDataReqZ = z . object ( { key : keyZ , data : setDataBodyZ } ) ;
3232const deleteReqZ = z . object ( { keys : keyZ . array ( ) } ) ;
3333
3434const copyReqZ = z . object ( {
@@ -95,7 +95,7 @@ export class Client {
9595 ) ;
9696 }
9797
98- async setData ( key : Key , data : record . Unknown ) : Promise < void > {
98+ async setData ( key : Key , data : SetDataBody ) : Promise < void > {
9999 await sendRequired (
100100 this . client ,
101101 "/schematic/set-data" ,
@@ -143,3 +143,17 @@ export class Client {
143143 return res . schematic ;
144144 }
145145}
146+
147+ export const ZERO_LEGEND : Legend = {
148+ visible : true ,
149+ position : { x : 50 , y : 50 , units : { x : "px" , y : "px" } } ,
150+ colors : { } ,
151+ } ;
152+
153+ export const ZERO_NEW : New = {
154+ name : "" ,
155+ legend : ZERO_LEGEND ,
156+ nodes : [ ] ,
157+ edges : [ ] ,
158+ configs : { } ,
159+ } ;
0 commit comments