functype 1.27.2 → 2.1.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.
Files changed (181) hide show
  1. package/README.md +70 -88
  2. package/dist/_virtual/_rolldown/runtime.js +1 -0
  3. package/dist/branded/ValidatedBrand.d.ts +122 -0
  4. package/dist/branded/ValidatedBrand.js +1 -0
  5. package/dist/branded/index.d.ts +52 -2
  6. package/dist/cli/data.d.ts +37 -0
  7. package/dist/cli/data.js +1 -0
  8. package/dist/cli/exports.d.ts +5 -46
  9. package/dist/cli/exports.js +1 -1
  10. package/dist/cli/formatters.js +4 -0
  11. package/dist/cli/full-interfaces.d.ts +6 -0
  12. package/dist/cli/full-interfaces.js +1150 -0
  13. package/dist/cli/index.js +3 -6
  14. package/dist/cli/interfaces.generated.js +1 -0
  15. package/dist/collections/index.d.ts +13 -0
  16. package/dist/companion/Companion.d.ts +23 -0
  17. package/dist/companion/Companion.js +1 -0
  18. package/dist/companion/CompanionTypes.d.ts +30 -0
  19. package/dist/{CompanionTypes-BVqO7Kc2.js → companion/CompanionTypes.js} +1 -1
  20. package/dist/companion/index.d.ts +2 -1
  21. package/dist/companion/index.js +1 -1
  22. package/dist/conditional/Cond.d.ts +147 -0
  23. package/dist/conditional/Cond.js +1 -0
  24. package/dist/conditional/Match.d.ts +295 -0
  25. package/dist/conditional/Match.js +1 -0
  26. package/dist/conditional/index.d.ts +3 -2
  27. package/dist/conditional/index.js +1 -1
  28. package/dist/core/base/Base.d.ts +12 -0
  29. package/dist/core/base/Base.js +1 -0
  30. package/dist/core/throwable/Throwable.d.ts +38 -0
  31. package/dist/core/throwable/Throwable.js +1 -0
  32. package/dist/decoder/Decoder.d.ts +15 -0
  33. package/dist/decoder/DecoderCompanion.js +1 -0
  34. package/dist/decoder/DecoderError.d.ts +56 -0
  35. package/dist/decoder/DecoderError.js +2 -0
  36. package/dist/decoder/Encoder.d.ts +15 -0
  37. package/dist/decoder/index.d.ts +71 -2
  38. package/dist/decoder/index.js +1 -1
  39. package/dist/decoder/tagged.js +1 -0
  40. package/dist/do/index.d.ts +246 -2
  41. package/dist/do/index.js +1 -1
  42. package/dist/do/protocol.d.ts +29 -0
  43. package/dist/either/index.d.ts +290 -2
  44. package/dist/either/index.js +1 -1
  45. package/dist/error/ErrorChain.d.ts +60 -0
  46. package/dist/error/ErrorChain.js +4 -0
  47. package/dist/error/ErrorFormatter.d.ts +67 -0
  48. package/dist/error/ErrorFormatter.js +6 -0
  49. package/dist/error/ParseError.d.ts +6 -0
  50. package/dist/error/ParseError.js +1 -0
  51. package/dist/error/typed/TypedError.d.ts +146 -0
  52. package/dist/error/typed/TypedError.js +1 -0
  53. package/dist/error/typed/Validation.d.ts +76 -0
  54. package/dist/error/typed/Validation.js +1 -0
  55. package/dist/extractable/Extractable.d.ts +62 -0
  56. package/dist/extractable/Extractable.js +1 -0
  57. package/dist/fetch/Http.d.ts +32 -0
  58. package/dist/fetch/Http.js +1 -0
  59. package/dist/fetch/HttpClient.d.ts +80 -0
  60. package/dist/fetch/HttpClient.js +1 -0
  61. package/dist/fetch/HttpError.d.ts +57 -0
  62. package/dist/fetch/HttpError.js +1 -0
  63. package/dist/fetch/HttpRequest.d.ts +103 -0
  64. package/dist/fetch/index.d.ts +5 -2
  65. package/dist/fetch/index.js +1 -1
  66. package/dist/foldable/Foldable.d.ts +27 -0
  67. package/dist/foldable/index.d.ts +55 -0
  68. package/dist/foldable/index.js +1 -0
  69. package/dist/functype/Functype.d.ts +76 -0
  70. package/dist/functype/FunctypeSum.d.ts +39 -0
  71. package/dist/functype/index.d.ts +4 -2
  72. package/dist/hkt/index.d.ts +68 -0
  73. package/dist/hkt/index.js +1 -0
  74. package/dist/identity/Identity.d.ts +34 -0
  75. package/dist/identity/Identity.js +1 -0
  76. package/dist/index.d.ts +74 -8
  77. package/dist/index.js +1 -1
  78. package/dist/internal/base64.js +1 -0
  79. package/dist/internal/call-alone.js +1 -0
  80. package/dist/internal/concurrency.d.ts +11 -0
  81. package/dist/internal/concurrency.js +1 -0
  82. package/dist/internal/define.js +1 -0
  83. package/dist/internal/mutation-utils.js +1 -0
  84. package/dist/internal/signal.js +1 -0
  85. package/dist/internal/stringify.js +1 -0
  86. package/dist/invariant/index.d.ts +32 -2
  87. package/dist/io/Context.d.ts +112 -0
  88. package/dist/io/Context.js +1 -0
  89. package/dist/io/Exit.d.ts +249 -0
  90. package/dist/io/Exit.js +1 -0
  91. package/dist/io/IO.d.ts +1263 -0
  92. package/dist/io/IO.js +1 -0
  93. package/dist/io/Layer.d.ts +139 -0
  94. package/dist/io/Layer.js +1 -0
  95. package/dist/io/SpanTracer.d.ts +78 -0
  96. package/dist/io/SpanTracer.js +1 -0
  97. package/dist/io/Tag.d.ts +75 -0
  98. package/dist/io/Tag.js +1 -0
  99. package/dist/io/TestClock.d.ts +133 -0
  100. package/dist/io/TestClock.js +1 -0
  101. package/dist/io/index.d.ts +41 -2
  102. package/dist/io/index.js +1 -1
  103. package/dist/lazy/Lazy.d.ts +312 -0
  104. package/dist/lazy/Lazy.js +1 -0
  105. package/dist/lazy/index.d.ts +2 -2
  106. package/dist/lazy/index.js +1 -1
  107. package/dist/list/LazyList.d.ts +182 -0
  108. package/dist/list/LazyList.js +1 -0
  109. package/dist/list/index.d.ts +137 -2
  110. package/dist/list/index.js +1 -1
  111. package/dist/logger/index.d.ts +24 -2
  112. package/dist/map/index.d.ts +95 -2
  113. package/dist/map/index.js +1 -1
  114. package/dist/map/shim.d.ts +13 -0
  115. package/dist/map/shim.js +1 -0
  116. package/dist/matchable/Matchable.d.ts +38 -0
  117. package/dist/matchable/Matchable.js +1 -0
  118. package/dist/obj/Obj.d.ts +212 -0
  119. package/dist/obj/Obj.js +1 -0
  120. package/dist/obj/index.d.ts +2 -2
  121. package/dist/obj/index.js +1 -1
  122. package/dist/option/index.d.ts +304 -2
  123. package/dist/option/index.js +1 -1
  124. package/dist/package.json.js +1 -0
  125. package/dist/pipe/index.d.ts +14 -0
  126. package/dist/ref/Ref.d.ts +77 -0
  127. package/dist/ref/Ref.js +1 -0
  128. package/dist/reshapeable/Reshapeable.d.ts +90 -0
  129. package/dist/serializable/Serializable.d.ts +39 -0
  130. package/dist/serialization/Serialization.d.ts +147 -0
  131. package/dist/serialization/Serialization.js +1 -0
  132. package/dist/serialization/SerializationCompanion.d.ts +125 -0
  133. package/dist/serialization/SerializationCompanion.js +1 -0
  134. package/dist/serialization/error-envelope.d.ts +44 -0
  135. package/dist/serialization/error-envelope.js +1 -0
  136. package/dist/serialization/index.d.ts +4 -2
  137. package/dist/serialization/index.js +1 -1
  138. package/dist/set/index.d.ts +106 -2
  139. package/dist/set/index.js +1 -1
  140. package/dist/stack/Stack.d.ts +120 -0
  141. package/dist/stack/Stack.js +1 -0
  142. package/dist/traced/TraceEvent.d.ts +27 -0
  143. package/dist/traced/TracedOption.d.ts +46 -0
  144. package/dist/traced/TracedOption.js +1 -0
  145. package/dist/traced/Tracer.d.ts +26 -0
  146. package/dist/traversable/KVTraversable.d.ts +14 -0
  147. package/dist/traversable/Traversable.d.ts +30 -0
  148. package/dist/try/index.d.ts +238 -2
  149. package/dist/try/index.js +1 -1
  150. package/dist/tuple/index.d.ts +92 -2
  151. package/dist/tuple/index.js +1 -1
  152. package/dist/typeable/Typeable.d.ts +40 -0
  153. package/dist/typeable/Typeable.js +1 -0
  154. package/dist/typeclass/ContainerOps.d.ts +131 -0
  155. package/dist/typeclass/Functor.d.ts +41 -0
  156. package/dist/typeclass/Promisable.d.ts +33 -0
  157. package/dist/typeclass/index.d.ts +4 -1
  158. package/dist/typeclass/index.js +1 -1
  159. package/dist/typeclass/variance.d.ts +54 -0
  160. package/dist/typeclass/variance.js +1 -0
  161. package/dist/types/index.d.ts +1 -0
  162. package/dist/util/index.d.ts +1 -3
  163. package/dist/valuable/Valuable.d.ts +28 -0
  164. package/dist/valuable/Valuable.js +1 -0
  165. package/dist/wire/index.d.ts +40 -2
  166. package/package.json +8 -13
  167. package/dist/Brand-bfnGXuum.d.ts +0 -54
  168. package/dist/Companion-DiOMBHDG.js +0 -1
  169. package/dist/CompanionTypes-Cc90cQ4P.d.ts +0 -58
  170. package/dist/Invariant-DEan-SxV.d.ts +0 -35
  171. package/dist/Logger-BmprRS8v.d.ts +0 -27
  172. package/dist/Tuple-B8KM-H8Y.d.ts +0 -213
  173. package/dist/Wire-3hvw0Ogg.d.ts +0 -42
  174. package/dist/core/task/index.d.ts +0 -2
  175. package/dist/core/task/index.js +0 -1
  176. package/dist/full-interfaces-BadxJrCt.js +0 -1202
  177. package/dist/index-CLYh2qZu.d.ts +0 -6649
  178. package/dist/rolldown-runtime-DK3Fl9T5.js +0 -1
  179. package/dist/serialization-9_SyrfdG.js +0 -3
  180. package/dist/src-BQPeS6p2.js +0 -10
  181. package/dist/typeclass-C61yDVYd.js +0 -1
@@ -0,0 +1,39 @@
1
+ import { Foldable } from "../foldable/Foldable.js";
2
+ import { Serializable } from "../serializable/Serializable.js";
3
+ import { Typeable } from "../typeable/Typeable.js";
4
+ import { AsyncMonad } from "../typeclass/Functor.js";
5
+ import { Type } from "../types/index.js";
6
+ /**
7
+ * Base interface for sum-type containers (Either, Try, etc.) that are NOT iterables.
8
+ *
9
+ * Unlike `FunctypeBase`, this base deliberately excludes `Traversable` — which bundles
10
+ * `reduce` / `reduceRight` / `size` / `isEmpty`. Those methods force A-invariance on their
11
+ * containers (signature `(f: (A, A) => A) => A` puts A in both contravariant and covariant
12
+ * positions) and have no semantic meaning for disjoint-union types where the "success"
13
+ * branch is 0-or-1, not a collection.
14
+ *
15
+ * Sum types that extend `FunctypeSum` can be declared covariant in their type parameter
16
+ * (`interface Foo<out A>`) without structural check failures. This mirrors Scala's model:
17
+ * `Either[+L, +R]` and `Try[+T]` do not extend `Iterable`; only `Option[+A]` extends the
18
+ * lighter `IterableOnce[+A]`.
19
+ *
20
+ * Only the covariance-safe subset of `ContainerOps` is included inline: `contains`,
21
+ * `exists`, `every` and `forEach` all place A only in contravariant (callback input) position.
22
+ * `find` (returns `Option<A>`) and `count` are intentionally omitted — if a sum type
23
+ * needs them it can declare them directly.
24
+ *
25
+ * @typeParam A - the type of the "success" branch value
26
+ * @typeParam Tag - the discriminant tag (e.g., `"Left" | "Right"`, `"Success" | "Failure"`)
27
+ */
28
+ export interface FunctypeSum<A extends Type, Tag extends string = string> extends AsyncMonad<A>, Foldable<A>, Serializable<A>, Typeable<Tag> {
29
+ readonly _tag: Tag;
30
+ readonly [Symbol.toStringTag]: string;
31
+ contains(value: A): boolean;
32
+ exists(p: (a: A) => boolean): boolean;
33
+ /**
34
+ * Tests whether the success value, if there is one, satisfies the predicate. The dual of
35
+ * `exists`, and Scala's `forall`: with no success value it gives `true`, as `[].every(p)` does.
36
+ */
37
+ every(p: (a: A) => boolean): boolean;
38
+ forEach(f: (a: A) => void): void;
39
+ }
@@ -1,2 +1,4 @@
1
- import { An as FunctypeBase, Fr as ConcurrencyOptions, On as FunctypeSum, Pr as Concurrency, jn as FunctypeCollection, kn as Functype } from "../index-CLYh2qZu.js";
2
- export { type Concurrency, type ConcurrencyOptions, Functype, FunctypeBase, FunctypeCollection, FunctypeSum };
1
+ import { Functype, FunctypeBase, FunctypeCollection, FunctypeCore, FunctypeValue } from "./Functype.js";
2
+ import { FunctypeSum } from "./FunctypeSum.js";
3
+ import { Concurrency, ConcurrencyOptions } from "../internal/concurrency.js";
4
+ export { type Concurrency, type ConcurrencyOptions, Functype, FunctypeBase, FunctypeCollection, FunctypeCore, FunctypeSum, FunctypeValue };
@@ -0,0 +1,68 @@
1
+ import { Either } from "../either/index.js";
2
+ import { List } from "../list/index.js";
3
+ import { Option } from "../option/index.js";
4
+ import { Try } from "../try/index.js";
5
+ import { Type } from "../types/index.js";
6
+ /**
7
+ * Type function for representing higher-kinded types
8
+ */
9
+ export type Kind<F, A> = F extends ((arg: infer T) => infer R) ? R : never;
10
+ /**
11
+ * Type constructors for common Functype data types
12
+ */
13
+ export type OptionKind = <A>(a: A) => Option<A>;
14
+ export type ListKind = <A>(a: A) => List<A>;
15
+ export type EitherKind<E> = <A>(a: A) => Either<E, A>;
16
+ export type TryKind = <A>(a: A) => Try<A>;
17
+ /**
18
+ * Generic container types for type-safe operations
19
+ * @internal
20
+ */
21
+ type Mappable<T> = {
22
+ map<U>(f: (value: T) => U): unknown;
23
+ };
24
+ /**
25
+ * @internal
26
+ */
27
+ type Flattenable = {
28
+ flatten(): unknown;
29
+ };
30
+ /**
31
+ * @internal
32
+ */
33
+ type FlatMappable<T> = {
34
+ flatMap<U>(f: (value: T) => unknown): unknown;
35
+ };
36
+ /**
37
+ * Universal type that includes all potential return types from the HKT functions
38
+ * Used to avoid 'any' usage which the linter prohibits
39
+ */
40
+ export type UniversalContainer = Option<unknown> | List<unknown> | Either<unknown, unknown> | Try<unknown>;
41
+ /**
42
+ * HKT provides utilities for working with higher-kinded types
43
+ * This allows writing generic code that works across different
44
+ * container types like Option, List, Either, etc.
45
+ */
46
+ export declare const HKT: {
47
+ (): {
48
+ _tag: string;
49
+ map: <F, A, B>(fa: unknown, f: (a: A) => B) => unknown;
50
+ flatten: <F, A>(ffa: unknown) => unknown;
51
+ flatMap: <F, A, B>(fa: unknown, f: (a: A) => unknown) => unknown;
52
+ ap: <F, A, B>(ff: unknown, fa: unknown) => unknown;
53
+ sequence: <F, G, A>(fga: unknown) => unknown;
54
+ traverse: <F, G, A, B>(fa: unknown, f: (a: A) => unknown) => unknown;
55
+ _type: string;
56
+ };
57
+ map<F = unknown, A = unknown, B = unknown>(fa: unknown, f: (a: A) => B): unknown;
58
+ flatten<F = unknown, A = unknown>(ffa: unknown): unknown;
59
+ flatMap<F = unknown, A = unknown, B = unknown>(fa: unknown, f: (a: A) => unknown): unknown;
60
+ ap<F = unknown, A = unknown, B = unknown>(ff: unknown, fa: unknown): unknown;
61
+ sequence<F = unknown, G = unknown, A = unknown>(fga: unknown): unknown;
62
+ traverse<F = unknown, G = unknown, A = unknown, B = unknown>(fa: unknown, f: (a: A) => unknown): unknown;
63
+ isOption: <T extends Type>(value: unknown) => value is Option<T> & Mappable<T> & FlatMappable<T>;
64
+ isList: <T extends Type>(value: unknown) => value is List<T> & Mappable<T> & Flattenable & FlatMappable<T>;
65
+ isEither: <E extends Type, A extends Type>(value: unknown) => value is Either<E, A> & Mappable<A> & FlatMappable<A>;
66
+ isTry: <T extends Type>(value: unknown) => value is Try<T> & Mappable<T> & FlatMappable<T>;
67
+ };
68
+ export {};
@@ -0,0 +1 @@
1
+ import{List as e}from"../list/index.js";import{Option as t}from"../option/index.js";const n=e=>typeof e==`object`&&!!e&&(e._tag===`Some`||e._tag===`None`),r=e=>typeof e==`object`&&!!e&&e._tag===`List`,i=e=>typeof e==`object`&&!!e&&(e._tag===`Left`||e._tag===`Right`),a=e=>typeof e==`object`&&!!e&&(e._tag===`Success`||e._tag===`Failure`),o=()=>{let o=(e,t)=>{if(n(e)||r(e)||i(e)||a(e))return e.map(e=>t(e));throw Error(`Unsupported functor type: ${JSON.stringify(e)}`)},s=t=>{if(n(t))return t.orThrow();if(r(t)){let n=t.toArray();if(n.length>0&&r(n[0])){let t=[];for(let e of n)r(e)&&t.push(...e.toArray());return e(t)}return t.flatten()}if(i(t))return t.isRight()?t.fold(()=>null,e=>e):t;if(a(t))return t.isSuccess()?t.orThrow():t;throw Error(`Unsupported functor type for flatten: ${JSON.stringify(t)}`)},c=(e,t)=>{if(n(e)||r(e)||i(e)||a(e))return e.flatMap(e=>t(e));throw Error(`Unsupported functor type for flatMap: ${JSON.stringify(e)}`)},l=(e,t)=>{if(n(e)&&n(t)||r(e)&&r(t)||i(e)&&i(t)||a(e)&&a(t))return e.flatMap(e=>t.map(t=>e(t)));throw Error(`Unsupported functor type for ap: ${JSON.stringify(e)}`)},u=i=>{if(n(i)){let n=i;if(n.isEmpty)return e([t.none()]);let a=n.orThrow();if(r(a))return a.map(e=>t(e));throw Error(`Unsupported inner container type for sequence`)}if(r(i)){let r=i.toArray();if(r.length===0)return t.none();let a=r[0];if(n(a)){for(let e of r)if(e.isEmpty)return t.none();let n=r.map(e=>e.orThrow());return t(e(n))}throw Error(`Unsupported inner container type for sequence`)}throw Error(`Unsupported outer container type for sequence: ${JSON.stringify(i)}`)};return{_tag:`HKT`,map:o,flatten:s,flatMap:c,ap:l,sequence:u,traverse:(e,t)=>u(o(e,e=>t(e))),_type:`HKT`}},s=o();o.map=(e,t)=>s.map(e,t),o.flatten=e=>s.flatten(e),o.flatMap=(e,t)=>s.flatMap(e,t),o.ap=(e,t)=>s.ap(e,t),o.sequence=e=>s.sequence(e),o.traverse=(e,t)=>s.traverse(e,t),o.isOption=n,o.isList=r,o.isEither=i,o.isTry=a;export{o as HKT};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Identity — a trivial container carrying a single tagged value.
3
+ * Covariant in T (`<out T>`). `isSame` takes `Identity<unknown>` so that
4
+ * cross-type equality checks (semantically always `false` for unrelated types)
5
+ * don't block variance — mirroring the `contains(unknown)` pattern used on
6
+ * List/Set/Map.
7
+ */
8
+ export type Identity<out T> = {
9
+ readonly _tag: "Identity";
10
+ readonly id: T;
11
+ /** True when `other` holds the same value, compared with `===`. */
12
+ isSame(other: Identity<unknown>): boolean;
13
+ };
14
+ declare const IdentityConstructor: <T>(value: T) => Identity<T>;
15
+ declare const IdentityStatics: {
16
+ /**
17
+ * Creates an Identity. Alias for Identity constructor.
18
+ * @param value - The value to wrap
19
+ * @returns Identity instance
20
+ */
21
+ of: <T>(value: T) => Identity<T>;
22
+ /**
23
+ * Creates an Identity. Same as of.
24
+ * @param value - The value to wrap
25
+ * @returns Identity instance
26
+ */
27
+ pure: <T>(value: T) => Identity<T>;
28
+ };
29
+ export declare const Identity: IdentityCompanion;
30
+ /** The type of `Identity`: its constructor and its statics, named so that errors and hovers print `IdentityCompanion`. */
31
+ export interface IdentityCompanion extends IdentityConstructorType, IdentityStaticsType {}
32
+ type IdentityConstructorType = typeof IdentityConstructor;
33
+ type IdentityStaticsType = typeof IdentityStatics;
34
+ export {};
@@ -0,0 +1 @@
1
+ import{Companion as e}from"../companion/Companion.js";import{define as t}from"../internal/define.js";const n=t()(`Identity`,{isSame(e){return e.id===this.id}}),r=e=>{let t=Object.create(n);return t._tag=`Identity`,t.id=e,t},i=e(r,{of:e=>r(e),pure:e=>r(e)});export{i as Identity};
package/dist/index.d.ts CHANGED
@@ -1,8 +1,74 @@
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-bfnGXuum.js";
2
- import { i as Companion, n as InstanceType, r as isCompanion, t as CompanionMethods } from "./CompanionTypes-Cc90cQ4P.js";
3
- import { a as isTypeable, c as SerializationMethods, d as Type, i as TypeableParams, l as Pipe, n as ExtractTag, o as Serializable, r as Typeable, s as SerializableEnvelope, t as Tuple, u as Foldable } from "./Tuple-B8KM-H8Y.js";
4
- import { $ as TimeoutError, $n as fromBinary, $t as Sync, A as Http, An as FunctypeBase, Ar as Flattened, At as safeStringify, B as HttpError, Bn as TypeNames, Bt as NoneError, C as HKT, Cn as PositiveNumber, Cr as Promisable, Ct as ErrorChainElement, D as TryKind, Dn as ValidatedBrandCompanion, Dr as Monad, Dt as createErrorSerializer, E as OptionKind, En as ValidatedBrand, Er as Functor, Et as TaskErrorInfo, F as HttpRequestOptions, Fn as Collection, Fr as ConcurrencyOptions, Ft as EmptyListError, G as TestClock, Gn as ParsedEnvelope, Gt as DecoderError, H as HttpStatusError, Hn as Serialization_d_exports, Ht as unwrap, I as HttpRequestView, In as Set, Ir as DoResult, It as FailureError, J as IO, Jn as createSerializationCompanion, Jt as Async, K as TestClockTag, Kn as SerializationResult, Kt as DecoderErrorComposite, L as HttpResponse, Ln as List, Lr as Doable, Lt as FailureErrorType, M as HttpClientConfig, Mn as Traversable, Mr as isExtractable, Mt as Do, N as HttpMethodOptions, Nn as Matchable, Nr as ParseError, Nt as DoAsync, O as UniversalContainer, On as FunctypeSum, Or as CollectionOps, Ot as formatError, P as HttpQueryParams, Pn as MatchableUtils, Pr as Concurrency, Pt as DoGenerator, Q as Task, Qn as expectMarker, Qt as Ok, R as ParseMode, Rn as Reshapeable, Rr as Cond, Rt as LeftError, S as EitherKind, Sn as PositiveInteger, Sr as reduceWiden, St as TypedErrorContext, T as ListKind, Tn as UrlString, Tr as AsyncMonad, Tt as ErrorWithTaskInfo, U as NetworkError, Un as FUNCTYPE_MARKER, Ut as Decoder, V as HttpMethod, Vn as JSONValue, Vt as isDoCapable, W as ResponseDecodeError, Wn as FunctypeEnvelope, Wt as Encoder, X as RIO, Xn as createTaggedSerializer, Xt as CancellationTokenSource, Y as InterruptedError, Yn as createSerializer, Yt as CancellationToken, Z as RepeatExhausted, Zn as envelope, Zt as Err, _ as ESMapType, _n as ISO8601Date, _r as isRight, _t as Validator, a as OptionConstructor, an as TaskParams, ar as serializeError, at as LayerOutput, b as Lazy, bn as NonNegativeNumber, br as Widen, bt as ErrorStatus, c as Tracer, cn as createCancellationTokenSource, cr as EitherBase, ct as Context, d as Stack, dn as Throwable, dr as Right, dt as Tag, en as TaggedThrowable, er as fromJSON, et as UIO, f as Valuable, fn as ThrowableType, fr as RightOf, ft as TagService, g as ESMap, gn as EmailAddress, gr as isLeft, gt as ValidationRule, h as Obj, hn as BoundedString, hr as TypeCheckRight, ht as Validation, i as Option, in as TaskOutcome, ir as deserializeError, it as LayerInput, j as HttpClient, jn as FunctypeCollection, jr as Extractable, jt as $, k as FoldableUtils, kn as Functype, kr as ContainerOps, kt as formatStackTrace, l as TraceEvent, ln as isTaggedThrowable, lr as Left, lt as ContextServices, m as Ref, mn as BoundedNumber, mr as TypeCheckLeft, mt as FormValidation, n as UntypedMatch, nn as TaskFailure, nr as taggedEnvelope, nt as Layer, o as Some, on as TaskResult, or as LazyList, ot as Exit, p as ValuableParams, pn as Base, pr as TestEither, pt as FieldValidation, q as TestContext, qn as createCustomSerializer, qt as DecoderErrorLeaf, r as None, rn as TaskMetadata, rr as SerializedError, rt as LayerError, s as TracedOption, sn as TaskSuccess, sr as Either, st as ExitTag, t as Match, tn as Task$1, tr as fromYAML, tt as UnsupportedSyncOperationError, u as TraceOp, un as NAME, ur as LeftOf, ut as HasService, v as Map, vn as IntegerNumber, vr as tryCatch, vt as ErrorCode, w as Kind, wn as UUID, wr as Applicative, wt as ErrorFormatterOptions, x as Identity, xn as PatternString, xr as reduceRightWiden, xt as TypedError, y as KVTraversable, yn as NonEmptyString, yr as tryCatchAsync, yt as ErrorMessage, z as DecodeError, zn as Try, zt as LeftErrorType } from "./index-CLYh2qZu.js";
5
- import { n as invariant, t as InvariantViolation } from "./Invariant-DEan-SxV.js";
6
- import { t as Logger } from "./Logger-BmprRS8v.js";
7
- import { n as WireMark, t as Wire } from "./Wire-3hvw0Ogg.js";
8
- 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, type Concurrency, type ConcurrencyOptions, Cond, type ContainerOps, Context, type Context as ContextType, type ContextServices, type DecodeError, Decoder, DecoderError, type DecoderErrorComposite, type DecoderErrorLeaf, Do, DoAsync, DoGenerator, type DoResult, type Doable, ESMap, ESMapType, Either, EitherBase, EitherKind, EmailAddress, EmptyListError, type Encoder, Err, ErrorChainElement, ErrorCode, ErrorFormatterOptions, ErrorMessage, ErrorStatus, ErrorWithTaskInfo, Exit, type Exit as ExitType, type ExitTag, type ExtractBrand, ExtractTag, type Extractable, FUNCTYPE_MARKER, FailureError, FailureErrorType, FieldValidation, type Flattened, Foldable, FoldableUtils, FormValidation, type Functor, Functype, FunctypeBase, FunctypeCollection, FunctypeEnvelope, FunctypeSum, HKT, type HasService, Http, HttpClient, type HttpClientConfig, HttpError, HttpError as HttpErrors, type HttpMethod, type HttpMethodOptions, type HttpQueryParams, type HttpRequestOptions, type HttpRequestView, type HttpResponse, type HttpStatusError, IO, type IO as IOType, type Task as IOTask, ISO8601Date, Identity, InstanceType, IntegerNumber, InterruptedError, InvariantViolation, type JSONValue, 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, type Logger, Map, Match, type Matchable, MatchableUtils, type Monad, NAME, type NetworkError, NonEmptyString, NonNegativeNumber, None, NoneError, Obj, Ok, Option, OptionConstructor, OptionKind, ParseError, type ParseMode, ParsedEnvelope, PatternString, Pipe, PositiveInteger, PositiveNumber, type Promisable, type RIO, Ref, type Ref as RefType, RepeatExhausted, type Reshapeable, type ResponseDecodeError, Right, RightOf, Serializable, SerializableEnvelope, Serialization_d_exports as Serialization, SerializationMethods, SerializationResult, SerializedError, 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, type TraceEvent, type TraceOp, TracedOption, type Tracer, Traversable, Try, TryKind, Tuple, Type, TypeCheckLeft, TypeCheckRight, TypeNames, Typeable, TypeableParams, TypedError, TypedErrorContext, type UIO, UUID, UniversalContainer, UnsupportedSyncOperationError, UntypedMatch, type Unwrap, UrlString, ValidatedBrand, type ValidatedBrand as ValidatedBrandType, type ValidatedBrandCompanion, Validation, ValidationRule, Validator, Valuable, ValuableParams, type Widen, type Wire, type WireMark, createBrander, createCancellationTokenSource, createCustomSerializer, createErrorSerializer, createSerializationCompanion, createSerializer, createTaggedSerializer, deserializeError, envelope, expectMarker, formatError, formatStackTrace, fromBinary, fromJSON, fromYAML, hasBrand, invariant, isCompanion, isDoCapable, isExtractable, isLeft, isRight, isTaggedThrowable, isTypeable, reduceRightWiden, reduceWiden, safeStringify, serializeError, taggedEnvelope, tryCatch, tryCatchAsync, unwrap, unwrapBrand };
1
+ import { BoundedNumber, BoundedString, EmailAddress, ISO8601Date, IntegerNumber, NonEmptyString, NonNegativeNumber, PatternString, PositiveInteger, PositiveNumber, UUID, UrlString, ValidatedBrand, ValidatedBrandCompanion } from "./branded/ValidatedBrand.js";
2
+ import { Brand, BrandedBoolean, BrandedNumber, BrandedString, ExtractBrand, Unwrap, createBrander, hasBrand, unwrap as unwrapBrand } from "./branded/index.js";
3
+ import { Collection } from "./collections/index.js";
4
+ import { Companion } from "./companion/Companion.js";
5
+ import { Cond, CondCompanion } from "./conditional/Cond.js";
6
+ import { DoResult, Doable } from "./do/protocol.js";
7
+ import { Concurrency, ConcurrencyOptions } from "./internal/concurrency.js";
8
+ import { ParseError } from "./error/ParseError.js";
9
+ import { Extractable, isExtractable } from "./extractable/Extractable.js";
10
+ import { CollectionOps, ContainerOps, Flattened } from "./typeclass/ContainerOps.js";
11
+ import { Applicative, AsyncMonad, Functor, Monad } from "./typeclass/Functor.js";
12
+ import { Promisable } from "./typeclass/Promisable.js";
13
+ import { Widen, reduceRightWiden, reduceWiden } from "./typeclass/variance.js";
14
+ import { CompanionMethods, InstanceType, isCompanion } from "./companion/CompanionTypes.js";
15
+ import { Base } from "./core/base/Base.js";
16
+ import { NAME, Throwable, ThrowableType } from "./core/throwable/Throwable.js";
17
+ import { Decoder, DecoderCompanion } from "./decoder/index.js";
18
+ import { $, Do, DoAsync, DoGenerator, EmptyListError, FailureError, FailureErrorType, LeftError, LeftErrorType, NoneError, isDoCapable, unwrap } from "./do/index.js";
19
+ import { Either, EitherBase, EitherCompanion, Left, LeftOf, Right, RightOf, TestEither, TypeCheckLeft, TypeCheckRight, isLeft, isRight, tryCatch, tryCatchAsync } from "./either/index.js";
20
+ import { SerializedError, deserializeError, serializeError } from "./serialization/error-envelope.js";
21
+ import { FUNCTYPE_MARKER, FunctypeEnvelope, ParsedEnvelope, SerializationResult, createSerializationCompanion, createSerializer, createTaggedSerializer, envelope, expectMarker, fromBinary, fromJSON, taggedEnvelope } from "./serialization/SerializationCompanion.js";
22
+ import { FoldableUtils } from "./foldable/index.js";
23
+ import { Foldable } from "./foldable/Foldable.js";
24
+ import { EitherKind, HKT, Kind, ListKind, OptionKind, TryKind, UniversalContainer } from "./hkt/index.js";
25
+ import { Identity, IdentityCompanion } from "./identity/Identity.js";
26
+ import { LazyList, LazyListCompanion } from "./list/LazyList.js";
27
+ import { List, ListCompanion } from "./list/index.js";
28
+ import { Matchable, MatchableUtils } from "./matchable/Matchable.js";
29
+ import { Logger } from "./logger/index.js";
30
+ import { Functype, FunctypeBase, FunctypeCollection, FunctypeCore, FunctypeValue } from "./functype/Functype.js";
31
+ import { FunctypeSum } from "./functype/FunctypeSum.js";
32
+ import { Map, MapCompanion } from "./map/index.js";
33
+ import { ESMap, ESMapType } from "./map/shim.js";
34
+ import { Obj, ObjCompanion } from "./obj/Obj.js";
35
+ import { DecoderError, DecoderErrorCompanion, DecoderErrorComposite, DecoderErrorLeaf } from "./decoder/DecoderError.js";
36
+ import { Encoder } from "./decoder/Encoder.js";
37
+ import { None, NoneOf, Option, OptionBase, OptionCompanion, OptionConstructor, Some, SomeOf } from "./option/index.js";
38
+ import { Pipe } from "./pipe/index.js";
39
+ import { ErrorChainFormatOptions, TaggedThrowable, formatErrorChain, getErrorChain, isTaggedThrowable } from "./error/ErrorChain.js";
40
+ import { ErrorChainElement, ErrorFormatterOptions, ErrorWithTaskInfo, TaskErrorInfo, createErrorSerializer, formatError, formatStackTrace, safeStringify } from "./error/ErrorFormatter.js";
41
+ import { ErrorCode, ErrorMessage, ErrorStatus, TypedError, TypedErrorContext } from "./error/typed/TypedError.js";
42
+ import { FieldValidation, FormValidation, Validation, ValidationRule, Validator } from "./error/typed/Validation.js";
43
+ import { Tag, TagService } from "./io/Tag.js";
44
+ import { Context, ContextServices, HasService } from "./io/Context.js";
45
+ import { DieExitOf, Exit, ExitBase, ExitCompanion, ExitTag, FailureExitOf, InterruptedExitOf, SuccessExitOf } from "./io/Exit.js";
46
+ import { Layer, LayerError, LayerInput, LayerOutput } from "./io/Layer.js";
47
+ import { SpanAttributes, SpanTracer } from "./io/SpanTracer.js";
48
+ import { IO, IOCompanion, InterruptedError, RIO, RepeatExhausted, Task, TimeoutError, UIO, UnsupportedSyncOperationError } from "./io/IO.js";
49
+ import { TestClock, TestClockTag, TestContext } from "./io/TestClock.js";
50
+ import { DecodeError, HttpError, HttpErrorCompanion, HttpMethod, HttpStatusError, NetworkError, ResponseDecodeError } from "./fetch/HttpError.js";
51
+ import { HttpMethodOptions, HttpQueryParams, HttpRequestOptions, HttpRequestView, HttpResponse, ParseMode } from "./fetch/HttpRequest.js";
52
+ import { HttpClient, HttpClientConfig } from "./fetch/HttpClient.js";
53
+ import { Http, HttpCompanion } from "./fetch/Http.js";
54
+ import { Reshapeable } from "./reshapeable/Reshapeable.js";
55
+ import { Serializable, SerializableEnvelope, SerializationMethods } from "./serializable/Serializable.js";
56
+ import { JSONValue, Serialization_d_exports } from "./serialization/Serialization.js";
57
+ import { InvariantViolation, invariant } from "./invariant/index.js";
58
+ import { Lazy, LazyCompanion } from "./lazy/Lazy.js";
59
+ import { Set, SetCompanion } from "./set/index.js";
60
+ import { Stack, StackCompanion } from "./stack/Stack.js";
61
+ import { KVTraversable } from "./traversable/KVTraversable.js";
62
+ import { Reducible, Traversable } from "./traversable/Traversable.js";
63
+ import { FailureOf, SuccessOf, Try, TryBase, TryCompanion, TypeNames } from "./try/index.js";
64
+ import { Tuple, TupleCompanion } from "./tuple/index.js";
65
+ import { Ref, RefCompanion } from "./ref/Ref.js";
66
+ import { ExtractTag, Typeable, TypeableParams, isTypeable } from "./typeable/Typeable.js";
67
+ import { Type } from "./types/index.js";
68
+ import { TraceEvent, TraceOp } from "./traced/TraceEvent.js";
69
+ import { Tracer } from "./traced/Tracer.js";
70
+ import { TracedOption } from "./traced/TracedOption.js";
71
+ import { Valuable, ValuableParams } from "./valuable/Valuable.js";
72
+ import { Wire, WireMark } from "./wire/index.js";
73
+ import { Match, MatchCompanion, UntypedMatch } from "./conditional/Match.js";
74
+ export { $, type Applicative, type AsyncMonad, Base, BoundedNumber, BoundedString, Brand, BrandedBoolean, type BrandedBoolean as BrandedBooleanType, BrandedNumber, type BrandedNumber as BrandedNumberType, BrandedString, type BrandedString as BrandedStringType, Collection, type CollectionOps, Companion, CompanionMethods, type Concurrency, type ConcurrencyOptions, Cond, CondCompanion, type ContainerOps, Context, type ContextServices, type Context as ContextType, type DecodeError, Decoder, DecoderCompanion, DecoderError, type DecoderErrorCompanion, type DecoderErrorComposite, type DecoderErrorLeaf, type DieExitOf, Do, DoAsync, DoGenerator, type DoResult, type Doable, ESMap, ESMapType, Either, EitherBase, EitherCompanion, EitherKind, EmailAddress, EmptyListError, type Encoder, ErrorChainElement, ErrorChainFormatOptions, ErrorCode, ErrorFormatterOptions, ErrorMessage, ErrorStatus, ErrorWithTaskInfo, Exit, type ExitBase, type ExitCompanion, type ExitTag, type Exit as ExitType, type ExtractBrand, ExtractTag, type Extractable, FUNCTYPE_MARKER, FailureError, FailureErrorType, type FailureExitOf, FailureOf, FieldValidation, type Flattened, Foldable, FoldableUtils, FormValidation, type Functor, Functype, FunctypeBase, FunctypeCollection, FunctypeCore, FunctypeEnvelope, FunctypeSum, FunctypeValue, HKT, type HasService, Http, HttpClient, type HttpClientConfig, type HttpCompanion, HttpError, type HttpErrorCompanion, HttpError as HttpErrors, type HttpMethod, type HttpMethodOptions, type HttpQueryParams, type HttpRequestOptions, type HttpRequestView, type HttpResponse, type HttpStatusError, IO, type IOCompanion, type Task as IOTask, type IO as IOType, ISO8601Date, Identity, IdentityCompanion, InstanceType, IntegerNumber, InterruptedError, type InterruptedExitOf, InvariantViolation, type JSONValue, KVTraversable, Kind, Layer, type LayerError, type LayerInput, type LayerOutput, type Layer as LayerType, Lazy, type LazyCompanion, LazyList, LazyListCompanion, type Lazy as LazyType, Left, LeftError, LeftErrorType, LeftOf, List, ListCompanion, ListKind, type Logger, Map, MapCompanion, Match, MatchCompanion, type Matchable, MatchableUtils, type Monad, NAME, type NetworkError, NonEmptyString, NonNegativeNumber, None, NoneError, NoneOf, Obj, ObjCompanion, Option, OptionBase, OptionCompanion, OptionConstructor, OptionKind, ParseError, type ParseMode, ParsedEnvelope, PatternString, Pipe, PositiveInteger, PositiveNumber, type Promisable, type RIO, Reducible, Ref, type RefCompanion, type Ref as RefType, RepeatExhausted, type Reshapeable, type ResponseDecodeError, Right, RightOf, Serializable, SerializableEnvelope, Serialization_d_exports as Serialization, SerializationMethods, SerializationResult, SerializedError, Set, SetCompanion, Some, SomeOf, type SpanAttributes, SpanTracer, Stack, StackCompanion, type SuccessExitOf, SuccessOf, Tag, type TagService, type Tag as TagType, TaggedThrowable, TaskErrorInfo, TestClock, TestClockTag, type TestClock as TestClockType, TestContext, type TestContext as TestContextType, TestEither, Throwable, ThrowableType, TimeoutError, type TraceEvent, type TraceOp, TracedOption, type Tracer, Traversable, Try, TryBase, TryCompanion, TryKind, Tuple, TupleCompanion, Type, TypeCheckLeft, TypeCheckRight, TypeNames, Typeable, TypeableParams, TypedError, TypedErrorContext, type UIO, UUID, UniversalContainer, UnsupportedSyncOperationError, UntypedMatch, type Unwrap, UrlString, ValidatedBrand, type ValidatedBrandCompanion, type ValidatedBrand as ValidatedBrandType, Validation, ValidationRule, Validator, Valuable, ValuableParams, type Widen, type Wire, type WireMark, createBrander, createErrorSerializer, createSerializationCompanion, createSerializer, createTaggedSerializer, deserializeError, envelope, expectMarker, formatError, formatErrorChain, formatStackTrace, fromBinary, fromJSON, getErrorChain, hasBrand, invariant, isCompanion, isDoCapable, isExtractable, isLeft, isRight, isTaggedThrowable, isTypeable, reduceRightWiden, reduceWiden, safeStringify, serializeError, taggedEnvelope, tryCatch, tryCatchAsync, unwrap, unwrapBrand };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{Brand as ee,BrandedBoolean as te,BrandedNumber as ne,BrandedString as e,createBrander as t,hasBrand as n,unwrap as r}from"./branded/index.js";import{$ as i,A as a,At as o,B as s,C as c,Ct as l,D as u,Dt as d,E as f,Et as p,F as m,Ft as h,G as g,H as _,I as v,J as y,K as b,L as x,M as S,Mt as C,N as w,Nt as T,O as E,Ot as D,P as O,Pt as k,Q as A,R as j,S as M,St as N,T as P,Tt as F,U as I,V as L,W as R,X as z,Y as B,Z as V,_ as H,_t as U,a as W,at as G,b as K,bt as q,c as J,ct as Y,d as X,dt as Z,et as re,f as Q,ft as ie,g as ae,gt as oe,h as se,ht as ce,i as le,it as $,j as ue,jt as de,k as fe,kt as pe,l as me,lt as he,m as ge,mt as _e,n as ve,nt as ye,o as be,ot as xe,p as Se,pt as Ce,q as we,r as Te,rt as Ee,s as De,st as Oe,t as ke,tt as Ae,u as je,ut as Me,v as Ne,vt as Pe,w as Fe,wt as Ie,x as Le,xt as Re,y as ze,yt as Be,z as Ve}from"./src-BQPeS6p2.js";import{t as He}from"./Companion-DiOMBHDG.js";import{a as Ue,c as We,d as Ge,f as Ke,i as qe,l as Je,n as Ye,o as Xe,p as Ze,r as Qe,s as $e,t as et,u as tt}from"./serialization-9_SyrfdG.js";import{n as nt,t as rt}from"./typeclass-C61yDVYd.js";import{t as it}from"./CompanionTypes-BVqO7Kc2.js";import{Tuple as at}from"./tuple/index.js";import{InvariantViolation as ot,invariant as st}from"./invariant/index.js";export{w as $,i as Base,ye as BoundedNumber,Ee as BoundedString,ee as Brand,te as BrandedBoolean,ne as BrandedNumber,e as BrandedString,He as Companion,Ae as Cond,P as Context,_ as Decoder,I as DecoderError,O as Do,m as DoAsync,g as ESMap,ce as Either,$ as EmailAddress,v as EmptyListError,b as Err,Fe as Exit,et as FUNCTYPE_MARKER,x as FailureError,je as FoldableUtils,me as HKT,X as Http,Se as HttpClient,Q as HttpError,Q as HttpErrors,ze as IO,G as ISO8601Date,J as Identity,xe as IntegerNumber,K as InterruptedError,ot as InvariantViolation,Ne as Layer,De as Lazy,D as LazyList,oe as Left,j as LeftError,Ie as List,R as Map,re as Match,be as MatchableUtils,V as NAME,Oe as NonEmptyString,Y as NonNegativeNumber,de as None,Ve as NoneError,W as Obj,we as Ok,C as Option,T as OptionConstructor,h as ParseError,he as PatternString,Me as PositiveInteger,Z as PositiveNumber,pe as Ref,Le as RepeatExhausted,U as Right,Te as Serialization,o as Set,k as Some,le as Stack,H as Tag,y as Task,ge as TestClock,se as TestClockTag,ae as TestContext,A as Throwable,M as TimeoutError,ve as TracedOption,d as Try,at as Tuple,Pe as TypeCheckLeft,Be as TypeCheckRight,F as Typeable,E as TypedError,ie as UUID,c as UnsupportedSyncOperationError,Ce as UrlString,_e as ValidatedBrand,u as Validation,ke as Valuable,t as createBrander,B as createCancellationTokenSource,Ye as createCustomSerializer,fe as createErrorSerializer,Qe as createSerializationCompanion,qe as createSerializer,Ue as createTaggedSerializer,Ke as deserializeError,Xe as envelope,$e as expectMarker,a as formatError,ue as formatStackTrace,We as fromBinary,Je as fromJSON,tt as fromYAML,n as hasBrand,st as invariant,it as isCompanion,s as isDoCapable,f as isExtractable,q as isLeft,Re as isRight,z as isTaggedThrowable,p as isTypeable,rt as reduceRightWiden,nt as reduceWiden,S as safeStringify,Ze as serializeError,Ge as taggedEnvelope,N as tryCatch,l as tryCatchAsync,L as unwrap,r as unwrapBrand};
1
+ import{BoundedNumber as ee,BoundedString as te,EmailAddress as ne,ISO8601Date as e,IntegerNumber as t,NonEmptyString as n,NonNegativeNumber as r,PatternString as i,PositiveInteger as a,PositiveNumber as o,UUID as s,UrlString as c,ValidatedBrand as l}from"./branded/ValidatedBrand.js";import{ParseError as u}from"./error/ParseError.js";import{Brand as d,BrandedBoolean as f,BrandedNumber as p,BrandedString as m,createBrander as h,hasBrand as g,unwrap as _}from"./branded/index.js";import{deserializeError as v,serializeError as y}from"./serialization/error-envelope.js";import{FUNCTYPE_MARKER as b,createSerializationCompanion as x,createSerializer as S,createTaggedSerializer as C,envelope as w,expectMarker as T,fromBinary as E,fromJSON as D,taggedEnvelope as O}from"./serialization/SerializationCompanion.js";import{Companion as k}from"./companion/Companion.js";import{reduceRightWiden as A,reduceWiden as j}from"./typeclass/variance.js";import{isCompanion as M}from"./companion/CompanionTypes.js";import{Ref as N}from"./ref/Ref.js";import{Base as P}from"./core/base/Base.js";import{NAME as F,Throwable as I}from"./core/throwable/Throwable.js";import{Decoder as L}from"./decoder/index.js";import{$ as R,Do as z,DoAsync as B,EmptyListError as V,FailureError as H,LeftError as U,NoneError as W,isDoCapable as G,unwrap as K}from"./do/index.js";import{Either as q,Left as J,Right as Y,TypeCheckLeft as X,TypeCheckRight as Z,isLeft as re,isRight as ie,tryCatch as ae,tryCatchAsync as oe}from"./either/index.js";import{FoldableUtils as se}from"./foldable/index.js";import{HKT as Q}from"./hkt/index.js";import{Cond as ce}from"./conditional/Cond.js";import{Match as le}from"./conditional/Match.js";import{Identity as ue}from"./identity/Identity.js";import{LazyList as de}from"./list/LazyList.js";import{List as fe}from"./list/index.js";import{Map as pe}from"./map/index.js";import{ESMap as me}from"./map/shim.js";import{DecoderError as he}from"./decoder/DecoderError.js";import{Obj as ge}from"./obj/Obj.js";import{None as _e,Option as ve,OptionConstructor as ye,Some as be}from"./option/index.js";import{formatErrorChain as xe,getErrorChain as Se,isTaggedThrowable as Ce}from"./error/ErrorChain.js";import{createErrorSerializer as we,formatError as Te,formatStackTrace as Ee,safeStringify as De}from"./error/ErrorFormatter.js";import{TypedError as Oe}from"./error/typed/TypedError.js";import{Validation as ke}from"./error/typed/Validation.js";import{isExtractable as Ae}from"./extractable/Extractable.js";import{Context as je}from"./io/Context.js";import{Exit as Me}from"./io/Exit.js";import{Tag as Ne}from"./io/Tag.js";import{SpanTracer as Pe}from"./io/SpanTracer.js";import{IO as Fe,InterruptedError as Ie,RepeatExhausted as Le,TimeoutError as Re,UnsupportedSyncOperationError as ze}from"./io/IO.js";import{Layer as Be}from"./io/Layer.js";import{TestClock as Ve,TestClockTag as He,TestContext as Ue}from"./io/TestClock.js";import{HttpClient as We}from"./fetch/HttpClient.js";import{HttpError as $}from"./fetch/HttpError.js";import{Http as Ge}from"./fetch/Http.js";import{Serialization_exports as Ke}from"./serialization/Serialization.js";import{Set as qe}from"./set/index.js";import{Stack as Je}from"./stack/Stack.js";import{InvariantViolation as Ye,invariant as Xe}from"./invariant/index.js";import{Lazy as Ze}from"./lazy/Lazy.js";import{MatchableUtils as Qe}from"./matchable/Matchable.js";import{Try as $e}from"./try/index.js";import{Tuple as et}from"./tuple/index.js";import{Typeable as tt,isTypeable as nt}from"./typeable/Typeable.js";import{TracedOption as rt}from"./traced/TracedOption.js";import{Valuable as it}from"./valuable/Valuable.js";export{R as $,P as Base,ee as BoundedNumber,te as BoundedString,d as Brand,f as BrandedBoolean,p as BrandedNumber,m as BrandedString,k as Companion,ce as Cond,je as Context,L as Decoder,he as DecoderError,z as Do,B as DoAsync,me as ESMap,q as Either,ne as EmailAddress,V as EmptyListError,Me as Exit,b as FUNCTYPE_MARKER,H as FailureError,se as FoldableUtils,Q as HKT,Ge as Http,We as HttpClient,$ as HttpError,$ as HttpErrors,Fe as IO,e as ISO8601Date,ue as Identity,t as IntegerNumber,Ie as InterruptedError,Ye as InvariantViolation,Be as Layer,Ze as Lazy,de as LazyList,J as Left,U as LeftError,fe as List,pe as Map,le as Match,Qe as MatchableUtils,F as NAME,n as NonEmptyString,r as NonNegativeNumber,_e as None,W as NoneError,ge as Obj,ve as Option,ye as OptionConstructor,u as ParseError,i as PatternString,a as PositiveInteger,o as PositiveNumber,N as Ref,Le as RepeatExhausted,Y as Right,Ke as Serialization,qe as Set,be as Some,Pe as SpanTracer,Je as Stack,Ne as Tag,Ve as TestClock,He as TestClockTag,Ue as TestContext,I as Throwable,Re as TimeoutError,rt as TracedOption,$e as Try,et as Tuple,X as TypeCheckLeft,Z as TypeCheckRight,tt as Typeable,Oe as TypedError,s as UUID,ze as UnsupportedSyncOperationError,c as UrlString,l as ValidatedBrand,ke as Validation,it as Valuable,h as createBrander,we as createErrorSerializer,x as createSerializationCompanion,S as createSerializer,C as createTaggedSerializer,v as deserializeError,w as envelope,T as expectMarker,Te as formatError,xe as formatErrorChain,Ee as formatStackTrace,E as fromBinary,D as fromJSON,Se as getErrorChain,g as hasBrand,Xe as invariant,M as isCompanion,G as isDoCapable,Ae as isExtractable,re as isLeft,ie as isRight,Ce as isTaggedThrowable,nt as isTypeable,A as reduceRightWiden,j as reduceWiden,De as safeStringify,y as serializeError,O as taggedEnvelope,ae as tryCatch,oe as tryCatchAsync,K as unwrap,_ as unwrapBrand};
@@ -0,0 +1 @@
1
+ const e=32768,t=t=>{let n=new TextEncoder().encode(t),r=Array.from({length:Math.ceil(n.length/e)},(t,r)=>String.fromCharCode(...n.subarray(r*e,(r+1)*e)));return btoa(r.join(``))},n=e=>{let t=e.replace(/\s+/g,``).replace(/-/g,`+`).replace(/_/g,`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`),r=atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return new TextDecoder(`utf-8`,{ignoreBOM:!0}).decode(i)};export{n as base64ToUtf8,t as utf8ToBase64};
@@ -0,0 +1 @@
1
+ const e=e=>e(),t=(e,t)=>e(t);export{e as callAlone0,t as callAlone1};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Bounded-concurrency traversal shared by the async collection methods and `Either.traverseAsync`.
3
+ */
4
+ /**
5
+ * How many calls may run at once: a positive integer, or `"unbounded"` to start them all together.
6
+ * `1` runs them one after another, in input order.
7
+ */
8
+ export type Concurrency = number | "unbounded";
9
+ export type ConcurrencyOptions = {
10
+ readonly concurrency?: Concurrency;
11
+ };
@@ -0,0 +1 @@
1
+ const e=(e,t)=>{if(e===`unbounded`)return t;if(!Number.isInteger(e)||e<1)throw RangeError(`concurrency must be a positive integer or "unbounded", got ${String(e)}`);return Math.min(e,t)},t=async(t,n,r,i=()=>!1)=>{let a=Array.from(t),o=[],s={next:0,stopped:!1},c=async()=>{if(s.stopped||s.next>=a.length)return;let e=s.next;s.next=e+1;try{let t=await n(a[e]);o[e]={value:t},i(t)&&(s.stopped=!0)}catch(e){throw s.stopped=!0,e}return c()};return await Promise.all(Array.from({length:e(r,a.length)},c)),o.flatMap(e=>[e.value])};export{t as traverseWithConcurrency,e as workerCount};
@@ -0,0 +1 @@
1
+ const e=()=>(e,t)=>{let n=function(){};Object.defineProperty(n,"name",{value:e});let r=n.prototype;return Reflect.ownKeys(t).forEach(e=>{let n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(r,e,{...n,enumerable:!1})}),Object.freeze(r)};export{e as define};
@@ -0,0 +1 @@
1
+ import{Ref as e}from"../ref/Ref.js";const t=(t=0)=>{let n=e(t),r=t;return{get:()=>n.get(),set:e=>n.set(e),increment:()=>n.updateAndGet(e=>e+1),decrement:()=>n.updateAndGet(e=>e-1),reset:()=>n.set(r),compareAndSet:(e,t)=>n.compareAndSet(e,t)}},n=()=>{let t=e([]);return{add:e=>t.update(t=>[...t,e]),addAll:e=>t.update(t=>[...t,...e]),build:()=>t.get(),clear:()=>t.set([]),size:()=>t.get().length}};export{n as ArrayBuilder,t as Counter};
@@ -0,0 +1 @@
1
+ const e=e=>{let t=e.filter(e=>e!==void 0),[n]=t;if(n!==void 0&&t.length===1)return{signal:n,dispose:()=>{}};let r=new AbortController,i=t.find(e=>e.aborted);if(i)return r.abort(i.reason),{signal:r.signal,dispose:()=>{}};let a=t.map(e=>{let t=()=>r.abort(e.reason);return e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)});return{signal:r.signal,dispose:()=>a.forEach(e=>e())}};export{e as anySignal};
@@ -0,0 +1 @@
1
+ function e(e){if(e===void 0||typeof e==`symbol`||typeof e==`function`)return;let t=/* @__PURE__ */ new Set;function n(e){if(e===null)return`null`;switch(typeof e){case`string`:return JSON.stringify(e);case`number`:return isFinite(e)?String(e):`null`;case`boolean`:return String(e);case`bigint`:return`"${e}"`;case`undefined`:case`symbol`:case`function`:return}let r=e;if(t.has(r))return`"[Circular]"`;t.add(r);try{if(`toJSON`in r&&typeof r.toJSON==`function`)return n(r.toJSON());if(Array.isArray(r))return`[${r.map(e=>n(e)??`null`).join(`,`)}]`;let e=Object.keys(r).sort(),t=[];for(let i of e){let e=n(r[i]);e!==void 0&&t.push(`${JSON.stringify(i)}:${e}`)}return`{${t.join(`,`)}}`}finally{t.delete(r)}}try{return n(e)}catch{return}}const t=e=>e instanceof Error||Object.prototype.toString.call(e)===`[object Error]`;function n(n){try{return t(n)?String(n):e(n)}catch{return e(n)}}export{e as safeStringify,n as showValue};
@@ -1,2 +1,32 @@
1
- import { n as invariant, t as InvariantViolation } from "../Invariant-DEan-SxV.js";
2
- export { InvariantViolation, invariant };
1
+ /**
2
+ * The error `invariant()` throws: a programmer error, never an expected failure. Tagged so a top-level
3
+ * handler can tell "a bug fired" apart from a failure that should have been an `Either`.
4
+ */
5
+ export type InvariantViolation = Error & {
6
+ readonly name: "InvariantViolation";
7
+ readonly _tag: "InvariantViolation";
8
+ };
9
+ /**
10
+ * Builds an {@link InvariantViolation}. Use it directly where a branch can only be reached by a bug and
11
+ * there is no condition to assert, e.g. `throw InvariantViolation("unreachable: unknown variant")`.
12
+ */
13
+ export declare const InvariantViolation: (message: string) => InvariantViolation;
14
+ /**
15
+ * Asserts a condition that can only be false because of a bug, and narrows it for the code after it.
16
+ *
17
+ * Expected failures return `Either`; `invariant` is for the other kind — "upsert returned no row",
18
+ * "step must be non-negative", "AUTH_PROVIDER is required in production". It covers one statement, so a
19
+ * function can mix bug checks with `Either`-returning failure paths, and `functype/prefer-either` never
20
+ * sees a `throw` to report.
21
+ *
22
+ * ```ts
23
+ * invariant(row, "upsert returned no row") // row: Row from here on
24
+ * invariant(teamDomain && aud, "requires CF_ACCESS_TEAM_DOMAIN and CF_ACCESS_AUD")
25
+ * invariant(n >= 0, () => `step must be non-negative, got ${n}`) // message built only on failure
26
+ * ```
27
+ *
28
+ * @param condition - Must be truthy. Narrowed to truthy after the call.
29
+ * @param message - The error message, or a thunk that builds it only when the check fails.
30
+ * @throws {@link InvariantViolation} when `condition` is falsy.
31
+ */
32
+ export declare function invariant(condition: unknown, message: string | (() => string)): asserts condition;
@@ -0,0 +1,112 @@
1
+ import { Option } from "../option/index.js";
2
+ import { Type } from "../types/index.js";
3
+ import { Tag } from "./Tag.js";
4
+ /**
5
+ * Context module - service container for dependency injection.
6
+ * @module Context
7
+ * @category IO
8
+ *
9
+ * Context is an immutable container that holds service implementations
10
+ * identified by their Tags.
11
+ */
12
+ /**
13
+ * Context holds service implementations for dependency injection.
14
+ * It's an immutable container that maps Tags to their implementations.
15
+ *
16
+ * @typeParam R - The services contained in this context (intersection type)
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const ctx = Context.empty()
21
+ * .add(Logger, consoleLogger)
22
+ * .add(Database, pgDatabase)
23
+ *
24
+ * // Access a service
25
+ * const logger = ctx.get(Logger) // Option<Logger>
26
+ * const loggerUnsafe = ctx.unsafeGet(Logger) // Logger (throws if missing)
27
+ * ```
28
+ */
29
+ export interface Context<R extends Type> {
30
+ /**
31
+ * Type brand
32
+ * @internal
33
+ */
34
+ readonly _tag: "Context";
35
+ /**
36
+ * Phantom type for requirements
37
+ * @internal
38
+ */
39
+ readonly _R?: R;
40
+ /**
41
+ * Internal service map
42
+ * @internal
43
+ */
44
+ readonly services: ReadonlyMap<string, Type>;
45
+ /**
46
+ * Gets a service from the context.
47
+ * @param tag - The tag identifying the service
48
+ * @returns Some(service) if found, None otherwise
49
+ */
50
+ get<S extends Type>(tag: Tag<S>): Option<S>;
51
+ /**
52
+ * Gets a service from the context, throwing if not found.
53
+ * @param tag - The tag identifying the service
54
+ * @returns The service
55
+ * @throws Error if service not found
56
+ */
57
+ unsafeGet<S extends Type>(tag: Tag<S>): S;
58
+ /**
59
+ * Checks if a service exists in the context.
60
+ * @param tag - The tag to check
61
+ * @returns true if the service exists
62
+ */
63
+ has<S extends Type>(tag: Tag<S>): boolean;
64
+ /**
65
+ * Adds a service to the context, returning a new context.
66
+ * @param tag - The tag for the service
67
+ * @param service - The service implementation
68
+ * @returns A new context with the service added
69
+ */
70
+ add<S extends Type>(tag: Tag<S>, service: S): Context<R & S>;
71
+ /**
72
+ * Merges another context into this one.
73
+ * @param other - The context to merge
74
+ * @returns A new context with all services from both
75
+ */
76
+ merge<R2 extends Type>(other: Context<R2>): Context<R & R2>;
77
+ /**
78
+ * Returns the number of services in this context.
79
+ */
80
+ readonly size: number;
81
+ /**
82
+ * String representation
83
+ */
84
+ toString(): string;
85
+ }
86
+ /**
87
+ * Context companion object with utility methods
88
+ */
89
+ export declare const Context: {
90
+ /**
91
+ * Creates an empty context with no services.
92
+ */
93
+ empty: <R extends Type = never>() => Context<R>;
94
+ /**
95
+ * Creates a context with a single service.
96
+ * @param tag - The tag for the service
97
+ * @param service - The service implementation
98
+ */
99
+ make: <S extends Type>(tag: Tag<S>, service: S) => Context<S>;
100
+ /**
101
+ * Checks if a value is a Context.
102
+ */
103
+ isContext: <R extends Type>(value: unknown) => value is Context<R>;
104
+ };
105
+ /**
106
+ * Type helper to extract requirements from a Context
107
+ */
108
+ export type ContextServices<C> = C extends Context<infer R> ? R : never;
109
+ /**
110
+ * Type helper to check if a context provides a service
111
+ */
112
+ export type HasService<C, S> = S extends ContextServices<C> ? true : false;
@@ -0,0 +1 @@
1
+ import{define as e}from"../internal/define.js";import{None as t,Some as n}from"../option/index.js";const r=e()(`Context`,{get(e){let r=this.services.get(e.id);return r===void 0?t():n(i(r))},unsafeGet(e){let t=this.services.get(e.id);if(t===void 0)throw Error(`Service not found: ${e.id}`);return i(t)},has(e){return this.services.has(e.id)},add(e,t){let n=new Map(this.services);return n.set(e.id,t),a(n)},merge(e){let t=new Map(this.services);for(let[n,r]of e.services)t.set(n,r);return a(t)},get size(){return this.services.size},toString(){return`Context(${Array.from(this.services.keys()).join(`, `)})`}}),i=e=>e,a=e=>{let t=Object.create(r);return t._tag=`Context`,t.services=e,Object.freeze(t)},o={empty:()=>a(/* @__PURE__ */ new Map),make:(e,t)=>{let n=/* @__PURE__ */ new Map;return n.set(e.id,t),a(n)},isContext:e=>typeof e==`object`&&!!e&&e._tag===`Context`};export{o as Context};