effect 4.0.0-beta.10 → 4.0.0-beta.12
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/Channel.d.ts +7 -7
- package/dist/Config.d.ts +157 -0
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +56 -1
- package/dist/Config.js.map +1 -1
- package/dist/Effect.d.ts +296 -8
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +72 -0
- package/dist/Effect.js.map +1 -1
- package/dist/ErrorReporter.d.ts +376 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +246 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/Fiber.d.ts +2 -2
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +3 -6
- package/dist/Graph.js.map +1 -1
- package/dist/LogLevel.d.ts +5 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +25 -91
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +0 -1
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +17 -0
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +17 -0
- package/dist/Random.js.map +1 -1
- package/dist/References.d.ts +3 -3
- package/dist/References.d.ts.map +1 -1
- package/dist/Schema.d.ts +3 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +2 -1
- package/dist/SchemaAST.js.map +1 -1
- package/dist/Stream.d.ts +5 -5
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js +98 -33
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +2 -2
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +86 -14
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +112 -36
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +47 -10
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +33 -6
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +16 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +14 -0
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/CliOutput.js +37 -6
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +199 -7
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +116 -6
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +60 -2
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +11 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +33 -8
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +7 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +10 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +2 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +27 -10
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +28 -4
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +3 -8
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +25 -31
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +4 -8
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +14 -27
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +37 -44
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +2 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +2 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +11 -0
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +29 -9
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/reactivity/Atom.js +1 -1
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +22 -1
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +14 -0
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +34 -9
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +0 -7
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +9 -10
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +131 -0
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Channel.ts +9 -9
- package/src/Config.ts +171 -9
- package/src/Effect.ts +315 -8
- package/src/ErrorReporter.ts +459 -0
- package/src/Fiber.ts +9 -2
- package/src/Graph.ts +16 -6
- package/src/LogLevel.ts +6 -0
- package/src/Logger.ts +28 -95
- package/src/Queue.ts +0 -1
- package/src/Random.ts +18 -0
- package/src/References.ts +4 -4
- package/src/Schema.ts +1 -1
- package/src/SchemaAST.ts +2 -1
- package/src/Stream.ts +7 -7
- package/src/index.ts +5 -0
- package/src/internal/effect.ts +205 -49
- package/src/internal/hashMap.ts +2 -2
- package/src/unstable/ai/LanguageModel.ts +117 -16
- package/src/unstable/ai/McpSchema.ts +57 -11
- package/src/unstable/ai/McpServer.ts +44 -6
- package/src/unstable/ai/Tool.ts +15 -0
- package/src/unstable/cli/CliOutput.ts +45 -6
- package/src/unstable/cli/Command.ts +298 -11
- package/src/unstable/cli/HelpDoc.ts +68 -2
- package/src/unstable/cli/internal/command.ts +47 -11
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +7 -2
- package/src/unstable/cli/internal/parser.ts +11 -3
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +2 -2
- package/src/unstable/http/Headers.ts +28 -13
- package/src/unstable/http/HttpClient.ts +45 -10
- package/src/unstable/http/HttpEffect.ts +30 -44
- package/src/unstable/http/HttpMiddleware.ts +4 -14
- package/src/unstable/http/HttpServerError.ts +42 -45
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +3 -1
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +2 -1
- package/src/unstable/httpapi/HttpApiError.ts +30 -9
- package/src/unstable/observability/OtlpLogger.ts +9 -5
- package/src/unstable/reactivity/Atom.ts +1 -1
- package/src/unstable/reactivity/AtomRegistry.ts +29 -1
- package/src/unstable/rpc/RpcSchema.ts +17 -0
- package/src/unstable/rpc/RpcSerialization.ts +44 -9
- package/src/unstable/rpc/RpcServer.ts +14 -19
- package/src/unstable/workflow/WorkflowEngine.ts +178 -0
package/dist/Effect.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ import { type LazyArg } from "./Function.ts";
|
|
|
78
78
|
import type { TypeLambda } from "./HKT.ts";
|
|
79
79
|
import type * as Layer from "./Layer.ts";
|
|
80
80
|
import type { Logger } from "./Logger.ts";
|
|
81
|
-
import type {
|
|
81
|
+
import type { Severity } from "./LogLevel.ts";
|
|
82
82
|
import * as Metric from "./Metric.ts";
|
|
83
83
|
import type { Option } from "./Option.ts";
|
|
84
84
|
import type { Pipeable } from "./Pipeable.ts";
|
|
@@ -724,6 +724,199 @@ export declare const partition: {
|
|
|
724
724
|
readonly concurrency?: Concurrency | undefined;
|
|
725
725
|
}): Effect<[excluded: Array<E>, satisfying: Array<B>], never, R>;
|
|
726
726
|
};
|
|
727
|
+
/**
|
|
728
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
729
|
+
*
|
|
730
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
731
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
732
|
+
* If all effects succeed, it returns all collected successes.
|
|
733
|
+
*
|
|
734
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
735
|
+
* elements.
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* ```ts
|
|
739
|
+
* import { Effect } from "effect"
|
|
740
|
+
*
|
|
741
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
742
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
743
|
+
* )
|
|
744
|
+
*
|
|
745
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
746
|
+
* // {
|
|
747
|
+
* // _id: 'Exit',
|
|
748
|
+
* // _tag: 'Failure',
|
|
749
|
+
* // cause: {
|
|
750
|
+
* // _id: 'Cause',
|
|
751
|
+
* // reasons: [
|
|
752
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
753
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
754
|
+
* // ]
|
|
755
|
+
* // }
|
|
756
|
+
* // }
|
|
757
|
+
* ```
|
|
758
|
+
*
|
|
759
|
+
* @since 4.0.0
|
|
760
|
+
* @category Error Accumulation
|
|
761
|
+
*/
|
|
762
|
+
export declare const validate: {
|
|
763
|
+
/**
|
|
764
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
765
|
+
*
|
|
766
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
767
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
768
|
+
* If all effects succeed, it returns all collected successes.
|
|
769
|
+
*
|
|
770
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
771
|
+
* elements.
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```ts
|
|
775
|
+
* import { Effect } from "effect"
|
|
776
|
+
*
|
|
777
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
778
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
779
|
+
* )
|
|
780
|
+
*
|
|
781
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
782
|
+
* // {
|
|
783
|
+
* // _id: 'Exit',
|
|
784
|
+
* // _tag: 'Failure',
|
|
785
|
+
* // cause: {
|
|
786
|
+
* // _id: 'Cause',
|
|
787
|
+
* // reasons: [
|
|
788
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
789
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
790
|
+
* // ]
|
|
791
|
+
* // }
|
|
792
|
+
* // }
|
|
793
|
+
* ```
|
|
794
|
+
*
|
|
795
|
+
* @since 4.0.0
|
|
796
|
+
* @category Error Accumulation
|
|
797
|
+
*/
|
|
798
|
+
<A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options?: {
|
|
799
|
+
readonly concurrency?: Concurrency | undefined;
|
|
800
|
+
readonly discard?: false | undefined;
|
|
801
|
+
} | undefined): (elements: Iterable<A>) => Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
|
|
802
|
+
/**
|
|
803
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
804
|
+
*
|
|
805
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
806
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
807
|
+
* If all effects succeed, it returns all collected successes.
|
|
808
|
+
*
|
|
809
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
810
|
+
* elements.
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```ts
|
|
814
|
+
* import { Effect } from "effect"
|
|
815
|
+
*
|
|
816
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
817
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
818
|
+
* )
|
|
819
|
+
*
|
|
820
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
821
|
+
* // {
|
|
822
|
+
* // _id: 'Exit',
|
|
823
|
+
* // _tag: 'Failure',
|
|
824
|
+
* // cause: {
|
|
825
|
+
* // _id: 'Cause',
|
|
826
|
+
* // reasons: [
|
|
827
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
828
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
829
|
+
* // ]
|
|
830
|
+
* // }
|
|
831
|
+
* // }
|
|
832
|
+
* ```
|
|
833
|
+
*
|
|
834
|
+
* @since 4.0.0
|
|
835
|
+
* @category Error Accumulation
|
|
836
|
+
*/
|
|
837
|
+
<A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options: {
|
|
838
|
+
readonly concurrency?: Concurrency | undefined;
|
|
839
|
+
readonly discard: true;
|
|
840
|
+
}): (elements: Iterable<A>) => Effect<void, Arr.NonEmptyArray<E>, R>;
|
|
841
|
+
/**
|
|
842
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
843
|
+
*
|
|
844
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
845
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
846
|
+
* If all effects succeed, it returns all collected successes.
|
|
847
|
+
*
|
|
848
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
849
|
+
* elements.
|
|
850
|
+
*
|
|
851
|
+
* @example
|
|
852
|
+
* ```ts
|
|
853
|
+
* import { Effect } from "effect"
|
|
854
|
+
*
|
|
855
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
856
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
857
|
+
* )
|
|
858
|
+
*
|
|
859
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
860
|
+
* // {
|
|
861
|
+
* // _id: 'Exit',
|
|
862
|
+
* // _tag: 'Failure',
|
|
863
|
+
* // cause: {
|
|
864
|
+
* // _id: 'Cause',
|
|
865
|
+
* // reasons: [
|
|
866
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
867
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
868
|
+
* // ]
|
|
869
|
+
* // }
|
|
870
|
+
* // }
|
|
871
|
+
* ```
|
|
872
|
+
*
|
|
873
|
+
* @since 4.0.0
|
|
874
|
+
* @category Error Accumulation
|
|
875
|
+
*/
|
|
876
|
+
<A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options?: {
|
|
877
|
+
readonly concurrency?: Concurrency | undefined;
|
|
878
|
+
readonly discard?: false | undefined;
|
|
879
|
+
} | undefined): Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
|
|
880
|
+
/**
|
|
881
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
882
|
+
*
|
|
883
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
884
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
885
|
+
* If all effects succeed, it returns all collected successes.
|
|
886
|
+
*
|
|
887
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
888
|
+
* elements.
|
|
889
|
+
*
|
|
890
|
+
* @example
|
|
891
|
+
* ```ts
|
|
892
|
+
* import { Effect } from "effect"
|
|
893
|
+
*
|
|
894
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
895
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
896
|
+
* )
|
|
897
|
+
*
|
|
898
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
899
|
+
* // {
|
|
900
|
+
* // _id: 'Exit',
|
|
901
|
+
* // _tag: 'Failure',
|
|
902
|
+
* // cause: {
|
|
903
|
+
* // _id: 'Cause',
|
|
904
|
+
* // reasons: [
|
|
905
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
906
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
907
|
+
* // ]
|
|
908
|
+
* // }
|
|
909
|
+
* // }
|
|
910
|
+
* ```
|
|
911
|
+
*
|
|
912
|
+
* @since 4.0.0
|
|
913
|
+
* @category Error Accumulation
|
|
914
|
+
*/
|
|
915
|
+
<A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options: {
|
|
916
|
+
readonly concurrency?: Concurrency | undefined;
|
|
917
|
+
readonly discard: true;
|
|
918
|
+
}): Effect<void, Arr.NonEmptyArray<E>, R>;
|
|
919
|
+
};
|
|
727
920
|
/**
|
|
728
921
|
* Executes an effectful operation for each element in an `Iterable`.
|
|
729
922
|
*
|
|
@@ -6421,11 +6614,11 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
|
|
|
6421
6614
|
* @category Error Handling
|
|
6422
6615
|
*/
|
|
6423
6616
|
export declare const ignore: <Arg extends Effect<any, any, any> | {
|
|
6424
|
-
readonly log?: boolean |
|
|
6617
|
+
readonly log?: boolean | Severity | undefined;
|
|
6425
6618
|
} | undefined = {
|
|
6426
|
-
readonly log?: boolean |
|
|
6619
|
+
readonly log?: boolean | Severity | undefined;
|
|
6427
6620
|
}>(effectOrOptions?: Arg, options?: {
|
|
6428
|
-
readonly log?: boolean |
|
|
6621
|
+
readonly log?: boolean | Severity | undefined;
|
|
6429
6622
|
} | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>;
|
|
6430
6623
|
/**
|
|
6431
6624
|
* Ignores the effect's failure cause, including defects and interruptions.
|
|
@@ -6446,11 +6639,11 @@ export declare const ignore: <Arg extends Effect<any, any, any> | {
|
|
|
6446
6639
|
* @category Error Handling
|
|
6447
6640
|
*/
|
|
6448
6641
|
export declare const ignoreCause: <Arg extends Effect<any, any, any> | {
|
|
6449
|
-
readonly log?: boolean |
|
|
6642
|
+
readonly log?: boolean | Severity | undefined;
|
|
6450
6643
|
} | undefined = {
|
|
6451
|
-
readonly log?: boolean |
|
|
6644
|
+
readonly log?: boolean | Severity | undefined;
|
|
6452
6645
|
}>(effectOrOptions?: Arg, options?: {
|
|
6453
|
-
readonly log?: boolean |
|
|
6646
|
+
readonly log?: boolean | Severity | undefined;
|
|
6454
6647
|
} | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>;
|
|
6455
6648
|
/**
|
|
6456
6649
|
* Apply an `ExecutionPlan` to an effect, retrying with step-provided resources
|
|
@@ -6556,6 +6749,22 @@ export declare const withExecutionPlan: {
|
|
|
6556
6749
|
requirements: PlanR;
|
|
6557
6750
|
}>): Effect<A, E | PlanE, Exclude<R, Provides> | PlanR>;
|
|
6558
6751
|
};
|
|
6752
|
+
/**
|
|
6753
|
+
* Runs an effect and reports any errors to the configured `ErrorReporter`s.
|
|
6754
|
+
*
|
|
6755
|
+
* If the `defectsOnly` option is set to `true`, only defects (unrecoverable
|
|
6756
|
+
* errors) will be reported, while regular failures will be ignored.
|
|
6757
|
+
*
|
|
6758
|
+
* @since 4.0.0
|
|
6759
|
+
* @category Error Handling
|
|
6760
|
+
*/
|
|
6761
|
+
export declare const withErrorReporting: <Arg extends Effect<any, any, any> | {
|
|
6762
|
+
readonly defectsOnly?: boolean | undefined;
|
|
6763
|
+
} | undefined = {
|
|
6764
|
+
readonly defectsOnly?: boolean | undefined;
|
|
6765
|
+
}>(effectOrOptions: Arg, options?: {
|
|
6766
|
+
readonly defectsOnly?: boolean | undefined;
|
|
6767
|
+
} | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Arg : <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
6559
6768
|
/**
|
|
6560
6769
|
* Replaces the original failure with a success value, ensuring the effect
|
|
6561
6770
|
* cannot fail.
|
|
@@ -15630,7 +15839,7 @@ export declare const clockWith: <A, E, R>(f: (clock: Clock) => Effect<A, E, R>)
|
|
|
15630
15839
|
* @since 2.0.0
|
|
15631
15840
|
* @category Logging
|
|
15632
15841
|
*/
|
|
15633
|
-
export declare const logWithLevel: (level?:
|
|
15842
|
+
export declare const logWithLevel: (level?: Severity) => (...message: ReadonlyArray<any>) => Effect<void>;
|
|
15634
15843
|
/**
|
|
15635
15844
|
* Logs one or more messages using the default log level.
|
|
15636
15845
|
*
|
|
@@ -15897,6 +16106,85 @@ export declare const annotateLogs: {
|
|
|
15897
16106
|
<A, E, R>(effect: Effect<A, E, R>, key: string, value: unknown): Effect<A, E, R>;
|
|
15898
16107
|
<A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>;
|
|
15899
16108
|
};
|
|
16109
|
+
/**
|
|
16110
|
+
* Adds log annotations to the current scope.
|
|
16111
|
+
*
|
|
16112
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
16113
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16114
|
+
* restores the previous annotations when the scope closes.
|
|
16115
|
+
*
|
|
16116
|
+
* @example
|
|
16117
|
+
* ```ts
|
|
16118
|
+
* import { Effect } from "effect"
|
|
16119
|
+
*
|
|
16120
|
+
* const program = Effect.scoped(
|
|
16121
|
+
* Effect.gen(function*() {
|
|
16122
|
+
* yield* Effect.log("before")
|
|
16123
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
16124
|
+
* yield* Effect.log("inside scope")
|
|
16125
|
+
* })
|
|
16126
|
+
* )
|
|
16127
|
+
*
|
|
16128
|
+
* Effect.runPromise(program)
|
|
16129
|
+
* ```
|
|
16130
|
+
*
|
|
16131
|
+
* @since 4.0.0
|
|
16132
|
+
* @category Logging
|
|
16133
|
+
*/
|
|
16134
|
+
export declare const annotateLogsScoped: {
|
|
16135
|
+
/**
|
|
16136
|
+
* Adds log annotations to the current scope.
|
|
16137
|
+
*
|
|
16138
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
16139
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16140
|
+
* restores the previous annotations when the scope closes.
|
|
16141
|
+
*
|
|
16142
|
+
* @example
|
|
16143
|
+
* ```ts
|
|
16144
|
+
* import { Effect } from "effect"
|
|
16145
|
+
*
|
|
16146
|
+
* const program = Effect.scoped(
|
|
16147
|
+
* Effect.gen(function*() {
|
|
16148
|
+
* yield* Effect.log("before")
|
|
16149
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
16150
|
+
* yield* Effect.log("inside scope")
|
|
16151
|
+
* })
|
|
16152
|
+
* )
|
|
16153
|
+
*
|
|
16154
|
+
* Effect.runPromise(program)
|
|
16155
|
+
* ```
|
|
16156
|
+
*
|
|
16157
|
+
* @since 4.0.0
|
|
16158
|
+
* @category Logging
|
|
16159
|
+
*/
|
|
16160
|
+
(key: string, value: unknown): Effect<void, never, Scope>;
|
|
16161
|
+
/**
|
|
16162
|
+
* Adds log annotations to the current scope.
|
|
16163
|
+
*
|
|
16164
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
16165
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16166
|
+
* restores the previous annotations when the scope closes.
|
|
16167
|
+
*
|
|
16168
|
+
* @example
|
|
16169
|
+
* ```ts
|
|
16170
|
+
* import { Effect } from "effect"
|
|
16171
|
+
*
|
|
16172
|
+
* const program = Effect.scoped(
|
|
16173
|
+
* Effect.gen(function*() {
|
|
16174
|
+
* yield* Effect.log("before")
|
|
16175
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
16176
|
+
* yield* Effect.log("inside scope")
|
|
16177
|
+
* })
|
|
16178
|
+
* )
|
|
16179
|
+
*
|
|
16180
|
+
* Effect.runPromise(program)
|
|
16181
|
+
* ```
|
|
16182
|
+
*
|
|
16183
|
+
* @since 4.0.0
|
|
16184
|
+
* @category Logging
|
|
16185
|
+
*/
|
|
16186
|
+
(values: Record<string, unknown>): Effect<void, never, Scope>;
|
|
16187
|
+
};
|
|
15900
16188
|
/**
|
|
15901
16189
|
* Adds a span to each log line in this effect.
|
|
15902
16190
|
*
|