@effect-app/vue 4.0.0-beta.18 → 4.0.0-beta.181
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.
- package/CHANGELOG.md +1275 -0
- package/dist/commander.d.ts +450 -0
- package/dist/commander.d.ts.map +1 -0
- package/dist/commander.js +687 -0
- package/dist/confirm.d.ts +19 -0
- package/dist/confirm.d.ts.map +1 -0
- package/dist/confirm.js +24 -0
- package/dist/errorReporter.d.ts +4 -4
- package/dist/errorReporter.d.ts.map +1 -1
- package/dist/errorReporter.js +12 -18
- package/dist/form.d.ts +13 -4
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +41 -12
- package/dist/index.d.ts +1 -1
- package/dist/intl.d.ts +15 -0
- package/dist/intl.d.ts.map +1 -0
- package/dist/intl.js +9 -0
- package/dist/lib.d.ts +6 -8
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +34 -7
- package/dist/makeClient.d.ts +191 -290
- package/dist/makeClient.d.ts.map +1 -1
- package/dist/makeClient.js +231 -361
- package/dist/makeContext.d.ts +1 -1
- package/dist/makeContext.d.ts.map +1 -1
- package/dist/makeIntl.d.ts +1 -1
- package/dist/makeIntl.d.ts.map +1 -1
- package/dist/makeUseCommand.d.ts +8 -0
- package/dist/makeUseCommand.d.ts.map +1 -0
- package/dist/makeUseCommand.js +13 -0
- package/dist/mutate.d.ts +57 -25
- package/dist/mutate.d.ts.map +1 -1
- package/dist/mutate.js +160 -33
- package/dist/query.d.ts +11 -15
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +19 -27
- package/dist/routeParams.d.ts +1 -1
- package/dist/runtime.d.ts +5 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +27 -17
- package/dist/toast.d.ts +46 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +32 -0
- package/dist/withToast.d.ts +26 -0
- package/dist/withToast.d.ts.map +1 -0
- package/dist/withToast.js +49 -0
- package/eslint.config.mjs +2 -2
- package/examples/streamMutation.ts +85 -0
- package/package.json +48 -48
- package/src/{experimental/commander.ts → commander.ts} +1158 -275
- package/src/{experimental/confirm.ts → confirm.ts} +10 -14
- package/src/errorReporter.ts +62 -74
- package/src/form.ts +55 -16
- package/src/intl.ts +12 -0
- package/src/lib.ts +46 -13
- package/src/makeClient.ts +670 -1038
- package/src/{experimental/makeUseCommand.ts → makeUseCommand.ts} +4 -4
- package/src/mutate.ts +306 -72
- package/src/query.ts +39 -50
- package/src/runtime.ts +39 -18
- package/src/{experimental/toast.ts → toast.ts} +11 -25
- package/src/{experimental/withToast.ts → withToast.ts} +15 -6
- package/test/Mutation.test.ts +130 -10
- package/test/dist/form.test.d.ts.map +1 -1
- package/test/dist/lib.test.d.ts.map +1 -0
- package/test/dist/streamFinal.test.d.ts.map +1 -0
- package/test/dist/stubs.d.ts +3220 -117
- package/test/dist/stubs.d.ts.map +1 -1
- package/test/dist/stubs.js +132 -25
- package/test/form-validation-errors.test.ts +23 -19
- package/test/form.test.ts +20 -2
- package/test/lib.test.ts +240 -0
- package/test/makeClient.test.ts +240 -38
- package/test/streamFinal.test.ts +110 -0
- package/test/stubs.ts +172 -42
- package/tsconfig.examples.json +20 -0
- package/tsconfig.json +0 -1
- package/tsconfig.json.bak +5 -2
- package/tsconfig.src.json +34 -34
- package/tsconfig.test.json +2 -2
- package/vitest.config.ts +5 -5
- package/dist/experimental/commander.d.ts +0 -359
- package/dist/experimental/commander.d.ts.map +0 -1
- package/dist/experimental/commander.js +0 -557
- package/dist/experimental/confirm.d.ts +0 -19
- package/dist/experimental/confirm.d.ts.map +0 -1
- package/dist/experimental/confirm.js +0 -28
- package/dist/experimental/intl.d.ts +0 -16
- package/dist/experimental/intl.d.ts.map +0 -1
- package/dist/experimental/intl.js +0 -5
- package/dist/experimental/makeUseCommand.d.ts +0 -8
- package/dist/experimental/makeUseCommand.d.ts.map +0 -1
- package/dist/experimental/makeUseCommand.js +0 -13
- package/dist/experimental/toast.d.ts +0 -47
- package/dist/experimental/toast.d.ts.map +0 -1
- package/dist/experimental/toast.js +0 -41
- package/dist/experimental/withToast.d.ts +0 -25
- package/dist/experimental/withToast.d.ts.map +0 -1
- package/dist/experimental/withToast.js +0 -45
- package/src/experimental/intl.ts +0 -9
|
@@ -1,19 +1,55 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { asResult, type MissingDependencies, reportRuntimeError } from "@effect-app/vue"
|
|
2
|
+
import { asResult, deepToRaw, type MissingDependencies, reportRuntimeError } from "@effect-app/vue"
|
|
3
3
|
import { reportMessage } from "@effect-app/vue/errorReporter"
|
|
4
|
-
import { Cause, Effect, type Exit, type Fiber, flow, Layer, Match, MutableHashMap, Option, Predicate, S
|
|
4
|
+
import { Cause, Context, Effect, type Exit, type Fiber, flow, Layer, Match, MutableHashMap, Option, Predicate, S } from "effect-app"
|
|
5
5
|
import { SupportedErrors } from "effect-app/client"
|
|
6
6
|
import { OperationFailure, OperationSuccess } from "effect-app/Operations"
|
|
7
7
|
import { isGeneratorFunction, wrapEffect } from "effect-app/utils"
|
|
8
|
-
import { type
|
|
8
|
+
import { type Refinement } from "effect/Predicate"
|
|
9
|
+
import type * as AsyncResult from "effect/unstable/reactivity/AsyncResult"
|
|
9
10
|
import { type FormatXMLElementFn, type PrimitiveType } from "intl-messageformat"
|
|
10
|
-
import { computed, type ComputedRef, reactive, ref } from "vue"
|
|
11
|
+
import { computed, type ComputedRef, reactive, ref, toRaw } from "vue"
|
|
11
12
|
import { Confirm } from "./confirm.js"
|
|
12
13
|
import { I18n } from "./intl.js"
|
|
13
14
|
import { WithToast } from "./withToast.js"
|
|
14
15
|
|
|
15
16
|
type IntlRecord = Record<string, PrimitiveType | FormatXMLElementFn<string, string>>
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Progress information surfaced by a stream command. Either a plain text label
|
|
20
|
+
* or a `{ text, percentage }` pair when concrete progress is known.
|
|
21
|
+
*/
|
|
22
|
+
export type Progress = string | { readonly text: string; readonly percentage: number }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Options accepted when calling a stream mutation factory.
|
|
26
|
+
* Supplying `progress` causes the resulting command to expose `running`
|
|
27
|
+
* (the live AsyncResult ref) and `progress` (formatted loading info).
|
|
28
|
+
* When omitted, neither is exposed on the command.
|
|
29
|
+
*/
|
|
30
|
+
export type StreamMutationCallOptions<A, E> = {
|
|
31
|
+
progress?: (result: AsyncResult.AsyncResult<A, E>) => Progress | undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type StreamMutationTuple<Id extends string, Arg, A, E, R> =
|
|
35
|
+
& readonly [
|
|
36
|
+
ComputedRef<AsyncResult.AsyncResult<A, E>>,
|
|
37
|
+
((arg: Arg) => Effect.Effect<any, never, R>) | Effect.Effect<any, never, R>
|
|
38
|
+
]
|
|
39
|
+
& {
|
|
40
|
+
readonly id: Id
|
|
41
|
+
readonly running?: ComputedRef<AsyncResult.AsyncResult<A, E>>
|
|
42
|
+
readonly progress?: ComputedRef<Progress | undefined>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type StreamMutationFactory<Id extends string, Arg, A, E, R> =
|
|
46
|
+
& ((options?: StreamMutationCallOptions<A, E>) => StreamMutationTuple<Id, Arg, A, E, R>)
|
|
47
|
+
& { readonly id: Id }
|
|
48
|
+
type FnOptions<
|
|
49
|
+
Id extends string,
|
|
50
|
+
I18nCustomKey extends string,
|
|
51
|
+
State extends IntlRecord | undefined
|
|
52
|
+
> = {
|
|
17
53
|
i18nCustomKey?: I18nCustomKey
|
|
18
54
|
/**
|
|
19
55
|
* passed to the i18n formatMessage calls so you can use it in translation messagee
|
|
@@ -66,7 +102,7 @@ export const DefaultIntl = {
|
|
|
66
102
|
}
|
|
67
103
|
}
|
|
68
104
|
|
|
69
|
-
export class CommandContext extends
|
|
105
|
+
export class CommandContext extends Context.Service<CommandContext, {
|
|
70
106
|
id: string
|
|
71
107
|
i18nKey: string
|
|
72
108
|
action: string
|
|
@@ -96,7 +132,7 @@ export declare namespace Commander {
|
|
|
96
132
|
& NonGen<RT, Id, I18nKey, State>
|
|
97
133
|
& CommandContextLocal<Id, I18nKey>
|
|
98
134
|
& {
|
|
99
|
-
state:
|
|
135
|
+
state: Context.Service<`Commander.Command.${Id}.state`, State>
|
|
100
136
|
}
|
|
101
137
|
|
|
102
138
|
export type CommanderFn<RT, Id extends string, I18nKey extends string, State extends IntlRecord | undefined> =
|
|
@@ -116,7 +152,7 @@ export declare namespace Commander {
|
|
|
116
152
|
& GenWrap<RT, Id, I18nCustomKey, I, A, E, R, State>
|
|
117
153
|
& NonGenWrap<RT, Id, I18nCustomKey, I, A, E, R, State>
|
|
118
154
|
& {
|
|
119
|
-
state:
|
|
155
|
+
state: Context.Service<`Commander.Command.${Id}.state`, State>
|
|
120
156
|
}
|
|
121
157
|
|
|
122
158
|
export interface CommandContextLocal<Id extends string, I18nKey extends string> {
|
|
@@ -138,7 +174,19 @@ export declare namespace Commander {
|
|
|
138
174
|
/** reactive */
|
|
139
175
|
label: string
|
|
140
176
|
/** reactive */
|
|
141
|
-
result: AsyncResult<A, E>
|
|
177
|
+
result: AsyncResult.AsyncResult<A, E>
|
|
178
|
+
/**
|
|
179
|
+
* reactive – set when the command wraps a stream (`wrapStream` / `wrap` with `mutateStream`)
|
|
180
|
+
* or when the `progress` option is provided to `fn`.
|
|
181
|
+
* Reflects the live AsyncResult of the underlying stream.
|
|
182
|
+
*/
|
|
183
|
+
running: AsyncResult.AsyncResult<any, any> | undefined
|
|
184
|
+
/**
|
|
185
|
+
* reactive – formatted progress info computed from `running` via the
|
|
186
|
+
* `progress` option. Useful as the loading state on a `CommandButton`.
|
|
187
|
+
* Undefined when no `progress` formatter was supplied.
|
|
188
|
+
*/
|
|
189
|
+
progress: Progress | undefined
|
|
142
190
|
/** reactive */
|
|
143
191
|
waiting: boolean
|
|
144
192
|
/** reactive */
|
|
@@ -188,6 +236,8 @@ export declare namespace Commander {
|
|
|
188
236
|
state: State
|
|
189
237
|
}
|
|
190
238
|
|
|
239
|
+
type ArgForCombinator<Arg> = [Arg] extends [void] ? undefined : NoInfer<Arg>
|
|
240
|
+
|
|
191
241
|
type CommandOutHelper<
|
|
192
242
|
Arg,
|
|
193
243
|
Eff extends Effect.Effect<any, any, any>,
|
|
@@ -241,7 +291,7 @@ export declare namespace Commander {
|
|
|
241
291
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
242
292
|
: never
|
|
243
293
|
>,
|
|
244
|
-
arg:
|
|
294
|
+
arg: ArgForCombinator<Arg>,
|
|
245
295
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
246
296
|
) => A
|
|
247
297
|
): CommandOutHelper<Arg, A, Id, I18nKey, State>
|
|
@@ -263,10 +313,14 @@ export declare namespace Commander {
|
|
|
263
313
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
264
314
|
: never
|
|
265
315
|
>,
|
|
266
|
-
arg:
|
|
316
|
+
arg: ArgForCombinator<Arg>,
|
|
267
317
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
268
318
|
) => A,
|
|
269
|
-
b: (
|
|
319
|
+
b: (
|
|
320
|
+
_: A,
|
|
321
|
+
arg: ArgForCombinator<Arg>,
|
|
322
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
323
|
+
) => B
|
|
270
324
|
): CommandOutHelper<Arg, B, Id, I18nKey, State>
|
|
271
325
|
<
|
|
272
326
|
Eff extends Effect.Yieldable<any, any, any, any>,
|
|
@@ -287,11 +341,19 @@ export declare namespace Commander {
|
|
|
287
341
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
288
342
|
: never
|
|
289
343
|
>,
|
|
290
|
-
arg:
|
|
344
|
+
arg: ArgForCombinator<Arg>,
|
|
291
345
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
292
346
|
) => A,
|
|
293
|
-
b: (
|
|
294
|
-
|
|
347
|
+
b: (
|
|
348
|
+
_: A,
|
|
349
|
+
arg: ArgForCombinator<Arg>,
|
|
350
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
351
|
+
) => B,
|
|
352
|
+
c: (
|
|
353
|
+
_: B,
|
|
354
|
+
arg: ArgForCombinator<Arg>,
|
|
355
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
356
|
+
) => C
|
|
295
357
|
): CommandOutHelper<Arg, C, Id, I18nKey, State>
|
|
296
358
|
<
|
|
297
359
|
Eff extends Effect.Yieldable<any, any, any, any>,
|
|
@@ -313,12 +375,24 @@ export declare namespace Commander {
|
|
|
313
375
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
314
376
|
: never
|
|
315
377
|
>,
|
|
316
|
-
arg:
|
|
378
|
+
arg: ArgForCombinator<Arg>,
|
|
317
379
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
318
380
|
) => A,
|
|
319
|
-
b: (
|
|
320
|
-
|
|
321
|
-
|
|
381
|
+
b: (
|
|
382
|
+
_: A,
|
|
383
|
+
arg: ArgForCombinator<Arg>,
|
|
384
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
385
|
+
) => B,
|
|
386
|
+
c: (
|
|
387
|
+
_: B,
|
|
388
|
+
arg: ArgForCombinator<Arg>,
|
|
389
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
390
|
+
) => C,
|
|
391
|
+
d: (
|
|
392
|
+
_: C,
|
|
393
|
+
arg: ArgForCombinator<Arg>,
|
|
394
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
395
|
+
) => D
|
|
322
396
|
): CommandOutHelper<Arg, D, Id, I18nKey, State>
|
|
323
397
|
<
|
|
324
398
|
Eff extends Effect.Yieldable<any, any, any, any>,
|
|
@@ -341,13 +415,29 @@ export declare namespace Commander {
|
|
|
341
415
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
342
416
|
: never
|
|
343
417
|
>,
|
|
344
|
-
arg:
|
|
418
|
+
arg: ArgForCombinator<Arg>,
|
|
345
419
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
346
420
|
) => A,
|
|
347
|
-
b: (
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
421
|
+
b: (
|
|
422
|
+
_: A,
|
|
423
|
+
arg: ArgForCombinator<Arg>,
|
|
424
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
425
|
+
) => B,
|
|
426
|
+
c: (
|
|
427
|
+
_: B,
|
|
428
|
+
arg: ArgForCombinator<Arg>,
|
|
429
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
430
|
+
) => C,
|
|
431
|
+
d: (
|
|
432
|
+
_: C,
|
|
433
|
+
arg: ArgForCombinator<Arg>,
|
|
434
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
435
|
+
) => D,
|
|
436
|
+
e: (
|
|
437
|
+
_: D,
|
|
438
|
+
arg: ArgForCombinator<Arg>,
|
|
439
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
440
|
+
) => E
|
|
351
441
|
): CommandOutHelper<Arg, E, Id, I18nKey, State>
|
|
352
442
|
<
|
|
353
443
|
Eff extends Effect.Yieldable<any, any, any, any>,
|
|
@@ -371,14 +461,34 @@ export declare namespace Commander {
|
|
|
371
461
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
372
462
|
: never
|
|
373
463
|
>,
|
|
374
|
-
arg:
|
|
464
|
+
arg: ArgForCombinator<Arg>,
|
|
375
465
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
376
466
|
) => A,
|
|
377
|
-
b: (
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
467
|
+
b: (
|
|
468
|
+
_: A,
|
|
469
|
+
arg: ArgForCombinator<Arg>,
|
|
470
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
471
|
+
) => B,
|
|
472
|
+
c: (
|
|
473
|
+
_: B,
|
|
474
|
+
arg: ArgForCombinator<Arg>,
|
|
475
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
476
|
+
) => C,
|
|
477
|
+
d: (
|
|
478
|
+
_: C,
|
|
479
|
+
arg: ArgForCombinator<Arg>,
|
|
480
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
481
|
+
) => D,
|
|
482
|
+
e: (
|
|
483
|
+
_: D,
|
|
484
|
+
arg: ArgForCombinator<Arg>,
|
|
485
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
486
|
+
) => E,
|
|
487
|
+
f: (
|
|
488
|
+
_: E,
|
|
489
|
+
arg: ArgForCombinator<Arg>,
|
|
490
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
491
|
+
) => F
|
|
382
492
|
): CommandOutHelper<Arg, F, Id, I18nKey, State>
|
|
383
493
|
<
|
|
384
494
|
Eff extends Effect.Yieldable<any, any, any, any>,
|
|
@@ -403,15 +513,39 @@ export declare namespace Commander {
|
|
|
403
513
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
404
514
|
: never
|
|
405
515
|
>,
|
|
406
|
-
arg:
|
|
516
|
+
arg: ArgForCombinator<Arg>,
|
|
407
517
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
408
518
|
) => A,
|
|
409
|
-
b: (
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
519
|
+
b: (
|
|
520
|
+
_: A,
|
|
521
|
+
arg: ArgForCombinator<Arg>,
|
|
522
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
523
|
+
) => B,
|
|
524
|
+
c: (
|
|
525
|
+
_: B,
|
|
526
|
+
arg: ArgForCombinator<Arg>,
|
|
527
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
528
|
+
) => C,
|
|
529
|
+
d: (
|
|
530
|
+
_: C,
|
|
531
|
+
arg: ArgForCombinator<Arg>,
|
|
532
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
533
|
+
) => D,
|
|
534
|
+
e: (
|
|
535
|
+
_: D,
|
|
536
|
+
arg: ArgForCombinator<Arg>,
|
|
537
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
538
|
+
) => E,
|
|
539
|
+
f: (
|
|
540
|
+
_: E,
|
|
541
|
+
arg: ArgForCombinator<Arg>,
|
|
542
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
543
|
+
) => F,
|
|
544
|
+
g: (
|
|
545
|
+
_: F,
|
|
546
|
+
arg: ArgForCombinator<Arg>,
|
|
547
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
548
|
+
) => G
|
|
415
549
|
): CommandOutHelper<Arg, G, Id, I18nKey, State>
|
|
416
550
|
<
|
|
417
551
|
Eff extends Effect.Yieldable<any, any, any, any>,
|
|
@@ -437,16 +571,44 @@ export declare namespace Commander {
|
|
|
437
571
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
438
572
|
: never
|
|
439
573
|
>,
|
|
440
|
-
arg:
|
|
574
|
+
arg: ArgForCombinator<Arg>,
|
|
441
575
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
442
576
|
) => A,
|
|
443
|
-
b: (
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
577
|
+
b: (
|
|
578
|
+
_: A,
|
|
579
|
+
arg: ArgForCombinator<Arg>,
|
|
580
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
581
|
+
) => B,
|
|
582
|
+
c: (
|
|
583
|
+
_: B,
|
|
584
|
+
arg: ArgForCombinator<Arg>,
|
|
585
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
586
|
+
) => C,
|
|
587
|
+
d: (
|
|
588
|
+
_: C,
|
|
589
|
+
arg: ArgForCombinator<Arg>,
|
|
590
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
591
|
+
) => D,
|
|
592
|
+
e: (
|
|
593
|
+
_: D,
|
|
594
|
+
arg: ArgForCombinator<Arg>,
|
|
595
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
596
|
+
) => E,
|
|
597
|
+
f: (
|
|
598
|
+
_: E,
|
|
599
|
+
arg: ArgForCombinator<Arg>,
|
|
600
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
601
|
+
) => F,
|
|
602
|
+
g: (
|
|
603
|
+
_: F,
|
|
604
|
+
arg: ArgForCombinator<Arg>,
|
|
605
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
606
|
+
) => G,
|
|
607
|
+
h: (
|
|
608
|
+
_: G,
|
|
609
|
+
arg: ArgForCombinator<Arg>,
|
|
610
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
611
|
+
) => H
|
|
450
612
|
): CommandOutHelper<Arg, H, Id, I18nKey, State>
|
|
451
613
|
<
|
|
452
614
|
Eff extends Effect.Yieldable<any, any, any, any>,
|
|
@@ -473,17 +635,49 @@ export declare namespace Commander {
|
|
|
473
635
|
: [Eff] extends [Effect.Yieldable<any, infer _A, infer _E, infer R>] ? R
|
|
474
636
|
: never
|
|
475
637
|
>,
|
|
476
|
-
arg:
|
|
638
|
+
arg: ArgForCombinator<Arg>,
|
|
477
639
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
478
640
|
) => A,
|
|
479
|
-
b: (
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
641
|
+
b: (
|
|
642
|
+
_: A,
|
|
643
|
+
arg: ArgForCombinator<Arg>,
|
|
644
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
645
|
+
) => B,
|
|
646
|
+
c: (
|
|
647
|
+
_: B,
|
|
648
|
+
arg: ArgForCombinator<Arg>,
|
|
649
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
650
|
+
) => C,
|
|
651
|
+
d: (
|
|
652
|
+
_: C,
|
|
653
|
+
arg: ArgForCombinator<Arg>,
|
|
654
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
655
|
+
) => D,
|
|
656
|
+
e: (
|
|
657
|
+
_: D,
|
|
658
|
+
arg: ArgForCombinator<Arg>,
|
|
659
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
660
|
+
) => E,
|
|
661
|
+
f: (
|
|
662
|
+
_: E,
|
|
663
|
+
arg: ArgForCombinator<Arg>,
|
|
664
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
665
|
+
) => F,
|
|
666
|
+
g: (
|
|
667
|
+
_: F,
|
|
668
|
+
arg: ArgForCombinator<Arg>,
|
|
669
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
670
|
+
) => G,
|
|
671
|
+
h: (
|
|
672
|
+
_: G,
|
|
673
|
+
arg: ArgForCombinator<Arg>,
|
|
674
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
675
|
+
) => H,
|
|
676
|
+
i: (
|
|
677
|
+
_: H,
|
|
678
|
+
arg: ArgForCombinator<Arg>,
|
|
679
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
680
|
+
) => I
|
|
487
681
|
): CommandOutHelper<Arg, I, Id, I18nKey, State>
|
|
488
682
|
}
|
|
489
683
|
|
|
@@ -500,7 +694,11 @@ export declare namespace Commander {
|
|
|
500
694
|
Arg = void
|
|
501
695
|
>(
|
|
502
696
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
503
|
-
a: (
|
|
697
|
+
a: (
|
|
698
|
+
_: A,
|
|
699
|
+
arg: ArgForCombinator<Arg>,
|
|
700
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
701
|
+
) => Eff
|
|
504
702
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
505
703
|
<
|
|
506
704
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -509,8 +707,16 @@ export declare namespace Commander {
|
|
|
509
707
|
Arg = void
|
|
510
708
|
>(
|
|
511
709
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
512
|
-
a: (
|
|
513
|
-
|
|
710
|
+
a: (
|
|
711
|
+
_: A,
|
|
712
|
+
arg: ArgForCombinator<Arg>,
|
|
713
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
714
|
+
) => B,
|
|
715
|
+
b: (
|
|
716
|
+
_: B,
|
|
717
|
+
arg: ArgForCombinator<Arg>,
|
|
718
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
719
|
+
) => Eff
|
|
514
720
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
515
721
|
<
|
|
516
722
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -520,9 +726,21 @@ export declare namespace Commander {
|
|
|
520
726
|
Arg = void
|
|
521
727
|
>(
|
|
522
728
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
523
|
-
a: (
|
|
524
|
-
|
|
525
|
-
|
|
729
|
+
a: (
|
|
730
|
+
_: A,
|
|
731
|
+
arg: ArgForCombinator<Arg>,
|
|
732
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
733
|
+
) => B,
|
|
734
|
+
b: (
|
|
735
|
+
_: B,
|
|
736
|
+
arg: ArgForCombinator<Arg>,
|
|
737
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
738
|
+
) => C,
|
|
739
|
+
c: (
|
|
740
|
+
_: C,
|
|
741
|
+
arg: ArgForCombinator<Arg>,
|
|
742
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
743
|
+
) => Eff
|
|
526
744
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
527
745
|
<
|
|
528
746
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -533,10 +751,26 @@ export declare namespace Commander {
|
|
|
533
751
|
Arg = void
|
|
534
752
|
>(
|
|
535
753
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
536
|
-
a: (
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
754
|
+
a: (
|
|
755
|
+
_: A,
|
|
756
|
+
arg: ArgForCombinator<Arg>,
|
|
757
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
758
|
+
) => B,
|
|
759
|
+
b: (
|
|
760
|
+
_: B,
|
|
761
|
+
arg: ArgForCombinator<Arg>,
|
|
762
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
763
|
+
) => C,
|
|
764
|
+
c: (
|
|
765
|
+
_: C,
|
|
766
|
+
arg: ArgForCombinator<Arg>,
|
|
767
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
768
|
+
) => D,
|
|
769
|
+
d: (
|
|
770
|
+
_: D,
|
|
771
|
+
arg: ArgForCombinator<Arg>,
|
|
772
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
773
|
+
) => Eff
|
|
540
774
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
541
775
|
<
|
|
542
776
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -548,11 +782,31 @@ export declare namespace Commander {
|
|
|
548
782
|
Arg = void
|
|
549
783
|
>(
|
|
550
784
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
551
|
-
a: (
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
785
|
+
a: (
|
|
786
|
+
_: A,
|
|
787
|
+
arg: ArgForCombinator<Arg>,
|
|
788
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
789
|
+
) => B,
|
|
790
|
+
b: (
|
|
791
|
+
_: B,
|
|
792
|
+
arg: ArgForCombinator<Arg>,
|
|
793
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
794
|
+
) => C,
|
|
795
|
+
c: (
|
|
796
|
+
_: C,
|
|
797
|
+
arg: ArgForCombinator<Arg>,
|
|
798
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
799
|
+
) => D,
|
|
800
|
+
d: (
|
|
801
|
+
_: D,
|
|
802
|
+
arg: ArgForCombinator<Arg>,
|
|
803
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
804
|
+
) => E,
|
|
805
|
+
e: (
|
|
806
|
+
_: E,
|
|
807
|
+
arg: ArgForCombinator<Arg>,
|
|
808
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
809
|
+
) => Eff
|
|
556
810
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
557
811
|
<
|
|
558
812
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -565,12 +819,36 @@ export declare namespace Commander {
|
|
|
565
819
|
Arg = void
|
|
566
820
|
>(
|
|
567
821
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
568
|
-
a: (
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
822
|
+
a: (
|
|
823
|
+
_: A,
|
|
824
|
+
arg: ArgForCombinator<Arg>,
|
|
825
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
826
|
+
) => B,
|
|
827
|
+
b: (
|
|
828
|
+
_: B,
|
|
829
|
+
arg: ArgForCombinator<Arg>,
|
|
830
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
831
|
+
) => C,
|
|
832
|
+
c: (
|
|
833
|
+
_: C,
|
|
834
|
+
arg: ArgForCombinator<Arg>,
|
|
835
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
836
|
+
) => D,
|
|
837
|
+
d: (
|
|
838
|
+
_: D,
|
|
839
|
+
arg: ArgForCombinator<Arg>,
|
|
840
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
841
|
+
) => E,
|
|
842
|
+
e: (
|
|
843
|
+
_: E,
|
|
844
|
+
arg: ArgForCombinator<Arg>,
|
|
845
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
846
|
+
) => F,
|
|
847
|
+
f: (
|
|
848
|
+
_: F,
|
|
849
|
+
arg: ArgForCombinator<Arg>,
|
|
850
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
851
|
+
) => Eff
|
|
574
852
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
575
853
|
<
|
|
576
854
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -584,13 +862,41 @@ export declare namespace Commander {
|
|
|
584
862
|
Arg = void
|
|
585
863
|
>(
|
|
586
864
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
587
|
-
a: (
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
865
|
+
a: (
|
|
866
|
+
_: A,
|
|
867
|
+
arg: ArgForCombinator<Arg>,
|
|
868
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
869
|
+
) => B,
|
|
870
|
+
b: (
|
|
871
|
+
_: B,
|
|
872
|
+
arg: ArgForCombinator<Arg>,
|
|
873
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
874
|
+
) => C,
|
|
875
|
+
c: (
|
|
876
|
+
_: C,
|
|
877
|
+
arg: ArgForCombinator<Arg>,
|
|
878
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
879
|
+
) => D,
|
|
880
|
+
d: (
|
|
881
|
+
_: D,
|
|
882
|
+
arg: ArgForCombinator<Arg>,
|
|
883
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
884
|
+
) => E,
|
|
885
|
+
e: (
|
|
886
|
+
_: E,
|
|
887
|
+
arg: ArgForCombinator<Arg>,
|
|
888
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
889
|
+
) => F,
|
|
890
|
+
f: (
|
|
891
|
+
_: F,
|
|
892
|
+
arg: ArgForCombinator<Arg>,
|
|
893
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
894
|
+
) => G,
|
|
895
|
+
g: (
|
|
896
|
+
_: G,
|
|
897
|
+
arg: ArgForCombinator<Arg>,
|
|
898
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
899
|
+
) => Eff
|
|
594
900
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
595
901
|
<
|
|
596
902
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -605,14 +911,46 @@ export declare namespace Commander {
|
|
|
605
911
|
Arg = void
|
|
606
912
|
>(
|
|
607
913
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
608
|
-
a: (
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
914
|
+
a: (
|
|
915
|
+
_: A,
|
|
916
|
+
arg: ArgForCombinator<Arg>,
|
|
917
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
918
|
+
) => B,
|
|
919
|
+
b: (
|
|
920
|
+
_: B,
|
|
921
|
+
arg: ArgForCombinator<Arg>,
|
|
922
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
923
|
+
) => C,
|
|
924
|
+
c: (
|
|
925
|
+
_: C,
|
|
926
|
+
arg: ArgForCombinator<Arg>,
|
|
927
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
928
|
+
) => D,
|
|
929
|
+
d: (
|
|
930
|
+
_: D,
|
|
931
|
+
arg: ArgForCombinator<Arg>,
|
|
932
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
933
|
+
) => E,
|
|
934
|
+
e: (
|
|
935
|
+
_: E,
|
|
936
|
+
arg: ArgForCombinator<Arg>,
|
|
937
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
938
|
+
) => F,
|
|
939
|
+
f: (
|
|
940
|
+
_: F,
|
|
941
|
+
arg: ArgForCombinator<Arg>,
|
|
942
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
943
|
+
) => G,
|
|
944
|
+
g: (
|
|
945
|
+
_: G,
|
|
946
|
+
arg: ArgForCombinator<Arg>,
|
|
947
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
948
|
+
) => H,
|
|
949
|
+
h: (
|
|
950
|
+
_: H,
|
|
951
|
+
arg: ArgForCombinator<Arg>,
|
|
952
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
953
|
+
) => Eff
|
|
616
954
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
617
955
|
<
|
|
618
956
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -628,15 +966,51 @@ export declare namespace Commander {
|
|
|
628
966
|
Arg = void
|
|
629
967
|
>(
|
|
630
968
|
body: (arg: Arg, ctx: CommandContextLocal2<Id, I18nKey, State>) => A,
|
|
631
|
-
a: (
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
969
|
+
a: (
|
|
970
|
+
_: A,
|
|
971
|
+
arg: ArgForCombinator<Arg>,
|
|
972
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
973
|
+
) => B,
|
|
974
|
+
b: (
|
|
975
|
+
_: B,
|
|
976
|
+
arg: ArgForCombinator<Arg>,
|
|
977
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
978
|
+
) => C,
|
|
979
|
+
c: (
|
|
980
|
+
_: C,
|
|
981
|
+
arg: ArgForCombinator<Arg>,
|
|
982
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
983
|
+
) => D,
|
|
984
|
+
d: (
|
|
985
|
+
_: D,
|
|
986
|
+
arg: ArgForCombinator<Arg>,
|
|
987
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
988
|
+
) => E,
|
|
989
|
+
e: (
|
|
990
|
+
_: E,
|
|
991
|
+
arg: ArgForCombinator<Arg>,
|
|
992
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
993
|
+
) => F,
|
|
994
|
+
f: (
|
|
995
|
+
_: F,
|
|
996
|
+
arg: ArgForCombinator<Arg>,
|
|
997
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
998
|
+
) => G,
|
|
999
|
+
g: (
|
|
1000
|
+
_: G,
|
|
1001
|
+
arg: ArgForCombinator<Arg>,
|
|
1002
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1003
|
+
) => H,
|
|
1004
|
+
h: (
|
|
1005
|
+
_: H,
|
|
1006
|
+
arg: ArgForCombinator<Arg>,
|
|
1007
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1008
|
+
) => I,
|
|
1009
|
+
i: (
|
|
1010
|
+
_: H,
|
|
1011
|
+
arg: ArgForCombinator<Arg>,
|
|
1012
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1013
|
+
) => Eff
|
|
640
1014
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
641
1015
|
}
|
|
642
1016
|
|
|
@@ -669,7 +1043,7 @@ export declare namespace Commander {
|
|
|
669
1043
|
EEff,
|
|
670
1044
|
REff
|
|
671
1045
|
>,
|
|
672
|
-
arg:
|
|
1046
|
+
arg: ArgForCombinator<Arg>,
|
|
673
1047
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
674
1048
|
) => A
|
|
675
1049
|
): CommandOutHelper<Arg, A, Id, I18nKey, State>
|
|
@@ -683,10 +1057,14 @@ export declare namespace Commander {
|
|
|
683
1057
|
EEff,
|
|
684
1058
|
REff
|
|
685
1059
|
>,
|
|
686
|
-
arg:
|
|
1060
|
+
arg: ArgForCombinator<Arg>,
|
|
687
1061
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
688
1062
|
) => A,
|
|
689
|
-
b: (
|
|
1063
|
+
b: (
|
|
1064
|
+
_: A,
|
|
1065
|
+
arg: ArgForCombinator<Arg>,
|
|
1066
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1067
|
+
) => B
|
|
690
1068
|
): CommandOutHelper<Arg, B, Id, I18nKey, State>
|
|
691
1069
|
<
|
|
692
1070
|
A,
|
|
@@ -699,11 +1077,19 @@ export declare namespace Commander {
|
|
|
699
1077
|
EEff,
|
|
700
1078
|
REff
|
|
701
1079
|
>,
|
|
702
|
-
arg:
|
|
1080
|
+
arg: ArgForCombinator<Arg>,
|
|
703
1081
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
704
1082
|
) => A,
|
|
705
|
-
b: (
|
|
706
|
-
|
|
1083
|
+
b: (
|
|
1084
|
+
_: A,
|
|
1085
|
+
arg: ArgForCombinator<Arg>,
|
|
1086
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1087
|
+
) => B,
|
|
1088
|
+
c: (
|
|
1089
|
+
_: B,
|
|
1090
|
+
arg: ArgForCombinator<Arg>,
|
|
1091
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1092
|
+
) => C
|
|
707
1093
|
): CommandOutHelper<Arg, C, Id, I18nKey, State>
|
|
708
1094
|
<
|
|
709
1095
|
A,
|
|
@@ -717,12 +1103,24 @@ export declare namespace Commander {
|
|
|
717
1103
|
EEff,
|
|
718
1104
|
REff
|
|
719
1105
|
>,
|
|
720
|
-
arg:
|
|
1106
|
+
arg: ArgForCombinator<Arg>,
|
|
721
1107
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
722
1108
|
) => A,
|
|
723
|
-
b: (
|
|
724
|
-
|
|
725
|
-
|
|
1109
|
+
b: (
|
|
1110
|
+
_: A,
|
|
1111
|
+
arg: ArgForCombinator<Arg>,
|
|
1112
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1113
|
+
) => B,
|
|
1114
|
+
c: (
|
|
1115
|
+
_: B,
|
|
1116
|
+
arg: ArgForCombinator<Arg>,
|
|
1117
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1118
|
+
) => C,
|
|
1119
|
+
d: (
|
|
1120
|
+
_: C,
|
|
1121
|
+
arg: ArgForCombinator<Arg>,
|
|
1122
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1123
|
+
) => D
|
|
726
1124
|
): CommandOutHelper<Arg, D, Id, I18nKey, State>
|
|
727
1125
|
<
|
|
728
1126
|
A,
|
|
@@ -737,13 +1135,29 @@ export declare namespace Commander {
|
|
|
737
1135
|
EEff,
|
|
738
1136
|
REff
|
|
739
1137
|
>,
|
|
740
|
-
arg:
|
|
1138
|
+
arg: ArgForCombinator<Arg>,
|
|
741
1139
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
742
1140
|
) => A,
|
|
743
|
-
b: (
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
1141
|
+
b: (
|
|
1142
|
+
_: A,
|
|
1143
|
+
arg: ArgForCombinator<Arg>,
|
|
1144
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1145
|
+
) => B,
|
|
1146
|
+
c: (
|
|
1147
|
+
_: B,
|
|
1148
|
+
arg: ArgForCombinator<Arg>,
|
|
1149
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1150
|
+
) => C,
|
|
1151
|
+
d: (
|
|
1152
|
+
_: C,
|
|
1153
|
+
arg: ArgForCombinator<Arg>,
|
|
1154
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1155
|
+
) => D,
|
|
1156
|
+
e: (
|
|
1157
|
+
_: D,
|
|
1158
|
+
arg: ArgForCombinator<Arg>,
|
|
1159
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1160
|
+
) => E
|
|
747
1161
|
): CommandOutHelper<Arg, E, Id, I18nKey, State>
|
|
748
1162
|
<
|
|
749
1163
|
A,
|
|
@@ -759,14 +1173,34 @@ export declare namespace Commander {
|
|
|
759
1173
|
EEff,
|
|
760
1174
|
REff
|
|
761
1175
|
>,
|
|
762
|
-
arg:
|
|
1176
|
+
arg: ArgForCombinator<Arg>,
|
|
763
1177
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
764
1178
|
) => A,
|
|
765
|
-
b: (
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
1179
|
+
b: (
|
|
1180
|
+
_: A,
|
|
1181
|
+
arg: ArgForCombinator<Arg>,
|
|
1182
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1183
|
+
) => B,
|
|
1184
|
+
c: (
|
|
1185
|
+
_: B,
|
|
1186
|
+
arg: ArgForCombinator<Arg>,
|
|
1187
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1188
|
+
) => C,
|
|
1189
|
+
d: (
|
|
1190
|
+
_: C,
|
|
1191
|
+
arg: ArgForCombinator<Arg>,
|
|
1192
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1193
|
+
) => D,
|
|
1194
|
+
e: (
|
|
1195
|
+
_: D,
|
|
1196
|
+
arg: ArgForCombinator<Arg>,
|
|
1197
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1198
|
+
) => E,
|
|
1199
|
+
f: (
|
|
1200
|
+
_: E,
|
|
1201
|
+
arg: ArgForCombinator<Arg>,
|
|
1202
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1203
|
+
) => F
|
|
770
1204
|
): CommandOutHelper<Arg, F, Id, I18nKey, State>
|
|
771
1205
|
<
|
|
772
1206
|
A,
|
|
@@ -783,15 +1217,39 @@ export declare namespace Commander {
|
|
|
783
1217
|
EEff,
|
|
784
1218
|
REff
|
|
785
1219
|
>,
|
|
786
|
-
arg:
|
|
1220
|
+
arg: ArgForCombinator<Arg>,
|
|
787
1221
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
788
1222
|
) => A,
|
|
789
|
-
b: (
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
1223
|
+
b: (
|
|
1224
|
+
_: A,
|
|
1225
|
+
arg: ArgForCombinator<Arg>,
|
|
1226
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1227
|
+
) => B,
|
|
1228
|
+
c: (
|
|
1229
|
+
_: B,
|
|
1230
|
+
arg: ArgForCombinator<Arg>,
|
|
1231
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1232
|
+
) => C,
|
|
1233
|
+
d: (
|
|
1234
|
+
_: C,
|
|
1235
|
+
arg: ArgForCombinator<Arg>,
|
|
1236
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1237
|
+
) => D,
|
|
1238
|
+
e: (
|
|
1239
|
+
_: D,
|
|
1240
|
+
arg: ArgForCombinator<Arg>,
|
|
1241
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1242
|
+
) => E,
|
|
1243
|
+
f: (
|
|
1244
|
+
_: E,
|
|
1245
|
+
arg: ArgForCombinator<Arg>,
|
|
1246
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1247
|
+
) => F,
|
|
1248
|
+
g: (
|
|
1249
|
+
_: F,
|
|
1250
|
+
arg: ArgForCombinator<Arg>,
|
|
1251
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1252
|
+
) => G
|
|
795
1253
|
): CommandOutHelper<Arg, G, Id, I18nKey, State>
|
|
796
1254
|
<A, B, C, D, E, F, G, H extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>>(
|
|
797
1255
|
a: (
|
|
@@ -800,16 +1258,44 @@ export declare namespace Commander {
|
|
|
800
1258
|
EEff,
|
|
801
1259
|
REff
|
|
802
1260
|
>,
|
|
803
|
-
arg:
|
|
1261
|
+
arg: ArgForCombinator<Arg>,
|
|
804
1262
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
805
1263
|
) => A,
|
|
806
|
-
b: (
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1264
|
+
b: (
|
|
1265
|
+
_: A,
|
|
1266
|
+
arg: ArgForCombinator<Arg>,
|
|
1267
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1268
|
+
) => B,
|
|
1269
|
+
c: (
|
|
1270
|
+
_: B,
|
|
1271
|
+
arg: ArgForCombinator<Arg>,
|
|
1272
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1273
|
+
) => C,
|
|
1274
|
+
d: (
|
|
1275
|
+
_: C,
|
|
1276
|
+
arg: ArgForCombinator<Arg>,
|
|
1277
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1278
|
+
) => D,
|
|
1279
|
+
e: (
|
|
1280
|
+
_: D,
|
|
1281
|
+
arg: ArgForCombinator<Arg>,
|
|
1282
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1283
|
+
) => E,
|
|
1284
|
+
f: (
|
|
1285
|
+
_: E,
|
|
1286
|
+
arg: ArgForCombinator<Arg>,
|
|
1287
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1288
|
+
) => F,
|
|
1289
|
+
g: (
|
|
1290
|
+
_: F,
|
|
1291
|
+
arg: ArgForCombinator<Arg>,
|
|
1292
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1293
|
+
) => G,
|
|
1294
|
+
h: (
|
|
1295
|
+
_: G,
|
|
1296
|
+
arg: ArgForCombinator<Arg>,
|
|
1297
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1298
|
+
) => H
|
|
813
1299
|
): CommandOutHelper<Arg, H, Id, I18nKey, State>
|
|
814
1300
|
<A, B, C, D, E, F, G, H, I extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>>(
|
|
815
1301
|
a: (
|
|
@@ -818,17 +1304,49 @@ export declare namespace Commander {
|
|
|
818
1304
|
EEff,
|
|
819
1305
|
REff
|
|
820
1306
|
>,
|
|
821
|
-
arg:
|
|
1307
|
+
arg: ArgForCombinator<Arg>,
|
|
822
1308
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
823
1309
|
) => A,
|
|
824
|
-
b: (
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1310
|
+
b: (
|
|
1311
|
+
_: A,
|
|
1312
|
+
arg: ArgForCombinator<Arg>,
|
|
1313
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1314
|
+
) => B,
|
|
1315
|
+
c: (
|
|
1316
|
+
_: B,
|
|
1317
|
+
arg: ArgForCombinator<Arg>,
|
|
1318
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1319
|
+
) => C,
|
|
1320
|
+
d: (
|
|
1321
|
+
_: C,
|
|
1322
|
+
arg: ArgForCombinator<Arg>,
|
|
1323
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1324
|
+
) => D,
|
|
1325
|
+
e: (
|
|
1326
|
+
_: D,
|
|
1327
|
+
arg: ArgForCombinator<Arg>,
|
|
1328
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1329
|
+
) => E,
|
|
1330
|
+
f: (
|
|
1331
|
+
_: E,
|
|
1332
|
+
arg: ArgForCombinator<Arg>,
|
|
1333
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1334
|
+
) => F,
|
|
1335
|
+
g: (
|
|
1336
|
+
_: F,
|
|
1337
|
+
arg: ArgForCombinator<Arg>,
|
|
1338
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1339
|
+
) => G,
|
|
1340
|
+
h: (
|
|
1341
|
+
_: G,
|
|
1342
|
+
arg: ArgForCombinator<Arg>,
|
|
1343
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1344
|
+
) => H,
|
|
1345
|
+
i: (
|
|
1346
|
+
_: H,
|
|
1347
|
+
arg: ArgForCombinator<Arg>,
|
|
1348
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1349
|
+
) => I
|
|
832
1350
|
): CommandOutHelper<Arg, I, Id, I18nKey, State>
|
|
833
1351
|
}
|
|
834
1352
|
|
|
@@ -854,7 +1372,7 @@ export declare namespace Commander {
|
|
|
854
1372
|
EEff,
|
|
855
1373
|
REff
|
|
856
1374
|
>,
|
|
857
|
-
arg:
|
|
1375
|
+
arg: ArgForCombinator<Arg>,
|
|
858
1376
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
859
1377
|
) => Eff
|
|
860
1378
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
@@ -869,10 +1387,14 @@ export declare namespace Commander {
|
|
|
869
1387
|
EEff,
|
|
870
1388
|
REff
|
|
871
1389
|
>,
|
|
872
|
-
arg:
|
|
1390
|
+
arg: ArgForCombinator<Arg>,
|
|
873
1391
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
874
1392
|
) => B,
|
|
875
|
-
b: (
|
|
1393
|
+
b: (
|
|
1394
|
+
_: B,
|
|
1395
|
+
arg: ArgForCombinator<Arg>,
|
|
1396
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1397
|
+
) => Eff
|
|
876
1398
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
877
1399
|
<
|
|
878
1400
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -886,11 +1408,19 @@ export declare namespace Commander {
|
|
|
886
1408
|
EEff,
|
|
887
1409
|
REff
|
|
888
1410
|
>,
|
|
889
|
-
arg:
|
|
1411
|
+
arg: ArgForCombinator<Arg>,
|
|
890
1412
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
891
1413
|
) => B,
|
|
892
|
-
b: (
|
|
893
|
-
|
|
1414
|
+
b: (
|
|
1415
|
+
_: B,
|
|
1416
|
+
arg: ArgForCombinator<Arg>,
|
|
1417
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1418
|
+
) => C,
|
|
1419
|
+
c: (
|
|
1420
|
+
_: C,
|
|
1421
|
+
arg: ArgForCombinator<Arg>,
|
|
1422
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1423
|
+
) => Eff
|
|
894
1424
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
895
1425
|
<
|
|
896
1426
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -905,12 +1435,24 @@ export declare namespace Commander {
|
|
|
905
1435
|
EEff,
|
|
906
1436
|
REff
|
|
907
1437
|
>,
|
|
908
|
-
arg:
|
|
1438
|
+
arg: ArgForCombinator<Arg>,
|
|
909
1439
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
910
1440
|
) => B,
|
|
911
|
-
b: (
|
|
912
|
-
|
|
913
|
-
|
|
1441
|
+
b: (
|
|
1442
|
+
_: B,
|
|
1443
|
+
arg: ArgForCombinator<Arg>,
|
|
1444
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1445
|
+
) => C,
|
|
1446
|
+
c: (
|
|
1447
|
+
_: C,
|
|
1448
|
+
arg: ArgForCombinator<Arg>,
|
|
1449
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1450
|
+
) => D,
|
|
1451
|
+
d: (
|
|
1452
|
+
_: D,
|
|
1453
|
+
arg: ArgForCombinator<Arg>,
|
|
1454
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1455
|
+
) => Eff
|
|
914
1456
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
915
1457
|
<
|
|
916
1458
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -926,13 +1468,29 @@ export declare namespace Commander {
|
|
|
926
1468
|
EEff,
|
|
927
1469
|
REff
|
|
928
1470
|
>,
|
|
929
|
-
arg:
|
|
1471
|
+
arg: ArgForCombinator<Arg>,
|
|
930
1472
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
931
1473
|
) => B,
|
|
932
|
-
b: (
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1474
|
+
b: (
|
|
1475
|
+
_: B,
|
|
1476
|
+
arg: ArgForCombinator<Arg>,
|
|
1477
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1478
|
+
) => C,
|
|
1479
|
+
c: (
|
|
1480
|
+
_: C,
|
|
1481
|
+
arg: ArgForCombinator<Arg>,
|
|
1482
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1483
|
+
) => D,
|
|
1484
|
+
d: (
|
|
1485
|
+
_: D,
|
|
1486
|
+
arg: ArgForCombinator<Arg>,
|
|
1487
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1488
|
+
) => E,
|
|
1489
|
+
e: (
|
|
1490
|
+
_: E,
|
|
1491
|
+
arg: ArgForCombinator<Arg>,
|
|
1492
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1493
|
+
) => Eff
|
|
936
1494
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
937
1495
|
<
|
|
938
1496
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -949,14 +1507,34 @@ export declare namespace Commander {
|
|
|
949
1507
|
EEff,
|
|
950
1508
|
REff
|
|
951
1509
|
>,
|
|
952
|
-
arg:
|
|
1510
|
+
arg: ArgForCombinator<Arg>,
|
|
953
1511
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
954
1512
|
) => B,
|
|
955
|
-
b: (
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1513
|
+
b: (
|
|
1514
|
+
_: B,
|
|
1515
|
+
arg: ArgForCombinator<Arg>,
|
|
1516
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1517
|
+
) => C,
|
|
1518
|
+
c: (
|
|
1519
|
+
_: C,
|
|
1520
|
+
arg: ArgForCombinator<Arg>,
|
|
1521
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1522
|
+
) => D,
|
|
1523
|
+
d: (
|
|
1524
|
+
_: D,
|
|
1525
|
+
arg: ArgForCombinator<Arg>,
|
|
1526
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1527
|
+
) => E,
|
|
1528
|
+
e: (
|
|
1529
|
+
_: E,
|
|
1530
|
+
arg: ArgForCombinator<Arg>,
|
|
1531
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1532
|
+
) => F,
|
|
1533
|
+
f: (
|
|
1534
|
+
_: F,
|
|
1535
|
+
arg: ArgForCombinator<Arg>,
|
|
1536
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1537
|
+
) => Eff
|
|
960
1538
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
961
1539
|
<
|
|
962
1540
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -974,15 +1552,39 @@ export declare namespace Commander {
|
|
|
974
1552
|
EEff,
|
|
975
1553
|
REff
|
|
976
1554
|
>,
|
|
977
|
-
arg:
|
|
1555
|
+
arg: ArgForCombinator<Arg>,
|
|
978
1556
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
979
1557
|
) => B,
|
|
980
|
-
b: (
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1558
|
+
b: (
|
|
1559
|
+
_: B,
|
|
1560
|
+
arg: ArgForCombinator<Arg>,
|
|
1561
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1562
|
+
) => C,
|
|
1563
|
+
c: (
|
|
1564
|
+
_: C,
|
|
1565
|
+
arg: ArgForCombinator<Arg>,
|
|
1566
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1567
|
+
) => D,
|
|
1568
|
+
d: (
|
|
1569
|
+
_: D,
|
|
1570
|
+
arg: ArgForCombinator<Arg>,
|
|
1571
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1572
|
+
) => E,
|
|
1573
|
+
e: (
|
|
1574
|
+
_: E,
|
|
1575
|
+
arg: ArgForCombinator<Arg>,
|
|
1576
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1577
|
+
) => F,
|
|
1578
|
+
f: (
|
|
1579
|
+
_: F,
|
|
1580
|
+
arg: ArgForCombinator<Arg>,
|
|
1581
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1582
|
+
) => G,
|
|
1583
|
+
g: (
|
|
1584
|
+
_: G,
|
|
1585
|
+
arg: ArgForCombinator<Arg>,
|
|
1586
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1587
|
+
) => Eff
|
|
986
1588
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
987
1589
|
<
|
|
988
1590
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -1001,16 +1603,44 @@ export declare namespace Commander {
|
|
|
1001
1603
|
EEff,
|
|
1002
1604
|
REff
|
|
1003
1605
|
>,
|
|
1004
|
-
arg:
|
|
1606
|
+
arg: ArgForCombinator<Arg>,
|
|
1005
1607
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1006
1608
|
) => B,
|
|
1007
|
-
b: (
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1609
|
+
b: (
|
|
1610
|
+
_: B,
|
|
1611
|
+
arg: ArgForCombinator<Arg>,
|
|
1612
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1613
|
+
) => C,
|
|
1614
|
+
c: (
|
|
1615
|
+
_: C,
|
|
1616
|
+
arg: ArgForCombinator<Arg>,
|
|
1617
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1618
|
+
) => D,
|
|
1619
|
+
d: (
|
|
1620
|
+
_: D,
|
|
1621
|
+
arg: ArgForCombinator<Arg>,
|
|
1622
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1623
|
+
) => E,
|
|
1624
|
+
e: (
|
|
1625
|
+
_: E,
|
|
1626
|
+
arg: ArgForCombinator<Arg>,
|
|
1627
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1628
|
+
) => F,
|
|
1629
|
+
f: (
|
|
1630
|
+
_: F,
|
|
1631
|
+
arg: ArgForCombinator<Arg>,
|
|
1632
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1633
|
+
) => G,
|
|
1634
|
+
g: (
|
|
1635
|
+
_: G,
|
|
1636
|
+
arg: ArgForCombinator<Arg>,
|
|
1637
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1638
|
+
) => H,
|
|
1639
|
+
h: (
|
|
1640
|
+
_: H,
|
|
1641
|
+
arg: ArgForCombinator<Arg>,
|
|
1642
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1643
|
+
) => Eff
|
|
1014
1644
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
1015
1645
|
<
|
|
1016
1646
|
Eff extends Effect.Effect<any, any, RT | CommandContext | `Commander.Command.${Id}.state`>,
|
|
@@ -1030,59 +1660,120 @@ export declare namespace Commander {
|
|
|
1030
1660
|
EEff,
|
|
1031
1661
|
REff
|
|
1032
1662
|
>,
|
|
1033
|
-
arg:
|
|
1663
|
+
arg: ArgForCombinator<Arg>,
|
|
1034
1664
|
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1035
1665
|
) => B,
|
|
1036
|
-
b: (
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1666
|
+
b: (
|
|
1667
|
+
_: B,
|
|
1668
|
+
arg: ArgForCombinator<Arg>,
|
|
1669
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1670
|
+
) => C,
|
|
1671
|
+
c: (
|
|
1672
|
+
_: C,
|
|
1673
|
+
arg: ArgForCombinator<Arg>,
|
|
1674
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1675
|
+
) => D,
|
|
1676
|
+
d: (
|
|
1677
|
+
_: D,
|
|
1678
|
+
arg: ArgForCombinator<Arg>,
|
|
1679
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1680
|
+
) => E,
|
|
1681
|
+
e: (
|
|
1682
|
+
_: E,
|
|
1683
|
+
arg: ArgForCombinator<Arg>,
|
|
1684
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1685
|
+
) => F,
|
|
1686
|
+
f: (
|
|
1687
|
+
_: F,
|
|
1688
|
+
arg: ArgForCombinator<Arg>,
|
|
1689
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1690
|
+
) => G,
|
|
1691
|
+
g: (
|
|
1692
|
+
_: G,
|
|
1693
|
+
arg: ArgForCombinator<Arg>,
|
|
1694
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1695
|
+
) => H,
|
|
1696
|
+
h: (
|
|
1697
|
+
_: H,
|
|
1698
|
+
arg: ArgForCombinator<Arg>,
|
|
1699
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1700
|
+
) => I,
|
|
1701
|
+
i: (
|
|
1702
|
+
_: H,
|
|
1703
|
+
arg: ArgForCombinator<Arg>,
|
|
1704
|
+
ctx: CommandContextLocal2<NoInfer<Id>, NoInfer<I18nKey>, NoInfer<State>>
|
|
1705
|
+
) => Eff
|
|
1044
1706
|
): CommandOutHelper<Arg, Eff, Id, I18nKey, State>
|
|
1045
1707
|
}
|
|
1046
1708
|
}
|
|
1047
1709
|
|
|
1048
1710
|
type ErrorRenderer<E, Args extends readonly any[]> = (e: E, action: string, ...args: Args) => string | undefined
|
|
1049
1711
|
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1712
|
+
type RegisteredErrorRenderer<A> = {
|
|
1713
|
+
guard: Refinement<unknown, A>
|
|
1714
|
+
render: (guarded: A) => string | undefined
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
export class CommanderErrorRenderers extends Context.Reference("Commander.ErrorRenderers", {
|
|
1718
|
+
defaultValue: () => [] as RegisteredErrorRenderer<any>[]
|
|
1719
|
+
}) {}
|
|
1720
|
+
|
|
1721
|
+
export const makeRegisteredErrorRenderer = <A>(
|
|
1722
|
+
guard: Predicate.Refinement<unknown, A>,
|
|
1723
|
+
render: (guarded: A) => string | undefined
|
|
1724
|
+
): RegisteredErrorRenderer<A> => ({
|
|
1725
|
+
guard,
|
|
1726
|
+
render
|
|
1727
|
+
})
|
|
1728
|
+
|
|
1729
|
+
const renderErrorMaker = Effect.gen(function*() {
|
|
1730
|
+
const { intl } = yield* I18n
|
|
1731
|
+
const registeredRenderers = yield* CommanderErrorRenderers
|
|
1732
|
+
return (
|
|
1733
|
+
<E, Args extends readonly any[]>(action: string, errorRenderer?: ErrorRenderer<E, Args>) =>
|
|
1734
|
+
(e: E, ...args: Args): string => {
|
|
1735
|
+
if (errorRenderer) {
|
|
1736
|
+
const m = errorRenderer(e, action, ...args)
|
|
1737
|
+
if (m !== undefined) {
|
|
1738
|
+
return m
|
|
1739
|
+
}
|
|
1058
1740
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
if ("message" in e) {
|
|
1063
|
-
return `${e.message}`
|
|
1741
|
+
for (const entry of registeredRenderers) {
|
|
1742
|
+
if (!entry.guard(e)) {
|
|
1743
|
+
continue
|
|
1064
1744
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1745
|
+
const m = entry.render(e)
|
|
1746
|
+
if (m !== undefined) {
|
|
1747
|
+
return m
|
|
1067
1748
|
}
|
|
1068
1749
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
SchemaError: (e) => {
|
|
1078
|
-
console.warn(e.toString())
|
|
1079
|
-
return intl.formatMessage({ id: "validation.failed" })
|
|
1750
|
+
if (!S.is(SupportedErrors)(e) && !S.isSchemaError(e)) {
|
|
1751
|
+
if (typeof e === "object" && e !== null) {
|
|
1752
|
+
if ("message" in e) {
|
|
1753
|
+
return `${e.message}`
|
|
1754
|
+
}
|
|
1755
|
+
if ("_tag" in e) {
|
|
1756
|
+
return `${e._tag}`
|
|
1757
|
+
}
|
|
1080
1758
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1759
|
+
return ""
|
|
1760
|
+
}
|
|
1761
|
+
const e2: SupportedErrors | S.SchemaError = e
|
|
1762
|
+
return Match.value(e2).pipe(
|
|
1763
|
+
Match.tags({
|
|
1764
|
+
NotFoundError: (e) => {
|
|
1765
|
+
return intl.formatMessage({ id: "handle.not_found" }, { type: e.type, id: e.id })
|
|
1766
|
+
},
|
|
1767
|
+
SchemaError: (e) => {
|
|
1768
|
+
console.warn(e.toString())
|
|
1769
|
+
return intl.formatMessage({ id: "validation.failed" })
|
|
1770
|
+
}
|
|
1771
|
+
}),
|
|
1772
|
+
Match.orElse((e) => `${e.message ?? e._tag ?? e}`)
|
|
1773
|
+
)
|
|
1774
|
+
}
|
|
1775
|
+
)
|
|
1776
|
+
})
|
|
1086
1777
|
|
|
1087
1778
|
const defaultFailureMessageHandler = <E, Args extends Array<unknown>, AME, AMR>(
|
|
1088
1779
|
actionMaker:
|
|
@@ -1105,23 +1796,28 @@ const defaultFailureMessageHandler = <E, Args extends Array<unknown>, AME, AMR>(
|
|
|
1105
1796
|
error: "" // TODO consider again Cause.pretty(cause), // will be reported to Sentry/Otel anyway.. and we shouldn't bother users with error dumps?
|
|
1106
1797
|
}
|
|
1107
1798
|
),
|
|
1108
|
-
onSome: (e) =>
|
|
1109
|
-
|
|
1799
|
+
onSome: (e) => {
|
|
1800
|
+
const rendered = renderError(action, errorRenderer)(e, ...args)
|
|
1801
|
+
return S.is(OperationFailure)(e)
|
|
1110
1802
|
? {
|
|
1111
1803
|
level: "warn" as const,
|
|
1112
|
-
message:
|
|
1804
|
+
message: `${
|
|
1805
|
+
intl.formatMessage(
|
|
1113
1806
|
{ id: "handle.with_warnings" },
|
|
1114
1807
|
{ action }
|
|
1115
|
-
)
|
|
1116
|
-
|
|
1117
|
-
: ""
|
|
1808
|
+
)
|
|
1809
|
+
}${rendered ? "\n" + rendered : ""}`
|
|
1118
1810
|
}
|
|
1119
|
-
:
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1811
|
+
: {
|
|
1812
|
+
level: "warn" as const,
|
|
1813
|
+
message: `${
|
|
1814
|
+
intl.formatMessage(
|
|
1815
|
+
{ id: "handle.with_errors" },
|
|
1816
|
+
{ action }
|
|
1817
|
+
)
|
|
1818
|
+
}:\n` + rendered
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1125
1821
|
})
|
|
1126
1822
|
})
|
|
1127
1823
|
|
|
@@ -1168,6 +1864,17 @@ export const CommanderStatic = {
|
|
|
1168
1864
|
CommandContext,
|
|
1169
1865
|
(c) => ({ ...c, action: update(c.action, ...input) })
|
|
1170
1866
|
),
|
|
1867
|
+
registerErrorRenderer: <A>(
|
|
1868
|
+
guard: Predicate.Refinement<unknown, A>,
|
|
1869
|
+
render: (guarded: A) => string | undefined
|
|
1870
|
+
) =>
|
|
1871
|
+
Layer.effect(
|
|
1872
|
+
CommanderErrorRenderers,
|
|
1873
|
+
Effect.gen(function*() {
|
|
1874
|
+
const current = yield* CommanderErrorRenderers
|
|
1875
|
+
return [...current, makeRegisteredErrorRenderer(guard, render)]
|
|
1876
|
+
})
|
|
1877
|
+
),
|
|
1171
1878
|
defaultFailureMessageHandler,
|
|
1172
1879
|
renderError: renderErrorMaker,
|
|
1173
1880
|
/**
|
|
@@ -1186,17 +1893,29 @@ export const CommanderStatic = {
|
|
|
1186
1893
|
/**
|
|
1187
1894
|
* if true, previous toasts with this key will be replaced
|
|
1188
1895
|
*/
|
|
1189
|
-
stableToastId?:
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1896
|
+
stableToastId?:
|
|
1897
|
+
| undefined
|
|
1898
|
+
| true
|
|
1899
|
+
| string
|
|
1900
|
+
| ((id: string, arg: NoInfer<Args>[0], ctx: NoInfer<Args>[1]) => true | string | undefined)
|
|
1901
|
+
errorRenderer?: (e: E, action: string, arg: NoInfer<Args>[0], ctx: NoInfer<Args>[1]) => string | undefined
|
|
1902
|
+
showSpanInfo?: false
|
|
1903
|
+
onWaiting?:
|
|
1904
|
+
| null
|
|
1905
|
+
| undefined
|
|
1906
|
+
| string
|
|
1907
|
+
| ((id: string, arg: NoInfer<Args>[0], ctx: NoInfer<Args>[1]) => string | null | undefined)
|
|
1908
|
+
onSuccess?:
|
|
1909
|
+
| null
|
|
1910
|
+
| undefined
|
|
1911
|
+
| string
|
|
1912
|
+
| ((a: A, action: string, arg: NoInfer<Args>[0], ctx: NoInfer<Args>[1]) => string | null | undefined)
|
|
1193
1913
|
}
|
|
1194
1914
|
) =>
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
Effect.gen(function*() {
|
|
1915
|
+
Effect.fnUntraced(function*(
|
|
1916
|
+
self: Effect.Effect<A, E, R>,
|
|
1917
|
+
...args: Args
|
|
1918
|
+
) {
|
|
1200
1919
|
const cc = yield* CommandContext
|
|
1201
1920
|
const { intl } = yield* I18n
|
|
1202
1921
|
const withToast = yield* WithToast
|
|
@@ -1243,9 +1962,10 @@ export const CommanderStatic = {
|
|
|
1243
1962
|
+ (S.is(OperationSuccess)(a) && a.message ? "\n" + a.message : "")),
|
|
1244
1963
|
onFailure: defaultFailureMessageHandler(
|
|
1245
1964
|
hasCustomFailure ? intl.formatMessage({ id: customFailure }, cc.state) : cc.action,
|
|
1246
|
-
options?.errorRenderer
|
|
1965
|
+
options?.errorRenderer as ErrorRenderer<E, Args> | undefined
|
|
1247
1966
|
),
|
|
1248
|
-
stableToastId
|
|
1967
|
+
stableToastId,
|
|
1968
|
+
...options?.showSpanInfo === false ? { showSpanInfo: options.showSpanInfo } : {}
|
|
1249
1969
|
})(_, ...args)
|
|
1250
1970
|
)
|
|
1251
1971
|
}),
|
|
@@ -1310,7 +2030,11 @@ const unregisterWait = (id: string) => {
|
|
|
1310
2030
|
}
|
|
1311
2031
|
}
|
|
1312
2032
|
|
|
1313
|
-
const getStateValues = <
|
|
2033
|
+
const getStateValues = <
|
|
2034
|
+
const Id extends string,
|
|
2035
|
+
const I18nKey extends string,
|
|
2036
|
+
State extends IntlRecord | undefined
|
|
2037
|
+
>(
|
|
1314
2038
|
options?: FnOptions<Id, I18nKey, State>
|
|
1315
2039
|
): ComputedRef<State> => {
|
|
1316
2040
|
const state_ = options?.state
|
|
@@ -1323,7 +2047,7 @@ const getStateValues = <const Id extends string, const I18nKey extends string, S
|
|
|
1323
2047
|
// class preserves JSDoc throughout..
|
|
1324
2048
|
export class CommanderImpl<RT, RTHooks> {
|
|
1325
2049
|
constructor(
|
|
1326
|
-
private readonly rt:
|
|
2050
|
+
private readonly rt: Context.Context<RT>,
|
|
1327
2051
|
private readonly intl: I18n,
|
|
1328
2052
|
private readonly hooks: Layer.Layer<RTHooks, never, RT>
|
|
1329
2053
|
) {
|
|
@@ -1362,11 +2086,17 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1362
2086
|
readonly makeCommand = <
|
|
1363
2087
|
const Id extends string,
|
|
1364
2088
|
const State extends IntlRecord | undefined,
|
|
1365
|
-
const I18nKey extends string = Id
|
|
2089
|
+
const I18nKey extends string = Id,
|
|
2090
|
+
RunningA = unknown,
|
|
2091
|
+
RunningE = unknown
|
|
1366
2092
|
>(
|
|
1367
2093
|
id_: Id | { id: Id },
|
|
1368
2094
|
options?: FnOptions<Id, I18nKey, State>,
|
|
1369
|
-
errorDef?: Error
|
|
2095
|
+
errorDef?: Error,
|
|
2096
|
+
streamMeta?: {
|
|
2097
|
+
running?: ComputedRef<AsyncResult.AsyncResult<RunningA, RunningE>> | undefined
|
|
2098
|
+
progress?: ComputedRef<Progress | undefined> | undefined
|
|
2099
|
+
}
|
|
1370
2100
|
) => {
|
|
1371
2101
|
const id = typeof id_ === "string" ? id_ : id_.id
|
|
1372
2102
|
const state = getStateValues(options)
|
|
@@ -1385,7 +2115,7 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1385
2115
|
}
|
|
1386
2116
|
|
|
1387
2117
|
const key = `Commander.Command.${id}.state` as const
|
|
1388
|
-
const stateTag =
|
|
2118
|
+
const stateTag = Context.Service<typeof key, State>(key)
|
|
1389
2119
|
|
|
1390
2120
|
const makeContext_ = () => this.makeContext(id, { ...options, state: state?.value })
|
|
1391
2121
|
const initialContext = makeContext_()
|
|
@@ -1479,10 +2209,11 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1479
2209
|
const computeAllowed = options?.allowed
|
|
1480
2210
|
const allowed = computeAllowed ? computed(() => computeAllowed(id, state)) : true
|
|
1481
2211
|
|
|
1482
|
-
const rt = Effect.
|
|
2212
|
+
const rt = Effect.context<RT | RTHooks>().pipe(Effect.provide(this.hooks)).pipe(Effect.runSyncWith(this.rt))
|
|
1483
2213
|
const runFork = Effect.runForkWith(rt)
|
|
1484
2214
|
|
|
1485
2215
|
const handle = Object.assign((arg: Arg) => {
|
|
2216
|
+
arg = toRaw(arg) // remove outside vue proxy bs
|
|
1486
2217
|
// we capture the call site stack here
|
|
1487
2218
|
const limit = Error.stackTraceLimit
|
|
1488
2219
|
Error.stackTraceLimit = 2
|
|
@@ -1513,15 +2244,17 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1513
2244
|
}
|
|
1514
2245
|
}
|
|
1515
2246
|
|
|
1516
|
-
const command = currentState.pipe(Effect.flatMap((state) =>
|
|
1517
|
-
|
|
2247
|
+
const command = currentState.pipe(Effect.flatMap((state) => {
|
|
2248
|
+
const rawArg = deepToRaw(arg)
|
|
2249
|
+
const rawState = deepToRaw(state)
|
|
2250
|
+
return Effect.withSpan(
|
|
1518
2251
|
exec(arg, { ...context.value, state } as any),
|
|
1519
2252
|
id,
|
|
1520
2253
|
{
|
|
1521
2254
|
captureStackTrace,
|
|
1522
2255
|
attributes: {
|
|
1523
|
-
input:
|
|
1524
|
-
state,
|
|
2256
|
+
input: rawArg,
|
|
2257
|
+
state: rawState,
|
|
1525
2258
|
action: initialContext.action,
|
|
1526
2259
|
label: initialContext.label,
|
|
1527
2260
|
id: initialContext.id,
|
|
@@ -1529,7 +2262,7 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1529
2262
|
}
|
|
1530
2263
|
}
|
|
1531
2264
|
)
|
|
1532
|
-
))
|
|
2265
|
+
}))
|
|
1533
2266
|
|
|
1534
2267
|
return runFork(command)
|
|
1535
2268
|
}, { action, label })
|
|
@@ -1548,6 +2281,12 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1548
2281
|
|
|
1549
2282
|
/** reactive */
|
|
1550
2283
|
result,
|
|
2284
|
+
/** reactive – live AsyncResult of the underlying stream, exposed only when
|
|
2285
|
+
* the stream factory was called with a `progress` formatter */
|
|
2286
|
+
running: streamMeta?.running,
|
|
2287
|
+
/** reactive – formatted progress info for current `running` state, when `progress`
|
|
2288
|
+
* formatter was supplied to the stream factory */
|
|
2289
|
+
progress: streamMeta?.progress,
|
|
1551
2290
|
/** reactive */
|
|
1552
2291
|
waiting,
|
|
1553
2292
|
/** reactive */
|
|
@@ -1649,14 +2388,41 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1649
2388
|
fn = <
|
|
1650
2389
|
const Id extends string,
|
|
1651
2390
|
const State extends IntlRecord = IntlRecord,
|
|
1652
|
-
const I18nKey extends string = Id
|
|
2391
|
+
const I18nKey extends string = Id,
|
|
2392
|
+
RunningA = unknown,
|
|
2393
|
+
RunningE = unknown
|
|
1653
2394
|
>(
|
|
1654
|
-
id:
|
|
2395
|
+
id:
|
|
2396
|
+
| Id
|
|
2397
|
+
| { id: Id }
|
|
2398
|
+
| StreamMutationTuple<Id, any, RunningA, RunningE, any>
|
|
2399
|
+
| StreamMutationFactory<Id, any, RunningA, RunningE, any>,
|
|
1655
2400
|
options?: FnOptions<Id, I18nKey, State>
|
|
1656
2401
|
): Commander.Gen<RT | RTHooks, Id, I18nKey, State> & Commander.NonGen<RT | RTHooks, Id, I18nKey, State> & {
|
|
1657
|
-
state:
|
|
1658
|
-
} =>
|
|
1659
|
-
|
|
2402
|
+
state: Context.Service<`Commander.Command.${Id}.state`, State>
|
|
2403
|
+
} => {
|
|
2404
|
+
// Resolve id and (optionally) per-build stream metadata.
|
|
2405
|
+
const resolvedId: Id = typeof id === "string" ? id : (id as { id: Id }).id
|
|
2406
|
+
const isStreamFactory = typeof id === "function" && "id" in id && (id as any).length <= 1
|
|
2407
|
+
const isStreamTuple = Array.isArray(id) && "id" in id
|
|
2408
|
+
const resolveStreamMeta = ():
|
|
2409
|
+
| {
|
|
2410
|
+
running?: ComputedRef<AsyncResult.AsyncResult<RunningA, RunningE>> | undefined
|
|
2411
|
+
progress?: ComputedRef<Progress | undefined> | undefined
|
|
2412
|
+
}
|
|
2413
|
+
| undefined =>
|
|
2414
|
+
{
|
|
2415
|
+
if (isStreamTuple) {
|
|
2416
|
+
const t = id as StreamMutationTuple<Id, any, RunningA, RunningE, any>
|
|
2417
|
+
return { running: t.running, progress: t.progress }
|
|
2418
|
+
}
|
|
2419
|
+
if (isStreamFactory) {
|
|
2420
|
+
const t = id()
|
|
2421
|
+
return { running: t.running, progress: t.progress }
|
|
2422
|
+
}
|
|
2423
|
+
return undefined
|
|
2424
|
+
}
|
|
2425
|
+
return Object.assign(
|
|
1660
2426
|
(
|
|
1661
2427
|
fn: any,
|
|
1662
2428
|
...combinators: any[]
|
|
@@ -1667,7 +2433,9 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1667
2433
|
const errorDef = new Error()
|
|
1668
2434
|
Error.stackTraceLimit = limit
|
|
1669
2435
|
|
|
1670
|
-
|
|
2436
|
+
const streamMeta = resolveStreamMeta()
|
|
2437
|
+
|
|
2438
|
+
return this.makeCommand(resolvedId, options, errorDef, streamMeta)(
|
|
1671
2439
|
Effect.fnUntraced(
|
|
1672
2440
|
// fnUntraced only supports generators as first arg, so we convert to generator if needed
|
|
1673
2441
|
isGeneratorFunction(fn) ? fn : function*(...args) {
|
|
@@ -1677,15 +2445,16 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1677
2445
|
) as any
|
|
1678
2446
|
)
|
|
1679
2447
|
},
|
|
1680
|
-
makeBaseInfo(
|
|
2448
|
+
makeBaseInfo(resolvedId, options),
|
|
1681
2449
|
{
|
|
1682
|
-
state:
|
|
1683
|
-
`Commander.Command.${
|
|
2450
|
+
state: Context.Service<`Commander.Command.${Id}.state`, State>(
|
|
2451
|
+
`Commander.Command.${resolvedId}.state`
|
|
1684
2452
|
)
|
|
1685
2453
|
}
|
|
1686
2454
|
)
|
|
2455
|
+
}
|
|
1687
2456
|
|
|
1688
|
-
/** @
|
|
2457
|
+
/** @deprecated */
|
|
1689
2458
|
alt2: <
|
|
1690
2459
|
const Id extends string,
|
|
1691
2460
|
MutArg,
|
|
@@ -1737,7 +2506,6 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1737
2506
|
)), baseInfo) as any
|
|
1738
2507
|
}
|
|
1739
2508
|
|
|
1740
|
-
/** @experimental */
|
|
1741
2509
|
alt = this.makeCommand as unknown as <
|
|
1742
2510
|
const Id extends string,
|
|
1743
2511
|
const I18nKey extends string = Id,
|
|
@@ -1789,10 +2557,31 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1789
2557
|
>(
|
|
1790
2558
|
mutation:
|
|
1791
2559
|
| { mutate: (arg: Arg) => Effect.Effect<A, E, R>; id: Id }
|
|
1792
|
-
| ((arg: Arg) => Effect.Effect<A, E, R>) & { id: Id }
|
|
2560
|
+
| ((arg: Arg) => Effect.Effect<A, E, R>) & { id: Id }
|
|
2561
|
+
| StreamMutationFactory<Id, Arg, A, E, R>
|
|
2562
|
+
| {
|
|
2563
|
+
id: Id
|
|
2564
|
+
mutateStream:
|
|
2565
|
+
| StreamMutationFactory<Id, Arg, A, E, R>
|
|
2566
|
+
| StreamMutationTuple<Id, Arg, A, E, R>
|
|
2567
|
+
}
|
|
2568
|
+
| StreamMutationTuple<Id, Arg, A, E, R>,
|
|
1793
2569
|
options?: FnOptions<Id, I18nKey, State>
|
|
1794
|
-
): Commander.CommanderWrap<RT | RTHooks, Id, I18nKey, State, Arg, A, E, R> =>
|
|
1795
|
-
|
|
2570
|
+
): Commander.CommanderWrap<RT | RTHooks, Id, I18nKey, State, Arg, A, E, R> => {
|
|
2571
|
+
if (mutation !== null && typeof mutation === "object" && "mutateStream" in mutation) {
|
|
2572
|
+
return this.wrapStream(mutation as any, options) as any
|
|
2573
|
+
}
|
|
2574
|
+
if (Array.isArray(mutation) && "id" in mutation) {
|
|
2575
|
+
return this.wrapStream(mutation as any, options) as any
|
|
2576
|
+
}
|
|
2577
|
+
if (typeof mutation === "function" && "id" in mutation && (mutation as any).length <= 1) {
|
|
2578
|
+
return this.wrapStream(mutation as any, options) as any
|
|
2579
|
+
}
|
|
2580
|
+
// At this point mutation is either { mutate, id } or (fn & { id })
|
|
2581
|
+
const callMutation = mutation as
|
|
2582
|
+
| { mutate: (arg: Arg) => Effect.Effect<A, E, R>; id: Id }
|
|
2583
|
+
| (((arg: Arg) => Effect.Effect<A, E, R>) & { id: Id })
|
|
2584
|
+
return Object.assign(
|
|
1796
2585
|
(
|
|
1797
2586
|
...combinators: any[]
|
|
1798
2587
|
): any => {
|
|
@@ -1801,9 +2590,11 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1801
2590
|
Error.stackTraceLimit = 2
|
|
1802
2591
|
const errorDef = new Error()
|
|
1803
2592
|
Error.stackTraceLimit = limit
|
|
1804
|
-
const mutate = "mutate" in
|
|
2593
|
+
const mutate = "mutate" in callMutation
|
|
2594
|
+
? callMutation.mutate
|
|
2595
|
+
: callMutation
|
|
1805
2596
|
|
|
1806
|
-
return this.makeCommand(
|
|
2597
|
+
return this.makeCommand(callMutation.id, options, errorDef)(
|
|
1807
2598
|
Effect.fnUntraced(
|
|
1808
2599
|
// fnUntraced only supports generators as first arg, so we convert to generator if needed
|
|
1809
2600
|
isGeneratorFunction(mutate) ? mutate : function*(arg: Arg) {
|
|
@@ -1813,20 +2604,112 @@ export class CommanderImpl<RT, RTHooks> {
|
|
|
1813
2604
|
) as any
|
|
1814
2605
|
)
|
|
1815
2606
|
},
|
|
1816
|
-
makeBaseInfo(
|
|
2607
|
+
makeBaseInfo(callMutation.id, options),
|
|
1817
2608
|
{
|
|
1818
|
-
state:
|
|
1819
|
-
`Commander.Command.${
|
|
2609
|
+
state: Context.Service<`Commander.Command.${Id}.state`, State>(
|
|
2610
|
+
`Commander.Command.${callMutation.id}.state`
|
|
1820
2611
|
)
|
|
1821
2612
|
}
|
|
1822
2613
|
)
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
/**
|
|
2617
|
+
* Define a Command from a stream-type mutation (`mutateStream` factory).
|
|
2618
|
+
* The stream's reactive `AsyncResult` ref is exposed as `running` for independent progress tracking.
|
|
2619
|
+
* The command's own `result` reflects the execution outcome of the `execute` function.
|
|
2620
|
+
* Supports the same combinator pipeline as `wrap` (e.g. `withDefaultToast`).
|
|
2621
|
+
*
|
|
2622
|
+
* Each invocation of the resulting wrap call produces a fresh `[ref, execute]` pair
|
|
2623
|
+
* (the `mutateStream` factory is called once per build), so independent commands
|
|
2624
|
+
* don't share progress state.
|
|
2625
|
+
*
|
|
2626
|
+
* Accepts either:
|
|
2627
|
+
* - An object with `id` and `mutateStream` factory (e.g. a client entry)
|
|
2628
|
+
* - The `mutateStream` factory directly (callable, with `id`)
|
|
2629
|
+
* - An already-called factory result (`[resultRef, execute] & { id }`) — shared ref across builds
|
|
2630
|
+
*
|
|
2631
|
+
* @example
|
|
2632
|
+
* ```ts
|
|
2633
|
+
* // Via client entry (recommended):
|
|
2634
|
+
* const exportCmd = Command.wrapStream(client.myExport)()
|
|
2635
|
+
*
|
|
2636
|
+
* // Via factory directly:
|
|
2637
|
+
* const exportCmd = Command.wrapStream(client.myExport.mutateStream)()
|
|
2638
|
+
*
|
|
2639
|
+
* // Via already-called factory (shared ref):
|
|
2640
|
+
* const stream = client.myExport.mutateStream()
|
|
2641
|
+
* const exportCmd = Command.wrapStream(stream)()
|
|
2642
|
+
* ```
|
|
2643
|
+
*/
|
|
2644
|
+
wrapStream = <
|
|
2645
|
+
const Id extends string,
|
|
2646
|
+
Arg,
|
|
2647
|
+
A,
|
|
2648
|
+
E,
|
|
2649
|
+
R,
|
|
2650
|
+
const State extends IntlRecord = IntlRecord,
|
|
2651
|
+
const I18nKey extends string = Id
|
|
2652
|
+
>(
|
|
2653
|
+
mutation:
|
|
2654
|
+
| {
|
|
2655
|
+
id: Id
|
|
2656
|
+
mutateStream:
|
|
2657
|
+
| StreamMutationFactory<Id, Arg, A, E, R>
|
|
2658
|
+
| StreamMutationTuple<Id, Arg, A, E, R>
|
|
2659
|
+
}
|
|
2660
|
+
| StreamMutationFactory<Id, Arg, A, E, R>
|
|
2661
|
+
| StreamMutationTuple<Id, Arg, A, E, R>,
|
|
2662
|
+
options?: FnOptions<Id, I18nKey, State>
|
|
2663
|
+
): Commander.CommanderWrap<RT | RTHooks, Id, I18nKey, State, Arg, A, E, R> => {
|
|
2664
|
+
const id = mutation.id
|
|
2665
|
+
// Resolve `source` to the factory or already-called tuple.
|
|
2666
|
+
const source: StreamMutationFactory<Id, Arg, A, E, R> | StreamMutationTuple<Id, Arg, A, E, R> =
|
|
2667
|
+
mutation !== null && typeof mutation === "object" && "mutateStream" in mutation
|
|
2668
|
+
? (mutation.mutateStream as any)
|
|
2669
|
+
: (mutation as any)
|
|
2670
|
+
const resolveTuple = (): StreamMutationTuple<Id, Arg, A, E, R> => (typeof source === "function" ? source() : source)
|
|
2671
|
+
return Object.assign(
|
|
2672
|
+
(...combinators: any[]): any => {
|
|
2673
|
+
// we capture the definition stack here, so we can append it to later stack traces
|
|
2674
|
+
const limit = Error.stackTraceLimit
|
|
2675
|
+
Error.stackTraceLimit = 2
|
|
2676
|
+
const errorDef = new Error()
|
|
2677
|
+
Error.stackTraceLimit = limit
|
|
2678
|
+
|
|
2679
|
+
// Fresh per build: call the factory once per command instance so each
|
|
2680
|
+
// wrap call gets its own ComputedRef + execute pair. `running`/`progress`
|
|
2681
|
+
// are only surfaced when the factory was called with a `progress` formatter.
|
|
2682
|
+
const tuple = resolveTuple()
|
|
2683
|
+
const [, executeRaw] = tuple
|
|
2684
|
+
const mutate: (_arg: Arg) => Effect.Effect<any, never, R> = Effect.isEffect(executeRaw)
|
|
2685
|
+
? (_arg: Arg) => executeRaw
|
|
2686
|
+
: executeRaw
|
|
2687
|
+
const streamMeta = { running: tuple.running, progress: tuple.progress }
|
|
2688
|
+
|
|
2689
|
+
return this.makeCommand(id, options, errorDef, streamMeta)(
|
|
2690
|
+
Effect.fnUntraced(
|
|
2691
|
+
isGeneratorFunction(mutate) ? mutate : function*(arg: Arg) {
|
|
2692
|
+
return yield* mutate(arg)
|
|
2693
|
+
},
|
|
2694
|
+
...combinators as [any]
|
|
2695
|
+
) as any
|
|
2696
|
+
)
|
|
2697
|
+
},
|
|
2698
|
+
makeBaseInfo(id, options),
|
|
2699
|
+
{
|
|
2700
|
+
state: Context.Service<`Commander.Command.${Id}.state`, State>(
|
|
2701
|
+
`Commander.Command.${id}.state`
|
|
2702
|
+
)
|
|
2703
|
+
}
|
|
2704
|
+
)
|
|
2705
|
+
}
|
|
1823
2706
|
}
|
|
1824
2707
|
|
|
1825
2708
|
// @effect-diagnostics-next-line missingEffectServiceDependency:off
|
|
1826
|
-
export class Commander extends
|
|
2709
|
+
export class Commander extends Context.Service<Commander>()("Commander", {
|
|
1827
2710
|
make: Effect.gen(function*() {
|
|
1828
2711
|
const i18n = yield* I18n
|
|
1829
|
-
return <RT, RTHooks>(rt:
|
|
2712
|
+
return <RT, RTHooks>(rt: Context.Context<RT>, rtHooks: Layer.Layer<RTHooks, never, RT>) =>
|
|
1830
2713
|
new CommanderImpl(rt, i18n, rtHooks)
|
|
1831
2714
|
})
|
|
1832
2715
|
}) {
|