effect 4.0.0-beta.83 → 4.0.0-beta.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +64 -64
- package/dist/Array.js +26 -26
- package/dist/Cache.d.ts +1 -1
- package/dist/Cache.js +1 -1
- package/dist/Cause.d.ts +68 -68
- package/dist/Cause.js +47 -47
- package/dist/Channel.d.ts +5 -5
- package/dist/Channel.js +3 -3
- package/dist/Clock.d.ts +1 -1
- package/dist/Clock.js +1 -1
- package/dist/Combiner.d.ts +9 -9
- package/dist/Combiner.js +8 -8
- package/dist/Config.d.ts +15 -94
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +22 -70
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +58 -74
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +66 -41
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +1 -1
- package/dist/Console.js +1 -1
- package/dist/Data.d.ts +15 -15
- package/dist/Data.js +3 -3
- package/dist/DateTime.d.ts +6 -6
- package/dist/DateTime.js +2 -2
- package/dist/Duration.d.ts +3 -3
- package/dist/Duration.js +3 -3
- package/dist/Effect.d.ts +84 -45
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +72 -33
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +7 -7
- package/dist/Equal.js +5 -5
- package/dist/Equivalence.d.ts +17 -17
- package/dist/Equivalence.js +13 -13
- package/dist/Exit.d.ts +3 -3
- package/dist/Exit.js +3 -3
- package/dist/Formatter.d.ts +5 -5
- package/dist/Formatter.js +4 -4
- package/dist/Function.d.ts +10 -10
- package/dist/Function.js +3 -3
- package/dist/HashMap.d.ts +3 -3
- package/dist/HashMap.js +1 -1
- package/dist/Iterable.d.ts +6 -6
- package/dist/Iterable.js +2 -2
- package/dist/JsonPatch.d.ts +2 -2
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.js +1 -1
- package/dist/Logger.d.ts +1 -1
- package/dist/Logger.js +1 -1
- package/dist/Match.d.ts +8 -8
- package/dist/Match.js +8 -8
- package/dist/Metric.d.ts +3 -3
- package/dist/Metric.js +3 -3
- package/dist/Optic.d.ts +30 -30
- package/dist/Optic.js +12 -12
- package/dist/Option.d.ts +7 -7
- package/dist/Option.js +7 -7
- package/dist/Order.d.ts +23 -23
- package/dist/Order.js +20 -20
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.js +1 -1
- package/dist/Predicate.d.ts +88 -88
- package/dist/Predicate.js +47 -47
- package/dist/PubSub.d.ts +3 -3
- package/dist/PubSub.js +3 -3
- package/dist/Reducer.d.ts +1 -1
- package/dist/Reducer.js +1 -1
- package/dist/Result.d.ts +18 -18
- package/dist/Result.js +8 -8
- package/dist/Runtime.d.ts +1 -1
- package/dist/Runtime.js +1 -1
- package/dist/Schema.d.ts +265 -120
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +285 -116
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +13 -9
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +48 -48
- package/dist/SchemaGetter.js +44 -44
- package/dist/SchemaIssue.d.ts +3 -3
- package/dist/SchemaIssue.js +3 -3
- package/dist/SchemaParser.d.ts +122 -22
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +186 -50
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +96 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +20 -20
- package/dist/SchemaTransformation.js +18 -18
- package/dist/Stream.d.ts +3 -3
- package/dist/Stream.js +2 -2
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +1 -1
- package/dist/String.js +1 -1
- package/dist/Struct.d.ts +1 -1
- package/dist/Struct.js +1 -1
- package/dist/Types.d.ts +13 -13
- package/dist/internal/effect.js +23 -10
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/cause.d.ts +2 -0
- package/dist/internal/schema/cause.d.ts.map +1 -0
- package/dist/internal/schema/cause.js +24 -0
- package/dist/internal/schema/cause.js.map +1 -0
- package/dist/internal/schema/schema.d.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +21 -8
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +3 -3
- package/dist/testing/TestSchema.js +1 -1
- package/dist/unstable/ai/AiError.d.ts +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.js +1 -1
- package/dist/unstable/cli/Prompt.js +2 -2
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -4
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +15 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -0
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +65 -65
- package/src/Cache.ts +1 -1
- package/src/Cause.ts +68 -68
- package/src/Channel.ts +5 -5
- package/src/Clock.ts +1 -1
- package/src/Combiner.ts +9 -9
- package/src/Config.ts +40 -108
- package/src/ConfigProvider.ts +139 -100
- package/src/Console.ts +1 -1
- package/src/Data.ts +15 -15
- package/src/DateTime.ts +6 -6
- package/src/Duration.ts +3 -3
- package/src/Effect.ts +89 -45
- package/src/Equal.ts +7 -7
- package/src/Equivalence.ts +17 -17
- package/src/Exit.ts +3 -3
- package/src/Formatter.ts +5 -5
- package/src/Function.ts +10 -10
- package/src/HashMap.ts +3 -3
- package/src/Iterable.ts +6 -6
- package/src/JsonPatch.ts +2 -2
- package/src/Layer.ts +1 -1
- package/src/Logger.ts +1 -1
- package/src/Match.ts +8 -8
- package/src/Metric.ts +3 -3
- package/src/Optic.ts +30 -30
- package/src/Option.ts +7 -7
- package/src/Order.ts +23 -23
- package/src/Pool.ts +1 -1
- package/src/Predicate.ts +88 -88
- package/src/PubSub.ts +3 -3
- package/src/Reducer.ts +1 -1
- package/src/Result.ts +20 -20
- package/src/Runtime.ts +1 -1
- package/src/Schema.ts +314 -131
- package/src/SchemaAST.ts +20 -11
- package/src/SchemaGetter.ts +48 -48
- package/src/SchemaIssue.ts +3 -3
- package/src/SchemaParser.ts +197 -58
- package/src/SchemaRepresentation.ts +73 -3
- package/src/SchemaTransformation.ts +20 -20
- package/src/Stream.ts +4 -4
- package/src/String.ts +1 -1
- package/src/Struct.ts +1 -1
- package/src/Types.ts +13 -13
- package/src/internal/effect.ts +29 -10
- package/src/internal/schema/cause.ts +26 -0
- package/src/internal/schema/schema.ts +36 -10
- package/src/testing/TestSchema.ts +3 -3
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/cli/Prompt.ts +1 -1
- package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
- package/src/unstable/rpc/Rpc.ts +1 -1
- package/src/unstable/rpc/RpcGroup.ts +3 -4
- package/src/unstable/sql/SqlResolver.ts +15 -2
- package/src/unstable/workflow/Activity.ts +2 -0
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
package/dist/Cause.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare const ReasonTypeId: "~effect/Cause/Reason";
|
|
|
56
56
|
* `Cause` implements `Equal` — two causes with the same reasons (by value)
|
|
57
57
|
* compare as equal.
|
|
58
58
|
*
|
|
59
|
-
* **Example** (
|
|
59
|
+
* **Example** (Creating and inspecting a cause)
|
|
60
60
|
*
|
|
61
61
|
* ```ts
|
|
62
62
|
* import { Cause } from "effect"
|
|
@@ -76,7 +76,7 @@ export interface Cause<out E> extends Pipeable, Inspectable, Equal {
|
|
|
76
76
|
/**
|
|
77
77
|
* Checks whether an arbitrary value is a `Cause`.
|
|
78
78
|
*
|
|
79
|
-
* **Example** (runtime type
|
|
79
|
+
* **Example** (Checking the runtime type)
|
|
80
80
|
*
|
|
81
81
|
* ```ts
|
|
82
82
|
* import { Cause } from "effect"
|
|
@@ -92,7 +92,7 @@ export declare const isCause: (self: unknown) => self is Cause<unknown>;
|
|
|
92
92
|
/**
|
|
93
93
|
* Checks whether an arbitrary value is a `Reason` (`Fail`, `Die`, or `Interrupt`).
|
|
94
94
|
*
|
|
95
|
-
* **Example** (runtime type
|
|
95
|
+
* **Example** (Checking the runtime type)
|
|
96
96
|
*
|
|
97
97
|
* ```ts
|
|
98
98
|
* import { Cause } from "effect"
|
|
@@ -121,7 +121,7 @@ export declare const isReason: (self: unknown) => self is Reason<unknown>;
|
|
|
121
121
|
* Every reason carries an `annotations` map and an `annotate` method for
|
|
122
122
|
* attaching tracing metadata.
|
|
123
123
|
*
|
|
124
|
-
* **Example** (
|
|
124
|
+
* **Example** (Narrowing a reason)
|
|
125
125
|
*
|
|
126
126
|
* ```ts
|
|
127
127
|
* import { Cause } from "effect"
|
|
@@ -144,7 +144,7 @@ export type Reason<E> = Fail<E> | Die | Interrupt;
|
|
|
144
144
|
* Use as a predicate for `Array.filter` to pick out typed `Fail` reasons when
|
|
145
145
|
* iterating over `cause.reasons`.
|
|
146
146
|
*
|
|
147
|
-
* **Example** (
|
|
147
|
+
* **Example** (Filtering fail reasons)
|
|
148
148
|
*
|
|
149
149
|
* ```ts
|
|
150
150
|
* import { Cause } from "effect"
|
|
@@ -169,7 +169,7 @@ export declare const isFailReason: <E>(self: Reason<E>) => self is Fail<E>;
|
|
|
169
169
|
* Use as a predicate for `Array.filter` to pick out `Die` (defect) reasons when
|
|
170
170
|
* iterating over `cause.reasons`.
|
|
171
171
|
*
|
|
172
|
-
* **Example** (
|
|
172
|
+
* **Example** (Filtering die reasons)
|
|
173
173
|
*
|
|
174
174
|
* ```ts
|
|
175
175
|
* import { Cause } from "effect"
|
|
@@ -194,7 +194,7 @@ export declare const isDieReason: <E>(self: Reason<E>) => self is Die;
|
|
|
194
194
|
* Use as a predicate for `Array.filter` to pick out `Interrupt` reasons when
|
|
195
195
|
* iterating over `cause.reasons`.
|
|
196
196
|
*
|
|
197
|
-
* **Example** (
|
|
197
|
+
* **Example** (Filtering interrupt reasons)
|
|
198
198
|
*
|
|
199
199
|
* ```ts
|
|
200
200
|
* import { Cause } from "effect"
|
|
@@ -220,7 +220,7 @@ export declare namespace Cause {
|
|
|
220
220
|
/**
|
|
221
221
|
* Extracts the error type `E` from a `Cause<E>`.
|
|
222
222
|
*
|
|
223
|
-
* **Example** (
|
|
223
|
+
* **Example** (Extracting the error type)
|
|
224
224
|
*
|
|
225
225
|
* ```ts
|
|
226
226
|
* import type { Cause } from "effect"
|
|
@@ -264,7 +264,7 @@ export declare namespace Reason {
|
|
|
264
264
|
/**
|
|
265
265
|
* Extracts the error type `E` from a `Reason<E>`.
|
|
266
266
|
*
|
|
267
|
-
* **Example** (
|
|
267
|
+
* **Example** (Extracting the error type)
|
|
268
268
|
*
|
|
269
269
|
* ```ts
|
|
270
270
|
* import type { Cause } from "effect"
|
|
@@ -292,7 +292,7 @@ export declare namespace Reason {
|
|
|
292
292
|
* typed error channel. Use {@link isDieReason} to narrow a `Reason`
|
|
293
293
|
* to this type.
|
|
294
294
|
*
|
|
295
|
-
* **Example** (
|
|
295
|
+
* **Example** (Accessing the defect)
|
|
296
296
|
*
|
|
297
297
|
* ```ts
|
|
298
298
|
* import { Cause } from "effect"
|
|
@@ -326,7 +326,7 @@ export interface Die extends Cause.ReasonProto<"Die"> {
|
|
|
326
326
|
* The `error` property carries the typed value `E`. Use {@link isFailReason}
|
|
327
327
|
* to narrow a `Reason` to this type.
|
|
328
328
|
*
|
|
329
|
-
* **Example** (
|
|
329
|
+
* **Example** (Accessing the error)
|
|
330
330
|
*
|
|
331
331
|
* ```ts
|
|
332
332
|
* import { Cause } from "effect"
|
|
@@ -355,7 +355,7 @@ export interface Fail<out E> extends Cause.ReasonProto<"Fail"> {
|
|
|
355
355
|
*
|
|
356
356
|
* Use {@link isInterruptReason} to narrow a `Reason` to this type.
|
|
357
357
|
*
|
|
358
|
-
* **Example** (
|
|
358
|
+
* **Example** (Accessing the fiber ID)
|
|
359
359
|
*
|
|
360
360
|
* ```ts
|
|
361
361
|
* import { Cause } from "effect"
|
|
@@ -392,7 +392,7 @@ export interface Interrupt extends Cause.ReasonProto<"Interrupt"> {
|
|
|
392
392
|
* The `reasons` array is stored as provided. Treat the array as immutable
|
|
393
393
|
* after passing it to this function.
|
|
394
394
|
*
|
|
395
|
-
* **Example** (
|
|
395
|
+
* **Example** (Building a cause from reasons)
|
|
396
396
|
*
|
|
397
397
|
* ```ts
|
|
398
398
|
* import { Cause } from "effect"
|
|
@@ -424,7 +424,7 @@ export declare const fromReasons: <E>(reasons: ReadonlyArray<Reason<E>>) => Caus
|
|
|
424
424
|
* Represents the absence of failure. Combining any cause with `empty` via
|
|
425
425
|
* {@link combine} returns the original cause unchanged.
|
|
426
426
|
*
|
|
427
|
-
* **Example** (
|
|
427
|
+
* **Example** (Combining with the empty cause)
|
|
428
428
|
*
|
|
429
429
|
* ```ts
|
|
430
430
|
* import { Cause } from "effect"
|
|
@@ -449,7 +449,7 @@ export declare const empty: Cause<never>;
|
|
|
449
449
|
*
|
|
450
450
|
* Use to construct a cause from an expected typed error.
|
|
451
451
|
*
|
|
452
|
-
* **Example** (
|
|
452
|
+
* **Example** (Creating a fail cause)
|
|
453
453
|
*
|
|
454
454
|
* ```ts
|
|
455
455
|
* import { Cause } from "effect"
|
|
@@ -474,7 +474,7 @@ export declare const fail: <E>(error: E) => Cause<E>;
|
|
|
474
474
|
*
|
|
475
475
|
* Use to construct a cause from an untyped defect or unexpected thrown value.
|
|
476
476
|
*
|
|
477
|
-
* **Example** (
|
|
477
|
+
* **Example** (Creating a die cause)
|
|
478
478
|
*
|
|
479
479
|
* ```ts
|
|
480
480
|
* import { Cause } from "effect"
|
|
@@ -495,7 +495,7 @@ export declare const die: (defect: unknown) => Cause<never>;
|
|
|
495
495
|
* Creates a `Cause` containing a single `Interrupt` reason,
|
|
496
496
|
* optionally carrying the interrupting fiber's ID.
|
|
497
497
|
*
|
|
498
|
-
* **Example** (
|
|
498
|
+
* **Example** (Creating an interrupt cause)
|
|
499
499
|
*
|
|
500
500
|
* ```ts
|
|
501
501
|
* import { Cause } from "effect"
|
|
@@ -520,7 +520,7 @@ export declare const interrupt: (fiberId?: number | undefined) => Cause<never>;
|
|
|
520
520
|
* Use when constructing a standalone typed failure reason for
|
|
521
521
|
* {@link fromReasons} or direct comparison.
|
|
522
522
|
*
|
|
523
|
-
* **Example** (
|
|
523
|
+
* **Example** (Creating a Fail reason)
|
|
524
524
|
*
|
|
525
525
|
* ```ts
|
|
526
526
|
* import { Cause } from "effect"
|
|
@@ -545,7 +545,7 @@ export declare const makeFailReason: <E>(error: E) => Fail<E>;
|
|
|
545
545
|
* Use when constructing a standalone defect reason for {@link fromReasons} or
|
|
546
546
|
* direct comparison.
|
|
547
547
|
*
|
|
548
|
-
* **Example** (
|
|
548
|
+
* **Example** (Creating a Die reason)
|
|
549
549
|
*
|
|
550
550
|
* ```ts
|
|
551
551
|
* import { Cause } from "effect"
|
|
@@ -571,7 +571,7 @@ export declare const makeDieReason: (defect: unknown) => Die;
|
|
|
571
571
|
* Use when constructing a standalone interrupt reason for {@link fromReasons}
|
|
572
572
|
* or direct comparison.
|
|
573
573
|
*
|
|
574
|
-
* **Example** (
|
|
574
|
+
* **Example** (Creating an Interrupt reason)
|
|
575
575
|
*
|
|
576
576
|
* ```ts
|
|
577
577
|
* import { Cause } from "effect"
|
|
@@ -596,7 +596,7 @@ export declare const makeInterruptReason: (fiberId?: number | undefined) => Inte
|
|
|
596
596
|
*
|
|
597
597
|
* Use when you need to detect failures caused only by interruption.
|
|
598
598
|
*
|
|
599
|
-
* **Example** (
|
|
599
|
+
* **Example** (Checking interrupt-only causes)
|
|
600
600
|
*
|
|
601
601
|
* ```ts
|
|
602
602
|
* import { Cause } from "effect"
|
|
@@ -628,7 +628,7 @@ export declare const hasInterruptsOnly: <E>(self: Cause<E>) => boolean;
|
|
|
628
628
|
* containing the mapped failures. If the cause has no `Fail` reasons, the
|
|
629
629
|
* original cause is returned unchanged.
|
|
630
630
|
*
|
|
631
|
-
* **Example** (
|
|
631
|
+
* **Example** (Mapping errors to uppercase)
|
|
632
632
|
*
|
|
633
633
|
* ```ts
|
|
634
634
|
* import { Cause } from "effect"
|
|
@@ -661,7 +661,7 @@ export declare const map: {
|
|
|
661
661
|
* containing the mapped failures. If the cause has no `Fail` reasons, the
|
|
662
662
|
* original cause is returned unchanged.
|
|
663
663
|
*
|
|
664
|
-
* **Example** (
|
|
664
|
+
* **Example** (Mapping errors to uppercase)
|
|
665
665
|
*
|
|
666
666
|
* ```ts
|
|
667
667
|
* import { Cause } from "effect"
|
|
@@ -694,7 +694,7 @@ export declare const map: {
|
|
|
694
694
|
* containing the mapped failures. If the cause has no `Fail` reasons, the
|
|
695
695
|
* original cause is returned unchanged.
|
|
696
696
|
*
|
|
697
|
-
* **Example** (
|
|
697
|
+
* **Example** (Mapping errors to uppercase)
|
|
698
698
|
*
|
|
699
699
|
* ```ts
|
|
700
700
|
* import { Cause } from "effect"
|
|
@@ -726,7 +726,7 @@ export declare const map: {
|
|
|
726
726
|
* - If the result is structurally equal to `self`, `self` is returned
|
|
727
727
|
* (referential shortcut).
|
|
728
728
|
*
|
|
729
|
-
* **Example** (
|
|
729
|
+
* **Example** (Combining two causes)
|
|
730
730
|
*
|
|
731
731
|
* ```ts
|
|
732
732
|
* import { Cause } from "effect"
|
|
@@ -758,7 +758,7 @@ export declare const combine: {
|
|
|
758
758
|
* - If the result is structurally equal to `self`, `self` is returned
|
|
759
759
|
* (referential shortcut).
|
|
760
760
|
*
|
|
761
|
-
* **Example** (
|
|
761
|
+
* **Example** (Combining two causes)
|
|
762
762
|
*
|
|
763
763
|
* ```ts
|
|
764
764
|
* import { Cause } from "effect"
|
|
@@ -790,7 +790,7 @@ export declare const combine: {
|
|
|
790
790
|
* - If the result is structurally equal to `self`, `self` is returned
|
|
791
791
|
* (referential shortcut).
|
|
792
792
|
*
|
|
793
|
-
* **Example** (
|
|
793
|
+
* **Example** (Combining two causes)
|
|
794
794
|
*
|
|
795
795
|
* ```ts
|
|
796
796
|
* import { Cause } from "effect"
|
|
@@ -833,7 +833,7 @@ export declare const combine: {
|
|
|
833
833
|
* This function is lossy. Use {@link prettyErrors} or iterate `cause.reasons`
|
|
834
834
|
* when you need all failures.
|
|
835
835
|
*
|
|
836
|
-
* **Example** (
|
|
836
|
+
* **Example** (Squashing a cause)
|
|
837
837
|
*
|
|
838
838
|
* ```ts
|
|
839
839
|
* import { Cause } from "effect"
|
|
@@ -857,7 +857,7 @@ export declare const squash: <E>(self: Cause<E>) => unknown;
|
|
|
857
857
|
* Use to check whether a cause includes typed failures before extracting,
|
|
858
858
|
* mapping, or rendering them.
|
|
859
859
|
*
|
|
860
|
-
* **Example** (
|
|
860
|
+
* **Example** (Checking for typed errors)
|
|
861
861
|
*
|
|
862
862
|
* ```ts
|
|
863
863
|
* import { Cause } from "effect"
|
|
@@ -884,7 +884,7 @@ export declare const hasFails: <E>(self: Cause<E>) => boolean;
|
|
|
884
884
|
* Use when you need the full `Fail` reason from a `Cause`, including
|
|
885
885
|
* annotations.
|
|
886
886
|
*
|
|
887
|
-
* **Example** (
|
|
887
|
+
* **Example** (Extracting the first Fail reason)
|
|
888
888
|
*
|
|
889
889
|
* ```ts
|
|
890
890
|
* import { Cause, Result } from "effect"
|
|
@@ -913,7 +913,7 @@ export declare const findFail: <E>(self: Cause<E>) => Result.Result<Fail<E>, Cau
|
|
|
913
913
|
* Use when you need the first typed error value from a `Cause` as a `Result`
|
|
914
914
|
* that preserves the original cause when no match is found.
|
|
915
915
|
*
|
|
916
|
-
* **Example** (
|
|
916
|
+
* **Example** (Extracting the first error value)
|
|
917
917
|
*
|
|
918
918
|
* ```ts
|
|
919
919
|
* import { Cause, Result } from "effect"
|
|
@@ -940,7 +940,7 @@ export declare const findError: <E>(self: Cause<E>) => Result.Result<E, Cause<ne
|
|
|
940
940
|
* Use when you need the first typed error value from a `Cause` as an `Option`,
|
|
941
941
|
* discarding the original cause.
|
|
942
942
|
*
|
|
943
|
-
* **Example** (
|
|
943
|
+
* **Example** (Extracting an error as Option)
|
|
944
944
|
*
|
|
945
945
|
* ```ts
|
|
946
946
|
* import { Cause, Option } from "effect"
|
|
@@ -966,7 +966,7 @@ export declare const findErrorOption: <E>(input: Cause<E>) => Option<E>;
|
|
|
966
966
|
* Use to check whether a cause includes defects before extracting or rendering
|
|
967
967
|
* them.
|
|
968
968
|
*
|
|
969
|
-
* **Example** (
|
|
969
|
+
* **Example** (Checking for defects)
|
|
970
970
|
*
|
|
971
971
|
* ```ts
|
|
972
972
|
* import { Cause } from "effect"
|
|
@@ -992,7 +992,7 @@ export declare const hasDies: <E>(self: Cause<E>) => boolean;
|
|
|
992
992
|
* Use when you need the full `Die` reason from a `Cause`, including
|
|
993
993
|
* annotations.
|
|
994
994
|
*
|
|
995
|
-
* **Example** (
|
|
995
|
+
* **Example** (Extracting the first Die reason)
|
|
996
996
|
*
|
|
997
997
|
* ```ts
|
|
998
998
|
* import { Cause, Result } from "effect"
|
|
@@ -1020,7 +1020,7 @@ export declare const findDie: <E>(self: Cause<E>) => Result.Result<Die, Cause<E>
|
|
|
1020
1020
|
* Use when you need the first defect value from a `Cause` as a `Result`,
|
|
1021
1021
|
* without the full `Die` reason.
|
|
1022
1022
|
*
|
|
1023
|
-
* **Example** (
|
|
1023
|
+
* **Example** (Extracting the first defect)
|
|
1024
1024
|
*
|
|
1025
1025
|
* ```ts
|
|
1026
1026
|
* import { Cause, Result } from "effect"
|
|
@@ -1041,7 +1041,7 @@ export declare const findDefect: <E>(self: Cause<E>) => Result.Result<unknown, C
|
|
|
1041
1041
|
/**
|
|
1042
1042
|
* Returns `true` if the cause contains at least one `Interrupt` reason.
|
|
1043
1043
|
*
|
|
1044
|
-
* **Example** (
|
|
1044
|
+
* **Example** (Checking for interruptions)
|
|
1045
1045
|
*
|
|
1046
1046
|
* ```ts
|
|
1047
1047
|
* import { Cause } from "effect"
|
|
@@ -1068,7 +1068,7 @@ export declare const hasInterrupts: <E>(self: Cause<E>) => boolean;
|
|
|
1068
1068
|
* Use when you need the first `Interrupt` reason from a `Cause`, including the
|
|
1069
1069
|
* fiber ID and annotations.
|
|
1070
1070
|
*
|
|
1071
|
-
* **Example** (
|
|
1071
|
+
* **Example** (Extracting the first interrupt)
|
|
1072
1072
|
*
|
|
1073
1073
|
* ```ts
|
|
1074
1074
|
* import { Cause, Result } from "effect"
|
|
@@ -1095,7 +1095,7 @@ export declare const findInterrupt: <E>(self: Cause<E>) => Result.Result<Interru
|
|
|
1095
1095
|
* Use when you need interrupting fiber IDs as a set, with absence represented
|
|
1096
1096
|
* as an empty set.
|
|
1097
1097
|
*
|
|
1098
|
-
* **Example** (
|
|
1098
|
+
* **Example** (Collecting interruptors)
|
|
1099
1099
|
*
|
|
1100
1100
|
* ```ts
|
|
1101
1101
|
* import { Cause } from "effect"
|
|
@@ -1130,7 +1130,7 @@ export declare const interruptors: <E>(self: Cause<E>) => ReadonlySet<number>;
|
|
|
1130
1130
|
* function succeeds with an empty `Set` when every interrupt reason has an
|
|
1131
1131
|
* undefined fiber ID.
|
|
1132
1132
|
*
|
|
1133
|
-
* **Example** (
|
|
1133
|
+
* **Example** (Extracting interruptors with Result)
|
|
1134
1134
|
*
|
|
1135
1135
|
* ```ts
|
|
1136
1136
|
* import { Cause, Result } from "effect"
|
|
@@ -1174,7 +1174,7 @@ export declare const filterInterruptors: <E>(self: Cause<E>) => Result.Result<Se
|
|
|
1174
1174
|
*
|
|
1175
1175
|
* An empty cause returns an empty array.
|
|
1176
1176
|
*
|
|
1177
|
-
* **Example** (
|
|
1177
|
+
* **Example** (Converting a cause to errors)
|
|
1178
1178
|
*
|
|
1179
1179
|
* ```ts
|
|
1180
1180
|
* import { Cause } from "effect"
|
|
@@ -1221,7 +1221,7 @@ export declare const prettyErrors: <E>(self: Cause<E>) => Array<Error>;
|
|
|
1221
1221
|
* Rendering an empty cause produces an empty string because there are no
|
|
1222
1222
|
* errors to render.
|
|
1223
1223
|
*
|
|
1224
|
-
* **Example** (
|
|
1224
|
+
* **Example** (Rendering a cause)
|
|
1225
1225
|
*
|
|
1226
1226
|
* ```ts
|
|
1227
1227
|
* import { Cause } from "effect"
|
|
@@ -1247,7 +1247,7 @@ export declare const pretty: <E>(cause: Cause<E>) => string;
|
|
|
1247
1247
|
* `TimeoutError`, `IllegalArgumentError`, `ExceededCapacityError`,
|
|
1248
1248
|
* `AsyncFiberError`, and `UnknownError`) implement this interface.
|
|
1249
1249
|
*
|
|
1250
|
-
* **Example** (
|
|
1250
|
+
* **Example** (Yielding an error in Effect.gen)
|
|
1251
1251
|
*
|
|
1252
1252
|
* ```ts
|
|
1253
1253
|
* import { Cause, Effect } from "effect"
|
|
@@ -1269,7 +1269,7 @@ export interface YieldableError extends Error, Pipeable, Inspectable {
|
|
|
1269
1269
|
/**
|
|
1270
1270
|
* Checks whether an arbitrary value is a `NoSuchElementError`.
|
|
1271
1271
|
*
|
|
1272
|
-
* **Example** (runtime type
|
|
1272
|
+
* **Example** (Checking the runtime type)
|
|
1273
1273
|
*
|
|
1274
1274
|
* ```ts
|
|
1275
1275
|
* import { Cause } from "effect"
|
|
@@ -1308,7 +1308,7 @@ export declare const NoSuchElementErrorTypeId: "~effect/Cause/NoSuchElementError
|
|
|
1308
1308
|
* expected case. This error is mainly for APIs that intentionally turn absence
|
|
1309
1309
|
* into a thrown value or failed effect.
|
|
1310
1310
|
*
|
|
1311
|
-
* **Example** (
|
|
1311
|
+
* **Example** (Creating and checking a NoSuchElementError)
|
|
1312
1312
|
*
|
|
1313
1313
|
* ```ts
|
|
1314
1314
|
* import { Cause } from "effect"
|
|
@@ -1333,7 +1333,7 @@ export interface NoSuchElementError extends YieldableError {
|
|
|
1333
1333
|
* Use to create the error value for APIs that intentionally fail when an
|
|
1334
1334
|
* expected element is absent.
|
|
1335
1335
|
*
|
|
1336
|
-
* **Example** (
|
|
1336
|
+
* **Example** (Creating a NoSuchElementError)
|
|
1337
1337
|
*
|
|
1338
1338
|
* ```ts
|
|
1339
1339
|
* import { Cause } from "effect"
|
|
@@ -1351,7 +1351,7 @@ export declare const NoSuchElementError: new (message?: string) => NoSuchElement
|
|
|
1351
1351
|
/**
|
|
1352
1352
|
* Checks whether an arbitrary value is a `Done` signal.
|
|
1353
1353
|
*
|
|
1354
|
-
* **Example** (runtime type
|
|
1354
|
+
* **Example** (Checking the runtime type)
|
|
1355
1355
|
*
|
|
1356
1356
|
* ```ts
|
|
1357
1357
|
* import { Cause } from "effect"
|
|
@@ -1386,7 +1386,7 @@ export declare const DoneTypeId: "~effect/Cause/Done";
|
|
|
1386
1386
|
* successful completion. The optional `value` field can carry a final
|
|
1387
1387
|
* leftover payload.
|
|
1388
1388
|
*
|
|
1389
|
-
* **Example** (
|
|
1389
|
+
* **Example** (Signaling queue completion)
|
|
1390
1390
|
*
|
|
1391
1391
|
* ```ts
|
|
1392
1392
|
* import { Cause, Effect, Queue } from "effect"
|
|
@@ -1452,7 +1452,7 @@ export declare const Done: <A = void>(value?: A) => Done<A>;
|
|
|
1452
1452
|
*
|
|
1453
1453
|
* Use when you model stream or queue completion through the error channel.
|
|
1454
1454
|
*
|
|
1455
|
-
* **Example** (
|
|
1455
|
+
* **Example** (Failing with Done)
|
|
1456
1456
|
*
|
|
1457
1457
|
* ```ts
|
|
1458
1458
|
* import { Cause, Effect } from "effect"
|
|
@@ -1480,7 +1480,7 @@ export declare const TimeoutErrorTypeId: "~effect/Cause/TimeoutError";
|
|
|
1480
1480
|
/**
|
|
1481
1481
|
* Checks whether an arbitrary value is a `TimeoutError`.
|
|
1482
1482
|
*
|
|
1483
|
-
* **Example** (runtime type
|
|
1483
|
+
* **Example** (Checking the runtime type)
|
|
1484
1484
|
*
|
|
1485
1485
|
* ```ts
|
|
1486
1486
|
* import { Cause } from "effect"
|
|
@@ -1501,7 +1501,7 @@ export declare const isTimeoutError: (u: unknown) => u is TimeoutError;
|
|
|
1501
1501
|
* Produced by `Effect.timeout` and related APIs. Implements
|
|
1502
1502
|
* `YieldableError`.
|
|
1503
1503
|
*
|
|
1504
|
-
* **Example** (
|
|
1504
|
+
* **Example** (Creating and checking a TimeoutError)
|
|
1505
1505
|
*
|
|
1506
1506
|
* ```ts
|
|
1507
1507
|
* import { Cause } from "effect"
|
|
@@ -1521,7 +1521,7 @@ export interface TimeoutError extends YieldableError {
|
|
|
1521
1521
|
/**
|
|
1522
1522
|
* Constructs a `TimeoutError` with an optional message.
|
|
1523
1523
|
*
|
|
1524
|
-
* **Example** (
|
|
1524
|
+
* **Example** (Creating a TimeoutError)
|
|
1525
1525
|
*
|
|
1526
1526
|
* ```ts
|
|
1527
1527
|
* import { Cause } from "effect"
|
|
@@ -1544,7 +1544,7 @@ export declare const IllegalArgumentErrorTypeId: "~effect/Cause/IllegalArgumentE
|
|
|
1544
1544
|
/**
|
|
1545
1545
|
* Checks whether an arbitrary value is an `IllegalArgumentError`.
|
|
1546
1546
|
*
|
|
1547
|
-
* **Example** (runtime type
|
|
1547
|
+
* **Example** (Checking the runtime type)
|
|
1548
1548
|
*
|
|
1549
1549
|
* ```ts
|
|
1550
1550
|
* import { Cause } from "effect"
|
|
@@ -1565,7 +1565,7 @@ export declare const isIllegalArgumentError: (u: unknown) => u is IllegalArgumen
|
|
|
1565
1565
|
*
|
|
1566
1566
|
* Implements `YieldableError`.
|
|
1567
1567
|
*
|
|
1568
|
-
* **Example** (
|
|
1568
|
+
* **Example** (Creating and checking an IllegalArgumentError)
|
|
1569
1569
|
*
|
|
1570
1570
|
* ```ts
|
|
1571
1571
|
* import { Cause } from "effect"
|
|
@@ -1585,7 +1585,7 @@ export interface IllegalArgumentError extends YieldableError {
|
|
|
1585
1585
|
/**
|
|
1586
1586
|
* Constructs an `IllegalArgumentError` with an optional message.
|
|
1587
1587
|
*
|
|
1588
|
-
* **Example** (
|
|
1588
|
+
* **Example** (Creating an IllegalArgumentError)
|
|
1589
1589
|
*
|
|
1590
1590
|
* ```ts
|
|
1591
1591
|
* import { Cause } from "effect"
|
|
@@ -1601,7 +1601,7 @@ export declare const IllegalArgumentError: new (message?: string) => IllegalArgu
|
|
|
1601
1601
|
/**
|
|
1602
1602
|
* Checks whether an arbitrary value is an `ExceededCapacityError`.
|
|
1603
1603
|
*
|
|
1604
|
-
* **Example** (runtime type
|
|
1604
|
+
* **Example** (Checking the runtime type)
|
|
1605
1605
|
*
|
|
1606
1606
|
* ```ts
|
|
1607
1607
|
* import { Cause } from "effect"
|
|
@@ -1634,7 +1634,7 @@ export declare const ExceededCapacityErrorTypeId: "~effect/Cause/ExceededCapacit
|
|
|
1634
1634
|
*
|
|
1635
1635
|
* Implements `YieldableError`.
|
|
1636
1636
|
*
|
|
1637
|
-
* **Example** (
|
|
1637
|
+
* **Example** (Creating and checking an ExceededCapacityError)
|
|
1638
1638
|
*
|
|
1639
1639
|
* ```ts
|
|
1640
1640
|
* import { Cause } from "effect"
|
|
@@ -1658,7 +1658,7 @@ export interface ExceededCapacityError extends YieldableError {
|
|
|
1658
1658
|
*
|
|
1659
1659
|
* Use to create the error value for bounded-resource capacity failures.
|
|
1660
1660
|
*
|
|
1661
|
-
* **Example** (
|
|
1661
|
+
* **Example** (Creating an ExceededCapacityError)
|
|
1662
1662
|
*
|
|
1663
1663
|
* ```ts
|
|
1664
1664
|
* import { Cause } from "effect"
|
|
@@ -1684,7 +1684,7 @@ export declare const AsyncFiberErrorTypeId: "~effect/Cause/AsyncFiberError";
|
|
|
1684
1684
|
/**
|
|
1685
1685
|
* Checks whether an arbitrary value is an `AsyncFiberError`.
|
|
1686
1686
|
*
|
|
1687
|
-
* **Example** (runtime type
|
|
1687
|
+
* **Example** (Checking the runtime type)
|
|
1688
1688
|
*
|
|
1689
1689
|
* ```ts
|
|
1690
1690
|
* import { Cause } from "effect"
|
|
@@ -1714,7 +1714,7 @@ export declare const isAsyncFiberError: (u: unknown) => u is AsyncFiberError;
|
|
|
1714
1714
|
* The `fiber` property stores the fiber that could not be synchronously
|
|
1715
1715
|
* resolved. This error implements `YieldableError`.
|
|
1716
1716
|
*
|
|
1717
|
-
* **Example** (
|
|
1717
|
+
* **Example** (Accessing the fiber)
|
|
1718
1718
|
*
|
|
1719
1719
|
* ```ts
|
|
1720
1720
|
* import { Cause } from "effect"
|
|
@@ -1744,7 +1744,7 @@ export interface AsyncFiberError extends YieldableError {
|
|
|
1744
1744
|
* Use to create the error value for a fiber that could not be completed by a
|
|
1745
1745
|
* synchronous runner.
|
|
1746
1746
|
*
|
|
1747
|
-
* **Example** (
|
|
1747
|
+
* **Example** (Creating an AsyncFiberError)
|
|
1748
1748
|
*
|
|
1749
1749
|
* ```ts
|
|
1750
1750
|
* import { Cause } from "effect"
|
|
@@ -1772,7 +1772,7 @@ export declare const UnknownErrorTypeId: "~effect/Cause/UnknownError";
|
|
|
1772
1772
|
/**
|
|
1773
1773
|
* Checks whether an arbitrary value is an `UnknownError`.
|
|
1774
1774
|
*
|
|
1775
|
-
* **Example** (runtime type
|
|
1775
|
+
* **Example** (Checking the runtime type)
|
|
1776
1776
|
*
|
|
1777
1777
|
* ```ts
|
|
1778
1778
|
* import { Cause } from "effect"
|
|
@@ -1794,7 +1794,7 @@ export declare const isUnknownError: (u: unknown) => u is UnknownError;
|
|
|
1794
1794
|
* typed error. The original value is stored in the `cause` property inherited
|
|
1795
1795
|
* from `Error`. Implements `YieldableError`.
|
|
1796
1796
|
*
|
|
1797
|
-
* **Example** (
|
|
1797
|
+
* **Example** (Creating and checking an UnknownError)
|
|
1798
1798
|
*
|
|
1799
1799
|
* ```ts
|
|
1800
1800
|
* import { Cause } from "effect"
|
|
@@ -1816,7 +1816,7 @@ export interface UnknownError extends YieldableError {
|
|
|
1816
1816
|
* cause (stored in `Error.cause`); the second is an optional human-readable
|
|
1817
1817
|
* message.
|
|
1818
1818
|
*
|
|
1819
|
-
* **Example** (
|
|
1819
|
+
* **Example** (Creating an UnknownError)
|
|
1820
1820
|
*
|
|
1821
1821
|
* ```ts
|
|
1822
1822
|
* import { Cause } from "effect"
|
|
@@ -1846,7 +1846,7 @@ export declare const UnknownError: new (cause: unknown, message?: string) => Unk
|
|
|
1846
1846
|
* - By default, existing keys are preserved. Pass `{ overwrite: true }` to
|
|
1847
1847
|
* replace them.
|
|
1848
1848
|
*
|
|
1849
|
-
* **Example** (
|
|
1849
|
+
* **Example** (Annotating a cause)
|
|
1850
1850
|
*
|
|
1851
1851
|
* ```ts
|
|
1852
1852
|
* import { Cause, Context } from "effect"
|
|
@@ -1883,7 +1883,7 @@ export declare const annotate: {
|
|
|
1883
1883
|
* - By default, existing keys are preserved. Pass `{ overwrite: true }` to
|
|
1884
1884
|
* replace them.
|
|
1885
1885
|
*
|
|
1886
|
-
* **Example** (
|
|
1886
|
+
* **Example** (Annotating a cause)
|
|
1887
1887
|
*
|
|
1888
1888
|
* ```ts
|
|
1889
1889
|
* import { Cause, Context } from "effect"
|
|
@@ -1922,7 +1922,7 @@ export declare const annotate: {
|
|
|
1922
1922
|
* - By default, existing keys are preserved. Pass `{ overwrite: true }` to
|
|
1923
1923
|
* replace them.
|
|
1924
1924
|
*
|
|
1925
|
-
* **Example** (
|
|
1925
|
+
* **Example** (Annotating a cause)
|
|
1926
1926
|
*
|
|
1927
1927
|
* ```ts
|
|
1928
1928
|
* import { Cause, Context } from "effect"
|
|
@@ -1953,7 +1953,7 @@ export declare const annotate: {
|
|
|
1953
1953
|
* Use when you need tracing metadata (e.g. `StackTrace`) from
|
|
1954
1954
|
* a specific reason rather than the whole cause.
|
|
1955
1955
|
*
|
|
1956
|
-
* **Example** (
|
|
1956
|
+
* **Example** (Reading reason annotations)
|
|
1957
1957
|
*
|
|
1958
1958
|
* ```ts
|
|
1959
1959
|
* import { Cause, Context } from "effect"
|
|
@@ -1984,7 +1984,7 @@ export declare const reasonAnnotations: <E>(self: Reason<E>) => Context.Context<
|
|
|
1984
1984
|
* When multiple reasons contain the same annotation key, the value from the
|
|
1985
1985
|
* later reason wins.
|
|
1986
1986
|
*
|
|
1987
|
-
* **Example** (
|
|
1987
|
+
* **Example** (Reading merged annotations)
|
|
1988
1988
|
*
|
|
1989
1989
|
* ```ts
|
|
1990
1990
|
* import { Cause, Context } from "effect"
|