better-call 1.0.0-beta.4 → 1.0.0-beta.6

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.
@@ -82,6 +82,7 @@ type Prettify<T> = {
82
82
  } & {};
83
83
  type IsEmptyObject<T> = keyof T extends never ? true : false;
84
84
  type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends (mergedIntersection: infer Intersection) => void ? Intersection & Union : never;
85
+ type MergeObject<T extends Record<string, any> | never, S extends Record<string, any> | never> = T extends never ? S : S extends never ? T : T & S;
85
86
  type InferParamPath<Path> = Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
86
87
  [K in Param | keyof InferParamPath<Rest>]: string;
87
88
  } : Path extends `${infer _Start}:${infer Param}` ? {
@@ -870,7 +871,473 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
870
871
  };
871
872
  declare const createEndpoint: {
872
873
  <Path extends string, Options extends EndpointOptions, R>(path: Path, options: Options, handler: (context: EndpointContext<Path, Options>) => Promise<R>): {
873
- <Context extends InputContext<Path, Options>>(...inputCtx: HasRequiredKeys<Context> extends true ? [Context] : [Context?]): Promise<Context["asResponse"] extends true ? Response : Context["returnHeaders"] extends true ? {
874
+ <C extends HasRequiredKeys<({
875
+ body: InferBodyInput<Options>;
876
+ method: InferInputMethod<Options>;
877
+ query: InferQueryInput<Options>;
878
+ params: InferParam<Path>;
879
+ request: InferRequest<Options>;
880
+ headers: InferHeadersInput<Options>;
881
+ asResponse?: boolean;
882
+ returnHeaders?: boolean;
883
+ use?: Middleware[];
884
+ path?: string;
885
+ } extends infer T_3 ? { [K_1 in keyof T_3 as {
886
+ body: InferBodyInput<Options>;
887
+ method: InferInputMethod<Options>;
888
+ query: InferQueryInput<Options>;
889
+ params: InferParam<Path>;
890
+ request: InferRequest<Options>;
891
+ headers: InferHeadersInput<Options>;
892
+ asResponse?: boolean;
893
+ returnHeaders?: boolean;
894
+ use?: Middleware[];
895
+ path?: string;
896
+ }[K_1] extends never ? never : undefined extends {
897
+ body: InferBodyInput<Options>;
898
+ method: InferInputMethod<Options>;
899
+ query: InferQueryInput<Options>;
900
+ params: InferParam<Path>;
901
+ request: InferRequest<Options>;
902
+ headers: InferHeadersInput<Options>;
903
+ asResponse?: boolean;
904
+ returnHeaders?: boolean;
905
+ use?: Middleware[];
906
+ path?: string;
907
+ }[K_1] ? never : K_1]: {
908
+ body: InferBodyInput<Options>;
909
+ method: InferInputMethod<Options>;
910
+ query: InferQueryInput<Options>;
911
+ params: InferParam<Path>;
912
+ request: InferRequest<Options>;
913
+ headers: InferHeadersInput<Options>;
914
+ asResponse?: boolean;
915
+ returnHeaders?: boolean;
916
+ use?: Middleware[];
917
+ path?: string;
918
+ }[K_1]; } : never) & ({
919
+ body: InferBodyInput<Options>;
920
+ method: InferInputMethod<Options>;
921
+ query: InferQueryInput<Options>;
922
+ params: InferParam<Path>;
923
+ request: InferRequest<Options>;
924
+ headers: InferHeadersInput<Options>;
925
+ asResponse?: boolean;
926
+ returnHeaders?: boolean;
927
+ use?: Middleware[];
928
+ path?: string;
929
+ } extends infer T_4 ? { [K_2 in keyof T_4 as undefined extends {
930
+ body: InferBodyInput<Options>;
931
+ method: InferInputMethod<Options>;
932
+ query: InferQueryInput<Options>;
933
+ params: InferParam<Path>;
934
+ request: InferRequest<Options>;
935
+ headers: InferHeadersInput<Options>;
936
+ asResponse?: boolean;
937
+ returnHeaders?: boolean;
938
+ use?: Middleware[];
939
+ path?: string;
940
+ }[K_2] ? K_2 : never]?: {
941
+ body: InferBodyInput<Options>;
942
+ method: InferInputMethod<Options>;
943
+ query: InferQueryInput<Options>;
944
+ params: InferParam<Path>;
945
+ request: InferRequest<Options>;
946
+ headers: InferHeadersInput<Options>;
947
+ asResponse?: boolean;
948
+ returnHeaders?: boolean;
949
+ use?: Middleware[];
950
+ path?: string;
951
+ }[K_2] | undefined; } : never) extends infer T ? { [K in keyof T]: (({
952
+ body: InferBodyInput<Options>;
953
+ method: InferInputMethod<Options>;
954
+ query: InferQueryInput<Options>;
955
+ params: InferParam<Path>;
956
+ request: InferRequest<Options>;
957
+ headers: InferHeadersInput<Options>;
958
+ asResponse?: boolean;
959
+ returnHeaders?: boolean;
960
+ use?: Middleware[];
961
+ path?: string;
962
+ } extends infer T_1 ? { [K_1 in keyof T_1 as {
963
+ body: InferBodyInput<Options>;
964
+ method: InferInputMethod<Options>;
965
+ query: InferQueryInput<Options>;
966
+ params: InferParam<Path>;
967
+ request: InferRequest<Options>;
968
+ headers: InferHeadersInput<Options>;
969
+ asResponse?: boolean;
970
+ returnHeaders?: boolean;
971
+ use?: Middleware[];
972
+ path?: string;
973
+ }[K_1] extends never ? never : undefined extends {
974
+ body: InferBodyInput<Options>;
975
+ method: InferInputMethod<Options>;
976
+ query: InferQueryInput<Options>;
977
+ params: InferParam<Path>;
978
+ request: InferRequest<Options>;
979
+ headers: InferHeadersInput<Options>;
980
+ asResponse?: boolean;
981
+ returnHeaders?: boolean;
982
+ use?: Middleware[];
983
+ path?: string;
984
+ }[K_1] ? never : K_1]: {
985
+ body: InferBodyInput<Options>;
986
+ method: InferInputMethod<Options>;
987
+ query: InferQueryInput<Options>;
988
+ params: InferParam<Path>;
989
+ request: InferRequest<Options>;
990
+ headers: InferHeadersInput<Options>;
991
+ asResponse?: boolean;
992
+ returnHeaders?: boolean;
993
+ use?: Middleware[];
994
+ path?: string;
995
+ }[K_1]; } : never) & ({
996
+ body: InferBodyInput<Options>;
997
+ method: InferInputMethod<Options>;
998
+ query: InferQueryInput<Options>;
999
+ params: InferParam<Path>;
1000
+ request: InferRequest<Options>;
1001
+ headers: InferHeadersInput<Options>;
1002
+ asResponse?: boolean;
1003
+ returnHeaders?: boolean;
1004
+ use?: Middleware[];
1005
+ path?: string;
1006
+ } extends infer T_2 ? { [K_2 in keyof T_2 as undefined extends {
1007
+ body: InferBodyInput<Options>;
1008
+ method: InferInputMethod<Options>;
1009
+ query: InferQueryInput<Options>;
1010
+ params: InferParam<Path>;
1011
+ request: InferRequest<Options>;
1012
+ headers: InferHeadersInput<Options>;
1013
+ asResponse?: boolean;
1014
+ returnHeaders?: boolean;
1015
+ use?: Middleware[];
1016
+ path?: string;
1017
+ }[K_2] ? K_2 : never]?: {
1018
+ body: InferBodyInput<Options>;
1019
+ method: InferInputMethod<Options>;
1020
+ query: InferQueryInput<Options>;
1021
+ params: InferParam<Path>;
1022
+ request: InferRequest<Options>;
1023
+ headers: InferHeadersInput<Options>;
1024
+ asResponse?: boolean;
1025
+ returnHeaders?: boolean;
1026
+ use?: Middleware[];
1027
+ path?: string;
1028
+ }[K_2] | undefined; } : never))[K]; } : never> extends true ? [({
1029
+ body: InferBodyInput<Options>;
1030
+ method: InferInputMethod<Options>;
1031
+ query: InferQueryInput<Options>;
1032
+ params: InferParam<Path>;
1033
+ request: InferRequest<Options>;
1034
+ headers: InferHeadersInput<Options>;
1035
+ asResponse?: boolean;
1036
+ returnHeaders?: boolean;
1037
+ use?: Middleware[];
1038
+ path?: string;
1039
+ } extends infer T_8 ? { [K_1 in keyof T_8 as {
1040
+ body: InferBodyInput<Options>;
1041
+ method: InferInputMethod<Options>;
1042
+ query: InferQueryInput<Options>;
1043
+ params: InferParam<Path>;
1044
+ request: InferRequest<Options>;
1045
+ headers: InferHeadersInput<Options>;
1046
+ asResponse?: boolean;
1047
+ returnHeaders?: boolean;
1048
+ use?: Middleware[];
1049
+ path?: string;
1050
+ }[K_1] extends never ? never : undefined extends {
1051
+ body: InferBodyInput<Options>;
1052
+ method: InferInputMethod<Options>;
1053
+ query: InferQueryInput<Options>;
1054
+ params: InferParam<Path>;
1055
+ request: InferRequest<Options>;
1056
+ headers: InferHeadersInput<Options>;
1057
+ asResponse?: boolean;
1058
+ returnHeaders?: boolean;
1059
+ use?: Middleware[];
1060
+ path?: string;
1061
+ }[K_1] ? never : K_1]: {
1062
+ body: InferBodyInput<Options>;
1063
+ method: InferInputMethod<Options>;
1064
+ query: InferQueryInput<Options>;
1065
+ params: InferParam<Path>;
1066
+ request: InferRequest<Options>;
1067
+ headers: InferHeadersInput<Options>;
1068
+ asResponse?: boolean;
1069
+ returnHeaders?: boolean;
1070
+ use?: Middleware[];
1071
+ path?: string;
1072
+ }[K_1]; } : never) & ({
1073
+ body: InferBodyInput<Options>;
1074
+ method: InferInputMethod<Options>;
1075
+ query: InferQueryInput<Options>;
1076
+ params: InferParam<Path>;
1077
+ request: InferRequest<Options>;
1078
+ headers: InferHeadersInput<Options>;
1079
+ asResponse?: boolean;
1080
+ returnHeaders?: boolean;
1081
+ use?: Middleware[];
1082
+ path?: string;
1083
+ } extends infer T_9 ? { [K_2 in keyof T_9 as undefined extends {
1084
+ body: InferBodyInput<Options>;
1085
+ method: InferInputMethod<Options>;
1086
+ query: InferQueryInput<Options>;
1087
+ params: InferParam<Path>;
1088
+ request: InferRequest<Options>;
1089
+ headers: InferHeadersInput<Options>;
1090
+ asResponse?: boolean;
1091
+ returnHeaders?: boolean;
1092
+ use?: Middleware[];
1093
+ path?: string;
1094
+ }[K_2] ? K_2 : never]?: {
1095
+ body: InferBodyInput<Options>;
1096
+ method: InferInputMethod<Options>;
1097
+ query: InferQueryInput<Options>;
1098
+ params: InferParam<Path>;
1099
+ request: InferRequest<Options>;
1100
+ headers: InferHeadersInput<Options>;
1101
+ asResponse?: boolean;
1102
+ returnHeaders?: boolean;
1103
+ use?: Middleware[];
1104
+ path?: string;
1105
+ }[K_2] | undefined; } : never) extends infer T_5 ? { [K in keyof T_5]: (({
1106
+ body: InferBodyInput<Options>;
1107
+ method: InferInputMethod<Options>;
1108
+ query: InferQueryInput<Options>;
1109
+ params: InferParam<Path>;
1110
+ request: InferRequest<Options>;
1111
+ headers: InferHeadersInput<Options>;
1112
+ asResponse?: boolean;
1113
+ returnHeaders?: boolean;
1114
+ use?: Middleware[];
1115
+ path?: string;
1116
+ } extends infer T_6 ? { [K_1 in keyof T_6 as {
1117
+ body: InferBodyInput<Options>;
1118
+ method: InferInputMethod<Options>;
1119
+ query: InferQueryInput<Options>;
1120
+ params: InferParam<Path>;
1121
+ request: InferRequest<Options>;
1122
+ headers: InferHeadersInput<Options>;
1123
+ asResponse?: boolean;
1124
+ returnHeaders?: boolean;
1125
+ use?: Middleware[];
1126
+ path?: string;
1127
+ }[K_1] extends never ? never : undefined extends {
1128
+ body: InferBodyInput<Options>;
1129
+ method: InferInputMethod<Options>;
1130
+ query: InferQueryInput<Options>;
1131
+ params: InferParam<Path>;
1132
+ request: InferRequest<Options>;
1133
+ headers: InferHeadersInput<Options>;
1134
+ asResponse?: boolean;
1135
+ returnHeaders?: boolean;
1136
+ use?: Middleware[];
1137
+ path?: string;
1138
+ }[K_1] ? never : K_1]: {
1139
+ body: InferBodyInput<Options>;
1140
+ method: InferInputMethod<Options>;
1141
+ query: InferQueryInput<Options>;
1142
+ params: InferParam<Path>;
1143
+ request: InferRequest<Options>;
1144
+ headers: InferHeadersInput<Options>;
1145
+ asResponse?: boolean;
1146
+ returnHeaders?: boolean;
1147
+ use?: Middleware[];
1148
+ path?: string;
1149
+ }[K_1]; } : never) & ({
1150
+ body: InferBodyInput<Options>;
1151
+ method: InferInputMethod<Options>;
1152
+ query: InferQueryInput<Options>;
1153
+ params: InferParam<Path>;
1154
+ request: InferRequest<Options>;
1155
+ headers: InferHeadersInput<Options>;
1156
+ asResponse?: boolean;
1157
+ returnHeaders?: boolean;
1158
+ use?: Middleware[];
1159
+ path?: string;
1160
+ } extends infer T_7 ? { [K_2 in keyof T_7 as undefined extends {
1161
+ body: InferBodyInput<Options>;
1162
+ method: InferInputMethod<Options>;
1163
+ query: InferQueryInput<Options>;
1164
+ params: InferParam<Path>;
1165
+ request: InferRequest<Options>;
1166
+ headers: InferHeadersInput<Options>;
1167
+ asResponse?: boolean;
1168
+ returnHeaders?: boolean;
1169
+ use?: Middleware[];
1170
+ path?: string;
1171
+ }[K_2] ? K_2 : never]?: {
1172
+ body: InferBodyInput<Options>;
1173
+ method: InferInputMethod<Options>;
1174
+ query: InferQueryInput<Options>;
1175
+ params: InferParam<Path>;
1176
+ request: InferRequest<Options>;
1177
+ headers: InferHeadersInput<Options>;
1178
+ asResponse?: boolean;
1179
+ returnHeaders?: boolean;
1180
+ use?: Middleware[];
1181
+ path?: string;
1182
+ }[K_2] | undefined; } : never))[K]; } : never] : [(({
1183
+ body: InferBodyInput<Options>;
1184
+ method: InferInputMethod<Options>;
1185
+ query: InferQueryInput<Options>;
1186
+ params: InferParam<Path>;
1187
+ request: InferRequest<Options>;
1188
+ headers: InferHeadersInput<Options>;
1189
+ asResponse?: boolean;
1190
+ returnHeaders?: boolean;
1191
+ use?: Middleware[];
1192
+ path?: string;
1193
+ } extends infer T_8 ? { [K_1 in keyof T_8 as {
1194
+ body: InferBodyInput<Options>;
1195
+ method: InferInputMethod<Options>;
1196
+ query: InferQueryInput<Options>;
1197
+ params: InferParam<Path>;
1198
+ request: InferRequest<Options>;
1199
+ headers: InferHeadersInput<Options>;
1200
+ asResponse?: boolean;
1201
+ returnHeaders?: boolean;
1202
+ use?: Middleware[];
1203
+ path?: string;
1204
+ }[K_1] extends never ? never : undefined extends {
1205
+ body: InferBodyInput<Options>;
1206
+ method: InferInputMethod<Options>;
1207
+ query: InferQueryInput<Options>;
1208
+ params: InferParam<Path>;
1209
+ request: InferRequest<Options>;
1210
+ headers: InferHeadersInput<Options>;
1211
+ asResponse?: boolean;
1212
+ returnHeaders?: boolean;
1213
+ use?: Middleware[];
1214
+ path?: string;
1215
+ }[K_1] ? never : K_1]: {
1216
+ body: InferBodyInput<Options>;
1217
+ method: InferInputMethod<Options>;
1218
+ query: InferQueryInput<Options>;
1219
+ params: InferParam<Path>;
1220
+ request: InferRequest<Options>;
1221
+ headers: InferHeadersInput<Options>;
1222
+ asResponse?: boolean;
1223
+ returnHeaders?: boolean;
1224
+ use?: Middleware[];
1225
+ path?: string;
1226
+ }[K_1]; } : never) & ({
1227
+ body: InferBodyInput<Options>;
1228
+ method: InferInputMethod<Options>;
1229
+ query: InferQueryInput<Options>;
1230
+ params: InferParam<Path>;
1231
+ request: InferRequest<Options>;
1232
+ headers: InferHeadersInput<Options>;
1233
+ asResponse?: boolean;
1234
+ returnHeaders?: boolean;
1235
+ use?: Middleware[];
1236
+ path?: string;
1237
+ } extends infer T_9 ? { [K_2 in keyof T_9 as undefined extends {
1238
+ body: InferBodyInput<Options>;
1239
+ method: InferInputMethod<Options>;
1240
+ query: InferQueryInput<Options>;
1241
+ params: InferParam<Path>;
1242
+ request: InferRequest<Options>;
1243
+ headers: InferHeadersInput<Options>;
1244
+ asResponse?: boolean;
1245
+ returnHeaders?: boolean;
1246
+ use?: Middleware[];
1247
+ path?: string;
1248
+ }[K_2] ? K_2 : never]?: {
1249
+ body: InferBodyInput<Options>;
1250
+ method: InferInputMethod<Options>;
1251
+ query: InferQueryInput<Options>;
1252
+ params: InferParam<Path>;
1253
+ request: InferRequest<Options>;
1254
+ headers: InferHeadersInput<Options>;
1255
+ asResponse?: boolean;
1256
+ returnHeaders?: boolean;
1257
+ use?: Middleware[];
1258
+ path?: string;
1259
+ }[K_2] | undefined; } : never) extends infer T_5 ? { [K in keyof T_5]: (({
1260
+ body: InferBodyInput<Options>;
1261
+ method: InferInputMethod<Options>;
1262
+ query: InferQueryInput<Options>;
1263
+ params: InferParam<Path>;
1264
+ request: InferRequest<Options>;
1265
+ headers: InferHeadersInput<Options>;
1266
+ asResponse?: boolean;
1267
+ returnHeaders?: boolean;
1268
+ use?: Middleware[];
1269
+ path?: string;
1270
+ } extends infer T_6 ? { [K_1 in keyof T_6 as {
1271
+ body: InferBodyInput<Options>;
1272
+ method: InferInputMethod<Options>;
1273
+ query: InferQueryInput<Options>;
1274
+ params: InferParam<Path>;
1275
+ request: InferRequest<Options>;
1276
+ headers: InferHeadersInput<Options>;
1277
+ asResponse?: boolean;
1278
+ returnHeaders?: boolean;
1279
+ use?: Middleware[];
1280
+ path?: string;
1281
+ }[K_1] extends never ? never : undefined extends {
1282
+ body: InferBodyInput<Options>;
1283
+ method: InferInputMethod<Options>;
1284
+ query: InferQueryInput<Options>;
1285
+ params: InferParam<Path>;
1286
+ request: InferRequest<Options>;
1287
+ headers: InferHeadersInput<Options>;
1288
+ asResponse?: boolean;
1289
+ returnHeaders?: boolean;
1290
+ use?: Middleware[];
1291
+ path?: string;
1292
+ }[K_1] ? never : K_1]: {
1293
+ body: InferBodyInput<Options>;
1294
+ method: InferInputMethod<Options>;
1295
+ query: InferQueryInput<Options>;
1296
+ params: InferParam<Path>;
1297
+ request: InferRequest<Options>;
1298
+ headers: InferHeadersInput<Options>;
1299
+ asResponse?: boolean;
1300
+ returnHeaders?: boolean;
1301
+ use?: Middleware[];
1302
+ path?: string;
1303
+ }[K_1]; } : never) & ({
1304
+ body: InferBodyInput<Options>;
1305
+ method: InferInputMethod<Options>;
1306
+ query: InferQueryInput<Options>;
1307
+ params: InferParam<Path>;
1308
+ request: InferRequest<Options>;
1309
+ headers: InferHeadersInput<Options>;
1310
+ asResponse?: boolean;
1311
+ returnHeaders?: boolean;
1312
+ use?: Middleware[];
1313
+ path?: string;
1314
+ } extends infer T_7 ? { [K_2 in keyof T_7 as undefined extends {
1315
+ body: InferBodyInput<Options>;
1316
+ method: InferInputMethod<Options>;
1317
+ query: InferQueryInput<Options>;
1318
+ params: InferParam<Path>;
1319
+ request: InferRequest<Options>;
1320
+ headers: InferHeadersInput<Options>;
1321
+ asResponse?: boolean;
1322
+ returnHeaders?: boolean;
1323
+ use?: Middleware[];
1324
+ path?: string;
1325
+ }[K_2] ? K_2 : never]?: {
1326
+ body: InferBodyInput<Options>;
1327
+ method: InferInputMethod<Options>;
1328
+ query: InferQueryInput<Options>;
1329
+ params: InferParam<Path>;
1330
+ request: InferRequest<Options>;
1331
+ headers: InferHeadersInput<Options>;
1332
+ asResponse?: boolean;
1333
+ returnHeaders?: boolean;
1334
+ use?: Middleware[];
1335
+ path?: string;
1336
+ }[K_2] | undefined; } : never))[K]; } : never)?]>(...inputCtx: C): Promise<C extends [{
1337
+ asResponse: true;
1338
+ }] ? Response : C extends [{
1339
+ returnHeaders: true;
1340
+ }] ? {
874
1341
  headers: Headers;
875
1342
  response: R;
876
1343
  } : R>;
@@ -880,7 +1347,7 @@ declare const createEndpoint: {
880
1347
  create<E extends {
881
1348
  use?: Middleware[];
882
1349
  }>(opts?: E): <Path extends string, Opts extends EndpointOptions, R>(path: Path, options: Opts, handler: (ctx: EndpointContext<Path, Opts, InferUse<E["use"]>>) => Promise<R>) => {
883
- <Context extends ({
1350
+ <C extends HasRequiredKeys<({
884
1351
  body: InferBodyInput<Opts & {
885
1352
  use: any[];
886
1353
  }>;
@@ -1174,7 +1641,599 @@ declare const createEndpoint: {
1174
1641
  returnHeaders?: boolean;
1175
1642
  use?: Middleware[];
1176
1643
  path?: string;
1177
- }[K_2] | undefined; } : never))[K]; } : never>(...inputCtx: HasRequiredKeys<Context> extends true ? [Context] : [(Context | undefined)?]): Promise<Context["asResponse"] extends true ? Response : Context["returnHeaders"] extends true ? {
1644
+ }[K_2] | undefined; } : never))[K]; } : never> extends true ? [({
1645
+ body: InferBodyInput<Opts & {
1646
+ use: any[];
1647
+ }>;
1648
+ method: InferInputMethod<Opts & {
1649
+ use: any[];
1650
+ }>;
1651
+ query: InferQueryInput<Opts & {
1652
+ use: any[];
1653
+ }>;
1654
+ params: InferParam<Path>;
1655
+ request: InferRequest<Opts & {
1656
+ use: any[];
1657
+ }>;
1658
+ headers: InferHeadersInput<Opts & {
1659
+ use: any[];
1660
+ }>;
1661
+ asResponse?: boolean;
1662
+ returnHeaders?: boolean;
1663
+ use?: Middleware[];
1664
+ path?: string;
1665
+ } extends infer T_8 ? { [K_1 in keyof T_8 as {
1666
+ body: InferBodyInput<Opts & {
1667
+ use: any[];
1668
+ }>;
1669
+ method: InferInputMethod<Opts & {
1670
+ use: any[];
1671
+ }>;
1672
+ query: InferQueryInput<Opts & {
1673
+ use: any[];
1674
+ }>;
1675
+ params: InferParam<Path>;
1676
+ request: InferRequest<Opts & {
1677
+ use: any[];
1678
+ }>;
1679
+ headers: InferHeadersInput<Opts & {
1680
+ use: any[];
1681
+ }>;
1682
+ asResponse?: boolean;
1683
+ returnHeaders?: boolean;
1684
+ use?: Middleware[];
1685
+ path?: string;
1686
+ }[K_1] extends never ? never : undefined extends {
1687
+ body: InferBodyInput<Opts & {
1688
+ use: any[];
1689
+ }>;
1690
+ method: InferInputMethod<Opts & {
1691
+ use: any[];
1692
+ }>;
1693
+ query: InferQueryInput<Opts & {
1694
+ use: any[];
1695
+ }>;
1696
+ params: InferParam<Path>;
1697
+ request: InferRequest<Opts & {
1698
+ use: any[];
1699
+ }>;
1700
+ headers: InferHeadersInput<Opts & {
1701
+ use: any[];
1702
+ }>;
1703
+ asResponse?: boolean;
1704
+ returnHeaders?: boolean;
1705
+ use?: Middleware[];
1706
+ path?: string;
1707
+ }[K_1] ? never : K_1]: {
1708
+ body: InferBodyInput<Opts & {
1709
+ use: any[];
1710
+ }>;
1711
+ method: InferInputMethod<Opts & {
1712
+ use: any[];
1713
+ }>;
1714
+ query: InferQueryInput<Opts & {
1715
+ use: any[];
1716
+ }>;
1717
+ params: InferParam<Path>;
1718
+ request: InferRequest<Opts & {
1719
+ use: any[];
1720
+ }>;
1721
+ headers: InferHeadersInput<Opts & {
1722
+ use: any[];
1723
+ }>;
1724
+ asResponse?: boolean;
1725
+ returnHeaders?: boolean;
1726
+ use?: Middleware[];
1727
+ path?: string;
1728
+ }[K_1]; } : never) & ({
1729
+ body: InferBodyInput<Opts & {
1730
+ use: any[];
1731
+ }>;
1732
+ method: InferInputMethod<Opts & {
1733
+ use: any[];
1734
+ }>;
1735
+ query: InferQueryInput<Opts & {
1736
+ use: any[];
1737
+ }>;
1738
+ params: InferParam<Path>;
1739
+ request: InferRequest<Opts & {
1740
+ use: any[];
1741
+ }>;
1742
+ headers: InferHeadersInput<Opts & {
1743
+ use: any[];
1744
+ }>;
1745
+ asResponse?: boolean;
1746
+ returnHeaders?: boolean;
1747
+ use?: Middleware[];
1748
+ path?: string;
1749
+ } extends infer T_9 ? { [K_2 in keyof T_9 as undefined extends {
1750
+ body: InferBodyInput<Opts & {
1751
+ use: any[];
1752
+ }>;
1753
+ method: InferInputMethod<Opts & {
1754
+ use: any[];
1755
+ }>;
1756
+ query: InferQueryInput<Opts & {
1757
+ use: any[];
1758
+ }>;
1759
+ params: InferParam<Path>;
1760
+ request: InferRequest<Opts & {
1761
+ use: any[];
1762
+ }>;
1763
+ headers: InferHeadersInput<Opts & {
1764
+ use: any[];
1765
+ }>;
1766
+ asResponse?: boolean;
1767
+ returnHeaders?: boolean;
1768
+ use?: Middleware[];
1769
+ path?: string;
1770
+ }[K_2] ? K_2 : never]?: {
1771
+ body: InferBodyInput<Opts & {
1772
+ use: any[];
1773
+ }>;
1774
+ method: InferInputMethod<Opts & {
1775
+ use: any[];
1776
+ }>;
1777
+ query: InferQueryInput<Opts & {
1778
+ use: any[];
1779
+ }>;
1780
+ params: InferParam<Path>;
1781
+ request: InferRequest<Opts & {
1782
+ use: any[];
1783
+ }>;
1784
+ headers: InferHeadersInput<Opts & {
1785
+ use: any[];
1786
+ }>;
1787
+ asResponse?: boolean;
1788
+ returnHeaders?: boolean;
1789
+ use?: Middleware[];
1790
+ path?: string;
1791
+ }[K_2] | undefined; } : never) extends infer T_5 ? { [K in keyof T_5]: (({
1792
+ body: InferBodyInput<Opts & {
1793
+ use: any[];
1794
+ }>;
1795
+ method: InferInputMethod<Opts & {
1796
+ use: any[];
1797
+ }>;
1798
+ query: InferQueryInput<Opts & {
1799
+ use: any[];
1800
+ }>;
1801
+ params: InferParam<Path>;
1802
+ request: InferRequest<Opts & {
1803
+ use: any[];
1804
+ }>;
1805
+ headers: InferHeadersInput<Opts & {
1806
+ use: any[];
1807
+ }>;
1808
+ asResponse?: boolean;
1809
+ returnHeaders?: boolean;
1810
+ use?: Middleware[];
1811
+ path?: string;
1812
+ } extends infer T_6 ? { [K_1 in keyof T_6 as {
1813
+ body: InferBodyInput<Opts & {
1814
+ use: any[];
1815
+ }>;
1816
+ method: InferInputMethod<Opts & {
1817
+ use: any[];
1818
+ }>;
1819
+ query: InferQueryInput<Opts & {
1820
+ use: any[];
1821
+ }>;
1822
+ params: InferParam<Path>;
1823
+ request: InferRequest<Opts & {
1824
+ use: any[];
1825
+ }>;
1826
+ headers: InferHeadersInput<Opts & {
1827
+ use: any[];
1828
+ }>;
1829
+ asResponse?: boolean;
1830
+ returnHeaders?: boolean;
1831
+ use?: Middleware[];
1832
+ path?: string;
1833
+ }[K_1] extends never ? never : undefined extends {
1834
+ body: InferBodyInput<Opts & {
1835
+ use: any[];
1836
+ }>;
1837
+ method: InferInputMethod<Opts & {
1838
+ use: any[];
1839
+ }>;
1840
+ query: InferQueryInput<Opts & {
1841
+ use: any[];
1842
+ }>;
1843
+ params: InferParam<Path>;
1844
+ request: InferRequest<Opts & {
1845
+ use: any[];
1846
+ }>;
1847
+ headers: InferHeadersInput<Opts & {
1848
+ use: any[];
1849
+ }>;
1850
+ asResponse?: boolean;
1851
+ returnHeaders?: boolean;
1852
+ use?: Middleware[];
1853
+ path?: string;
1854
+ }[K_1] ? never : K_1]: {
1855
+ body: InferBodyInput<Opts & {
1856
+ use: any[];
1857
+ }>;
1858
+ method: InferInputMethod<Opts & {
1859
+ use: any[];
1860
+ }>;
1861
+ query: InferQueryInput<Opts & {
1862
+ use: any[];
1863
+ }>;
1864
+ params: InferParam<Path>;
1865
+ request: InferRequest<Opts & {
1866
+ use: any[];
1867
+ }>;
1868
+ headers: InferHeadersInput<Opts & {
1869
+ use: any[];
1870
+ }>;
1871
+ asResponse?: boolean;
1872
+ returnHeaders?: boolean;
1873
+ use?: Middleware[];
1874
+ path?: string;
1875
+ }[K_1]; } : never) & ({
1876
+ body: InferBodyInput<Opts & {
1877
+ use: any[];
1878
+ }>;
1879
+ method: InferInputMethod<Opts & {
1880
+ use: any[];
1881
+ }>;
1882
+ query: InferQueryInput<Opts & {
1883
+ use: any[];
1884
+ }>;
1885
+ params: InferParam<Path>;
1886
+ request: InferRequest<Opts & {
1887
+ use: any[];
1888
+ }>;
1889
+ headers: InferHeadersInput<Opts & {
1890
+ use: any[];
1891
+ }>;
1892
+ asResponse?: boolean;
1893
+ returnHeaders?: boolean;
1894
+ use?: Middleware[];
1895
+ path?: string;
1896
+ } extends infer T_7 ? { [K_2 in keyof T_7 as undefined extends {
1897
+ body: InferBodyInput<Opts & {
1898
+ use: any[];
1899
+ }>;
1900
+ method: InferInputMethod<Opts & {
1901
+ use: any[];
1902
+ }>;
1903
+ query: InferQueryInput<Opts & {
1904
+ use: any[];
1905
+ }>;
1906
+ params: InferParam<Path>;
1907
+ request: InferRequest<Opts & {
1908
+ use: any[];
1909
+ }>;
1910
+ headers: InferHeadersInput<Opts & {
1911
+ use: any[];
1912
+ }>;
1913
+ asResponse?: boolean;
1914
+ returnHeaders?: boolean;
1915
+ use?: Middleware[];
1916
+ path?: string;
1917
+ }[K_2] ? K_2 : never]?: {
1918
+ body: InferBodyInput<Opts & {
1919
+ use: any[];
1920
+ }>;
1921
+ method: InferInputMethod<Opts & {
1922
+ use: any[];
1923
+ }>;
1924
+ query: InferQueryInput<Opts & {
1925
+ use: any[];
1926
+ }>;
1927
+ params: InferParam<Path>;
1928
+ request: InferRequest<Opts & {
1929
+ use: any[];
1930
+ }>;
1931
+ headers: InferHeadersInput<Opts & {
1932
+ use: any[];
1933
+ }>;
1934
+ asResponse?: boolean;
1935
+ returnHeaders?: boolean;
1936
+ use?: Middleware[];
1937
+ path?: string;
1938
+ }[K_2] | undefined; } : never))[K]; } : never] : [((({
1939
+ body: InferBodyInput<Opts & {
1940
+ use: any[];
1941
+ }>;
1942
+ method: InferInputMethod<Opts & {
1943
+ use: any[];
1944
+ }>;
1945
+ query: InferQueryInput<Opts & {
1946
+ use: any[];
1947
+ }>;
1948
+ params: InferParam<Path>;
1949
+ request: InferRequest<Opts & {
1950
+ use: any[];
1951
+ }>;
1952
+ headers: InferHeadersInput<Opts & {
1953
+ use: any[];
1954
+ }>;
1955
+ asResponse?: boolean;
1956
+ returnHeaders?: boolean;
1957
+ use?: Middleware[];
1958
+ path?: string;
1959
+ } extends infer T_13 ? { [K_1 in keyof T_13 as {
1960
+ body: InferBodyInput<Opts & {
1961
+ use: any[];
1962
+ }>;
1963
+ method: InferInputMethod<Opts & {
1964
+ use: any[];
1965
+ }>;
1966
+ query: InferQueryInput<Opts & {
1967
+ use: any[];
1968
+ }>;
1969
+ params: InferParam<Path>;
1970
+ request: InferRequest<Opts & {
1971
+ use: any[];
1972
+ }>;
1973
+ headers: InferHeadersInput<Opts & {
1974
+ use: any[];
1975
+ }>;
1976
+ asResponse?: boolean;
1977
+ returnHeaders?: boolean;
1978
+ use?: Middleware[];
1979
+ path?: string;
1980
+ }[K_1] extends never ? never : undefined extends {
1981
+ body: InferBodyInput<Opts & {
1982
+ use: any[];
1983
+ }>;
1984
+ method: InferInputMethod<Opts & {
1985
+ use: any[];
1986
+ }>;
1987
+ query: InferQueryInput<Opts & {
1988
+ use: any[];
1989
+ }>;
1990
+ params: InferParam<Path>;
1991
+ request: InferRequest<Opts & {
1992
+ use: any[];
1993
+ }>;
1994
+ headers: InferHeadersInput<Opts & {
1995
+ use: any[];
1996
+ }>;
1997
+ asResponse?: boolean;
1998
+ returnHeaders?: boolean;
1999
+ use?: Middleware[];
2000
+ path?: string;
2001
+ }[K_1] ? never : K_1]: {
2002
+ body: InferBodyInput<Opts & {
2003
+ use: any[];
2004
+ }>;
2005
+ method: InferInputMethod<Opts & {
2006
+ use: any[];
2007
+ }>;
2008
+ query: InferQueryInput<Opts & {
2009
+ use: any[];
2010
+ }>;
2011
+ params: InferParam<Path>;
2012
+ request: InferRequest<Opts & {
2013
+ use: any[];
2014
+ }>;
2015
+ headers: InferHeadersInput<Opts & {
2016
+ use: any[];
2017
+ }>;
2018
+ asResponse?: boolean;
2019
+ returnHeaders?: boolean;
2020
+ use?: Middleware[];
2021
+ path?: string;
2022
+ }[K_1]; } : never) & ({
2023
+ body: InferBodyInput<Opts & {
2024
+ use: any[];
2025
+ }>;
2026
+ method: InferInputMethod<Opts & {
2027
+ use: any[];
2028
+ }>;
2029
+ query: InferQueryInput<Opts & {
2030
+ use: any[];
2031
+ }>;
2032
+ params: InferParam<Path>;
2033
+ request: InferRequest<Opts & {
2034
+ use: any[];
2035
+ }>;
2036
+ headers: InferHeadersInput<Opts & {
2037
+ use: any[];
2038
+ }>;
2039
+ asResponse?: boolean;
2040
+ returnHeaders?: boolean;
2041
+ use?: Middleware[];
2042
+ path?: string;
2043
+ } extends infer T_14 ? { [K_2 in keyof T_14 as undefined extends {
2044
+ body: InferBodyInput<Opts & {
2045
+ use: any[];
2046
+ }>;
2047
+ method: InferInputMethod<Opts & {
2048
+ use: any[];
2049
+ }>;
2050
+ query: InferQueryInput<Opts & {
2051
+ use: any[];
2052
+ }>;
2053
+ params: InferParam<Path>;
2054
+ request: InferRequest<Opts & {
2055
+ use: any[];
2056
+ }>;
2057
+ headers: InferHeadersInput<Opts & {
2058
+ use: any[];
2059
+ }>;
2060
+ asResponse?: boolean;
2061
+ returnHeaders?: boolean;
2062
+ use?: Middleware[];
2063
+ path?: string;
2064
+ }[K_2] ? K_2 : never]?: {
2065
+ body: InferBodyInput<Opts & {
2066
+ use: any[];
2067
+ }>;
2068
+ method: InferInputMethod<Opts & {
2069
+ use: any[];
2070
+ }>;
2071
+ query: InferQueryInput<Opts & {
2072
+ use: any[];
2073
+ }>;
2074
+ params: InferParam<Path>;
2075
+ request: InferRequest<Opts & {
2076
+ use: any[];
2077
+ }>;
2078
+ headers: InferHeadersInput<Opts & {
2079
+ use: any[];
2080
+ }>;
2081
+ asResponse?: boolean;
2082
+ returnHeaders?: boolean;
2083
+ use?: Middleware[];
2084
+ path?: string;
2085
+ }[K_2] | undefined; } : never) extends infer T_10 ? { [K in keyof T_10]: (({
2086
+ body: InferBodyInput<Opts & {
2087
+ use: any[];
2088
+ }>;
2089
+ method: InferInputMethod<Opts & {
2090
+ use: any[];
2091
+ }>;
2092
+ query: InferQueryInput<Opts & {
2093
+ use: any[];
2094
+ }>;
2095
+ params: InferParam<Path>;
2096
+ request: InferRequest<Opts & {
2097
+ use: any[];
2098
+ }>;
2099
+ headers: InferHeadersInput<Opts & {
2100
+ use: any[];
2101
+ }>;
2102
+ asResponse?: boolean;
2103
+ returnHeaders?: boolean;
2104
+ use?: Middleware[];
2105
+ path?: string;
2106
+ } extends infer T_11 ? { [K_1 in keyof T_11 as {
2107
+ body: InferBodyInput<Opts & {
2108
+ use: any[];
2109
+ }>;
2110
+ method: InferInputMethod<Opts & {
2111
+ use: any[];
2112
+ }>;
2113
+ query: InferQueryInput<Opts & {
2114
+ use: any[];
2115
+ }>;
2116
+ params: InferParam<Path>;
2117
+ request: InferRequest<Opts & {
2118
+ use: any[];
2119
+ }>;
2120
+ headers: InferHeadersInput<Opts & {
2121
+ use: any[];
2122
+ }>;
2123
+ asResponse?: boolean;
2124
+ returnHeaders?: boolean;
2125
+ use?: Middleware[];
2126
+ path?: string;
2127
+ }[K_1] extends never ? never : undefined extends {
2128
+ body: InferBodyInput<Opts & {
2129
+ use: any[];
2130
+ }>;
2131
+ method: InferInputMethod<Opts & {
2132
+ use: any[];
2133
+ }>;
2134
+ query: InferQueryInput<Opts & {
2135
+ use: any[];
2136
+ }>;
2137
+ params: InferParam<Path>;
2138
+ request: InferRequest<Opts & {
2139
+ use: any[];
2140
+ }>;
2141
+ headers: InferHeadersInput<Opts & {
2142
+ use: any[];
2143
+ }>;
2144
+ asResponse?: boolean;
2145
+ returnHeaders?: boolean;
2146
+ use?: Middleware[];
2147
+ path?: string;
2148
+ }[K_1] ? never : K_1]: {
2149
+ body: InferBodyInput<Opts & {
2150
+ use: any[];
2151
+ }>;
2152
+ method: InferInputMethod<Opts & {
2153
+ use: any[];
2154
+ }>;
2155
+ query: InferQueryInput<Opts & {
2156
+ use: any[];
2157
+ }>;
2158
+ params: InferParam<Path>;
2159
+ request: InferRequest<Opts & {
2160
+ use: any[];
2161
+ }>;
2162
+ headers: InferHeadersInput<Opts & {
2163
+ use: any[];
2164
+ }>;
2165
+ asResponse?: boolean;
2166
+ returnHeaders?: boolean;
2167
+ use?: Middleware[];
2168
+ path?: string;
2169
+ }[K_1]; } : never) & ({
2170
+ body: InferBodyInput<Opts & {
2171
+ use: any[];
2172
+ }>;
2173
+ method: InferInputMethod<Opts & {
2174
+ use: any[];
2175
+ }>;
2176
+ query: InferQueryInput<Opts & {
2177
+ use: any[];
2178
+ }>;
2179
+ params: InferParam<Path>;
2180
+ request: InferRequest<Opts & {
2181
+ use: any[];
2182
+ }>;
2183
+ headers: InferHeadersInput<Opts & {
2184
+ use: any[];
2185
+ }>;
2186
+ asResponse?: boolean;
2187
+ returnHeaders?: boolean;
2188
+ use?: Middleware[];
2189
+ path?: string;
2190
+ } extends infer T_12 ? { [K_2 in keyof T_12 as undefined extends {
2191
+ body: InferBodyInput<Opts & {
2192
+ use: any[];
2193
+ }>;
2194
+ method: InferInputMethod<Opts & {
2195
+ use: any[];
2196
+ }>;
2197
+ query: InferQueryInput<Opts & {
2198
+ use: any[];
2199
+ }>;
2200
+ params: InferParam<Path>;
2201
+ request: InferRequest<Opts & {
2202
+ use: any[];
2203
+ }>;
2204
+ headers: InferHeadersInput<Opts & {
2205
+ use: any[];
2206
+ }>;
2207
+ asResponse?: boolean;
2208
+ returnHeaders?: boolean;
2209
+ use?: Middleware[];
2210
+ path?: string;
2211
+ }[K_2] ? K_2 : never]?: {
2212
+ body: InferBodyInput<Opts & {
2213
+ use: any[];
2214
+ }>;
2215
+ method: InferInputMethod<Opts & {
2216
+ use: any[];
2217
+ }>;
2218
+ query: InferQueryInput<Opts & {
2219
+ use: any[];
2220
+ }>;
2221
+ params: InferParam<Path>;
2222
+ request: InferRequest<Opts & {
2223
+ use: any[];
2224
+ }>;
2225
+ headers: InferHeadersInput<Opts & {
2226
+ use: any[];
2227
+ }>;
2228
+ asResponse?: boolean;
2229
+ returnHeaders?: boolean;
2230
+ use?: Middleware[];
2231
+ path?: string;
2232
+ }[K_2] | undefined; } : never))[K]; } : never) | undefined)?]>(...inputCtx: C): Promise<C extends [{
2233
+ asResponse: true;
2234
+ }] ? Response : C extends [{
2235
+ returnHeaders: true;
2236
+ }] ? {
1178
2237
  headers: Headers;
1179
2238
  response: R;
1180
2239
  } : R>;
@@ -1260,4 +2319,4 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
1260
2319
  };
1261
2320
  type Router = ReturnType<typeof createRouter>;
1262
2321
 
1263
- export { APIError as A, type InferHeaders as B, type CookiePrefixOptions as C, type InferHeadersInput as D, type EndpointOptions as E, type InferUse as F, type InferMiddlewareBody as G, type HTTPMethod as H, type InferBodyInput as I, type InferMiddlewareQuery as J, type InputContext as K, createInternalContext as L, type MiddlewareOptions as M, type HasRequiredKeys as N, type OpenAPISchemaType as O, type Path as P, type RouterConfig as R, type Status as S, type UnionToIntersection as U, _statusCode as _, type EndpointContext as a, type Endpoint as b, createEndpoint as c, type MiddlewareResponse as d, type MiddlewareContext as e, createMiddleware as f, type MiddlewareInputContext as g, type Middleware as h, createRouter as i, type Router as j, type CookieOptions as k, getCookieKey as l, serializeSignedCookie as m, type OpenAPIParameter as n, generator as o, parseCookies as p, getHTML as q, type Method as r, serializeCookie as s, type InferBody as t, type InferQueryInput as u, type InferQuery as v, type InferMethod as w, type InferInputMethod as x, type InferParam as y, type InferRequest as z };
2322
+ export { StandardSchemaV1 as $, APIError as A, type InferHeaders as B, type CookiePrefixOptions as C, type InferHeadersInput as D, type EndpointOptions as E, type InferUse as F, type InferMiddlewareBody as G, type HTTPMethod as H, type InferBodyInput as I, type InferMiddlewareQuery as J, type InputContext as K, createInternalContext as L, type MiddlewareOptions as M, type Input as N, type OpenAPISchemaType as O, type Path as P, type RequiredKeysOf as Q, type RouterConfig as R, type Status as S, type HasRequiredKeys as T, type Prettify as U, type IsEmptyObject as V, type UnionToIntersection as W, type MergeObject as X, type InferParamPath as Y, type InferParamWildCard as Z, _statusCode as _, type EndpointContext as a, type Endpoint as b, createEndpoint as c, type MiddlewareResponse as d, type MiddlewareContext as e, createMiddleware as f, type MiddlewareInputContext as g, type Middleware as h, createRouter as i, type Router as j, type CookieOptions as k, getCookieKey as l, serializeSignedCookie as m, type OpenAPIParameter as n, generator as o, parseCookies as p, getHTML as q, type Method as r, serializeCookie as s, type InferBody as t, type InferQueryInput as u, type InferQuery as v, type InferMethod as w, type InferInputMethod as x, type InferParam as y, type InferRequest as z };