functype 0.60.7 → 0.61.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.
@@ -1,6 +1,12 @@
1
1
  //#region src/cli/data.d.ts
2
2
  /**
3
- * Curated API data for CLI output, optimized for LLM consumption
3
+ * Curated API data for CLI output, optimized for LLM consumption.
4
+ *
5
+ * `interfaces` arrays are composed of (a) the GENERATED_INTERFACES floor
6
+ * derived from each type's `extends` chain in source, plus (b) optional
7
+ * hand-curated additions for capabilities declared inline (e.g. `List.map`
8
+ * lives in the interface body, not via `extends Functor`). The data-sync
9
+ * spec enforces that no source-declared interface is dropped from this list.
4
10
  */
5
11
  declare const VERSION: string;
6
12
  interface TypeData {
@@ -1 +1 @@
1
- import{a as e,i as t,n,r,t as i}from"../full-interfaces-DP0MRmk5.js";export{n as CATEGORIES,i as FULL_INTERFACES,r as INTERFACES,t as TYPES,e as VERSION};
1
+ import{a as e,i as t,n,r,t as i}from"../full-interfaces-CasVRlAv.js";export{n as CATEGORIES,i as FULL_INTERFACES,r as INTERFACES,t as TYPES,e as VERSION};
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{J as e,kt as t,yt as n}from"../src-BxyCNnFT.js";import{a as r,i,n as a,r as o,t as s}from"../full-interfaces-DP0MRmk5.js";const c=()=>{let e=n([`functype ${r} - Scala-inspired FP for TypeScript`,``]);return n(Object.entries(a)).foldLeft(e)((e,[r,a])=>{let o=e.add(r.toUpperCase());return n(a).foldLeft(o)((e,n)=>t(i[n]).fold(()=>e,t=>{let r=t.interfaces.length>0?` [${t.interfaces.join(`, `)}]`:``;return e.add(` ${n}${r}`).add(` ${t.description}`)})).add(``)}).concat(n([`Use: npx functype <Type> for details`,`Use: npx functype interfaces for interface reference`])).toArray().join(`
2
+ import{J as e,kt as t,yt as n}from"../src-Djzr1skt.js";import{a as r,i,n as a,r as o,t as s}from"../full-interfaces-CasVRlAv.js";const c=()=>{let e=n([`functype ${r} - Scala-inspired FP for TypeScript`,``]);return n(Object.entries(a)).foldLeft(e)((e,[r,a])=>{let o=e.add(r.toUpperCase());return n(a).foldLeft(o)((e,n)=>t(i[n]).fold(()=>e,t=>{let r=t.interfaces.length>0?` [${t.interfaces.join(`, `)}]`:``;return e.add(` ${n}${r}`).add(` ${t.description}`)})).add(``)}).concat(n([`Use: npx functype <Type> for details`,`Use: npx functype interfaces for interface reference`])).toArray().join(`
3
3
  `)},l=(e,r)=>{let i=r.interfaces.length>0?` [${r.interfaces.join(`, `)}]`:``,a=n([`create`,`transform`,`extract`,`check`,`other`]),o=n([`${e}<T>${i}`,``,r.description,``]);return a.foldLeft(o)((e,i)=>t(r.methods[i]).filter(e=>e.length>0).fold(()=>e,t=>{let r=e.add(i.toUpperCase());return n(t).foldLeft(r)((e,t)=>e.add(` ${t}`)).add(``)})).toArray().join(`
4
4
  `).trimEnd()},u=()=>{let e=n([`INTERFACES`,``]);return n(Object.entries(o)).foldLeft(e)((e,[t,r])=>{let i=r.extends?` extends ${r.extends}`:``,a=e.add(`${t}<A>${i}`).add(` ${r.description}`);return n(r.methods).foldLeft(a)((e,t)=>e.add(` ${t}`)).add(``)}).toArray().join(`
5
5
  `).trimEnd()},d=e=>JSON.stringify(e,null,2),f=()=>({version:r,categories:a,types:i}),p=e=>t(i[e]).map(t=>({name:e,data:t})).or(n(Object.entries(i)).find(([t])=>t.toLowerCase()===e.toLowerCase()).map(([e,t])=>({name:e,data:t}))).orUndefined(),m=()=>Object.keys(i),h=()=>o,g=e=>{let t=n(e.slice(2));return{flags:{json:t.contains(`--json`),full:t.contains(`--full`),help:t.exists(e=>e===`--help`||e===`-h`)},args:t.filter(e=>!e.startsWith(`--`)&&e!==`-h`)}},_=e=>t(s[e]).or(n(Object.entries(s)).find(([t])=>t.toLowerCase()===e.toLowerCase()).map(([,e])=>e)),v=()=>{let e=n([`FULL INTERFACE DEFINITIONS`,`=`.repeat(60),``]);return n(Object.entries(s)).foldLeft(e)((e,[t,r])=>e.concat(n([`// ${t}`,r,``,`-`.repeat(60),``]))).toArray().join(`
@@ -1,2 +1,2 @@
1
- import { a as EmptyListError, c as LeftError, d as isDoCapable, dr as Doable, f as unwrap, i as DoGenerator, l as LeftErrorType, n as Do, o as FailureError, r as DoAsync, s as FailureErrorType, t as $, u as NoneError, ur as DoResult } from "../index-DZR10yks.js";
1
+ import { a as EmptyListError, c as LeftError, d as isDoCapable, dr as DoResult, f as unwrap, fr as Doable, i as DoGenerator, l as LeftErrorType, n as Do, o as FailureError, r as DoAsync, s as FailureErrorType, t as $, u as NoneError } from "../index-BYF5RMBp.js";
2
2
  export { $, Do, DoAsync, DoGenerator, type DoResult, type Doable, EmptyListError, FailureError, FailureErrorType, LeftError, LeftErrorType, NoneError, isDoCapable, unwrap };
package/dist/do/index.js CHANGED
@@ -1 +1 @@
1
- import{F as e,I as t,L as n,M as r,N as i,P as a,R as o,j as s,z as c}from"../src-BxyCNnFT.js";export{s as $,r as Do,i as DoAsync,a as EmptyListError,e as FailureError,t as LeftError,n as NoneError,o as isDoCapable,c as unwrap};
1
+ import{F as e,I as t,L as n,M as r,N as i,P as a,R as o,j as s,z as c}from"../src-Djzr1skt.js";export{s as $,r as Do,i as DoAsync,a as EmptyListError,e as FailureError,t as LeftError,n as NoneError,o as isDoCapable,c as unwrap};
@@ -1,2 +1,2 @@
1
- import { C as isRight, S as isLeft, T as tryCatchAsync, _ as Right, b as TypeCheckLeft, g as LeftOf, h as Left, m as EitherBase, p as Either, v as RightOf, w as tryCatch, x as TypeCheckRight, y as TestEither } from "../index-DZR10yks.js";
1
+ import { C as isRight, S as isLeft, T as tryCatchAsync, _ as Right, b as TypeCheckLeft, g as LeftOf, h as Left, m as EitherBase, p as Either, v as RightOf, w as tryCatch, x as TypeCheckRight, y as TestEither } from "../index-BYF5RMBp.js";
2
2
  export { Either, EitherBase, Left, LeftOf, Right, RightOf, TestEither, TypeCheckLeft, TypeCheckRight, isLeft, isRight, tryCatch, tryCatchAsync };
@@ -1 +1 @@
1
- import{_t as e,dt as t,ft as n,gt as r,ht as i,mt as a,pt as o,ut as s,vt as c}from"../src-BxyCNnFT.js";export{s as Either,t as Left,n as Right,o as TypeCheckLeft,a as TypeCheckRight,i as isLeft,r as isRight,e as tryCatch,c as tryCatchAsync};
1
+ import{_t as e,dt as t,ft as n,gt as r,ht as i,mt as a,pt as o,ut as s,vt as c}from"../src-Djzr1skt.js";export{s as Either,t as Left,n as Right,o as TypeCheckLeft,a as TypeCheckRight,i as isLeft,r as isRight,e as tryCatch,c as tryCatchAsync};
@@ -1,4 +1,4 @@
1
- const e=`0.60.7`,t={Option:{description:`Safe nullable handling - Some<T> or None`,interfaces:[`Functor`,`Monad`,`Foldable`,`Extractable`,`Matchable`,`Serializable`,`Traversable`],methods:{create:[`Option(v)`,`Option.none()`,`Some(v)`,`None()`],transform:[`.map(f)`,`.flatMap(f)`,`.filter(p)`,`.ap(ff)`],extract:[`.fold(n, s)`,`.foldAsync(n, s)`,`.orElse(d)`,`.orThrow()`,`.expect(() => never)`,`.orNull()`,`.match({Some, None})`],check:[`.isSome`,`.isNone`,`.isDefined`,`.isEmpty`],other:[`Option.sequence(arr)`,`Option.traverse(arr, f)`]}},Either:{description:`Error handling with Left (error) or Right (success)`,interfaces:[`Functor`,`Monad`,`Foldable`,`Traversable`,`PromiseLike`],methods:{create:[`Right(v)`,`Left(e)`,`Either.right(v)`,`Either.left(e)`,`Either.void()`],transform:[`.map(f)`,`.flatMap(f)`,`.mapLeft(f)`,`.swap()`],extract:[`.fold(l, r)`,`.foldAsync(l, r)`,`.orElse(d)`,`.orThrow()`,`.expect((l) => never)`,`.match({Left, Right})`],check:[`.isRight`,`.isLeft`],other:[`Either.sequence(arr)`,`Either.traverse(arr, f)`,`Either.fromNullable(v, e)`]}},Try:{description:`Wrap operations that may throw - Success<T> or Failure`,interfaces:[`Functor`,`Monad`,`Foldable`,`Extractable`,`Matchable`,`Serializable`,`Traversable`],methods:{create:[`Try(() => expr)`,`Try.success(v)`,`Try.failure(e)`,`Try.fromPromise(p)`],transform:[`.map(f)`,`.flatMap(f)`,`.recover(f)`,`.recoverWith(f)`],extract:[`.fold(f, s)`,`.foldAsync(f, s)`,`.orElse(d)`,`.orThrow()`,`.expect((e) => never)`,`.toOption()`,`.toEither()`],check:[`.isSuccess`,`.isFailure`],other:[`Try.sequence(arr)`,`Try.traverse(arr, f)`]}},List:{description:`Immutable array with functional operations`,interfaces:[`Functor`,`Monad`,`Foldable`,`Collection`,`Serializable`,`Traversable`],methods:{create:[`List([...])`,`List.of(...)`,`List.empty()`],transform:[`.map(f)`,`.flatMap(f)`,`.filter(p)`,`.take(n)`,`.takeWhile(p)`,`.takeRight(n)`,`.drop(n)`,`.dropWhile(p)`,`.concat(list)`,`.reverse()`,`.distinct()`,`.sorted()`,`.sortBy(f)`,`.zip(list)`,`.zipWithIndex()`,`.prepend(v)`,`.slice(s, e)`],extract:[`.fold(z, f)`,`.reduce(f)`,`.head`,`.headOption`,`.tail`,`.last`,`.lastOption`,`.init`,`.indexOf(v)`,`.toArray()`],check:[`.isEmpty`,`.nonEmpty`,`.size`,`.contains(v)`],other:[`.groupBy(f)`,`.partition(p)`,`.span(p)`]}},Set:{description:`Immutable set of unique values`,interfaces:[`Functor`,`Foldable`,`Collection`,`Serializable`,`Traversable`],methods:{create:[`Set([...])`,`Set.of(...)`,`Set.empty()`],transform:[`.map(f)`,`.filter(p)`,`.union(s)`,`.intersection(s)`,`.difference(s)`,`.add(v)`],extract:[`.fold(z, f)`,`.toArray()`],check:[`.has(v)`,`.isEmpty`,`.size`]}},Obj:{description:`Immutable object wrapper with fluent operations`,interfaces:[`KVTraversable`,`Foldable`,`Matchable`,`Extractable`,`Serializable`,`Reshapeable`,`Doable`],methods:{create:[`Obj({...})`,`Obj.of({...})`,`Obj.empty()`],transform:[`.set(k, v)`,`.assign(partial)`,`.merge(obj)`,`.when(cond, partial)`,`.omit(...keys)`,`.pick(...keys)`,`.map(f)`,`.flatMap(f)`],extract:[`.get(k)`,`.value()`,`.keys()`,`.values()`,`.entries()`,`.fold(n, s)`,`.match({Obj})`],check:[`.has(k)`,`.isEmpty`,`.size`]}},Map:{description:`Immutable key-value store`,interfaces:[`KVTraversable`,`Collection`,`Serializable`],methods:{create:[`Map([[k, v], ...])`,`Map.of([k, v], ...)`,`Map.empty()`],transform:[`.set(k, v)`,`.delete(k)`,`.map(f)`,`.filter(p)`,`.add(k, v)`],extract:[`.get(k)`,`.keys()`,`.values()`,`.entries()`,`.fold(z, f)`],check:[`.has(k)`,`.isEmpty`,`.size`]}},Lazy:{description:`Deferred computation with memoization`,interfaces:[`Functor`,`Monad`,`Foldable`,`Extractable`,`Serializable`,`Traversable`],methods:{create:[`Lazy(() => expr)`],transform:[`.map(f)`,`.flatMap(f)`],extract:[`.fold(n, s)`,`.orElse(d)`,`.orThrow()`,`.get()`],check:[`.isEvaluated`]}},LazyList:{description:`Lazy sequences for large/infinite data`,interfaces:[`Functor`,`Monad`,`Iterable`],methods:{create:[`LazyList.from(iter)`,`LazyList.range(start, end)`,`LazyList.infinite(f)`],transform:[`.map(f)`,`.filter(p)`,`.take(n)`,`.takeRight(n)`,`.drop(n)`,`.takeWhile(p)`,`.dropWhile(p)`,`.concat(ll)`,`.reverse()`,`.distinct()`,`.zip(ll)`,`.zipWithIndex()`],extract:[`.head`,`.headOption`,`.tail`,`.last`,`.lastOption`,`.init`,`.toArray()`],check:[`.isEmpty`]}},Task:{description:`Async operations with cancellation and progress tracking. Returns TaskOutcome<T> (Ok/Err) which implements Functor, AsyncMonad, Foldable, Extractable, Serializable`,interfaces:[],methods:{create:[`Task(params).Async(fn, errFn)`,`Task(params).Sync(fn, errFn)`,`Task.ok(value)`,`Task.err(error)`,`Task.fromEither(either)`,`Task.fromTry(try)`,`Task.fromPromise(fn)`,`Task.fromNodeCallback(fn)`],transform:[`.map(f)`,`.flatMap(f)`,`.mapError(f)`,`.recover(v)`,`.recoverWith(f)`],extract:[`.fold(onErr, onOk)`,`.match({Ok, Err})`,`.orElse(v)`,`.orThrow()`,`.toEither()`,`.toOption()`],other:[`Task.cancellable(fn)`,`Task.withProgress(fn, onProgress)`,`Task.race(tasks, timeout?)`,`Task.getErrorChain(error)`,`Task.formatErrorChain(error)`]}},IO:{description:`Lazy effect type with typed errors and dependency injection`,interfaces:[`Functor`,`Monad`,`Foldable`,`Matchable`],methods:{create:[`IO(() => v)`,`IO.succeed(v)`,`IO.fail(e)`,`IO.sync(f)`,`IO.async(f)`,`IO.tryPromise({try, catch})`,`IO.fromEither(e)`,`IO.fromOption(o)`,`IO.fromTry(t)`],transform:[`.map(f)`,`.flatMap(f)`,`.tap(f)`,`.mapError(f)`,`.recover(v)`,`.recoverWith(f)`],extract:[`.run()`,`.runOrThrow()`,`.runSync()`,`.runSyncOrThrow()`,`.runExit()`,`.runOption()`,`.runTry()`,`.fold(onErr, onOk)`,`.match({failure, success})`],check:[],other:[`.catchTag(tag, f)`,`.catchAll(f)`,`.retry(n)`,`.retryWithDelay(n, ms)`,`.timeout(ms)`,`.delay(ms)`,`.zip(io)`,`.pipe(f)`,`IO.all([...])`,`IO.race([...])`,`IO.bracket(acquire, use, release)`,`IO.gen(function*() {...})`,`IO.Do.bind().map()`,`IO.service(Tag)`,`.provideService(Tag, impl)`,`.provideLayer(layer)`]}},Cond:{description:`Conditional expression builder - replace if-else chains`,interfaces:[],methods:{create:[`Cond<T>()`],other:[`.case(pred, result)`,`.otherwise(result)`,`.eval()`]}},Match:{description:`Pattern matching - replace switch statements`,interfaces:[],methods:{create:[`Match(value)`],other:[`.case(pattern, result)`,`.when(pred, result)`,`.default(result)`,`.done()`]}},Brand:{description:`Nominal typing without runtime overhead`,interfaces:[],methods:{create:[`Brand<K, T>(value)`],extract:[`.unwrap()`,`.toString()`]}},ValidatedBrand:{description:`Branded types with runtime validation`,interfaces:[],methods:{create:[`ValidatedBrand(validator)`,`.of(v)`,`.from(v)`,`.unsafeOf(v)`],check:[`.is(v)`],other:[`.refine(validator)`]}},Tuple:{description:`Fixed-size typed array`,interfaces:[`Typeable`,`Valuable`,`Iterable`],methods:{create:[`Tuple([a, b, ...])`,`Tuple.of(a, b, ...)`],extract:[`.first`,`.second`,`.toArray()`],transform:[`.map(f)`]}},Stack:{description:`Immutable LIFO stack`,interfaces:[`Foldable`,`Collection`,`Serializable`,`Traversable`],methods:{create:[`Stack()`,`Stack.of(...)`],transform:[`.push(v)`,`.pop()`],extract:[`.peek()`,`.toArray()`],check:[`.isEmpty`,`.size`]}},Http:{description:`HTTP fetch wrapper returning IO<never, HttpError, HttpResponse<unknown>> by default. Provide a validate function to get typed responses (BYOV: bring your own validator). Works with Zod, TypeBox, Valibot, or manual validators.`,interfaces:[],methods:{create:[`Http.get(url, { validate }?)`,`Http.post(url, { body, validate }?)`,`Http.put(url, { body, validate }?)`,`Http.patch(url, { body, validate }?)`,`Http.delete(url, { validate }?)`,`Http.request({ url, validate })`,`Http.client(config)`],transform:[`.map(f)`,`.flatMap(f)`,`.retry(n)`,`.retryWithDelay(n, ms)`,`.timeout(ms)`],extract:[`.run()`,`.runOrThrow()`,`.runOption()`,`.runTry()`],check:[],other:[`.catchTag(tag, handler)`,`.catchAll(handler)`,`.mapError(f)`,`.recover(fallback)`]}},HttpError:{description:`Three-variant ADT for HTTP failures: NetworkError | HttpStatusError | DecodeError`,interfaces:[],methods:{create:[`HttpError.networkError(url, method, cause)`,`HttpError.httpStatusError(url, method, status, statusText, body)`,`HttpError.decodeError(url, method, body, cause)`],check:[`HttpError.isNetworkError(e)`,`HttpError.isHttpStatusError(e)`,`HttpError.isDecodeError(e)`],other:[`HttpError.match(error, { NetworkError, HttpStatusError, DecodeError })`]}}},n={Functor:{description:`Transform contained values`,methods:[`.map<B>(f: A => B): Functor<B>`]},Applicative:{extends:`Functor`,description:`Apply wrapped functions`,methods:[`.ap<B>(ff: Applicative<A => B>): Applicative<B>`]},Monad:{extends:`Applicative`,description:`Chain operations returning wrapped values`,methods:[`.flatMap<B>(f: A => Monad<B>): Monad<B>`]},Foldable:{description:`Extract via pattern matching`,methods:[`.fold<B>(empty: () => B, f: A => B): B`,`.foldLeft<B>(z: B, op: (B, A) => B): B`,`.foldRight<B>(z: B, op: (A, B) => B): B`]},Extractable:{description:`Get contained value with fallback`,methods:[`.orElse(d: T): T`,`.orThrow(e?: Error): T`,`.expect(handler: (e?) => never): T`,`.orNull(): T | null`,`.orUndefined(): T | undefined`]},Matchable:{description:`Pattern match on type variants`,methods:[`.match<R>(patterns: Record<Tag, Handler>): R`]},Traversable:{description:`Iterate and check contents`,methods:[`.size: number`,`.isEmpty: boolean`,`.contains(v: A): boolean`,`.reduce<B>(f, init): B`]},Collection:{description:`Collection operations`,methods:[`.toArray(): A[]`,`.forEach(f: A => void): void`]},Serializable:{description:`Convert to string formats`,methods:[`.serialize().toJSON(): string`,`.serialize().toYAML(): string`]}},r={Core:[`Option`,`Either`,`Try`,`Obj`],Collection:[`List`,`Set`,`Map`,`LazyList`,`Tuple`,`Stack`],Effect:[`IO`,`Task`,`Http`,`HttpError`],Utility:[`Lazy`,`Cond`,`Match`,`Brand`,`ValidatedBrand`]},i={Option:`export interface Option<out T extends Type>
1
+ var e=`0.61.0`;const t={Option:[`Applicative`,`AsyncMonad`,`Doable`,`Extractable`,`Foldable`,`Functor`,`Matchable`,`Monad`,`Promisable`,`Reshapeable`,`Serializable`,`Traversable`],Either:[`Applicative`,`AsyncMonad`,`Doable`,`Extractable`,`Foldable`,`Functor`,`Monad`,`Promisable`,`Reshapeable`,`Serializable`],Try:[`Applicative`,`AsyncMonad`,`Doable`,`Extractable`,`Foldable`,`Functor`,`Monad`,`Promisable`,`Reshapeable`,`Serializable`],List:[`Collection`,`Doable`,`Iterable`,`Reshapeable`],Set:[`Collection`,`Iterable`],Map:[`Collection`,`Foldable`,`Iterable`,`KVTraversable`,`Serializable`],Obj:[`Doable`,`Promisable`,`Reshapeable`],Lazy:[`Applicative`,`AsyncMonad`,`Extractable`,`Foldable`,`Functor`,`Monad`,`Serializable`,`Traversable`],LazyList:[`Foldable`,`Serializable`],Tuple:[`Foldable`,`Serializable`],Task:[`Applicative`,`AsyncMonad`,`Doable`,`Extractable`,`Foldable`,`Functor`,`Monad`,`Promisable`,`Serializable`,`Traversable`]},n=e,r=(e,...n)=>Array.from(new Set([...t[e],...n])).sort(),i={Option:{description:`Safe nullable handling - Some<T> or None`,interfaces:r(`Option`),methods:{create:[`Option(v)`,`Option.none()`,`Some(v)`,`None()`],transform:[`.map(f)`,`.flatMap(f)`,`.filter(p)`,`.ap(ff)`],extract:[`.fold(n, s)`,`.foldAsync(n, s)`,`.orElse(d)`,`.orThrow()`,`.expect(() => never)`,`.orNull()`,`.match({Some, None})`],check:[`.isSome`,`.isNone`,`.isDefined`,`.isEmpty`],other:[`Option.sequence(arr)`,`Option.traverse(arr, f)`]}},Either:{description:`Error handling with Left (error) or Right (success)`,interfaces:r(`Either`,`Traversable`),methods:{create:[`Right(v)`,`Left(e)`,`Either.right(v)`,`Either.left(e)`,`Either.void()`],transform:[`.map(f)`,`.flatMap(f)`,`.mapLeft(f)`,`.swap()`],extract:[`.fold(l, r)`,`.foldAsync(l, r)`,`.orElse(d)`,`.orThrow()`,`.expect((l) => never)`,`.match({Left, Right})`],check:[`.isRight`,`.isLeft`],other:[`Either.sequence(arr)`,`Either.traverse(arr, f)`,`Either.fromNullable(v, e)`]}},Try:{description:`Wrap operations that may throw - Success<T> or Failure`,interfaces:r(`Try`,`Matchable`,`Traversable`),methods:{create:[`Try(() => expr)`,`Try.success(v)`,`Try.failure(e)`,`Try.fromPromise(p)`],transform:[`.map(f)`,`.flatMap(f)`,`.recover(f)`,`.recoverWith(f)`],extract:[`.fold(f, s)`,`.foldAsync(f, s)`,`.orElse(d)`,`.orThrow()`,`.expect((e) => never)`,`.toOption()`,`.toEither()`],check:[`.isSuccess`,`.isFailure`],other:[`Try.sequence(arr)`,`Try.traverse(arr, f)`]}},List:{description:`Immutable array with functional operations`,interfaces:r(`List`,`Functor`,`Monad`,`Foldable`,`Serializable`,`Traversable`),methods:{create:[`List([...])`,`List.of(...)`,`List.empty()`],transform:[`.map(f)`,`.flatMap(f)`,`.filter(p)`,`.take(n)`,`.takeWhile(p)`,`.takeRight(n)`,`.drop(n)`,`.dropWhile(p)`,`.concat(list)`,`.reverse()`,`.distinct()`,`.sorted()`,`.sortBy(f)`,`.zip(list)`,`.zipWithIndex()`,`.prepend(v)`,`.slice(s, e)`],extract:[`.fold(z, f)`,`.reduce(f)`,`.head`,`.headOption`,`.tail`,`.last`,`.lastOption`,`.init`,`.indexOf(v)`,`.toArray()`],check:[`.isEmpty`,`.nonEmpty`,`.size`,`.contains(v)`],other:[`.groupBy(f)`,`.partition(p)`,`.span(p)`]}},Set:{description:`Immutable set of unique values`,interfaces:r(`Set`,`Functor`,`Foldable`,`Serializable`,`Traversable`),methods:{create:[`Set([...])`,`Set.of(...)`,`Set.empty()`],transform:[`.map(f)`,`.filter(p)`,`.union(s)`,`.intersection(s)`,`.difference(s)`,`.add(v)`],extract:[`.fold(z, f)`,`.toArray()`],check:[`.has(v)`,`.isEmpty`,`.size`]}},Obj:{description:`Immutable object wrapper with fluent operations`,interfaces:r(`Obj`,`KVTraversable`,`Foldable`,`Matchable`,`Extractable`,`Serializable`),methods:{create:[`Obj({...})`,`Obj.of({...})`,`Obj.empty()`],transform:[`.set(k, v)`,`.assign(partial)`,`.merge(obj)`,`.when(cond, partial)`,`.omit(...keys)`,`.pick(...keys)`,`.map(f)`,`.flatMap(f)`],extract:[`.get(k)`,`.value()`,`.keys()`,`.values()`,`.entries()`,`.fold(n, s)`,`.match({Obj})`],check:[`.has(k)`,`.isEmpty`,`.size`]}},Map:{description:`Immutable key-value store`,interfaces:r(`Map`),methods:{create:[`Map([[k, v], ...])`,`Map.of([k, v], ...)`,`Map.empty()`],transform:[`.set(k, v)`,`.delete(k)`,`.map(f)`,`.filter(p)`,`.add(k, v)`],extract:[`.get(k)`,`.keys()`,`.values()`,`.entries()`,`.fold(z, f)`],check:[`.has(k)`,`.isEmpty`,`.size`]}},Lazy:{description:`Deferred computation with memoization`,interfaces:r(`Lazy`),methods:{create:[`Lazy(() => expr)`],transform:[`.map(f)`,`.flatMap(f)`],extract:[`.fold(n, s)`,`.orElse(d)`,`.orThrow()`,`.get()`],check:[`.isEvaluated`]}},LazyList:{description:`Lazy sequences for large/infinite data`,interfaces:r(`LazyList`,`Functor`,`Monad`,`Iterable`),methods:{create:[`LazyList.from(iter)`,`LazyList.range(start, end)`,`LazyList.infinite(f)`],transform:[`.map(f)`,`.filter(p)`,`.take(n)`,`.takeRight(n)`,`.drop(n)`,`.takeWhile(p)`,`.dropWhile(p)`,`.concat(ll)`,`.reverse()`,`.distinct()`,`.zip(ll)`,`.zipWithIndex()`],extract:[`.head`,`.headOption`,`.tail`,`.last`,`.lastOption`,`.init`,`.toArray()`],check:[`.isEmpty`]}},Task:{description:`Async operations with cancellation and progress tracking. Returns TaskOutcome<T> (Ok/Err) which implements Functor, AsyncMonad, Foldable, Extractable, Serializable`,interfaces:r(`Task`),methods:{create:[`Task(params).Async(fn, errFn)`,`Task(params).Sync(fn, errFn)`,`Task.ok(value)`,`Task.err(error)`,`Task.fromEither(either)`,`Task.fromTry(try)`,`Task.fromPromise(fn)`,`Task.fromNodeCallback(fn)`],transform:[`.map(f)`,`.flatMap(f)`,`.mapError(f)`,`.recover(v)`,`.recoverWith(f)`],extract:[`.fold(onErr, onOk)`,`.match({Ok, Err})`,`.orElse(v)`,`.orThrow()`,`.toEither()`,`.toOption()`],other:[`Task.cancellable(fn)`,`Task.withProgress(fn, onProgress)`,`Task.race(tasks, timeout?)`,`Task.getErrorChain(error)`,`Task.formatErrorChain(error)`]}},IO:{description:`Lazy effect type with typed errors and dependency injection`,interfaces:[`Functor`,`Monad`,`Foldable`,`Matchable`],methods:{create:[`IO(() => v)`,`IO.succeed(v)`,`IO.fail(e)`,`IO.sync(f)`,`IO.async(f)`,`IO.tryPromise({try, catch})`,`IO.fromEither(e)`,`IO.fromOption(o)`,`IO.fromTry(t)`],transform:[`.map(f)`,`.flatMap(f)`,`.tap(f)`,`.mapError(f)`,`.recover(v)`,`.recoverWith(f)`],extract:[`.run()`,`.runOrThrow()`,`.runSync()`,`.runSyncOrThrow()`,`.runExit()`,`.runOption()`,`.runTry()`,`.fold(onErr, onOk)`,`.match({failure, success})`],check:[],other:[`.catchTag(tag, f)`,`.catchAll(f)`,`.retry(n)`,`.retryWithDelay(n, ms)`,`.timeout(ms)`,`.delay(ms)`,`.zip(io)`,`.pipe(f)`,`IO.all([...])`,`IO.race([...])`,`IO.bracket(acquire, use, release)`,`IO.gen(function*() {...})`,`IO.Do.bind().map()`,`IO.service(Tag)`,`.provideService(Tag, impl)`,`.provideLayer(layer)`]}},Cond:{description:`Conditional expression builder - replace if-else chains`,interfaces:[],methods:{create:[`Cond<T>()`],other:[`.case(pred, result)`,`.otherwise(result)`,`.eval()`]}},Match:{description:`Pattern matching - replace switch statements`,interfaces:[],methods:{create:[`Match(value)`],other:[`.case(pattern, result)`,`.when(pred, result)`,`.default(result)`,`.done()`]}},Brand:{description:`Nominal typing without runtime overhead`,interfaces:[],methods:{create:[`Brand<K, T>(value)`],extract:[`.unwrap()`,`.toString()`]}},ValidatedBrand:{description:`Branded types with runtime validation`,interfaces:[],methods:{create:[`ValidatedBrand(validator)`,`.of(v)`,`.from(v)`,`.unsafeOf(v)`],check:[`.is(v)`],other:[`.refine(validator)`]}},Tuple:{description:`Fixed-size typed array`,interfaces:r(`Tuple`,`Typeable`,`Valuable`,`Iterable`),methods:{create:[`Tuple([a, b, ...])`,`Tuple.of(a, b, ...)`],extract:[`.first`,`.second`,`.toArray()`],transform:[`.map(f)`]}},Stack:{description:`Immutable LIFO stack`,interfaces:[`Foldable`,`Collection`,`Serializable`,`Traversable`],methods:{create:[`Stack()`,`Stack.of(...)`],transform:[`.push(v)`,`.pop()`],extract:[`.peek()`,`.toArray()`],check:[`.isEmpty`,`.size`]}},Http:{description:`HTTP fetch wrapper returning IO<never, HttpError, HttpResponse<unknown>> by default. Provide a validate function to get typed responses (BYOV: bring your own validator). Works with Zod, TypeBox, Valibot, or manual validators. The returned IO supports the full IO chain (.tap, .map, .flatMap, .catchTag, .mapError, .retry, .timeout). Http.client config accepts a beforeRequest hook — an effectful (IO-returning) transformer that closes the symmetry with the response chain so request-side concerns (auth refresh, request IDs, entry logging) compose via IO operators rather than fetch-wrapper substitution.`,interfaces:[],methods:{create:[`Http.get(url, { validate }?)`,`Http.post(url, { body, validate }?)`,`Http.put(url, { body, validate }?)`,`Http.patch(url, { body, validate }?)`,`Http.delete(url, { validate }?)`,`Http.request({ url, validate })`,`Http.client({ baseUrl, defaultHeaders, fetch, beforeRequest })`],transform:[`.tap(f)`,`.map(f)`,`.flatMap(f)`,`.mapError(f)`,`.retry(n)`,`.retryWithDelay(n, ms)`,`.timeout(ms)`],extract:[`.run()`,`.runOrThrow()`,`.runOption()`,`.runTry()`,`.runExit()`],check:[],other:[`.catchTag(tag, handler)`,`.catchAll(handler)`,`.recover(fallback)`,`beforeRequest: (req) => IO<never, HttpError, HttpRequestView>`]}},HttpError:{description:`Three-variant ADT for HTTP failures: NetworkError | HttpStatusError | DecodeError`,interfaces:[],methods:{create:[`HttpError.networkError(url, method, cause)`,`HttpError.httpStatusError(url, method, status, statusText, body)`,`HttpError.decodeError(url, method, body, cause)`],check:[`HttpError.isNetworkError(e)`,`HttpError.isHttpStatusError(e)`,`HttpError.isDecodeError(e)`],other:[`HttpError.match(error, { NetworkError, HttpStatusError, DecodeError })`]}}},a={Functor:{description:`Transform contained values`,methods:[`.map<B>(f: A => B): Functor<B>`]},Applicative:{extends:`Functor`,description:`Apply wrapped functions`,methods:[`.ap<B>(ff: Applicative<A => B>): Applicative<B>`]},Monad:{extends:`Applicative`,description:`Chain operations returning wrapped values`,methods:[`.flatMap<B>(f: A => Monad<B>): Monad<B>`]},Foldable:{description:`Extract via pattern matching`,methods:[`.fold<B>(empty: () => B, f: A => B): B`,`.foldLeft<B>(z: B, op: (B, A) => B): B`,`.foldRight<B>(z: B, op: (A, B) => B): B`]},Extractable:{description:`Get contained value with fallback`,methods:[`.orElse(d: T): T`,`.orThrow(e?: Error): T`,`.expect(handler: (e?) => never): T`,`.orNull(): T | null`,`.orUndefined(): T | undefined`]},Matchable:{description:`Pattern match on type variants`,methods:[`.match<R>(patterns: Record<Tag, Handler>): R`]},Traversable:{description:`Iterate and check contents`,methods:[`.size: number`,`.isEmpty: boolean`,`.contains(v: A): boolean`,`.reduce<B>(f, init): B`]},Collection:{description:`Collection operations`,methods:[`.toArray(): A[]`,`.forEach(f: A => void): void`]},Serializable:{description:`Convert to string formats`,methods:[`.serialize().toJSON(): string`,`.serialize().toYAML(): string`]}},o={Core:[`Option`,`Either`,`Try`,`Obj`],Collection:[`List`,`Set`,`Map`,`LazyList`,`Tuple`,`Stack`],Effect:[`IO`,`Task`,`Http`,`HttpError`],Utility:[`Lazy`,`Cond`,`Match`,`Brand`,`ValidatedBrand`]},s={Option:`export interface Option<out T extends Type>
2
2
  extends Functype<T, "Some" | "None">, Promisable<T>, Doable<T>, Reshapeable<T> {
3
3
  /** The contained value (undefined for None) */
4
4
  readonly value: T | undefined
@@ -800,4 +800,44 @@ const networkError = (url: string, method: HttpMethod, cause: unknown): NetworkE
800
800
  url,
801
801
  method,
802
802
  cause,
803
- })`};export{e as a,t as i,r as n,n as r,i as t};
803
+ })`,Http:`export interface HttpClientConfig {
804
+ readonly baseUrl?: string
805
+ readonly defaultHeaders?: Record<string, string>
806
+ readonly fetch?: typeof globalThis.fetch
807
+ /**
808
+ * Effectful transformer that runs after \`defaultHeaders\` and per-call headers
809
+ * are merged, but before the request is sent. Returning a failed IO short-
810
+ * circuits the call with the produced \`HttpError\`. Compose multiple concerns
811
+ * (request IDs, auth refresh, logging) with standard IO operators — the
812
+ * request side becomes symmetric with the response chain (\`.tap\`, \`.map\`,
813
+ * \`.flatMap\`, \`.catchTag\`).
814
+ *
815
+ * @example
816
+ * \`\`\`ts
817
+ * const addRequestId = (r: HttpRequestView): HttpRequestView => ({
818
+ * ...r,
819
+ * headers: { ...r.headers, "x-request-id": crypto.randomUUID() },
820
+ * })
821
+ *
822
+ * const addBearer = (getToken: () => Promise<string>) =>
823
+ * (r: HttpRequestView): IO<never, HttpError, HttpRequestView> =>
824
+ * IO.tryPromise({
825
+ * try: () => getToken(),
826
+ * catch: (e) => HttpError.networkError(r.url, r.method, e),
827
+ * }).map((token) => ({
828
+ * ...r,
829
+ * headers: { ...r.headers, Authorization: \`Bearer \${token}\` },
830
+ * }))
831
+ *
832
+ * const api = Http.client({
833
+ * baseUrl: "https://api.example.com",
834
+ * beforeRequest: (r) =>
835
+ * IO.succeed(r)
836
+ * .map(addRequestId)
837
+ * .flatMap(addBearer(getToken))
838
+ * .tap((req) => logger.info(req.method, req.url)),
839
+ * })
840
+ * \`\`\`
841
+ */
842
+ readonly beforeRequest?: (request: HttpRequestView) => IO<never, HttpError, HttpRequestView>
843
+ }`};export{n as a,i,o as n,a as r,s as t};
@@ -2493,6 +2493,11 @@ type IOEffect<R, E, A> = {
2493
2493
  readonly acquire: IO<R, E, unknown>;
2494
2494
  readonly use: (a: unknown) => IO<R, E, A>;
2495
2495
  readonly release: (a: unknown) => IO<R, never, void>;
2496
+ } | {
2497
+ readonly _tag: "BracketExit";
2498
+ readonly acquire: IO<R, E, unknown>;
2499
+ readonly use: (a: unknown) => IO<R, E, A>;
2500
+ readonly release: (a: unknown, exit: Exit<unknown, unknown>) => IO<R, never, void>;
2496
2501
  } | {
2497
2502
  readonly _tag: "Race";
2498
2503
  readonly effects: readonly IO<R, E, A>[];
@@ -3055,6 +3060,27 @@ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknow
3055
3060
  * Alias for bracket with a more descriptive name.
3056
3061
  */
3057
3062
  acquireRelease: <R extends Type, E extends Type, A extends Type, B extends Type>(acquire: IO<R, E, A>, use: (a: A) => IO<R, E, B>, release: (a: A) => IO<R, never, void>) => IO<R, E, B>;
3063
+ /**
3064
+ * Like `bracket`, but the release callback receives the Exit of the use-step.
3065
+ * Use this when cleanup needs to branch on whether `use` succeeded or failed —
3066
+ * e.g., emit a different audit event on `Success` vs `Failure`.
3067
+ *
3068
+ * The release effect always runs (whether use succeeded, failed, or was
3069
+ * interrupted). If `acquire` itself fails, release is not called.
3070
+ *
3071
+ * @example
3072
+ * ```typescript
3073
+ * IO.bracketExit(
3074
+ * appendEvent({ event: "job_start" }),
3075
+ * () => body,
3076
+ * (_a, exit) =>
3077
+ * exit.isSuccess()
3078
+ * ? appendEvent({ event: "job_complete" })
3079
+ * : appendEvent({ event: "job_failed", error: String(exit.toValue().value) })
3080
+ * )
3081
+ * ```
3082
+ */
3083
+ bracketExit: <R extends Type, E extends Type, A extends Type, B extends Type>(acquire: IO<R, E, A>, use: (a: A) => IO<R, E, B>, release: (a: A, exit: Exit<E, B>) => IO<R, never, void>) => IO<R, E, B>;
3058
3084
  /**
3059
3085
  * Races multiple effects, returning the first to complete.
3060
3086
  * Note: Other effects are NOT cancelled (JS limitation).
@@ -3274,14 +3300,6 @@ declare const TestContext: {
3274
3300
  withClock: () => TestContext<TestClock>;
3275
3301
  };
3276
3302
  //#endregion
3277
- //#region src/fetch/HttpClient.d.ts
3278
- interface HttpClientConfig {
3279
- readonly baseUrl?: string;
3280
- readonly defaultHeaders?: Record<string, string>;
3281
- readonly fetch?: typeof globalThis.fetch;
3282
- }
3283
- declare const HttpClient: Tag<HttpClientConfig>;
3284
- //#endregion
3285
3303
  //#region src/fetch/HttpError.d.ts
3286
3304
  type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
3287
3305
  type NetworkError = {
@@ -3346,6 +3364,65 @@ interface HttpResponse<T> {
3346
3364
  readonly statusText: string;
3347
3365
  readonly headers: Headers;
3348
3366
  }
3367
+ /**
3368
+ * The assembled, pre-wire view of a request that `HttpClientConfig.beforeRequest`
3369
+ * receives and may return a transformed copy of. URL is resolved against
3370
+ * `baseUrl`; headers reflect the `defaultHeaders` + per-call merge. The
3371
+ * response-side `validate` function is intentionally not exposed here — it
3372
+ * isn't part of the wire request and applies to the response.
3373
+ */
3374
+ interface HttpRequestView {
3375
+ readonly url: string;
3376
+ readonly method: HttpMethod;
3377
+ readonly headers?: Record<string, string>;
3378
+ readonly body?: unknown;
3379
+ readonly signal?: AbortSignal;
3380
+ readonly parseAs?: ParseMode;
3381
+ }
3382
+ //#endregion
3383
+ //#region src/fetch/HttpClient.d.ts
3384
+ interface HttpClientConfig {
3385
+ readonly baseUrl?: string;
3386
+ readonly defaultHeaders?: Record<string, string>;
3387
+ readonly fetch?: typeof globalThis.fetch;
3388
+ /**
3389
+ * Effectful transformer that runs after `defaultHeaders` and per-call headers
3390
+ * are merged, but before the request is sent. Returning a failed IO short-
3391
+ * circuits the call with the produced `HttpError`. Compose multiple concerns
3392
+ * (request IDs, auth refresh, logging) with standard IO operators — the
3393
+ * request side becomes symmetric with the response chain (`.tap`, `.map`,
3394
+ * `.flatMap`, `.catchTag`).
3395
+ *
3396
+ * @example
3397
+ * ```ts
3398
+ * const addRequestId = (r: HttpRequestView): HttpRequestView => ({
3399
+ * ...r,
3400
+ * headers: { ...r.headers, "x-request-id": crypto.randomUUID() },
3401
+ * })
3402
+ *
3403
+ * const addBearer = (getToken: () => Promise<string>) =>
3404
+ * (r: HttpRequestView): IO<never, HttpError, HttpRequestView> =>
3405
+ * IO.tryPromise({
3406
+ * try: () => getToken(),
3407
+ * catch: (e) => HttpError.networkError(r.url, r.method, e),
3408
+ * }).map((token) => ({
3409
+ * ...r,
3410
+ * headers: { ...r.headers, Authorization: `Bearer ${token}` },
3411
+ * }))
3412
+ *
3413
+ * const api = Http.client({
3414
+ * baseUrl: "https://api.example.com",
3415
+ * beforeRequest: (r) =>
3416
+ * IO.succeed(r)
3417
+ * .map(addRequestId)
3418
+ * .flatMap(addBearer(getToken))
3419
+ * .tap((req) => logger.info(req.method, req.url)),
3420
+ * })
3421
+ * ```
3422
+ */
3423
+ readonly beforeRequest?: (request: HttpRequestView) => IO<never, HttpError, HttpRequestView>;
3424
+ }
3425
+ declare const HttpClient: Tag<HttpClientConfig>;
3349
3426
  //#endregion
3350
3427
  //#region src/fetch/Http.d.ts
3351
3428
  type HttpMethods = {
@@ -5259,4 +5336,4 @@ interface FailureErrorType extends Error {
5259
5336
  }
5260
5337
  declare const FailureError: (cause: Error, message?: string) => FailureErrorType;
5261
5338
  //#endregion
5262
- export { Map$1 as $, reduceWiden as $n, TypedErrorContext as $t, Collection as A, Cond as An, Task as At, SerializationResult as B, NonEmptyString as Bn, ContextServices as Bt, isRight as C, isTaggedThrowable as Cn, HttpClientConfig as Ct, Functype as D, Base as Dn, IO as Dt, FunctypeSum as E, ThrowableType as En, TestContext as Et, Some as F, BoundedNumber as Fn, LayerInput as Ft, fromJSON as G, UUID as Gn, FormValidation as Gt, createSerializationCompanion as H, PatternString as Hn, Tag as Ht, Stack as I, BoundedString as In, LayerOutput as It, Obj as J, ValidatedBrandCompanion as Jn, Validator as Jt, fromYAML as K, UrlString as Kn, Validation as Kt, Valuable as L, EmailAddress as Ln, Exit as Lt, None as M, InstanceType as Mn, UIO as Mt, Option as N, isCompanion as Nn, Layer as Nt, FunctypeBase as O, Match as On, InterruptedError as Ot, OptionConstructor as P, Companion as Pn, LayerError as Pt, ESMapType as Q, reduceRightWiden as Qn, TypedError as Qt, ValuableParams as R, ISO8601Date as Rn, ExitTag as Rt, isLeft as S, createCancellationTokenSource as Sn, HttpClient as St, tryCatchAsync as T, Throwable as Tn, TestClockTag as Tt, createSerializer as U, PositiveInteger as Un, TagService as Ut, createCustomSerializer as V, NonNegativeNumber as Vn, HasService as Vt, fromBinary as W, PositiveNumber as Wn, FieldValidation as Wt, MatchableUtils as X, TypeNames as Xn, ErrorMessage as Xt, Matchable as Y, Try as Yn, ErrorCode as Yt, ESMap as Z, Widen as Zn, ErrorStatus as Zt, Right as _, TaskMetadata as _n, DecodeError as _t, EmptyListError as a, formatError as an, CollectionOps as ar, HKT as at, TypeCheckLeft as b, TaskResult as bn, HttpStatusError as bt, LeftError as c, Async as cn, Extractable as cr, OptionKind as ct, isDoCapable as d, Err as dn, Doable as dr, FoldableUtils as dt, ErrorChainElement as en, Promisable as er, KVTraversable as et, unwrap as f, Ok as fn, ParseError as fr, Http as ft, LeftOf as g, TaskFailure as gn, ParseMode as gt, Left as h, Task$1 as hn, HttpResponse as ht, DoGenerator as i, createErrorSerializer as in, Monad as ir, EitherKind as it, List as j, CompanionMethods as jn, TimeoutError as jt, FunctypeCollection as k, UntypedMatch as kn, RIO as kt, LeftErrorType as l, CancellationToken as ln, isExtractable as lr, TryKind as lt, EitherBase as m, TaggedThrowable as mn, HttpRequestOptions as mt, Do as n, ErrorWithTaskInfo as nn, AsyncMonad as nr, Lazy as nt, FailureError as o, formatStackTrace as on, ContainerOps as or, Kind as ot, Either as p, Sync as pn, HttpMethodOptions as pt, Ref as q, ValidatedBrand as qn, ValidationRule as qt, DoAsync as r, TaskErrorInfo as rn, Functor as rr, Identity as rt, FailureErrorType as s, safeStringify as sn, LazyList as sr, ListKind as st, $ as t, ErrorFormatterOptions as tn, Applicative as tr, Traversable as tt, NoneError as u, CancellationTokenSource as un, DoResult as ur, UniversalContainer as ut, RightOf as v, TaskOutcome as vn, HttpError as vt, tryCatch as w, NAME as wn, TestClock as wt, TypeCheckRight as x, TaskSuccess as xn, NetworkError as xt, TestEither as y, TaskParams as yn, HttpMethod as yt, Set as z, IntegerNumber as zn, Context as zt };
5339
+ export { Map$1 as $, reduceRightWiden as $n, TypedError as $t, Collection as A, UntypedMatch as An, RIO as At, SerializationResult as B, IntegerNumber as Bn, Context as Bt, isRight as C, createCancellationTokenSource as Cn, HttpStatusError as Ct, Functype as D, ThrowableType as Dn, TestContext as Dt, FunctypeSum as E, Throwable as En, TestClockTag as Et, Some as F, Companion as Fn, LayerError as Ft, fromJSON as G, PositiveNumber as Gn, FieldValidation as Gt, createSerializationCompanion as H, NonNegativeNumber as Hn, HasService as Ht, Stack as I, BoundedNumber as In, LayerInput as It, Obj as J, ValidatedBrand as Jn, ValidationRule as Jt, fromYAML as K, UUID as Kn, FormValidation as Kt, Valuable as L, BoundedString as Ln, LayerOutput as Lt, None as M, CompanionMethods as Mn, TimeoutError as Mt, Option as N, InstanceType as Nn, UIO as Nt, FunctypeBase as O, Base as On, IO as Ot, OptionConstructor as P, isCompanion as Pn, Layer as Pt, ESMapType as Q, Widen as Qn, ErrorStatus as Qt, ValuableParams as R, EmailAddress as Rn, Exit as Rt, isLeft as S, TaskSuccess as Sn, HttpMethod as St, tryCatchAsync as T, NAME as Tn, TestClock as Tt, createSerializer as U, PatternString as Un, Tag as Ut, createCustomSerializer as V, NonEmptyString as Vn, ContextServices as Vt, fromBinary as W, PositiveInteger as Wn, TagService as Wt, MatchableUtils as X, Try as Xn, ErrorCode as Xt, Matchable as Y, ValidatedBrandCompanion as Yn, Validator as Yt, ESMap as Z, TypeNames as Zn, ErrorMessage as Zt, Right as _, TaskFailure as _n, HttpRequestView as _t, EmptyListError as a, createErrorSerializer as an, Monad as ar, HKT as at, TypeCheckLeft as b, TaskParams as bn, DecodeError as bt, LeftError as c, safeStringify as cn, LazyList as cr, OptionKind as ct, isDoCapable as d, CancellationTokenSource as dn, DoResult as dr, FoldableUtils as dt, TypedErrorContext as en, reduceWiden as er, KVTraversable as et, unwrap as f, Err as fn, Doable as fr, Http as ft, LeftOf as g, Task$1 as gn, HttpRequestOptions as gt, Left as h, TaggedThrowable as hn, HttpMethodOptions as ht, DoGenerator as i, TaskErrorInfo as in, Functor as ir, EitherKind as it, List as j, Cond as jn, Task as jt, FunctypeCollection as k, Match as kn, InterruptedError as kt, LeftErrorType as l, Async as ln, Extractable as lr, TryKind as lt, EitherBase as m, Sync as mn, HttpClientConfig as mt, Do as n, ErrorFormatterOptions as nn, Applicative as nr, Lazy as nt, FailureError as o, formatError as on, CollectionOps as or, Kind as ot, Either as p, Ok as pn, ParseError as pr, HttpClient as pt, Ref as q, UrlString as qn, Validation as qt, DoAsync as r, ErrorWithTaskInfo as rn, AsyncMonad as rr, Identity as rt, FailureErrorType as s, formatStackTrace as sn, ContainerOps as sr, ListKind as st, $ as t, ErrorChainElement as tn, Promisable as tr, Traversable as tt, NoneError as u, CancellationToken as un, isExtractable as ur, UniversalContainer as ut, RightOf as v, TaskMetadata as vn, HttpResponse as vt, tryCatch as w, isTaggedThrowable as wn, NetworkError as wt, TypeCheckRight as x, TaskResult as xn, HttpError as xt, TestEither as y, TaskOutcome as yn, ParseMode as yt, Set as z, ISO8601Date as zn, ExitTag as zt };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as ExtractBrand, c as hasBrand, i as BrandedString, l as unwrapBrand, n as BrandedBoolean, o as Unwrap, r as BrandedNumber, s as createBrander, t as Brand } from "./Brand-BJIRbUKB.js";
2
- import { $ as Map, $n as reduceWiden, $t as TypedErrorContext, A as Collection, An as Cond, At as Task, B as SerializationResult, Bn as NonEmptyString, Bt as ContextServices, C as isRight, Cn as isTaggedThrowable, Ct as HttpClientConfig, D as Functype, Dn as Base, Dt as IO, E as FunctypeSum, En as ThrowableType, Et as TestContext, F as Some, Fn as BoundedNumber, Ft as LayerInput, G as fromJSON, Gn as UUID, Gt as FormValidation, H as createSerializationCompanion, Hn as PatternString, Ht as Tag, I as Stack, In as BoundedString, It as LayerOutput, J as Obj, Jn as ValidatedBrandCompanion, Jt as Validator, K as fromYAML, Kn as UrlString, Kt as Validation, L as Valuable, Ln as EmailAddress, Lt as Exit, M as None, Mn as InstanceType, Mt as UIO, N as Option, Nn as isCompanion, Nt as Layer, O as FunctypeBase, On as Match, Ot as InterruptedError, P as OptionConstructor, Pn as Companion, Pt as LayerError, Q as ESMapType, Qn as reduceRightWiden, Qt as TypedError, R as ValuableParams, Rn as ISO8601Date, Rt as ExitTag, S as isLeft, Sn as createCancellationTokenSource, St as HttpClient, T as tryCatchAsync, Tn as Throwable, Tt as TestClockTag, U as createSerializer, Un as PositiveInteger, Ut as TagService, V as createCustomSerializer, Vn as NonNegativeNumber, Vt as HasService, W as fromBinary, Wn as PositiveNumber, Wt as FieldValidation, X as MatchableUtils, Xn as TypeNames, Xt as ErrorMessage, Y as Matchable, Yn as Try, Yt as ErrorCode, Z as ESMap, Zn as Widen, Zt as ErrorStatus, _ as Right, _n as TaskMetadata, _t as DecodeError, a as EmptyListError, an as formatError, ar as CollectionOps, at as HKT, b as TypeCheckLeft, bn as TaskResult, bt as HttpStatusError, c as LeftError, cn as Async, cr as Extractable, ct as OptionKind, d as isDoCapable, dn as Err, dr as Doable, dt as FoldableUtils, en as ErrorChainElement, er as Promisable, et as KVTraversable, f as unwrap, fn as Ok, fr as ParseError, ft as Http, g as LeftOf, gn as TaskFailure, gt as ParseMode, h as Left, hn as Task$1, ht as HttpResponse, i as DoGenerator, in as createErrorSerializer, ir as Monad, it as EitherKind, j as List, jn as CompanionMethods, jt as TimeoutError, k as FunctypeCollection, kn as UntypedMatch, kt as RIO, l as LeftErrorType, ln as CancellationToken, lr as isExtractable, lt as TryKind, m as EitherBase, mn as TaggedThrowable, mt as HttpRequestOptions, n as Do, nn as ErrorWithTaskInfo, nr as AsyncMonad, nt as Lazy, o as FailureError, on as formatStackTrace, or as ContainerOps, ot as Kind, p as Either, pn as Sync, pt as HttpMethodOptions, q as Ref, qn as ValidatedBrand, qt as ValidationRule, r as DoAsync, rn as TaskErrorInfo, rr as Functor, rt as Identity, s as FailureErrorType, sn as safeStringify, sr as LazyList, st as ListKind, t as $, tn as ErrorFormatterOptions, tr as Applicative, tt as Traversable, u as NoneError, un as CancellationTokenSource, ur as DoResult, ut as UniversalContainer, v as RightOf, vn as TaskOutcome, vt as HttpError, w as tryCatch, wn as NAME, wt as TestClock, x as TypeCheckRight, xn as TaskSuccess, xt as NetworkError, y as TestEither, yn as TaskParams, yt as HttpMethod, z as Set, zn as IntegerNumber, zt as Context } from "./index-DZR10yks.js";
2
+ import { $ as Map, $n as reduceRightWiden, $t as TypedError, A as Collection, An as UntypedMatch, At as RIO, B as SerializationResult, Bn as IntegerNumber, Bt as Context, C as isRight, Cn as createCancellationTokenSource, Ct as HttpStatusError, D as Functype, Dn as ThrowableType, Dt as TestContext, E as FunctypeSum, En as Throwable, Et as TestClockTag, F as Some, Fn as Companion, Ft as LayerError, G as fromJSON, Gn as PositiveNumber, Gt as FieldValidation, H as createSerializationCompanion, Hn as NonNegativeNumber, Ht as HasService, I as Stack, In as BoundedNumber, It as LayerInput, J as Obj, Jn as ValidatedBrand, Jt as ValidationRule, K as fromYAML, Kn as UUID, Kt as FormValidation, L as Valuable, Ln as BoundedString, Lt as LayerOutput, M as None, Mn as CompanionMethods, Mt as TimeoutError, N as Option, Nn as InstanceType, Nt as UIO, O as FunctypeBase, On as Base, Ot as IO, P as OptionConstructor, Pn as isCompanion, Pt as Layer, Q as ESMapType, Qn as Widen, Qt as ErrorStatus, R as ValuableParams, Rn as EmailAddress, Rt as Exit, S as isLeft, Sn as TaskSuccess, St as HttpMethod, T as tryCatchAsync, Tn as NAME, Tt as TestClock, U as createSerializer, Un as PatternString, Ut as Tag, V as createCustomSerializer, Vn as NonEmptyString, Vt as ContextServices, W as fromBinary, Wn as PositiveInteger, Wt as TagService, X as MatchableUtils, Xn as Try, Xt as ErrorCode, Y as Matchable, Yn as ValidatedBrandCompanion, Yt as Validator, Z as ESMap, Zn as TypeNames, Zt as ErrorMessage, _ as Right, _n as TaskFailure, _t as HttpRequestView, a as EmptyListError, an as createErrorSerializer, ar as Monad, at as HKT, b as TypeCheckLeft, bn as TaskParams, bt as DecodeError, c as LeftError, cn as safeStringify, cr as LazyList, ct as OptionKind, d as isDoCapable, dn as CancellationTokenSource, dr as DoResult, dt as FoldableUtils, en as TypedErrorContext, er as reduceWiden, et as KVTraversable, f as unwrap, fn as Err, fr as Doable, ft as Http, g as LeftOf, gn as Task$1, gt as HttpRequestOptions, h as Left, hn as TaggedThrowable, ht as HttpMethodOptions, i as DoGenerator, in as TaskErrorInfo, ir as Functor, it as EitherKind, j as List, jn as Cond, jt as Task, k as FunctypeCollection, kn as Match, kt as InterruptedError, l as LeftErrorType, ln as Async, lr as Extractable, lt as TryKind, m as EitherBase, mn as Sync, mt as HttpClientConfig, n as Do, nn as ErrorFormatterOptions, nr as Applicative, nt as Lazy, o as FailureError, on as formatError, or as CollectionOps, ot as Kind, p as Either, pn as Ok, pr as ParseError, pt as HttpClient, q as Ref, qn as UrlString, qt as Validation, r as DoAsync, rn as ErrorWithTaskInfo, rr as AsyncMonad, rt as Identity, s as FailureErrorType, sn as formatStackTrace, sr as ContainerOps, st as ListKind, t as $, tn as ErrorChainElement, tr as Promisable, tt as Traversable, u as NoneError, un as CancellationToken, ur as isExtractable, ut as UniversalContainer, v as RightOf, vn as TaskMetadata, vt as HttpResponse, w as tryCatch, wn as isTaggedThrowable, wt as NetworkError, x as TypeCheckRight, xn as TaskResult, xt as HttpError, y as TestEither, yn as TaskOutcome, yt as ParseMode, z as Set, zn as ISO8601Date, zt as ExitTag } from "./index-BYF5RMBp.js";
3
3
  import { a as isTypeable, c as Pipe, i as TypeableParams, l as Foldable, n as ExtractTag, o as Serializable, r as Typeable, s as SerializationMethods, t as Tuple, u as Type } from "./Tuple-De-FhPDq.js";
4
- export { $, type Applicative, Async, type AsyncMonad, Base, BoundedNumber, BoundedString, Brand, BrandedBoolean, type BrandedBoolean as BrandedBooleanType, BrandedNumber, type BrandedNumber as BrandedNumberType, BrandedString, type BrandedString as BrandedStringType, CancellationToken, CancellationTokenSource, Collection, type CollectionOps, Companion, CompanionMethods, Cond, type ContainerOps, Context, type Context as ContextType, type ContextServices, type DecodeError, Do, DoAsync, DoGenerator, type DoResult, type Doable, ESMap, ESMapType, Either, EitherBase, EitherKind, EmailAddress, EmptyListError, Err, ErrorChainElement, ErrorCode, ErrorFormatterOptions, ErrorMessage, ErrorStatus, ErrorWithTaskInfo, Exit, type Exit as ExitType, type ExitTag, type ExtractBrand, ExtractTag, type Extractable, FailureError, FailureErrorType, FieldValidation, Foldable, FoldableUtils, FormValidation, type Functor, Functype, FunctypeBase, FunctypeCollection, FunctypeSum, HKT, type HasService, Http, HttpClient, type HttpClientConfig, type HttpError, HttpError as HttpErrors, type HttpMethod, type HttpMethodOptions, type HttpRequestOptions, type HttpResponse, type HttpStatusError, IO, type IO as IOType, type Task as IOTask, ISO8601Date, Identity, InstanceType, IntegerNumber, InterruptedError, KVTraversable, Kind, Layer, type Layer as LayerType, type LayerError, type LayerInput, type LayerOutput, Lazy, type Lazy as LazyType, LazyList, Left, LeftError, LeftErrorType, LeftOf, List, ListKind, Map, Match, type Matchable, MatchableUtils, type Monad, NAME, type NetworkError, NonEmptyString, NonNegativeNumber, None, NoneError, Obj, Ok, Option, OptionConstructor, OptionKind, ParseError, type ParseMode, PatternString, Pipe, PositiveInteger, PositiveNumber, type Promisable, type RIO, Ref, type Ref as RefType, Right, RightOf, Serializable, SerializationMethods, SerializationResult, Set, Some, Stack, Sync, Tag, type Tag as TagType, type TagService, TaggedThrowable, Task$1 as Task, TaskErrorInfo, TaskFailure, TaskMetadata, TaskOutcome, TaskParams, TaskResult, TaskSuccess, TestClock, type TestClock as TestClockType, TestClockTag, TestContext, type TestContext as TestContextType, TestEither, Throwable, ThrowableType, TimeoutError, Traversable, Try, TryKind, Tuple, Type, TypeCheckLeft, TypeCheckRight, TypeNames, Typeable, TypeableParams, TypedError, TypedErrorContext, type UIO, UUID, UniversalContainer, UntypedMatch, type Unwrap, UrlString, ValidatedBrand, type ValidatedBrand as ValidatedBrandType, type ValidatedBrandCompanion, Validation, ValidationRule, Validator, Valuable, ValuableParams, type Widen, createBrander, createCancellationTokenSource, createCustomSerializer, createErrorSerializer, createSerializationCompanion, createSerializer, formatError, formatStackTrace, fromBinary, fromJSON, fromYAML, hasBrand, isCompanion, isDoCapable, isExtractable, isLeft, isRight, isTaggedThrowable, isTypeable, reduceRightWiden, reduceWiden, safeStringify, tryCatch, tryCatchAsync, unwrap, unwrapBrand };
4
+ export { $, type Applicative, Async, type AsyncMonad, Base, BoundedNumber, BoundedString, Brand, BrandedBoolean, type BrandedBoolean as BrandedBooleanType, BrandedNumber, type BrandedNumber as BrandedNumberType, BrandedString, type BrandedString as BrandedStringType, CancellationToken, CancellationTokenSource, Collection, type CollectionOps, Companion, CompanionMethods, Cond, type ContainerOps, Context, type Context as ContextType, type ContextServices, type DecodeError, Do, DoAsync, DoGenerator, type DoResult, type Doable, ESMap, ESMapType, Either, EitherBase, EitherKind, EmailAddress, EmptyListError, Err, ErrorChainElement, ErrorCode, ErrorFormatterOptions, ErrorMessage, ErrorStatus, ErrorWithTaskInfo, Exit, type Exit as ExitType, type ExitTag, type ExtractBrand, ExtractTag, type Extractable, FailureError, FailureErrorType, FieldValidation, Foldable, FoldableUtils, FormValidation, type Functor, Functype, FunctypeBase, FunctypeCollection, FunctypeSum, HKT, type HasService, Http, HttpClient, type HttpClientConfig, type HttpError, HttpError as HttpErrors, type HttpMethod, type HttpMethodOptions, type HttpRequestOptions, type HttpRequestView, type HttpResponse, type HttpStatusError, IO, type IO as IOType, type Task as IOTask, ISO8601Date, Identity, InstanceType, IntegerNumber, InterruptedError, KVTraversable, Kind, Layer, type Layer as LayerType, type LayerError, type LayerInput, type LayerOutput, Lazy, type Lazy as LazyType, LazyList, Left, LeftError, LeftErrorType, LeftOf, List, ListKind, Map, Match, type Matchable, MatchableUtils, type Monad, NAME, type NetworkError, NonEmptyString, NonNegativeNumber, None, NoneError, Obj, Ok, Option, OptionConstructor, OptionKind, ParseError, type ParseMode, PatternString, Pipe, PositiveInteger, PositiveNumber, type Promisable, type RIO, Ref, type Ref as RefType, Right, RightOf, Serializable, SerializationMethods, SerializationResult, Set, Some, Stack, Sync, Tag, type Tag as TagType, type TagService, TaggedThrowable, Task$1 as Task, TaskErrorInfo, TaskFailure, TaskMetadata, TaskOutcome, TaskParams, TaskResult, TaskSuccess, TestClock, type TestClock as TestClockType, TestClockTag, TestContext, type TestContext as TestContextType, TestEither, Throwable, ThrowableType, TimeoutError, Traversable, Try, TryKind, Tuple, Type, TypeCheckLeft, TypeCheckRight, TypeNames, Typeable, TypeableParams, TypedError, TypedErrorContext, type UIO, UUID, UniversalContainer, UntypedMatch, type Unwrap, UrlString, ValidatedBrand, type ValidatedBrand as ValidatedBrandType, type ValidatedBrandCompanion, Validation, ValidationRule, Validator, Valuable, ValuableParams, type Widen, createBrander, createCancellationTokenSource, createCustomSerializer, createErrorSerializer, createSerializationCompanion, createSerializer, formatError, formatStackTrace, fromBinary, fromJSON, fromYAML, hasBrand, isCompanion, isDoCapable, isExtractable, isLeft, isRight, isTaggedThrowable, isTypeable, reduceRightWiden, reduceWiden, safeStringify, tryCatch, tryCatchAsync, unwrap, unwrapBrand };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{Brand as e,BrandedBoolean as t,BrandedNumber as n,BrandedString as r,createBrander as i,hasBrand as a,unwrap as o}from"./branded/index.js";import{$ as s,A as c,At as l,B as u,C as d,Ct as f,D as p,Dt as m,E as h,Et as g,F as _,Ft as v,G as y,H as b,I as x,It as S,J as C,K as w,L as T,Lt as E,M as D,Mt as O,N as k,Nt as A,O as j,Ot as M,P as N,Pt as P,Q as F,R as I,Rt as L,S as R,St as z,T as B,Tt as V,U as H,V as U,W,X as G,Y as K,Z as q,_ as J,_t as Y,a as X,at as Z,b as Q,bt as $,c as ee,ct as te,d as ne,dt as re,et as ie,f as ae,ft as oe,g as se,gt as ce,h as le,ht as ue,i as de,it as fe,j as pe,jt as me,k as he,kt as ge,l as _e,lt as ve,m as ye,mt as be,n as xe,nt as Se,o as Ce,ot as we,p as Te,pt as Ee,q as De,r as Oe,rt as ke,s as Ae,st as je,t as Me,tt as Ne,u as Pe,ut as Fe,v as Ie,vt as Le,w as Re,wt as ze,x as Be,xt as Ve,y as He,yt as Ue,z as We}from"./src-BxyCNnFT.js";import{r as Ge,t as Ke}from"./Tuple-DY00RBep.js";export{pe as $,De as Base,q as BoundedNumber,F as BoundedString,e as Brand,t as BrandedBoolean,n as BrandedNumber,r as BrandedString,Ge as Companion,K as Cond,d as Context,D as Do,k as DoAsync,Ce as ESMap,Fe as Either,s as EmailAddress,N as EmptyListError,u as Err,R as Exit,_ as FailureError,Pe as FoldableUtils,_e as HKT,ne as Http,Te as HttpClient,ae as HttpErrors,He as IO,ie as ISO8601Date,ee as Identity,Ne as IntegerNumber,Q as InterruptedError,Ie as Layer,Ae as Lazy,f as LazyList,re as Left,x as LeftError,Ue as List,X as Map,C as Match,de as MatchableUtils,y as NAME,Se as NonEmptyString,ke as NonNegativeNumber,M as None,T as NoneError,Oe as Obj,U as Ok,ge as Option,l as OptionConstructor,L as ParseError,fe as PatternString,Z as PositiveInteger,we as PositiveNumber,ze as Ref,oe as Right,V as Set,me as Some,xe as Stack,J as Tag,b as Task,ye as TestClock,le as TestClockTag,se as TestContext,w as Throwable,Be as TimeoutError,z as Try,Ke as Tuple,Ee as TypeCheckLeft,be as TypeCheckRight,$ as Typeable,h as TypedError,je as UUID,te as UrlString,ve as ValidatedBrand,B as Validation,Me as Valuable,i as createBrander,H as createCancellationTokenSource,O as createCustomSerializer,p as createErrorSerializer,A as createSerializationCompanion,P as createSerializer,j as formatError,he as formatStackTrace,v as fromBinary,S as fromJSON,E as fromYAML,a as hasBrand,G as isCompanion,I as isDoCapable,Re as isExtractable,ue as isLeft,ce as isRight,W as isTaggedThrowable,Ve as isTypeable,g as reduceRightWiden,m as reduceWiden,c as safeStringify,Y as tryCatch,Le as tryCatchAsync,We as unwrap,o as unwrapBrand};
1
+ import{Brand as e,BrandedBoolean as t,BrandedNumber as n,BrandedString as r,createBrander as i,hasBrand as a,unwrap as o}from"./branded/index.js";import{$ as s,A as c,At as l,B as u,C as d,Ct as f,D as p,Dt as m,E as h,Et as g,F as _,Ft as v,G as y,H as b,I as x,It as S,J as C,K as w,L as T,Lt as E,M as D,Mt as O,N as k,Nt as A,O as j,Ot as M,P as N,Pt as P,Q as F,R as I,Rt as L,S as R,St as z,T as B,Tt as V,U as H,V as U,W,X as G,Y as K,Z as q,_ as J,_t as Y,a as X,at as Z,b as Q,bt as $,c as ee,ct as te,d as ne,dt as re,et as ie,f as ae,ft as oe,g as se,gt as ce,h as le,ht as ue,i as de,it as fe,j as pe,jt as me,k as he,kt as ge,l as _e,lt as ve,m as ye,mt as be,n as xe,nt as Se,o as Ce,ot as we,p as Te,pt as Ee,q as De,r as Oe,rt as ke,s as Ae,st as je,t as Me,tt as Ne,u as Pe,ut as Fe,v as Ie,vt as Le,w as Re,wt as ze,x as Be,xt as Ve,y as He,yt as Ue,z as We}from"./src-Djzr1skt.js";import{r as Ge,t as Ke}from"./Tuple-DY00RBep.js";export{pe as $,De as Base,q as BoundedNumber,F as BoundedString,e as Brand,t as BrandedBoolean,n as BrandedNumber,r as BrandedString,Ge as Companion,K as Cond,d as Context,D as Do,k as DoAsync,Ce as ESMap,Fe as Either,s as EmailAddress,N as EmptyListError,u as Err,R as Exit,_ as FailureError,Pe as FoldableUtils,_e as HKT,ne as Http,Te as HttpClient,ae as HttpErrors,He as IO,ie as ISO8601Date,ee as Identity,Ne as IntegerNumber,Q as InterruptedError,Ie as Layer,Ae as Lazy,f as LazyList,re as Left,x as LeftError,Ue as List,X as Map,C as Match,de as MatchableUtils,y as NAME,Se as NonEmptyString,ke as NonNegativeNumber,M as None,T as NoneError,Oe as Obj,U as Ok,ge as Option,l as OptionConstructor,L as ParseError,fe as PatternString,Z as PositiveInteger,we as PositiveNumber,ze as Ref,oe as Right,V as Set,me as Some,xe as Stack,J as Tag,b as Task,ye as TestClock,le as TestClockTag,se as TestContext,w as Throwable,Be as TimeoutError,z as Try,Ke as Tuple,Ee as TypeCheckLeft,be as TypeCheckRight,$ as Typeable,h as TypedError,je as UUID,te as UrlString,ve as ValidatedBrand,B as Validation,Me as Valuable,i as createBrander,H as createCancellationTokenSource,O as createCustomSerializer,p as createErrorSerializer,A as createSerializationCompanion,P as createSerializer,j as formatError,he as formatStackTrace,v as fromBinary,S as fromJSON,E as fromYAML,a as hasBrand,G as isCompanion,I as isDoCapable,Re as isExtractable,ue as isLeft,ce as isRight,W as isTaggedThrowable,Ve as isTypeable,g as reduceRightWiden,m as reduceWiden,c as safeStringify,Y as tryCatch,Le as tryCatchAsync,We as unwrap,o as unwrapBrand};
@@ -1,2 +1,2 @@
1
- import { j as List } from "../index-DZR10yks.js";
1
+ import { j as List } from "../index-BYF5RMBp.js";
2
2
  export { List };
@@ -1 +1 @@
1
- import{yt as e}from"../src-BxyCNnFT.js";export{e as List};
1
+ import{yt as e}from"../src-Djzr1skt.js";export{e as List};
@@ -1,2 +1,2 @@
1
- import { $ as Map } from "../index-DZR10yks.js";
1
+ import { $ as Map } from "../index-BYF5RMBp.js";
2
2
  export { Map };
package/dist/map/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e}from"../src-BxyCNnFT.js";export{e as Map};
1
+ import{a as e}from"../src-Djzr1skt.js";export{e as Map};
@@ -1,2 +1,2 @@
1
- import { F as Some, M as None, N as Option, P as OptionConstructor } from "../index-DZR10yks.js";
1
+ import { F as Some, M as None, N as Option, P as OptionConstructor } from "../index-BYF5RMBp.js";
2
2
  export { None, Option, OptionConstructor, Some };
@@ -1 +1 @@
1
- import{At as e,Ot as t,jt as n,kt as r}from"../src-BxyCNnFT.js";export{t as None,r as Option,e as OptionConstructor,n as Some};
1
+ import{At as e,Ot as t,jt as n,kt as r}from"../src-Djzr1skt.js";export{t as None,r as Option,e as OptionConstructor,n as Some};
@@ -1,2 +1,2 @@
1
- import { z as Set } from "../index-DZR10yks.js";
1
+ import { z as Set } from "../index-BYF5RMBp.js";
2
2
  export { Set };
package/dist/set/index.js CHANGED
@@ -1 +1 @@
1
- import{Tt as e}from"../src-BxyCNnFT.js";export{e as Set};
1
+ import{Tt as e}from"../src-Djzr1skt.js";export{e as Set};
@@ -13,7 +13,7 @@ import{Brand as e}from"./branded/index.js";import{i as t,n,r,t as i}from"./Tuple
13
13
  `);return[t[0],...t.slice(1).map(e=>e.trim())].join(`
14
14
  `)}function yt(e,t){let n={...gt,...t},r=e instanceof Error?e:Qe.apply(e),i=A?.getErrorChain?A.getErrorChain(r):[r],a=`${n.colors?`\x1b[31m${n.title}:\x1b[0m ${r.message}`:`${n.title}: ${r.message}`}\n\n${i.map((e,t)=>{let r=` `.repeat(t),i=t>0?`↳ `:``,{taskInfo:a}=e,o=`${r}${i}${n.includeTasks&&a?.name?n.colors?`\x1b[36m[${a.name}]\x1b[0m `:`[${a.name}] `:``}${e.message}`;if(n.includeStackTrace&&e.stack){let t=vt(e.stack).split(`
15
15
  `).slice(1),i=n.maxStackFrames??gt.maxStackFrames??3,a=t.slice(0,i).map(e=>`${r} ${n.colors?`\x1B[90m`:``}${e}${n.colors?`\x1B[0m`:``}`).join(`
16
- `);o+=`\n${a}`,t.length>i&&(o+=`\n${r} ${n.colors?`\x1B[90m`:``}...${t.length-i} more stack frames${n.colors?`\x1B[0m`:``}`)}return o}).join(n.separator)}`;if(n.includeData){let{data:e}=r;if(e){let t=n.colors?`\n\n\x1b[33mContext:\x1b[0m\n${_t(e)}`:`\n\nContext:\n${_t(e)}`;a+=t}}return a}function bt(){return function(e){if(!e)return e;let t=e instanceof Error?e:Error(String(e)),n={message:t.message,name:t.name||`Error`,stack:t.stack?vt(t.stack):void 0};if(t.taskInfo&&(n.taskInfo=t.taskInfo),t.data&&(n.data=t.data),typeof A?.getErrorChain==`function`)try{let e=A.getErrorChain(t);e.length>1&&(n.errorChain=A.formatErrorChain(t,{includeTasks:!0}),n.structuredErrorChain=e.map(e=>({message:e.message,name:e.name,taskInfo:e.taskInfo,stack:e.stack?vt(e.stack):void 0})))}catch{}return Object.getOwnPropertyNames(t).forEach(e=>{n[e]||(n[e]=t[e])}),n}}const j=(e,n,r,i)=>t(Qe.apply(n,r,{name:e,description:n}),{code:e,message:n,status:xt(e),context:r,timestamp:new Date().toISOString(),traceId:i?.traceId}),xt=e=>({VALIDATION_FAILED:400,BAD_REQUEST:400,AUTH_REQUIRED:401,PERMISSION_DENIED:403,NOT_FOUND:404,TIMEOUT:408,CONFLICT:409,RATE_LIMITED:429,INTERNAL_ERROR:500,NETWORK_ERROR:503})[e],M=Object.assign(j,{validation:(e,t,n)=>j(`VALIDATION_FAILED`,`Validation failed: ${e} ${n}`,{field:e,value:t,rule:n}),network:(e,t,n)=>j(`NETWORK_ERROR`,`Network error: ${t} ${e}${n?` (${n})`:``}`,{url:e,method:t,statusCode:n}),auth:(e,t)=>j(`AUTH_REQUIRED`,`Authentication required: ${e}${t?` (role: ${t})`:``}`,{resource:e,requiredRole:t}),notFound:(e,t)=>j(`NOT_FOUND`,`Not found: ${e} with id ${t}`,{resource:e,id:t}),permission:(e,t,n)=>j(`PERMISSION_DENIED`,`Permission denied: cannot ${e} ${t}`,{action:e,resource:t,userId:n}),rateLimit:(e,t,n)=>j(`RATE_LIMITED`,`Rate limit exceeded: ${e} requests per ${t}`,{limit:e,window:t,retryAfter:n}),internal:e=>j(`INTERNAL_ERROR`,`Internal server error: ${e}`,{errorId:e,timestamp:new Date().toISOString()}),badRequest:(e,t)=>j(`BAD_REQUEST`,`Bad request: ${e}`,{reason:e,expected:t}),conflict:(e,t)=>j(`CONFLICT`,`Conflict: ${e} already exists with value ${t}`,{resource:e,conflictingValue:t}),timeout:(e,t)=>j(`TIMEOUT`,`Request timeout: ${t} exceeded ${e}ms`,{duration:e,operation:t}),isTypedError:e=>typeof e==`object`&&!!e&&`code`in e&&`message`in e&&`status`in e&&`context`in e&&`_tag`in e&&e._tag===`Throwable`,hasCode:(e,t)=>e.code===t}),N={rule:e=>t=>{if(e===`email`)return typeof t!=`string`||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?T(M.validation(`value`,t,`must be a valid email`)):w(t);if(e===`url`)try{return new URL(String(t)),w(t)}catch{return T(M.validation(`value`,t,`must be a valid URL`))}if(e===`uuid`)return typeof t!=`string`||!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)?T(M.validation(`value`,t,`must be a valid UUID`)):w(t);if(e===`required`)return t==null||t===``?T(M.validation(`value`,t,`is required`)):w(t);if(e===`numeric`)return typeof t!=`number`&&!/^\d+$/.test(String(t))?T(M.validation(`value`,t,`must be numeric`)):w(t);if(e===`alpha`)return typeof t!=`string`||!/^[a-zA-Z]+$/.test(t)?T(M.validation(`value`,t,`must contain only letters`)):w(t);if(e===`alphanumeric`)return typeof t!=`string`||!/^[a-zA-Z0-9]+$/.test(t)?T(M.validation(`value`,t,`must be alphanumeric`)):w(t);if(e.startsWith(`min:`)){let n=Number(e.split(`:`)[1]),r=Number(t);return isNaN(r)||r<n?T(M.validation(`value`,t,`must be at least ${n}`)):w(t)}if(e.startsWith(`max:`)){let n=Number(e.split(`:`)[1]),r=Number(t);return isNaN(r)||r>n?T(M.validation(`value`,t,`must be at most ${n}`)):w(t)}if(e.startsWith(`minLength:`)){let n=Number(e.split(`:`)[1]);return String(t).length<n?T(M.validation(`value`,t,`must be at least ${n} characters`)):w(t)}if(e.startsWith(`maxLength:`)){let n=Number(e.split(`:`)[1]);return String(t).length>n?T(M.validation(`value`,t,`must be at most ${n} characters`)):w(t)}if(e.startsWith(`pattern:`)){let n=e.substring(8);return new RegExp(n).test(String(t))?w(t):T(M.validation(`value`,t,`must match pattern ${n}`))}if(e.startsWith(`in:`)){let n=e.substring(3).split(`,`);return n.includes(String(t))?w(t):T(M.validation(`value`,t,`must be one of: ${n.join(`, `)}`))}if(e.startsWith(`notIn:`)){let n=e.substring(6).split(`,`);return n.includes(String(t))?T(M.validation(`value`,t,`must not be one of: ${n.join(`, `)}`)):w(t)}if(e===`date`){let e=new Date(String(t));return isNaN(e.getTime())?T(M.validation(`value`,t,`must be a valid date`)):w(t)}if(e===`future`){let e=new Date(String(t));return isNaN(e.getTime())||e<=new Date?T(M.validation(`value`,t,`must be a future date`)):w(t)}if(e===`past`){let e=new Date(String(t));return isNaN(e.getTime())||e>=new Date?T(M.validation(`value`,t,`must be a past date`)):w(t)}return w(t)},combine:(...e)=>t=>{for(let n of e){let e=n(t);if(e.isLeft())return e}return w(t)},custom:(e,t)=>n=>e(n)?w(n):T(M.validation(`value`,n,t)),form:(e,t)=>{let n=[],r={};for(let[i,a]of Object.entries(e)){let e=t[i],o=a(e);if(o.isLeft()){let t=o.fold(e=>e,()=>{throw Error(`Should not be left`)}),r=M.validation(i,e,t.context.rule);n.push(r)}else r[i]=o.orThrow()}return n.length>0?T(C(n)):w(r)}},St={...N,validators:{email:N.rule(`email`),url:N.rule(`url`),uuid:N.rule(`uuid`),required:N.rule(`required`),numeric:N.rule(`numeric`),positiveNumber:N.combine(N.rule(`numeric`),N.rule(`min:0`)),nonEmptyString:N.combine(N.rule(`required`),N.custom(e=>typeof e==`string`&&e.trim().length>0,`must not be empty`))}},Ct=t(N.rule,St);function wt(e){return typeof e==`object`&&!!e&&`orThrow`in e&&typeof e.orThrow==`function`}function Tt(e){return wt(e)&&`orElse`in e&&typeof e.orElse==`function`&&`or`in e&&typeof e.or==`function`&&`orNull`in e&&typeof e.orNull==`function`&&`orUndefined`in e&&typeof e.orUndefined==`function`}const Et=e=>({_tag:`Context`,services:e,get(t){let n=e.get(t.id);return n===void 0?p():d(n)},unsafeGet(t){let n=e.get(t.id);if(n===void 0)throw Error(`Service not found: ${t.id}`);return n},has(t){return e.has(t.id)},add(t,n){let r=new Map(e);return r.set(t.id,n),Et(r)},merge(t){let n=new Map(e);for(let[e,r]of t.services)n.set(e,r);return Et(n)},get size(){return e.size},toString(){return`Context(${Array.from(e.keys()).join(`, `)})`}}),P={empty:()=>Et(new Map),make:(e,t)=>{let n=new Map;return n.set(e.id,t),Et(n)},isContext:e=>typeof e==`object`&&!!e&&e._tag===`Context`},F=e=>({[Symbol.toStringTag]:`Exit`,_tag:`Success`,isSuccess(){return!0},isFailure(){return!1},isInterrupted(){return!1},map(t){return F(t(e))},mapError(t){return F(e)},mapBoth(t,n){return F(n(e))},flatMap(t){return t(e)},fold(t,n,r){return n(e)},match(t){return t.Success(e)},orThrow(){return e},orElse(t){return e},toOption(){return d(e)},toEither(){return w(e)},toValue(){return{_tag:`Success`,value:e}},toString(){return`Exit.Success(${n(e)})`},toJSON(){return{_tag:`Success`,value:e}}}),Dt=e=>({[Symbol.toStringTag]:`Exit`,_tag:`Failure`,isSuccess(){return!1},isFailure(){return!0},isInterrupted(){return!1},map(t){return Dt(e)},mapError(t){return Dt(t(e))},mapBoth(t,n){return Dt(t(e))},flatMap(t){return Dt(e)},fold(t,n,r){return t(e)},match(t){return t.Failure(e)},orThrow(){throw e},orElse(e){return e},toOption(){return p()},toEither(){return T(e)},toValue(){return{_tag:`Failure`,error:e}},toString(){return`Exit.Failure(${n(e)})`},toJSON(){return{_tag:`Failure`,error:e}}}),Ot=e=>({[Symbol.toStringTag]:`Exit`,_tag:`Interrupted`,isSuccess(){return!1},isFailure(){return!1},isInterrupted(){return!0},map(t){return Ot(e)},mapError(t){return Ot(e)},mapBoth(t,n){return Ot(e)},flatMap(t){return Ot(e)},fold(t,n,r){if(r)return r(e);throw Error(`Effect was interrupted: ${e}`)},match(t){return t.Interrupted(e)},orThrow(){throw Error(`Effect was interrupted: ${e}`)},orElse(e){return e},toOption(){return p()},toEither(){throw Error(`Cannot convert Interrupted Exit to Either: ${e}`)},toValue(){return{_tag:`Interrupted`,fiberId:e}},toString(){return`Exit.Interrupted(${e})`},toJSON(){return{_tag:`Interrupted`,fiberId:e}}}),I=r(e=>F(e),{succeed:e=>F(e),fail:e=>Dt(e),interrupt:e=>Ot(e),interrupted:()=>Ot(`interrupted`),isSuccess:e=>e.isSuccess(),isFailure:e=>e.isFailure(),isInterrupted:e=>e.isInterrupted(),fromEither:e=>e.isRight()?F(e.value):Dt(e.value),fromOption:(e,t)=>e.isSome()?F(e.value):Dt(t()),zip:(e,t)=>e.isInterrupted()?e:t.isInterrupted()?t:e.isFailure()?e:t.isFailure()?t:F([e.orThrow(),t.orThrow()]),all:e=>{let t=[];for(let n of e){if(n.isInterrupted()||n.isFailure())return n;t.push(n.orThrow())}return F(t)}}),L=e=>e;var kt=class extends Error{constructor(e,t){super(t??`Effect timed out after ${e}ms`),this.duration=e,this._tag=`TimeoutError`,this.name=`TimeoutError`}},At=class extends Error{constructor(e){super(e??`Effect was interrupted`),this._tag=`InterruptedError`,this.name=`InterruptedError`}};const jt=Symbol.for(`functype/IO/effect`),R=e=>e[jt],z=e=>{let t={[Symbol.toStringTag]:`IO`,[jt]:e,map(e){return z(L({_tag:`Map`,effect:t,f:e}))},flatMap(e){return z(L({_tag:`FlatMap`,effect:t,f:e}))},tap(e){return t.map(t=>(e(t),t))},tapEffect(e){return t.flatMap(t=>e(t).map(()=>t))},mapError(e){return z(L({_tag:`MapError`,effect:t,f:e}))},tapError(e){return t.mapError(t=>(e(t),t))},recover(e){return z(L({_tag:`Recover`,effect:t,fallback:e}))},recoverWith(e){return z(L({_tag:`RecoverWith`,effect:t,f:e}))},fold(e,n){return z(L({_tag:`Fold`,effect:t,onFailure:e,onSuccess:n}))},match(e){return t.fold(e.failure,e.success)},catchTag(e,n){return z(L({_tag:`RecoverWith`,effect:t,f:t=>typeof t==`object`&&t&&`_tag`in t&&t._tag===e?L(n(t)):L(H.fail(t))}))},catchAll(e){return t.recoverWith(e)},retry(e){return e<=0?t:t.recoverWith(()=>t.retry(e-1))},retryWithDelay(e,n){return e<=0?t:t.recoverWith(()=>H.sleep(n).flatMap(()=>t.retryWithDelay(e-1,n)))},zipRight(e){return t.flatMap(()=>e)},zipLeft(e){return t.flatMap(t=>e.map(()=>t))},zip(e){return t.flatMap(t=>e.map(e=>[t,e]))},flatten(){return this.flatMap(e=>e)},provideContext(e){return z(L({_tag:`ProvideContext`,effect:t,context:e}))},provideService(e,n){return z(L({_tag:`ProvideContext`,effect:t,context:P.make(e,n)}))},provideLayer(e){return L(L(H.async(async()=>{let t=P.empty();return await e.build(L(t))})).flatMap(e=>z(L({_tag:`ProvideContext`,effect:t,context:e}))))},async run(){let e=await V(R(this));return e.isSuccess()?w(e.orThrow()):T(e.isFailure()?e.toValue().error:new At)},async runOrThrow(){let e=await V(R(this));if(e.isSuccess())return e.orThrow();throw e.isFailure()?e.toValue().error:new At},runSync(){try{return w(B(R(this)))}catch(e){return T(e)}},runSyncOrThrow(){return B(R(this))},async runExit(){return V(R(this))},async runOption(){let e=await V(R(this));return e.isSuccess()?d(e.orThrow()):p()},async runTry(){let e=await V(R(this));if(e.isSuccess())return L(x(()=>e.orThrow()));let t=e.isFailure()?e.toValue().error:Error(`Effect was interrupted`);return L(x(()=>{throw t}))},pipe(e){return e(t)},delay(e){return L(H.async(()=>new Promise(t=>setTimeout(t,e))).flatMap(()=>t))},timeout(e){return z(L({_tag:`Timeout`,effect:t,duration:e}))},timeoutTo(e,n){return L(t.timeout(e).recover(L(n)))},toString(){return`IO(${n(e._tag)})`},toJSON(){return{_tag:`IO`,effect:e._tag}},*[Symbol.iterator](){return yield t}};return t},B=(e,t=P.empty())=>{switch(e._tag){case`Succeed`:return e.value;case`Fail`:throw e.error;case`Die`:throw e.defect;case`Sync`:return e.thunk();case`Async`:throw Error(`Cannot run async effect synchronously`);case`Auto`:{let t=e.thunk();if(t instanceof Promise)throw Error(`Cannot run async effect synchronously`);return t}case`Map`:{let n=B(R(e.effect),t);return e.f(n)}case`FlatMap`:{let n=B(R(e.effect),t);return B(R(e.f(n)),t)}case`MapError`:try{return B(R(e.effect),t)}catch(t){throw e.f(t)}case`Recover`:try{return B(R(e.effect),t)}catch{return e.fallback}case`RecoverWith`:try{return L(B(R(e.effect),t))}catch(n){return B(R(e.f(n)),t)}case`Fold`:try{let n=B(R(e.effect),t);return e.onSuccess(n)}catch(t){return e.onFailure(t)}case`Service`:{let n=t.get(e.tag);if(n.isNone())throw Error(`Service not found: ${e.tag.id}`);return n.orThrow()}case`ProvideContext`:{let n=t.merge(e.context);return B(R(e.effect),n)}case`Interrupt`:throw new At;case`Bracket`:{let n=B(R(e.acquire),t);try{return B(R(e.use(n)),t)}finally{B(R(e.release(n)),t)}}case`Race`:throw Error(`Cannot run race effect synchronously`);case`Timeout`:throw Error(`Cannot run timeout effect synchronously`)}},V=async(e,t=P.empty())=>{try{switch(e._tag){case`Succeed`:return L(I.succeed(e.value));case`Fail`:return L(I.fail(e.error));case`Die`:throw e.defect;case`Sync`:return L(I.succeed(e.thunk()));case`Async`:{let t=await e.thunk();return L(I.succeed(t))}case`Auto`:{let t=e.thunk();return t instanceof Promise?L(I.succeed(await t)):L(I.succeed(t))}case`Map`:{let n=await V(R(e.effect),t);return n.isSuccess()?L(I.succeed(e.f(n.orThrow()))):L(n)}case`FlatMap`:{let n=await V(R(e.effect),t);return n.isSuccess()?V(R(e.f(n.orThrow())),t):L(n)}case`MapError`:{let n=await V(R(e.effect),t);return n.isSuccess()?L(n):n.isFailure()?L(I.fail(e.f(n.toValue().error))):L(n)}case`Recover`:{let n=await V(R(e.effect),t);return n.isSuccess()?n:I.succeed(e.fallback)}case`RecoverWith`:{let n=await V(R(e.effect),t);return n.isSuccess()?L(n):n.isFailure()?V(R(e.f(n.toValue().error)),t):L(n)}case`Fold`:{let n=await V(R(e.effect),t);return n.isSuccess()?I.succeed(e.onSuccess(n.orThrow())):n.isFailure()?I.succeed(e.onFailure(n.toValue().error)):n}case`Service`:{let n=t.get(e.tag);return n.isNone()?I.fail(Error(`Service not found: ${e.tag.id}`)):I.succeed(n.orThrow())}case`ProvideContext`:{let n=t.merge(e.context);return V(R(e.effect),n)}case`Interrupt`:return I.interrupted();case`Bracket`:{let n=await V(R(e.acquire),t);if(!n.isSuccess())return n;let r=n.orThrow();try{return await V(R(e.use(r)),t)}finally{await V(R(e.release(r)),t)}}case`Race`:return e.effects.length===0?I.fail(Error(`No effects to race`)):await Promise.race(e.effects.map(e=>V(R(e),t)));case`Timeout`:{let n=new Promise(t=>setTimeout(()=>t(I.fail(new kt(e.duration))),e.duration)),r=V(R(e.effect),t);return Promise.race([r,n])}}}catch(e){return I.fail(e)}},H={sync:e=>z({_tag:`Sync`,thunk:e}),succeed:e=>z({_tag:`Succeed`,value:e}),fail:e=>z({_tag:`Fail`,error:e}),die:e=>z({_tag:`Die`,defect:e}),async:e=>z(L({_tag:`Async`,thunk:e})),tryPromise:e=>z({_tag:`Async`,thunk:e.try}).mapError(e.catch),tryCatch:(e,t)=>H.sync(()=>{try{return e()}catch(e){throw t(e)}}),liftSync:e=>(...t)=>H.sync(()=>e(...t)),liftPromise:e=>(...t)=>H.async(()=>e(...t)),fromEither:e=>L(e.isRight()?H.succeed(e.value):H.fail(e.value)),fromOption:e=>L(e.isSome()?H.succeed(e.value):H.fail(void 0)),fromOptionOrFail:(e,t)=>L(e.isSome()?H.succeed(e.value):H.fail(t())),fromTry:e=>L(e.isSuccess()?H.succeed(e.orThrow()):H.fail(e.error)),fromResult:e=>L(e.error?H.fail(e.error):H.succeed(m(e.data))),tryAsync:(e,t,n)=>n?.aborted?L(H.fail(t(n.reason??new DOMException(`Aborted`,`AbortError`)))):H.async(()=>e(n)).mapError(t),asyncResult:(e,t,n)=>{let r=n?.dataKey??`data`,i=n?.errorKey??`error`;return H.tryAsync(t=>e(t),t,n?.signal).flatMap(e=>H.fromResult({data:e[r],error:e[i]}))},service:e=>z({_tag:`Service`,tag:e}),serviceWith:(e,t)=>H.service(e).map(t),serviceWithIO:(e,t)=>H.service(e).flatMap(t),withServices:(e,t)=>{let n=Object.entries(e);if(n.length===0)return L(z({_tag:`Auto`,thunk:()=>t({})}));let r=L(H.succeed({}));return L(n.reduce((e,[t,n])=>L(e.flatMap(e=>H.service(n).map(n=>({...e,[t]:n})))),r).flatMap(e=>z({_tag:`Auto`,thunk:()=>t(e)})))},all:e=>{if(e.length===0)return L(H.succeed([]));let t=L(H.succeed([]));return L(e.reduce((e,t)=>e.flatMap(e=>t.map(t=>[...e,t])),t))},firstSuccessOf:e=>e.length===0?L(H.fail(Error(`No effects provided`))):e.reduce((e,t)=>e.recoverWith(()=>t)),sleep:e=>L(H.async(()=>new Promise(t=>setTimeout(t,e)))),never:()=>L(H.async(()=>new Promise(()=>{}))),get unit(){return L(z({_tag:`Succeed`,value:void 0}))},fromNullable:e=>L(e==null?H.fail(void 0):H.succeed(e)),interrupt:()=>z({_tag:`Interrupt`}),bracket:(e,t,n)=>z({_tag:`Bracket`,acquire:e,use:t,release:n}),acquireRelease:(e,t,n)=>H.bracket(e,t,n),race:e=>z({_tag:`Race`,effects:e}),any:e=>e.length===0?L(H.fail(Error(`No effects provided`))):e.reduce((e,t)=>e.recoverWith(()=>t)),forEach:(e,t)=>{if(e.length===0)return L(H.succeed([]));let n=L(H.succeed([]));return L(e.reduce((e,n)=>e.flatMap(e=>t(n).map(t=>[...e,t])),n))},forEachPar:(e,t)=>H.forEach(e,t),timeout:(e,t)=>z(L({_tag:`Timeout`,effect:e,duration:t})),gen:e=>L(H.sync(()=>{let t=e(),n=e=>{let r=t.next(e);return r.done?L(H.succeed(r.value)):L(r.value.flatMap(e=>n(e)))};return n(void 0)}).flatMap(e=>e)),get Do(){return Mt(H.succeed({}))}},Mt=e=>({effect:e,bind(t,n){return Mt(e.flatMap(e=>n(e).map(n=>({...e,[t]:n}))))},let(t,n){return Mt(e.map(e=>({...e,[t]:n(e)})))},map(t){return e.map(t)},flatMap(t){return e.flatMap(t)},tap(t){return Mt(e.tap(t))},tapEffect(t){return Mt(e.tapEffect(t))},done(){return e}}),U=r(e=>z(L({_tag:`Auto`,thunk:e})),H),W=(e,t)=>({_tag:`Layer`,build:e,provideToAndMerge(t){return W(async n=>{let r=await e(n),i=n.merge(r),a=await t.build(i);return r.merge(a)})},merge(t){return W(async n=>{let[r,i]=await Promise.all([e(n),t.build(n)]);return r.merge(i)})},map(t){return W(async n=>t(await e(n)))},toString(){return`Layer(${t??`anonymous`})`}}),Nt={succeed:(e,t)=>W(()=>Promise.resolve(P.make(e,t)),e.id),effect:(e,t)=>W(async()=>{let n=await t();return P.make(e,n)},e.id),sync:(e,t)=>W(()=>Promise.resolve(P.make(e,t())),e.id),fromService:(e,t,n)=>W(r=>{let i=r.unsafeGet(t);return Promise.resolve(P.make(e,n(i)))},e.id),fromServiceEffect:(e,t,n)=>W(async r=>{let i=await n(r.unsafeGet(t));return P.make(e,i)},e.id),fromContext:e=>W(()=>Promise.resolve(e)),empty:()=>W(()=>Promise.resolve(P.empty()),`empty`),mergeAll:(...e)=>W(async t=>(await Promise.all(e.map(e=>e.build(t)))).reduce((e,t)=>e.merge(t),P.empty()))},Pt=e=>({id:e,_tag:`Tag`,toString(){return`Tag(${e})`}}),Ft=()=>{let e=0,t=[],n=async()=>{for(t.sort((e,t)=>e.time-t.time);t.length>0&&t[0]!==void 0&&t[0].time<=e;){let e=t.shift();e&&(e.resolve(),await Promise.resolve())}};return{get currentTime(){return e},async advance(t){e+=t,await n()},async setTime(t){e=t,await n()},async runAll(){if(t.length>0){let n=t[t.length-1];n&&(e=n.time)}await n()},get pendingCount(){return t.length},sleep(n){return new Promise(r=>{t.push({time:e+n,resolve:r})})}}},G=Pt(`TestClock`),It={make:Ft,tag:G,test:async e=>e(Ft()),get:U.service(G),advance:e=>U.serviceWithIO(G,t=>U.async(()=>t.advance(e))),setTime:e=>U.serviceWithIO(G,t=>U.async(()=>t.setTime(e))),runAll:U.serviceWithIO(G,e=>U.async(()=>e.runAll())),context:()=>{let e=Ft();return{clock:e,context:P.make(G,e)}}},Lt={make:()=>{let e=Ft(),t=P.empty(),n={get context(){return t},get clock(){return e},withService(e,r){return t=t.add(e,r),n},async run(e){return e.provideContext(t).runOrThrow()}};return n},withClock:()=>{let e=Ft();return Lt.make().withService(G,e)}},Rt=Pt(`HttpClient`),zt={},Bt=r({},{networkError:(e,t,n)=>({_tag:`NetworkError`,url:e,method:t,cause:n}),httpStatusError:(e,t,n,r,i)=>({_tag:`HttpStatusError`,url:e,method:t,status:n,statusText:r,body:i}),decodeError:(e,t,n,r)=>({_tag:`DecodeError`,url:e,method:t,body:n,cause:r}),isNetworkError:e=>e._tag===`NetworkError`,isHttpStatusError:e=>e._tag===`HttpStatusError`,isDecodeError:e=>e._tag===`DecodeError`,match:(e,t)=>{switch(e._tag){case`NetworkError`:return t.NetworkError(e);case`HttpStatusError`:return t.HttpStatusError(e);case`DecodeError`:return t.DecodeError(e)}}}),Vt=(e,t)=>!e||t.startsWith(`http://`)||t.startsWith(`https://`)?t:`${e.endsWith(`/`)?e.slice(0,-1):e}${t.startsWith(`/`)?t:`/${t}`}`,Ht=e=>e==null?{serialized:void 0,contentType:void 0}:typeof e==`string`?{serialized:e,contentType:void 0}:typeof e==`object`||Array.isArray(e)?{serialized:JSON.stringify(e),contentType:`application/json`}:{serialized:String(e),contentType:void 0},Ut=e=>{let t=e.get(`content-type`)??``;return t.includes(`application/json`)?`json`:t.startsWith(`text/`)?`text`:`raw`},Wt=async(e,t,n,r,i)=>{let a=t??Ut(e.headers),o,s={};switch(a){case`json`:{let t=await e.text();s.value=t;try{o=JSON.parse(t)}catch(e){throw Bt.decodeError(n,r,t,e)}break}case`text`:o=await e.text(),s.value=o;break;case`blob`:o=await e.blob();break;case`arrayBuffer`:o=await e.arrayBuffer();break;case`raw`:o=e;break}return{data:i?(()=>{try{return i(o)}catch(e){let t=s.value??(typeof o==`string`?o:JSON.stringify(o));throw Bt.decodeError(n,r,t,e)}})():o,status:e.status,statusText:e.statusText,headers:e.headers}},K=(e,t)=>{let n=Vt(e.baseUrl,t.url),{serialized:r,contentType:i}=Ht(t.body),a={...e.defaultHeaders,...t.headers,...i?{"Content-Type":i}:{}};return U.tryAsync(i=>(e.fetch??globalThis.fetch)(n,{method:t.method,headers:a,body:r,signal:t.signal??i}).then(async e=>{if(!e.ok){let r=await e.text().catch(()=>``);throw Bt.httpStatusError(n,t.method,e.status,e.statusText,r)}return Wt(e,t.parseAs,n,t.method,t.validate)}),e=>typeof e==`object`&&e&&`_tag`in e?e:Bt.networkError(n,t.method,e))},Gt=e=>K(zt,e),Kt=r({},{request:Gt,get:(e,t)=>Gt({...t,url:e,method:`GET`}),post:(e,t)=>Gt({...t,url:e,method:`POST`}),put:(e,t)=>Gt({...t,url:e,method:`PUT`}),patch:(e,t)=>Gt({...t,url:e,method:`PATCH`}),delete:(e,t)=>Gt({...t,url:e,method:`DELETE`}),head:(e,t)=>Gt({...t,url:e,method:`HEAD`,parseAs:`raw`}),options:(e,t)=>Gt({...t,url:e,method:`OPTIONS`,parseAs:`raw`}),client:e=>({request:t=>K(e,t),get:(t,n)=>K(e,{...n,url:t,method:`GET`}),post:(t,n)=>K(e,{...n,url:t,method:`POST`}),put:(t,n)=>K(e,{...n,url:t,method:`PUT`}),patch:(t,n)=>K(e,{...n,url:t,method:`PATCH`}),delete:(t,n)=>K(e,{...n,url:t,method:`DELETE`}),head:(t,n)=>K(e,{...n,url:t,method:`HEAD`,parseAs:`raw`}),options:(t,n)=>K(e,{...n,url:t,method:`OPTIONS`,parseAs:`raw`})})}),qt={toOption:e=>e.fold(()=>p(),e=>d(e)),toList:e=>e.fold(()=>C([]),e=>C([e])),toEither:(e,t)=>e.fold(()=>T(t),e=>w(e)),isEmpty:e=>e.fold(()=>!0,()=>!1),size:e=>e.fold(()=>0,()=>1)},Jt=e=>typeof e==`object`&&!!e&&(e._tag===`Some`||e._tag===`None`),q=e=>typeof e==`object`&&!!e&&e._tag===`List`,Yt=e=>typeof e==`object`&&!!e&&(e._tag===`Left`||e._tag===`Right`),Xt=e=>typeof e==`object`&&!!e&&(e._tag===`Success`||e._tag===`Failure`),J=()=>{let e=(e,t)=>{if(Jt(e)||q(e)||Yt(e)||Xt(e))return e.map(e=>t(e));throw Error(`Unsupported functor type: ${JSON.stringify(e)}`)},t=e=>{if(Jt(e))return e.orThrow();if(q(e)){let t=e.toArray();if(t.length>0&&q(t[0])){let e=[];for(let n of t)q(n)&&e.push(...n.toArray());return C(e)}return e.flatten()}if(Yt(e))return e.isRight()?e.fold(()=>null,e=>e):e;if(Xt(e))return e.isSuccess()?e.orThrow():e;throw Error(`Unsupported functor type for flatten: ${JSON.stringify(e)}`)},n=(e,t)=>{if(Jt(e)||q(e)||Yt(e)||Xt(e))return e.flatMap(e=>t(e));throw Error(`Unsupported functor type for flatMap: ${JSON.stringify(e)}`)},r=(e,t)=>{if(Jt(e)&&Jt(t)||q(e)&&q(t)||Yt(e)&&Yt(t)||Xt(e)&&Xt(t))return e.flatMap(e=>t.map(t=>e(t)));throw Error(`Unsupported functor type for ap: ${JSON.stringify(e)}`)},i=e=>{if(Jt(e)){let t=e;if(t.isEmpty)return C([m.none()]);let n=t.orThrow();if(q(n))return n.map(e=>m(e));throw Error(`Unsupported inner container type for sequence`)}if(q(e)){let t=e.toArray();if(t.length===0)return m.none();let n=t[0];if(Jt(n)){for(let e of t)if(e.isEmpty)return m.none();return m(C(t.map(e=>e.orThrow())))}throw Error(`Unsupported inner container type for sequence`)}throw Error(`Unsupported outer container type for sequence: ${JSON.stringify(e)}`)};return{_tag:`HKT`,map:e,flatten:t,flatMap:n,ap:r,sequence:i,traverse:(t,n)=>i(e(t,e=>n(e))),_type:`HKT`}},Zt=J();J.map=(e,t)=>Zt.map(e,t),J.flatten=e=>Zt.flatten(e),J.flatMap=(e,t)=>Zt.flatMap(e,t),J.ap=(e,t)=>Zt.ap(e,t),J.sequence=e=>Zt.sequence(e),J.traverse=(e,t)=>Zt.traverse(e,t),J.isOption=Jt,J.isList=q,J.isEither=Yt,J.isTry=Xt;const Qt=e=>({id:e,isSame:t=>t.id===e}),$t=r(Qt,{of:e=>Qt(e),pure:e=>Qt(e)}),Y=e=>{let t=!1,r,i,a=!1,o=()=>{if(!t)try{r=e(),t=!0}catch(e){throw i=e,a=!0,t=!0,e}if(a)throw i;return r};return{[Symbol.toStringTag]:`Lazy`,_tag:`Lazy`,get isEvaluated(){return t},orElse:e=>{try{return o()}catch{return e}},orNull:()=>{try{return o()}catch{return null}},orThrow:e=>{try{return o()}catch(t){throw e??t}},or:e=>X(()=>{try{return o()}catch{return e.orThrow()}}),orUndefined:()=>{try{return o()}catch{return}},map:e=>X(()=>e(o())),ap:e=>X(()=>e.orThrow()(o())),mapAsync:async e=>{let t=await e(o());return X(()=>t)},flatMap:e=>X(()=>e(o()).orThrow()),flatMapAsync:async e=>{let t=await e(o());return X(()=>t.orThrow())},filter:e=>X(()=>{let t=o();return e(t)?d(t):p}),recover:e=>X(()=>{try{return o()}catch(t){return e(t)}}),recoverWith:e=>X(()=>{try{return o()}catch(t){return e(t).orThrow()}}),toOption:()=>{try{return d(o())}catch{return p}},toEither:()=>{try{return w(o())}catch(e){return T(e)}},toEitherWith:e=>{try{return w(o())}catch(t){return T(e(t))}},toTry:()=>x(()=>o()),tap:e=>X(()=>{let t=o();return e(t),t}),tapError:e=>X(()=>{try{return o()}catch(t){throw e(t),t}}),fold:e=>e(o()),foldWith:(e,t)=>{try{return t(o())}catch(t){return e(t)}},foldLeft:e=>t=>t(e,o()),foldRight:e=>t=>t(o(),e),match:e=>e.Lazy(o()),toString:()=>t&&!a?`Lazy(${n(r)})`:t&&a?`Lazy(<error: ${i instanceof Error?i.message:String(i)}>)`:`Lazy(<not evaluated>)`,toValue:()=>t&&!a?{_tag:`Lazy`,evaluated:!0,value:r}:{_tag:`Lazy`,evaluated:!1},get size(){try{return o(),1}catch{return 0}},get isEmpty(){try{return o(),!1}catch{return!0}},contains:e=>{try{return o()===e}catch{return!1}},reduce:e=>o(),reduceRight:e=>o(),count:e=>{try{return+!!e(o())}catch{return 0}},find:e=>{try{let t=o();return e(t)?d(t):p}catch{return p}},exists:e=>{try{return e(o())}catch{return!1}},forEach:e=>{try{e(o())}catch{}},pipe:e=>e(o()),serialize:()=>({toJSON:()=>JSON.stringify(t&&!a?{_tag:`Lazy`,evaluated:!0,value:r}:{_tag:`Lazy`,evaluated:!1}),toYAML:()=>t&&!a?`_tag: Lazy\nevaluated: true\nvalue: ${n(r)}`:`_tag: Lazy
16
+ `);o+=`\n${a}`,t.length>i&&(o+=`\n${r} ${n.colors?`\x1B[90m`:``}...${t.length-i} more stack frames${n.colors?`\x1B[0m`:``}`)}return o}).join(n.separator)}`;if(n.includeData){let{data:e}=r;if(e){let t=n.colors?`\n\n\x1b[33mContext:\x1b[0m\n${_t(e)}`:`\n\nContext:\n${_t(e)}`;a+=t}}return a}function bt(){return function(e){if(!e)return e;let t=e instanceof Error?e:Error(String(e)),n={message:t.message,name:t.name||`Error`,stack:t.stack?vt(t.stack):void 0};if(t.taskInfo&&(n.taskInfo=t.taskInfo),t.data&&(n.data=t.data),typeof A?.getErrorChain==`function`)try{let e=A.getErrorChain(t);e.length>1&&(n.errorChain=A.formatErrorChain(t,{includeTasks:!0}),n.structuredErrorChain=e.map(e=>({message:e.message,name:e.name,taskInfo:e.taskInfo,stack:e.stack?vt(e.stack):void 0})))}catch{}return Object.getOwnPropertyNames(t).forEach(e=>{n[e]||(n[e]=t[e])}),n}}const j=(e,n,r,i)=>t(Qe.apply(n,r,{name:e,description:n}),{code:e,message:n,status:xt(e),context:r,timestamp:new Date().toISOString(),traceId:i?.traceId}),xt=e=>({VALIDATION_FAILED:400,BAD_REQUEST:400,AUTH_REQUIRED:401,PERMISSION_DENIED:403,NOT_FOUND:404,TIMEOUT:408,CONFLICT:409,RATE_LIMITED:429,INTERNAL_ERROR:500,NETWORK_ERROR:503})[e],M=Object.assign(j,{validation:(e,t,n)=>j(`VALIDATION_FAILED`,`Validation failed: ${e} ${n}`,{field:e,value:t,rule:n}),network:(e,t,n)=>j(`NETWORK_ERROR`,`Network error: ${t} ${e}${n?` (${n})`:``}`,{url:e,method:t,statusCode:n}),auth:(e,t)=>j(`AUTH_REQUIRED`,`Authentication required: ${e}${t?` (role: ${t})`:``}`,{resource:e,requiredRole:t}),notFound:(e,t)=>j(`NOT_FOUND`,`Not found: ${e} with id ${t}`,{resource:e,id:t}),permission:(e,t,n)=>j(`PERMISSION_DENIED`,`Permission denied: cannot ${e} ${t}`,{action:e,resource:t,userId:n}),rateLimit:(e,t,n)=>j(`RATE_LIMITED`,`Rate limit exceeded: ${e} requests per ${t}`,{limit:e,window:t,retryAfter:n}),internal:e=>j(`INTERNAL_ERROR`,`Internal server error: ${e}`,{errorId:e,timestamp:new Date().toISOString()}),badRequest:(e,t)=>j(`BAD_REQUEST`,`Bad request: ${e}`,{reason:e,expected:t}),conflict:(e,t)=>j(`CONFLICT`,`Conflict: ${e} already exists with value ${t}`,{resource:e,conflictingValue:t}),timeout:(e,t)=>j(`TIMEOUT`,`Request timeout: ${t} exceeded ${e}ms`,{duration:e,operation:t}),isTypedError:e=>typeof e==`object`&&!!e&&`code`in e&&`message`in e&&`status`in e&&`context`in e&&`_tag`in e&&e._tag===`Throwable`,hasCode:(e,t)=>e.code===t}),N={rule:e=>t=>{if(e===`email`)return typeof t!=`string`||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?T(M.validation(`value`,t,`must be a valid email`)):w(t);if(e===`url`)try{return new URL(String(t)),w(t)}catch{return T(M.validation(`value`,t,`must be a valid URL`))}if(e===`uuid`)return typeof t!=`string`||!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)?T(M.validation(`value`,t,`must be a valid UUID`)):w(t);if(e===`required`)return t==null||t===``?T(M.validation(`value`,t,`is required`)):w(t);if(e===`numeric`)return typeof t!=`number`&&!/^\d+$/.test(String(t))?T(M.validation(`value`,t,`must be numeric`)):w(t);if(e===`alpha`)return typeof t!=`string`||!/^[a-zA-Z]+$/.test(t)?T(M.validation(`value`,t,`must contain only letters`)):w(t);if(e===`alphanumeric`)return typeof t!=`string`||!/^[a-zA-Z0-9]+$/.test(t)?T(M.validation(`value`,t,`must be alphanumeric`)):w(t);if(e.startsWith(`min:`)){let n=Number(e.split(`:`)[1]),r=Number(t);return isNaN(r)||r<n?T(M.validation(`value`,t,`must be at least ${n}`)):w(t)}if(e.startsWith(`max:`)){let n=Number(e.split(`:`)[1]),r=Number(t);return isNaN(r)||r>n?T(M.validation(`value`,t,`must be at most ${n}`)):w(t)}if(e.startsWith(`minLength:`)){let n=Number(e.split(`:`)[1]);return String(t).length<n?T(M.validation(`value`,t,`must be at least ${n} characters`)):w(t)}if(e.startsWith(`maxLength:`)){let n=Number(e.split(`:`)[1]);return String(t).length>n?T(M.validation(`value`,t,`must be at most ${n} characters`)):w(t)}if(e.startsWith(`pattern:`)){let n=e.substring(8);return new RegExp(n).test(String(t))?w(t):T(M.validation(`value`,t,`must match pattern ${n}`))}if(e.startsWith(`in:`)){let n=e.substring(3).split(`,`);return n.includes(String(t))?w(t):T(M.validation(`value`,t,`must be one of: ${n.join(`, `)}`))}if(e.startsWith(`notIn:`)){let n=e.substring(6).split(`,`);return n.includes(String(t))?T(M.validation(`value`,t,`must not be one of: ${n.join(`, `)}`)):w(t)}if(e===`date`){let e=new Date(String(t));return isNaN(e.getTime())?T(M.validation(`value`,t,`must be a valid date`)):w(t)}if(e===`future`){let e=new Date(String(t));return isNaN(e.getTime())||e<=new Date?T(M.validation(`value`,t,`must be a future date`)):w(t)}if(e===`past`){let e=new Date(String(t));return isNaN(e.getTime())||e>=new Date?T(M.validation(`value`,t,`must be a past date`)):w(t)}return w(t)},combine:(...e)=>t=>{for(let n of e){let e=n(t);if(e.isLeft())return e}return w(t)},custom:(e,t)=>n=>e(n)?w(n):T(M.validation(`value`,n,t)),form:(e,t)=>{let n=[],r={};for(let[i,a]of Object.entries(e)){let e=t[i],o=a(e);if(o.isLeft()){let t=o.fold(e=>e,()=>{throw Error(`Should not be left`)}),r=M.validation(i,e,t.context.rule);n.push(r)}else r[i]=o.orThrow()}return n.length>0?T(C(n)):w(r)}},St={...N,validators:{email:N.rule(`email`),url:N.rule(`url`),uuid:N.rule(`uuid`),required:N.rule(`required`),numeric:N.rule(`numeric`),positiveNumber:N.combine(N.rule(`numeric`),N.rule(`min:0`)),nonEmptyString:N.combine(N.rule(`required`),N.custom(e=>typeof e==`string`&&e.trim().length>0,`must not be empty`))}},Ct=t(N.rule,St);function wt(e){return typeof e==`object`&&!!e&&`orThrow`in e&&typeof e.orThrow==`function`}function Tt(e){return wt(e)&&`orElse`in e&&typeof e.orElse==`function`&&`or`in e&&typeof e.or==`function`&&`orNull`in e&&typeof e.orNull==`function`&&`orUndefined`in e&&typeof e.orUndefined==`function`}const Et=e=>({_tag:`Context`,services:e,get(t){let n=e.get(t.id);return n===void 0?p():d(n)},unsafeGet(t){let n=e.get(t.id);if(n===void 0)throw Error(`Service not found: ${t.id}`);return n},has(t){return e.has(t.id)},add(t,n){let r=new Map(e);return r.set(t.id,n),Et(r)},merge(t){let n=new Map(e);for(let[e,r]of t.services)n.set(e,r);return Et(n)},get size(){return e.size},toString(){return`Context(${Array.from(e.keys()).join(`, `)})`}}),P={empty:()=>Et(new Map),make:(e,t)=>{let n=new Map;return n.set(e.id,t),Et(n)},isContext:e=>typeof e==`object`&&!!e&&e._tag===`Context`},F=e=>({[Symbol.toStringTag]:`Exit`,_tag:`Success`,isSuccess(){return!0},isFailure(){return!1},isInterrupted(){return!1},map(t){return F(t(e))},mapError(t){return F(e)},mapBoth(t,n){return F(n(e))},flatMap(t){return t(e)},fold(t,n,r){return n(e)},match(t){return t.Success(e)},orThrow(){return e},orElse(t){return e},toOption(){return d(e)},toEither(){return w(e)},toValue(){return{_tag:`Success`,value:e}},toString(){return`Exit.Success(${n(e)})`},toJSON(){return{_tag:`Success`,value:e}}}),Dt=e=>({[Symbol.toStringTag]:`Exit`,_tag:`Failure`,isSuccess(){return!1},isFailure(){return!0},isInterrupted(){return!1},map(t){return Dt(e)},mapError(t){return Dt(t(e))},mapBoth(t,n){return Dt(t(e))},flatMap(t){return Dt(e)},fold(t,n,r){return t(e)},match(t){return t.Failure(e)},orThrow(){throw e},orElse(e){return e},toOption(){return p()},toEither(){return T(e)},toValue(){return{_tag:`Failure`,error:e}},toString(){return`Exit.Failure(${n(e)})`},toJSON(){return{_tag:`Failure`,error:e}}}),Ot=e=>({[Symbol.toStringTag]:`Exit`,_tag:`Interrupted`,isSuccess(){return!1},isFailure(){return!1},isInterrupted(){return!0},map(t){return Ot(e)},mapError(t){return Ot(e)},mapBoth(t,n){return Ot(e)},flatMap(t){return Ot(e)},fold(t,n,r){if(r)return r(e);throw Error(`Effect was interrupted: ${e}`)},match(t){return t.Interrupted(e)},orThrow(){throw Error(`Effect was interrupted: ${e}`)},orElse(e){return e},toOption(){return p()},toEither(){throw Error(`Cannot convert Interrupted Exit to Either: ${e}`)},toValue(){return{_tag:`Interrupted`,fiberId:e}},toString(){return`Exit.Interrupted(${e})`},toJSON(){return{_tag:`Interrupted`,fiberId:e}}}),I=r(e=>F(e),{succeed:e=>F(e),fail:e=>Dt(e),interrupt:e=>Ot(e),interrupted:()=>Ot(`interrupted`),isSuccess:e=>e.isSuccess(),isFailure:e=>e.isFailure(),isInterrupted:e=>e.isInterrupted(),fromEither:e=>e.isRight()?F(e.value):Dt(e.value),fromOption:(e,t)=>e.isSome()?F(e.value):Dt(t()),zip:(e,t)=>e.isInterrupted()?e:t.isInterrupted()?t:e.isFailure()?e:t.isFailure()?t:F([e.orThrow(),t.orThrow()]),all:e=>{let t=[];for(let n of e){if(n.isInterrupted()||n.isFailure())return n;t.push(n.orThrow())}return F(t)}}),L=e=>e;var kt=class extends Error{constructor(e,t){super(t??`Effect timed out after ${e}ms`),this.duration=e,this._tag=`TimeoutError`,this.name=`TimeoutError`}},At=class extends Error{constructor(e){super(e??`Effect was interrupted`),this._tag=`InterruptedError`,this.name=`InterruptedError`}};const jt=Symbol.for(`functype/IO/effect`),R=e=>e[jt],z=e=>{let t={[Symbol.toStringTag]:`IO`,[jt]:e,map(e){return z(L({_tag:`Map`,effect:t,f:e}))},flatMap(e){return z(L({_tag:`FlatMap`,effect:t,f:e}))},tap(e){return t.map(t=>(e(t),t))},tapEffect(e){return t.flatMap(t=>e(t).map(()=>t))},mapError(e){return z(L({_tag:`MapError`,effect:t,f:e}))},tapError(e){return t.mapError(t=>(e(t),t))},recover(e){return z(L({_tag:`Recover`,effect:t,fallback:e}))},recoverWith(e){return z(L({_tag:`RecoverWith`,effect:t,f:e}))},fold(e,n){return z(L({_tag:`Fold`,effect:t,onFailure:e,onSuccess:n}))},match(e){return t.fold(e.failure,e.success)},catchTag(e,n){return z(L({_tag:`RecoverWith`,effect:t,f:t=>typeof t==`object`&&t&&`_tag`in t&&t._tag===e?L(n(t)):L(H.fail(t))}))},catchAll(e){return t.recoverWith(e)},retry(e){return e<=0?t:t.recoverWith(()=>t.retry(e-1))},retryWithDelay(e,n){return e<=0?t:t.recoverWith(()=>H.sleep(n).flatMap(()=>t.retryWithDelay(e-1,n)))},zipRight(e){return t.flatMap(()=>e)},zipLeft(e){return t.flatMap(t=>e.map(()=>t))},zip(e){return t.flatMap(t=>e.map(e=>[t,e]))},flatten(){return this.flatMap(e=>e)},provideContext(e){return z(L({_tag:`ProvideContext`,effect:t,context:e}))},provideService(e,n){return z(L({_tag:`ProvideContext`,effect:t,context:P.make(e,n)}))},provideLayer(e){return L(L(H.async(async()=>{let t=P.empty();return await e.build(L(t))})).flatMap(e=>z(L({_tag:`ProvideContext`,effect:t,context:e}))))},async run(){let e=await V(R(this));return e.isSuccess()?w(e.orThrow()):T(e.isFailure()?e.toValue().error:new At)},async runOrThrow(){let e=await V(R(this));if(e.isSuccess())return e.orThrow();throw e.isFailure()?e.toValue().error:new At},runSync(){try{return w(B(R(this)))}catch(e){return T(e)}},runSyncOrThrow(){return B(R(this))},async runExit(){return V(R(this))},async runOption(){let e=await V(R(this));return e.isSuccess()?d(e.orThrow()):p()},async runTry(){let e=await V(R(this));if(e.isSuccess())return L(x(()=>e.orThrow()));let t=e.isFailure()?e.toValue().error:Error(`Effect was interrupted`);return L(x(()=>{throw t}))},pipe(e){return e(t)},delay(e){return L(H.async(()=>new Promise(t=>setTimeout(t,e))).flatMap(()=>t))},timeout(e){return z(L({_tag:`Timeout`,effect:t,duration:e}))},timeoutTo(e,n){return L(t.timeout(e).recover(L(n)))},toString(){return`IO(${n(e._tag)})`},toJSON(){return{_tag:`IO`,effect:e._tag}},*[Symbol.iterator](){return yield t}};return t},B=(e,t=P.empty())=>{switch(e._tag){case`Succeed`:return e.value;case`Fail`:throw e.error;case`Die`:throw e.defect;case`Sync`:return e.thunk();case`Async`:throw Error(`Cannot run async effect synchronously`);case`Auto`:{let t=e.thunk();if(t instanceof Promise)throw Error(`Cannot run async effect synchronously`);return t}case`Map`:{let n=B(R(e.effect),t);return e.f(n)}case`FlatMap`:{let n=B(R(e.effect),t);return B(R(e.f(n)),t)}case`MapError`:try{return B(R(e.effect),t)}catch(t){throw e.f(t)}case`Recover`:try{return B(R(e.effect),t)}catch{return e.fallback}case`RecoverWith`:try{return L(B(R(e.effect),t))}catch(n){return B(R(e.f(n)),t)}case`Fold`:try{let n=B(R(e.effect),t);return e.onSuccess(n)}catch(t){return e.onFailure(t)}case`Service`:{let n=t.get(e.tag);if(n.isNone())throw Error(`Service not found: ${e.tag.id}`);return n.orThrow()}case`ProvideContext`:{let n=t.merge(e.context);return B(R(e.effect),n)}case`Interrupt`:throw new At;case`Bracket`:{let n=B(R(e.acquire),t);try{return B(R(e.use(n)),t)}finally{B(R(e.release(n)),t)}}case`BracketExit`:{let n=B(R(e.acquire),t),r;try{let i=B(R(e.use(n)),t);return r=L(I.succeed(i)),i}catch(e){throw r=L(I.fail(e)),e}finally{B(R(e.release(n,r)),t)}}case`Race`:throw Error(`Cannot run race effect synchronously`);case`Timeout`:throw Error(`Cannot run timeout effect synchronously`)}},V=async(e,t=P.empty())=>{try{switch(e._tag){case`Succeed`:return L(I.succeed(e.value));case`Fail`:return L(I.fail(e.error));case`Die`:throw e.defect;case`Sync`:return L(I.succeed(e.thunk()));case`Async`:{let t=await e.thunk();return L(I.succeed(t))}case`Auto`:{let t=e.thunk();return t instanceof Promise?L(I.succeed(await t)):L(I.succeed(t))}case`Map`:{let n=await V(R(e.effect),t);return n.isSuccess()?L(I.succeed(e.f(n.orThrow()))):L(n)}case`FlatMap`:{let n=await V(R(e.effect),t);return n.isSuccess()?V(R(e.f(n.orThrow())),t):L(n)}case`MapError`:{let n=await V(R(e.effect),t);return n.isSuccess()?L(n):n.isFailure()?L(I.fail(e.f(n.toValue().error))):L(n)}case`Recover`:{let n=await V(R(e.effect),t);return n.isSuccess()?n:I.succeed(e.fallback)}case`RecoverWith`:{let n=await V(R(e.effect),t);return n.isSuccess()?L(n):n.isFailure()?V(R(e.f(n.toValue().error)),t):L(n)}case`Fold`:{let n=await V(R(e.effect),t);return n.isSuccess()?I.succeed(e.onSuccess(n.orThrow())):n.isFailure()?I.succeed(e.onFailure(n.toValue().error)):n}case`Service`:{let n=t.get(e.tag);return n.isNone()?I.fail(Error(`Service not found: ${e.tag.id}`)):I.succeed(n.orThrow())}case`ProvideContext`:{let n=t.merge(e.context);return V(R(e.effect),n)}case`Interrupt`:return I.interrupted();case`Bracket`:{let n=await V(R(e.acquire),t);if(!n.isSuccess())return n;let r=n.orThrow();try{return await V(R(e.use(r)),t)}finally{await V(R(e.release(r)),t)}}case`BracketExit`:{let n=await V(R(e.acquire),t);if(!n.isSuccess())return n;let r=n.orThrow(),i=await V(R(e.use(r)),t);return await V(R(e.release(r,i)),t),i}case`Race`:return e.effects.length===0?I.fail(Error(`No effects to race`)):await Promise.race(e.effects.map(e=>V(R(e),t)));case`Timeout`:{let n=new Promise(t=>setTimeout(()=>t(I.fail(new kt(e.duration))),e.duration)),r=V(R(e.effect),t);return Promise.race([r,n])}}}catch(e){return I.fail(e)}},H={sync:e=>z({_tag:`Sync`,thunk:e}),succeed:e=>z({_tag:`Succeed`,value:e}),fail:e=>z({_tag:`Fail`,error:e}),die:e=>z({_tag:`Die`,defect:e}),async:e=>z(L({_tag:`Async`,thunk:e})),tryPromise:e=>z({_tag:`Async`,thunk:e.try}).mapError(e.catch),tryCatch:(e,t)=>H.sync(()=>{try{return e()}catch(e){throw t(e)}}),liftSync:e=>(...t)=>H.sync(()=>e(...t)),liftPromise:e=>(...t)=>H.async(()=>e(...t)),fromEither:e=>L(e.isRight()?H.succeed(e.value):H.fail(e.value)),fromOption:e=>L(e.isSome()?H.succeed(e.value):H.fail(void 0)),fromOptionOrFail:(e,t)=>L(e.isSome()?H.succeed(e.value):H.fail(t())),fromTry:e=>L(e.isSuccess()?H.succeed(e.orThrow()):H.fail(e.error)),fromResult:e=>L(e.error?H.fail(e.error):H.succeed(m(e.data))),tryAsync:(e,t,n)=>n?.aborted?L(H.fail(t(n.reason??new DOMException(`Aborted`,`AbortError`)))):H.async(()=>e(n)).mapError(t),asyncResult:(e,t,n)=>{let r=n?.dataKey??`data`,i=n?.errorKey??`error`;return H.tryAsync(t=>e(t),t,n?.signal).flatMap(e=>H.fromResult({data:e[r],error:e[i]}))},service:e=>z({_tag:`Service`,tag:e}),serviceWith:(e,t)=>H.service(e).map(t),serviceWithIO:(e,t)=>H.service(e).flatMap(t),withServices:(e,t)=>{let n=Object.entries(e);if(n.length===0)return L(z({_tag:`Auto`,thunk:()=>t({})}));let r=L(H.succeed({}));return L(n.reduce((e,[t,n])=>L(e.flatMap(e=>H.service(n).map(n=>({...e,[t]:n})))),r).flatMap(e=>z({_tag:`Auto`,thunk:()=>t(e)})))},all:e=>{if(e.length===0)return L(H.succeed([]));let t=L(H.succeed([]));return L(e.reduce((e,t)=>e.flatMap(e=>t.map(t=>[...e,t])),t))},firstSuccessOf:e=>e.length===0?L(H.fail(Error(`No effects provided`))):e.reduce((e,t)=>e.recoverWith(()=>t)),sleep:e=>L(H.async(()=>new Promise(t=>setTimeout(t,e)))),never:()=>L(H.async(()=>new Promise(()=>{}))),get unit(){return L(z({_tag:`Succeed`,value:void 0}))},fromNullable:e=>L(e==null?H.fail(void 0):H.succeed(e)),interrupt:()=>z({_tag:`Interrupt`}),bracket:(e,t,n)=>z({_tag:`Bracket`,acquire:e,use:t,release:n}),acquireRelease:(e,t,n)=>H.bracket(e,t,n),bracketExit:(e,t,n)=>z({_tag:`BracketExit`,acquire:e,use:t,release:n}),race:e=>z({_tag:`Race`,effects:e}),any:e=>e.length===0?L(H.fail(Error(`No effects provided`))):e.reduce((e,t)=>e.recoverWith(()=>t)),forEach:(e,t)=>{if(e.length===0)return L(H.succeed([]));let n=L(H.succeed([]));return L(e.reduce((e,n)=>e.flatMap(e=>t(n).map(t=>[...e,t])),n))},forEachPar:(e,t)=>H.forEach(e,t),timeout:(e,t)=>z(L({_tag:`Timeout`,effect:e,duration:t})),gen:e=>L(H.sync(()=>{let t=e(),n=e=>{let r=t.next(e);return r.done?L(H.succeed(r.value)):L(r.value.flatMap(e=>n(e)))};return n(void 0)}).flatMap(e=>e)),get Do(){return Mt(H.succeed({}))}},Mt=e=>({effect:e,bind(t,n){return Mt(e.flatMap(e=>n(e).map(n=>({...e,[t]:n}))))},let(t,n){return Mt(e.map(e=>({...e,[t]:n(e)})))},map(t){return e.map(t)},flatMap(t){return e.flatMap(t)},tap(t){return Mt(e.tap(t))},tapEffect(t){return Mt(e.tapEffect(t))},done(){return e}}),U=r(e=>z(L({_tag:`Auto`,thunk:e})),H),W=(e,t)=>({_tag:`Layer`,build:e,provideToAndMerge(t){return W(async n=>{let r=await e(n),i=n.merge(r),a=await t.build(i);return r.merge(a)})},merge(t){return W(async n=>{let[r,i]=await Promise.all([e(n),t.build(n)]);return r.merge(i)})},map(t){return W(async n=>t(await e(n)))},toString(){return`Layer(${t??`anonymous`})`}}),Nt={succeed:(e,t)=>W(()=>Promise.resolve(P.make(e,t)),e.id),effect:(e,t)=>W(async()=>{let n=await t();return P.make(e,n)},e.id),sync:(e,t)=>W(()=>Promise.resolve(P.make(e,t())),e.id),fromService:(e,t,n)=>W(r=>{let i=r.unsafeGet(t);return Promise.resolve(P.make(e,n(i)))},e.id),fromServiceEffect:(e,t,n)=>W(async r=>{let i=await n(r.unsafeGet(t));return P.make(e,i)},e.id),fromContext:e=>W(()=>Promise.resolve(e)),empty:()=>W(()=>Promise.resolve(P.empty()),`empty`),mergeAll:(...e)=>W(async t=>(await Promise.all(e.map(e=>e.build(t)))).reduce((e,t)=>e.merge(t),P.empty()))},Pt=e=>({id:e,_tag:`Tag`,toString(){return`Tag(${e})`}}),Ft=()=>{let e=0,t=[],n=async()=>{for(t.sort((e,t)=>e.time-t.time);t.length>0&&t[0]!==void 0&&t[0].time<=e;){let e=t.shift();e&&(e.resolve(),await Promise.resolve())}};return{get currentTime(){return e},async advance(t){e+=t,await n()},async setTime(t){e=t,await n()},async runAll(){if(t.length>0){let n=t[t.length-1];n&&(e=n.time)}await n()},get pendingCount(){return t.length},sleep(n){return new Promise(r=>{t.push({time:e+n,resolve:r})})}}},G=Pt(`TestClock`),It={make:Ft,tag:G,test:async e=>e(Ft()),get:U.service(G),advance:e=>U.serviceWithIO(G,t=>U.async(()=>t.advance(e))),setTime:e=>U.serviceWithIO(G,t=>U.async(()=>t.setTime(e))),runAll:U.serviceWithIO(G,e=>U.async(()=>e.runAll())),context:()=>{let e=Ft();return{clock:e,context:P.make(G,e)}}},Lt={make:()=>{let e=Ft(),t=P.empty(),n={get context(){return t},get clock(){return e},withService(e,r){return t=t.add(e,r),n},async run(e){return e.provideContext(t).runOrThrow()}};return n},withClock:()=>{let e=Ft();return Lt.make().withService(G,e)}},Rt=Pt(`HttpClient`),zt={},Bt=r({},{networkError:(e,t,n)=>({_tag:`NetworkError`,url:e,method:t,cause:n}),httpStatusError:(e,t,n,r,i)=>({_tag:`HttpStatusError`,url:e,method:t,status:n,statusText:r,body:i}),decodeError:(e,t,n,r)=>({_tag:`DecodeError`,url:e,method:t,body:n,cause:r}),isNetworkError:e=>e._tag===`NetworkError`,isHttpStatusError:e=>e._tag===`HttpStatusError`,isDecodeError:e=>e._tag===`DecodeError`,match:(e,t)=>{switch(e._tag){case`NetworkError`:return t.NetworkError(e);case`HttpStatusError`:return t.HttpStatusError(e);case`DecodeError`:return t.DecodeError(e)}}}),Vt=(e,t)=>!e||t.startsWith(`http://`)||t.startsWith(`https://`)?t:`${e.endsWith(`/`)?e.slice(0,-1):e}${t.startsWith(`/`)?t:`/${t}`}`,Ht=e=>e==null?{serialized:void 0,contentType:void 0}:typeof e==`string`?{serialized:e,contentType:void 0}:typeof e==`object`||Array.isArray(e)?{serialized:JSON.stringify(e),contentType:`application/json`}:{serialized:String(e),contentType:void 0},Ut=e=>{let t=e.get(`content-type`)??``;return t.includes(`application/json`)?`json`:t.startsWith(`text/`)?`text`:`raw`},Wt=async(e,t,n,r,i)=>{let a=t??Ut(e.headers),o,s={};switch(a){case`json`:{let t=await e.text();s.value=t;try{o=JSON.parse(t)}catch(e){throw Bt.decodeError(n,r,t,e)}break}case`text`:o=await e.text(),s.value=o;break;case`blob`:o=await e.blob();break;case`arrayBuffer`:o=await e.arrayBuffer();break;case`raw`:o=e;break}return{data:i?(()=>{try{return i(o)}catch(e){let t=s.value??(typeof o==`string`?o:JSON.stringify(o));throw Bt.decodeError(n,r,t,e)}})():o,status:e.status,statusText:e.statusText,headers:e.headers}},K=(e,t)=>{let n={url:Vt(e.baseUrl,t.url),method:t.method,headers:{...e.defaultHeaders,...t.headers},body:t.body,signal:t.signal,parseAs:t.parseAs};return(e.beforeRequest?e.beforeRequest(n):U.succeed(n)).flatMap(n=>{let{serialized:r,contentType:i}=Ht(n.body),a={...n.headers,...i?{"Content-Type":i}:{}};return U.tryAsync(i=>(e.fetch??globalThis.fetch)(n.url,{method:n.method,headers:a,body:r,signal:n.signal??i}).then(async e=>{if(!e.ok){let t=await e.text().catch(()=>``);throw Bt.httpStatusError(n.url,n.method,e.status,e.statusText,t)}return Wt(e,n.parseAs,n.url,n.method,t.validate)}),e=>typeof e==`object`&&e&&`_tag`in e?e:Bt.networkError(n.url,n.method,e))})},Gt=e=>K(zt,e),Kt=r({},{request:Gt,get:(e,t)=>Gt({...t,url:e,method:`GET`}),post:(e,t)=>Gt({...t,url:e,method:`POST`}),put:(e,t)=>Gt({...t,url:e,method:`PUT`}),patch:(e,t)=>Gt({...t,url:e,method:`PATCH`}),delete:(e,t)=>Gt({...t,url:e,method:`DELETE`}),head:(e,t)=>Gt({...t,url:e,method:`HEAD`,parseAs:`raw`}),options:(e,t)=>Gt({...t,url:e,method:`OPTIONS`,parseAs:`raw`}),client:e=>({request:t=>K(e,t),get:(t,n)=>K(e,{...n,url:t,method:`GET`}),post:(t,n)=>K(e,{...n,url:t,method:`POST`}),put:(t,n)=>K(e,{...n,url:t,method:`PUT`}),patch:(t,n)=>K(e,{...n,url:t,method:`PATCH`}),delete:(t,n)=>K(e,{...n,url:t,method:`DELETE`}),head:(t,n)=>K(e,{...n,url:t,method:`HEAD`,parseAs:`raw`}),options:(t,n)=>K(e,{...n,url:t,method:`OPTIONS`,parseAs:`raw`})})}),qt={toOption:e=>e.fold(()=>p(),e=>d(e)),toList:e=>e.fold(()=>C([]),e=>C([e])),toEither:(e,t)=>e.fold(()=>T(t),e=>w(e)),isEmpty:e=>e.fold(()=>!0,()=>!1),size:e=>e.fold(()=>0,()=>1)},Jt=e=>typeof e==`object`&&!!e&&(e._tag===`Some`||e._tag===`None`),q=e=>typeof e==`object`&&!!e&&e._tag===`List`,Yt=e=>typeof e==`object`&&!!e&&(e._tag===`Left`||e._tag===`Right`),Xt=e=>typeof e==`object`&&!!e&&(e._tag===`Success`||e._tag===`Failure`),J=()=>{let e=(e,t)=>{if(Jt(e)||q(e)||Yt(e)||Xt(e))return e.map(e=>t(e));throw Error(`Unsupported functor type: ${JSON.stringify(e)}`)},t=e=>{if(Jt(e))return e.orThrow();if(q(e)){let t=e.toArray();if(t.length>0&&q(t[0])){let e=[];for(let n of t)q(n)&&e.push(...n.toArray());return C(e)}return e.flatten()}if(Yt(e))return e.isRight()?e.fold(()=>null,e=>e):e;if(Xt(e))return e.isSuccess()?e.orThrow():e;throw Error(`Unsupported functor type for flatten: ${JSON.stringify(e)}`)},n=(e,t)=>{if(Jt(e)||q(e)||Yt(e)||Xt(e))return e.flatMap(e=>t(e));throw Error(`Unsupported functor type for flatMap: ${JSON.stringify(e)}`)},r=(e,t)=>{if(Jt(e)&&Jt(t)||q(e)&&q(t)||Yt(e)&&Yt(t)||Xt(e)&&Xt(t))return e.flatMap(e=>t.map(t=>e(t)));throw Error(`Unsupported functor type for ap: ${JSON.stringify(e)}`)},i=e=>{if(Jt(e)){let t=e;if(t.isEmpty)return C([m.none()]);let n=t.orThrow();if(q(n))return n.map(e=>m(e));throw Error(`Unsupported inner container type for sequence`)}if(q(e)){let t=e.toArray();if(t.length===0)return m.none();let n=t[0];if(Jt(n)){for(let e of t)if(e.isEmpty)return m.none();return m(C(t.map(e=>e.orThrow())))}throw Error(`Unsupported inner container type for sequence`)}throw Error(`Unsupported outer container type for sequence: ${JSON.stringify(e)}`)};return{_tag:`HKT`,map:e,flatten:t,flatMap:n,ap:r,sequence:i,traverse:(t,n)=>i(e(t,e=>n(e))),_type:`HKT`}},Zt=J();J.map=(e,t)=>Zt.map(e,t),J.flatten=e=>Zt.flatten(e),J.flatMap=(e,t)=>Zt.flatMap(e,t),J.ap=(e,t)=>Zt.ap(e,t),J.sequence=e=>Zt.sequence(e),J.traverse=(e,t)=>Zt.traverse(e,t),J.isOption=Jt,J.isList=q,J.isEither=Yt,J.isTry=Xt;const Qt=e=>({id:e,isSame:t=>t.id===e}),$t=r(Qt,{of:e=>Qt(e),pure:e=>Qt(e)}),Y=e=>{let t=!1,r,i,a=!1,o=()=>{if(!t)try{r=e(),t=!0}catch(e){throw i=e,a=!0,t=!0,e}if(a)throw i;return r};return{[Symbol.toStringTag]:`Lazy`,_tag:`Lazy`,get isEvaluated(){return t},orElse:e=>{try{return o()}catch{return e}},orNull:()=>{try{return o()}catch{return null}},orThrow:e=>{try{return o()}catch(t){throw e??t}},or:e=>X(()=>{try{return o()}catch{return e.orThrow()}}),orUndefined:()=>{try{return o()}catch{return}},map:e=>X(()=>e(o())),ap:e=>X(()=>e.orThrow()(o())),mapAsync:async e=>{let t=await e(o());return X(()=>t)},flatMap:e=>X(()=>e(o()).orThrow()),flatMapAsync:async e=>{let t=await e(o());return X(()=>t.orThrow())},filter:e=>X(()=>{let t=o();return e(t)?d(t):p}),recover:e=>X(()=>{try{return o()}catch(t){return e(t)}}),recoverWith:e=>X(()=>{try{return o()}catch(t){return e(t).orThrow()}}),toOption:()=>{try{return d(o())}catch{return p}},toEither:()=>{try{return w(o())}catch(e){return T(e)}},toEitherWith:e=>{try{return w(o())}catch(t){return T(e(t))}},toTry:()=>x(()=>o()),tap:e=>X(()=>{let t=o();return e(t),t}),tapError:e=>X(()=>{try{return o()}catch(t){throw e(t),t}}),fold:e=>e(o()),foldWith:(e,t)=>{try{return t(o())}catch(t){return e(t)}},foldLeft:e=>t=>t(e,o()),foldRight:e=>t=>t(o(),e),match:e=>e.Lazy(o()),toString:()=>t&&!a?`Lazy(${n(r)})`:t&&a?`Lazy(<error: ${i instanceof Error?i.message:String(i)}>)`:`Lazy(<not evaluated>)`,toValue:()=>t&&!a?{_tag:`Lazy`,evaluated:!0,value:r}:{_tag:`Lazy`,evaluated:!1},get size(){try{return o(),1}catch{return 0}},get isEmpty(){try{return o(),!1}catch{return!0}},contains:e=>{try{return o()===e}catch{return!1}},reduce:e=>o(),reduceRight:e=>o(),count:e=>{try{return+!!e(o())}catch{return 0}},find:e=>{try{let t=o();return e(t)?d(t):p}catch{return p}},exists:e=>{try{return e(o())}catch{return!1}},forEach:e=>{try{e(o())}catch{}},pipe:e=>e(o()),serialize:()=>({toJSON:()=>JSON.stringify(t&&!a?{_tag:`Lazy`,evaluated:!0,value:r}:{_tag:`Lazy`,evaluated:!1}),toYAML:()=>t&&!a?`_tag: Lazy\nevaluated: true\nvalue: ${n(r)}`:`_tag: Lazy
17
17
  evaluated: false`,toBinary:()=>Buffer.from(JSON.stringify(t&&!a?{_tag:`Lazy`,evaluated:!0,value:r}:{_tag:`Lazy`,evaluated:!1})).toString(`base64`)}),typeable:`Lazy`}},X=r(Y,{of:e=>Y(e),fromValue:e=>Y(()=>e),fromOption:(e,t)=>Y(()=>e._tag===`Some`?e.value:t()),fromTry:e=>Y(()=>e.orThrow()),fromEither:e=>Y(()=>e.fold(e=>{throw e},e=>e)),fromPromise:e=>Y(()=>{throw Error(`Promise not yet resolved. Use await on the promise before creating Lazy.`)}),fail:e=>Y(()=>{throw e})}),en=Map,Z=e=>{let t={values:new en(e)},n=()=>Array.from(t.values.entries()).map(([e,t])=>i([e,t])),r=e=>Z(new en(t.values).set(e.toArray()[0],e.toArray()[1]).entries()),a=e=>{let n=new en(t.values);return n.delete(e)?Z(n.entries()):Z(t.values.entries())},s=e=>{if(!e||typeof e.toArray!=`function`)return!1;let n=e.toArray();return t.values.get(n[0])===n[1]},c=()=>t.values.size,l=e=>Z(Array.from(t.values.entries()).map(([t,n])=>[t,e(n)])),u=e=>Z(Z(t.values.entries()).toList().flatMap(e).toArray()),ee=e=>{let n=[];for(let[r,i]of t.values.entries()){let t=e.get(r);t._tag===`Some`&&t.value&&n.push([r,t.value(i)])}return Z(n)},d=async e=>{let n=new en;for(let[r,i]of t.values.entries()){let t=await e(i);for(let e of t.toList()){let[t,r]=e.toArray();n.set(t,r)}}return Z(n.entries())},f=e=>C(n()).reduce(e),p=e=>C(n()).reduceRight(e),te=e=>t=>C(n()).foldLeft(e)(t),ne=e=>t=>C(n()).foldRight(e)(t),re=e=>m(t.values.get(e)),ie=(e,n)=>m(t.values.get(e)).orElse(n),h=()=>t.values.size===0,g=(e,n)=>m(t.values.get(e)).or(n),ae=(e,t)=>C(n()).fold(e,t),oe=()=>C(n()),se=()=>ce(n()),le=()=>`Map(${n().toString()})`,_=e=>h()?e.Empty():e.NonEmpty(n());return{[Symbol.toStringTag]:`FunctypeMap`,_tag:`Map`,[Symbol.iterator]:()=>t.values.entries(),add:r,remove:a,contains:s,get size(){return c()},map:l,ap:ee,flatMap:u,flatMapAsync:d,reduce:f,reduceRight:p,foldLeft:te,foldRight:ne,fold:ae,match:_,get:re,getOrElse:ie,get isEmpty(){return h()},orElse:g,toList:oe,toSet:se,toString:le,toValue:()=>({_tag:`Map`,value:Array.from(t.values.entries())}),pipe:e=>e(Array.from(t.values.entries())),serialize:()=>o(`Map`,Array.from(t.values.entries()))}},tn=e=>Z(e),nn=Z([]),rn={empty:()=>nn,of:(...e)=>Z(e),fromJSON:e=>an(JSON.parse(e).value),fromYAML:e=>{let t=e.split(`
18
18
  `)[1]?.split(`: `)[1];return an(t?JSON.parse(t):[])},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return rn.fromJSON(t)}},an=r(tn,rn),on={default:e=>t=>e(t),when:(e,t)=>n=>e(n)?t(n):void 0},Q=e=>({[Symbol.toStringTag]:`Obj`,_tag:`Obj`,data:e,get:t=>m(e[t]),set:(t,n)=>Q({...e,[t]:n}),assign:t=>Q({...e,...t}),merge:t=>Q({...e,...t}),when:(t,n)=>(typeof t==`function`?t():t)?Q({...e,...n}):Q(e),omit:(...t)=>{let n={...e};for(let e of t)delete n[e];return Q(n)},pick:(...t)=>{let n={};for(let r of t)r in e&&(n[r]=e[r]);return Q(n)},keys:()=>C(Object.keys(e)),values:()=>C(Object.values(e)),entries:()=>C(Object.entries(e).map(([e,t])=>i([e,t]))),has:t=>t in e,value:()=>e,get isEmpty(){return Object.keys(e).length===0},get size(){return Object.keys(e).length},map:t=>Q(t(e)),flatMap:t=>t(e),flatMapAsync:async t=>await t(e),ap:t=>{let n=t.data;return Q(n(e))},fold:(t,n)=>Object.keys(e).length===0?t():n(e),match:t=>t.Obj(e),foldLeft:t=>n=>n(t,e),foldRight:t=>n=>n(e,t),count:t=>+!!t(e),find:t=>t(e)?m(e):m(void 0),exists:t=>t(e),forEach:t=>t(e),reduce:t=>e,reduceRight:t=>e,contains:t=>JSON.stringify(e)===JSON.stringify(t),orElse:t=>e,orThrow:t=>e,or:t=>Q(e),orNull:()=>e,orUndefined:()=>e,toOption:()=>m(e),toEither:t=>w(e),toList:()=>C([e]),toTry:()=>x(()=>e),toPromise:()=>Promise.resolve(e),toString:()=>`Obj(${n(e)})`,toValue:()=>({_tag:`Obj`,value:e}),pipe:t=>t(e),serialize:()=>o(`Obj`,e),doUnwrap(){return{ok:!0,value:e}}}),sn=e=>Q(e),cn={of:e=>Q(e),empty:()=>Q({}),fromJSON:e=>Q(JSON.parse(e).value),fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return cn.fromJSON(t)}},ln=r(sn,cn),$=(e=[])=>{let t=[...e],r=()=>t.length,i=()=>t.length===0,a=e=>t.includes(e),o=e=>{if(t.length===0)throw Error(`Cannot reduce an empty stack`);return re(t,e)},s=e=>{if(t.length===0)throw Error(`Cannot reduce an empty stack`);return ie(t,e)},c=e=>$([...t,e]),l=()=>{if(i())return[$([]),m(null)];let e=[...t],n=e.pop();return[$(e),m(n)]},u=()=>i()?m(null):m(t[t.length-1]),ee=e=>$(t.map(e)),d=e=>i()?$([]):t.reduce((t,n)=>e(n).toArray().reduce((e,t)=>e.push(t),t),$([])),f=e=>{let n=[];return t.forEach(t=>{e.toArray().forEach(e=>{n.push(e(t))})}),$(n)},p=async e=>i()?$([]):(await Promise.all(t.map(async t=>await e(t)))).reduce((e,t)=>t.toArray().reduce((e,t)=>e.push(t),e),$([])),te=()=>C(t),ne=()=>[...t],h=()=>`Stack(${t.join(`, `)})`,g=(e,n)=>t.reduce(n,e),ae=e=>n=>t.reduce(n,e),oe=e=>n=>t.reduceRight((e,t)=>n(t,e),e),se=e=>i()?e.Empty():e.NonEmpty([...t]);return{[Symbol.toStringTag]:`Stack`,_tag:`Stack`,get size(){return r()},get isEmpty(){return i()},contains:a,reduce:o,reduceRight:s,push:c,pop:l,peek:u,map:ee,flatMap:d,ap:f,flatMapAsync:p,toList:te,toArray:ne,toString:h,fold:g,foldLeft:ae,foldRight:oe,match:se,toValue:()=>({_tag:`Stack`,value:t}),pipe:e=>e([...t]),serialize:()=>({toJSON:()=>JSON.stringify({_tag:`Stack`,value:t}),toYAML:()=>`_tag: Stack\nvalue: ${n(t)}`,toBinary:()=>Buffer.from(JSON.stringify({_tag:`Stack`,value:t})).toString(`base64`)})}},un=(e=[])=>$(e),dn={empty:()=>$([]),of:e=>$([e]),fromJSON:e=>fn(JSON.parse(e).value),fromYAML:e=>{let t=e.split(`
19
19
  `)[1]?.split(`: `)[1];return fn(t?JSON.parse(t):[])},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return dn.fromJSON(t)}},fn=r(un,dn);function pn(e){let t=he({_tag:e._tag,impl:e.impl});return{...t,toValue:()=>({_tag:t._tag,value:e.value})}}export{Ie as $,_t as A,te as At,O as B,P as C,fe as Ct,bt as D,re as Dt,M as E,ie as Et,ht as F,u as Ft,Ze as G,A as H,pt as I,c as It,Ye as J,Qe as K,ft as L,l as Lt,ot as M,s as Mt,ct as N,ee as Nt,yt as O,p as Ot,mt as P,o as Pt,Ve as Q,lt as R,a as Rt,I as S,x as St,Ct as T,ce as Tt,tt as U,k as V,$e as W,Ue as X,Ke as Y,Be as Z,Pt as _,we as _t,an as a,Pe as at,At as b,he as bt,$t as c,Le as ct,Kt as d,T as dt,ze as et,Bt as f,w as ft,Lt as g,Se as gt,G as h,Ce as ht,on as i,He as it,dt as j,d as jt,vt as k,m as kt,J as l,E as lt,It as m,Te as mt,fn as n,Fe as nt,en as o,je as ot,Rt as p,Ee as pt,Xe as q,ln as r,Me as rt,X as s,Re as st,pn as t,Ne as tt,qt as u,Ae as ut,Nt as v,De as vt,Tt as w,_ as wt,kt as x,ge as xt,U as y,C as yt,ut as z};
@@ -1,2 +1,2 @@
1
- import { Xn as TypeNames, Yn as Try } from "../index-DZR10yks.js";
1
+ import { Xn as Try, Zn as TypeNames } from "../index-BYF5RMBp.js";
2
2
  export { Try, TypeNames };
package/dist/try/index.js CHANGED
@@ -1 +1 @@
1
- import{St as e}from"../src-BxyCNnFT.js";export{e as Try};
1
+ import{St as e}from"../src-Djzr1skt.js";export{e as Try};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functype",
3
- "version": "0.60.7",
3
+ "version": "0.61.0",
4
4
  "type": "module",
5
5
  "description": "A functional programming library for TypeScript, using immutable data structures and type classes",
6
6
  "keywords": [
@@ -31,14 +31,14 @@
31
31
  "devDependencies": {
32
32
  "@eslint/compat": "^2.1.0",
33
33
  "@types/node": "~24.10.15",
34
- "eslint-plugin-functional": "^9.0.4",
34
+ "eslint-plugin-functional": "^9.0.5",
35
35
  "fast-check": "^4.8.0",
36
36
  "globals": "^17.6.0",
37
- "ts-builds": "^2.8.0",
37
+ "ts-builds": "^2.8.1",
38
38
  "tsdown": "^0.22.0",
39
- "tsx": "^4.22.2",
39
+ "tsx": "^4.22.3",
40
40
  "typedoc": "^0.28.19",
41
- "eslint-config-functype": "^2.60.7"
41
+ "eslint-config-functype": "^2.61.0"
42
42
  },
43
43
  "types": "./dist/index.d.ts",
44
44
  "module": "./dist/index.js",
@@ -177,6 +177,7 @@
177
177
  "test:ui": "ts-builds test:ui",
178
178
  "build": "ts-builds build",
179
179
  "extract:interfaces": "ts-builds extract:interfaces",
180
+ "generate:interfaces": "tsx scripts/generate-interfaces.ts",
180
181
  "build:watch": "ts-builds dev",
181
182
  "dev": "ts-builds dev",
182
183
  "compile": "ts-builds compile",