@valbuild/shared 0.63.5 → 0.64.0

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.
@@ -0,0 +1,1981 @@
1
+ import { z } from "zod";
2
+ import { type ModuleFilePath, type PatchId } from "@valbuild/core";
3
+ declare const PatchId: z.ZodEffects<z.ZodString, PatchId, string>;
4
+ declare const ModuleFilePath: z.ZodEffects<z.ZodString, ModuleFilePath, string>;
5
+ declare const cookies: z.ZodUnion<[z.ZodLiteral<"val_session">, z.ZodLiteral<"val_enable">, z.ZodLiteral<"val_state">]>;
6
+ type Cookies = z.infer<typeof cookies>;
7
+ declare const enableCookieValue: z.ZodObject<{
8
+ value: z.ZodLiteral<"true">;
9
+ options: z.ZodObject<{
10
+ httpOnly: z.ZodLiteral<false>;
11
+ sameSite: z.ZodLiteral<"lax">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ httpOnly: false;
14
+ sameSite: "lax";
15
+ }, {
16
+ httpOnly: false;
17
+ sameSite: "lax";
18
+ }>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ value: "true";
21
+ options: {
22
+ httpOnly: false;
23
+ sameSite: "lax";
24
+ };
25
+ }, {
26
+ value: "true";
27
+ options: {
28
+ httpOnly: false;
29
+ sameSite: "lax";
30
+ };
31
+ }>;
32
+ type EnableCookieValue = z.infer<typeof enableCookieValue>;
33
+ type CookieValue = EnableCookieValue | {
34
+ value: "false" | string | null;
35
+ options?: {
36
+ httpOnly: boolean;
37
+ sameSite: "lax" | "strict";
38
+ expires: Date;
39
+ };
40
+ };
41
+ export declare const Api: {
42
+ "/enable": {
43
+ GET: {
44
+ req: {
45
+ query: {
46
+ redirect_to: z.ZodOptional<z.ZodString>;
47
+ };
48
+ };
49
+ res: z.ZodUnion<[z.ZodObject<{
50
+ status: z.ZodLiteral<302>;
51
+ redirectTo: z.ZodString;
52
+ cookies: z.ZodObject<{
53
+ val_enable: z.ZodObject<{
54
+ value: z.ZodLiteral<"true">;
55
+ options: z.ZodObject<{
56
+ httpOnly: z.ZodLiteral<false>;
57
+ sameSite: z.ZodLiteral<"lax">;
58
+ }, "strip", z.ZodTypeAny, {
59
+ httpOnly: false;
60
+ sameSite: "lax";
61
+ }, {
62
+ httpOnly: false;
63
+ sameSite: "lax";
64
+ }>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ value: "true";
67
+ options: {
68
+ httpOnly: false;
69
+ sameSite: "lax";
70
+ };
71
+ }, {
72
+ value: "true";
73
+ options: {
74
+ httpOnly: false;
75
+ sameSite: "lax";
76
+ };
77
+ }>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ val_enable: {
80
+ value: "true";
81
+ options: {
82
+ httpOnly: false;
83
+ sameSite: "lax";
84
+ };
85
+ };
86
+ }, {
87
+ val_enable: {
88
+ value: "true";
89
+ options: {
90
+ httpOnly: false;
91
+ sameSite: "lax";
92
+ };
93
+ };
94
+ }>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ status: 302;
97
+ redirectTo: string;
98
+ cookies: {
99
+ val_enable: {
100
+ value: "true";
101
+ options: {
102
+ httpOnly: false;
103
+ sameSite: "lax";
104
+ };
105
+ };
106
+ };
107
+ }, {
108
+ status: 302;
109
+ redirectTo: string;
110
+ cookies: {
111
+ val_enable: {
112
+ value: "true";
113
+ options: {
114
+ httpOnly: false;
115
+ sameSite: "lax";
116
+ };
117
+ };
118
+ };
119
+ }>, z.ZodObject<{
120
+ status: z.ZodLiteral<400>;
121
+ json: z.ZodObject<{
122
+ message: z.ZodString;
123
+ }, "strip", z.ZodTypeAny, {
124
+ message: string;
125
+ }, {
126
+ message: string;
127
+ }>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ status: 400;
130
+ json: {
131
+ message: string;
132
+ };
133
+ }, {
134
+ status: 400;
135
+ json: {
136
+ message: string;
137
+ };
138
+ }>]>;
139
+ };
140
+ };
141
+ "/disable": {
142
+ GET: {
143
+ req: {
144
+ query: {
145
+ redirect_to: z.ZodOptional<z.ZodString>;
146
+ };
147
+ };
148
+ res: z.ZodUnion<[z.ZodObject<{
149
+ status: z.ZodLiteral<302>;
150
+ redirectTo: z.ZodString;
151
+ cookies: z.ZodObject<{
152
+ val_enable: z.ZodObject<{
153
+ value: z.ZodLiteral<"false">;
154
+ }, "strip", z.ZodTypeAny, {
155
+ value: "false";
156
+ }, {
157
+ value: "false";
158
+ }>;
159
+ }, "strip", z.ZodTypeAny, {
160
+ val_enable: {
161
+ value: "false";
162
+ };
163
+ }, {
164
+ val_enable: {
165
+ value: "false";
166
+ };
167
+ }>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ status: 302;
170
+ redirectTo: string;
171
+ cookies: {
172
+ val_enable: {
173
+ value: "false";
174
+ };
175
+ };
176
+ }, {
177
+ status: 302;
178
+ redirectTo: string;
179
+ cookies: {
180
+ val_enable: {
181
+ value: "false";
182
+ };
183
+ };
184
+ }>, z.ZodObject<{
185
+ status: z.ZodLiteral<400>;
186
+ json: z.ZodObject<{
187
+ message: z.ZodString;
188
+ }, "strip", z.ZodTypeAny, {
189
+ message: string;
190
+ }, {
191
+ message: string;
192
+ }>;
193
+ }, "strip", z.ZodTypeAny, {
194
+ status: 400;
195
+ json: {
196
+ message: string;
197
+ };
198
+ }, {
199
+ status: 400;
200
+ json: {
201
+ message: string;
202
+ };
203
+ }>]>;
204
+ };
205
+ };
206
+ "/authorize": {
207
+ GET: {
208
+ req: {
209
+ query: {
210
+ redirect_to: z.ZodOptional<z.ZodString>;
211
+ };
212
+ };
213
+ res: z.ZodUnion<[z.ZodObject<{
214
+ status: z.ZodLiteral<302>;
215
+ redirectTo: z.ZodString;
216
+ cookies: z.ZodObject<{
217
+ val_enable: z.ZodObject<{
218
+ value: z.ZodLiteral<"true">;
219
+ options: z.ZodObject<{
220
+ httpOnly: z.ZodLiteral<false>;
221
+ sameSite: z.ZodLiteral<"lax">;
222
+ }, "strip", z.ZodTypeAny, {
223
+ httpOnly: false;
224
+ sameSite: "lax";
225
+ }, {
226
+ httpOnly: false;
227
+ sameSite: "lax";
228
+ }>;
229
+ }, "strip", z.ZodTypeAny, {
230
+ value: "true";
231
+ options: {
232
+ httpOnly: false;
233
+ sameSite: "lax";
234
+ };
235
+ }, {
236
+ value: "true";
237
+ options: {
238
+ httpOnly: false;
239
+ sameSite: "lax";
240
+ };
241
+ }>;
242
+ val_state: z.ZodObject<{
243
+ value: z.ZodString;
244
+ options: z.ZodObject<{
245
+ httpOnly: z.ZodLiteral<true>;
246
+ sameSite: z.ZodLiteral<"lax">;
247
+ expires: z.ZodType<Date, z.ZodTypeDef, Date>;
248
+ }, "strip", z.ZodTypeAny, {
249
+ httpOnly: true;
250
+ sameSite: "lax";
251
+ expires: Date;
252
+ }, {
253
+ httpOnly: true;
254
+ sameSite: "lax";
255
+ expires: Date;
256
+ }>;
257
+ }, "strip", z.ZodTypeAny, {
258
+ value: string;
259
+ options: {
260
+ httpOnly: true;
261
+ sameSite: "lax";
262
+ expires: Date;
263
+ };
264
+ }, {
265
+ value: string;
266
+ options: {
267
+ httpOnly: true;
268
+ sameSite: "lax";
269
+ expires: Date;
270
+ };
271
+ }>;
272
+ }, "strip", z.ZodTypeAny, {
273
+ val_enable: {
274
+ value: "true";
275
+ options: {
276
+ httpOnly: false;
277
+ sameSite: "lax";
278
+ };
279
+ };
280
+ val_state: {
281
+ value: string;
282
+ options: {
283
+ httpOnly: true;
284
+ sameSite: "lax";
285
+ expires: Date;
286
+ };
287
+ };
288
+ }, {
289
+ val_enable: {
290
+ value: "true";
291
+ options: {
292
+ httpOnly: false;
293
+ sameSite: "lax";
294
+ };
295
+ };
296
+ val_state: {
297
+ value: string;
298
+ options: {
299
+ httpOnly: true;
300
+ sameSite: "lax";
301
+ expires: Date;
302
+ };
303
+ };
304
+ }>;
305
+ }, "strip", z.ZodTypeAny, {
306
+ status: 302;
307
+ redirectTo: string;
308
+ cookies: {
309
+ val_enable: {
310
+ value: "true";
311
+ options: {
312
+ httpOnly: false;
313
+ sameSite: "lax";
314
+ };
315
+ };
316
+ val_state: {
317
+ value: string;
318
+ options: {
319
+ httpOnly: true;
320
+ sameSite: "lax";
321
+ expires: Date;
322
+ };
323
+ };
324
+ };
325
+ }, {
326
+ status: 302;
327
+ redirectTo: string;
328
+ cookies: {
329
+ val_enable: {
330
+ value: "true";
331
+ options: {
332
+ httpOnly: false;
333
+ sameSite: "lax";
334
+ };
335
+ };
336
+ val_state: {
337
+ value: string;
338
+ options: {
339
+ httpOnly: true;
340
+ sameSite: "lax";
341
+ expires: Date;
342
+ };
343
+ };
344
+ };
345
+ }>, z.ZodObject<{
346
+ status: z.ZodLiteral<400>;
347
+ json: z.ZodObject<{
348
+ message: z.ZodString;
349
+ }, "strip", z.ZodTypeAny, {
350
+ message: string;
351
+ }, {
352
+ message: string;
353
+ }>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ status: 400;
356
+ json: {
357
+ message: string;
358
+ };
359
+ }, {
360
+ status: 400;
361
+ json: {
362
+ message: string;
363
+ };
364
+ }>]>;
365
+ };
366
+ };
367
+ "/callback": {
368
+ GET: {
369
+ req: {
370
+ query: {
371
+ code: z.ZodOptional<z.ZodString>;
372
+ state: z.ZodOptional<z.ZodString>;
373
+ };
374
+ cookies: {
375
+ val_state: z.ZodString;
376
+ };
377
+ };
378
+ res: z.ZodObject<{
379
+ status: z.ZodLiteral<302>;
380
+ redirectTo: z.ZodString;
381
+ cookies: z.ZodObject<{
382
+ val_state: z.ZodObject<{
383
+ value: z.ZodLiteral<null>;
384
+ }, "strip", z.ZodTypeAny, {
385
+ value: null;
386
+ }, {
387
+ value: null;
388
+ }>;
389
+ val_enable: z.ZodOptional<z.ZodObject<{
390
+ value: z.ZodLiteral<"true">;
391
+ options: z.ZodObject<{
392
+ httpOnly: z.ZodLiteral<false>;
393
+ sameSite: z.ZodLiteral<"lax">;
394
+ }, "strip", z.ZodTypeAny, {
395
+ httpOnly: false;
396
+ sameSite: "lax";
397
+ }, {
398
+ httpOnly: false;
399
+ sameSite: "lax";
400
+ }>;
401
+ }, "strip", z.ZodTypeAny, {
402
+ value: "true";
403
+ options: {
404
+ httpOnly: false;
405
+ sameSite: "lax";
406
+ };
407
+ }, {
408
+ value: "true";
409
+ options: {
410
+ httpOnly: false;
411
+ sameSite: "lax";
412
+ };
413
+ }>>;
414
+ val_session: z.ZodOptional<z.ZodObject<{
415
+ value: z.ZodString;
416
+ options: z.ZodOptional<z.ZodObject<{
417
+ httpOnly: z.ZodLiteral<true>;
418
+ sameSite: z.ZodLiteral<"strict">;
419
+ path: z.ZodString;
420
+ secure: z.ZodLiteral<true>;
421
+ expires: z.ZodType<Date, z.ZodTypeDef, Date>;
422
+ }, "strip", z.ZodTypeAny, {
423
+ path: string;
424
+ httpOnly: true;
425
+ sameSite: "strict";
426
+ expires: Date;
427
+ secure: true;
428
+ }, {
429
+ path: string;
430
+ httpOnly: true;
431
+ sameSite: "strict";
432
+ expires: Date;
433
+ secure: true;
434
+ }>>;
435
+ }, "strip", z.ZodTypeAny, {
436
+ value: string;
437
+ options?: {
438
+ path: string;
439
+ httpOnly: true;
440
+ sameSite: "strict";
441
+ expires: Date;
442
+ secure: true;
443
+ } | undefined;
444
+ }, {
445
+ value: string;
446
+ options?: {
447
+ path: string;
448
+ httpOnly: true;
449
+ sameSite: "strict";
450
+ expires: Date;
451
+ secure: true;
452
+ } | undefined;
453
+ }>>;
454
+ }, "strip", z.ZodTypeAny, {
455
+ val_state: {
456
+ value: null;
457
+ };
458
+ val_enable?: {
459
+ value: "true";
460
+ options: {
461
+ httpOnly: false;
462
+ sameSite: "lax";
463
+ };
464
+ } | undefined;
465
+ val_session?: {
466
+ value: string;
467
+ options?: {
468
+ path: string;
469
+ httpOnly: true;
470
+ sameSite: "strict";
471
+ expires: Date;
472
+ secure: true;
473
+ } | undefined;
474
+ } | undefined;
475
+ }, {
476
+ val_state: {
477
+ value: null;
478
+ };
479
+ val_enable?: {
480
+ value: "true";
481
+ options: {
482
+ httpOnly: false;
483
+ sameSite: "lax";
484
+ };
485
+ } | undefined;
486
+ val_session?: {
487
+ value: string;
488
+ options?: {
489
+ path: string;
490
+ httpOnly: true;
491
+ sameSite: "strict";
492
+ expires: Date;
493
+ secure: true;
494
+ } | undefined;
495
+ } | undefined;
496
+ }>;
497
+ }, "strip", z.ZodTypeAny, {
498
+ status: 302;
499
+ redirectTo: string;
500
+ cookies: {
501
+ val_state: {
502
+ value: null;
503
+ };
504
+ val_enable?: {
505
+ value: "true";
506
+ options: {
507
+ httpOnly: false;
508
+ sameSite: "lax";
509
+ };
510
+ } | undefined;
511
+ val_session?: {
512
+ value: string;
513
+ options?: {
514
+ path: string;
515
+ httpOnly: true;
516
+ sameSite: "strict";
517
+ expires: Date;
518
+ secure: true;
519
+ } | undefined;
520
+ } | undefined;
521
+ };
522
+ }, {
523
+ status: 302;
524
+ redirectTo: string;
525
+ cookies: {
526
+ val_state: {
527
+ value: null;
528
+ };
529
+ val_enable?: {
530
+ value: "true";
531
+ options: {
532
+ httpOnly: false;
533
+ sameSite: "lax";
534
+ };
535
+ } | undefined;
536
+ val_session?: {
537
+ value: string;
538
+ options?: {
539
+ path: string;
540
+ httpOnly: true;
541
+ sameSite: "strict";
542
+ expires: Date;
543
+ secure: true;
544
+ } | undefined;
545
+ } | undefined;
546
+ };
547
+ }>;
548
+ };
549
+ };
550
+ "/session": {
551
+ GET: {
552
+ req: {
553
+ cookies: {
554
+ val_session: z.ZodOptional<z.ZodString>;
555
+ };
556
+ };
557
+ res: z.ZodUnion<[z.ZodObject<{
558
+ status: z.ZodLiteral<200>;
559
+ json: z.ZodObject<{
560
+ mode: z.ZodUnion<[z.ZodLiteral<"local">, z.ZodLiteral<"proxy">]>;
561
+ enabled: z.ZodBoolean;
562
+ }, "strip", z.ZodTypeAny, {
563
+ mode: "local" | "proxy";
564
+ enabled: boolean;
565
+ }, {
566
+ mode: "local" | "proxy";
567
+ enabled: boolean;
568
+ }>;
569
+ }, "strip", z.ZodTypeAny, {
570
+ status: 200;
571
+ json: {
572
+ mode: "local" | "proxy";
573
+ enabled: boolean;
574
+ };
575
+ }, {
576
+ status: 200;
577
+ json: {
578
+ mode: "local" | "proxy";
579
+ enabled: boolean;
580
+ };
581
+ }>, z.ZodObject<{
582
+ status: z.ZodUnion<[z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>, z.ZodLiteral<501>]>;
583
+ json: z.ZodObject<{
584
+ message: z.ZodString;
585
+ }, "strip", z.ZodTypeAny, {
586
+ message: string;
587
+ }, {
588
+ message: string;
589
+ }>;
590
+ }, "strip", z.ZodTypeAny, {
591
+ status: 400 | 401 | 403 | 404 | 500 | 501;
592
+ json: {
593
+ message: string;
594
+ };
595
+ }, {
596
+ status: 400 | 401 | 403 | 404 | 500 | 501;
597
+ json: {
598
+ message: string;
599
+ };
600
+ }>, z.ZodObject<{
601
+ status: z.ZodLiteral<401>;
602
+ json: z.ZodObject<{
603
+ message: z.ZodString;
604
+ details: z.ZodUnion<[z.ZodString, z.ZodObject<{
605
+ reason: z.ZodString;
606
+ }, "strip", z.ZodTypeAny, {
607
+ reason: string;
608
+ }, {
609
+ reason: string;
610
+ }>, z.ZodObject<{
611
+ sub: z.ZodString;
612
+ exp: z.ZodNumber;
613
+ token: z.ZodString;
614
+ org: z.ZodString;
615
+ project: z.ZodString;
616
+ }, "strip", z.ZodTypeAny, {
617
+ sub: string;
618
+ exp: number;
619
+ token: string;
620
+ org: string;
621
+ project: string;
622
+ }, {
623
+ sub: string;
624
+ exp: number;
625
+ token: string;
626
+ org: string;
627
+ project: string;
628
+ }>]>;
629
+ }, "strip", z.ZodTypeAny, {
630
+ message: string;
631
+ details: (string | {
632
+ reason: string;
633
+ } | {
634
+ sub: string;
635
+ exp: number;
636
+ token: string;
637
+ org: string;
638
+ project: string;
639
+ }) & (string | {
640
+ reason: string;
641
+ } | {
642
+ sub: string;
643
+ exp: number;
644
+ token: string;
645
+ org: string;
646
+ project: string;
647
+ } | undefined);
648
+ }, {
649
+ message: string;
650
+ details: (string | {
651
+ reason: string;
652
+ } | {
653
+ sub: string;
654
+ exp: number;
655
+ token: string;
656
+ org: string;
657
+ project: string;
658
+ }) & (string | {
659
+ reason: string;
660
+ } | {
661
+ sub: string;
662
+ exp: number;
663
+ token: string;
664
+ org: string;
665
+ project: string;
666
+ } | undefined);
667
+ }>;
668
+ }, "strip", z.ZodTypeAny, {
669
+ status: 401;
670
+ json: {
671
+ message: string;
672
+ details: (string | {
673
+ reason: string;
674
+ } | {
675
+ sub: string;
676
+ exp: number;
677
+ token: string;
678
+ org: string;
679
+ project: string;
680
+ }) & (string | {
681
+ reason: string;
682
+ } | {
683
+ sub: string;
684
+ exp: number;
685
+ token: string;
686
+ org: string;
687
+ project: string;
688
+ } | undefined);
689
+ };
690
+ }, {
691
+ status: 401;
692
+ json: {
693
+ message: string;
694
+ details: (string | {
695
+ reason: string;
696
+ } | {
697
+ sub: string;
698
+ exp: number;
699
+ token: string;
700
+ org: string;
701
+ project: string;
702
+ }) & (string | {
703
+ reason: string;
704
+ } | {
705
+ sub: string;
706
+ exp: number;
707
+ token: string;
708
+ org: string;
709
+ project: string;
710
+ } | undefined);
711
+ };
712
+ }>, z.ZodObject<{
713
+ status: z.ZodLiteral<500>;
714
+ json: z.ZodObject<{
715
+ message: z.ZodString;
716
+ }, "strip", z.ZodTypeAny, {
717
+ message: string;
718
+ }, {
719
+ message: string;
720
+ }>;
721
+ }, "strip", z.ZodTypeAny, {
722
+ status: 500;
723
+ json: {
724
+ message: string;
725
+ };
726
+ }, {
727
+ status: 500;
728
+ json: {
729
+ message: string;
730
+ };
731
+ }>]>;
732
+ };
733
+ };
734
+ "/logout": {
735
+ GET: {
736
+ req: {};
737
+ res: z.ZodObject<{
738
+ status: z.ZodLiteral<200>;
739
+ cookies: z.ZodObject<{
740
+ val_session: z.ZodObject<{
741
+ value: z.ZodLiteral<null>;
742
+ }, "strip", z.ZodTypeAny, {
743
+ value: null;
744
+ }, {
745
+ value: null;
746
+ }>;
747
+ val_state: z.ZodObject<{
748
+ value: z.ZodLiteral<null>;
749
+ }, "strip", z.ZodTypeAny, {
750
+ value: null;
751
+ }, {
752
+ value: null;
753
+ }>;
754
+ }, "strip", z.ZodTypeAny, {
755
+ val_state: {
756
+ value: null;
757
+ };
758
+ val_session: {
759
+ value: null;
760
+ };
761
+ }, {
762
+ val_state: {
763
+ value: null;
764
+ };
765
+ val_session: {
766
+ value: null;
767
+ };
768
+ }>;
769
+ }, "strip", z.ZodTypeAny, {
770
+ status: 200;
771
+ cookies: {
772
+ val_state: {
773
+ value: null;
774
+ };
775
+ val_session: {
776
+ value: null;
777
+ };
778
+ };
779
+ }, {
780
+ status: 200;
781
+ cookies: {
782
+ val_state: {
783
+ value: null;
784
+ };
785
+ val_session: {
786
+ value: null;
787
+ };
788
+ };
789
+ }>;
790
+ };
791
+ };
792
+ "/patches/~": {
793
+ DELETE: {
794
+ req: {
795
+ query: {
796
+ id: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
797
+ };
798
+ cookies: {
799
+ val_session: z.ZodOptional<z.ZodString>;
800
+ };
801
+ };
802
+ res: z.ZodUnion<[z.ZodObject<{
803
+ status: z.ZodLiteral<401>;
804
+ json: z.ZodObject<{
805
+ message: z.ZodString;
806
+ }, "strip", z.ZodTypeAny, {
807
+ message: string;
808
+ }, {
809
+ message: string;
810
+ }>;
811
+ }, "strip", z.ZodTypeAny, {
812
+ status: 401;
813
+ json: {
814
+ message: string;
815
+ };
816
+ }, {
817
+ status: 401;
818
+ json: {
819
+ message: string;
820
+ };
821
+ }>, z.ZodObject<{
822
+ status: z.ZodLiteral<500>;
823
+ json: z.ZodObject<{
824
+ message: z.ZodString;
825
+ details: z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
826
+ message: z.ZodString;
827
+ }, "strip", z.ZodTypeAny, {
828
+ message: string;
829
+ }, {
830
+ message: string;
831
+ }>>;
832
+ }, "strip", z.ZodTypeAny, {
833
+ message: string;
834
+ details: Partial<Record<PatchId, {
835
+ message: string;
836
+ }>>;
837
+ }, {
838
+ message: string;
839
+ details: Record<string, {
840
+ message: string;
841
+ }>;
842
+ }>;
843
+ }, "strip", z.ZodTypeAny, {
844
+ status: 500;
845
+ json: {
846
+ message: string;
847
+ details: Partial<Record<PatchId, {
848
+ message: string;
849
+ }>>;
850
+ };
851
+ }, {
852
+ status: 500;
853
+ json: {
854
+ message: string;
855
+ details: Record<string, {
856
+ message: string;
857
+ }>;
858
+ };
859
+ }>, z.ZodObject<{
860
+ status: z.ZodLiteral<200>;
861
+ json: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
862
+ }, "strip", z.ZodTypeAny, {
863
+ status: 200;
864
+ json: PatchId[];
865
+ }, {
866
+ status: 200;
867
+ json: string[];
868
+ }>]>;
869
+ };
870
+ GET: {
871
+ req: {
872
+ query: {
873
+ author: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
874
+ patch_id: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
875
+ module_file_path: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, ModuleFilePath, string>, "many">>;
876
+ omit_patch: z.ZodOptional<z.ZodBoolean>;
877
+ };
878
+ cookies: {
879
+ val_session: z.ZodOptional<z.ZodString>;
880
+ };
881
+ };
882
+ res: z.ZodUnion<[z.ZodObject<{
883
+ status: z.ZodLiteral<401>;
884
+ json: z.ZodObject<{
885
+ message: z.ZodString;
886
+ }, "strip", z.ZodTypeAny, {
887
+ message: string;
888
+ }, {
889
+ message: string;
890
+ }>;
891
+ }, "strip", z.ZodTypeAny, {
892
+ status: 401;
893
+ json: {
894
+ message: string;
895
+ };
896
+ }, {
897
+ status: 401;
898
+ json: {
899
+ message: string;
900
+ };
901
+ }>, z.ZodObject<{
902
+ status: z.ZodLiteral<500>;
903
+ json: z.ZodObject<{
904
+ message: z.ZodString;
905
+ details: z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
906
+ message: z.ZodString;
907
+ }, "strip", z.ZodTypeAny, {
908
+ message: string;
909
+ }, {
910
+ message: string;
911
+ }>>;
912
+ }, "strip", z.ZodTypeAny, {
913
+ message: string;
914
+ details: Partial<Record<PatchId, {
915
+ message: string;
916
+ }>>;
917
+ }, {
918
+ message: string;
919
+ details: Record<string, {
920
+ message: string;
921
+ }>;
922
+ }>;
923
+ }, "strip", z.ZodTypeAny, {
924
+ status: 500;
925
+ json: {
926
+ message: string;
927
+ details: Partial<Record<PatchId, {
928
+ message: string;
929
+ }>>;
930
+ };
931
+ }, {
932
+ status: 500;
933
+ json: {
934
+ message: string;
935
+ details: Record<string, {
936
+ message: string;
937
+ }>;
938
+ };
939
+ }>, z.ZodObject<{
940
+ status: z.ZodLiteral<200>;
941
+ json: z.ZodObject<{
942
+ patches: z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
943
+ path: z.ZodEffects<z.ZodString, ModuleFilePath, string>;
944
+ patch: z.ZodOptional<z.ZodType<import("@valbuild/core/patch").Patch, z.ZodTypeDef, import("@valbuild/core/patch").Patch>>;
945
+ createdAt: z.ZodString;
946
+ authorId: z.ZodNullable<z.ZodString>;
947
+ appliedAt: z.ZodNullable<z.ZodObject<{
948
+ baseSha: z.ZodString;
949
+ git: z.ZodOptional<z.ZodObject<{
950
+ commitSha: z.ZodString;
951
+ }, "strip", z.ZodTypeAny, {
952
+ commitSha: string;
953
+ }, {
954
+ commitSha: string;
955
+ }>>;
956
+ timestamp: z.ZodString;
957
+ }, "strip", z.ZodTypeAny, {
958
+ baseSha: string;
959
+ timestamp: string;
960
+ git?: {
961
+ commitSha: string;
962
+ } | undefined;
963
+ }, {
964
+ baseSha: string;
965
+ timestamp: string;
966
+ git?: {
967
+ commitSha: string;
968
+ } | undefined;
969
+ }>>;
970
+ }, "strip", z.ZodTypeAny, {
971
+ path: string & {
972
+ VAL_DATA_TYPE: "ModuleFilePath";
973
+ };
974
+ createdAt: string;
975
+ authorId: string | null;
976
+ appliedAt: {
977
+ baseSha: string;
978
+ timestamp: string;
979
+ git?: {
980
+ commitSha: string;
981
+ } | undefined;
982
+ } | null;
983
+ patch?: import("@valbuild/core/patch").Patch | undefined;
984
+ }, {
985
+ path: string;
986
+ createdAt: string;
987
+ authorId: string | null;
988
+ appliedAt: {
989
+ baseSha: string;
990
+ timestamp: string;
991
+ git?: {
992
+ commitSha: string;
993
+ } | undefined;
994
+ } | null;
995
+ patch?: import("@valbuild/core/patch").Patch | undefined;
996
+ }>>;
997
+ error: z.ZodOptional<z.ZodObject<{
998
+ message: z.ZodString;
999
+ }, "strip", z.ZodTypeAny, {
1000
+ message: string;
1001
+ }, {
1002
+ message: string;
1003
+ }>>;
1004
+ errors: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
1005
+ message: z.ZodString;
1006
+ }, "strip", z.ZodTypeAny, {
1007
+ message: string;
1008
+ }, {
1009
+ message: string;
1010
+ }>>>;
1011
+ }, "strip", z.ZodTypeAny, {
1012
+ patches: Partial<Record<PatchId, {
1013
+ path: string & {
1014
+ VAL_DATA_TYPE: "ModuleFilePath";
1015
+ };
1016
+ createdAt: string;
1017
+ authorId: string | null;
1018
+ appliedAt: {
1019
+ baseSha: string;
1020
+ timestamp: string;
1021
+ git?: {
1022
+ commitSha: string;
1023
+ } | undefined;
1024
+ } | null;
1025
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1026
+ }>>;
1027
+ error?: {
1028
+ message: string;
1029
+ } | undefined;
1030
+ errors?: Partial<Record<PatchId, {
1031
+ message: string;
1032
+ }>> | undefined;
1033
+ }, {
1034
+ patches: Record<string, {
1035
+ path: string;
1036
+ createdAt: string;
1037
+ authorId: string | null;
1038
+ appliedAt: {
1039
+ baseSha: string;
1040
+ timestamp: string;
1041
+ git?: {
1042
+ commitSha: string;
1043
+ } | undefined;
1044
+ } | null;
1045
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1046
+ }>;
1047
+ error?: {
1048
+ message: string;
1049
+ } | undefined;
1050
+ errors?: Record<string, {
1051
+ message: string;
1052
+ }> | undefined;
1053
+ }>;
1054
+ }, "strip", z.ZodTypeAny, {
1055
+ status: 200;
1056
+ json: {
1057
+ patches: Partial<Record<PatchId, {
1058
+ path: string & {
1059
+ VAL_DATA_TYPE: "ModuleFilePath";
1060
+ };
1061
+ createdAt: string;
1062
+ authorId: string | null;
1063
+ appliedAt: {
1064
+ baseSha: string;
1065
+ timestamp: string;
1066
+ git?: {
1067
+ commitSha: string;
1068
+ } | undefined;
1069
+ } | null;
1070
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1071
+ }>>;
1072
+ error?: {
1073
+ message: string;
1074
+ } | undefined;
1075
+ errors?: Partial<Record<PatchId, {
1076
+ message: string;
1077
+ }>> | undefined;
1078
+ };
1079
+ }, {
1080
+ status: 200;
1081
+ json: {
1082
+ patches: Record<string, {
1083
+ path: string;
1084
+ createdAt: string;
1085
+ authorId: string | null;
1086
+ appliedAt: {
1087
+ baseSha: string;
1088
+ timestamp: string;
1089
+ git?: {
1090
+ commitSha: string;
1091
+ } | undefined;
1092
+ } | null;
1093
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1094
+ }>;
1095
+ error?: {
1096
+ message: string;
1097
+ } | undefined;
1098
+ errors?: Record<string, {
1099
+ message: string;
1100
+ }> | undefined;
1101
+ };
1102
+ }>]>;
1103
+ };
1104
+ };
1105
+ "/schema": {
1106
+ GET: {
1107
+ req: {
1108
+ cookies: {
1109
+ val_session: z.ZodOptional<z.ZodString>;
1110
+ };
1111
+ };
1112
+ res: z.ZodUnion<[z.ZodObject<{
1113
+ status: z.ZodLiteral<401>;
1114
+ json: z.ZodObject<{
1115
+ message: z.ZodString;
1116
+ }, "strip", z.ZodTypeAny, {
1117
+ message: string;
1118
+ }, {
1119
+ message: string;
1120
+ }>;
1121
+ }, "strip", z.ZodTypeAny, {
1122
+ status: 401;
1123
+ json: {
1124
+ message: string;
1125
+ };
1126
+ }, {
1127
+ status: 401;
1128
+ json: {
1129
+ message: string;
1130
+ };
1131
+ }>, z.ZodObject<{
1132
+ status: z.ZodLiteral<500>;
1133
+ json: z.ZodObject<{
1134
+ message: z.ZodString;
1135
+ details: z.ZodArray<z.ZodObject<{
1136
+ message: z.ZodString;
1137
+ path: z.ZodOptional<z.ZodEffects<z.ZodString, ModuleFilePath, string>>;
1138
+ }, "strip", z.ZodTypeAny, {
1139
+ message: string;
1140
+ path?: ModuleFilePath | undefined;
1141
+ }, {
1142
+ message: string;
1143
+ path?: string | undefined;
1144
+ }>, "many">;
1145
+ }, "strip", z.ZodTypeAny, {
1146
+ message: string;
1147
+ details: {
1148
+ message: string;
1149
+ path?: ModuleFilePath | undefined;
1150
+ }[];
1151
+ }, {
1152
+ message: string;
1153
+ details: {
1154
+ message: string;
1155
+ path?: string | undefined;
1156
+ }[];
1157
+ }>;
1158
+ }, "strip", z.ZodTypeAny, {
1159
+ status: 500;
1160
+ json: {
1161
+ message: string;
1162
+ details: {
1163
+ message: string;
1164
+ path?: ModuleFilePath | undefined;
1165
+ }[];
1166
+ };
1167
+ }, {
1168
+ status: 500;
1169
+ json: {
1170
+ message: string;
1171
+ details: {
1172
+ message: string;
1173
+ path?: string | undefined;
1174
+ }[];
1175
+ };
1176
+ }>, z.ZodObject<{
1177
+ status: z.ZodLiteral<200>;
1178
+ json: z.ZodObject<{
1179
+ schemaSha: z.ZodString;
1180
+ schemas: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodType<import("@valbuild/core").SerializedSchema, z.ZodTypeDef, unknown>>;
1181
+ }, "strip", z.ZodTypeAny, {
1182
+ schemaSha: string;
1183
+ schemas: Partial<Record<ModuleFilePath, import("@valbuild/core").SerializedSchema>>;
1184
+ }, {
1185
+ schemaSha: string;
1186
+ schemas: Record<string, unknown>;
1187
+ }>;
1188
+ }, "strip", z.ZodTypeAny, {
1189
+ status: 200;
1190
+ json: {
1191
+ schemaSha: string;
1192
+ schemas: Partial<Record<ModuleFilePath, import("@valbuild/core").SerializedSchema>>;
1193
+ };
1194
+ }, {
1195
+ status: 200;
1196
+ json: {
1197
+ schemaSha: string;
1198
+ schemas: Record<string, unknown>;
1199
+ };
1200
+ }>]>;
1201
+ };
1202
+ };
1203
+ "/tree/~": {
1204
+ PUT: {
1205
+ req: {
1206
+ path: z.ZodOptional<z.ZodString>;
1207
+ body: z.ZodOptional<z.ZodObject<{
1208
+ patchIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
1209
+ addPatch: z.ZodOptional<z.ZodObject<{
1210
+ path: z.ZodEffects<z.ZodString, ModuleFilePath, string>;
1211
+ patch: z.ZodType<import("@valbuild/core/patch").Patch, z.ZodTypeDef, import("@valbuild/core/patch").Patch>;
1212
+ }, "strip", z.ZodTypeAny, {
1213
+ path: string & {
1214
+ VAL_DATA_TYPE: "ModuleFilePath";
1215
+ };
1216
+ patch: import("@valbuild/core/patch").Patch;
1217
+ }, {
1218
+ path: string;
1219
+ patch: import("@valbuild/core/patch").Patch;
1220
+ }>>;
1221
+ }, "strip", z.ZodTypeAny, {
1222
+ patchIds?: PatchId[] | undefined;
1223
+ addPatch?: {
1224
+ path: string & {
1225
+ VAL_DATA_TYPE: "ModuleFilePath";
1226
+ };
1227
+ patch: import("@valbuild/core/patch").Patch;
1228
+ } | undefined;
1229
+ }, {
1230
+ patchIds?: string[] | undefined;
1231
+ addPatch?: {
1232
+ path: string;
1233
+ patch: import("@valbuild/core/patch").Patch;
1234
+ } | undefined;
1235
+ }>>;
1236
+ query: {
1237
+ validate_all: z.ZodOptional<z.ZodBoolean>;
1238
+ validate_sources: z.ZodOptional<z.ZodBoolean>;
1239
+ validate_binary_files: z.ZodOptional<z.ZodBoolean>;
1240
+ };
1241
+ cookies: {
1242
+ val_session: z.ZodOptional<z.ZodString>;
1243
+ };
1244
+ };
1245
+ res: z.ZodUnion<[z.ZodObject<{
1246
+ status: z.ZodLiteral<401>;
1247
+ json: z.ZodObject<{
1248
+ message: z.ZodString;
1249
+ }, "strip", z.ZodTypeAny, {
1250
+ message: string;
1251
+ }, {
1252
+ message: string;
1253
+ }>;
1254
+ }, "strip", z.ZodTypeAny, {
1255
+ status: 401;
1256
+ json: {
1257
+ message: string;
1258
+ };
1259
+ }, {
1260
+ status: 401;
1261
+ json: {
1262
+ message: string;
1263
+ };
1264
+ }>, z.ZodObject<{
1265
+ status: z.ZodLiteral<401>;
1266
+ json: z.ZodObject<{
1267
+ message: z.ZodString;
1268
+ }, "strip", z.ZodTypeAny, {
1269
+ message: string;
1270
+ }, {
1271
+ message: string;
1272
+ }>;
1273
+ }, "strip", z.ZodTypeAny, {
1274
+ status: 401;
1275
+ json: {
1276
+ message: string;
1277
+ };
1278
+ }, {
1279
+ status: 401;
1280
+ json: {
1281
+ message: string;
1282
+ };
1283
+ }>, z.ZodObject<{
1284
+ status: z.ZodLiteral<500>;
1285
+ json: z.ZodObject<{
1286
+ message: z.ZodString;
1287
+ details: z.ZodUnion<[z.ZodArray<z.ZodObject<{
1288
+ message: z.ZodString;
1289
+ path: z.ZodOptional<z.ZodEffects<z.ZodString, ModuleFilePath, string>>;
1290
+ }, "strip", z.ZodTypeAny, {
1291
+ message: string;
1292
+ path?: ModuleFilePath | undefined;
1293
+ }, {
1294
+ message: string;
1295
+ path?: string | undefined;
1296
+ }>, "many">, z.ZodObject<{
1297
+ message: z.ZodString;
1298
+ }, "strip", z.ZodTypeAny, {
1299
+ message: string;
1300
+ }, {
1301
+ message: string;
1302
+ }>]>;
1303
+ }, "strip", z.ZodTypeAny, {
1304
+ message: string;
1305
+ details: ({
1306
+ message: string;
1307
+ } | {
1308
+ message: string;
1309
+ path?: ModuleFilePath | undefined;
1310
+ }[]) & ({
1311
+ message: string;
1312
+ } | {
1313
+ message: string;
1314
+ path?: ModuleFilePath | undefined;
1315
+ }[] | undefined);
1316
+ }, {
1317
+ message: string;
1318
+ details: ({
1319
+ message: string;
1320
+ } | {
1321
+ message: string;
1322
+ path?: string | undefined;
1323
+ }[]) & ({
1324
+ message: string;
1325
+ } | {
1326
+ message: string;
1327
+ path?: string | undefined;
1328
+ }[] | undefined);
1329
+ }>;
1330
+ }, "strip", z.ZodTypeAny, {
1331
+ status: 500;
1332
+ json: {
1333
+ message: string;
1334
+ details: ({
1335
+ message: string;
1336
+ } | {
1337
+ message: string;
1338
+ path?: ModuleFilePath | undefined;
1339
+ }[]) & ({
1340
+ message: string;
1341
+ } | {
1342
+ message: string;
1343
+ path?: ModuleFilePath | undefined;
1344
+ }[] | undefined);
1345
+ };
1346
+ }, {
1347
+ status: 500;
1348
+ json: {
1349
+ message: string;
1350
+ details: ({
1351
+ message: string;
1352
+ } | {
1353
+ message: string;
1354
+ path?: string | undefined;
1355
+ }[]) & ({
1356
+ message: string;
1357
+ } | {
1358
+ message: string;
1359
+ path?: string | undefined;
1360
+ }[] | undefined);
1361
+ };
1362
+ }>, z.ZodObject<{
1363
+ status: z.ZodLiteral<400>;
1364
+ json: z.ZodObject<{
1365
+ message: z.ZodString;
1366
+ details: z.ZodArray<z.ZodObject<{
1367
+ message: z.ZodString;
1368
+ path: z.ZodOptional<z.ZodEffects<z.ZodString, ModuleFilePath, string>>;
1369
+ }, "strip", z.ZodTypeAny, {
1370
+ message: string;
1371
+ path?: ModuleFilePath | undefined;
1372
+ }, {
1373
+ message: string;
1374
+ path?: string | undefined;
1375
+ }>, "many">;
1376
+ }, "strip", z.ZodTypeAny, {
1377
+ message: string;
1378
+ details: {
1379
+ message: string;
1380
+ path?: ModuleFilePath | undefined;
1381
+ }[];
1382
+ }, {
1383
+ message: string;
1384
+ details: {
1385
+ message: string;
1386
+ path?: string | undefined;
1387
+ }[];
1388
+ }>;
1389
+ }, "strip", z.ZodTypeAny, {
1390
+ status: 400;
1391
+ json: {
1392
+ message: string;
1393
+ details: {
1394
+ message: string;
1395
+ path?: ModuleFilePath | undefined;
1396
+ }[];
1397
+ };
1398
+ }, {
1399
+ status: 400;
1400
+ json: {
1401
+ message: string;
1402
+ details: {
1403
+ message: string;
1404
+ path?: string | undefined;
1405
+ }[];
1406
+ };
1407
+ }>, z.ZodObject<{
1408
+ status: z.ZodLiteral<400>;
1409
+ json: z.ZodObject<{
1410
+ type: z.ZodLiteral<"patch-error">;
1411
+ message: z.ZodString;
1412
+ errors: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodArray<z.ZodObject<{
1413
+ patchId: z.ZodEffects<z.ZodString, PatchId, string>;
1414
+ skipped: z.ZodBoolean;
1415
+ error: z.ZodObject<{
1416
+ message: z.ZodString;
1417
+ }, "strip", z.ZodTypeAny, {
1418
+ message: string;
1419
+ }, {
1420
+ message: string;
1421
+ }>;
1422
+ }, "strip", z.ZodTypeAny, {
1423
+ error: {
1424
+ message: string;
1425
+ };
1426
+ patchId: string & {
1427
+ VAL_DATA_TYPE: "PatchId";
1428
+ };
1429
+ skipped: boolean;
1430
+ }, {
1431
+ error: {
1432
+ message: string;
1433
+ };
1434
+ patchId: string;
1435
+ skipped: boolean;
1436
+ }>, "many">>;
1437
+ }, "strip", z.ZodTypeAny, {
1438
+ message: string;
1439
+ type: "patch-error";
1440
+ errors: Partial<Record<ModuleFilePath, {
1441
+ error: {
1442
+ message: string;
1443
+ };
1444
+ patchId: string & {
1445
+ VAL_DATA_TYPE: "PatchId";
1446
+ };
1447
+ skipped: boolean;
1448
+ }[]>>;
1449
+ }, {
1450
+ message: string;
1451
+ type: "patch-error";
1452
+ errors: Record<string, {
1453
+ error: {
1454
+ message: string;
1455
+ };
1456
+ patchId: string;
1457
+ skipped: boolean;
1458
+ }[]>;
1459
+ }>;
1460
+ }, "strip", z.ZodTypeAny, {
1461
+ status: 400;
1462
+ json: {
1463
+ message: string;
1464
+ type: "patch-error";
1465
+ errors: Partial<Record<ModuleFilePath, {
1466
+ error: {
1467
+ message: string;
1468
+ };
1469
+ patchId: string & {
1470
+ VAL_DATA_TYPE: "PatchId";
1471
+ };
1472
+ skipped: boolean;
1473
+ }[]>>;
1474
+ };
1475
+ }, {
1476
+ status: 400;
1477
+ json: {
1478
+ message: string;
1479
+ type: "patch-error";
1480
+ errors: Record<string, {
1481
+ error: {
1482
+ message: string;
1483
+ };
1484
+ patchId: string;
1485
+ skipped: boolean;
1486
+ }[]>;
1487
+ };
1488
+ }>, z.ZodObject<{
1489
+ status: z.ZodLiteral<200>;
1490
+ json: z.ZodObject<{
1491
+ schemaSha: z.ZodString;
1492
+ modules: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodObject<{
1493
+ source: z.ZodAny;
1494
+ patches: z.ZodOptional<z.ZodObject<{
1495
+ applied: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
1496
+ skipped: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
1497
+ errors: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
1498
+ message: z.ZodString;
1499
+ }, "strip", z.ZodTypeAny, {
1500
+ message: string;
1501
+ }, {
1502
+ message: string;
1503
+ }>>>;
1504
+ }, "strip", z.ZodTypeAny, {
1505
+ applied: PatchId[];
1506
+ skipped?: PatchId[] | undefined;
1507
+ errors?: Partial<Record<PatchId, {
1508
+ message: string;
1509
+ }>> | undefined;
1510
+ }, {
1511
+ applied: string[];
1512
+ skipped?: string[] | undefined;
1513
+ errors?: Record<string, {
1514
+ message: string;
1515
+ }> | undefined;
1516
+ }>>;
1517
+ validationErrors: z.ZodOptional<z.ZodRecord<z.ZodType<import("@valbuild/core").SourcePath, z.ZodTypeDef, unknown>, z.ZodArray<z.ZodObject<{
1518
+ message: z.ZodString;
1519
+ value: z.ZodOptional<z.ZodUnknown>;
1520
+ fatal: z.ZodOptional<z.ZodBoolean>;
1521
+ fixes: z.ZodOptional<z.ZodArray<z.ZodType<"image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext", z.ZodTypeDef, "image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext">, "many">>;
1522
+ }, "strip", z.ZodTypeAny, {
1523
+ message: string;
1524
+ value?: unknown;
1525
+ fatal?: boolean | undefined;
1526
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1527
+ }, {
1528
+ message: string;
1529
+ value?: unknown;
1530
+ fatal?: boolean | undefined;
1531
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1532
+ }>, "many">>>;
1533
+ }, "strip", z.ZodTypeAny, {
1534
+ source?: any;
1535
+ patches?: {
1536
+ applied: PatchId[];
1537
+ skipped?: PatchId[] | undefined;
1538
+ errors?: Partial<Record<PatchId, {
1539
+ message: string;
1540
+ }>> | undefined;
1541
+ } | undefined;
1542
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
1543
+ message: string;
1544
+ value?: unknown;
1545
+ fatal?: boolean | undefined;
1546
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1547
+ }[]>> | undefined;
1548
+ }, {
1549
+ source?: any;
1550
+ patches?: {
1551
+ applied: string[];
1552
+ skipped?: string[] | undefined;
1553
+ errors?: Record<string, {
1554
+ message: string;
1555
+ }> | undefined;
1556
+ } | undefined;
1557
+ validationErrors?: Record<unknown, {
1558
+ message: string;
1559
+ value?: unknown;
1560
+ fatal?: boolean | undefined;
1561
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1562
+ }[]> | undefined;
1563
+ }>>;
1564
+ newPatchId: z.ZodOptional<z.ZodEffects<z.ZodString, PatchId, string>>;
1565
+ }, "strip", z.ZodTypeAny, {
1566
+ schemaSha: string;
1567
+ modules: Partial<Record<ModuleFilePath, {
1568
+ source?: any;
1569
+ patches?: {
1570
+ applied: PatchId[];
1571
+ skipped?: PatchId[] | undefined;
1572
+ errors?: Partial<Record<PatchId, {
1573
+ message: string;
1574
+ }>> | undefined;
1575
+ } | undefined;
1576
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
1577
+ message: string;
1578
+ value?: unknown;
1579
+ fatal?: boolean | undefined;
1580
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1581
+ }[]>> | undefined;
1582
+ }>>;
1583
+ newPatchId?: PatchId | undefined;
1584
+ }, {
1585
+ schemaSha: string;
1586
+ modules: Record<string, {
1587
+ source?: any;
1588
+ patches?: {
1589
+ applied: string[];
1590
+ skipped?: string[] | undefined;
1591
+ errors?: Record<string, {
1592
+ message: string;
1593
+ }> | undefined;
1594
+ } | undefined;
1595
+ validationErrors?: Record<unknown, {
1596
+ message: string;
1597
+ value?: unknown;
1598
+ fatal?: boolean | undefined;
1599
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1600
+ }[]> | undefined;
1601
+ }>;
1602
+ newPatchId?: string | undefined;
1603
+ }>;
1604
+ }, "strip", z.ZodTypeAny, {
1605
+ status: 200;
1606
+ json: {
1607
+ schemaSha: string;
1608
+ modules: Partial<Record<ModuleFilePath, {
1609
+ source?: any;
1610
+ patches?: {
1611
+ applied: PatchId[];
1612
+ skipped?: PatchId[] | undefined;
1613
+ errors?: Partial<Record<PatchId, {
1614
+ message: string;
1615
+ }>> | undefined;
1616
+ } | undefined;
1617
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
1618
+ message: string;
1619
+ value?: unknown;
1620
+ fatal?: boolean | undefined;
1621
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1622
+ }[]>> | undefined;
1623
+ }>>;
1624
+ newPatchId?: PatchId | undefined;
1625
+ };
1626
+ }, {
1627
+ status: 200;
1628
+ json: {
1629
+ schemaSha: string;
1630
+ modules: Record<string, {
1631
+ source?: any;
1632
+ patches?: {
1633
+ applied: string[];
1634
+ skipped?: string[] | undefined;
1635
+ errors?: Record<string, {
1636
+ message: string;
1637
+ }> | undefined;
1638
+ } | undefined;
1639
+ validationErrors?: Record<unknown, {
1640
+ message: string;
1641
+ value?: unknown;
1642
+ fatal?: boolean | undefined;
1643
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
1644
+ }[]> | undefined;
1645
+ }>;
1646
+ newPatchId?: string | undefined;
1647
+ };
1648
+ }>]>;
1649
+ };
1650
+ };
1651
+ "/save": {
1652
+ POST: {
1653
+ req: {
1654
+ body: z.ZodObject<{
1655
+ patchIds: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
1656
+ }, "strip", z.ZodTypeAny, {
1657
+ patchIds: PatchId[];
1658
+ }, {
1659
+ patchIds: string[];
1660
+ }>;
1661
+ cookies: {
1662
+ val_session: z.ZodOptional<z.ZodString>;
1663
+ };
1664
+ };
1665
+ res: z.ZodUnion<[z.ZodObject<{
1666
+ status: z.ZodLiteral<401>;
1667
+ json: z.ZodObject<{
1668
+ message: z.ZodString;
1669
+ }, "strip", z.ZodTypeAny, {
1670
+ message: string;
1671
+ }, {
1672
+ message: string;
1673
+ }>;
1674
+ }, "strip", z.ZodTypeAny, {
1675
+ status: 401;
1676
+ json: {
1677
+ message: string;
1678
+ };
1679
+ }, {
1680
+ status: 401;
1681
+ json: {
1682
+ message: string;
1683
+ };
1684
+ }>, z.ZodObject<{
1685
+ status: z.ZodLiteral<200>;
1686
+ json: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
1687
+ }, "strip", z.ZodTypeAny, {
1688
+ status: 200;
1689
+ json: {};
1690
+ }, {
1691
+ status: 200;
1692
+ json: {};
1693
+ }>, z.ZodObject<{
1694
+ status: z.ZodLiteral<400>;
1695
+ json: z.ZodObject<{
1696
+ message: z.ZodString;
1697
+ details: z.ZodUnion<[z.ZodObject<{
1698
+ sourceFilePatchErrors: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodArray<z.ZodObject<{
1699
+ message: z.ZodString;
1700
+ }, "strip", z.ZodTypeAny, {
1701
+ message: string;
1702
+ }, {
1703
+ message: string;
1704
+ }>, "many">>;
1705
+ binaryFilePatchErrors: z.ZodRecord<z.ZodString, z.ZodObject<{
1706
+ message: z.ZodString;
1707
+ }, "strip", z.ZodTypeAny, {
1708
+ message: string;
1709
+ }, {
1710
+ message: string;
1711
+ }>>;
1712
+ }, "strip", z.ZodTypeAny, {
1713
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
1714
+ message: string;
1715
+ }[]>>;
1716
+ binaryFilePatchErrors: Record<string, {
1717
+ message: string;
1718
+ }>;
1719
+ }, {
1720
+ sourceFilePatchErrors: Record<string, {
1721
+ message: string;
1722
+ }[]>;
1723
+ binaryFilePatchErrors: Record<string, {
1724
+ message: string;
1725
+ }>;
1726
+ }>, z.ZodArray<z.ZodObject<{
1727
+ message: z.ZodString;
1728
+ }, "strip", z.ZodTypeAny, {
1729
+ message: string;
1730
+ }, {
1731
+ message: string;
1732
+ }>, "many">]>;
1733
+ }, "strip", z.ZodTypeAny, {
1734
+ message: string;
1735
+ details: ({
1736
+ message: string;
1737
+ }[] | {
1738
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
1739
+ message: string;
1740
+ }[]>>;
1741
+ binaryFilePatchErrors: Record<string, {
1742
+ message: string;
1743
+ }>;
1744
+ }) & ({
1745
+ message: string;
1746
+ }[] | {
1747
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
1748
+ message: string;
1749
+ }[]>>;
1750
+ binaryFilePatchErrors: Record<string, {
1751
+ message: string;
1752
+ }>;
1753
+ } | undefined);
1754
+ }, {
1755
+ message: string;
1756
+ details: ({
1757
+ message: string;
1758
+ }[] | {
1759
+ sourceFilePatchErrors: Record<string, {
1760
+ message: string;
1761
+ }[]>;
1762
+ binaryFilePatchErrors: Record<string, {
1763
+ message: string;
1764
+ }>;
1765
+ }) & ({
1766
+ message: string;
1767
+ }[] | {
1768
+ sourceFilePatchErrors: Record<string, {
1769
+ message: string;
1770
+ }[]>;
1771
+ binaryFilePatchErrors: Record<string, {
1772
+ message: string;
1773
+ }>;
1774
+ } | undefined);
1775
+ }>;
1776
+ }, "strip", z.ZodTypeAny, {
1777
+ status: 400;
1778
+ json: {
1779
+ message: string;
1780
+ details: ({
1781
+ message: string;
1782
+ }[] | {
1783
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
1784
+ message: string;
1785
+ }[]>>;
1786
+ binaryFilePatchErrors: Record<string, {
1787
+ message: string;
1788
+ }>;
1789
+ }) & ({
1790
+ message: string;
1791
+ }[] | {
1792
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
1793
+ message: string;
1794
+ }[]>>;
1795
+ binaryFilePatchErrors: Record<string, {
1796
+ message: string;
1797
+ }>;
1798
+ } | undefined);
1799
+ };
1800
+ }, {
1801
+ status: 400;
1802
+ json: {
1803
+ message: string;
1804
+ details: ({
1805
+ message: string;
1806
+ }[] | {
1807
+ sourceFilePatchErrors: Record<string, {
1808
+ message: string;
1809
+ }[]>;
1810
+ binaryFilePatchErrors: Record<string, {
1811
+ message: string;
1812
+ }>;
1813
+ }) & ({
1814
+ message: string;
1815
+ }[] | {
1816
+ sourceFilePatchErrors: Record<string, {
1817
+ message: string;
1818
+ }[]>;
1819
+ binaryFilePatchErrors: Record<string, {
1820
+ message: string;
1821
+ }>;
1822
+ } | undefined);
1823
+ };
1824
+ }>]>;
1825
+ };
1826
+ };
1827
+ "/files": {
1828
+ GET: {
1829
+ req: {
1830
+ path: z.ZodString;
1831
+ query: {
1832
+ patch_id: z.ZodOptional<z.ZodEffects<z.ZodString, PatchId, string>>;
1833
+ };
1834
+ };
1835
+ res: z.ZodUnion<[z.ZodObject<{
1836
+ status: z.ZodLiteral<200>;
1837
+ body: z.ZodType<ReadableStream<unknown>, z.ZodTypeDef, ReadableStream<unknown>>;
1838
+ }, "strip", z.ZodTypeAny, {
1839
+ status: 200;
1840
+ body: ReadableStream<unknown>;
1841
+ }, {
1842
+ status: 200;
1843
+ body: ReadableStream<unknown>;
1844
+ }>, z.ZodObject<{
1845
+ status: z.ZodLiteral<404>;
1846
+ json: z.ZodObject<{
1847
+ message: z.ZodString;
1848
+ }, "strip", z.ZodTypeAny, {
1849
+ message: string;
1850
+ }, {
1851
+ message: string;
1852
+ }>;
1853
+ }, "strip", z.ZodTypeAny, {
1854
+ status: 404;
1855
+ json: {
1856
+ message: string;
1857
+ };
1858
+ }, {
1859
+ status: 404;
1860
+ json: {
1861
+ message: string;
1862
+ };
1863
+ }>]>;
1864
+ };
1865
+ };
1866
+ };
1867
+ /**
1868
+ * Extracts the keys of an object where the value is not undefined.
1869
+ */
1870
+ type DefinedKeys<T> = {
1871
+ [K in keyof T]-?: T[K] extends undefined ? never : K;
1872
+ }[keyof T];
1873
+ /**
1874
+ * Extracts the keys of an object where the value is not undefined.
1875
+ * Then picks the keys from the object.
1876
+ * This is useful for creating a new object type with only the defined keys.
1877
+ * @example
1878
+ * type A = { a: string; b?: number };
1879
+ * type B = DefinedObject<A>; // { a: string }
1880
+ */
1881
+ type DefinedObject<T> = Pick<T, DefinedKeys<T>>;
1882
+ /**
1883
+ * This schema supports:
1884
+ * 1. multiple query params with the same name
1885
+ * 2. simple API route definitions where:
1886
+ * 2.1. z.array means at least one query params this name is required
1887
+ * 2.2. z.optional means no query param of this name is accepted
1888
+ * 2.3. z.array(...).optional() means zero or more query params of this name is accepted
1889
+ *
1890
+ * Do not change this without updating the ValRouter query parsing logic
1891
+ * */
1892
+ export type ValidQueryParamTypes = boolean | string | string[] | undefined;
1893
+ export type ApiEndpoint = {
1894
+ req: {
1895
+ path?: z.ZodString | z.ZodOptional<z.ZodString>;
1896
+ body?: z.ZodTypeAny;
1897
+ query?: Record<string, z.ZodSchema<ValidQueryParamTypes>>;
1898
+ cookies?: Record<string, z.ZodSchema<string | undefined>>;
1899
+ };
1900
+ res: z.ZodSchema<{
1901
+ status: number;
1902
+ body: unknown;
1903
+ contentType?: string;
1904
+ cookies?: Partial<Record<Cookies, CookieValue>>;
1905
+ } | {
1906
+ status: number;
1907
+ json?: unknown;
1908
+ cookies?: Partial<Record<Cookies, CookieValue>>;
1909
+ } | {
1910
+ cookies?: Partial<Record<Cookies, CookieValue>>;
1911
+ status: 302;
1912
+ redirectTo: string;
1913
+ }>;
1914
+ };
1915
+ type ApiGuard = Record<`/${string}`, Partial<Record<"PUT" | "GET" | "POST" | "DELETE", ApiEndpoint>>>;
1916
+ export type ServerOf<Api extends ApiGuard> = {
1917
+ [Route in keyof Api]: {
1918
+ [Method in keyof Api[Route]]: Api[Route][Method] extends ApiEndpoint ? (req: DefinedObject<{
1919
+ body: Api[Route][Method]["req"]["body"] extends z.ZodTypeAny ? z.infer<Api[Route][Method]["req"]["body"]> : undefined;
1920
+ path: Api[Route][Method]["req"]["path"] extends z.ZodSchema<string | undefined> ? string : undefined;
1921
+ query: Api[Route][Method]["req"]["query"] extends Record<string, z.ZodSchema<ValidQueryParamTypes>> ? {
1922
+ [key in keyof Api[Route][Method]["req"]["query"]]: z.infer<Api[Route][Method]["req"]["query"][key]>;
1923
+ } : undefined;
1924
+ cookies: Api[Route][Method]["req"]["cookies"] extends Record<string, z.ZodSchema<string | undefined>> ? {
1925
+ [key in keyof Api[Route][Method]["req"]["cookies"]]: z.infer<Api[Route][Method]["req"]["cookies"][key]>;
1926
+ } : undefined;
1927
+ }>) => Promise<z.infer<Api[Route][Method]["res"]>> : never;
1928
+ };
1929
+ };
1930
+ export type ClientOf<Api extends ApiGuard> = <Route extends keyof Api, Method extends keyof Api[Route], Endpoint extends Api[Route][Method] extends ApiEndpoint ? Api[Route][Method] : never>(route: Route, method: Method, req: DefinedObject<{
1931
+ body: Endpoint["req"]["body"] extends z.ZodTypeAny ? z.infer<Endpoint["req"]["body"]> : undefined;
1932
+ path: Endpoint["req"]["path"] extends z.ZodSchema<string | undefined> ? z.infer<Endpoint["req"]["path"]> : undefined;
1933
+ query: Endpoint["req"]["query"] extends Record<string, z.ZodSchema<ValidQueryParamTypes>> ? {
1934
+ [key in keyof Endpoint["req"]["query"]]: z.infer<Endpoint["req"]["query"][key]>;
1935
+ } : undefined;
1936
+ }>) => Promise<z.infer<Endpoint["res"]> | ClientFetchErrors>;
1937
+ export type ClientFetchErrors = {
1938
+ status: 404;
1939
+ json: {
1940
+ message: string;
1941
+ method: string;
1942
+ path: string;
1943
+ };
1944
+ } | {
1945
+ status: 500;
1946
+ json: {
1947
+ message: string;
1948
+ type: "unknown";
1949
+ };
1950
+ } | {
1951
+ status: 504;
1952
+ json: {
1953
+ message: string;
1954
+ };
1955
+ } | {
1956
+ status: null;
1957
+ json: {
1958
+ type: "network_error";
1959
+ message: string;
1960
+ details: string;
1961
+ } | {
1962
+ message: string;
1963
+ type: "client_side_validation_error";
1964
+ details: {
1965
+ validationError: string;
1966
+ data: unknown;
1967
+ };
1968
+ };
1969
+ };
1970
+ export type UrlOf<Api extends ApiGuard> = <Route extends keyof Api | "/val", Method extends keyof Api[Route] & "GET", Endpoint extends Api[Route][Method] extends ApiEndpoint ? Api[Route][Method] : never>(...args: Route extends "/val" ? [route: Route] : Endpoint["req"]["query"] extends Record<string, z.ZodSchema<ValidQueryParamTypes>> ? [
1971
+ route: `/api/val${Route & string}`,
1972
+ query: {
1973
+ [key in keyof Endpoint["req"]["query"]]: z.infer<Endpoint["req"]["query"][key]>;
1974
+ }
1975
+ ] : [route: `/api/val${Route & string}`]) => string;
1976
+ export type Api = {
1977
+ [Route in keyof typeof Api]: {
1978
+ [Method in keyof (typeof Api)[Route]]: (typeof Api)[Route][Method] extends ApiEndpoint ? (typeof Api)[Route][Method] : never;
1979
+ };
1980
+ };
1981
+ export {};