@valbuild/shared 0.84.2 → 0.85.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.
@@ -16,17 +16,17 @@ declare const enableCookieValue: z.ZodObject<{
16
16
  sameSite: "lax";
17
17
  }>;
18
18
  }, "strip", z.ZodTypeAny, {
19
- value: "true";
20
19
  options: {
21
20
  httpOnly: false;
22
21
  sameSite: "lax";
23
22
  };
24
- }, {
25
23
  value: "true";
24
+ }, {
26
25
  options: {
27
26
  httpOnly: false;
28
27
  sameSite: "lax";
29
28
  };
29
+ value: "true";
30
30
  }>;
31
31
  type EnableCookieValue = z.infer<typeof enableCookieValue>;
32
32
  type CookieValue = EnableCookieValue | {
@@ -42,7 +42,7 @@ export declare const Api: {
42
42
  GET: {
43
43
  req: {
44
44
  query: {
45
- redirect_to: z.ZodOptional<z.ZodString>;
45
+ redirect_to: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
46
46
  };
47
47
  cookies: {
48
48
  val_session: z.ZodOptional<z.ZodString>;
@@ -102,7 +102,7 @@ export declare const Api: {
102
102
  GET: {
103
103
  req: {
104
104
  query: {
105
- redirect_to: z.ZodOptional<z.ZodString>;
105
+ redirect_to: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
106
106
  };
107
107
  cookies: {
108
108
  val_session: z.ZodOptional<z.ZodString>;
@@ -210,7 +210,7 @@ export declare const Api: {
210
210
  GET: {
211
211
  req: {
212
212
  query: {
213
- redirect_to: z.ZodOptional<z.ZodString>;
213
+ redirect_to: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
214
214
  };
215
215
  cookies: {
216
216
  val_session: z.ZodOptional<z.ZodString>;
@@ -252,17 +252,17 @@ export declare const Api: {
252
252
  sameSite: "lax";
253
253
  }>;
254
254
  }, "strip", z.ZodTypeAny, {
255
- value: "true";
256
255
  options: {
257
256
  httpOnly: false;
258
257
  sameSite: "lax";
259
258
  };
260
- }, {
261
259
  value: "true";
260
+ }, {
262
261
  options: {
263
262
  httpOnly: false;
264
263
  sameSite: "lax";
265
264
  };
265
+ value: "true";
266
266
  }>;
267
267
  val_state: z.ZodObject<{
268
268
  value: z.ZodString;
@@ -280,51 +280,51 @@ export declare const Api: {
280
280
  expires: Date;
281
281
  }>;
282
282
  }, "strip", z.ZodTypeAny, {
283
- value: string;
284
283
  options: {
285
284
  httpOnly: true;
286
285
  sameSite: "lax";
287
286
  expires: Date;
288
287
  };
289
- }, {
290
288
  value: string;
289
+ }, {
291
290
  options: {
292
291
  httpOnly: true;
293
292
  sameSite: "lax";
294
293
  expires: Date;
295
294
  };
295
+ value: string;
296
296
  }>;
297
297
  }, "strip", z.ZodTypeAny, {
298
298
  val_enable: {
299
- value: "true";
300
299
  options: {
301
300
  httpOnly: false;
302
301
  sameSite: "lax";
303
302
  };
303
+ value: "true";
304
304
  };
305
305
  val_state: {
306
- value: string;
307
306
  options: {
308
307
  httpOnly: true;
309
308
  sameSite: "lax";
310
309
  expires: Date;
311
310
  };
311
+ value: string;
312
312
  };
313
313
  }, {
314
314
  val_enable: {
315
- value: "true";
316
315
  options: {
317
316
  httpOnly: false;
318
317
  sameSite: "lax";
319
318
  };
319
+ value: "true";
320
320
  };
321
321
  val_state: {
322
- value: string;
323
322
  options: {
324
323
  httpOnly: true;
325
324
  sameSite: "lax";
326
325
  expires: Date;
327
326
  };
327
+ value: string;
328
328
  };
329
329
  }>;
330
330
  }, "strip", z.ZodTypeAny, {
@@ -332,19 +332,19 @@ export declare const Api: {
332
332
  redirectTo: string;
333
333
  cookies: {
334
334
  val_enable: {
335
- value: "true";
336
335
  options: {
337
336
  httpOnly: false;
338
337
  sameSite: "lax";
339
338
  };
339
+ value: "true";
340
340
  };
341
341
  val_state: {
342
- value: string;
343
342
  options: {
344
343
  httpOnly: true;
345
344
  sameSite: "lax";
346
345
  expires: Date;
347
346
  };
347
+ value: string;
348
348
  };
349
349
  };
350
350
  }, {
@@ -352,19 +352,19 @@ export declare const Api: {
352
352
  redirectTo: string;
353
353
  cookies: {
354
354
  val_enable: {
355
- value: "true";
356
355
  options: {
357
356
  httpOnly: false;
358
357
  sameSite: "lax";
359
358
  };
359
+ value: "true";
360
360
  };
361
361
  val_state: {
362
- value: string;
363
362
  options: {
364
363
  httpOnly: true;
365
364
  sameSite: "lax";
366
365
  expires: Date;
367
366
  };
367
+ value: string;
368
368
  };
369
369
  };
370
370
  }>, z.ZodObject<{
@@ -384,33 +384,33 @@ export declare const Api: {
384
384
  sameSite: "lax";
385
385
  }>;
386
386
  }, "strip", z.ZodTypeAny, {
387
- value: "true";
388
387
  options: {
389
388
  httpOnly: false;
390
389
  sameSite: "lax";
391
390
  };
392
- }, {
393
391
  value: "true";
392
+ }, {
394
393
  options: {
395
394
  httpOnly: false;
396
395
  sameSite: "lax";
397
396
  };
397
+ value: "true";
398
398
  }>;
399
399
  }, "strip", z.ZodTypeAny, {
400
400
  val_enable: {
401
- value: "true";
402
401
  options: {
403
402
  httpOnly: false;
404
403
  sameSite: "lax";
405
404
  };
405
+ value: "true";
406
406
  };
407
407
  }, {
408
408
  val_enable: {
409
- value: "true";
410
409
  options: {
411
410
  httpOnly: false;
412
411
  sameSite: "lax";
413
412
  };
413
+ value: "true";
414
414
  };
415
415
  }>;
416
416
  }, "strip", z.ZodTypeAny, {
@@ -418,11 +418,11 @@ export declare const Api: {
418
418
  redirectTo: string;
419
419
  cookies: {
420
420
  val_enable: {
421
- value: "true";
422
421
  options: {
423
422
  httpOnly: false;
424
423
  sameSite: "lax";
425
424
  };
425
+ value: "true";
426
426
  };
427
427
  };
428
428
  }, {
@@ -430,11 +430,11 @@ export declare const Api: {
430
430
  redirectTo: string;
431
431
  cookies: {
432
432
  val_enable: {
433
- value: "true";
434
433
  options: {
435
434
  httpOnly: false;
436
435
  sameSite: "lax";
437
436
  };
437
+ value: "true";
438
438
  };
439
439
  };
440
440
  }>, z.ZodObject<{
@@ -463,7 +463,7 @@ export declare const Api: {
463
463
  GET: {
464
464
  req: {
465
465
  query: {
466
- redirect_to: z.ZodOptional<z.ZodString>;
466
+ redirect_to: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
467
467
  };
468
468
  cookies: {
469
469
  val_session: z.ZodOptional<z.ZodString>;
@@ -550,7 +550,7 @@ export declare const Api: {
550
550
  GET: {
551
551
  req: {
552
552
  query: {
553
- redirect_to: z.ZodOptional<z.ZodString>;
553
+ redirect_to: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
554
554
  };
555
555
  };
556
556
  res: z.ZodUnion<[z.ZodObject<{
@@ -570,17 +570,17 @@ export declare const Api: {
570
570
  sameSite: "lax";
571
571
  }>;
572
572
  }, "strip", z.ZodTypeAny, {
573
- value: "true";
574
573
  options: {
575
574
  httpOnly: false;
576
575
  sameSite: "lax";
577
576
  };
578
- }, {
579
577
  value: "true";
578
+ }, {
580
579
  options: {
581
580
  httpOnly: false;
582
581
  sameSite: "lax";
583
582
  };
583
+ value: "true";
584
584
  }>;
585
585
  val_state: z.ZodObject<{
586
586
  value: z.ZodString;
@@ -598,51 +598,51 @@ export declare const Api: {
598
598
  expires: Date;
599
599
  }>;
600
600
  }, "strip", z.ZodTypeAny, {
601
- value: string;
602
601
  options: {
603
602
  httpOnly: true;
604
603
  sameSite: "lax";
605
604
  expires: Date;
606
605
  };
607
- }, {
608
606
  value: string;
607
+ }, {
609
608
  options: {
610
609
  httpOnly: true;
611
610
  sameSite: "lax";
612
611
  expires: Date;
613
612
  };
613
+ value: string;
614
614
  }>;
615
615
  }, "strip", z.ZodTypeAny, {
616
616
  val_enable: {
617
- value: "true";
618
617
  options: {
619
618
  httpOnly: false;
620
619
  sameSite: "lax";
621
620
  };
621
+ value: "true";
622
622
  };
623
623
  val_state: {
624
- value: string;
625
624
  options: {
626
625
  httpOnly: true;
627
626
  sameSite: "lax";
628
627
  expires: Date;
629
628
  };
629
+ value: string;
630
630
  };
631
631
  }, {
632
632
  val_enable: {
633
- value: "true";
634
633
  options: {
635
634
  httpOnly: false;
636
635
  sameSite: "lax";
637
636
  };
637
+ value: "true";
638
638
  };
639
639
  val_state: {
640
- value: string;
641
640
  options: {
642
641
  httpOnly: true;
643
642
  sameSite: "lax";
644
643
  expires: Date;
645
644
  };
645
+ value: string;
646
646
  };
647
647
  }>;
648
648
  }, "strip", z.ZodTypeAny, {
@@ -650,19 +650,19 @@ export declare const Api: {
650
650
  redirectTo: string;
651
651
  cookies: {
652
652
  val_enable: {
653
- value: "true";
654
653
  options: {
655
654
  httpOnly: false;
656
655
  sameSite: "lax";
657
656
  };
657
+ value: "true";
658
658
  };
659
659
  val_state: {
660
- value: string;
661
660
  options: {
662
661
  httpOnly: true;
663
662
  sameSite: "lax";
664
663
  expires: Date;
665
664
  };
665
+ value: string;
666
666
  };
667
667
  };
668
668
  }, {
@@ -670,19 +670,19 @@ export declare const Api: {
670
670
  redirectTo: string;
671
671
  cookies: {
672
672
  val_enable: {
673
- value: "true";
674
673
  options: {
675
674
  httpOnly: false;
676
675
  sameSite: "lax";
677
676
  };
677
+ value: "true";
678
678
  };
679
679
  val_state: {
680
- value: string;
681
680
  options: {
682
681
  httpOnly: true;
683
682
  sameSite: "lax";
684
683
  expires: Date;
685
684
  };
685
+ value: string;
686
686
  };
687
687
  };
688
688
  }>, z.ZodObject<{
@@ -711,8 +711,8 @@ export declare const Api: {
711
711
  GET: {
712
712
  req: {
713
713
  query: {
714
- code: z.ZodOptional<z.ZodString>;
715
- state: z.ZodOptional<z.ZodString>;
714
+ code: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
715
+ state: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
716
716
  };
717
717
  cookies: {
718
718
  val_state: z.ZodString;
@@ -742,17 +742,17 @@ export declare const Api: {
742
742
  sameSite: "lax";
743
743
  }>;
744
744
  }, "strip", z.ZodTypeAny, {
745
- value: "true";
746
745
  options: {
747
746
  httpOnly: false;
748
747
  sameSite: "lax";
749
748
  };
750
- }, {
751
749
  value: "true";
750
+ }, {
752
751
  options: {
753
752
  httpOnly: false;
754
753
  sameSite: "lax";
755
754
  };
755
+ value: "true";
756
756
  }>>;
757
757
  val_session: z.ZodOptional<z.ZodObject<{
758
758
  value: z.ZodString;
@@ -799,11 +799,11 @@ export declare const Api: {
799
799
  value: null;
800
800
  };
801
801
  val_enable?: {
802
- value: "true";
803
802
  options: {
804
803
  httpOnly: false;
805
804
  sameSite: "lax";
806
805
  };
806
+ value: "true";
807
807
  } | undefined;
808
808
  val_session?: {
809
809
  value: string;
@@ -820,11 +820,11 @@ export declare const Api: {
820
820
  value: null;
821
821
  };
822
822
  val_enable?: {
823
- value: "true";
824
823
  options: {
825
824
  httpOnly: false;
826
825
  sameSite: "lax";
827
826
  };
827
+ value: "true";
828
828
  } | undefined;
829
829
  val_session?: {
830
830
  value: string;
@@ -845,11 +845,11 @@ export declare const Api: {
845
845
  value: null;
846
846
  };
847
847
  val_enable?: {
848
- value: "true";
849
848
  options: {
850
849
  httpOnly: false;
851
850
  sameSite: "lax";
852
851
  };
852
+ value: "true";
853
853
  } | undefined;
854
854
  val_session?: {
855
855
  value: string;
@@ -870,11 +870,11 @@ export declare const Api: {
870
870
  value: null;
871
871
  };
872
872
  val_enable?: {
873
- value: "true";
874
873
  options: {
875
874
  httpOnly: false;
876
875
  sameSite: "lax";
877
876
  };
877
+ value: "true";
878
878
  } | undefined;
879
879
  val_session?: {
880
880
  value: string;
@@ -1046,7 +1046,7 @@ export declare const Api: {
1046
1046
  GET: {
1047
1047
  req: {
1048
1048
  query: {
1049
- redirect_to: z.ZodOptional<z.ZodString>;
1049
+ redirect_to: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
1050
1050
  };
1051
1051
  };
1052
1052
  res: z.ZodUnion<[z.ZodObject<{
@@ -2475,7 +2475,7 @@ export declare const Api: {
2475
2475
  req: {
2476
2476
  query: {
2477
2477
  patch_id: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, import("@valbuild/core").PatchId, string>, "many">>;
2478
- exclude_patch_ops: z.ZodOptional<z.ZodBoolean>;
2478
+ exclude_patch_ops: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>, string, string[]>, boolean, string[]>>;
2479
2479
  };
2480
2480
  cookies: {
2481
2481
  val_session: z.ZodOptional<z.ZodString>;
@@ -2895,8 +2895,8 @@ export declare const Api: {
2895
2895
  req: {
2896
2896
  path: z.ZodOptional<z.ZodString>;
2897
2897
  query: {
2898
- validate_sources: z.ZodOptional<z.ZodBoolean>;
2899
- validate_binary_files: z.ZodOptional<z.ZodBoolean>;
2898
+ validate_sources: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>, string, string[]>, boolean, string[]>>;
2899
+ validate_binary_files: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>, string, string[]>, boolean, string[]>>;
2900
2900
  };
2901
2901
  cookies: {
2902
2902
  val_session: z.ZodOptional<z.ZodString>;
@@ -3601,8 +3601,8 @@ export declare const Api: {
3601
3601
  req: {
3602
3602
  path: z.ZodString;
3603
3603
  query: {
3604
- patch_id: z.ZodOptional<z.ZodEffects<z.ZodString, import("@valbuild/core").PatchId, string>>;
3605
- remote: z.ZodOptional<z.ZodString>;
3604
+ patch_id: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodString, import("@valbuild/core").PatchId, string>, "many">, import("@valbuild/core").PatchId, string[]>>;
3605
+ remote: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string, string[]>>;
3606
3606
  };
3607
3607
  };
3608
3608
  res: z.ZodUnion<[z.ZodObject<{
@@ -3686,7 +3686,7 @@ export type ApiEndpoint = {
3686
3686
  req: {
3687
3687
  path?: z.ZodString | z.ZodOptional<z.ZodString>;
3688
3688
  body?: z.ZodTypeAny;
3689
- query?: Record<string, z.ZodSchema<ValidQueryParamTypes>>;
3689
+ query?: Record<string, z.ZodSchema<ValidQueryParamTypes, z.ZodTypeDef, string[] | undefined>>;
3690
3690
  cookies?: Record<string, z.ZodSchema<string | undefined>>;
3691
3691
  };
3692
3692
  res: z.ZodSchema<{
@@ -1396,12 +1396,20 @@ var enableCookieValue = zod.z.object({
1396
1396
  sameSite: zod.z.literal("lax")
1397
1397
  })
1398
1398
  });
1399
+ var onlyOneStringQueryParam = zod.z.array(zod.z.string()).max(1, "At most one query param is allowed").transform(function (arg) {
1400
+ return arg[0];
1401
+ });
1402
+ var onlyOneBooleanQueryParam = onlyOneStringQueryParam.refine(function (arg) {
1403
+ return arg === "true" || arg === "false";
1404
+ }, "Value must be true or false").transform(function (arg) {
1405
+ return arg === "true";
1406
+ });
1399
1407
  var Api = {
1400
1408
  "/draft/enable": {
1401
1409
  GET: {
1402
1410
  req: {
1403
1411
  query: {
1404
- redirect_to: zod.z.string().optional()
1412
+ redirect_to: onlyOneStringQueryParam.optional()
1405
1413
  },
1406
1414
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1407
1415
  },
@@ -1423,7 +1431,7 @@ var Api = {
1423
1431
  GET: {
1424
1432
  req: {
1425
1433
  query: {
1426
- redirect_to: zod.z.string().optional()
1434
+ redirect_to: onlyOneStringQueryParam.optional()
1427
1435
  },
1428
1436
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1429
1437
  },
@@ -1461,7 +1469,7 @@ var Api = {
1461
1469
  GET: {
1462
1470
  req: {
1463
1471
  query: {
1464
- redirect_to: zod.z.string().optional()
1472
+ redirect_to: onlyOneStringQueryParam.optional()
1465
1473
  },
1466
1474
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1467
1475
  },
@@ -1495,7 +1503,7 @@ var Api = {
1495
1503
  GET: {
1496
1504
  req: {
1497
1505
  query: {
1498
- redirect_to: zod.z.string().optional()
1506
+ redirect_to: onlyOneStringQueryParam.optional()
1499
1507
  },
1500
1508
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1501
1509
  },
@@ -1520,7 +1528,7 @@ var Api = {
1520
1528
  GET: {
1521
1529
  req: {
1522
1530
  query: {
1523
- redirect_to: zod.z.string().optional()
1531
+ redirect_to: onlyOneStringQueryParam.optional()
1524
1532
  }
1525
1533
  },
1526
1534
  res: zod.z.union([zod.z.object({
@@ -1546,8 +1554,8 @@ var Api = {
1546
1554
  GET: {
1547
1555
  req: {
1548
1556
  query: {
1549
- code: zod.z.string().optional(),
1550
- state: zod.z.string().optional()
1557
+ code: onlyOneStringQueryParam.optional(),
1558
+ state: onlyOneStringQueryParam.optional()
1551
1559
  },
1552
1560
  cookies: _defineProperty({}, VAL_STATE_COOKIE, zod.z.string())
1553
1561
  },
@@ -1615,7 +1623,7 @@ var Api = {
1615
1623
  GET: {
1616
1624
  req: {
1617
1625
  query: {
1618
- redirect_to: zod.z.string().optional()
1626
+ redirect_to: onlyOneStringQueryParam.optional()
1619
1627
  }
1620
1628
  },
1621
1629
  // TODO fix req types
@@ -1808,7 +1816,7 @@ var Api = {
1808
1816
  DELETE: {
1809
1817
  req: {
1810
1818
  query: {
1811
- id: zod.z.array(PatchId)
1819
+ id: zod.z.array(PatchId).min(1, "At least one patch id is required")
1812
1820
  },
1813
1821
  cookies: {
1814
1822
  val_session: zod.z.string().optional()
@@ -1867,7 +1875,7 @@ var Api = {
1867
1875
  req: {
1868
1876
  query: {
1869
1877
  patch_id: zod.z.array(PatchId).optional(),
1870
- exclude_patch_ops: zod.z["boolean"]().optional()
1878
+ exclude_patch_ops: onlyOneBooleanQueryParam.optional()
1871
1879
  },
1872
1880
  cookies: {
1873
1881
  val_session: zod.z.string().optional()
@@ -1938,8 +1946,8 @@ var Api = {
1938
1946
  req: {
1939
1947
  path: zod.z.string().optional(),
1940
1948
  query: {
1941
- validate_sources: zod.z["boolean"]().optional(),
1942
- validate_binary_files: zod.z["boolean"]().optional()
1949
+ validate_sources: onlyOneBooleanQueryParam.optional(),
1950
+ validate_binary_files: onlyOneBooleanQueryParam.optional()
1943
1951
  },
1944
1952
  cookies: {
1945
1953
  val_session: zod.z.string().optional()
@@ -2073,8 +2081,10 @@ var Api = {
2073
2081
  req: {
2074
2082
  path: zod.z.string(),
2075
2083
  query: {
2076
- patch_id: PatchId.optional(),
2077
- remote: zod.z.string().optional()
2084
+ patch_id: zod.z.array(PatchId).max(1, "At most one patch id is allowed").transform(function (arg) {
2085
+ return arg[0];
2086
+ }).optional(),
2087
+ remote: onlyOneStringQueryParam.optional()
2078
2088
  }
2079
2089
  },
2080
2090
  res: zod.z.union([unauthorizedResponse, notFoundResponse, zod.z.object({
@@ -1396,12 +1396,20 @@ var enableCookieValue = zod.z.object({
1396
1396
  sameSite: zod.z.literal("lax")
1397
1397
  })
1398
1398
  });
1399
+ var onlyOneStringQueryParam = zod.z.array(zod.z.string()).max(1, "At most one query param is allowed").transform(function (arg) {
1400
+ return arg[0];
1401
+ });
1402
+ var onlyOneBooleanQueryParam = onlyOneStringQueryParam.refine(function (arg) {
1403
+ return arg === "true" || arg === "false";
1404
+ }, "Value must be true or false").transform(function (arg) {
1405
+ return arg === "true";
1406
+ });
1399
1407
  var Api = {
1400
1408
  "/draft/enable": {
1401
1409
  GET: {
1402
1410
  req: {
1403
1411
  query: {
1404
- redirect_to: zod.z.string().optional()
1412
+ redirect_to: onlyOneStringQueryParam.optional()
1405
1413
  },
1406
1414
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1407
1415
  },
@@ -1423,7 +1431,7 @@ var Api = {
1423
1431
  GET: {
1424
1432
  req: {
1425
1433
  query: {
1426
- redirect_to: zod.z.string().optional()
1434
+ redirect_to: onlyOneStringQueryParam.optional()
1427
1435
  },
1428
1436
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1429
1437
  },
@@ -1461,7 +1469,7 @@ var Api = {
1461
1469
  GET: {
1462
1470
  req: {
1463
1471
  query: {
1464
- redirect_to: zod.z.string().optional()
1472
+ redirect_to: onlyOneStringQueryParam.optional()
1465
1473
  },
1466
1474
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1467
1475
  },
@@ -1495,7 +1503,7 @@ var Api = {
1495
1503
  GET: {
1496
1504
  req: {
1497
1505
  query: {
1498
- redirect_to: zod.z.string().optional()
1506
+ redirect_to: onlyOneStringQueryParam.optional()
1499
1507
  },
1500
1508
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1501
1509
  },
@@ -1520,7 +1528,7 @@ var Api = {
1520
1528
  GET: {
1521
1529
  req: {
1522
1530
  query: {
1523
- redirect_to: zod.z.string().optional()
1531
+ redirect_to: onlyOneStringQueryParam.optional()
1524
1532
  }
1525
1533
  },
1526
1534
  res: zod.z.union([zod.z.object({
@@ -1546,8 +1554,8 @@ var Api = {
1546
1554
  GET: {
1547
1555
  req: {
1548
1556
  query: {
1549
- code: zod.z.string().optional(),
1550
- state: zod.z.string().optional()
1557
+ code: onlyOneStringQueryParam.optional(),
1558
+ state: onlyOneStringQueryParam.optional()
1551
1559
  },
1552
1560
  cookies: _defineProperty({}, VAL_STATE_COOKIE, zod.z.string())
1553
1561
  },
@@ -1615,7 +1623,7 @@ var Api = {
1615
1623
  GET: {
1616
1624
  req: {
1617
1625
  query: {
1618
- redirect_to: zod.z.string().optional()
1626
+ redirect_to: onlyOneStringQueryParam.optional()
1619
1627
  }
1620
1628
  },
1621
1629
  // TODO fix req types
@@ -1808,7 +1816,7 @@ var Api = {
1808
1816
  DELETE: {
1809
1817
  req: {
1810
1818
  query: {
1811
- id: zod.z.array(PatchId)
1819
+ id: zod.z.array(PatchId).min(1, "At least one patch id is required")
1812
1820
  },
1813
1821
  cookies: {
1814
1822
  val_session: zod.z.string().optional()
@@ -1867,7 +1875,7 @@ var Api = {
1867
1875
  req: {
1868
1876
  query: {
1869
1877
  patch_id: zod.z.array(PatchId).optional(),
1870
- exclude_patch_ops: zod.z["boolean"]().optional()
1878
+ exclude_patch_ops: onlyOneBooleanQueryParam.optional()
1871
1879
  },
1872
1880
  cookies: {
1873
1881
  val_session: zod.z.string().optional()
@@ -1938,8 +1946,8 @@ var Api = {
1938
1946
  req: {
1939
1947
  path: zod.z.string().optional(),
1940
1948
  query: {
1941
- validate_sources: zod.z["boolean"]().optional(),
1942
- validate_binary_files: zod.z["boolean"]().optional()
1949
+ validate_sources: onlyOneBooleanQueryParam.optional(),
1950
+ validate_binary_files: onlyOneBooleanQueryParam.optional()
1943
1951
  },
1944
1952
  cookies: {
1945
1953
  val_session: zod.z.string().optional()
@@ -2073,8 +2081,10 @@ var Api = {
2073
2081
  req: {
2074
2082
  path: zod.z.string(),
2075
2083
  query: {
2076
- patch_id: PatchId.optional(),
2077
- remote: zod.z.string().optional()
2084
+ patch_id: zod.z.array(PatchId).max(1, "At most one patch id is allowed").transform(function (arg) {
2085
+ return arg[0];
2086
+ }).optional(),
2087
+ remote: onlyOneStringQueryParam.optional()
2078
2088
  }
2079
2089
  },
2080
2090
  res: zod.z.union([unauthorizedResponse, notFoundResponse, zod.z.object({
@@ -1392,12 +1392,20 @@ var enableCookieValue = z.object({
1392
1392
  sameSite: z.literal("lax")
1393
1393
  })
1394
1394
  });
1395
+ var onlyOneStringQueryParam = z.array(z.string()).max(1, "At most one query param is allowed").transform(function (arg) {
1396
+ return arg[0];
1397
+ });
1398
+ var onlyOneBooleanQueryParam = onlyOneStringQueryParam.refine(function (arg) {
1399
+ return arg === "true" || arg === "false";
1400
+ }, "Value must be true or false").transform(function (arg) {
1401
+ return arg === "true";
1402
+ });
1395
1403
  var Api = {
1396
1404
  "/draft/enable": {
1397
1405
  GET: {
1398
1406
  req: {
1399
1407
  query: {
1400
- redirect_to: z.string().optional()
1408
+ redirect_to: onlyOneStringQueryParam.optional()
1401
1409
  },
1402
1410
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
1403
1411
  },
@@ -1419,7 +1427,7 @@ var Api = {
1419
1427
  GET: {
1420
1428
  req: {
1421
1429
  query: {
1422
- redirect_to: z.string().optional()
1430
+ redirect_to: onlyOneStringQueryParam.optional()
1423
1431
  },
1424
1432
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
1425
1433
  },
@@ -1457,7 +1465,7 @@ var Api = {
1457
1465
  GET: {
1458
1466
  req: {
1459
1467
  query: {
1460
- redirect_to: z.string().optional()
1468
+ redirect_to: onlyOneStringQueryParam.optional()
1461
1469
  },
1462
1470
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
1463
1471
  },
@@ -1491,7 +1499,7 @@ var Api = {
1491
1499
  GET: {
1492
1500
  req: {
1493
1501
  query: {
1494
- redirect_to: z.string().optional()
1502
+ redirect_to: onlyOneStringQueryParam.optional()
1495
1503
  },
1496
1504
  cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
1497
1505
  },
@@ -1516,7 +1524,7 @@ var Api = {
1516
1524
  GET: {
1517
1525
  req: {
1518
1526
  query: {
1519
- redirect_to: z.string().optional()
1527
+ redirect_to: onlyOneStringQueryParam.optional()
1520
1528
  }
1521
1529
  },
1522
1530
  res: z.union([z.object({
@@ -1542,8 +1550,8 @@ var Api = {
1542
1550
  GET: {
1543
1551
  req: {
1544
1552
  query: {
1545
- code: z.string().optional(),
1546
- state: z.string().optional()
1553
+ code: onlyOneStringQueryParam.optional(),
1554
+ state: onlyOneStringQueryParam.optional()
1547
1555
  },
1548
1556
  cookies: _defineProperty({}, VAL_STATE_COOKIE, z.string())
1549
1557
  },
@@ -1611,7 +1619,7 @@ var Api = {
1611
1619
  GET: {
1612
1620
  req: {
1613
1621
  query: {
1614
- redirect_to: z.string().optional()
1622
+ redirect_to: onlyOneStringQueryParam.optional()
1615
1623
  }
1616
1624
  },
1617
1625
  // TODO fix req types
@@ -1804,7 +1812,7 @@ var Api = {
1804
1812
  DELETE: {
1805
1813
  req: {
1806
1814
  query: {
1807
- id: z.array(PatchId)
1815
+ id: z.array(PatchId).min(1, "At least one patch id is required")
1808
1816
  },
1809
1817
  cookies: {
1810
1818
  val_session: z.string().optional()
@@ -1863,7 +1871,7 @@ var Api = {
1863
1871
  req: {
1864
1872
  query: {
1865
1873
  patch_id: z.array(PatchId).optional(),
1866
- exclude_patch_ops: z["boolean"]().optional()
1874
+ exclude_patch_ops: onlyOneBooleanQueryParam.optional()
1867
1875
  },
1868
1876
  cookies: {
1869
1877
  val_session: z.string().optional()
@@ -1934,8 +1942,8 @@ var Api = {
1934
1942
  req: {
1935
1943
  path: z.string().optional(),
1936
1944
  query: {
1937
- validate_sources: z["boolean"]().optional(),
1938
- validate_binary_files: z["boolean"]().optional()
1945
+ validate_sources: onlyOneBooleanQueryParam.optional(),
1946
+ validate_binary_files: onlyOneBooleanQueryParam.optional()
1939
1947
  },
1940
1948
  cookies: {
1941
1949
  val_session: z.string().optional()
@@ -2069,8 +2077,10 @@ var Api = {
2069
2077
  req: {
2070
2078
  path: z.string(),
2071
2079
  query: {
2072
- patch_id: PatchId.optional(),
2073
- remote: z.string().optional()
2080
+ patch_id: z.array(PatchId).max(1, "At most one patch id is allowed").transform(function (arg) {
2081
+ return arg[0];
2082
+ }).optional(),
2083
+ remote: onlyOneStringQueryParam.optional()
2074
2084
  }
2075
2085
  },
2076
2086
  res: z.union([unauthorizedResponse, notFoundResponse, z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.84.2",
3
+ "version": "0.85.0",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "exports": true
30
30
  },
31
31
  "dependencies": {
32
- "@valbuild/core": "~0.84.2",
32
+ "@valbuild/core": "~0.85.0",
33
33
  "zod": "^3.22.4",
34
34
  "zod-validation-error": "^3.3.0"
35
35
  },