@valbuild/shared 0.63.5 → 0.65.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,2725 @@
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
+ "/draft/enable": {
43
+ GET: {
44
+ req: {
45
+ query: {
46
+ redirect_to: z.ZodOptional<z.ZodString>;
47
+ };
48
+ cookies: {
49
+ val_session: z.ZodOptional<z.ZodString>;
50
+ };
51
+ };
52
+ res: z.ZodUnion<[z.ZodObject<{
53
+ status: z.ZodLiteral<401>;
54
+ json: z.ZodObject<{
55
+ message: z.ZodString;
56
+ }, "strip", z.ZodTypeAny, {
57
+ message: string;
58
+ }, {
59
+ message: string;
60
+ }>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ status: 401;
63
+ json: {
64
+ message: string;
65
+ };
66
+ }, {
67
+ status: 401;
68
+ json: {
69
+ message: string;
70
+ };
71
+ }>, z.ZodObject<{
72
+ status: z.ZodLiteral<302>;
73
+ redirectTo: z.ZodString;
74
+ }, "strip", z.ZodTypeAny, {
75
+ status: 302;
76
+ redirectTo: string;
77
+ }, {
78
+ status: 302;
79
+ redirectTo: string;
80
+ }>, z.ZodObject<{
81
+ status: z.ZodLiteral<400>;
82
+ json: z.ZodObject<{
83
+ message: z.ZodString;
84
+ }, "strip", z.ZodTypeAny, {
85
+ message: string;
86
+ }, {
87
+ message: string;
88
+ }>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ status: 400;
91
+ json: {
92
+ message: string;
93
+ };
94
+ }, {
95
+ status: 400;
96
+ json: {
97
+ message: string;
98
+ };
99
+ }>]>;
100
+ };
101
+ };
102
+ "/draft/disable": {
103
+ GET: {
104
+ req: {
105
+ query: {
106
+ redirect_to: z.ZodOptional<z.ZodString>;
107
+ };
108
+ cookies: {
109
+ val_session: z.ZodOptional<z.ZodString>;
110
+ };
111
+ };
112
+ res: z.ZodUnion<[z.ZodObject<{
113
+ status: z.ZodLiteral<401>;
114
+ json: z.ZodObject<{
115
+ message: z.ZodString;
116
+ }, "strip", z.ZodTypeAny, {
117
+ message: string;
118
+ }, {
119
+ message: string;
120
+ }>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ status: 401;
123
+ json: {
124
+ message: string;
125
+ };
126
+ }, {
127
+ status: 401;
128
+ json: {
129
+ message: string;
130
+ };
131
+ }>, z.ZodObject<{
132
+ status: z.ZodLiteral<302>;
133
+ redirectTo: z.ZodString;
134
+ }, "strip", z.ZodTypeAny, {
135
+ status: 302;
136
+ redirectTo: string;
137
+ }, {
138
+ status: 302;
139
+ redirectTo: string;
140
+ }>, z.ZodObject<{
141
+ status: z.ZodLiteral<400>;
142
+ json: z.ZodObject<{
143
+ message: z.ZodString;
144
+ }, "strip", z.ZodTypeAny, {
145
+ message: string;
146
+ }, {
147
+ message: string;
148
+ }>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ status: 400;
151
+ json: {
152
+ message: string;
153
+ };
154
+ }, {
155
+ status: 400;
156
+ json: {
157
+ message: string;
158
+ };
159
+ }>]>;
160
+ };
161
+ };
162
+ "/draft/stat": {
163
+ GET: {
164
+ req: {
165
+ cookies: {
166
+ val_session: z.ZodOptional<z.ZodString>;
167
+ };
168
+ };
169
+ res: z.ZodUnion<[z.ZodObject<{
170
+ status: z.ZodLiteral<401>;
171
+ json: z.ZodObject<{
172
+ message: z.ZodString;
173
+ }, "strip", z.ZodTypeAny, {
174
+ message: string;
175
+ }, {
176
+ message: string;
177
+ }>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ status: 401;
180
+ json: {
181
+ message: string;
182
+ };
183
+ }, {
184
+ status: 401;
185
+ json: {
186
+ message: string;
187
+ };
188
+ }>, z.ZodObject<{
189
+ status: z.ZodLiteral<200>;
190
+ json: z.ZodObject<{
191
+ draftMode: z.ZodBoolean;
192
+ }, "strip", z.ZodTypeAny, {
193
+ draftMode: boolean;
194
+ }, {
195
+ draftMode: boolean;
196
+ }>;
197
+ }, "strip", z.ZodTypeAny, {
198
+ status: 200;
199
+ json: {
200
+ draftMode: boolean;
201
+ };
202
+ }, {
203
+ status: 200;
204
+ json: {
205
+ draftMode: boolean;
206
+ };
207
+ }>]>;
208
+ };
209
+ };
210
+ "/enable": {
211
+ GET: {
212
+ req: {
213
+ query: {
214
+ redirect_to: z.ZodOptional<z.ZodString>;
215
+ };
216
+ cookies: {
217
+ val_session: z.ZodOptional<z.ZodString>;
218
+ };
219
+ };
220
+ res: z.ZodUnion<[z.ZodObject<{
221
+ status: z.ZodLiteral<401>;
222
+ json: z.ZodObject<{
223
+ message: z.ZodString;
224
+ }, "strip", z.ZodTypeAny, {
225
+ message: string;
226
+ }, {
227
+ message: string;
228
+ }>;
229
+ }, "strip", z.ZodTypeAny, {
230
+ status: 401;
231
+ json: {
232
+ message: string;
233
+ };
234
+ }, {
235
+ status: 401;
236
+ json: {
237
+ message: string;
238
+ };
239
+ }>, z.ZodObject<{
240
+ status: z.ZodLiteral<302>;
241
+ redirectTo: z.ZodString;
242
+ cookies: z.ZodObject<{
243
+ val_enable: z.ZodObject<{
244
+ value: z.ZodLiteral<"true">;
245
+ options: z.ZodObject<{
246
+ httpOnly: z.ZodLiteral<false>;
247
+ sameSite: z.ZodLiteral<"lax">;
248
+ }, "strip", z.ZodTypeAny, {
249
+ httpOnly: false;
250
+ sameSite: "lax";
251
+ }, {
252
+ httpOnly: false;
253
+ sameSite: "lax";
254
+ }>;
255
+ }, "strip", z.ZodTypeAny, {
256
+ value: "true";
257
+ options: {
258
+ httpOnly: false;
259
+ sameSite: "lax";
260
+ };
261
+ }, {
262
+ value: "true";
263
+ options: {
264
+ httpOnly: false;
265
+ sameSite: "lax";
266
+ };
267
+ }>;
268
+ val_state: z.ZodObject<{
269
+ value: z.ZodString;
270
+ options: z.ZodObject<{
271
+ httpOnly: z.ZodLiteral<true>;
272
+ sameSite: z.ZodLiteral<"lax">;
273
+ expires: z.ZodType<Date, z.ZodTypeDef, Date>;
274
+ }, "strip", z.ZodTypeAny, {
275
+ httpOnly: true;
276
+ sameSite: "lax";
277
+ expires: Date;
278
+ }, {
279
+ httpOnly: true;
280
+ sameSite: "lax";
281
+ expires: Date;
282
+ }>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ value: string;
285
+ options: {
286
+ httpOnly: true;
287
+ sameSite: "lax";
288
+ expires: Date;
289
+ };
290
+ }, {
291
+ value: string;
292
+ options: {
293
+ httpOnly: true;
294
+ sameSite: "lax";
295
+ expires: Date;
296
+ };
297
+ }>;
298
+ }, "strip", z.ZodTypeAny, {
299
+ val_enable: {
300
+ value: "true";
301
+ options: {
302
+ httpOnly: false;
303
+ sameSite: "lax";
304
+ };
305
+ };
306
+ val_state: {
307
+ value: string;
308
+ options: {
309
+ httpOnly: true;
310
+ sameSite: "lax";
311
+ expires: Date;
312
+ };
313
+ };
314
+ }, {
315
+ val_enable: {
316
+ value: "true";
317
+ options: {
318
+ httpOnly: false;
319
+ sameSite: "lax";
320
+ };
321
+ };
322
+ val_state: {
323
+ value: string;
324
+ options: {
325
+ httpOnly: true;
326
+ sameSite: "lax";
327
+ expires: Date;
328
+ };
329
+ };
330
+ }>;
331
+ }, "strip", z.ZodTypeAny, {
332
+ status: 302;
333
+ redirectTo: string;
334
+ cookies: {
335
+ val_enable: {
336
+ value: "true";
337
+ options: {
338
+ httpOnly: false;
339
+ sameSite: "lax";
340
+ };
341
+ };
342
+ val_state: {
343
+ value: string;
344
+ options: {
345
+ httpOnly: true;
346
+ sameSite: "lax";
347
+ expires: Date;
348
+ };
349
+ };
350
+ };
351
+ }, {
352
+ status: 302;
353
+ redirectTo: string;
354
+ cookies: {
355
+ val_enable: {
356
+ value: "true";
357
+ options: {
358
+ httpOnly: false;
359
+ sameSite: "lax";
360
+ };
361
+ };
362
+ val_state: {
363
+ value: string;
364
+ options: {
365
+ httpOnly: true;
366
+ sameSite: "lax";
367
+ expires: Date;
368
+ };
369
+ };
370
+ };
371
+ }>, z.ZodObject<{
372
+ status: z.ZodLiteral<302>;
373
+ redirectTo: z.ZodString;
374
+ cookies: z.ZodObject<{
375
+ val_enable: z.ZodObject<{
376
+ value: z.ZodLiteral<"true">;
377
+ options: z.ZodObject<{
378
+ httpOnly: z.ZodLiteral<false>;
379
+ sameSite: z.ZodLiteral<"lax">;
380
+ }, "strip", z.ZodTypeAny, {
381
+ httpOnly: false;
382
+ sameSite: "lax";
383
+ }, {
384
+ httpOnly: false;
385
+ sameSite: "lax";
386
+ }>;
387
+ }, "strip", z.ZodTypeAny, {
388
+ value: "true";
389
+ options: {
390
+ httpOnly: false;
391
+ sameSite: "lax";
392
+ };
393
+ }, {
394
+ value: "true";
395
+ options: {
396
+ httpOnly: false;
397
+ sameSite: "lax";
398
+ };
399
+ }>;
400
+ }, "strip", z.ZodTypeAny, {
401
+ val_enable: {
402
+ value: "true";
403
+ options: {
404
+ httpOnly: false;
405
+ sameSite: "lax";
406
+ };
407
+ };
408
+ }, {
409
+ val_enable: {
410
+ value: "true";
411
+ options: {
412
+ httpOnly: false;
413
+ sameSite: "lax";
414
+ };
415
+ };
416
+ }>;
417
+ }, "strip", z.ZodTypeAny, {
418
+ status: 302;
419
+ redirectTo: string;
420
+ cookies: {
421
+ val_enable: {
422
+ value: "true";
423
+ options: {
424
+ httpOnly: false;
425
+ sameSite: "lax";
426
+ };
427
+ };
428
+ };
429
+ }, {
430
+ status: 302;
431
+ redirectTo: string;
432
+ cookies: {
433
+ val_enable: {
434
+ value: "true";
435
+ options: {
436
+ httpOnly: false;
437
+ sameSite: "lax";
438
+ };
439
+ };
440
+ };
441
+ }>, z.ZodObject<{
442
+ status: z.ZodLiteral<400>;
443
+ json: z.ZodObject<{
444
+ message: z.ZodString;
445
+ }, "strip", z.ZodTypeAny, {
446
+ message: string;
447
+ }, {
448
+ message: string;
449
+ }>;
450
+ }, "strip", z.ZodTypeAny, {
451
+ status: 400;
452
+ json: {
453
+ message: string;
454
+ };
455
+ }, {
456
+ status: 400;
457
+ json: {
458
+ message: string;
459
+ };
460
+ }>]>;
461
+ };
462
+ };
463
+ "/disable": {
464
+ GET: {
465
+ req: {
466
+ query: {
467
+ redirect_to: z.ZodOptional<z.ZodString>;
468
+ };
469
+ cookies: {
470
+ val_session: z.ZodOptional<z.ZodString>;
471
+ };
472
+ };
473
+ res: z.ZodUnion<[z.ZodObject<{
474
+ status: z.ZodLiteral<401>;
475
+ json: z.ZodObject<{
476
+ message: z.ZodString;
477
+ }, "strip", z.ZodTypeAny, {
478
+ message: string;
479
+ }, {
480
+ message: string;
481
+ }>;
482
+ }, "strip", z.ZodTypeAny, {
483
+ status: 401;
484
+ json: {
485
+ message: string;
486
+ };
487
+ }, {
488
+ status: 401;
489
+ json: {
490
+ message: string;
491
+ };
492
+ }>, z.ZodObject<{
493
+ status: z.ZodLiteral<302>;
494
+ redirectTo: z.ZodString;
495
+ cookies: z.ZodObject<{
496
+ val_enable: z.ZodObject<{
497
+ value: z.ZodLiteral<"false">;
498
+ }, "strip", z.ZodTypeAny, {
499
+ value: "false";
500
+ }, {
501
+ value: "false";
502
+ }>;
503
+ }, "strip", z.ZodTypeAny, {
504
+ val_enable: {
505
+ value: "false";
506
+ };
507
+ }, {
508
+ val_enable: {
509
+ value: "false";
510
+ };
511
+ }>;
512
+ }, "strip", z.ZodTypeAny, {
513
+ status: 302;
514
+ redirectTo: string;
515
+ cookies: {
516
+ val_enable: {
517
+ value: "false";
518
+ };
519
+ };
520
+ }, {
521
+ status: 302;
522
+ redirectTo: string;
523
+ cookies: {
524
+ val_enable: {
525
+ value: "false";
526
+ };
527
+ };
528
+ }>, z.ZodObject<{
529
+ status: z.ZodLiteral<400>;
530
+ json: z.ZodObject<{
531
+ message: z.ZodString;
532
+ }, "strip", z.ZodTypeAny, {
533
+ message: string;
534
+ }, {
535
+ message: string;
536
+ }>;
537
+ }, "strip", z.ZodTypeAny, {
538
+ status: 400;
539
+ json: {
540
+ message: string;
541
+ };
542
+ }, {
543
+ status: 400;
544
+ json: {
545
+ message: string;
546
+ };
547
+ }>]>;
548
+ };
549
+ };
550
+ "/authorize": {
551
+ GET: {
552
+ req: {
553
+ query: {
554
+ redirect_to: z.ZodOptional<z.ZodString>;
555
+ };
556
+ };
557
+ res: z.ZodUnion<[z.ZodObject<{
558
+ status: z.ZodLiteral<302>;
559
+ redirectTo: z.ZodString;
560
+ cookies: z.ZodObject<{
561
+ val_enable: z.ZodObject<{
562
+ value: z.ZodLiteral<"true">;
563
+ options: z.ZodObject<{
564
+ httpOnly: z.ZodLiteral<false>;
565
+ sameSite: z.ZodLiteral<"lax">;
566
+ }, "strip", z.ZodTypeAny, {
567
+ httpOnly: false;
568
+ sameSite: "lax";
569
+ }, {
570
+ httpOnly: false;
571
+ sameSite: "lax";
572
+ }>;
573
+ }, "strip", z.ZodTypeAny, {
574
+ value: "true";
575
+ options: {
576
+ httpOnly: false;
577
+ sameSite: "lax";
578
+ };
579
+ }, {
580
+ value: "true";
581
+ options: {
582
+ httpOnly: false;
583
+ sameSite: "lax";
584
+ };
585
+ }>;
586
+ val_state: z.ZodObject<{
587
+ value: z.ZodString;
588
+ options: z.ZodObject<{
589
+ httpOnly: z.ZodLiteral<true>;
590
+ sameSite: z.ZodLiteral<"lax">;
591
+ expires: z.ZodType<Date, z.ZodTypeDef, Date>;
592
+ }, "strip", z.ZodTypeAny, {
593
+ httpOnly: true;
594
+ sameSite: "lax";
595
+ expires: Date;
596
+ }, {
597
+ httpOnly: true;
598
+ sameSite: "lax";
599
+ expires: Date;
600
+ }>;
601
+ }, "strip", z.ZodTypeAny, {
602
+ value: string;
603
+ options: {
604
+ httpOnly: true;
605
+ sameSite: "lax";
606
+ expires: Date;
607
+ };
608
+ }, {
609
+ value: string;
610
+ options: {
611
+ httpOnly: true;
612
+ sameSite: "lax";
613
+ expires: Date;
614
+ };
615
+ }>;
616
+ }, "strip", z.ZodTypeAny, {
617
+ val_enable: {
618
+ value: "true";
619
+ options: {
620
+ httpOnly: false;
621
+ sameSite: "lax";
622
+ };
623
+ };
624
+ val_state: {
625
+ value: string;
626
+ options: {
627
+ httpOnly: true;
628
+ sameSite: "lax";
629
+ expires: Date;
630
+ };
631
+ };
632
+ }, {
633
+ val_enable: {
634
+ value: "true";
635
+ options: {
636
+ httpOnly: false;
637
+ sameSite: "lax";
638
+ };
639
+ };
640
+ val_state: {
641
+ value: string;
642
+ options: {
643
+ httpOnly: true;
644
+ sameSite: "lax";
645
+ expires: Date;
646
+ };
647
+ };
648
+ }>;
649
+ }, "strip", z.ZodTypeAny, {
650
+ status: 302;
651
+ redirectTo: string;
652
+ cookies: {
653
+ val_enable: {
654
+ value: "true";
655
+ options: {
656
+ httpOnly: false;
657
+ sameSite: "lax";
658
+ };
659
+ };
660
+ val_state: {
661
+ value: string;
662
+ options: {
663
+ httpOnly: true;
664
+ sameSite: "lax";
665
+ expires: Date;
666
+ };
667
+ };
668
+ };
669
+ }, {
670
+ status: 302;
671
+ redirectTo: string;
672
+ cookies: {
673
+ val_enable: {
674
+ value: "true";
675
+ options: {
676
+ httpOnly: false;
677
+ sameSite: "lax";
678
+ };
679
+ };
680
+ val_state: {
681
+ value: string;
682
+ options: {
683
+ httpOnly: true;
684
+ sameSite: "lax";
685
+ expires: Date;
686
+ };
687
+ };
688
+ };
689
+ }>, z.ZodObject<{
690
+ status: z.ZodLiteral<400>;
691
+ json: z.ZodObject<{
692
+ message: z.ZodString;
693
+ }, "strip", z.ZodTypeAny, {
694
+ message: string;
695
+ }, {
696
+ message: string;
697
+ }>;
698
+ }, "strip", z.ZodTypeAny, {
699
+ status: 400;
700
+ json: {
701
+ message: string;
702
+ };
703
+ }, {
704
+ status: 400;
705
+ json: {
706
+ message: string;
707
+ };
708
+ }>]>;
709
+ };
710
+ };
711
+ "/callback": {
712
+ GET: {
713
+ req: {
714
+ query: {
715
+ code: z.ZodOptional<z.ZodString>;
716
+ state: z.ZodOptional<z.ZodString>;
717
+ };
718
+ cookies: {
719
+ val_state: z.ZodString;
720
+ };
721
+ };
722
+ res: z.ZodObject<{
723
+ status: z.ZodLiteral<302>;
724
+ redirectTo: z.ZodString;
725
+ cookies: z.ZodObject<{
726
+ val_state: z.ZodObject<{
727
+ value: z.ZodLiteral<null>;
728
+ }, "strip", z.ZodTypeAny, {
729
+ value: null;
730
+ }, {
731
+ value: null;
732
+ }>;
733
+ val_enable: z.ZodOptional<z.ZodObject<{
734
+ value: z.ZodLiteral<"true">;
735
+ options: z.ZodObject<{
736
+ httpOnly: z.ZodLiteral<false>;
737
+ sameSite: z.ZodLiteral<"lax">;
738
+ }, "strip", z.ZodTypeAny, {
739
+ httpOnly: false;
740
+ sameSite: "lax";
741
+ }, {
742
+ httpOnly: false;
743
+ sameSite: "lax";
744
+ }>;
745
+ }, "strip", z.ZodTypeAny, {
746
+ value: "true";
747
+ options: {
748
+ httpOnly: false;
749
+ sameSite: "lax";
750
+ };
751
+ }, {
752
+ value: "true";
753
+ options: {
754
+ httpOnly: false;
755
+ sameSite: "lax";
756
+ };
757
+ }>>;
758
+ val_session: z.ZodOptional<z.ZodObject<{
759
+ value: z.ZodString;
760
+ options: z.ZodOptional<z.ZodObject<{
761
+ httpOnly: z.ZodLiteral<true>;
762
+ sameSite: z.ZodLiteral<"strict">;
763
+ path: z.ZodString;
764
+ secure: z.ZodLiteral<true>;
765
+ expires: z.ZodType<Date, z.ZodTypeDef, Date>;
766
+ }, "strip", z.ZodTypeAny, {
767
+ path: string;
768
+ httpOnly: true;
769
+ sameSite: "strict";
770
+ expires: Date;
771
+ secure: true;
772
+ }, {
773
+ path: string;
774
+ httpOnly: true;
775
+ sameSite: "strict";
776
+ expires: Date;
777
+ secure: true;
778
+ }>>;
779
+ }, "strip", z.ZodTypeAny, {
780
+ value: string;
781
+ options?: {
782
+ path: string;
783
+ httpOnly: true;
784
+ sameSite: "strict";
785
+ expires: Date;
786
+ secure: true;
787
+ } | undefined;
788
+ }, {
789
+ value: string;
790
+ options?: {
791
+ path: string;
792
+ httpOnly: true;
793
+ sameSite: "strict";
794
+ expires: Date;
795
+ secure: true;
796
+ } | undefined;
797
+ }>>;
798
+ }, "strip", z.ZodTypeAny, {
799
+ val_state: {
800
+ value: null;
801
+ };
802
+ val_enable?: {
803
+ value: "true";
804
+ options: {
805
+ httpOnly: false;
806
+ sameSite: "lax";
807
+ };
808
+ } | undefined;
809
+ val_session?: {
810
+ value: string;
811
+ options?: {
812
+ path: string;
813
+ httpOnly: true;
814
+ sameSite: "strict";
815
+ expires: Date;
816
+ secure: true;
817
+ } | undefined;
818
+ } | undefined;
819
+ }, {
820
+ val_state: {
821
+ value: null;
822
+ };
823
+ val_enable?: {
824
+ value: "true";
825
+ options: {
826
+ httpOnly: false;
827
+ sameSite: "lax";
828
+ };
829
+ } | undefined;
830
+ val_session?: {
831
+ value: string;
832
+ options?: {
833
+ path: string;
834
+ httpOnly: true;
835
+ sameSite: "strict";
836
+ expires: Date;
837
+ secure: true;
838
+ } | undefined;
839
+ } | undefined;
840
+ }>;
841
+ }, "strip", z.ZodTypeAny, {
842
+ status: 302;
843
+ redirectTo: string;
844
+ cookies: {
845
+ val_state: {
846
+ value: null;
847
+ };
848
+ val_enable?: {
849
+ value: "true";
850
+ options: {
851
+ httpOnly: false;
852
+ sameSite: "lax";
853
+ };
854
+ } | undefined;
855
+ val_session?: {
856
+ value: string;
857
+ options?: {
858
+ path: string;
859
+ httpOnly: true;
860
+ sameSite: "strict";
861
+ expires: Date;
862
+ secure: true;
863
+ } | undefined;
864
+ } | undefined;
865
+ };
866
+ }, {
867
+ status: 302;
868
+ redirectTo: string;
869
+ cookies: {
870
+ val_state: {
871
+ value: null;
872
+ };
873
+ val_enable?: {
874
+ value: "true";
875
+ options: {
876
+ httpOnly: false;
877
+ sameSite: "lax";
878
+ };
879
+ } | undefined;
880
+ val_session?: {
881
+ value: string;
882
+ options?: {
883
+ path: string;
884
+ httpOnly: true;
885
+ sameSite: "strict";
886
+ expires: Date;
887
+ secure: true;
888
+ } | undefined;
889
+ } | undefined;
890
+ };
891
+ }>;
892
+ };
893
+ };
894
+ "/session": {
895
+ GET: {
896
+ req: {
897
+ cookies: {
898
+ val_session: z.ZodOptional<z.ZodString>;
899
+ };
900
+ };
901
+ res: z.ZodUnion<[z.ZodObject<{
902
+ status: z.ZodLiteral<200>;
903
+ json: z.ZodObject<{
904
+ mode: z.ZodUnion<[z.ZodLiteral<"local">, z.ZodLiteral<"proxy">]>;
905
+ enabled: z.ZodBoolean;
906
+ }, "strip", z.ZodTypeAny, {
907
+ mode: "local" | "proxy";
908
+ enabled: boolean;
909
+ }, {
910
+ mode: "local" | "proxy";
911
+ enabled: boolean;
912
+ }>;
913
+ }, "strip", z.ZodTypeAny, {
914
+ status: 200;
915
+ json: {
916
+ mode: "local" | "proxy";
917
+ enabled: boolean;
918
+ };
919
+ }, {
920
+ status: 200;
921
+ json: {
922
+ mode: "local" | "proxy";
923
+ enabled: boolean;
924
+ };
925
+ }>, z.ZodObject<{
926
+ status: z.ZodUnion<[z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>, z.ZodLiteral<501>]>;
927
+ json: z.ZodObject<{
928
+ message: z.ZodString;
929
+ }, "strip", z.ZodTypeAny, {
930
+ message: string;
931
+ }, {
932
+ message: string;
933
+ }>;
934
+ }, "strip", z.ZodTypeAny, {
935
+ status: 400 | 401 | 403 | 404 | 500 | 501;
936
+ json: {
937
+ message: string;
938
+ };
939
+ }, {
940
+ status: 400 | 401 | 403 | 404 | 500 | 501;
941
+ json: {
942
+ message: string;
943
+ };
944
+ }>, z.ZodObject<{
945
+ status: z.ZodLiteral<401>;
946
+ json: z.ZodObject<{
947
+ message: z.ZodString;
948
+ details: z.ZodUnion<[z.ZodString, z.ZodObject<{
949
+ reason: z.ZodString;
950
+ }, "strip", z.ZodTypeAny, {
951
+ reason: string;
952
+ }, {
953
+ reason: string;
954
+ }>, z.ZodObject<{
955
+ sub: z.ZodString;
956
+ exp: z.ZodNumber;
957
+ token: z.ZodString;
958
+ org: z.ZodString;
959
+ project: z.ZodString;
960
+ }, "strip", z.ZodTypeAny, {
961
+ sub: string;
962
+ exp: number;
963
+ token: string;
964
+ org: string;
965
+ project: string;
966
+ }, {
967
+ sub: string;
968
+ exp: number;
969
+ token: string;
970
+ org: string;
971
+ project: string;
972
+ }>]>;
973
+ }, "strip", z.ZodTypeAny, {
974
+ message: string;
975
+ details: string | {
976
+ reason: string;
977
+ } | {
978
+ sub: string;
979
+ exp: number;
980
+ token: string;
981
+ org: string;
982
+ project: string;
983
+ };
984
+ }, {
985
+ message: string;
986
+ details: string | {
987
+ reason: string;
988
+ } | {
989
+ sub: string;
990
+ exp: number;
991
+ token: string;
992
+ org: string;
993
+ project: string;
994
+ };
995
+ }>;
996
+ }, "strip", z.ZodTypeAny, {
997
+ status: 401;
998
+ json: {
999
+ message: string;
1000
+ details: string | {
1001
+ reason: string;
1002
+ } | {
1003
+ sub: string;
1004
+ exp: number;
1005
+ token: string;
1006
+ org: string;
1007
+ project: string;
1008
+ };
1009
+ };
1010
+ }, {
1011
+ status: 401;
1012
+ json: {
1013
+ message: string;
1014
+ details: string | {
1015
+ reason: string;
1016
+ } | {
1017
+ sub: string;
1018
+ exp: number;
1019
+ token: string;
1020
+ org: string;
1021
+ project: string;
1022
+ };
1023
+ };
1024
+ }>, z.ZodObject<{
1025
+ status: z.ZodLiteral<500>;
1026
+ json: z.ZodObject<{
1027
+ message: z.ZodString;
1028
+ }, "strip", z.ZodTypeAny, {
1029
+ message: string;
1030
+ }, {
1031
+ message: string;
1032
+ }>;
1033
+ }, "strip", z.ZodTypeAny, {
1034
+ status: 500;
1035
+ json: {
1036
+ message: string;
1037
+ };
1038
+ }, {
1039
+ status: 500;
1040
+ json: {
1041
+ message: string;
1042
+ };
1043
+ }>]>;
1044
+ };
1045
+ };
1046
+ "/logout": {
1047
+ GET: {
1048
+ req: {};
1049
+ res: z.ZodObject<{
1050
+ status: z.ZodLiteral<200>;
1051
+ cookies: z.ZodObject<{
1052
+ val_session: z.ZodObject<{
1053
+ value: z.ZodLiteral<null>;
1054
+ }, "strip", z.ZodTypeAny, {
1055
+ value: null;
1056
+ }, {
1057
+ value: null;
1058
+ }>;
1059
+ val_state: z.ZodObject<{
1060
+ value: z.ZodLiteral<null>;
1061
+ }, "strip", z.ZodTypeAny, {
1062
+ value: null;
1063
+ }, {
1064
+ value: null;
1065
+ }>;
1066
+ }, "strip", z.ZodTypeAny, {
1067
+ val_state: {
1068
+ value: null;
1069
+ };
1070
+ val_session: {
1071
+ value: null;
1072
+ };
1073
+ }, {
1074
+ val_state: {
1075
+ value: null;
1076
+ };
1077
+ val_session: {
1078
+ value: null;
1079
+ };
1080
+ }>;
1081
+ }, "strip", z.ZodTypeAny, {
1082
+ status: 200;
1083
+ cookies: {
1084
+ val_state: {
1085
+ value: null;
1086
+ };
1087
+ val_session: {
1088
+ value: null;
1089
+ };
1090
+ };
1091
+ }, {
1092
+ status: 200;
1093
+ cookies: {
1094
+ val_state: {
1095
+ value: null;
1096
+ };
1097
+ val_session: {
1098
+ value: null;
1099
+ };
1100
+ };
1101
+ }>;
1102
+ };
1103
+ };
1104
+ "/stat": {
1105
+ POST: {
1106
+ req: {
1107
+ body: z.ZodNullable<z.ZodObject<{
1108
+ schemaSha: z.ZodString;
1109
+ baseSha: z.ZodString;
1110
+ patches: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1111
+ }, "strip", z.ZodTypeAny, {
1112
+ schemaSha: string;
1113
+ baseSha: string;
1114
+ patches?: string[] | undefined;
1115
+ }, {
1116
+ schemaSha: string;
1117
+ baseSha: string;
1118
+ patches?: string[] | undefined;
1119
+ }>>;
1120
+ cookies: {
1121
+ val_session: z.ZodOptional<z.ZodString>;
1122
+ };
1123
+ };
1124
+ res: z.ZodUnion<[z.ZodObject<{
1125
+ status: z.ZodLiteral<401>;
1126
+ json: z.ZodObject<{
1127
+ message: z.ZodString;
1128
+ }, "strip", z.ZodTypeAny, {
1129
+ message: string;
1130
+ }, {
1131
+ message: string;
1132
+ }>;
1133
+ }, "strip", z.ZodTypeAny, {
1134
+ status: 401;
1135
+ json: {
1136
+ message: string;
1137
+ };
1138
+ }, {
1139
+ status: 401;
1140
+ json: {
1141
+ message: string;
1142
+ };
1143
+ }>, z.ZodObject<{
1144
+ status: z.ZodLiteral<500>;
1145
+ json: z.ZodObject<{
1146
+ message: z.ZodString;
1147
+ }, "strip", z.ZodTypeAny, {
1148
+ message: string;
1149
+ }, {
1150
+ message: string;
1151
+ }>;
1152
+ }, "strip", z.ZodTypeAny, {
1153
+ status: 500;
1154
+ json: {
1155
+ message: string;
1156
+ };
1157
+ }, {
1158
+ status: 500;
1159
+ json: {
1160
+ message: string;
1161
+ };
1162
+ }>, z.ZodObject<{
1163
+ status: z.ZodLiteral<200>;
1164
+ json: z.ZodUnion<[z.ZodObject<{
1165
+ type: z.ZodUnion<[z.ZodLiteral<"request-again">, z.ZodLiteral<"no-change">, z.ZodLiteral<"did-change">]>;
1166
+ baseSha: z.ZodString;
1167
+ schemaSha: z.ZodString;
1168
+ patches: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
1169
+ config: z.ZodObject<{
1170
+ project: z.ZodOptional<z.ZodString>;
1171
+ root: z.ZodOptional<z.ZodString>;
1172
+ files: z.ZodOptional<z.ZodObject<{
1173
+ directory: z.ZodString;
1174
+ }, "strip", z.ZodTypeAny, {
1175
+ directory: string;
1176
+ }, {
1177
+ directory: string;
1178
+ }>>;
1179
+ gitCommit: z.ZodOptional<z.ZodString>;
1180
+ gitBranch: z.ZodOptional<z.ZodString>;
1181
+ }, "strip", z.ZodTypeAny, {
1182
+ project?: string | undefined;
1183
+ root?: string | undefined;
1184
+ files?: {
1185
+ directory: string;
1186
+ } | undefined;
1187
+ gitCommit?: string | undefined;
1188
+ gitBranch?: string | undefined;
1189
+ }, {
1190
+ project?: string | undefined;
1191
+ root?: string | undefined;
1192
+ files?: {
1193
+ directory: string;
1194
+ } | undefined;
1195
+ gitCommit?: string | undefined;
1196
+ gitBranch?: string | undefined;
1197
+ }>;
1198
+ }, "strip", z.ZodTypeAny, {
1199
+ type: "request-again" | "no-change" | "did-change";
1200
+ schemaSha: string;
1201
+ baseSha: string;
1202
+ patches: PatchId[];
1203
+ config: {
1204
+ project?: string | undefined;
1205
+ root?: string | undefined;
1206
+ files?: {
1207
+ directory: string;
1208
+ } | undefined;
1209
+ gitCommit?: string | undefined;
1210
+ gitBranch?: string | undefined;
1211
+ };
1212
+ }, {
1213
+ type: "request-again" | "no-change" | "did-change";
1214
+ schemaSha: string;
1215
+ baseSha: string;
1216
+ patches: string[];
1217
+ config: {
1218
+ project?: string | undefined;
1219
+ root?: string | undefined;
1220
+ files?: {
1221
+ directory: string;
1222
+ } | undefined;
1223
+ gitCommit?: string | undefined;
1224
+ gitBranch?: string | undefined;
1225
+ };
1226
+ }>, z.ZodObject<{
1227
+ type: z.ZodLiteral<"use-websocket">;
1228
+ url: z.ZodString;
1229
+ nonce: z.ZodString;
1230
+ baseSha: z.ZodString;
1231
+ schemaSha: z.ZodString;
1232
+ commitSha: z.ZodString;
1233
+ patches: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
1234
+ config: z.ZodObject<{
1235
+ project: z.ZodOptional<z.ZodString>;
1236
+ root: z.ZodOptional<z.ZodString>;
1237
+ files: z.ZodOptional<z.ZodObject<{
1238
+ directory: z.ZodString;
1239
+ }, "strip", z.ZodTypeAny, {
1240
+ directory: string;
1241
+ }, {
1242
+ directory: string;
1243
+ }>>;
1244
+ gitCommit: z.ZodOptional<z.ZodString>;
1245
+ gitBranch: z.ZodOptional<z.ZodString>;
1246
+ }, "strip", z.ZodTypeAny, {
1247
+ project?: string | undefined;
1248
+ root?: string | undefined;
1249
+ files?: {
1250
+ directory: string;
1251
+ } | undefined;
1252
+ gitCommit?: string | undefined;
1253
+ gitBranch?: string | undefined;
1254
+ }, {
1255
+ project?: string | undefined;
1256
+ root?: string | undefined;
1257
+ files?: {
1258
+ directory: string;
1259
+ } | undefined;
1260
+ gitCommit?: string | undefined;
1261
+ gitBranch?: string | undefined;
1262
+ }>;
1263
+ }, "strip", z.ZodTypeAny, {
1264
+ type: "use-websocket";
1265
+ schemaSha: string;
1266
+ baseSha: string;
1267
+ patches: PatchId[];
1268
+ config: {
1269
+ project?: string | undefined;
1270
+ root?: string | undefined;
1271
+ files?: {
1272
+ directory: string;
1273
+ } | undefined;
1274
+ gitCommit?: string | undefined;
1275
+ gitBranch?: string | undefined;
1276
+ };
1277
+ url: string;
1278
+ nonce: string;
1279
+ commitSha: string;
1280
+ }, {
1281
+ type: "use-websocket";
1282
+ schemaSha: string;
1283
+ baseSha: string;
1284
+ patches: string[];
1285
+ config: {
1286
+ project?: string | undefined;
1287
+ root?: string | undefined;
1288
+ files?: {
1289
+ directory: string;
1290
+ } | undefined;
1291
+ gitCommit?: string | undefined;
1292
+ gitBranch?: string | undefined;
1293
+ };
1294
+ url: string;
1295
+ nonce: string;
1296
+ commitSha: string;
1297
+ }>]>;
1298
+ }, "strip", z.ZodTypeAny, {
1299
+ status: 200;
1300
+ json: {
1301
+ type: "request-again" | "no-change" | "did-change";
1302
+ schemaSha: string;
1303
+ baseSha: string;
1304
+ patches: PatchId[];
1305
+ config: {
1306
+ project?: string | undefined;
1307
+ root?: string | undefined;
1308
+ files?: {
1309
+ directory: string;
1310
+ } | undefined;
1311
+ gitCommit?: string | undefined;
1312
+ gitBranch?: string | undefined;
1313
+ };
1314
+ } | {
1315
+ type: "use-websocket";
1316
+ schemaSha: string;
1317
+ baseSha: string;
1318
+ patches: PatchId[];
1319
+ config: {
1320
+ project?: string | undefined;
1321
+ root?: string | undefined;
1322
+ files?: {
1323
+ directory: string;
1324
+ } | undefined;
1325
+ gitCommit?: string | undefined;
1326
+ gitBranch?: string | undefined;
1327
+ };
1328
+ url: string;
1329
+ nonce: string;
1330
+ commitSha: string;
1331
+ };
1332
+ }, {
1333
+ status: 200;
1334
+ json: {
1335
+ type: "request-again" | "no-change" | "did-change";
1336
+ schemaSha: string;
1337
+ baseSha: string;
1338
+ patches: string[];
1339
+ config: {
1340
+ project?: string | undefined;
1341
+ root?: string | undefined;
1342
+ files?: {
1343
+ directory: string;
1344
+ } | undefined;
1345
+ gitCommit?: string | undefined;
1346
+ gitBranch?: string | undefined;
1347
+ };
1348
+ } | {
1349
+ type: "use-websocket";
1350
+ schemaSha: string;
1351
+ baseSha: string;
1352
+ patches: string[];
1353
+ config: {
1354
+ project?: string | undefined;
1355
+ root?: string | undefined;
1356
+ files?: {
1357
+ directory: string;
1358
+ } | undefined;
1359
+ gitCommit?: string | undefined;
1360
+ gitBranch?: string | undefined;
1361
+ };
1362
+ url: string;
1363
+ nonce: string;
1364
+ commitSha: string;
1365
+ };
1366
+ }>]>;
1367
+ };
1368
+ };
1369
+ "/patches/~": {
1370
+ DELETE: {
1371
+ req: {
1372
+ query: {
1373
+ id: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
1374
+ };
1375
+ cookies: {
1376
+ val_session: z.ZodOptional<z.ZodString>;
1377
+ };
1378
+ };
1379
+ res: z.ZodUnion<[z.ZodObject<{
1380
+ status: z.ZodLiteral<401>;
1381
+ json: z.ZodObject<{
1382
+ message: z.ZodString;
1383
+ }, "strip", z.ZodTypeAny, {
1384
+ message: string;
1385
+ }, {
1386
+ message: string;
1387
+ }>;
1388
+ }, "strip", z.ZodTypeAny, {
1389
+ status: 401;
1390
+ json: {
1391
+ message: string;
1392
+ };
1393
+ }, {
1394
+ status: 401;
1395
+ json: {
1396
+ message: string;
1397
+ };
1398
+ }>, z.ZodObject<{
1399
+ status: z.ZodLiteral<500>;
1400
+ json: z.ZodObject<{
1401
+ message: z.ZodString;
1402
+ details: z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
1403
+ message: z.ZodString;
1404
+ }, "strip", z.ZodTypeAny, {
1405
+ message: string;
1406
+ }, {
1407
+ message: string;
1408
+ }>>;
1409
+ }, "strip", z.ZodTypeAny, {
1410
+ message: string;
1411
+ details: Partial<Record<PatchId, {
1412
+ message: string;
1413
+ }>>;
1414
+ }, {
1415
+ message: string;
1416
+ details: Record<string, {
1417
+ message: string;
1418
+ }>;
1419
+ }>;
1420
+ }, "strip", z.ZodTypeAny, {
1421
+ status: 500;
1422
+ json: {
1423
+ message: string;
1424
+ details: Partial<Record<PatchId, {
1425
+ message: string;
1426
+ }>>;
1427
+ };
1428
+ }, {
1429
+ status: 500;
1430
+ json: {
1431
+ message: string;
1432
+ details: Record<string, {
1433
+ message: string;
1434
+ }>;
1435
+ };
1436
+ }>, z.ZodObject<{
1437
+ status: z.ZodLiteral<200>;
1438
+ json: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
1439
+ }, "strip", z.ZodTypeAny, {
1440
+ status: 200;
1441
+ json: PatchId[];
1442
+ }, {
1443
+ status: 200;
1444
+ json: string[];
1445
+ }>]>;
1446
+ };
1447
+ GET: {
1448
+ req: {
1449
+ query: {
1450
+ author: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1451
+ patch_id: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
1452
+ module_file_path: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, ModuleFilePath, string>, "many">>;
1453
+ omit_patch: z.ZodOptional<z.ZodBoolean>;
1454
+ };
1455
+ cookies: {
1456
+ val_session: z.ZodOptional<z.ZodString>;
1457
+ };
1458
+ };
1459
+ res: z.ZodUnion<[z.ZodObject<{
1460
+ status: z.ZodLiteral<401>;
1461
+ json: z.ZodObject<{
1462
+ message: z.ZodString;
1463
+ }, "strip", z.ZodTypeAny, {
1464
+ message: string;
1465
+ }, {
1466
+ message: string;
1467
+ }>;
1468
+ }, "strip", z.ZodTypeAny, {
1469
+ status: 401;
1470
+ json: {
1471
+ message: string;
1472
+ };
1473
+ }, {
1474
+ status: 401;
1475
+ json: {
1476
+ message: string;
1477
+ };
1478
+ }>, z.ZodObject<{
1479
+ status: z.ZodLiteral<500>;
1480
+ json: z.ZodObject<{
1481
+ message: z.ZodString;
1482
+ details: z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
1483
+ message: z.ZodString;
1484
+ }, "strip", z.ZodTypeAny, {
1485
+ message: string;
1486
+ }, {
1487
+ message: string;
1488
+ }>>;
1489
+ }, "strip", z.ZodTypeAny, {
1490
+ message: string;
1491
+ details: Partial<Record<PatchId, {
1492
+ message: string;
1493
+ }>>;
1494
+ }, {
1495
+ message: string;
1496
+ details: Record<string, {
1497
+ message: string;
1498
+ }>;
1499
+ }>;
1500
+ }, "strip", z.ZodTypeAny, {
1501
+ status: 500;
1502
+ json: {
1503
+ message: string;
1504
+ details: Partial<Record<PatchId, {
1505
+ message: string;
1506
+ }>>;
1507
+ };
1508
+ }, {
1509
+ status: 500;
1510
+ json: {
1511
+ message: string;
1512
+ details: Record<string, {
1513
+ message: string;
1514
+ }>;
1515
+ };
1516
+ }>, z.ZodObject<{
1517
+ status: z.ZodLiteral<200>;
1518
+ json: z.ZodObject<{
1519
+ patches: z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
1520
+ path: z.ZodEffects<z.ZodString, ModuleFilePath, string>;
1521
+ patch: z.ZodOptional<z.ZodType<import("@valbuild/core/patch").Patch, z.ZodTypeDef, import("@valbuild/core/patch").Patch>>;
1522
+ createdAt: z.ZodString;
1523
+ authorId: z.ZodNullable<z.ZodString>;
1524
+ appliedAt: z.ZodNullable<z.ZodObject<{
1525
+ baseSha: z.ZodString;
1526
+ git: z.ZodOptional<z.ZodObject<{
1527
+ commitSha: z.ZodString;
1528
+ }, "strip", z.ZodTypeAny, {
1529
+ commitSha: string;
1530
+ }, {
1531
+ commitSha: string;
1532
+ }>>;
1533
+ timestamp: z.ZodString;
1534
+ }, "strip", z.ZodTypeAny, {
1535
+ baseSha: string;
1536
+ timestamp: string;
1537
+ git?: {
1538
+ commitSha: string;
1539
+ } | undefined;
1540
+ }, {
1541
+ baseSha: string;
1542
+ timestamp: string;
1543
+ git?: {
1544
+ commitSha: string;
1545
+ } | undefined;
1546
+ }>>;
1547
+ }, "strip", z.ZodTypeAny, {
1548
+ path: string & {
1549
+ VAL_DATA_TYPE: "ModuleFilePath";
1550
+ };
1551
+ createdAt: string;
1552
+ authorId: string | null;
1553
+ appliedAt: {
1554
+ baseSha: string;
1555
+ timestamp: string;
1556
+ git?: {
1557
+ commitSha: string;
1558
+ } | undefined;
1559
+ } | null;
1560
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1561
+ }, {
1562
+ path: string;
1563
+ createdAt: string;
1564
+ authorId: string | null;
1565
+ appliedAt: {
1566
+ baseSha: string;
1567
+ timestamp: string;
1568
+ git?: {
1569
+ commitSha: string;
1570
+ } | undefined;
1571
+ } | null;
1572
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1573
+ }>>;
1574
+ error: z.ZodOptional<z.ZodObject<{
1575
+ message: z.ZodString;
1576
+ }, "strip", z.ZodTypeAny, {
1577
+ message: string;
1578
+ }, {
1579
+ message: string;
1580
+ }>>;
1581
+ errors: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
1582
+ message: z.ZodString;
1583
+ }, "strip", z.ZodTypeAny, {
1584
+ message: string;
1585
+ }, {
1586
+ message: string;
1587
+ }>>>;
1588
+ }, "strip", z.ZodTypeAny, {
1589
+ patches: Partial<Record<PatchId, {
1590
+ path: string & {
1591
+ VAL_DATA_TYPE: "ModuleFilePath";
1592
+ };
1593
+ createdAt: string;
1594
+ authorId: string | null;
1595
+ appliedAt: {
1596
+ baseSha: string;
1597
+ timestamp: string;
1598
+ git?: {
1599
+ commitSha: string;
1600
+ } | undefined;
1601
+ } | null;
1602
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1603
+ }>>;
1604
+ error?: {
1605
+ message: string;
1606
+ } | undefined;
1607
+ errors?: Partial<Record<PatchId, {
1608
+ message: string;
1609
+ }>> | undefined;
1610
+ }, {
1611
+ patches: Record<string, {
1612
+ path: string;
1613
+ createdAt: string;
1614
+ authorId: string | null;
1615
+ appliedAt: {
1616
+ baseSha: string;
1617
+ timestamp: string;
1618
+ git?: {
1619
+ commitSha: string;
1620
+ } | undefined;
1621
+ } | null;
1622
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1623
+ }>;
1624
+ error?: {
1625
+ message: string;
1626
+ } | undefined;
1627
+ errors?: Record<string, {
1628
+ message: string;
1629
+ }> | undefined;
1630
+ }>;
1631
+ }, "strip", z.ZodTypeAny, {
1632
+ status: 200;
1633
+ json: {
1634
+ patches: Partial<Record<PatchId, {
1635
+ path: string & {
1636
+ VAL_DATA_TYPE: "ModuleFilePath";
1637
+ };
1638
+ createdAt: string;
1639
+ authorId: string | null;
1640
+ appliedAt: {
1641
+ baseSha: string;
1642
+ timestamp: string;
1643
+ git?: {
1644
+ commitSha: string;
1645
+ } | undefined;
1646
+ } | null;
1647
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1648
+ }>>;
1649
+ error?: {
1650
+ message: string;
1651
+ } | undefined;
1652
+ errors?: Partial<Record<PatchId, {
1653
+ message: string;
1654
+ }>> | undefined;
1655
+ };
1656
+ }, {
1657
+ status: 200;
1658
+ json: {
1659
+ patches: Record<string, {
1660
+ path: string;
1661
+ createdAt: string;
1662
+ authorId: string | null;
1663
+ appliedAt: {
1664
+ baseSha: string;
1665
+ timestamp: string;
1666
+ git?: {
1667
+ commitSha: string;
1668
+ } | undefined;
1669
+ } | null;
1670
+ patch?: import("@valbuild/core/patch").Patch | undefined;
1671
+ }>;
1672
+ error?: {
1673
+ message: string;
1674
+ } | undefined;
1675
+ errors?: Record<string, {
1676
+ message: string;
1677
+ }> | undefined;
1678
+ };
1679
+ }>]>;
1680
+ };
1681
+ };
1682
+ "/schema": {
1683
+ GET: {
1684
+ req: {
1685
+ cookies: {
1686
+ val_session: z.ZodOptional<z.ZodString>;
1687
+ };
1688
+ };
1689
+ res: z.ZodUnion<[z.ZodObject<{
1690
+ status: z.ZodLiteral<401>;
1691
+ json: z.ZodObject<{
1692
+ message: z.ZodString;
1693
+ }, "strip", z.ZodTypeAny, {
1694
+ message: string;
1695
+ }, {
1696
+ message: string;
1697
+ }>;
1698
+ }, "strip", z.ZodTypeAny, {
1699
+ status: 401;
1700
+ json: {
1701
+ message: string;
1702
+ };
1703
+ }, {
1704
+ status: 401;
1705
+ json: {
1706
+ message: string;
1707
+ };
1708
+ }>, z.ZodObject<{
1709
+ status: z.ZodLiteral<500>;
1710
+ json: z.ZodObject<{
1711
+ message: z.ZodString;
1712
+ details: z.ZodArray<z.ZodObject<{
1713
+ message: z.ZodString;
1714
+ path: z.ZodOptional<z.ZodEffects<z.ZodString, ModuleFilePath, string>>;
1715
+ }, "strip", z.ZodTypeAny, {
1716
+ message: string;
1717
+ path?: ModuleFilePath | undefined;
1718
+ }, {
1719
+ message: string;
1720
+ path?: string | undefined;
1721
+ }>, "many">;
1722
+ }, "strip", z.ZodTypeAny, {
1723
+ message: string;
1724
+ details: {
1725
+ message: string;
1726
+ path?: ModuleFilePath | undefined;
1727
+ }[];
1728
+ }, {
1729
+ message: string;
1730
+ details: {
1731
+ message: string;
1732
+ path?: string | undefined;
1733
+ }[];
1734
+ }>;
1735
+ }, "strip", z.ZodTypeAny, {
1736
+ status: 500;
1737
+ json: {
1738
+ message: string;
1739
+ details: {
1740
+ message: string;
1741
+ path?: ModuleFilePath | undefined;
1742
+ }[];
1743
+ };
1744
+ }, {
1745
+ status: 500;
1746
+ json: {
1747
+ message: string;
1748
+ details: {
1749
+ message: string;
1750
+ path?: string | undefined;
1751
+ }[];
1752
+ };
1753
+ }>, z.ZodObject<{
1754
+ status: z.ZodLiteral<500>;
1755
+ json: z.ZodObject<{
1756
+ message: z.ZodString;
1757
+ details: z.ZodArray<z.ZodObject<{
1758
+ message: z.ZodString;
1759
+ }, "strip", z.ZodTypeAny, {
1760
+ message: string;
1761
+ }, {
1762
+ message: string;
1763
+ }>, "many">;
1764
+ }, "strip", z.ZodTypeAny, {
1765
+ message: string;
1766
+ details: {
1767
+ message: string;
1768
+ }[];
1769
+ }, {
1770
+ message: string;
1771
+ details: {
1772
+ message: string;
1773
+ }[];
1774
+ }>;
1775
+ }, "strip", z.ZodTypeAny, {
1776
+ status: 500;
1777
+ json: {
1778
+ message: string;
1779
+ details: {
1780
+ message: string;
1781
+ }[];
1782
+ };
1783
+ }, {
1784
+ status: 500;
1785
+ json: {
1786
+ message: string;
1787
+ details: {
1788
+ message: string;
1789
+ }[];
1790
+ };
1791
+ }>, z.ZodObject<{
1792
+ status: z.ZodLiteral<200>;
1793
+ json: z.ZodObject<{
1794
+ schemaSha: z.ZodString;
1795
+ schemas: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodType<import("@valbuild/core").SerializedSchema, z.ZodTypeDef, unknown>>;
1796
+ }, "strip", z.ZodTypeAny, {
1797
+ schemaSha: string;
1798
+ schemas: Partial<Record<ModuleFilePath, import("@valbuild/core").SerializedSchema>>;
1799
+ }, {
1800
+ schemaSha: string;
1801
+ schemas: Record<string, unknown>;
1802
+ }>;
1803
+ }, "strip", z.ZodTypeAny, {
1804
+ status: 200;
1805
+ json: {
1806
+ schemaSha: string;
1807
+ schemas: Partial<Record<ModuleFilePath, import("@valbuild/core").SerializedSchema>>;
1808
+ };
1809
+ }, {
1810
+ status: 200;
1811
+ json: {
1812
+ schemaSha: string;
1813
+ schemas: Record<string, unknown>;
1814
+ };
1815
+ }>]>;
1816
+ };
1817
+ };
1818
+ "/sources": {
1819
+ PUT: {
1820
+ req: {
1821
+ path: z.ZodOptional<z.ZodString>;
1822
+ body: z.ZodOptional<z.ZodObject<{
1823
+ patchIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
1824
+ addPatches: z.ZodOptional<z.ZodArray<z.ZodObject<{
1825
+ path: z.ZodEffects<z.ZodString, ModuleFilePath, string>;
1826
+ patch: z.ZodType<import("@valbuild/core/patch").Patch, z.ZodTypeDef, import("@valbuild/core/patch").Patch>;
1827
+ }, "strip", z.ZodTypeAny, {
1828
+ path: string & {
1829
+ VAL_DATA_TYPE: "ModuleFilePath";
1830
+ };
1831
+ patch: import("@valbuild/core/patch").Patch;
1832
+ }, {
1833
+ path: string;
1834
+ patch: import("@valbuild/core/patch").Patch;
1835
+ }>, "many">>;
1836
+ }, "strip", z.ZodTypeAny, {
1837
+ patchIds?: PatchId[] | undefined;
1838
+ addPatches?: {
1839
+ path: string & {
1840
+ VAL_DATA_TYPE: "ModuleFilePath";
1841
+ };
1842
+ patch: import("@valbuild/core/patch").Patch;
1843
+ }[] | undefined;
1844
+ }, {
1845
+ patchIds?: string[] | undefined;
1846
+ addPatches?: {
1847
+ path: string;
1848
+ patch: import("@valbuild/core/patch").Patch;
1849
+ }[] | undefined;
1850
+ }>>;
1851
+ query: {
1852
+ validate_all: z.ZodOptional<z.ZodBoolean>;
1853
+ validate_sources: z.ZodOptional<z.ZodBoolean>;
1854
+ validate_binary_files: z.ZodOptional<z.ZodBoolean>;
1855
+ };
1856
+ cookies: {
1857
+ val_session: z.ZodOptional<z.ZodString>;
1858
+ };
1859
+ };
1860
+ res: z.ZodUnion<[z.ZodObject<{
1861
+ status: z.ZodLiteral<401>;
1862
+ json: z.ZodObject<{
1863
+ message: z.ZodString;
1864
+ }, "strip", z.ZodTypeAny, {
1865
+ message: string;
1866
+ }, {
1867
+ message: string;
1868
+ }>;
1869
+ }, "strip", z.ZodTypeAny, {
1870
+ status: 401;
1871
+ json: {
1872
+ message: string;
1873
+ };
1874
+ }, {
1875
+ status: 401;
1876
+ json: {
1877
+ message: string;
1878
+ };
1879
+ }>, z.ZodObject<{
1880
+ status: z.ZodLiteral<401>;
1881
+ json: z.ZodObject<{
1882
+ message: z.ZodString;
1883
+ }, "strip", z.ZodTypeAny, {
1884
+ message: string;
1885
+ }, {
1886
+ message: string;
1887
+ }>;
1888
+ }, "strip", z.ZodTypeAny, {
1889
+ status: 401;
1890
+ json: {
1891
+ message: string;
1892
+ };
1893
+ }, {
1894
+ status: 401;
1895
+ json: {
1896
+ message: string;
1897
+ };
1898
+ }>, z.ZodObject<{
1899
+ status: z.ZodLiteral<409>;
1900
+ json: z.ZodObject<{
1901
+ message: z.ZodString;
1902
+ }, "strip", z.ZodTypeAny, {
1903
+ message: string;
1904
+ }, {
1905
+ message: string;
1906
+ }>;
1907
+ }, "strip", z.ZodTypeAny, {
1908
+ status: 409;
1909
+ json: {
1910
+ message: string;
1911
+ };
1912
+ }, {
1913
+ status: 409;
1914
+ json: {
1915
+ message: string;
1916
+ };
1917
+ }>, z.ZodObject<{
1918
+ status: z.ZodLiteral<500>;
1919
+ json: z.ZodObject<{
1920
+ message: z.ZodString;
1921
+ details: z.ZodUnion<[z.ZodArray<z.ZodObject<{
1922
+ message: z.ZodString;
1923
+ path: z.ZodOptional<z.ZodEffects<z.ZodString, ModuleFilePath, string>>;
1924
+ }, "strip", z.ZodTypeAny, {
1925
+ message: string;
1926
+ path?: ModuleFilePath | undefined;
1927
+ }, {
1928
+ message: string;
1929
+ path?: string | undefined;
1930
+ }>, "many">, z.ZodObject<{
1931
+ message: z.ZodString;
1932
+ }, "strip", z.ZodTypeAny, {
1933
+ message: string;
1934
+ }, {
1935
+ message: string;
1936
+ }>]>;
1937
+ }, "strip", z.ZodTypeAny, {
1938
+ message: string;
1939
+ details: {
1940
+ message: string;
1941
+ } | {
1942
+ message: string;
1943
+ path?: ModuleFilePath | undefined;
1944
+ }[];
1945
+ }, {
1946
+ message: string;
1947
+ details: {
1948
+ message: string;
1949
+ } | {
1950
+ message: string;
1951
+ path?: string | undefined;
1952
+ }[];
1953
+ }>;
1954
+ }, "strip", z.ZodTypeAny, {
1955
+ status: 500;
1956
+ json: {
1957
+ message: string;
1958
+ details: {
1959
+ message: string;
1960
+ } | {
1961
+ message: string;
1962
+ path?: ModuleFilePath | undefined;
1963
+ }[];
1964
+ };
1965
+ }, {
1966
+ status: 500;
1967
+ json: {
1968
+ message: string;
1969
+ details: {
1970
+ message: string;
1971
+ } | {
1972
+ message: string;
1973
+ path?: string | undefined;
1974
+ }[];
1975
+ };
1976
+ }>, z.ZodObject<{
1977
+ status: z.ZodLiteral<400>;
1978
+ json: z.ZodObject<{
1979
+ message: z.ZodString;
1980
+ details: z.ZodArray<z.ZodObject<{
1981
+ message: z.ZodString;
1982
+ path: z.ZodOptional<z.ZodEffects<z.ZodString, ModuleFilePath, string>>;
1983
+ }, "strip", z.ZodTypeAny, {
1984
+ message: string;
1985
+ path?: ModuleFilePath | undefined;
1986
+ }, {
1987
+ message: string;
1988
+ path?: string | undefined;
1989
+ }>, "many">;
1990
+ }, "strip", z.ZodTypeAny, {
1991
+ message: string;
1992
+ details: {
1993
+ message: string;
1994
+ path?: ModuleFilePath | undefined;
1995
+ }[];
1996
+ }, {
1997
+ message: string;
1998
+ details: {
1999
+ message: string;
2000
+ path?: string | undefined;
2001
+ }[];
2002
+ }>;
2003
+ }, "strip", z.ZodTypeAny, {
2004
+ status: 400;
2005
+ json: {
2006
+ message: string;
2007
+ details: {
2008
+ message: string;
2009
+ path?: ModuleFilePath | undefined;
2010
+ }[];
2011
+ };
2012
+ }, {
2013
+ status: 400;
2014
+ json: {
2015
+ message: string;
2016
+ details: {
2017
+ message: string;
2018
+ path?: string | undefined;
2019
+ }[];
2020
+ };
2021
+ }>, z.ZodObject<{
2022
+ status: z.ZodLiteral<400>;
2023
+ json: z.ZodObject<{
2024
+ type: z.ZodLiteral<"patch-error">;
2025
+ message: z.ZodString;
2026
+ schemaSha: z.ZodString;
2027
+ modules: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodObject<{
2028
+ source: z.ZodAny;
2029
+ patches: z.ZodOptional<z.ZodObject<{
2030
+ applied: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
2031
+ skipped: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
2032
+ errors: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
2033
+ message: z.ZodString;
2034
+ }, "strip", z.ZodTypeAny, {
2035
+ message: string;
2036
+ }, {
2037
+ message: string;
2038
+ }>>>;
2039
+ }, "strip", z.ZodTypeAny, {
2040
+ applied: PatchId[];
2041
+ errors?: Partial<Record<PatchId, {
2042
+ message: string;
2043
+ }>> | undefined;
2044
+ skipped?: PatchId[] | undefined;
2045
+ }, {
2046
+ applied: string[];
2047
+ errors?: Record<string, {
2048
+ message: string;
2049
+ }> | undefined;
2050
+ skipped?: string[] | undefined;
2051
+ }>>;
2052
+ validationErrors: z.ZodOptional<z.ZodRecord<z.ZodType<import("@valbuild/core").SourcePath, z.ZodTypeDef, unknown>, z.ZodArray<z.ZodObject<{
2053
+ message: z.ZodString;
2054
+ value: z.ZodOptional<z.ZodUnknown>;
2055
+ fatal: z.ZodOptional<z.ZodBoolean>;
2056
+ 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">>;
2057
+ }, "strip", z.ZodTypeAny, {
2058
+ message: string;
2059
+ value?: unknown;
2060
+ fatal?: boolean | undefined;
2061
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2062
+ }, {
2063
+ message: string;
2064
+ value?: unknown;
2065
+ fatal?: boolean | undefined;
2066
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2067
+ }>, "many">>>;
2068
+ }, "strip", z.ZodTypeAny, {
2069
+ patches?: {
2070
+ applied: PatchId[];
2071
+ errors?: Partial<Record<PatchId, {
2072
+ message: string;
2073
+ }>> | undefined;
2074
+ skipped?: PatchId[] | undefined;
2075
+ } | undefined;
2076
+ source?: any;
2077
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
2078
+ message: string;
2079
+ value?: unknown;
2080
+ fatal?: boolean | undefined;
2081
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2082
+ }[]>> | undefined;
2083
+ }, {
2084
+ patches?: {
2085
+ applied: string[];
2086
+ errors?: Record<string, {
2087
+ message: string;
2088
+ }> | undefined;
2089
+ skipped?: string[] | undefined;
2090
+ } | undefined;
2091
+ source?: any;
2092
+ validationErrors?: Record<unknown, {
2093
+ message: string;
2094
+ value?: unknown;
2095
+ fatal?: boolean | undefined;
2096
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2097
+ }[]> | undefined;
2098
+ }>>;
2099
+ errors: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodArray<z.ZodObject<{
2100
+ patchId: z.ZodEffects<z.ZodString, PatchId, string>;
2101
+ skipped: z.ZodBoolean;
2102
+ error: z.ZodObject<{
2103
+ message: z.ZodString;
2104
+ }, "strip", z.ZodTypeAny, {
2105
+ message: string;
2106
+ }, {
2107
+ message: string;
2108
+ }>;
2109
+ }, "strip", z.ZodTypeAny, {
2110
+ error: {
2111
+ message: string;
2112
+ };
2113
+ skipped: boolean;
2114
+ patchId: string & {
2115
+ VAL_DATA_TYPE: "PatchId";
2116
+ };
2117
+ }, {
2118
+ error: {
2119
+ message: string;
2120
+ };
2121
+ skipped: boolean;
2122
+ patchId: string;
2123
+ }>, "many">>;
2124
+ }, "strip", z.ZodTypeAny, {
2125
+ message: string;
2126
+ type: "patch-error";
2127
+ schemaSha: string;
2128
+ errors: Partial<Record<ModuleFilePath, {
2129
+ error: {
2130
+ message: string;
2131
+ };
2132
+ skipped: boolean;
2133
+ patchId: string & {
2134
+ VAL_DATA_TYPE: "PatchId";
2135
+ };
2136
+ }[]>>;
2137
+ modules: Partial<Record<ModuleFilePath, {
2138
+ patches?: {
2139
+ applied: PatchId[];
2140
+ errors?: Partial<Record<PatchId, {
2141
+ message: string;
2142
+ }>> | undefined;
2143
+ skipped?: PatchId[] | undefined;
2144
+ } | undefined;
2145
+ source?: any;
2146
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
2147
+ message: string;
2148
+ value?: unknown;
2149
+ fatal?: boolean | undefined;
2150
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2151
+ }[]>> | undefined;
2152
+ }>>;
2153
+ }, {
2154
+ message: string;
2155
+ type: "patch-error";
2156
+ schemaSha: string;
2157
+ errors: Record<string, {
2158
+ error: {
2159
+ message: string;
2160
+ };
2161
+ skipped: boolean;
2162
+ patchId: string;
2163
+ }[]>;
2164
+ modules: Record<string, {
2165
+ patches?: {
2166
+ applied: string[];
2167
+ errors?: Record<string, {
2168
+ message: string;
2169
+ }> | undefined;
2170
+ skipped?: string[] | undefined;
2171
+ } | undefined;
2172
+ source?: any;
2173
+ validationErrors?: Record<unknown, {
2174
+ message: string;
2175
+ value?: unknown;
2176
+ fatal?: boolean | undefined;
2177
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2178
+ }[]> | undefined;
2179
+ }>;
2180
+ }>;
2181
+ }, "strip", z.ZodTypeAny, {
2182
+ status: 400;
2183
+ json: {
2184
+ message: string;
2185
+ type: "patch-error";
2186
+ schemaSha: string;
2187
+ errors: Partial<Record<ModuleFilePath, {
2188
+ error: {
2189
+ message: string;
2190
+ };
2191
+ skipped: boolean;
2192
+ patchId: string & {
2193
+ VAL_DATA_TYPE: "PatchId";
2194
+ };
2195
+ }[]>>;
2196
+ modules: Partial<Record<ModuleFilePath, {
2197
+ patches?: {
2198
+ applied: PatchId[];
2199
+ errors?: Partial<Record<PatchId, {
2200
+ message: string;
2201
+ }>> | undefined;
2202
+ skipped?: PatchId[] | undefined;
2203
+ } | undefined;
2204
+ source?: any;
2205
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
2206
+ message: string;
2207
+ value?: unknown;
2208
+ fatal?: boolean | undefined;
2209
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2210
+ }[]>> | undefined;
2211
+ }>>;
2212
+ };
2213
+ }, {
2214
+ status: 400;
2215
+ json: {
2216
+ message: string;
2217
+ type: "patch-error";
2218
+ schemaSha: string;
2219
+ errors: Record<string, {
2220
+ error: {
2221
+ message: string;
2222
+ };
2223
+ skipped: boolean;
2224
+ patchId: string;
2225
+ }[]>;
2226
+ modules: Record<string, {
2227
+ patches?: {
2228
+ applied: string[];
2229
+ errors?: Record<string, {
2230
+ message: string;
2231
+ }> | undefined;
2232
+ skipped?: string[] | undefined;
2233
+ } | undefined;
2234
+ source?: any;
2235
+ validationErrors?: Record<unknown, {
2236
+ message: string;
2237
+ value?: unknown;
2238
+ fatal?: boolean | undefined;
2239
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2240
+ }[]> | undefined;
2241
+ }>;
2242
+ };
2243
+ }>, z.ZodObject<{
2244
+ status: z.ZodLiteral<200>;
2245
+ json: z.ZodObject<{
2246
+ schemaSha: z.ZodString;
2247
+ modules: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodObject<{
2248
+ source: z.ZodAny;
2249
+ patches: z.ZodOptional<z.ZodObject<{
2250
+ applied: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
2251
+ skipped: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
2252
+ errors: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodString, PatchId, string>, z.ZodObject<{
2253
+ message: z.ZodString;
2254
+ }, "strip", z.ZodTypeAny, {
2255
+ message: string;
2256
+ }, {
2257
+ message: string;
2258
+ }>>>;
2259
+ }, "strip", z.ZodTypeAny, {
2260
+ applied: PatchId[];
2261
+ errors?: Partial<Record<PatchId, {
2262
+ message: string;
2263
+ }>> | undefined;
2264
+ skipped?: PatchId[] | undefined;
2265
+ }, {
2266
+ applied: string[];
2267
+ errors?: Record<string, {
2268
+ message: string;
2269
+ }> | undefined;
2270
+ skipped?: string[] | undefined;
2271
+ }>>;
2272
+ validationErrors: z.ZodOptional<z.ZodRecord<z.ZodType<import("@valbuild/core").SourcePath, z.ZodTypeDef, unknown>, z.ZodArray<z.ZodObject<{
2273
+ message: z.ZodString;
2274
+ value: z.ZodOptional<z.ZodUnknown>;
2275
+ fatal: z.ZodOptional<z.ZodBoolean>;
2276
+ 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">>;
2277
+ }, "strip", z.ZodTypeAny, {
2278
+ message: string;
2279
+ value?: unknown;
2280
+ fatal?: boolean | undefined;
2281
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2282
+ }, {
2283
+ message: string;
2284
+ value?: unknown;
2285
+ fatal?: boolean | undefined;
2286
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2287
+ }>, "many">>>;
2288
+ }, "strip", z.ZodTypeAny, {
2289
+ patches?: {
2290
+ applied: PatchId[];
2291
+ errors?: Partial<Record<PatchId, {
2292
+ message: string;
2293
+ }>> | undefined;
2294
+ skipped?: PatchId[] | undefined;
2295
+ } | undefined;
2296
+ source?: any;
2297
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
2298
+ message: string;
2299
+ value?: unknown;
2300
+ fatal?: boolean | undefined;
2301
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2302
+ }[]>> | undefined;
2303
+ }, {
2304
+ patches?: {
2305
+ applied: string[];
2306
+ errors?: Record<string, {
2307
+ message: string;
2308
+ }> | undefined;
2309
+ skipped?: string[] | undefined;
2310
+ } | undefined;
2311
+ source?: any;
2312
+ validationErrors?: Record<unknown, {
2313
+ message: string;
2314
+ value?: unknown;
2315
+ fatal?: boolean | undefined;
2316
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2317
+ }[]> | undefined;
2318
+ }>>;
2319
+ newPatchIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">>;
2320
+ }, "strip", z.ZodTypeAny, {
2321
+ schemaSha: string;
2322
+ modules: Partial<Record<ModuleFilePath, {
2323
+ patches?: {
2324
+ applied: PatchId[];
2325
+ errors?: Partial<Record<PatchId, {
2326
+ message: string;
2327
+ }>> | undefined;
2328
+ skipped?: PatchId[] | undefined;
2329
+ } | undefined;
2330
+ source?: any;
2331
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
2332
+ message: string;
2333
+ value?: unknown;
2334
+ fatal?: boolean | undefined;
2335
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2336
+ }[]>> | undefined;
2337
+ }>>;
2338
+ newPatchIds?: PatchId[] | undefined;
2339
+ }, {
2340
+ schemaSha: string;
2341
+ modules: Record<string, {
2342
+ patches?: {
2343
+ applied: string[];
2344
+ errors?: Record<string, {
2345
+ message: string;
2346
+ }> | undefined;
2347
+ skipped?: string[] | undefined;
2348
+ } | undefined;
2349
+ source?: any;
2350
+ validationErrors?: Record<unknown, {
2351
+ message: string;
2352
+ value?: unknown;
2353
+ fatal?: boolean | undefined;
2354
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2355
+ }[]> | undefined;
2356
+ }>;
2357
+ newPatchIds?: string[] | undefined;
2358
+ }>;
2359
+ }, "strip", z.ZodTypeAny, {
2360
+ status: 200;
2361
+ json: {
2362
+ schemaSha: string;
2363
+ modules: Partial<Record<ModuleFilePath, {
2364
+ patches?: {
2365
+ applied: PatchId[];
2366
+ errors?: Partial<Record<PatchId, {
2367
+ message: string;
2368
+ }>> | undefined;
2369
+ skipped?: PatchId[] | undefined;
2370
+ } | undefined;
2371
+ source?: any;
2372
+ validationErrors?: Partial<Record<import("@valbuild/core").SourcePath, {
2373
+ message: string;
2374
+ value?: unknown;
2375
+ fatal?: boolean | undefined;
2376
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2377
+ }[]>> | undefined;
2378
+ }>>;
2379
+ newPatchIds?: PatchId[] | undefined;
2380
+ };
2381
+ }, {
2382
+ status: 200;
2383
+ json: {
2384
+ schemaSha: string;
2385
+ modules: Record<string, {
2386
+ patches?: {
2387
+ applied: string[];
2388
+ errors?: Record<string, {
2389
+ message: string;
2390
+ }> | undefined;
2391
+ skipped?: string[] | undefined;
2392
+ } | undefined;
2393
+ source?: any;
2394
+ validationErrors?: Record<unknown, {
2395
+ message: string;
2396
+ value?: unknown;
2397
+ fatal?: boolean | undefined;
2398
+ fixes?: ("image:add-metadata" | "image:replace-metadata" | "file:add-metadata" | "file:check-metadata" | "fix:deprecated-richtext")[] | undefined;
2399
+ }[]> | undefined;
2400
+ }>;
2401
+ newPatchIds?: string[] | undefined;
2402
+ };
2403
+ }>]>;
2404
+ };
2405
+ };
2406
+ "/save": {
2407
+ POST: {
2408
+ req: {
2409
+ body: z.ZodObject<{
2410
+ patchIds: z.ZodArray<z.ZodEffects<z.ZodString, PatchId, string>, "many">;
2411
+ }, "strip", z.ZodTypeAny, {
2412
+ patchIds: PatchId[];
2413
+ }, {
2414
+ patchIds: string[];
2415
+ }>;
2416
+ cookies: {
2417
+ val_session: z.ZodOptional<z.ZodString>;
2418
+ };
2419
+ };
2420
+ res: z.ZodUnion<[z.ZodObject<{
2421
+ status: z.ZodLiteral<401>;
2422
+ json: z.ZodObject<{
2423
+ message: z.ZodString;
2424
+ }, "strip", z.ZodTypeAny, {
2425
+ message: string;
2426
+ }, {
2427
+ message: string;
2428
+ }>;
2429
+ }, "strip", z.ZodTypeAny, {
2430
+ status: 401;
2431
+ json: {
2432
+ message: string;
2433
+ };
2434
+ }, {
2435
+ status: 401;
2436
+ json: {
2437
+ message: string;
2438
+ };
2439
+ }>, z.ZodObject<{
2440
+ status: z.ZodLiteral<200>;
2441
+ json: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
2442
+ }, "strip", z.ZodTypeAny, {
2443
+ status: 200;
2444
+ json: {};
2445
+ }, {
2446
+ status: 200;
2447
+ json: {};
2448
+ }>, z.ZodObject<{
2449
+ status: z.ZodLiteral<409>;
2450
+ json: z.ZodObject<{
2451
+ message: z.ZodString;
2452
+ isNotFastForward: z.ZodLiteral<true>;
2453
+ }, "strip", z.ZodTypeAny, {
2454
+ message: string;
2455
+ isNotFastForward: true;
2456
+ }, {
2457
+ message: string;
2458
+ isNotFastForward: true;
2459
+ }>;
2460
+ }, "strip", z.ZodTypeAny, {
2461
+ status: 409;
2462
+ json: {
2463
+ message: string;
2464
+ isNotFastForward: true;
2465
+ };
2466
+ }, {
2467
+ status: 409;
2468
+ json: {
2469
+ message: string;
2470
+ isNotFastForward: true;
2471
+ };
2472
+ }>, z.ZodObject<{
2473
+ status: z.ZodLiteral<400>;
2474
+ json: z.ZodObject<{
2475
+ message: z.ZodString;
2476
+ details: z.ZodUnion<[z.ZodObject<{
2477
+ sourceFilePatchErrors: z.ZodRecord<z.ZodEffects<z.ZodString, ModuleFilePath, string>, z.ZodArray<z.ZodObject<{
2478
+ message: z.ZodString;
2479
+ }, "strip", z.ZodTypeAny, {
2480
+ message: string;
2481
+ }, {
2482
+ message: string;
2483
+ }>, "many">>;
2484
+ binaryFilePatchErrors: z.ZodRecord<z.ZodString, z.ZodObject<{
2485
+ message: z.ZodString;
2486
+ }, "strip", z.ZodTypeAny, {
2487
+ message: string;
2488
+ }, {
2489
+ message: string;
2490
+ }>>;
2491
+ }, "strip", z.ZodTypeAny, {
2492
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
2493
+ message: string;
2494
+ }[]>>;
2495
+ binaryFilePatchErrors: Record<string, {
2496
+ message: string;
2497
+ }>;
2498
+ }, {
2499
+ sourceFilePatchErrors: Record<string, {
2500
+ message: string;
2501
+ }[]>;
2502
+ binaryFilePatchErrors: Record<string, {
2503
+ message: string;
2504
+ }>;
2505
+ }>, z.ZodArray<z.ZodObject<{
2506
+ message: z.ZodString;
2507
+ }, "strip", z.ZodTypeAny, {
2508
+ message: string;
2509
+ }, {
2510
+ message: string;
2511
+ }>, "many">]>;
2512
+ }, "strip", z.ZodTypeAny, {
2513
+ message: string;
2514
+ details: {
2515
+ message: string;
2516
+ }[] | {
2517
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
2518
+ message: string;
2519
+ }[]>>;
2520
+ binaryFilePatchErrors: Record<string, {
2521
+ message: string;
2522
+ }>;
2523
+ };
2524
+ }, {
2525
+ message: string;
2526
+ details: {
2527
+ message: string;
2528
+ }[] | {
2529
+ sourceFilePatchErrors: Record<string, {
2530
+ message: string;
2531
+ }[]>;
2532
+ binaryFilePatchErrors: Record<string, {
2533
+ message: string;
2534
+ }>;
2535
+ };
2536
+ }>;
2537
+ }, "strip", z.ZodTypeAny, {
2538
+ status: 400;
2539
+ json: {
2540
+ message: string;
2541
+ details: {
2542
+ message: string;
2543
+ }[] | {
2544
+ sourceFilePatchErrors: Partial<Record<ModuleFilePath, {
2545
+ message: string;
2546
+ }[]>>;
2547
+ binaryFilePatchErrors: Record<string, {
2548
+ message: string;
2549
+ }>;
2550
+ };
2551
+ };
2552
+ }, {
2553
+ status: 400;
2554
+ json: {
2555
+ message: string;
2556
+ details: {
2557
+ message: string;
2558
+ }[] | {
2559
+ sourceFilePatchErrors: Record<string, {
2560
+ message: string;
2561
+ }[]>;
2562
+ binaryFilePatchErrors: Record<string, {
2563
+ message: string;
2564
+ }>;
2565
+ };
2566
+ };
2567
+ }>]>;
2568
+ };
2569
+ };
2570
+ "/files": {
2571
+ GET: {
2572
+ req: {
2573
+ path: z.ZodString;
2574
+ query: {
2575
+ patch_id: z.ZodOptional<z.ZodEffects<z.ZodString, PatchId, string>>;
2576
+ };
2577
+ };
2578
+ res: z.ZodUnion<[z.ZodObject<{
2579
+ status: z.ZodLiteral<200>;
2580
+ body: z.ZodType<ReadableStream<unknown>, z.ZodTypeDef, ReadableStream<unknown>>;
2581
+ }, "strip", z.ZodTypeAny, {
2582
+ status: 200;
2583
+ body: ReadableStream<unknown>;
2584
+ }, {
2585
+ status: 200;
2586
+ body: ReadableStream<unknown>;
2587
+ }>, z.ZodObject<{
2588
+ status: z.ZodLiteral<404>;
2589
+ json: z.ZodObject<{
2590
+ message: z.ZodString;
2591
+ }, "strip", z.ZodTypeAny, {
2592
+ message: string;
2593
+ }, {
2594
+ message: string;
2595
+ }>;
2596
+ }, "strip", z.ZodTypeAny, {
2597
+ status: 404;
2598
+ json: {
2599
+ message: string;
2600
+ };
2601
+ }, {
2602
+ status: 404;
2603
+ json: {
2604
+ message: string;
2605
+ };
2606
+ }>]>;
2607
+ };
2608
+ };
2609
+ };
2610
+ /**
2611
+ * Extracts the keys of an object where the value is not undefined.
2612
+ */
2613
+ type DefinedKeys<T> = {
2614
+ [K in keyof T]-?: T[K] extends undefined ? never : K;
2615
+ }[keyof T];
2616
+ /**
2617
+ * Extracts the keys of an object where the value is not undefined.
2618
+ * Then picks the keys from the object.
2619
+ * This is useful for creating a new object type with only the defined keys.
2620
+ * @example
2621
+ * type A = { a: string; b?: number };
2622
+ * type B = DefinedObject<A>; // { a: string }
2623
+ */
2624
+ type DefinedObject<T> = Pick<T, DefinedKeys<T>>;
2625
+ /**
2626
+ * This schema supports:
2627
+ * 1. multiple query params with the same name
2628
+ * 2. simple API route definitions where:
2629
+ * 2.1. z.array means at least one query params this name is required
2630
+ * 2.2. z.optional means no query param of this name is accepted
2631
+ * 2.3. z.array(...).optional() means zero or more query params of this name is accepted
2632
+ *
2633
+ * Do not change this without updating the ValRouter query parsing logic
2634
+ * */
2635
+ export type ValidQueryParamTypes = boolean | string | string[] | undefined;
2636
+ export type ApiEndpoint = {
2637
+ req: {
2638
+ path?: z.ZodString | z.ZodOptional<z.ZodString>;
2639
+ body?: z.ZodTypeAny;
2640
+ query?: Record<string, z.ZodSchema<ValidQueryParamTypes>>;
2641
+ cookies?: Record<string, z.ZodSchema<string | undefined>>;
2642
+ };
2643
+ res: z.ZodSchema<{
2644
+ status: number;
2645
+ body: unknown;
2646
+ contentType?: string;
2647
+ cookies?: Partial<Record<Cookies, CookieValue>>;
2648
+ } | {
2649
+ status: number;
2650
+ json?: unknown;
2651
+ cookies?: Partial<Record<Cookies, CookieValue>>;
2652
+ } | {
2653
+ cookies?: Partial<Record<Cookies, CookieValue>>;
2654
+ status: 302;
2655
+ redirectTo: string;
2656
+ }>;
2657
+ };
2658
+ type ApiGuard = Record<`/${string}`, Partial<Record<"PUT" | "GET" | "POST" | "DELETE", ApiEndpoint>>>;
2659
+ export type ServerOf<Api extends ApiGuard> = {
2660
+ [Route in keyof Api]: {
2661
+ [Method in keyof Api[Route]]: Api[Route][Method] extends ApiEndpoint ? (req: DefinedObject<{
2662
+ body: Api[Route][Method]["req"]["body"] extends z.ZodTypeAny ? z.infer<Api[Route][Method]["req"]["body"]> : undefined;
2663
+ path: Api[Route][Method]["req"]["path"] extends z.ZodSchema<string | undefined> ? string : undefined;
2664
+ query: Api[Route][Method]["req"]["query"] extends Record<string, z.ZodSchema<ValidQueryParamTypes>> ? {
2665
+ [key in keyof Api[Route][Method]["req"]["query"]]: z.infer<Api[Route][Method]["req"]["query"][key]>;
2666
+ } : undefined;
2667
+ cookies: Api[Route][Method]["req"]["cookies"] extends Record<string, z.ZodSchema<string | undefined>> ? {
2668
+ [key in keyof Api[Route][Method]["req"]["cookies"]]: z.infer<Api[Route][Method]["req"]["cookies"][key]>;
2669
+ } : undefined;
2670
+ }>) => Promise<z.infer<Api[Route][Method]["res"]>> : never;
2671
+ };
2672
+ };
2673
+ 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<{
2674
+ body: Endpoint["req"]["body"] extends z.ZodTypeAny ? z.infer<Endpoint["req"]["body"]> : undefined;
2675
+ path: Endpoint["req"]["path"] extends z.ZodSchema<string | undefined> ? z.infer<Endpoint["req"]["path"]> : undefined;
2676
+ query: Endpoint["req"]["query"] extends Record<string, z.ZodSchema<ValidQueryParamTypes>> ? {
2677
+ [key in keyof Endpoint["req"]["query"]]: z.infer<Endpoint["req"]["query"][key]>;
2678
+ } : undefined;
2679
+ }>) => Promise<z.infer<Endpoint["res"]> | ClientFetchErrors>;
2680
+ export type ClientFetchErrors = {
2681
+ status: 404;
2682
+ json: {
2683
+ message: string;
2684
+ method: string;
2685
+ path: string;
2686
+ };
2687
+ } | {
2688
+ status: 500;
2689
+ json: {
2690
+ message: string;
2691
+ type: "unknown";
2692
+ };
2693
+ } | {
2694
+ status: 504;
2695
+ json: {
2696
+ message: string;
2697
+ };
2698
+ } | {
2699
+ status: null;
2700
+ json: {
2701
+ type: "network_error";
2702
+ retryable: boolean;
2703
+ message: string;
2704
+ details: string;
2705
+ } | {
2706
+ message: string;
2707
+ type: "client_side_validation_error";
2708
+ details: {
2709
+ validationError: string;
2710
+ data: unknown;
2711
+ };
2712
+ };
2713
+ };
2714
+ 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>> ? [
2715
+ route: `/api/val${Route & string}`,
2716
+ query: {
2717
+ [key in keyof Endpoint["req"]["query"]]: z.infer<Endpoint["req"]["query"][key]>;
2718
+ }
2719
+ ] : [route: `/api/val${Route & string}`]) => string;
2720
+ export type Api = {
2721
+ [Route in keyof typeof Api]: {
2722
+ [Method in keyof (typeof Api)[Route]]: (typeof Api)[Route][Method] extends ApiEndpoint ? (typeof Api)[Route][Method] : never;
2723
+ };
2724
+ };
2725
+ export {};