unthrown 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +117 -27
- package/dist/index.d.cts +77 -20
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +77 -20
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +116 -28
- package/dist/index.mjs.map +1 -1
- package/docs/index.md +190 -100
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,15 @@ var Res = class {
|
|
|
57
57
|
return defectRes(cause);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
flatTap(f) {
|
|
61
|
+
if (this.tag !== "Ok") return this;
|
|
62
|
+
try {
|
|
63
|
+
const r = f(this.value);
|
|
64
|
+
return r.tag === "Ok" ? this : r;
|
|
65
|
+
} catch (cause) {
|
|
66
|
+
return defectRes(cause);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
60
69
|
as(value) {
|
|
61
70
|
if (this.tag !== "Ok") return this;
|
|
62
71
|
return okRes(value);
|
|
@@ -244,6 +253,17 @@ var AsyncRes = class AsyncRes {
|
|
|
244
253
|
}
|
|
245
254
|
}));
|
|
246
255
|
}
|
|
256
|
+
flatTap(f) {
|
|
257
|
+
return new AsyncRes(this.promise.then(async (r) => {
|
|
258
|
+
if (r.tag !== "Ok") return r;
|
|
259
|
+
try {
|
|
260
|
+
const inner = await f(r.value);
|
|
261
|
+
return inner.tag === "Ok" ? r : inner;
|
|
262
|
+
} catch (cause) {
|
|
263
|
+
return defectRes(cause);
|
|
264
|
+
}
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
247
267
|
as(value) {
|
|
248
268
|
return new AsyncRes(this.promise.then((r) => r.tag === "Ok" ? okRes(value) : r));
|
|
249
269
|
}
|
|
@@ -554,17 +574,52 @@ function qualifyToResult(cause, qualify) {
|
|
|
554
574
|
}
|
|
555
575
|
}
|
|
556
576
|
/**
|
|
557
|
-
*
|
|
577
|
+
* Fold an array of settled `Result`s: first `Err` wins, any `Defect` dominates,
|
|
578
|
+
* else `Ok` of the values array.
|
|
579
|
+
*
|
|
580
|
+
* @internal
|
|
581
|
+
*/
|
|
582
|
+
function foldArray(results) {
|
|
583
|
+
let firstErr;
|
|
584
|
+
let firstDefect;
|
|
585
|
+
const values = [];
|
|
586
|
+
for (const r of results) if (r.tag === "Defect") firstDefect ??= r;
|
|
587
|
+
else if (r.tag === "Err") firstErr ??= r;
|
|
588
|
+
else values.push(r.value);
|
|
589
|
+
return firstDefect ?? firstErr ?? ok(values);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Fold a record of settled `Result`s with the same rules, else `Ok` of the
|
|
593
|
+
* record of values. Keys are written with `Object.defineProperty` so a
|
|
594
|
+
* caller-supplied `"__proto__"` key cannot pollute the prototype.
|
|
595
|
+
*
|
|
596
|
+
* @internal
|
|
597
|
+
*/
|
|
598
|
+
function foldRecord(results) {
|
|
599
|
+
let firstErr;
|
|
600
|
+
let firstDefect;
|
|
601
|
+
const values = {};
|
|
602
|
+
for (const [key, r] of Object.entries(results)) if (r.tag === "Defect") firstDefect ??= r;
|
|
603
|
+
else if (r.tag === "Err") firstErr ??= r;
|
|
604
|
+
else Object.defineProperty(values, key, {
|
|
605
|
+
value: r.value,
|
|
606
|
+
enumerable: true,
|
|
607
|
+
writable: true,
|
|
608
|
+
configurable: true
|
|
609
|
+
});
|
|
610
|
+
return firstDefect ?? firstErr ?? ok(values);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Collect a tuple/array of {@link Result}s into a single `Result` of all their
|
|
614
|
+
* success values.
|
|
558
615
|
*
|
|
559
616
|
* @remarks
|
|
560
617
|
* Short-circuits on the **first** `Err` (later entries are not inspected for
|
|
561
618
|
* their error); any `Defect` present **dominates**, winning even over an earlier
|
|
562
619
|
* `Err`. A **fixed tuple** keeps its positional types — `all([ok(1), ok("a")])`
|
|
563
620
|
* is `Result<[number, string], …>` — while a **dynamic array** `Result<T, E>[]`
|
|
564
|
-
* collapses to `Result<T[], E>` with no cast.
|
|
565
|
-
*
|
|
566
|
-
* @typeParam Rs - the tuple/array of input `Result` types.
|
|
567
|
-
* @param results - the results to combine.
|
|
621
|
+
* collapses to `Result<T[], E>` with no cast. For a **record** keyed by name,
|
|
622
|
+
* use {@link allFromDict}.
|
|
568
623
|
*
|
|
569
624
|
* @example
|
|
570
625
|
* ```ts
|
|
@@ -574,39 +629,69 @@ function qualifyToResult(cause, qualify) {
|
|
|
574
629
|
* ```
|
|
575
630
|
*/
|
|
576
631
|
function all(results) {
|
|
577
|
-
|
|
578
|
-
let firstErr;
|
|
579
|
-
let firstDefect;
|
|
580
|
-
for (const r of results) if (r.tag === "Defect") firstDefect ??= r;
|
|
581
|
-
else if (r.tag === "Err") firstErr ??= r;
|
|
582
|
-
else values.push(r.value);
|
|
583
|
-
if (firstDefect) return firstDefect;
|
|
584
|
-
if (firstErr) return firstErr;
|
|
585
|
-
return ok(values);
|
|
632
|
+
return foldArray(results);
|
|
586
633
|
}
|
|
587
634
|
/**
|
|
588
|
-
*
|
|
589
|
-
*
|
|
635
|
+
* Collect a **record** of {@link Result}s into a single `Result` of a record of
|
|
636
|
+
* their success values — `allFromDict({ a: Result<A, E>, b: Result<B, E> })` is
|
|
637
|
+
* `Result<{ a: A; b: B }, E>`. The named counterpart of {@link all}, for
|
|
638
|
+
* parallel work you'd rather not tuple.
|
|
590
639
|
*
|
|
591
640
|
* @remarks
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
* first `Err` short-circuits, any `Defect` dominates. As ever, the returned
|
|
595
|
-
* `AsyncResult`'s internal promise never rejects. A **fixed tuple** keeps its
|
|
596
|
-
* positional types; a **dynamic array** `AsyncResult<T, E>[]` collapses to
|
|
597
|
-
* `AsyncResult<T[], E>`.
|
|
641
|
+
* Same folding rules as {@link all}: first `Err` short-circuits, any `Defect`
|
|
642
|
+
* dominates. This is **not** error accumulation.
|
|
598
643
|
*
|
|
599
|
-
* @
|
|
600
|
-
*
|
|
644
|
+
* @example
|
|
645
|
+
* ```ts
|
|
646
|
+
* import { allFromDict, ok } from "unthrown";
|
|
647
|
+
* allFromDict({ id: ok(1), name: ok("ada") }).unwrap(); // { id: 1, name: "ada" }
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
function allFromDict(results) {
|
|
651
|
+
return foldRecord(results);
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* The asynchronous counterpart of {@link all}: combine a tuple/array of
|
|
655
|
+
* {@link AsyncResult}s into one `AsyncResult` of all their success values.
|
|
656
|
+
*
|
|
657
|
+
* @remarks
|
|
658
|
+
* The inputs are resolved **concurrently** (order preserved); the resolved
|
|
659
|
+
* `Result`s are then folded with the same rules as {@link all} — first `Err`
|
|
660
|
+
* short-circuits, any `Defect` dominates. As ever, the returned `AsyncResult`'s
|
|
661
|
+
* internal promise never rejects. For a **record**, use {@link allFromDictAsync}.
|
|
601
662
|
*
|
|
602
663
|
* @example
|
|
603
664
|
* ```ts
|
|
604
665
|
* import { allAsync, fromSafePromise } from "unthrown";
|
|
605
|
-
*
|
|
666
|
+
* await allAsync([fromSafePromise(a()), fromSafePromise(b())]);
|
|
606
667
|
* ```
|
|
607
668
|
*/
|
|
608
669
|
function allAsync(results) {
|
|
609
|
-
return new AsyncRes(Promise.all(results).then((resolved) =>
|
|
670
|
+
return new AsyncRes(Promise.all(results).then((resolved) => foldArray(resolved)));
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* The asynchronous counterpart of {@link allFromDict}: combine a record of
|
|
674
|
+
* {@link AsyncResult}s into one `AsyncResult` of a record of their values.
|
|
675
|
+
*
|
|
676
|
+
* @remarks
|
|
677
|
+
* Resolved concurrently (order preserved), folded with the {@link all} rules,
|
|
678
|
+
* and the internal promise never rejects.
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* ```ts
|
|
682
|
+
* import { allFromDictAsync, fromSafePromise } from "unthrown";
|
|
683
|
+
* await allFromDictAsync({ a: fromSafePromise(a()), b: fromSafePromise(b()) });
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
function allFromDictAsync(results) {
|
|
687
|
+
const entries = Object.entries(results);
|
|
688
|
+
return new AsyncRes(Promise.all(entries.map(([, ar]) => ar)).then((resolved) => {
|
|
689
|
+
const byKey = Object.create(null);
|
|
690
|
+
entries.forEach(([key], i) => {
|
|
691
|
+
byKey[key] = resolved[i];
|
|
692
|
+
});
|
|
693
|
+
return foldRecord(byKey);
|
|
694
|
+
}));
|
|
610
695
|
}
|
|
611
696
|
//#endregion
|
|
612
697
|
//#region src/facade.ts
|
|
@@ -615,7 +700,8 @@ function allAsync(results) {
|
|
|
615
700
|
* discoverable namespace: {@link Result.ok}, {@link Result.err},
|
|
616
701
|
* {@link Result.defect}, {@link Result.fromNullable}, {@link Result.fromThrowable},
|
|
617
702
|
* {@link Result.fromPromise}, {@link Result.fromSafePromise}, {@link Result.all},
|
|
618
|
-
* {@link Result.allAsync}, {@link Result.
|
|
703
|
+
* {@link Result.allAsync}, {@link Result.allFromDict},
|
|
704
|
+
* {@link Result.allFromDictAsync}, {@link Result.isOk}, {@link Result.isErr},
|
|
619
705
|
* {@link Result.isDefect}.
|
|
620
706
|
*
|
|
621
707
|
* @remarks
|
|
@@ -640,6 +726,8 @@ const Result = {
|
|
|
640
726
|
fromSafePromise,
|
|
641
727
|
all,
|
|
642
728
|
allAsync,
|
|
729
|
+
allFromDict,
|
|
730
|
+
allFromDictAsync,
|
|
643
731
|
isOk,
|
|
644
732
|
isErr,
|
|
645
733
|
isDefect
|
|
@@ -717,6 +805,8 @@ exports.TaggedError = TaggedError;
|
|
|
717
805
|
exports.UnwrapError = UnwrapError;
|
|
718
806
|
exports.all = all;
|
|
719
807
|
exports.allAsync = allAsync;
|
|
808
|
+
exports.allFromDict = allFromDict;
|
|
809
|
+
exports.allFromDictAsync = allFromDictAsync;
|
|
720
810
|
exports.defect = defect;
|
|
721
811
|
exports.err = err;
|
|
722
812
|
exports.fromNullable = fromNullable;
|
package/dist/index.d.cts
CHANGED
|
@@ -39,6 +39,23 @@ type ResultMethods<T, E> = {
|
|
|
39
39
|
* @param f - the side effect (its return value is ignored).
|
|
40
40
|
*/
|
|
41
41
|
tap(f: (value: T) => void): Result$1<T, E>;
|
|
42
|
+
/**
|
|
43
|
+
* Run a **failable** side effect on the success value, keeping the original
|
|
44
|
+
* value but threading the effect's error.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* This is to {@link ResultMethods.tap | tap} what
|
|
48
|
+
* {@link ResultMethods.flatMap | flatMap} is to {@link ResultMethods.map | map}:
|
|
49
|
+
* `f` returns a `Result`, but its **success value is discarded** — on success
|
|
50
|
+
* the original value flows through (`Result<T, E | E2>`), while an `Err` (or
|
|
51
|
+
* `Defect`) from `f` short-circuits. Runs only on `Ok`; `Err` and `Defect` pass
|
|
52
|
+
* through. If `f` throws, the throw becomes a `Defect`. Use it for a validation
|
|
53
|
+
* or write whose _result_ matters but whose _value_ you don't need.
|
|
54
|
+
*
|
|
55
|
+
* @typeParam E2 - the error type the effect may introduce.
|
|
56
|
+
* @param f - the failable side effect; its `Ok` value is ignored.
|
|
57
|
+
*/
|
|
58
|
+
flatTap<E2>(f: (value: T) => Result$1<unknown, E2>): Result$1<T, E | E2>;
|
|
42
59
|
/**
|
|
43
60
|
* Replace the success value with a constant `value`.
|
|
44
61
|
*
|
|
@@ -258,7 +275,8 @@ type Awaitable<T> = {
|
|
|
258
275
|
* {@link fromPromise} forces. To do further async work, re-enter through a
|
|
259
276
|
* qualified boundary and compose it: `ar.flatMap((v) => fromPromise(work(v),
|
|
260
277
|
* qualify))`. The eliminators (`unwrap`, …) return promises; the binds
|
|
261
|
-
* (`flatMap`, `orElse`, `recoverDefect`) additionally accept an
|
|
278
|
+
* (`flatMap`, `flatTap`, `orElse`, `recoverDefect`) additionally accept an
|
|
279
|
+
* `AsyncResult`.
|
|
262
280
|
*
|
|
263
281
|
* To pattern-match an `AsyncResult`, `await` it first: `match(await ar)`.
|
|
264
282
|
*
|
|
@@ -272,7 +290,13 @@ type AsyncResult<T, E> = Awaitable<Result$1<T, E>> & {
|
|
|
272
290
|
* (never a raw `Promise`); a throw becomes a `Defect`.
|
|
273
291
|
*/
|
|
274
292
|
flatMap<U, E2>(f: (value: T) => Result$1<U, E2> | AsyncResult<U, E2>): AsyncResult<U, E | E2>; /** Asynchronous `tap`. `f` is synchronous; a throw becomes a `Defect`. */
|
|
275
|
-
tap(f: (value: T) => void): AsyncResult<T, E>;
|
|
293
|
+
tap(f: (value: T) => void): AsyncResult<T, E>;
|
|
294
|
+
/**
|
|
295
|
+
* Asynchronous `flatTap` — a failable tap that keeps the original value. `f`
|
|
296
|
+
* may return a `Result` **or** an `AsyncResult`; its `Ok` value is discarded,
|
|
297
|
+
* an `Err`/`Defect` short-circuits, and a throw becomes a `Defect`.
|
|
298
|
+
*/
|
|
299
|
+
flatTap<E2>(f: (value: T) => Result$1<unknown, E2> | AsyncResult<unknown, E2>): AsyncResult<T, E | E2>; /** Asynchronous `as`. */
|
|
276
300
|
as<U>(value: U): AsyncResult<U, E>; /** Asynchronous `mapErr`. `f` is synchronous; a throw becomes a `Defect`. */
|
|
277
301
|
mapErr<E2>(f: (error: E) => E2): AsyncResult<T, E2>; /** Asynchronous `orElse`. `f` may return a `Result` or an `AsyncResult`. */
|
|
278
302
|
orElse<U, E2>(f: (error: E) => Result$1<U, E2> | AsyncResult<U, E2>): AsyncResult<T | U, E2>; /** Asynchronous `recover`. `f` is synchronous; a throw becomes a `Defect`. */
|
|
@@ -544,18 +568,21 @@ declare function fromSafePromise<T>(promise: Promise<T> | (() => Promise<T>)): A
|
|
|
544
568
|
* @internal
|
|
545
569
|
*/
|
|
546
570
|
type AllOk<Rs extends readonly unknown[], Ts extends readonly unknown[]> = number extends Rs["length"] ? Ts[number][] : Ts;
|
|
571
|
+
/** A record of `Result`s — the input to {@link allFromDict}. */
|
|
572
|
+
type ResultRecord = Record<string, Result$1<unknown, unknown>>;
|
|
573
|
+
/** A record of `AsyncResult`s — the input to {@link allFromDictAsync}. */
|
|
574
|
+
type AsyncResultRecord = Record<string, AsyncResult<unknown, unknown>>;
|
|
547
575
|
/**
|
|
548
|
-
* Collect {@link Result}s into a single `Result` of all their
|
|
576
|
+
* Collect a tuple/array of {@link Result}s into a single `Result` of all their
|
|
577
|
+
* success values.
|
|
549
578
|
*
|
|
550
579
|
* @remarks
|
|
551
580
|
* Short-circuits on the **first** `Err` (later entries are not inspected for
|
|
552
581
|
* their error); any `Defect` present **dominates**, winning even over an earlier
|
|
553
582
|
* `Err`. A **fixed tuple** keeps its positional types — `all([ok(1), ok("a")])`
|
|
554
583
|
* is `Result<[number, string], …>` — while a **dynamic array** `Result<T, E>[]`
|
|
555
|
-
* collapses to `Result<T[], E>` with no cast.
|
|
556
|
-
*
|
|
557
|
-
* @typeParam Rs - the tuple/array of input `Result` types.
|
|
558
|
-
* @param results - the results to combine.
|
|
584
|
+
* collapses to `Result<T[], E>` with no cast. For a **record** keyed by name,
|
|
585
|
+
* use {@link allFromDict}.
|
|
559
586
|
*
|
|
560
587
|
* @example
|
|
561
588
|
* ```ts
|
|
@@ -566,27 +593,54 @@ type AllOk<Rs extends readonly unknown[], Ts extends readonly unknown[]> = numbe
|
|
|
566
593
|
*/
|
|
567
594
|
declare function all<Rs extends readonly Result$1<unknown, unknown>[]>(results: readonly [...Rs]): Result$1<AllOk<Rs, { [K in keyof Rs]: OkOf<Rs[K]> }>, ErrOf<Rs[number]>>;
|
|
568
595
|
/**
|
|
569
|
-
*
|
|
570
|
-
*
|
|
596
|
+
* Collect a **record** of {@link Result}s into a single `Result` of a record of
|
|
597
|
+
* their success values — `allFromDict({ a: Result<A, E>, b: Result<B, E> })` is
|
|
598
|
+
* `Result<{ a: A; b: B }, E>`. The named counterpart of {@link all}, for
|
|
599
|
+
* parallel work you'd rather not tuple.
|
|
571
600
|
*
|
|
572
601
|
* @remarks
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
602
|
+
* Same folding rules as {@link all}: first `Err` short-circuits, any `Defect`
|
|
603
|
+
* dominates. This is **not** error accumulation.
|
|
604
|
+
*
|
|
605
|
+
* @example
|
|
606
|
+
* ```ts
|
|
607
|
+
* import { allFromDict, ok } from "unthrown";
|
|
608
|
+
* allFromDict({ id: ok(1), name: ok("ada") }).unwrap(); // { id: 1, name: "ada" }
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
declare function allFromDict<R extends ResultRecord>(results: R): Result$1<{ [K in keyof R]: OkOf<R[K]> }, ErrOf<R[keyof R]>>;
|
|
612
|
+
/**
|
|
613
|
+
* The asynchronous counterpart of {@link all}: combine a tuple/array of
|
|
614
|
+
* {@link AsyncResult}s into one `AsyncResult` of all their success values.
|
|
579
615
|
*
|
|
580
|
-
* @
|
|
581
|
-
*
|
|
616
|
+
* @remarks
|
|
617
|
+
* The inputs are resolved **concurrently** (order preserved); the resolved
|
|
618
|
+
* `Result`s are then folded with the same rules as {@link all} — first `Err`
|
|
619
|
+
* short-circuits, any `Defect` dominates. As ever, the returned `AsyncResult`'s
|
|
620
|
+
* internal promise never rejects. For a **record**, use {@link allFromDictAsync}.
|
|
582
621
|
*
|
|
583
622
|
* @example
|
|
584
623
|
* ```ts
|
|
585
624
|
* import { allAsync, fromSafePromise } from "unthrown";
|
|
586
|
-
*
|
|
625
|
+
* await allAsync([fromSafePromise(a()), fromSafePromise(b())]);
|
|
587
626
|
* ```
|
|
588
627
|
*/
|
|
589
628
|
declare function allAsync<Rs extends readonly AsyncResult<unknown, unknown>[]>(results: readonly [...Rs]): AsyncResult<AllOk<Rs, { [K in keyof Rs]: AsyncOkOf<Rs[K]> }>, AsyncErrOf<Rs[number]>>;
|
|
629
|
+
/**
|
|
630
|
+
* The asynchronous counterpart of {@link allFromDict}: combine a record of
|
|
631
|
+
* {@link AsyncResult}s into one `AsyncResult` of a record of their values.
|
|
632
|
+
*
|
|
633
|
+
* @remarks
|
|
634
|
+
* Resolved concurrently (order preserved), folded with the {@link all} rules,
|
|
635
|
+
* and the internal promise never rejects.
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```ts
|
|
639
|
+
* import { allFromDictAsync, fromSafePromise } from "unthrown";
|
|
640
|
+
* await allFromDictAsync({ a: fromSafePromise(a()), b: fromSafePromise(b()) });
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
declare function allFromDictAsync<R extends AsyncResultRecord>(results: R): AsyncResult<{ [K in keyof R]: AsyncOkOf<R[K]> }, AsyncErrOf<R[keyof R]>>;
|
|
590
644
|
//#endregion
|
|
591
645
|
//#region src/facade.d.ts
|
|
592
646
|
/**
|
|
@@ -594,7 +648,8 @@ declare function allAsync<Rs extends readonly AsyncResult<unknown, unknown>[]>(r
|
|
|
594
648
|
* discoverable namespace: {@link Result.ok}, {@link Result.err},
|
|
595
649
|
* {@link Result.defect}, {@link Result.fromNullable}, {@link Result.fromThrowable},
|
|
596
650
|
* {@link Result.fromPromise}, {@link Result.fromSafePromise}, {@link Result.all},
|
|
597
|
-
* {@link Result.allAsync}, {@link Result.
|
|
651
|
+
* {@link Result.allAsync}, {@link Result.allFromDict},
|
|
652
|
+
* {@link Result.allFromDictAsync}, {@link Result.isOk}, {@link Result.isErr},
|
|
598
653
|
* {@link Result.isDefect}.
|
|
599
654
|
*
|
|
600
655
|
* @remarks
|
|
@@ -619,6 +674,8 @@ declare const Result: {
|
|
|
619
674
|
readonly fromSafePromise: typeof fromSafePromise;
|
|
620
675
|
readonly all: typeof all;
|
|
621
676
|
readonly allAsync: typeof allAsync;
|
|
677
|
+
readonly allFromDict: typeof allFromDict;
|
|
678
|
+
readonly allFromDictAsync: typeof allFromDictAsync;
|
|
622
679
|
readonly isOk: typeof isOk;
|
|
623
680
|
readonly isErr: typeof isErr;
|
|
624
681
|
readonly isDefect: typeof isDefect;
|
|
@@ -747,5 +804,5 @@ declare function matchTags<T, E extends {
|
|
|
747
804
|
_tag: string;
|
|
748
805
|
}, R>(result: AsyncResult<T, E>, handlers: TagHandlers<T, E, R>): Promise<R>;
|
|
749
806
|
//#endregion
|
|
750
|
-
export { type AsyncErrOf, type AsyncOkOf, type AsyncResult, type Awaitable, type Defect, type DefectView, type ErrOf, type ErrView, type OkOf, type OkView, Result, type TagHandlers, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, UnwrapError, all, allAsync, defect, err, fromNullable, fromPromise, fromSafePromise, fromThrowable, isDefect, isErr, isOk, matchTags, ok };
|
|
807
|
+
export { type AsyncErrOf, type AsyncOkOf, type AsyncResult, type Awaitable, type Defect, type DefectView, type ErrOf, type ErrView, type OkOf, type OkView, Result, type TagHandlers, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, UnwrapError, all, allAsync, allFromDict, allFromDictAsync, defect, err, fromNullable, fromPromise, fromSafePromise, fromThrowable, isDefect, isErr, isOk, matchTags, ok };
|
|
751
808
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/constructors.ts","../src/core.ts","../src/defect.ts","../src/interop.ts","../src/facade.ts","../src/tagged.ts"],"mappings":";;AAWA;;;;;;;;KAAY,aAAA;EAqB6B;;;;;;;;;EAXvC,GAAA,IAAO,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,CAAA,GAAI,QAAA,CAAO,CAAA,EAAG,CAAA;EAoBV;;;;;;;;;;EAT5B,OAAA,QAAe,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,CAAO,CAAA,EAAG,EAAA,IAAM,QAAA,CAAO,CAAA,EAAG,CAAA,GAAI,EAAA;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/constructors.ts","../src/core.ts","../src/defect.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,EAAG,CAAA,IAC3B,OAAA,CAAQ,CAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,23 @@ type ResultMethods<T, E> = {
|
|
|
39
39
|
* @param f - the side effect (its return value is ignored).
|
|
40
40
|
*/
|
|
41
41
|
tap(f: (value: T) => void): Result$1<T, E>;
|
|
42
|
+
/**
|
|
43
|
+
* Run a **failable** side effect on the success value, keeping the original
|
|
44
|
+
* value but threading the effect's error.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* This is to {@link ResultMethods.tap | tap} what
|
|
48
|
+
* {@link ResultMethods.flatMap | flatMap} is to {@link ResultMethods.map | map}:
|
|
49
|
+
* `f` returns a `Result`, but its **success value is discarded** — on success
|
|
50
|
+
* the original value flows through (`Result<T, E | E2>`), while an `Err` (or
|
|
51
|
+
* `Defect`) from `f` short-circuits. Runs only on `Ok`; `Err` and `Defect` pass
|
|
52
|
+
* through. If `f` throws, the throw becomes a `Defect`. Use it for a validation
|
|
53
|
+
* or write whose _result_ matters but whose _value_ you don't need.
|
|
54
|
+
*
|
|
55
|
+
* @typeParam E2 - the error type the effect may introduce.
|
|
56
|
+
* @param f - the failable side effect; its `Ok` value is ignored.
|
|
57
|
+
*/
|
|
58
|
+
flatTap<E2>(f: (value: T) => Result$1<unknown, E2>): Result$1<T, E | E2>;
|
|
42
59
|
/**
|
|
43
60
|
* Replace the success value with a constant `value`.
|
|
44
61
|
*
|
|
@@ -258,7 +275,8 @@ type Awaitable<T> = {
|
|
|
258
275
|
* {@link fromPromise} forces. To do further async work, re-enter through a
|
|
259
276
|
* qualified boundary and compose it: `ar.flatMap((v) => fromPromise(work(v),
|
|
260
277
|
* qualify))`. The eliminators (`unwrap`, …) return promises; the binds
|
|
261
|
-
* (`flatMap`, `orElse`, `recoverDefect`) additionally accept an
|
|
278
|
+
* (`flatMap`, `flatTap`, `orElse`, `recoverDefect`) additionally accept an
|
|
279
|
+
* `AsyncResult`.
|
|
262
280
|
*
|
|
263
281
|
* To pattern-match an `AsyncResult`, `await` it first: `match(await ar)`.
|
|
264
282
|
*
|
|
@@ -272,7 +290,13 @@ type AsyncResult<T, E> = Awaitable<Result$1<T, E>> & {
|
|
|
272
290
|
* (never a raw `Promise`); a throw becomes a `Defect`.
|
|
273
291
|
*/
|
|
274
292
|
flatMap<U, E2>(f: (value: T) => Result$1<U, E2> | AsyncResult<U, E2>): AsyncResult<U, E | E2>; /** Asynchronous `tap`. `f` is synchronous; a throw becomes a `Defect`. */
|
|
275
|
-
tap(f: (value: T) => void): AsyncResult<T, E>;
|
|
293
|
+
tap(f: (value: T) => void): AsyncResult<T, E>;
|
|
294
|
+
/**
|
|
295
|
+
* Asynchronous `flatTap` — a failable tap that keeps the original value. `f`
|
|
296
|
+
* may return a `Result` **or** an `AsyncResult`; its `Ok` value is discarded,
|
|
297
|
+
* an `Err`/`Defect` short-circuits, and a throw becomes a `Defect`.
|
|
298
|
+
*/
|
|
299
|
+
flatTap<E2>(f: (value: T) => Result$1<unknown, E2> | AsyncResult<unknown, E2>): AsyncResult<T, E | E2>; /** Asynchronous `as`. */
|
|
276
300
|
as<U>(value: U): AsyncResult<U, E>; /** Asynchronous `mapErr`. `f` is synchronous; a throw becomes a `Defect`. */
|
|
277
301
|
mapErr<E2>(f: (error: E) => E2): AsyncResult<T, E2>; /** Asynchronous `orElse`. `f` may return a `Result` or an `AsyncResult`. */
|
|
278
302
|
orElse<U, E2>(f: (error: E) => Result$1<U, E2> | AsyncResult<U, E2>): AsyncResult<T | U, E2>; /** Asynchronous `recover`. `f` is synchronous; a throw becomes a `Defect`. */
|
|
@@ -544,18 +568,21 @@ declare function fromSafePromise<T>(promise: Promise<T> | (() => Promise<T>)): A
|
|
|
544
568
|
* @internal
|
|
545
569
|
*/
|
|
546
570
|
type AllOk<Rs extends readonly unknown[], Ts extends readonly unknown[]> = number extends Rs["length"] ? Ts[number][] : Ts;
|
|
571
|
+
/** A record of `Result`s — the input to {@link allFromDict}. */
|
|
572
|
+
type ResultRecord = Record<string, Result$1<unknown, unknown>>;
|
|
573
|
+
/** A record of `AsyncResult`s — the input to {@link allFromDictAsync}. */
|
|
574
|
+
type AsyncResultRecord = Record<string, AsyncResult<unknown, unknown>>;
|
|
547
575
|
/**
|
|
548
|
-
* Collect {@link Result}s into a single `Result` of all their
|
|
576
|
+
* Collect a tuple/array of {@link Result}s into a single `Result` of all their
|
|
577
|
+
* success values.
|
|
549
578
|
*
|
|
550
579
|
* @remarks
|
|
551
580
|
* Short-circuits on the **first** `Err` (later entries are not inspected for
|
|
552
581
|
* their error); any `Defect` present **dominates**, winning even over an earlier
|
|
553
582
|
* `Err`. A **fixed tuple** keeps its positional types — `all([ok(1), ok("a")])`
|
|
554
583
|
* is `Result<[number, string], …>` — while a **dynamic array** `Result<T, E>[]`
|
|
555
|
-
* collapses to `Result<T[], E>` with no cast.
|
|
556
|
-
*
|
|
557
|
-
* @typeParam Rs - the tuple/array of input `Result` types.
|
|
558
|
-
* @param results - the results to combine.
|
|
584
|
+
* collapses to `Result<T[], E>` with no cast. For a **record** keyed by name,
|
|
585
|
+
* use {@link allFromDict}.
|
|
559
586
|
*
|
|
560
587
|
* @example
|
|
561
588
|
* ```ts
|
|
@@ -566,27 +593,54 @@ type AllOk<Rs extends readonly unknown[], Ts extends readonly unknown[]> = numbe
|
|
|
566
593
|
*/
|
|
567
594
|
declare function all<Rs extends readonly Result$1<unknown, unknown>[]>(results: readonly [...Rs]): Result$1<AllOk<Rs, { [K in keyof Rs]: OkOf<Rs[K]> }>, ErrOf<Rs[number]>>;
|
|
568
595
|
/**
|
|
569
|
-
*
|
|
570
|
-
*
|
|
596
|
+
* Collect a **record** of {@link Result}s into a single `Result` of a record of
|
|
597
|
+
* their success values — `allFromDict({ a: Result<A, E>, b: Result<B, E> })` is
|
|
598
|
+
* `Result<{ a: A; b: B }, E>`. The named counterpart of {@link all}, for
|
|
599
|
+
* parallel work you'd rather not tuple.
|
|
571
600
|
*
|
|
572
601
|
* @remarks
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
602
|
+
* Same folding rules as {@link all}: first `Err` short-circuits, any `Defect`
|
|
603
|
+
* dominates. This is **not** error accumulation.
|
|
604
|
+
*
|
|
605
|
+
* @example
|
|
606
|
+
* ```ts
|
|
607
|
+
* import { allFromDict, ok } from "unthrown";
|
|
608
|
+
* allFromDict({ id: ok(1), name: ok("ada") }).unwrap(); // { id: 1, name: "ada" }
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
declare function allFromDict<R extends ResultRecord>(results: R): Result$1<{ [K in keyof R]: OkOf<R[K]> }, ErrOf<R[keyof R]>>;
|
|
612
|
+
/**
|
|
613
|
+
* The asynchronous counterpart of {@link all}: combine a tuple/array of
|
|
614
|
+
* {@link AsyncResult}s into one `AsyncResult` of all their success values.
|
|
579
615
|
*
|
|
580
|
-
* @
|
|
581
|
-
*
|
|
616
|
+
* @remarks
|
|
617
|
+
* The inputs are resolved **concurrently** (order preserved); the resolved
|
|
618
|
+
* `Result`s are then folded with the same rules as {@link all} — first `Err`
|
|
619
|
+
* short-circuits, any `Defect` dominates. As ever, the returned `AsyncResult`'s
|
|
620
|
+
* internal promise never rejects. For a **record**, use {@link allFromDictAsync}.
|
|
582
621
|
*
|
|
583
622
|
* @example
|
|
584
623
|
* ```ts
|
|
585
624
|
* import { allAsync, fromSafePromise } from "unthrown";
|
|
586
|
-
*
|
|
625
|
+
* await allAsync([fromSafePromise(a()), fromSafePromise(b())]);
|
|
587
626
|
* ```
|
|
588
627
|
*/
|
|
589
628
|
declare function allAsync<Rs extends readonly AsyncResult<unknown, unknown>[]>(results: readonly [...Rs]): AsyncResult<AllOk<Rs, { [K in keyof Rs]: AsyncOkOf<Rs[K]> }>, AsyncErrOf<Rs[number]>>;
|
|
629
|
+
/**
|
|
630
|
+
* The asynchronous counterpart of {@link allFromDict}: combine a record of
|
|
631
|
+
* {@link AsyncResult}s into one `AsyncResult` of a record of their values.
|
|
632
|
+
*
|
|
633
|
+
* @remarks
|
|
634
|
+
* Resolved concurrently (order preserved), folded with the {@link all} rules,
|
|
635
|
+
* and the internal promise never rejects.
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```ts
|
|
639
|
+
* import { allFromDictAsync, fromSafePromise } from "unthrown";
|
|
640
|
+
* await allFromDictAsync({ a: fromSafePromise(a()), b: fromSafePromise(b()) });
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
declare function allFromDictAsync<R extends AsyncResultRecord>(results: R): AsyncResult<{ [K in keyof R]: AsyncOkOf<R[K]> }, AsyncErrOf<R[keyof R]>>;
|
|
590
644
|
//#endregion
|
|
591
645
|
//#region src/facade.d.ts
|
|
592
646
|
/**
|
|
@@ -594,7 +648,8 @@ declare function allAsync<Rs extends readonly AsyncResult<unknown, unknown>[]>(r
|
|
|
594
648
|
* discoverable namespace: {@link Result.ok}, {@link Result.err},
|
|
595
649
|
* {@link Result.defect}, {@link Result.fromNullable}, {@link Result.fromThrowable},
|
|
596
650
|
* {@link Result.fromPromise}, {@link Result.fromSafePromise}, {@link Result.all},
|
|
597
|
-
* {@link Result.allAsync}, {@link Result.
|
|
651
|
+
* {@link Result.allAsync}, {@link Result.allFromDict},
|
|
652
|
+
* {@link Result.allFromDictAsync}, {@link Result.isOk}, {@link Result.isErr},
|
|
598
653
|
* {@link Result.isDefect}.
|
|
599
654
|
*
|
|
600
655
|
* @remarks
|
|
@@ -619,6 +674,8 @@ declare const Result: {
|
|
|
619
674
|
readonly fromSafePromise: typeof fromSafePromise;
|
|
620
675
|
readonly all: typeof all;
|
|
621
676
|
readonly allAsync: typeof allAsync;
|
|
677
|
+
readonly allFromDict: typeof allFromDict;
|
|
678
|
+
readonly allFromDictAsync: typeof allFromDictAsync;
|
|
622
679
|
readonly isOk: typeof isOk;
|
|
623
680
|
readonly isErr: typeof isErr;
|
|
624
681
|
readonly isDefect: typeof isDefect;
|
|
@@ -747,5 +804,5 @@ declare function matchTags<T, E extends {
|
|
|
747
804
|
_tag: string;
|
|
748
805
|
}, R>(result: AsyncResult<T, E>, handlers: TagHandlers<T, E, R>): Promise<R>;
|
|
749
806
|
//#endregion
|
|
750
|
-
export { type AsyncErrOf, type AsyncOkOf, type AsyncResult, type Awaitable, type Defect, type DefectView, type ErrOf, type ErrView, type OkOf, type OkView, Result, type TagHandlers, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, UnwrapError, all, allAsync, defect, err, fromNullable, fromPromise, fromSafePromise, fromThrowable, isDefect, isErr, isOk, matchTags, ok };
|
|
807
|
+
export { type AsyncErrOf, type AsyncOkOf, type AsyncResult, type Awaitable, type Defect, type DefectView, type ErrOf, type ErrView, type OkOf, type OkView, Result, type TagHandlers, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, UnwrapError, all, allAsync, allFromDict, allFromDictAsync, defect, err, fromNullable, fromPromise, fromSafePromise, fromThrowable, isDefect, isErr, isOk, matchTags, ok };
|
|
751
808
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/constructors.ts","../src/core.ts","../src/defect.ts","../src/interop.ts","../src/facade.ts","../src/tagged.ts"],"mappings":";;AAWA;;;;;;;;KAAY,aAAA;EAqB6B;;;;;;;;;EAXvC,GAAA,IAAO,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,CAAA,GAAI,QAAA,CAAO,CAAA,EAAG,CAAA;EAoBV;;;;;;;;;;EAT5B,OAAA,QAAe,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,CAAO,CAAA,EAAG,EAAA,IAAM,QAAA,CAAO,CAAA,EAAG,CAAA,GAAI,EAAA;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/constructors.ts","../src/core.ts","../src/defect.ts","../src/interop.ts","../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