@effect-app/vue 2.60.7 → 2.60.8

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.
@@ -68,13 +68,14 @@ export const wrapEmitSubmit = <A>(
68
68
  }
69
69
 
70
70
  export declare namespace Commander {
71
- export interface CommandProps<A, E> {
71
+ export interface CommandProps<A, E, Name extends string> {
72
+ name: Name
72
73
  action: string
73
74
  result: Result<A, E>
74
75
  waiting: boolean
75
76
  }
76
77
 
77
- export interface CommandOut<Args extends Array<any>, A, E, R> extends CommandProps<A, E> {
78
+ export interface CommandOut<Args extends Array<any>, A, E, R, Name extends string> extends CommandProps<A, E, Name> {
78
79
  /** click handlers */
79
80
  handle: (...args: Args) => RuntimeFiber<Exit.Exit<A, E>, never>
80
81
 
@@ -94,14 +95,16 @@ export declare namespace Commander {
94
95
  exec: (...args: Args) => Effect.Effect<Exit.Exit<A, E>, never, Exclude<R, CommandContext>>
95
96
  }
96
97
 
97
- type CommandOutHelper<Args extends Array<any>, Eff extends Effect.Effect<any, any, any>> = CommandOut<
98
- Args,
99
- Effect.Effect.Success<Eff>,
100
- Effect.Effect.Error<Eff>,
101
- Effect.Effect.Context<Eff>
102
- >
98
+ type CommandOutHelper<Args extends Array<any>, Eff extends Effect.Effect<any, any, any>, Name extends string> =
99
+ CommandOut<
100
+ Args,
101
+ Effect.Effect.Success<Eff>,
102
+ Effect.Effect.Error<Eff>,
103
+ Effect.Effect.Context<Eff>,
104
+ Name
105
+ >
103
106
 
104
- export type Gen<RT> = {
107
+ export type Gen<RT, Name extends string> = {
105
108
  <Eff extends YieldWrap<Effect.Effect<any, any, RT | CommandContext>>, AEff, Args extends Array<any>>(
106
109
  body: (...args: Args) => Generator<Eff, AEff, never>
107
110
  ): CommandOut<
@@ -112,7 +115,8 @@ export declare namespace Commander {
112
115
  : never,
113
116
  [Eff] extends [never] ? never
114
117
  : [Eff] extends [YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R
115
- : never
118
+ : never,
119
+ Name
116
120
  >
117
121
  <
118
122
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
@@ -133,7 +137,7 @@ export declare namespace Commander {
133
137
  >,
134
138
  ...args: NoInfer<Args>
135
139
  ) => A
136
- ): CommandOutHelper<Args, A>
140
+ ): CommandOutHelper<Args, A, Name>
137
141
  <
138
142
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
139
143
  AEff,
@@ -155,7 +159,7 @@ export declare namespace Commander {
155
159
  ...args: NoInfer<Args>
156
160
  ) => A,
157
161
  b: (_: A, ...args: NoInfer<Args>) => B
158
- ): CommandOutHelper<Args, B>
162
+ ): CommandOutHelper<Args, B, Name>
159
163
  <
160
164
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
161
165
  AEff,
@@ -179,7 +183,7 @@ export declare namespace Commander {
179
183
  ) => A,
180
184
  b: (_: A, ...args: NoInfer<Args>) => B,
181
185
  c: (_: B, ...args: NoInfer<Args>) => C
182
- ): CommandOutHelper<Args, C>
186
+ ): CommandOutHelper<Args, C, Name>
183
187
  <
184
188
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
185
189
  AEff,
@@ -205,7 +209,7 @@ export declare namespace Commander {
205
209
  b: (_: A, ...args: NoInfer<Args>) => B,
206
210
  c: (_: B, ...args: NoInfer<Args>) => C,
207
211
  d: (_: C, ...args: NoInfer<Args>) => D
208
- ): CommandOutHelper<Args, D>
212
+ ): CommandOutHelper<Args, D, Name>
209
213
  <
210
214
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
211
215
  AEff,
@@ -233,7 +237,7 @@ export declare namespace Commander {
233
237
  c: (_: B, ...args: NoInfer<Args>) => C,
234
238
  d: (_: C, ...args: NoInfer<Args>) => D,
235
239
  e: (_: D, ...args: NoInfer<Args>) => E
236
- ): CommandOutHelper<Args, E>
240
+ ): CommandOutHelper<Args, E, Name>
237
241
  <
238
242
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
239
243
  AEff,
@@ -263,7 +267,7 @@ export declare namespace Commander {
263
267
  d: (_: C, ...args: NoInfer<Args>) => D,
264
268
  e: (_: D, ...args: NoInfer<Args>) => E,
265
269
  f: (_: E, ...args: NoInfer<Args>) => F
266
- ): CommandOutHelper<Args, F>
270
+ ): CommandOutHelper<Args, F, Name>
267
271
  <
268
272
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
269
273
  AEff,
@@ -295,7 +299,7 @@ export declare namespace Commander {
295
299
  e: (_: D, ...args: NoInfer<Args>) => E,
296
300
  f: (_: E, ...args: NoInfer<Args>) => F,
297
301
  g: (_: F, ...args: NoInfer<Args>) => G
298
- ): CommandOutHelper<Args, G>
302
+ ): CommandOutHelper<Args, G, Name>
299
303
  <
300
304
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
301
305
  AEff,
@@ -329,7 +333,7 @@ export declare namespace Commander {
329
333
  f: (_: E, ...args: NoInfer<Args>) => F,
330
334
  g: (_: F, ...args: NoInfer<Args>) => G,
331
335
  h: (_: G, ...args: NoInfer<Args>) => H
332
- ): CommandOutHelper<Args, H>
336
+ ): CommandOutHelper<Args, H, Name>
333
337
  <
334
338
  Eff extends YieldWrap<Effect.Effect<any, any, any>>,
335
339
  AEff,
@@ -365,35 +369,35 @@ export declare namespace Commander {
365
369
  g: (_: F, ...args: NoInfer<Args>) => G,
366
370
  h: (_: G, ...args: NoInfer<Args>) => H,
367
371
  i: (_: H, ...args: NoInfer<Args>) => I
368
- ): CommandOutHelper<Args, I>
372
+ ): CommandOutHelper<Args, I, Name>
369
373
  }
370
374
 
371
- export type NonGen<RT> = {
375
+ export type NonGen<RT, Name extends string> = {
372
376
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, Args extends Array<any>>(
373
377
  body: (...args: Args) => Eff
374
- ): CommandOutHelper<Args, Eff>
378
+ ): CommandOutHelper<Args, Eff, Name>
375
379
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, Args extends Array<any>>(
376
380
  body: (...args: Args) => A,
377
381
  a: (_: A, ...args: NoInfer<Args>) => Eff
378
- ): CommandOutHelper<Args, Eff>
382
+ ): CommandOutHelper<Args, Eff, Name>
379
383
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, Args extends Array<any>>(
380
384
  body: (...args: Args) => A,
381
385
  a: (_: A, ...args: NoInfer<Args>) => B,
382
386
  b: (_: B, ...args: NoInfer<Args>) => Eff
383
- ): CommandOutHelper<Args, Eff>
387
+ ): CommandOutHelper<Args, Eff, Name>
384
388
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, C, Args extends Array<any>>(
385
389
  body: (...args: Args) => A,
386
390
  a: (_: A, ...args: NoInfer<Args>) => B,
387
391
  b: (_: B, ...args: NoInfer<Args>) => C,
388
392
  c: (_: C, ...args: NoInfer<Args>) => Eff
389
- ): CommandOutHelper<Args, Eff>
393
+ ): CommandOutHelper<Args, Eff, Name>
390
394
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, C, D, Args extends Array<any>>(
391
395
  body: (...args: Args) => A,
392
396
  a: (_: A, ...args: NoInfer<Args>) => B,
393
397
  b: (_: B, ...args: NoInfer<Args>) => C,
394
398
  c: (_: C, ...args: NoInfer<Args>) => D,
395
399
  d: (_: D, ...args: NoInfer<Args>) => Eff
396
- ): CommandOutHelper<Args, Eff>
400
+ ): CommandOutHelper<Args, Eff, Name>
397
401
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, C, D, E, Args extends Array<any>>(
398
402
  body: (...args: Args) => A,
399
403
  a: (_: A, ...args: NoInfer<Args>) => B,
@@ -401,7 +405,7 @@ export declare namespace Commander {
401
405
  c: (_: C, ...args: NoInfer<Args>) => D,
402
406
  d: (_: D, ...args: NoInfer<Args>) => E,
403
407
  e: (_: E, ...args: NoInfer<Args>) => Eff
404
- ): CommandOutHelper<Args, Eff>
408
+ ): CommandOutHelper<Args, Eff, Name>
405
409
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, C, D, E, F, Args extends Array<any>>(
406
410
  body: (...args: Args) => A,
407
411
  a: (_: A, ...args: NoInfer<Args>) => B,
@@ -410,7 +414,7 @@ export declare namespace Commander {
410
414
  d: (_: D, ...args: NoInfer<Args>) => E,
411
415
  e: (_: E, ...args: NoInfer<Args>) => F,
412
416
  f: (_: F, ...args: NoInfer<Args>) => Eff
413
- ): CommandOutHelper<Args, Eff>
417
+ ): CommandOutHelper<Args, Eff, Name>
414
418
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, C, D, E, F, G, Args extends Array<any>>(
415
419
  body: (...args: Args) => A,
416
420
  a: (_: A, ...args: NoInfer<Args>) => B,
@@ -420,7 +424,7 @@ export declare namespace Commander {
420
424
  e: (_: E, ...args: NoInfer<Args>) => F,
421
425
  f: (_: F, ...args: NoInfer<Args>) => G,
422
426
  g: (_: G, ...args: NoInfer<Args>) => Eff
423
- ): CommandOutHelper<Args, Eff>
427
+ ): CommandOutHelper<Args, Eff, Name>
424
428
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, C, D, E, F, G, H, Args extends Array<any>>(
425
429
  body: (...args: Args) => A,
426
430
  a: (_: A, ...args: NoInfer<Args>) => B,
@@ -431,7 +435,7 @@ export declare namespace Commander {
431
435
  f: (_: F, ...args: NoInfer<Args>) => G,
432
436
  g: (_: G, ...args: NoInfer<Args>) => H,
433
437
  h: (_: H, ...args: NoInfer<Args>) => Eff
434
- ): CommandOutHelper<Args, Eff>
438
+ ): CommandOutHelper<Args, Eff, Name>
435
439
  <Eff extends Effect.Effect<any, any, RT | CommandContext>, A, B, C, D, E, F, G, H, I, Args extends Array<any>>(
436
440
  body: (...args: Args) => A,
437
441
  a: (_: A, ...args: NoInfer<Args>) => B,
@@ -443,7 +447,308 @@ export declare namespace Commander {
443
447
  g: (_: G, ...args: NoInfer<Args>) => H,
444
448
  h: (_: H, ...args: NoInfer<Args>) => I,
445
449
  i: (_: H, ...args: NoInfer<Args>) => Eff
446
- ): CommandOutHelper<Args, Eff>
450
+ ): CommandOutHelper<Args, Eff, Name>
451
+ }
452
+
453
+ export type GenWrap<RT, Name extends string, Args extends Array<any>, AEff, EEff, REff> = {
454
+ (): CommandOut<
455
+ Args,
456
+ AEff,
457
+ EEff,
458
+ REff, // TODO: only allowed to be RT | CommandContext
459
+ Name
460
+ >
461
+ <
462
+ A extends Effect.Effect<any, any, RT | CommandContext>
463
+ >(
464
+ a: (
465
+ _: Effect.Effect<
466
+ AEff,
467
+ EEff,
468
+ REff
469
+ >,
470
+ ...args: NoInfer<Args>
471
+ ) => A
472
+ ): CommandOutHelper<Args, A, Name>
473
+ <
474
+ A,
475
+ B extends Effect.Effect<any, any, RT | CommandContext>
476
+ >(
477
+ a: (
478
+ _: Effect.Effect<
479
+ AEff,
480
+ EEff,
481
+ REff
482
+ >,
483
+ ...args: NoInfer<Args>
484
+ ) => A,
485
+ b: (_: A, ...args: NoInfer<Args>) => B
486
+ ): CommandOutHelper<Args, B, Name>
487
+ <
488
+ A,
489
+ B,
490
+ C extends Effect.Effect<any, any, RT | CommandContext>
491
+ >(
492
+ a: (
493
+ _: Effect.Effect<
494
+ AEff,
495
+ EEff,
496
+ REff
497
+ >,
498
+ ...args: NoInfer<Args>
499
+ ) => A,
500
+ b: (_: A, ...args: NoInfer<Args>) => B,
501
+ c: (_: B, ...args: NoInfer<Args>) => C
502
+ ): CommandOutHelper<Args, C, Name>
503
+ <
504
+ A,
505
+ B,
506
+ C,
507
+ D extends Effect.Effect<any, any, RT | CommandContext>
508
+ >(
509
+ a: (
510
+ _: Effect.Effect<
511
+ AEff,
512
+ EEff,
513
+ REff
514
+ >,
515
+ ...args: NoInfer<Args>
516
+ ) => A,
517
+ b: (_: A, ...args: NoInfer<Args>) => B,
518
+ c: (_: B, ...args: NoInfer<Args>) => C,
519
+ d: (_: C, ...args: NoInfer<Args>) => D
520
+ ): CommandOutHelper<Args, D, Name>
521
+ <
522
+ A,
523
+ B,
524
+ C,
525
+ D,
526
+ E extends Effect.Effect<any, any, RT | CommandContext>
527
+ >(
528
+ a: (
529
+ _: Effect.Effect<
530
+ AEff,
531
+ EEff,
532
+ REff
533
+ >,
534
+ ...args: NoInfer<Args>
535
+ ) => A,
536
+ b: (_: A, ...args: NoInfer<Args>) => B,
537
+ c: (_: B, ...args: NoInfer<Args>) => C,
538
+ d: (_: C, ...args: NoInfer<Args>) => D,
539
+ e: (_: D, ...args: NoInfer<Args>) => E
540
+ ): CommandOutHelper<Args, E, Name>
541
+ <
542
+ A,
543
+ B,
544
+ C,
545
+ D,
546
+ E,
547
+ F extends Effect.Effect<any, any, RT | CommandContext>
548
+ >(
549
+ a: (
550
+ _: Effect.Effect<
551
+ AEff,
552
+ EEff,
553
+ REff
554
+ >,
555
+ ...args: NoInfer<Args>
556
+ ) => A,
557
+ b: (_: A, ...args: NoInfer<Args>) => B,
558
+ c: (_: B, ...args: NoInfer<Args>) => C,
559
+ d: (_: C, ...args: NoInfer<Args>) => D,
560
+ e: (_: D, ...args: NoInfer<Args>) => E,
561
+ f: (_: E, ...args: NoInfer<Args>) => F
562
+ ): CommandOutHelper<Args, F, Name>
563
+ <
564
+ A,
565
+ B,
566
+ C,
567
+ D,
568
+ E,
569
+ F,
570
+ G extends Effect.Effect<any, any, RT | CommandContext>
571
+ >(
572
+ a: (
573
+ _: Effect.Effect<
574
+ AEff,
575
+ EEff,
576
+ REff
577
+ >,
578
+ ...args: NoInfer<Args>
579
+ ) => A,
580
+ b: (_: A, ...args: NoInfer<Args>) => B,
581
+ c: (_: B, ...args: NoInfer<Args>) => C,
582
+ d: (_: C, ...args: NoInfer<Args>) => D,
583
+ e: (_: D, ...args: NoInfer<Args>) => E,
584
+ f: (_: E, ...args: NoInfer<Args>) => F,
585
+ g: (_: F, ...args: NoInfer<Args>) => G
586
+ ): CommandOutHelper<Args, G, Name>
587
+ <A, B, C, D, E, F, G, H extends Effect.Effect<any, any, RT | CommandContext>>(
588
+ a: (
589
+ _: Effect.Effect<
590
+ AEff,
591
+ EEff,
592
+ REff
593
+ >,
594
+ ...args: NoInfer<Args>
595
+ ) => A,
596
+ b: (_: A, ...args: NoInfer<Args>) => B,
597
+ c: (_: B, ...args: NoInfer<Args>) => C,
598
+ d: (_: C, ...args: NoInfer<Args>) => D,
599
+ e: (_: D, ...args: NoInfer<Args>) => E,
600
+ f: (_: E, ...args: NoInfer<Args>) => F,
601
+ g: (_: F, ...args: NoInfer<Args>) => G,
602
+ h: (_: G, ...args: NoInfer<Args>) => H
603
+ ): CommandOutHelper<Args, H, Name>
604
+ <A, B, C, D, E, F, G, H, I extends Effect.Effect<any, any, RT | CommandContext>>(
605
+ a: (
606
+ _: Effect.Effect<
607
+ AEff,
608
+ EEff,
609
+ REff
610
+ >,
611
+ ...args: NoInfer<Args>
612
+ ) => A,
613
+ b: (_: A, ...args: NoInfer<Args>) => B,
614
+ c: (_: B, ...args: NoInfer<Args>) => C,
615
+ d: (_: C, ...args: NoInfer<Args>) => D,
616
+ e: (_: D, ...args: NoInfer<Args>) => E,
617
+ f: (_: E, ...args: NoInfer<Args>) => F,
618
+ g: (_: F, ...args: NoInfer<Args>) => G,
619
+ h: (_: G, ...args: NoInfer<Args>) => H,
620
+ i: (_: H, ...args: NoInfer<Args>) => I
621
+ ): CommandOutHelper<Args, I, Name>
622
+ }
623
+
624
+ export type NonGenWrap<RT, Name extends string, Args extends Array<any>, AEff, EEff, REff> = {
625
+ (): CommandOutHelper<Args, Effect.Effect<AEff, EEff, REff>, Name>
626
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, Args extends Array<any>>(
627
+ a: (
628
+ _: Effect.Effect<
629
+ AEff,
630
+ EEff,
631
+ REff
632
+ >,
633
+ ...args: NoInfer<Args>
634
+ ) => Eff
635
+ ): CommandOutHelper<Args, Eff, Name>
636
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, Args extends Array<any>>(
637
+ a: (
638
+ _: Effect.Effect<
639
+ AEff,
640
+ EEff,
641
+ REff
642
+ >,
643
+ ...args: NoInfer<Args>
644
+ ) => B,
645
+ b: (_: B, ...args: NoInfer<Args>) => Eff
646
+ ): CommandOutHelper<Args, Eff, Name>
647
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, C, Args extends Array<any>>(
648
+ a: (
649
+ _: Effect.Effect<
650
+ AEff,
651
+ EEff,
652
+ REff
653
+ >,
654
+ ...args: NoInfer<Args>
655
+ ) => B,
656
+ b: (_: B, ...args: NoInfer<Args>) => C,
657
+ c: (_: C, ...args: NoInfer<Args>) => Eff
658
+ ): CommandOutHelper<Args, Eff, Name>
659
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, C, D, Args extends Array<any>>(
660
+ a: (
661
+ _: Effect.Effect<
662
+ AEff,
663
+ EEff,
664
+ REff
665
+ >,
666
+ ...args: NoInfer<Args>
667
+ ) => B,
668
+ b: (_: B, ...args: NoInfer<Args>) => C,
669
+ c: (_: C, ...args: NoInfer<Args>) => D,
670
+ d: (_: D, ...args: NoInfer<Args>) => Eff
671
+ ): CommandOutHelper<Args, Eff, Name>
672
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, C, D, E, Args extends Array<any>>(
673
+ a: (
674
+ _: Effect.Effect<
675
+ AEff,
676
+ EEff,
677
+ REff
678
+ >,
679
+ ...args: NoInfer<Args>
680
+ ) => B,
681
+ b: (_: B, ...args: NoInfer<Args>) => C,
682
+ c: (_: C, ...args: NoInfer<Args>) => D,
683
+ d: (_: D, ...args: NoInfer<Args>) => E,
684
+ e: (_: E, ...args: NoInfer<Args>) => Eff
685
+ ): CommandOutHelper<Args, Eff, Name>
686
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, C, D, E, F, Args extends Array<any>>(
687
+ a: (
688
+ _: Effect.Effect<
689
+ AEff,
690
+ EEff,
691
+ REff
692
+ >,
693
+ ...args: NoInfer<Args>
694
+ ) => B,
695
+ b: (_: B, ...args: NoInfer<Args>) => C,
696
+ c: (_: C, ...args: NoInfer<Args>) => D,
697
+ d: (_: D, ...args: NoInfer<Args>) => E,
698
+ e: (_: E, ...args: NoInfer<Args>) => F,
699
+ f: (_: F, ...args: NoInfer<Args>) => Eff
700
+ ): CommandOutHelper<Args, Eff, Name>
701
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, C, D, E, F, G, Args extends Array<any>>(
702
+ a: (
703
+ _: Effect.Effect<
704
+ AEff,
705
+ EEff,
706
+ REff
707
+ >,
708
+ ...args: NoInfer<Args>
709
+ ) => B,
710
+ b: (_: B, ...args: NoInfer<Args>) => C,
711
+ c: (_: C, ...args: NoInfer<Args>) => D,
712
+ d: (_: D, ...args: NoInfer<Args>) => E,
713
+ e: (_: E, ...args: NoInfer<Args>) => F,
714
+ f: (_: F, ...args: NoInfer<Args>) => G,
715
+ g: (_: G, ...args: NoInfer<Args>) => Eff
716
+ ): CommandOutHelper<Args, Eff, Name>
717
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, C, D, E, F, G, H, Args extends Array<any>>(
718
+ a: (
719
+ _: Effect.Effect<
720
+ AEff,
721
+ EEff,
722
+ REff
723
+ >,
724
+ ...args: NoInfer<Args>
725
+ ) => B,
726
+ b: (_: B, ...args: NoInfer<Args>) => C,
727
+ c: (_: C, ...args: NoInfer<Args>) => D,
728
+ d: (_: D, ...args: NoInfer<Args>) => E,
729
+ e: (_: E, ...args: NoInfer<Args>) => F,
730
+ f: (_: F, ...args: NoInfer<Args>) => G,
731
+ g: (_: G, ...args: NoInfer<Args>) => H,
732
+ h: (_: H, ...args: NoInfer<Args>) => Eff
733
+ ): CommandOutHelper<Args, Eff, Name>
734
+ <Eff extends Effect.Effect<any, any, RT | CommandContext>, B, C, D, E, F, G, H, I, Args extends Array<any>>(
735
+ a: (
736
+ _: Effect.Effect<
737
+ AEff,
738
+ EEff,
739
+ REff
740
+ >,
741
+ ...args: NoInfer<Args>
742
+ ) => B,
743
+ b: (_: B, ...args: NoInfer<Args>) => C,
744
+ c: (_: C, ...args: NoInfer<Args>) => D,
745
+ d: (_: D, ...args: NoInfer<Args>) => E,
746
+ e: (_: E, ...args: NoInfer<Args>) => F,
747
+ f: (_: F, ...args: NoInfer<Args>) => G,
748
+ g: (_: G, ...args: NoInfer<Args>) => H,
749
+ h: (_: H, ...args: NoInfer<Args>) => I,
750
+ i: (_: H, ...args: NoInfer<Args>) => Eff
751
+ ): CommandOutHelper<Args, Eff, Name>
447
752
  }
448
753
  }
449
754
 
@@ -689,6 +994,7 @@ export class Commander extends Effect.Service<Commander>()("Commander", {
689
994
  }, { action })
690
995
 
691
996
  return reactive({
997
+ name: actionName,
692
998
  result,
693
999
  waiting,
694
1000
  action,
@@ -702,54 +1008,56 @@ export class Commander extends Effect.Service<Commander>()("Commander", {
702
1008
  }
703
1009
 
704
1010
  return {
705
- /** experimental */
706
- takeOver: <Args extends any[], A, E, R>(command: Commander.CommandOut<Args, A, E, R>) => (...args: Args) => {
707
- // we capture the call site stack here
708
- const limit = Error.stackTraceLimit
709
- Error.stackTraceLimit = 2
710
- const errorCall = new Error()
711
- const localErrorDef = new Error()
712
- Error.stackTraceLimit = limit
1011
+ /** @experimental */
1012
+ takeOver:
1013
+ <Args extends any[], A, E, R, const Name extends string>(command: Commander.CommandOut<Args, A, E, R, Name>) =>
1014
+ (...args: Args) => {
1015
+ // we capture the call site stack here
1016
+ const limit = Error.stackTraceLimit
1017
+ Error.stackTraceLimit = 2
1018
+ const errorCall = new Error()
1019
+ const localErrorDef = new Error()
1020
+ Error.stackTraceLimit = limit
713
1021
 
714
- // TODO
715
- const errorDef = localErrorDef
1022
+ // TODO
1023
+ const errorDef = localErrorDef
716
1024
 
717
- let cache: false | string = false
718
- const captureStackTrace = () => {
719
- // in case of an error, we want to append the definition stack to the call site stack,
720
- // so we can see where the handler was defined too
1025
+ let cache: false | string = false
1026
+ const captureStackTrace = () => {
1027
+ // in case of an error, we want to append the definition stack to the call site stack,
1028
+ // so we can see where the handler was defined too
721
1029
 
722
- if (cache !== false) {
723
- return cache
724
- }
725
- if (errorCall.stack) {
726
- const stackDef = errorDef.stack!.trim().split("\n")
727
- const stackCall = errorCall.stack.trim().split("\n")
728
- let endStackDef = stackDef.slice(2).join("\n").trim()
729
- if (!endStackDef.includes(`(`)) {
730
- endStackDef = endStackDef.replace(/at (.*)/, "at ($1)")
1030
+ if (cache !== false) {
1031
+ return cache
731
1032
  }
732
- let endStackCall = stackCall.slice(2).join("\n").trim()
733
- if (!endStackCall.includes(`(`)) {
734
- endStackCall = endStackCall.replace(/at (.*)/, "at ($1)")
1033
+ if (errorCall.stack) {
1034
+ const stackDef = errorDef.stack!.trim().split("\n")
1035
+ const stackCall = errorCall.stack.trim().split("\n")
1036
+ let endStackDef = stackDef.slice(2).join("\n").trim()
1037
+ if (!endStackDef.includes(`(`)) {
1038
+ endStackDef = endStackDef.replace(/at (.*)/, "at ($1)")
1039
+ }
1040
+ let endStackCall = stackCall.slice(2).join("\n").trim()
1041
+ if (!endStackCall.includes(`(`)) {
1042
+ endStackCall = endStackCall.replace(/at (.*)/, "at ($1)")
1043
+ }
1044
+ cache = `${endStackDef}\n${endStackCall}`
1045
+ return cache
735
1046
  }
736
- cache = `${endStackDef}\n${endStackCall}`
737
- return cache
738
1047
  }
739
- }
740
1048
 
741
- return Effect.gen(function*() {
742
- const ctx = yield* CommandContext
743
- ctx.action = command.action
744
- return yield* command.exec(...args).pipe(
745
- Effect.flatten,
746
- Effect.withSpan(
747
- command.action,
748
- { captureStackTrace }
1049
+ return Effect.gen(function*() {
1050
+ const ctx = yield* CommandContext
1051
+ ctx.action = command.action
1052
+ return yield* command.exec(...args).pipe(
1053
+ Effect.flatten,
1054
+ Effect.withSpan(
1055
+ command.action,
1056
+ { captureStackTrace }
1057
+ )
749
1058
  )
750
- )
751
- })
752
- },
1059
+ })
1060
+ },
753
1061
 
754
1062
  /** Version of @see confirmOrInterrupt that automatically includes the action name in the default messages */
755
1063
  confirmOrInterrupt: Effect.fnUntraced(function*(
@@ -879,7 +1187,7 @@ export class Commander extends Effect.Service<Commander>()("Commander", {
879
1187
  */
880
1188
  fn: <RT>(runtime: Runtime.Runtime<RT>) => {
881
1189
  const make = makeCommand(runtime)
882
- return (actionName: string): Commander.Gen<RT> & Commander.NonGen<RT> =>
1190
+ return <const Name extends string>(actionName: Name): Commander.Gen<RT, Name> & Commander.NonGen<RT, Name> =>
883
1191
  (
884
1192
  fn: any,
885
1193
  ...combinators: any[]
@@ -902,11 +1210,39 @@ export class Commander extends Effect.Service<Commander>()("Commander", {
902
1210
  }
903
1211
  },
904
1212
 
905
- alt: makeCommand as unknown as <RT>(runtime: Runtime.Runtime<RT>) => (
906
- actionName: string
1213
+ /** @experimental */
1214
+ alt: makeCommand as unknown as <RT>(runtime: Runtime.Runtime<RT>) => <const Name extends string>(
1215
+ actionName: Name
907
1216
  ) => <Args extends Array<any>, A, E, R extends RT | CommandContext>(
908
1217
  handler: (...args: Args) => Effect.Effect<A, E, R>
909
- ) => Commander.CommandOut<Args, A, E, R>
1218
+ ) => Commander.CommandOut<Args, A, E, R, Name>,
1219
+
1220
+ /** @experimental */
1221
+ wrap: <RT>(runtime: Runtime.Runtime<RT>) => {
1222
+ const make = makeCommand(runtime)
1223
+ return <const Name extends string, Args extends Array<any>, A, E, R>(
1224
+ mutation: { mutate: (...args: Args) => Effect.Effect<A, E, R>; name: Name }
1225
+ ): Commander.GenWrap<RT, Name, Args, A, E, R> & Commander.NonGenWrap<RT, Name, Args, A, E, R> =>
1226
+ (
1227
+ ...combinators: any[]
1228
+ ): any => {
1229
+ // we capture the definition stack here, so we can append it to later stack traces
1230
+ const limit = Error.stackTraceLimit
1231
+ Error.stackTraceLimit = 2
1232
+ const errorDef = new Error()
1233
+ Error.stackTraceLimit = limit
1234
+
1235
+ return make(mutation.name, errorDef)(
1236
+ Effect.fnUntraced(
1237
+ // fnUntraced only supports generators as first arg, so we convert to generator if needed
1238
+ isGeneratorFunction(mutation.mutate) ? mutation.mutate : function*(...args: Args) {
1239
+ return yield* mutation.mutate(...args)
1240
+ },
1241
+ ...combinators as [any]
1242
+ ) as any
1243
+ )
1244
+ }
1245
+ }
910
1246
  }
911
1247
  })
912
1248
  }) {}
@@ -5,5 +5,5 @@ export const makeUseCommand = Effect.fnUntraced(function*<R = never>() {
5
5
  const cmndr = yield* Commander
6
6
  const runtime = yield* Effect.runtime<R>()
7
7
 
8
- return { ...cmndr, alt: cmndr.alt(runtime), fn: cmndr.fn(runtime) }
8
+ return { ...cmndr, alt: cmndr.alt(runtime), fn: cmndr.fn(runtime), wrap: cmndr.wrap(runtime) }
9
9
  })
@@ -8,6 +8,11 @@ import { useExperimental } from "./stubs.js"
8
8
 
9
9
  const unwrap = <A, E>(r: RuntimeFiber<Exit.Exit<A, E>, never>) => Fiber.join(r).pipe(Effect.flatten)
10
10
 
11
+ declare const mutation: {
12
+ name: "myMutation"
13
+ mutate: (a: number, b: string) => Effect.Effect<number, boolean, CommandContext>
14
+ }
15
+
11
16
  it.live("works", () =>
12
17
  Effect
13
18
  .gen(function*() {
@@ -46,6 +51,10 @@ it.live("works", () =>
46
51
  expect(command.result.pipe(Result.value)).toEqual(Option.some("test-value"))
47
52
 
48
53
  expect(toasts.length).toBe(0)
54
+
55
+ const wrap = Command.wrap(mutation)
56
+ wrap()
57
+ wrap((_, ...args) => Effect.tap(_, () => console.log("called with", _, args)))
49
58
  }))
50
59
 
51
60
  it.live("works non-gen", () =>