@nicolastoulemont/std 0.3.0 → 0.5.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/adt/index.d.mts +1 -1
- package/dist/adt/index.mjs +1 -3
- package/dist/adt-DZmVJG4P.mjs +2 -0
- package/dist/adt-DZmVJG4P.mjs.map +1 -0
- package/dist/{apply-fn.types-CXDoeA7D.d.mts → apply-fn.types-CMgY6WQe.d.mts} +1 -1
- package/dist/{apply-fn.types-CXDoeA7D.d.mts.map → apply-fn.types-CMgY6WQe.d.mts.map} +1 -1
- package/dist/brand/index.d.mts +2 -2
- package/dist/brand/index.mjs +1 -3
- package/dist/brand-BUqMmkzC.mjs +2 -0
- package/dist/{brand-CTaxGuU9.mjs.map → brand-BUqMmkzC.mjs.map} +1 -1
- package/dist/data/index.d.mts +1 -1
- package/dist/data/index.mjs +1 -3
- package/dist/data-DzqKBCQg.mjs +2 -0
- package/dist/data-DzqKBCQg.mjs.map +1 -0
- package/dist/discriminator.types-DkThfvNE.d.mts +7 -0
- package/dist/discriminator.types-DkThfvNE.d.mts.map +1 -0
- package/dist/either/index.d.mts +2 -2
- package/dist/either/index.mjs +1 -3
- package/dist/either-BDY9T5oz.mjs +2 -0
- package/dist/either-BDY9T5oz.mjs.map +1 -0
- package/dist/equality-D2EJvZm4.mjs +2 -0
- package/dist/equality-D2EJvZm4.mjs.map +1 -0
- package/dist/err/index.d.mts +2 -2
- package/dist/err/index.mjs +1 -3
- package/dist/err-CYs4b1RV.mjs +2 -0
- package/dist/err-CYs4b1RV.mjs.map +1 -0
- package/dist/flow/index.d.mts +1 -1
- package/dist/flow/index.mjs +1 -3
- package/dist/flow-CxKQ5yac.mjs +2 -0
- package/dist/flow-CxKQ5yac.mjs.map +1 -0
- package/dist/fx/index.d.mts +3 -0
- package/dist/fx/index.mjs +1 -0
- package/dist/fx-C4UuWCqP.mjs +2 -0
- package/dist/fx-C4UuWCqP.mjs.map +1 -0
- package/dist/fx.types-CXTwEa1G.mjs +2 -0
- package/dist/fx.types-CXTwEa1G.mjs.map +1 -0
- package/dist/fx.types-DO-8yG4c.d.mts +133 -0
- package/dist/fx.types-DO-8yG4c.d.mts.map +1 -0
- package/dist/index-78LWwTds.d.mts +288 -0
- package/dist/index-78LWwTds.d.mts.map +1 -0
- package/dist/index-BQ5wVDSP.d.mts +441 -0
- package/dist/index-BQ5wVDSP.d.mts.map +1 -0
- package/dist/{index-tkgTLCoq.d.mts → index-BahMvQpA.d.mts} +2 -2
- package/dist/{index-tkgTLCoq.d.mts.map → index-BahMvQpA.d.mts.map} +1 -1
- package/dist/index-Bs5TTFlK.d.mts +882 -0
- package/dist/index-Bs5TTFlK.d.mts.map +1 -0
- package/dist/index-BuLJRX1e.d.mts +476 -0
- package/dist/index-BuLJRX1e.d.mts.map +1 -0
- package/dist/{index-BR7takNf.d.mts → index-CDio8mJY.d.mts} +65 -26
- package/dist/index-CDio8mJY.d.mts.map +1 -0
- package/dist/{index-Cp_4sFun.d.mts → index-DLlx9jiG.d.mts} +38 -43
- package/dist/index-DLlx9jiG.d.mts.map +1 -0
- package/dist/index-DQoTXLSm.d.mts +846 -0
- package/dist/index-DQoTXLSm.d.mts.map +1 -0
- package/dist/index-DjjJIDaA.d.mts +221 -0
- package/dist/index-DjjJIDaA.d.mts.map +1 -0
- package/dist/{index-BCrD3pEs.d.mts → index-DtAPrec7.d.mts} +18 -18
- package/dist/index-DtAPrec7.d.mts.map +1 -0
- package/dist/{index-zC2zAtZY.d.mts → index-IdejL485.d.mts} +2 -2
- package/dist/{index-zC2zAtZY.d.mts.map → index-IdejL485.d.mts.map} +1 -1
- package/dist/index.d.mts +16 -802
- package/dist/index.mjs +1 -1393
- package/dist/option/index.d.mts +3 -3
- package/dist/option/index.mjs +1 -3
- package/dist/option-Qiv7Ls7L.mjs +2 -0
- package/dist/option-Qiv7Ls7L.mjs.map +1 -0
- package/dist/option.types-By5UOfC2.mjs +2 -0
- package/dist/option.types-By5UOfC2.mjs.map +1 -0
- package/dist/option.types-Cluybn30.d.mts +167 -0
- package/dist/option.types-Cluybn30.d.mts.map +1 -0
- package/dist/pipe/index.d.mts +1 -1
- package/dist/pipe/index.mjs +1 -3
- package/dist/pipe-BROILDeC.mjs +2 -0
- package/dist/{pipe-GYxZNkPB.mjs.map → pipe-BROILDeC.mjs.map} +1 -1
- package/dist/pipeable-KHu4D8ol.d.mts +27 -0
- package/dist/pipeable-KHu4D8ol.d.mts.map +1 -0
- package/dist/pipeable-rQvolRqh.mjs +2 -0
- package/dist/pipeable-rQvolRqh.mjs.map +1 -0
- package/dist/predicate/index.d.mts +2 -2
- package/dist/predicate/index.mjs +1 -3
- package/dist/predicate-DvXnfmeJ.mjs +2 -0
- package/dist/{predicate-BZkZmo-W.mjs.map → predicate-DvXnfmeJ.mjs.map} +1 -1
- package/dist/result/index.d.mts +3 -3
- package/dist/result/index.mjs +1 -3
- package/dist/result-B68pxC7l.mjs +2 -0
- package/dist/result-B68pxC7l.mjs.map +1 -0
- package/dist/result-uRORQlAQ.mjs +1 -0
- package/dist/result.types-fIbuBwVQ.d.mts +259 -0
- package/dist/result.types-fIbuBwVQ.d.mts.map +1 -0
- package/package.json +1 -9
- package/dist/adt-DraJkmij.mjs +0 -318
- package/dist/adt-DraJkmij.mjs.map +0 -1
- package/dist/brand-CTaxGuU9.mjs +0 -165
- package/dist/data-DgzWI4R_.mjs +0 -244
- package/dist/data-DgzWI4R_.mjs.map +0 -1
- package/dist/discriminator.types-DCkkrCj4.d.mts +0 -7
- package/dist/discriminator.types-DCkkrCj4.d.mts.map +0 -1
- package/dist/either-CnOBUH7a.mjs +0 -598
- package/dist/either-CnOBUH7a.mjs.map +0 -1
- package/dist/equality/index.d.mts +0 -86
- package/dist/equality/index.d.mts.map +0 -1
- package/dist/equality/index.mjs +0 -3
- package/dist/equality-YMebYwm1.mjs +0 -201
- package/dist/equality-YMebYwm1.mjs.map +0 -1
- package/dist/err-BqQApH9r.mjs +0 -169
- package/dist/err-BqQApH9r.mjs.map +0 -1
- package/dist/flow-pRdnqmMY.mjs +0 -21
- package/dist/flow-pRdnqmMY.mjs.map +0 -1
- package/dist/fn/index.d.mts +0 -2
- package/dist/fn/index.mjs +0 -3
- package/dist/fn-DFHj-EVA.mjs +0 -10
- package/dist/fn-DFHj-EVA.mjs.map +0 -1
- package/dist/gen/index.d.mts +0 -3
- package/dist/gen/index.mjs +0 -3
- package/dist/gen-DF-FXNdy.mjs +0 -99
- package/dist/gen-DF-FXNdy.mjs.map +0 -1
- package/dist/index-B3z7T6Dz.d.mts +0 -57
- package/dist/index-B3z7T6Dz.d.mts.map +0 -1
- package/dist/index-BCrD3pEs.d.mts.map +0 -1
- package/dist/index-BFhV56qy.d.mts +0 -105
- package/dist/index-BFhV56qy.d.mts.map +0 -1
- package/dist/index-BLG9B4bn.d.mts +0 -116
- package/dist/index-BLG9B4bn.d.mts.map +0 -1
- package/dist/index-BR7takNf.d.mts.map +0 -1
- package/dist/index-BiFc2xWF.d.mts +0 -211
- package/dist/index-BiFc2xWF.d.mts.map +0 -1
- package/dist/index-BwVaI5d0.d.mts +0 -79
- package/dist/index-BwVaI5d0.d.mts.map +0 -1
- package/dist/index-CckxkaUd.d.mts +0 -80
- package/dist/index-CckxkaUd.d.mts.map +0 -1
- package/dist/index-Cp_4sFun.d.mts.map +0 -1
- package/dist/index-DbfMra4p.d.mts +0 -72
- package/dist/index-DbfMra4p.d.mts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/is-promise-BEl3eGZg.mjs +0 -11
- package/dist/is-promise-BEl3eGZg.mjs.map +0 -1
- package/dist/option-CKHDOVea.mjs +0 -410
- package/dist/option-CKHDOVea.mjs.map +0 -1
- package/dist/option.types-eqVODMIy.d.mts +0 -89
- package/dist/option.types-eqVODMIy.d.mts.map +0 -1
- package/dist/pipe-GYxZNkPB.mjs +0 -10
- package/dist/predicate-BZkZmo-W.mjs +0 -293
- package/dist/result-C5tPWR60.mjs +0 -422
- package/dist/result-C5tPWR60.mjs.map +0 -1
- package/dist/result-D7XJ96pv.mjs +0 -1
- package/dist/result.types-Bd8a43Fg.d.mts +0 -174
- package/dist/result.types-Bd8a43Fg.d.mts.map +0 -1
package/dist/gen-DF-FXNdy.mjs
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { n as err, r as ok } from "./result-C5tPWR60.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/gen/gen.ts
|
|
4
|
-
/**
|
|
5
|
-
* Implementation of unified gen function.
|
|
6
|
-
* Detects sync vs async generator and returns appropriate computation type.
|
|
7
|
-
*/
|
|
8
|
-
function gen(generatorFn) {
|
|
9
|
-
const runSync = () => {
|
|
10
|
-
const gen$1 = generatorFn();
|
|
11
|
-
if (Symbol.asyncIterator in gen$1) throw new Error("Cannot run sync on async generator. This should not happen if types are correct.");
|
|
12
|
-
const next = gen$1.next();
|
|
13
|
-
if (next.done !== true) return err(next.value);
|
|
14
|
-
return ok(next.value);
|
|
15
|
-
};
|
|
16
|
-
const runAsync = async () => {
|
|
17
|
-
const gen$1 = generatorFn();
|
|
18
|
-
if (Symbol.asyncIterator in gen$1) {
|
|
19
|
-
const next = await gen$1.next();
|
|
20
|
-
if (next.done !== true) return err(next.value);
|
|
21
|
-
return ok(next.value);
|
|
22
|
-
}
|
|
23
|
-
return runSync();
|
|
24
|
-
};
|
|
25
|
-
const testGen = generatorFn();
|
|
26
|
-
if (Symbol.asyncIterator in testGen) return {
|
|
27
|
-
run: runAsync,
|
|
28
|
-
async *[Symbol.asyncIterator]() {
|
|
29
|
-
const result = await runAsync();
|
|
30
|
-
if (!result.ok) {
|
|
31
|
-
yield result.error;
|
|
32
|
-
throw new Error("Unreachable: gen should short-circuit on error");
|
|
33
|
-
}
|
|
34
|
-
return result.value;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
run: runSync,
|
|
39
|
-
*[Symbol.iterator]() {
|
|
40
|
-
const result = runSync();
|
|
41
|
-
if (!result.ok) {
|
|
42
|
-
yield result.error;
|
|
43
|
-
throw new Error("Unreachable: Do should short-circuit on error");
|
|
44
|
-
}
|
|
45
|
-
return result.value;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Implementation of ensure for sync/async predicates.
|
|
51
|
-
*/
|
|
52
|
-
function ensure(predicate, onFail) {
|
|
53
|
-
return (value) => {
|
|
54
|
-
const result = predicate(value);
|
|
55
|
-
const makeYieldable = (passes) => ({ *[Symbol.iterator]() {
|
|
56
|
-
if (!passes) {
|
|
57
|
-
yield onFail(value);
|
|
58
|
-
throw new Error("Unreachable: gen should short-circuit on error");
|
|
59
|
-
}
|
|
60
|
-
return value;
|
|
61
|
-
} });
|
|
62
|
-
if (result instanceof Promise) return result.then(makeYieldable);
|
|
63
|
-
return makeYieldable(result);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Convert a type refinement to a yieldable with type narrowing.
|
|
68
|
-
* Use this to narrow types within a gen computation.
|
|
69
|
-
*
|
|
70
|
-
* Note: Refinements are inherently synchronous (TypeScript type guards).
|
|
71
|
-
*
|
|
72
|
-
* @template T - The input type
|
|
73
|
-
* @template U - The narrowed type (must extend T)
|
|
74
|
-
* @template E - The error type on failure
|
|
75
|
-
* @param refinement - A type guard function
|
|
76
|
-
* @param onFail - A function that creates an error from the failing value
|
|
77
|
-
* @returns A function that takes a value and returns a Yieldable with narrowed type
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* const isString = (v: unknown): v is string => typeof v === "string"
|
|
82
|
-
*
|
|
83
|
-
* const result = gen(function* () {
|
|
84
|
-
* const str = yield* ensureRefinement(isString, () => "Expected string")(unknownValue)
|
|
85
|
-
* return str.toUpperCase() // str is typed as string
|
|
86
|
-
* }).run()
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
const ensureRefinement = (refinement, onFail) => (value) => ({ *[Symbol.iterator]() {
|
|
90
|
-
if (!refinement(value)) {
|
|
91
|
-
yield onFail(value);
|
|
92
|
-
throw new Error("Unreachable: gen should short-circuit on error");
|
|
93
|
-
}
|
|
94
|
-
return value;
|
|
95
|
-
} });
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
export { ensureRefinement as n, gen as r, ensure as t };
|
|
99
|
-
//# sourceMappingURL=gen-DF-FXNdy.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gen-DF-FXNdy.mjs","names":["gen"],"sources":["../src/gen/gen.ts"],"sourcesContent":["import { ok, err } from \"../result/result\"\nimport type { Result } from \"../result/result.types\"\nimport type { SyncComputation, AsyncComputation, GenGenerator, AsyncGenGenerator, Yieldable } from \"./gen.types\"\n\n/**\n * Create a computation from a sync generator function.\n * Returns a SyncComputation where run() returns Result directly (no Promise).\n *\n * @template A - The success value type\n * @template E - The error type\n * @param generatorFn - A function that returns a sync generator\n * @returns SyncComputation<A, E>\n *\n * @see {@link run} for immediate execution without storing the computation\n *\n * @example\n * ```ts\n * const result = gen(function* () {\n * const a = yield* Result.yield(divide(10, 2))\n * const b = yield* Result.yield(divide(a, 2))\n * return b\n * }).run()\n * // Type: Result<number, \"DivisionByZero\">\n * ```\n */\nexport function gen<A, E>(generatorFn: () => GenGenerator<A, E>): SyncComputation<A, E>\n\n/**\n * Create a computation from an async generator function.\n * Returns an AsyncComputation where run() returns Promise<Result>.\n *\n * @template A - The success value type\n * @template E - The error type\n * @param generatorFn - A function that returns an async generator\n * @returns AsyncComputation<A, E>\n *\n * @see {@link run} for immediate execution without storing the computation\n *\n * @example\n * ```ts\n * const result = await gen(async function* () {\n * const data = yield* Result.yield(await fetchData(1))\n * return data\n * }).run()\n * // Type: Promise<Result<string, \"NetworkError\">>\n * ```\n */\nexport function gen<A, E>(generatorFn: () => AsyncGenGenerator<A, E>): AsyncComputation<A, E>\n\n/**\n * Implementation of unified gen function.\n * Detects sync vs async generator and returns appropriate computation type.\n */\nexport function gen<A, E>(\n generatorFn: () => GenGenerator<A, E> | AsyncGenGenerator<A, E>,\n): SyncComputation<A, E> | AsyncComputation<A, E> {\n // Helper to run sync generator\n const runSync = (): Result<A, E> => {\n const gen = generatorFn()\n\n // Detect async generator at runtime (safety check)\n if (Symbol.asyncIterator in gen) {\n throw new Error(\"Cannot run sync on async generator. This should not happen if types are correct.\")\n }\n\n const syncGen = gen\n const next = syncGen.next()\n\n // If not done, an error was yielded (short-circuit)\n if (next.done !== true) {\n return err(next.value)\n }\n\n return ok(next.value)\n }\n\n // Helper to run async generator\n const runAsync = async (): Promise<Result<A, E>> => {\n const gen = generatorFn()\n\n if (Symbol.asyncIterator in gen) {\n // Async generator path\n const asyncGen = gen\n const next = await asyncGen.next()\n\n if (next.done !== true) {\n return err(next.value)\n }\n return ok(next.value)\n }\n // Sync generator can also use run() - just runs synchronously\n return runSync()\n }\n\n // Check if we're dealing with async generator\n // We need to call it once to check the type\n const testGen = generatorFn()\n const isAsync = Symbol.asyncIterator in testGen\n\n if (isAsync) {\n // Return AsyncComputation with Symbol.asyncIterator for nesting\n return {\n run: runAsync,\n async *[Symbol.asyncIterator](): AsyncGenerator<E, A, unknown> {\n const result = await runAsync()\n if (!result.ok) {\n yield result.error\n throw new Error(\"Unreachable: gen should short-circuit on error\")\n }\n return result.value\n },\n } as AsyncComputation<A, E>\n }\n // Return SyncComputation (with Symbol.iterator for nesting)\n return {\n run: runSync,\n *[Symbol.iterator](): Generator<E, A, unknown> {\n const result = runSync()\n if (!result.ok) {\n yield result.error\n // This line is never reached because outer Do stops iteration on first yield\n // But TypeScript needs a return statement for the A type\n throw new Error(\"Unreachable: Do should short-circuit on error\")\n }\n return result.value\n },\n } as SyncComputation<A, E>\n}\n\n// ============================================================================\n// Predicate Bridge Functions\n// ============================================================================\n\n/**\n * Convert a sync predicate to a yieldable.\n * Use this to validate values within a gen computation.\n *\n * @template T - The value type to validate\n * @template E - The error type on failure\n * @param predicate - A sync predicate function\n * @param onFail - A function that creates an error from the failing value\n * @returns A function that takes a value and returns a Yieldable\n *\n * @example\n * ```ts\n * const isPositive = (n: number) => n > 0\n *\n * const result = gen(function* () {\n * const value = yield* ensure(isPositive, n => `${n} must be positive`)(userInput)\n * return value * 2\n * }).run()\n * ```\n */\nexport function ensure<T, E>(predicate: (value: T) => boolean, onFail: (value: T) => E): (value: T) => Yieldable<T, E>\n\n/**\n * Convert an async predicate to an async yieldable.\n * Use this to validate values within an async gen computation.\n *\n * @template T - The value type to validate\n * @template E - The error type on failure\n * @param predicate - An async predicate function\n * @param onFail - A function that creates an error from the failing value\n * @returns A function that takes a value and returns a Promise<Yieldable>\n *\n * @example\n * ```ts\n * const isAvailable = async (id: number) => await checkAvailability(id)\n *\n * const result = await gen(async function* () {\n * const id = yield* await ensure(isAvailable, id => `${id} not available`)(userId)\n * return `user-${id}`\n * }).run()\n * ```\n */\nexport function ensure<T, E>(\n predicate: (value: T) => Promise<boolean>,\n onFail: (value: T) => E,\n): (value: T) => Promise<Yieldable<T, E>>\n\n/**\n * Implementation of ensure for sync/async predicates.\n */\nexport function ensure<T, E>(\n predicate: (value: T) => boolean | Promise<boolean>,\n onFail: (value: T) => E,\n): (value: T) => Yieldable<T, E> | Promise<Yieldable<T, E>> {\n return (value: T) => {\n const result = predicate(value)\n\n const makeYieldable = (passes: boolean): Yieldable<T, E> => ({\n *[Symbol.iterator](): Generator<E, T, unknown> {\n if (!passes) {\n yield onFail(value)\n throw new Error(\"Unreachable: gen should short-circuit on error\")\n }\n return value\n },\n })\n\n if (result instanceof Promise) {\n return result.then(makeYieldable)\n }\n return makeYieldable(result)\n }\n}\n\n/**\n * Convert a type refinement to a yieldable with type narrowing.\n * Use this to narrow types within a gen computation.\n *\n * Note: Refinements are inherently synchronous (TypeScript type guards).\n *\n * @template T - The input type\n * @template U - The narrowed type (must extend T)\n * @template E - The error type on failure\n * @param refinement - A type guard function\n * @param onFail - A function that creates an error from the failing value\n * @returns A function that takes a value and returns a Yieldable with narrowed type\n *\n * @example\n * ```ts\n * const isString = (v: unknown): v is string => typeof v === \"string\"\n *\n * const result = gen(function* () {\n * const str = yield* ensureRefinement(isString, () => \"Expected string\")(unknownValue)\n * return str.toUpperCase() // str is typed as string\n * }).run()\n * ```\n */\nexport const ensureRefinement =\n <T, U extends T, E>(refinement: (value: T) => value is U, onFail: (value: T) => E) =>\n (value: T): Yieldable<U, E> => ({\n *[Symbol.iterator](): Generator<E, U, unknown> {\n if (!refinement(value)) {\n yield onFail(value)\n throw new Error(\"Unreachable: gen should short-circuit on error\")\n }\n return value\n },\n })\n"],"mappings":";;;;;;;AAqDA,SAAgB,IACd,aACgD;CAEhD,MAAM,gBAA8B;EAClC,MAAMA,QAAM,aAAa;AAGzB,MAAI,OAAO,iBAAiBA,MAC1B,OAAM,IAAI,MAAM,mFAAmF;EAIrG,MAAM,OADUA,MACK,MAAM;AAG3B,MAAI,KAAK,SAAS,KAChB,QAAO,IAAI,KAAK,MAAM;AAGxB,SAAO,GAAG,KAAK,MAAM;;CAIvB,MAAM,WAAW,YAAmC;EAClD,MAAMA,QAAM,aAAa;AAEzB,MAAI,OAAO,iBAAiBA,OAAK;GAG/B,MAAM,OAAO,MADIA,MACW,MAAM;AAElC,OAAI,KAAK,SAAS,KAChB,QAAO,IAAI,KAAK,MAAM;AAExB,UAAO,GAAG,KAAK,MAAM;;AAGvB,SAAO,SAAS;;CAKlB,MAAM,UAAU,aAAa;AAG7B,KAFgB,OAAO,iBAAiB,QAItC,QAAO;EACL,KAAK;EACL,QAAQ,OAAO,iBAAgD;GAC7D,MAAM,SAAS,MAAM,UAAU;AAC/B,OAAI,CAAC,OAAO,IAAI;AACd,UAAM,OAAO;AACb,UAAM,IAAI,MAAM,iDAAiD;;AAEnE,UAAO,OAAO;;EAEjB;AAGH,QAAO;EACL,KAAK;EACL,EAAE,OAAO,YAAsC;GAC7C,MAAM,SAAS,SAAS;AACxB,OAAI,CAAC,OAAO,IAAI;AACd,UAAM,OAAO;AAGb,UAAM,IAAI,MAAM,gDAAgD;;AAElE,UAAO,OAAO;;EAEjB;;;;;AAyDH,SAAgB,OACd,WACA,QAC0D;AAC1D,SAAQ,UAAa;EACnB,MAAM,SAAS,UAAU,MAAM;EAE/B,MAAM,iBAAiB,YAAsC,EAC3D,EAAE,OAAO,YAAsC;AAC7C,OAAI,CAAC,QAAQ;AACX,UAAM,OAAO,MAAM;AACnB,UAAM,IAAI,MAAM,iDAAiD;;AAEnE,UAAO;KAEV;AAED,MAAI,kBAAkB,QACpB,QAAO,OAAO,KAAK,cAAc;AAEnC,SAAO,cAAc,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BhC,MAAa,oBACS,YAAsC,YACzD,WAA+B,EAC9B,EAAE,OAAO,YAAsC;AAC7C,KAAI,CAAC,WAAW,MAAM,EAAE;AACtB,QAAM,OAAO,MAAM;AACnB,QAAM,IAAI,MAAM,iDAAiD;;AAEnE,QAAO;GAEV"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { i as Result } from "./result.types-Bd8a43Fg.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/fn/fn.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Convenience wrapper around gen() that executes the computation immediately
|
|
7
|
-
* and returns the Result directly.
|
|
8
|
-
*
|
|
9
|
-
* Use this when you want inline execution without storing the computation.
|
|
10
|
-
* For deferred execution, use gen() directly.
|
|
11
|
-
*
|
|
12
|
-
* @see {@link gen} for deferred/composable computations
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // Sync computation
|
|
17
|
-
* const result = fn(function* () {
|
|
18
|
-
* const a = yield* divide(10, 2)
|
|
19
|
-
* const b = yield* divide(a, 2)
|
|
20
|
-
* return b
|
|
21
|
-
* }) // Result<number, "DivisionByZero">
|
|
22
|
-
*
|
|
23
|
-
* // Async computation
|
|
24
|
-
* const user = await fn(async function* () {
|
|
25
|
-
* const data = yield* await fetchUser(1)
|
|
26
|
-
* return data.name
|
|
27
|
-
* }) // Promise<Result<string, "NotFound">>
|
|
28
|
-
*
|
|
29
|
-
* // Type accumulation
|
|
30
|
-
* const result = fn(function* () {
|
|
31
|
-
* const a = yield* divide(10, 2) // "DivisionByZero"
|
|
32
|
-
* const b = yield* findUser(a) // "NotFound"
|
|
33
|
-
* return b.name
|
|
34
|
-
* }) // Result<string, "DivisionByZero" | "NotFound">
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* Execute a sync generator computation immediately.
|
|
39
|
-
*
|
|
40
|
-
* @template A - The success value type
|
|
41
|
-
* @template E - The error type (union of all yielded error types)
|
|
42
|
-
* @param generatorFn - A function returning a sync generator
|
|
43
|
-
* @returns Result<A, E> directly
|
|
44
|
-
*/
|
|
45
|
-
declare function fn<A, E>(generatorFn: () => Generator<E, A, unknown>): Result<A, E>;
|
|
46
|
-
/**
|
|
47
|
-
* Execute an async generator computation immediately.
|
|
48
|
-
*
|
|
49
|
-
* @template A - The success value type
|
|
50
|
-
* @template E - The error type (union of all yielded error types)
|
|
51
|
-
* @param generatorFn - A function returning an async generator
|
|
52
|
-
* @returns Promise<Result<A, E>>
|
|
53
|
-
*/
|
|
54
|
-
declare function fn<A, E>(generatorFn: () => AsyncGenerator<E, A, unknown>): Promise<Result<A, E>>;
|
|
55
|
-
//#endregion
|
|
56
|
-
export { fn as t };
|
|
57
|
-
//# sourceMappingURL=index-B3z7T6Dz.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-B3z7T6Dz.d.mts","names":[],"sources":["../src/fn/fn.ts"],"sourcesContent":[],"mappings":";;;;;;AA4CA;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAVgB,4BAA4B,UAAU,GAAG,cAAc,OAAW,GAAG;;;;;;;;;iBAUrE,4BAA4B,eAAe,GAAG,cAAc,QAAQ,OAAW,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-BCrD3pEs.d.mts","names":[],"sources":["../src/data/data.types.ts","../src/data/data.tagged.ts","../src/data/data.struct.ts","../src/data/data.tuple.ts","../src/data/data.array.ts"],"sourcesContent":[],"mappings":";;;;;;AAUA;;AAAsD,KAA1C,WAA0C,CAAA,iBAAA,MAAA,EAAA,CAAA,CAAA,GAAA,QAAA,CAAS,CAAT,CAAA,GAAc,aAAd,CAA4B,QAA5B,CAAA;;;;AAOtD;;AAIU,KAJE,iBAIF,CAAA,iBAAA,MAAA,EAAA,CAAA,CAAA,GAAA;EAAgB;EAAU,SAAA,UAAA,EAFb,QAEa;EAAtB;EAE6B,CAAA,KAAA,EAFjC,CAEiC,CAAA,EAF7B,WAE6B,CAFjB,QAEiB,EAFP,CAEO,CAAA;EAAU;EAAtB,EAAA,CAAA,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IAAA,WAAA,CAAY,QAAZ,EAAsB,CAAtB,CAAA;EAEP;EAAU,MAAA,CAAA,CAAA,EAAtB,WAAsB,CAAV,QAAU,EAAA,CAAA,CAAA,EAAA,CAAA,EAAO,WAAP,CAAmB,QAAnB,EAA6B,CAA7B,CAAA,CAAA,EAAA,OAAA;EAAtB;EAAyC,IAAA,CAAA,KAAA,EAEvC,WAFuC,CAE3B,QAF2B,EAEjB,CAFiB,CAAA,CAAA,EAAA,MAAA;CAAU;;;;;AAEtC,KAWb,WAXa,CAAA,UAWS,MAXT,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,GAWoC,QAXpC,CAW6C,CAX7C,CAAA,GAAA;EAWb;EAAsB,MAAA,CAAA,KAAA,EAElB,CAFkB,CAAA,EAAA,OAAA;EAAoC;EAAT,IAAA,EAAA,EAAA,MAAA;CAE7C;;AAahB;;;AAC6B,KADjB,UACiB,CAAA,UAAA,SAAA,OAAA,EAAA,CAAA,GAAA,iBAEV,MAFI,CAEJ,GAFQ,CAER,CAFU,CA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AAqBA;;;;;AAEiB,iBCJD,MDIC,CAAA,UCJgB,MDIhB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA,QAAA,EAAA,MAAA,CAAA,ECJ4D,iBDI5D,CAAA,OCJqF,QDIrF,ECJ+F,CDI/F,CAAA;;;;;AA9BjB;;;;;;AAOA;;;;;;;;;;;;;;;;;;;AAqBA;;;;AAEgB,iBENA,MFMA,CAAA,UENiB,MFMjB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA,KAAA,EENiD,CFMjD,CAAA,EENqD,WFMrD,CENiE,CFMjE,CAAA;;;;;AA9BhB;;;;;;AAOA;;;;;;;;;;;;;;;;;;;AAqBA;;;AAA6D,iBGL7C,KHK6C,CAAA,UAAA,SAAA,OAAA,EAAA,CAAA,CAAA,GAAA,IAAA,EGLA,CHKA,CAAA,EGLI,UHKJ,CGLe,CHKf,CAAA;;;;;AA5B7D;;;;;;AAOA;;;;;;;;;;;;;;;;;;;AAqBA;;;;;;AAeA;;;AAC6B,iBIfb,KJea,CAAA,CAAA,CAAA,CAAA,KAAA,EAAA,SIfY,CJeZ,EAAA,CAAA,EIfkB,UJelB,CIf6B,CJe7B,CAAA"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { i as Result } from "./result.types-Bd8a43Fg.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/brand/brand.types.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Unique symbol for brand keys to ensure true nominal typing.
|
|
7
|
-
* Using a symbol prevents collision with actual property keys.
|
|
8
|
-
*/
|
|
9
|
-
declare const BrandSymbol: unique symbol;
|
|
10
|
-
/**
|
|
11
|
-
* A brand type that adds nominal typing to TypeScript.
|
|
12
|
-
* The brand exists only at the type level - no runtime cost.
|
|
13
|
-
*
|
|
14
|
-
* @template K - The brand key (typically a string literal type)
|
|
15
|
-
*/
|
|
16
|
-
type Brand$1<K extends string> = {
|
|
17
|
-
readonly [BrandSymbol]: K;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Create a branded type by intersecting a base type with a brand.
|
|
21
|
-
* The resulting type is structurally compatible with T but nominally unique.
|
|
22
|
-
*
|
|
23
|
-
* @template T - The base type to brand
|
|
24
|
-
* @template K - The brand key (string literal)
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* type UserId = Branded<string, "UserId">
|
|
29
|
-
* type OrderId = Branded<string, "OrderId">
|
|
30
|
-
*
|
|
31
|
-
* // UserId and OrderId are incompatible even though both are strings
|
|
32
|
-
* declare const userId: UserId
|
|
33
|
-
* declare const orderId: OrderId
|
|
34
|
-
* userId = orderId // Type error!
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
type Branded<T, K extends string> = T & Brand$1<K>;
|
|
38
|
-
/**
|
|
39
|
-
* Extract the base type from a branded type.
|
|
40
|
-
* Useful for working with the underlying value.
|
|
41
|
-
*
|
|
42
|
-
* @template B - A branded type
|
|
43
|
-
*/
|
|
44
|
-
type Unbrand<B> = B extends Branded<infer T, string> ? T : B;
|
|
45
|
-
/**
|
|
46
|
-
* Extract the brand key from a branded type.
|
|
47
|
-
*
|
|
48
|
-
* @template B - A branded type
|
|
49
|
-
*/
|
|
50
|
-
type BrandKey<B> = B extends Brand$1<infer K> ? K : never;
|
|
51
|
-
/**
|
|
52
|
-
* A validation function that checks if a value can be branded.
|
|
53
|
-
* Returns true if the value passes validation, false otherwise.
|
|
54
|
-
*
|
|
55
|
-
* @template T - The base type being validated
|
|
56
|
-
*/
|
|
57
|
-
type Validator<T> = (value: T) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Error type returned when brand validation fails.
|
|
60
|
-
* Contains the original value and error message for debugging.
|
|
61
|
-
*
|
|
62
|
-
* @template T - The type of the value that failed validation
|
|
63
|
-
*/
|
|
64
|
-
type BrandError<T = unknown> = {
|
|
65
|
-
readonly __typename: "BrandError";
|
|
66
|
-
readonly value: T;
|
|
67
|
-
readonly message: string;
|
|
68
|
-
};
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/brand/brand.d.ts
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Brand namespace containing utilities for nominal typing in TypeScript.
|
|
74
|
-
*
|
|
75
|
-
* Brand types add type-level distinctiveness to primitive types without
|
|
76
|
-
* any runtime overhead. This prevents accidental mixing of semantically
|
|
77
|
-
* different values that share the same structural type.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* import { Brand } from "@repo/std"
|
|
82
|
-
* import type { Branded } from "@repo/std"
|
|
83
|
-
*
|
|
84
|
-
* // Define branded types
|
|
85
|
-
* type UserId = Branded<string, "UserId">
|
|
86
|
-
* type Email = Branded<string, "Email">
|
|
87
|
-
*
|
|
88
|
-
* // Create values
|
|
89
|
-
* const userId = Brand.make<UserId>("user-123")
|
|
90
|
-
* const isValidEmail = Brand.is<Email>(s => s.includes("@"))
|
|
91
|
-
*
|
|
92
|
-
* // Type safety
|
|
93
|
-
* function sendEmail(email: Email) { ... }
|
|
94
|
-
* sendEmail(userId) // Type error! UserId is not Email
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
declare const Brand: {
|
|
98
|
-
readonly make: <B extends Branded<unknown, string>>(value: Unbrand<B>) => B;
|
|
99
|
-
readonly unsafeMake: <B extends Branded<unknown, string>>(value: Unbrand<B>) => B;
|
|
100
|
-
readonly is: <T, K extends string>(validator: Validator<T>) => ((value: T) => value is Branded<T, K>);
|
|
101
|
-
readonly refine: <B extends Branded<unknown, string>>(validator: Validator<Unbrand<B>>, errorMessage?: string | ((value: Unbrand<B>) => string)) => ((value: Unbrand<B>) => Result<B, BrandError<Unbrand<B>>>);
|
|
102
|
-
};
|
|
103
|
-
//#endregion
|
|
104
|
-
export { Branded as a, BrandKey as i, Brand$1 as n, Unbrand as o, BrandError as r, Validator as s, Brand as t };
|
|
105
|
-
//# sourceMappingURL=index-BFhV56qy.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-BFhV56qy.d.mts","names":[],"sources":["../src/brand/brand.types.ts","../src/brand/brand.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAYA,cARc,WAQG,EAAA,OACL,MAAA;AAqBZ;;;;;AAQA;AAAyB,KA9Bb,OA8Ba,CAAA,UAAA,MAAA,CAAA,GAAA;EAAU,UA7BvB,WAAA,CA6BuB,EA7BT,CA6BS;CAA+B;;AAOlE;AAQA;AAiBA;;;;ACqFA;;;;;;;;;;;AApF2E,KDzC/D,OCyC+D,CAAA,CAAA,EAAA,UAAA,MAAA,CAAA,GDzChC,CCyCgC,GDzC5B,OCyC4B,CDzCtB,CCyCsB,CAAA;;;;;;;AA+C9D,KDhFD,OCgFC,CAAA,CAAA,CAAA,GDhFY,CCgFZ,SDhFsB,OCgFtB,CAAA,KAAA,EAAA,EAAA,MAAA,CAAA,GAAA,CAAA,GDhFqD,CCgFrD;;;;;;AAE+C,KD3EhD,QC2EgD,CAAA,CAAA,CAAA,GD3ElC,CC2EkC,SD3ExB,OC2EwB,CAAA,KAAA,EAAA,CAAA,GAAA,CAAA,GAAA,KAAA;;;;;;;KDnEhD,uBAAuB;;;;;;;KAiBvB;;kBAEM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCmFL;4BAlIkB,iCAAiC,QAAQ,OAAK;kCAoBxC,iCAAiC,QAAQ,OAAK;gDA0BhC,UAAU,gBAAc,eAAe,QAAQ,GAAG;8BA8CpE,qCACpB,UAAU,QAAQ,sCACI,QAAQ,4BAC/B,QAAQ,OAAO,OAAW,GAAG,WAAW,QAAQ"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { _ as GenGenerator, d as AsyncComputation, f as AsyncGenGenerator, v as SyncComputation, y as Yieldable } from "./result.types-Bd8a43Fg.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/gen/gen.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a computation from a sync generator function.
|
|
7
|
-
* Returns a SyncComputation where run() returns Result directly (no Promise).
|
|
8
|
-
*
|
|
9
|
-
* @template A - The success value type
|
|
10
|
-
* @template E - The error type
|
|
11
|
-
* @param generatorFn - A function that returns a sync generator
|
|
12
|
-
* @returns SyncComputation<A, E>
|
|
13
|
-
*
|
|
14
|
-
* @see {@link run} for immediate execution without storing the computation
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* const result = gen(function* () {
|
|
19
|
-
* const a = yield* Result.yield(divide(10, 2))
|
|
20
|
-
* const b = yield* Result.yield(divide(a, 2))
|
|
21
|
-
* return b
|
|
22
|
-
* }).run()
|
|
23
|
-
* // Type: Result<number, "DivisionByZero">
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
declare function gen<A, E>(generatorFn: () => GenGenerator<A, E>): SyncComputation<A, E>;
|
|
27
|
-
/**
|
|
28
|
-
* Create a computation from an async generator function.
|
|
29
|
-
* Returns an AsyncComputation where run() returns Promise<Result>.
|
|
30
|
-
*
|
|
31
|
-
* @template A - The success value type
|
|
32
|
-
* @template E - The error type
|
|
33
|
-
* @param generatorFn - A function that returns an async generator
|
|
34
|
-
* @returns AsyncComputation<A, E>
|
|
35
|
-
*
|
|
36
|
-
* @see {@link run} for immediate execution without storing the computation
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* const result = await gen(async function* () {
|
|
41
|
-
* const data = yield* Result.yield(await fetchData(1))
|
|
42
|
-
* return data
|
|
43
|
-
* }).run()
|
|
44
|
-
* // Type: Promise<Result<string, "NetworkError">>
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
declare function gen<A, E>(generatorFn: () => AsyncGenGenerator<A, E>): AsyncComputation<A, E>;
|
|
48
|
-
/**
|
|
49
|
-
* Convert a sync predicate to a yieldable.
|
|
50
|
-
* Use this to validate values within a gen computation.
|
|
51
|
-
*
|
|
52
|
-
* @template T - The value type to validate
|
|
53
|
-
* @template E - The error type on failure
|
|
54
|
-
* @param predicate - A sync predicate function
|
|
55
|
-
* @param onFail - A function that creates an error from the failing value
|
|
56
|
-
* @returns A function that takes a value and returns a Yieldable
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* const isPositive = (n: number) => n > 0
|
|
61
|
-
*
|
|
62
|
-
* const result = gen(function* () {
|
|
63
|
-
* const value = yield* ensure(isPositive, n => `${n} must be positive`)(userInput)
|
|
64
|
-
* return value * 2
|
|
65
|
-
* }).run()
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
declare function ensure<T, E>(predicate: (value: T) => boolean, onFail: (value: T) => E): (value: T) => Yieldable<T, E>;
|
|
69
|
-
/**
|
|
70
|
-
* Convert an async predicate to an async yieldable.
|
|
71
|
-
* Use this to validate values within an async gen computation.
|
|
72
|
-
*
|
|
73
|
-
* @template T - The value type to validate
|
|
74
|
-
* @template E - The error type on failure
|
|
75
|
-
* @param predicate - An async predicate function
|
|
76
|
-
* @param onFail - A function that creates an error from the failing value
|
|
77
|
-
* @returns A function that takes a value and returns a Promise<Yieldable>
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* const isAvailable = async (id: number) => await checkAvailability(id)
|
|
82
|
-
*
|
|
83
|
-
* const result = await gen(async function* () {
|
|
84
|
-
* const id = yield* await ensure(isAvailable, id => `${id} not available`)(userId)
|
|
85
|
-
* return `user-${id}`
|
|
86
|
-
* }).run()
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
declare function ensure<T, E>(predicate: (value: T) => Promise<boolean>, onFail: (value: T) => E): (value: T) => Promise<Yieldable<T, E>>;
|
|
90
|
-
/**
|
|
91
|
-
* Convert a type refinement to a yieldable with type narrowing.
|
|
92
|
-
* Use this to narrow types within a gen computation.
|
|
93
|
-
*
|
|
94
|
-
* Note: Refinements are inherently synchronous (TypeScript type guards).
|
|
95
|
-
*
|
|
96
|
-
* @template T - The input type
|
|
97
|
-
* @template U - The narrowed type (must extend T)
|
|
98
|
-
* @template E - The error type on failure
|
|
99
|
-
* @param refinement - A type guard function
|
|
100
|
-
* @param onFail - A function that creates an error from the failing value
|
|
101
|
-
* @returns A function that takes a value and returns a Yieldable with narrowed type
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```ts
|
|
105
|
-
* const isString = (v: unknown): v is string => typeof v === "string"
|
|
106
|
-
*
|
|
107
|
-
* const result = gen(function* () {
|
|
108
|
-
* const str = yield* ensureRefinement(isString, () => "Expected string")(unknownValue)
|
|
109
|
-
* return str.toUpperCase() // str is typed as string
|
|
110
|
-
* }).run()
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
declare const ensureRefinement: <T, U extends T, E>(refinement: (value: T) => value is U, onFail: (value: T) => E) => (value: T) => Yieldable<U, E>;
|
|
114
|
-
//#endregion
|
|
115
|
-
export { ensureRefinement as n, gen as r, ensure as t };
|
|
116
|
-
//# sourceMappingURL=index-BLG9B4bn.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-BLG9B4bn.d.mts","names":[],"sources":["../src/gen/gen.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;;;;;;;;AAsBA;;;;;;;;AA0GA;;;AAAqF,iBAhIrE,GAgIqE,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,WAAA,EAAA,GAAA,GAhIxC,YAgIwC,CAhI3B,CAgI2B,EAhIxB,CAgIwB,CAAA,CAAA,EAhInB,eAgImB,CAhIH,CAgIG,EAhIA,CAgIA,CAAA;;;;;;AAsBrF;;;;;;;;;;;AAuDA;;;;AAC4E,iBAxL5D,GAwL4D,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,WAAA,EAAA,GAAA,GAxL/B,iBAwL+B,CAxLb,CAwLa,EAxLV,CAwLU,CAAA,CAAA,EAxLL,gBAw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tC,aCjBsC,CAAA,KAAA,IAAA,CAAA,GAAA,GAAA,GAAA,KAAA;;;;;;;;;;;;KD8B9D,eAAe,UAAU;;;AAtDrC;;;KCTK,MDWD,CAAA,UCXkB,WDWlB,CAAA,MAAA,CAAA,CAAA,GCXyC,IDWzC,CCX8C,CDW9C,EAAA,YAAA,CAAA;;AASJ;;KCfK,WDgBM,CAAA,IAAA,CAAA,GAAA,MChBoB,IDgBpB,SAAA,KAAA,GAAA,IAAA,GAAA,KAAA;;;;;;;;AAWX;;;;;;;;AAkBA;AAaA;;;;ACpEkE;;;;;AAKjB;AAuEjD;;;;;AAqGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBArGgB,qCAAqC,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqGjE;8BA7ImB,0BACzB,oBACF,YAAY,OAAO,yBAAyB,WAAW,OAAO,OAAO;0BAwF7C,0BAA0B,kDAAgD"}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { i as Result, y as Yieldable } from "./result.types-Bd8a43Fg.mjs";
|
|
2
|
-
import { a as Option } from "./option.types-eqVODMIy.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/either/either.types.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A discriminated union representing a choice between two alternatives.
|
|
8
|
-
* By convention: Right = correct/preferred, Left = alternative.
|
|
9
|
-
*
|
|
10
|
-
* Unlike Result, neither side has inherent error semantics. Use Either when
|
|
11
|
-
* both outcomes are valid alternatives (e.g., cached vs fresh data).
|
|
12
|
-
*
|
|
13
|
-
* Use Result when modeling success/failure with error semantics.
|
|
14
|
-
*
|
|
15
|
-
* Implements Yieldable protocol for use in Do computations with yield*.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* // Either: Valid alternatives
|
|
20
|
-
* type DataSource = Either<CachedData, FreshData>
|
|
21
|
-
*
|
|
22
|
-
* // Result: Success/failure
|
|
23
|
-
* type ApiResult = Result<User, ApiError>
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
type Either$1<L, R> = Yieldable<R, L> & ({
|
|
27
|
-
readonly right: true;
|
|
28
|
-
readonly value: R;
|
|
29
|
-
} | {
|
|
30
|
-
readonly right: false;
|
|
31
|
-
readonly value: L;
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
* Extract the left type from an Either
|
|
35
|
-
*/
|
|
36
|
-
type LeftValue<E> = E extends {
|
|
37
|
-
readonly right: false;
|
|
38
|
-
readonly value: infer L;
|
|
39
|
-
} ? L : never;
|
|
40
|
-
/**
|
|
41
|
-
* Extract the right type from an Either
|
|
42
|
-
*/
|
|
43
|
-
type RightValue<E> = E extends {
|
|
44
|
-
readonly right: true;
|
|
45
|
-
readonly value: infer R;
|
|
46
|
-
} ? R : never;
|
|
47
|
-
/**
|
|
48
|
-
* Return type for all() with array input - preserves tuple structure
|
|
49
|
-
*/
|
|
50
|
-
type AllArrayReturn<T extends readonly Either$1<unknown, unknown>[]> = Either$1<LeftValue<T[number]>, { -readonly [K in keyof T]: RightValue<T[K]> }>;
|
|
51
|
-
/**
|
|
52
|
-
* Return type for all() with object input - preserves object structure
|
|
53
|
-
*/
|
|
54
|
-
type AllObjectReturn<T extends Record<string, Either$1<unknown, unknown>>> = Either$1<LeftValue<T[keyof T]>, { -readonly [K in keyof T]: RightValue<T[K]> }>;
|
|
55
|
-
/**
|
|
56
|
-
* Type-safe interface for map() with async detection
|
|
57
|
-
* Async overload must come first for proper type inference
|
|
58
|
-
*/
|
|
59
|
-
type EitherMap = {
|
|
60
|
-
<A, B>(fn: (value: A) => Promise<B>): <L>(either: Either$1<L, A>) => Promise<Either$1<L, B>>;
|
|
61
|
-
<A, B>(fn: (value: A) => B): <L>(either: Either$1<L, A>) => Either$1<L, B>;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Type-safe interface for mapLeft() with async detection
|
|
65
|
-
*/
|
|
66
|
-
type EitherMapLeft = {
|
|
67
|
-
<L1, L2$1>(fn: (value: L1) => Promise<L2$1>): <R>(either: Either$1<L1, R>) => Promise<Either$1<L2$1, R>>;
|
|
68
|
-
<L1, L2$1>(fn: (value: L1) => L2$1): <R>(either: Either$1<L1, R>) => Either$1<L2$1, R>;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Type-safe interface for bimap() with async detection
|
|
72
|
-
*/
|
|
73
|
-
type EitherBimap = {
|
|
74
|
-
<L1, L2$1, R1, R2$1>(fnLeft: (left: L1) => Promise<L2$1>, fnRight: (right: R1) => Promise<R2$1>): (either: Either$1<L1, R1>) => Promise<Either$1<L2$1, R2$1>>;
|
|
75
|
-
<L1, L2$1, R1, R2$1>(fnLeft: (left: L1) => Promise<L2$1>, fnRight: (right: R1) => R2$1): (either: Either$1<L1, R1>) => Promise<Either$1<L2$1, R2$1>>;
|
|
76
|
-
<L1, L2$1, R1, R2$1>(fnLeft: (left: L1) => L2$1, fnRight: (right: R1) => Promise<R2$1>): (either: Either$1<L1, R1>) => Promise<Either$1<L2$1, R2$1>>;
|
|
77
|
-
<L1, L2$1, R1, R2$1>(fnLeft: (left: L1) => L2$1, fnRight: (right: R1) => R2$1): (either: Either$1<L1, R1>) => Either$1<L2$1, R2$1>;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Type-safe interface for flatMap() with async detection and left union
|
|
81
|
-
*/
|
|
82
|
-
type EitherFlatMap = {
|
|
83
|
-
<A, B, L2$1>(fn: (value: A) => Promise<Either$1<L2$1, B>>): <L>(either: Either$1<L, A>) => Promise<Either$1<L | L2$1, B>>;
|
|
84
|
-
<A, B, L2$1>(fn: (value: A) => Either$1<L2$1, B>): <L>(either: Either$1<L, A>) => Either$1<L | L2$1, B>;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Type-safe interface for tap() with async detection
|
|
88
|
-
*/
|
|
89
|
-
type EitherTap = {
|
|
90
|
-
<A>(fn: (value: A) => Promise<void>): <L>(either: Either$1<L, A>) => Promise<Either$1<L, A>>;
|
|
91
|
-
<A>(fn: (value: A) => void): <L>(either: Either$1<L, A>) => Either$1<L, A>;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Type-safe interface for tapLeft() with async detection
|
|
95
|
-
*/
|
|
96
|
-
type EitherTapLeft = {
|
|
97
|
-
<L>(fn: (value: L) => Promise<void>): <R>(either: Either$1<L, R>) => Promise<Either$1<L, R>>;
|
|
98
|
-
<L>(fn: (value: L) => void): <R>(either: Either$1<L, R>) => Either$1<L, R>;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Type-safe interface for orElse() with async detection and right union
|
|
102
|
-
*/
|
|
103
|
-
type EitherOrElse = {
|
|
104
|
-
<L1, L2$1, R2$1>(fn: (left: L1) => Promise<Either$1<L2$1, R2$1>>): <R>(either: Either$1<L1, R>) => Promise<Either$1<L2$1, R | R2$1>>;
|
|
105
|
-
<L1, L2$1, R2$1>(fn: (left: L1) => Either$1<L2$1, R2$1>): <R>(either: Either$1<L1, R>) => Either$1<L2$1, R | R2$1>;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Type-safe interface for filter()
|
|
109
|
-
*/
|
|
110
|
-
type EitherFilter = {
|
|
111
|
-
<R, L2$1>(predicate: (value: R) => boolean, onFail: (value: R) => L2$1): <L>(either: Either$1<L, R>) => Either$1<L | L2$1, R>;
|
|
112
|
-
};
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/either/either.d.ts
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Combine multiple Eithers into a single Either.
|
|
118
|
-
* Short-circuits on the first left value.
|
|
119
|
-
*
|
|
120
|
-
* Supports both array and object inputs with full type preservation.
|
|
121
|
-
*
|
|
122
|
-
* @param eithers - Array or object of Eithers to combine
|
|
123
|
-
* @returns Either with all right values or first left
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```ts
|
|
127
|
-
* // Array form (with const assertion for tuple typing)
|
|
128
|
-
* all([right(1), right("hello")] as const)
|
|
129
|
-
* // => right([1, "hello"])
|
|
130
|
-
*
|
|
131
|
-
* all([right(1), left("error"), right(3)])
|
|
132
|
-
* // => left("error")
|
|
133
|
-
*
|
|
134
|
-
* // Object form
|
|
135
|
-
* all({ a: right(1), b: right("hello") })
|
|
136
|
-
* // => right({ a: 1, b: "hello" })
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
declare function all<const T extends readonly Either$1<unknown, unknown>[]>(eithers: T): AllArrayReturn<T>;
|
|
140
|
-
declare function all<const T extends Record<string, Either$1<unknown, unknown>>>(eithers: T): AllObjectReturn<T>;
|
|
141
|
-
/**
|
|
142
|
-
* Either namespace containing all utility functions for working with Either types.
|
|
143
|
-
*
|
|
144
|
-
* Either represents a value that can be one of two types: Left<L> or Right<R>.
|
|
145
|
-
* By convention, Right is the "success" or preferred path, while Left represents
|
|
146
|
-
* an alternative outcome (not necessarily an error, unlike Result).
|
|
147
|
-
*
|
|
148
|
-
* Use Either when both outcomes are valid and meaningful, not just success/failure.
|
|
149
|
-
* For error handling, prefer Result instead.
|
|
150
|
-
*
|
|
151
|
-
* @see {@link Result} for success/error semantics
|
|
152
|
-
* @see {@link Option} for presence/absence semantics
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* ```ts
|
|
156
|
-
* import { Either, pipe } from '@repo/std'
|
|
157
|
-
* import type { Either as EitherType } from '@repo/std'
|
|
158
|
-
*
|
|
159
|
-
* // Either for branching logic (cache vs fresh data)
|
|
160
|
-
* const fetchOrCache = (id: number): EitherType<CachedData, FreshData> =>
|
|
161
|
-
* cache.has(id) ? Either.left(cache.get(id)) : Either.right(fetch(id))
|
|
162
|
-
*
|
|
163
|
-
* const result = pipe(
|
|
164
|
-
* fetchOrCache(1),
|
|
165
|
-
* Either.map(data => data.value),
|
|
166
|
-
* Either.unwrapOr(defaultValue)
|
|
167
|
-
* )
|
|
168
|
-
*
|
|
169
|
-
* // Async example
|
|
170
|
-
* const processed = await pipe(
|
|
171
|
-
* Either.right(userId),
|
|
172
|
-
* Either.map(async id => await fetchUser(id)),
|
|
173
|
-
* Either.flatMap(async user => Either.right(await enrichUser(user)))
|
|
174
|
-
* )
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
declare const Either: {
|
|
178
|
-
readonly left: <L>(value: L) => Either$1<L, never>;
|
|
179
|
-
readonly right: <R>(value: R) => Either$1<never, R>;
|
|
180
|
-
readonly isLeft: <L, R>(either: Either$1<L, R>) => either is Extract<Either$1<L, R>, {
|
|
181
|
-
right: false;
|
|
182
|
-
}>;
|
|
183
|
-
readonly isRight: <L, R>(either: Either$1<L, R>) => either is Extract<Either$1<L, R>, {
|
|
184
|
-
right: true;
|
|
185
|
-
}>;
|
|
186
|
-
readonly map: EitherMap;
|
|
187
|
-
readonly mapLeft: EitherMapLeft;
|
|
188
|
-
readonly bimap: EitherBimap;
|
|
189
|
-
readonly flatMap: EitherFlatMap;
|
|
190
|
-
readonly tap: EitherTap;
|
|
191
|
-
readonly tapLeft: EitherTapLeft;
|
|
192
|
-
readonly orElse: EitherOrElse;
|
|
193
|
-
readonly swap: <L, R>() => (either: Either$1<L, R>) => Either$1<R, L>;
|
|
194
|
-
readonly filter: EitherFilter;
|
|
195
|
-
readonly all: typeof all;
|
|
196
|
-
readonly unwrapOr: <R>(defaultValue: R) => <L>(either: Either$1<L, R>) => R;
|
|
197
|
-
readonly unwrapOrElse: <L, R>(fn: (left: L) => R) => (either: Either$1<L, R>) => R;
|
|
198
|
-
readonly match: <L, R, U$1>(handlers: {
|
|
199
|
-
left: (value: L) => U$1;
|
|
200
|
-
right: (value: R) => U$1;
|
|
201
|
-
}) => (either: Either$1<L, R>) => U$1;
|
|
202
|
-
readonly fromResult: <R, E>(result: Result<R, E>) => Either$1<E, R>;
|
|
203
|
-
readonly toResult: <L, R>(either: Either$1<L, R>) => Result<R, L>;
|
|
204
|
-
readonly fromOption: <R, L>(option: Option<R>, onNone: () => L) => Either$1<L, R>;
|
|
205
|
-
readonly toOption: <L, R>(either: Either$1<L, R>) => Option<R>;
|
|
206
|
-
readonly fromNullable: <R, L>(value: R | null | undefined, onNull: () => L) => Either$1<L, R>;
|
|
207
|
-
readonly fromPredicate: <R, L>(value: R, predicate: (value: R) => boolean, onFail: (value: R) => L) => Either$1<L, R>;
|
|
208
|
-
};
|
|
209
|
-
//#endregion
|
|
210
|
-
export { EitherFilter as a, EitherMapLeft as c, EitherTapLeft as d, EitherBimap as i, EitherOrElse as l, all as n, EitherFlatMap as o, Either$1 as r, EitherMap as s, Either as t, EitherTap as u };
|
|
211
|
-
//# sourceMappingURL=index-BiFc2xWF.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-BiFc2xWF.d.mts","names":[],"sources":["../src/either/either.types.ts","../src/either/either.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA0BA;;;;;;;AAUA;AAKA;AA+EA;;;;;;;;AAA4E,KA9FhE,QA8FgE,CAAA,CAAA,EAAA,CAAA,CAAA,GA9FjD,SA8FiD,CA9FvC,CA8FuC,EA9FpC,CA8FoC,CAAA,GAAA,CAAA;EAAM,SAAA,KAAA,EAAA,IAAA;EAQtE,SAAA,KAAA,EArG+B,CAqG/B;CAAyC,GAAA;EAAf,SAAA,KAAA,EAAA,KAAA;EAC1B,SAAA,KAAA,EAtG8E,CAsG9E;CAAQ,CAAA;;;;AACuB,KA9F/B,SA8F+B,CAAA,CAAA,CAAA,GA9FhB,CA8FgB,SAAA;EAAb,SAAA,KAAA,EAAA,KAAA;EAFoD,SAAA,KAAA,EAAA,KAAA,EAAA;CAAM,GAAA,CAAA,GAAA,KAAA;AAaxF;;;AAC2B,KArGf,UAqGe,CAAA,CAAA,CAAA,GArGC,CAqGD,SAAA;EAAgC,SAAA,KAAA,EAAA,IAAA;EAAG,SAAA,KAAA,EAAA,KAAA,EAAA;CAAV,GAA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