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