@r_masseater/masseater-utils 0.1.3 → 0.1.4

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,7 +1,3 @@
1
- import "effect/Context";
2
- import "effect/Effect";
3
- import "effect/Exit";
4
- import { Option } from "effect/Option";
5
1
  /**
6
2
  * Describes the concurrency level for Effect operations that run multiple
7
3
  * effects.
@@ -573,7 +569,7 @@ declare const TypeId$5 = "~effect/Option";
573
569
  * @category models
574
570
  * @since 2.0.0
575
571
  */
576
- type Option$1<A> = None<A> | Some<A>;
572
+ type Option<A> = None<A> | Some<A>;
577
573
  /**
578
574
  * Represents the absence of a value within an {@link Option}.
579
575
  *
@@ -600,7 +596,7 @@ interface None<out A> extends Pipeable, Inspectable {
600
596
  readonly [TypeId$5]: {
601
597
  readonly _A: Covariant<A>;
602
598
  };
603
- [Symbol.iterator](): OptionIterator<Option$1<A>>;
599
+ [Symbol.iterator](): OptionIterator<Option<A>>;
604
600
  [typeSymbol]?: unknown;
605
601
  [unifySymbol]?: OptionUnify<this>;
606
602
  [ignoreSymbol]?: OptionUnifyIgnore;
@@ -620,8 +616,8 @@ interface None<out A> extends Pipeable, Inspectable {
620
616
  * @category generators
621
617
  * @since 4.0.0
622
618
  */
623
- interface OptionIterator<T extends Option$1<any>> {
624
- next(...args: ReadonlyArray<any>): IteratorResult<T, Option$1.Value<T>>;
619
+ interface OptionIterator<T extends Option<any>> {
620
+ next(...args: ReadonlyArray<any>): IteratorResult<T, Option.Value<T>>;
625
621
  }
626
622
  /**
627
623
  * Represents the presence of a value within an {@link Option}.
@@ -652,7 +648,7 @@ interface Some<out A> extends Pipeable, Inspectable {
652
648
  readonly [TypeId$5]: {
653
649
  readonly _A: Covariant<A>;
654
650
  };
655
- [Symbol.iterator](): OptionIterator<Option$1<A>>;
651
+ [Symbol.iterator](): OptionIterator<Option<A>>;
656
652
  [typeSymbol]?: unknown;
657
653
  [unifySymbol]?: OptionUnify<this>;
658
654
  [ignoreSymbol]?: OptionUnifyIgnore;
@@ -677,7 +673,7 @@ interface Some<out A> extends Pipeable, Inspectable {
677
673
  interface OptionUnify<A extends {
678
674
  [typeSymbol]?: any;
679
675
  }> {
680
- Option?: () => A[typeSymbol] extends Option$1<infer A0> | (infer _) ? Option$1<A0> : never;
676
+ Option?: () => A[typeSymbol] extends Option<infer A0> | (infer _) ? Option<A0> : never;
681
677
  }
682
678
  /**
683
679
  * Namespace containing utility types for `Option`.
@@ -689,7 +685,7 @@ interface OptionUnify<A extends {
689
685
  * @stability stable
690
686
  * @since 2.0.0
691
687
  */
692
- declare namespace Option$1 {
688
+ declare namespace Option {
693
689
  /**
694
690
  * Extracts the type of the value contained in an `Option`.
695
691
  *
@@ -711,7 +707,7 @@ declare namespace Option$1 {
711
707
  * @category utility types
712
708
  * @since 2.0.0
713
709
  */
714
- type Value<T extends Option$1<any>> = [T] extends [Option$1<infer _A>] ? _A : never;
710
+ type Value<T extends Option<any>> = [T] extends [Option<infer _A>] ? _A : never;
715
711
  }
716
712
  /**
717
713
  * Marker interface used by Effect's `Unify` machinery for `Option` values.
@@ -1507,7 +1503,7 @@ interface Transform<out T, in E> extends Pipeable {
1507
1503
  */
1508
1504
  interface TransformOptional<out T, in E> extends Pipeable {
1509
1505
  readonly _tag: "TransformOptional";
1510
- readonly transform: (input: Option$1<E>) => Option$1<T>;
1506
+ readonly transform: (input: Option<E>) => Option<T>;
1511
1507
  }
1512
1508
  /**
1513
1509
  * An effectful transformation of present values.
@@ -1529,7 +1525,7 @@ interface TransformEffect<out T, in E, R> extends Pipeable {
1529
1525
  */
1530
1526
  interface TransformOptionalEffect<out T, in E, R> extends Pipeable {
1531
1527
  readonly _tag: "TransformOptionalEffect";
1532
- readonly transform: (input: Option$1<E>, options: ParseOptions) => Effect<Option$1<T>, Issue, R>;
1528
+ readonly transform: (input: Option<E>, options: ParseOptions) => Effect<Option<T>, Issue, R>;
1533
1529
  }
1534
1530
  /**
1535
1531
  * Represents a composable transformation from an encoded type `E` to a decoded type `T`.
@@ -1618,8 +1614,8 @@ type Getter<T, E, R = never> = Passthrough | Transform<T, E> | TransformOptional
1618
1614
  */
1619
1615
  interface Middleware<in out T, in out E, RDE, RDT, RET, REE> extends Pipeable {
1620
1616
  readonly _tag: "Middleware";
1621
- readonly decode: (effect: Effect<Option$1<E>, Issue, RDE>, options: ParseOptions) => Effect<Option$1<T>, Issue, RDT>;
1622
- readonly encode: (effect: Effect<Option$1<T>, Issue, RET>, options: ParseOptions) => Effect<Option$1<E>, Issue, REE>;
1617
+ readonly decode: (effect: Effect<Option<E>, Issue, RDE>, options: ParseOptions) => Effect<Option<T>, Issue, RDT>;
1618
+ readonly encode: (effect: Effect<Option<T>, Issue, RET>, options: ParseOptions) => Effect<Option<E>, Issue, REE>;
1623
1619
  flip(): Middleware<E, T, RET, REE, RDE, RDT>;
1624
1620
  }
1625
1621
  /**
@@ -1629,7 +1625,7 @@ interface Middleware<in out T, in out E, RDE, RDT, RET, REE> extends Pipeable {
1629
1625
  * @category constructors
1630
1626
  * @since 4.0.0
1631
1627
  */
1632
- declare const Middleware: new <T, E, RDE, RDT, RET, REE>(decode: (effect: Effect<Option$1<E>, Issue, RDE>, options: ParseOptions) => Effect<Option$1<T>, Issue, RDT>, encode: (effect: Effect<Option$1<T>, Issue, RET>, options: ParseOptions) => Effect<Option$1<E>, Issue, REE>) => Middleware<T, E, RDE, RDT, RET, REE>;
1628
+ declare const Middleware: new <T, E, RDE, RDT, RET, REE>(decode: (effect: Effect<Option<E>, Issue, RDE>, options: ParseOptions) => Effect<Option<T>, Issue, RDT>, encode: (effect: Effect<Option<T>, Issue, RET>, options: ParseOptions) => Effect<Option<E>, Issue, REE>) => Middleware<T, E, RDE, RDT, RET, REE>;
1633
1629
  declare const TypeId$3 = "~effect/SchemaTransformation/Transformation";
1634
1630
  /**
1635
1631
  * Represents a bidirectional transformation between a decoded type `T` and an encoded
@@ -3213,7 +3209,7 @@ interface BottomWithoutNew<out T, out E, out RD, out RE, out Ast extends AST, ou
3213
3209
  * @see {@link BottomWithoutNew.make} — construct synchronously when validation failure should throw
3214
3210
  * @see {@link BottomWithoutNew.makeEffect} — construct through `Effect` when validation details should stay in the error channel
3215
3211
  */
3216
- makeOption(input: this["~type.make.in"], options?: MakeOptions): Option$1<this["Type"]>;
3212
+ makeOption(input: this["~type.make.in"], options?: MakeOptions): Option<this["Type"]>;
3217
3213
  /**
3218
3214
  * Constructs a value from the make input representation, returning validation
3219
3215
  * failures in the `Effect` error channel.
@@ -5311,6 +5307,39 @@ type Success<T> = T extends Effect<infer _A, infer _E, infer _R> ? _A : never;
5311
5307
  interface EffectIterator<T extends Effect<any, any, any>> {
5312
5308
  next(...args: ReadonlyArray<any>): IteratorResult<T, Success<T>>;
5313
5309
  }
5310
+ /**
5311
+ * Base interface for error classes that can be yielded directly inside
5312
+ * `Effect.gen`. Yielding one of these errors fails the generator with that
5313
+ * error as the typed failure value.
5314
+ *
5315
+ * **Details**
5316
+ *
5317
+ * All built-in error classes in this module (`NoSuchElementError`,
5318
+ * `TimeoutError`, `IllegalArgumentError`, `ExceededCapacityError`,
5319
+ * `AsyncFiberError`, and `UnknownError`) implement this interface.
5320
+ *
5321
+ * **Example** (Yielding an error in Effect.gen)
5322
+ *
5323
+ * ```ts import.meta.vitest
5324
+ * import { Cause, Effect, Exit } from "effect"
5325
+ *
5326
+ * const error = new Cause.NoSuchElementError("not found")
5327
+ *
5328
+ * const program = Effect.gen(function*() {
5329
+ * return yield* error // fails the effect with NoSuchElementError
5330
+ * })
5331
+ *
5332
+ * await Effect.runPromiseExit(program) // => Exit.fail(error)
5333
+ * ```
5334
+ *
5335
+ * @stability stable
5336
+ * @category errors
5337
+ * @since 2.0.0
5338
+ */
5339
+ interface YieldableError extends Error, Pipeable, Inspectable {
5340
+ readonly [TypeId]: Variance<never, this, never>;
5341
+ [Symbol.iterator](): EffectIterator<Effect<never, this, never>>;
5342
+ }
5314
5343
  /**
5315
5344
  * Interface that object errors can implement to control reporting behavior.
5316
5345
  *
@@ -5648,7 +5677,7 @@ type errorReported = "~effect/Runtime/errorReported";
5648
5677
  declare const errorReported: errorReported;
5649
5678
  declare const CacheRootError_base: Class<CacheRootError, TaggedStruct<"CacheRootError", {
5650
5679
  readonly message: String;
5651
- }>, import("effect/Cause").YieldableError & {
5680
+ }>, YieldableError & {
5652
5681
  readonly brand: unique symbol;
5653
5682
  }>;
5654
5683
  export declare class CacheRootError extends CacheRootError_base {}