effect 4.0.0-beta.26 → 4.0.0-beta.28
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/Cause.d.ts +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/Cron.d.ts +1 -1
- package/dist/Data.d.ts +3 -3
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +2 -2
- package/dist/Data.js.map +1 -1
- package/dist/Effect.d.ts +331 -206
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +113 -72
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +1 -1
- package/dist/ErrorReporter.d.ts +2 -4
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +1 -3
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +1 -0
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/Graph.d.ts +1 -1
- package/dist/Layer.d.ts +112 -117
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +43 -44
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +4 -4
- package/dist/LayerMap.js +3 -3
- package/dist/ManagedRuntime.d.ts +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/Metric.d.ts +2 -4
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +2 -4
- package/dist/Metric.js.map +1 -1
- package/dist/PlatformError.d.ts +2 -2
- package/dist/References.d.ts +6 -1
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +6 -1
- package/dist/References.js.map +1 -1
- package/dist/RequestResolver.d.ts +19 -19
- package/dist/RequestResolver.js +10 -10
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Schedule.d.ts +144 -82
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +58 -32
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +9 -0
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +11 -0
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +3 -1
- package/dist/Schema.js.map +1 -1
- package/dist/Stdio.d.ts +6 -2
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +2 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +8 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +8 -4
- package/dist/Stream.js.map +1 -1
- package/dist/Types.d.ts +1 -22
- package/dist/Types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js +3 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +12 -28
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +4 -18
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +20 -1
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +8 -0
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +65 -12
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +159 -45
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +4 -11
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +0 -5
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +4 -4
- package/dist/unstable/cli/CliError.js +4 -4
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Prompt.js +31 -0
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +5 -5
- package/dist/unstable/cluster/Reply.d.ts +3 -3
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +1 -1
- package/dist/unstable/http/Cookies.d.ts +45 -1
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +22 -0
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +16 -0
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +11 -0
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +7 -7
- package/dist/unstable/http/HttpClientRequest.d.ts +5 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +21 -17
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +7 -0
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +6 -0
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +6 -6
- package/dist/unstable/http/HttpServerRequest.d.ts +11 -0
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +291 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +47 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +227 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/Multipart.d.ts +1 -1
- package/dist/unstable/http/UrlParams.d.ts +1 -1
- package/dist/unstable/http/index.d.ts +4 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +4 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +5 -0
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +1 -0
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +4 -10
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +4 -6
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +39 -9
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +8 -8
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +46 -20
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +5 -5
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +2 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/Utils.js +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +21 -0
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +15 -0
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +3 -3
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +1 -1
- package/package.json +1 -1
- package/src/Cause.ts +1 -1
- package/src/Data.ts +3 -4
- package/src/Effect.ts +331 -206
- package/src/ErrorReporter.ts +2 -4
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +1 -0
- package/src/Layer.ts +112 -117
- package/src/LayerMap.ts +4 -4
- package/src/ManagedRuntime.ts +1 -1
- package/src/Metric.ts +2 -4
- package/src/References.ts +6 -1
- package/src/RequestResolver.ts +20 -20
- package/src/Schedule.ts +144 -82
- package/src/Scheduler.ts +12 -0
- package/src/Schema.ts +3 -1
- package/src/Stdio.ts +8 -4
- package/src/Stream.ts +8 -4
- package/src/Types.ts +1 -23
- package/src/index.ts +5 -3
- package/src/internal/effect.ts +3 -0
- package/src/unstable/ai/LanguageModel.ts +16 -37
- package/src/unstable/ai/McpSchema.ts +14 -0
- package/src/unstable/ai/McpServer.ts +224 -53
- package/src/unstable/ai/Toolkit.ts +5 -14
- package/src/unstable/ai/internal/codec-transformer.ts +0 -7
- package/src/unstable/cli/CliError.ts +4 -4
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +27 -0
- package/src/unstable/http/Cookies.ts +84 -0
- package/src/unstable/http/Headers.ts +34 -0
- package/src/unstable/http/HttpClientRequest.ts +21 -17
- package/src/unstable/http/HttpEffect.ts +8 -0
- package/src/unstable/http/HttpServerRequest.ts +388 -1
- package/src/unstable/http/HttpServerResponse.ts +328 -1
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/index.ts +5 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +3 -0
- package/src/unstable/httpapi/HttpApiGroup.ts +1 -0
- package/src/unstable/reactivity/Atom.ts +20 -26
- package/src/unstable/reactivity/AtomHttpApi.ts +45 -11
- package/src/unstable/reactivity/AtomRpc.ts +48 -17
- package/src/unstable/rpc/Rpc.ts +1 -3
- package/src/unstable/rpc/RpcMiddleware.ts +12 -6
- package/src/unstable/rpc/RpcServer.ts +2 -2
- package/src/unstable/rpc/Utils.ts +1 -1
- package/src/unstable/schema/Model.ts +31 -0
- package/src/unstable/sql/SqlResolver.ts +2 -2
package/src/ErrorReporter.ts
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
*
|
|
40
40
|
* // Opt in to error reporting with Effect.withErrorReporting
|
|
41
41
|
* const program = Effect.gen(function*() {
|
|
42
|
-
* yield* new RateLimitError({ retryAfter: 60 })
|
|
42
|
+
* return yield* new RateLimitError({ retryAfter: 60 })
|
|
43
43
|
* }).pipe(
|
|
44
44
|
* Effect.withErrorReporting,
|
|
45
45
|
* Effect.provide(ErrorReporter.layer([consoleReporter]))
|
|
@@ -200,9 +200,7 @@ export const CurrentErrorReporters: ServiceMap.Reference<ReadonlySet<ErrorReport
|
|
|
200
200
|
* { mergeWithExisting: true }
|
|
201
201
|
* )
|
|
202
202
|
*
|
|
203
|
-
* const program = Effect.
|
|
204
|
-
* yield* Effect.fail("boom")
|
|
205
|
-
* }).pipe(
|
|
203
|
+
* const program = Effect.fail("boom").pipe(
|
|
206
204
|
* Effect.withErrorReporting,
|
|
207
205
|
* Effect.provide(ReporterLive)
|
|
208
206
|
* )
|
package/src/Exit.ts
CHANGED
|
@@ -857,10 +857,12 @@ export const map: {
|
|
|
857
857
|
* **Example** (Mapping over an error)
|
|
858
858
|
*
|
|
859
859
|
* ```ts
|
|
860
|
-
* import { Exit } from "effect"
|
|
860
|
+
* import { Data, Exit } from "effect"
|
|
861
|
+
*
|
|
862
|
+
* class ExitError extends Data.TaggedError("ExitError")<{ readonly input: string }> {}
|
|
861
863
|
*
|
|
862
864
|
* const exit = Exit.fail("bad input")
|
|
863
|
-
* const mapped = Exit.mapError(exit, (e) => new
|
|
865
|
+
* const mapped = Exit.mapError(exit, (e) => new ExitError({ input: e }))
|
|
864
866
|
* console.log(Exit.isFailure(mapped)) // true
|
|
865
867
|
* ```
|
|
866
868
|
*
|
|
@@ -884,10 +886,12 @@ export const mapError: {
|
|
|
884
886
|
* **Example** (Mapping over an error)
|
|
885
887
|
*
|
|
886
888
|
* ```ts
|
|
887
|
-
* import { Exit } from "effect"
|
|
889
|
+
* import { Data, Exit } from "effect"
|
|
890
|
+
*
|
|
891
|
+
* class ExitError extends Data.TaggedError("ExitError")<{ readonly input: string }> {}
|
|
888
892
|
*
|
|
889
893
|
* const exit = Exit.fail("bad input")
|
|
890
|
-
* const mapped = Exit.mapError(exit, (e) => new
|
|
894
|
+
* const mapped = Exit.mapError(exit, (e) => new ExitError({ input: e }))
|
|
891
895
|
* console.log(Exit.isFailure(mapped)) // true
|
|
892
896
|
* ```
|
|
893
897
|
*
|
|
@@ -911,10 +915,12 @@ export const mapError: {
|
|
|
911
915
|
* **Example** (Mapping over an error)
|
|
912
916
|
*
|
|
913
917
|
* ```ts
|
|
914
|
-
* import { Exit } from "effect"
|
|
918
|
+
* import { Data, Exit } from "effect"
|
|
919
|
+
*
|
|
920
|
+
* class ExitError extends Data.TaggedError("ExitError")<{ readonly input: string }> {}
|
|
915
921
|
*
|
|
916
922
|
* const exit = Exit.fail("bad input")
|
|
917
|
-
* const mapped = Exit.mapError(exit, (e) => new
|
|
923
|
+
* const mapped = Exit.mapError(exit, (e) => new ExitError({ input: e }))
|
|
918
924
|
* console.log(Exit.isFailure(mapped)) // true
|
|
919
925
|
* ```
|
|
920
926
|
*
|
|
@@ -941,12 +947,14 @@ export const mapError: {
|
|
|
941
947
|
* **Example** (Mapping both channels)
|
|
942
948
|
*
|
|
943
949
|
* ```ts
|
|
944
|
-
* import { Exit } from "effect"
|
|
950
|
+
* import { Data, Exit } from "effect"
|
|
951
|
+
*
|
|
952
|
+
* class ExitError extends Data.TaggedError("ExitError")<{ readonly input: string }> {}
|
|
945
953
|
*
|
|
946
954
|
* const exit = Exit.succeed(42)
|
|
947
955
|
* const mapped = Exit.mapBoth(exit, {
|
|
948
956
|
* onSuccess: (x) => String(x),
|
|
949
|
-
* onFailure: (e: string) => new
|
|
957
|
+
* onFailure: (e: string) => new ExitError({ input: e })
|
|
950
958
|
* })
|
|
951
959
|
* console.log(Exit.isSuccess(mapped) && mapped.value) // "42"
|
|
952
960
|
* ```
|
|
@@ -972,12 +980,14 @@ export const mapBoth: {
|
|
|
972
980
|
* **Example** (Mapping both channels)
|
|
973
981
|
*
|
|
974
982
|
* ```ts
|
|
975
|
-
* import { Exit } from "effect"
|
|
983
|
+
* import { Data, Exit } from "effect"
|
|
984
|
+
*
|
|
985
|
+
* class ExitError extends Data.TaggedError("ExitError")<{ readonly input: string }> {}
|
|
976
986
|
*
|
|
977
987
|
* const exit = Exit.succeed(42)
|
|
978
988
|
* const mapped = Exit.mapBoth(exit, {
|
|
979
989
|
* onSuccess: (x) => String(x),
|
|
980
|
-
* onFailure: (e: string) => new
|
|
990
|
+
* onFailure: (e: string) => new ExitError({ input: e })
|
|
981
991
|
* })
|
|
982
992
|
* console.log(Exit.isSuccess(mapped) && mapped.value) // "42"
|
|
983
993
|
* ```
|
|
@@ -1005,12 +1015,14 @@ export const mapBoth: {
|
|
|
1005
1015
|
* **Example** (Mapping both channels)
|
|
1006
1016
|
*
|
|
1007
1017
|
* ```ts
|
|
1008
|
-
* import { Exit } from "effect"
|
|
1018
|
+
* import { Data, Exit } from "effect"
|
|
1019
|
+
*
|
|
1020
|
+
* class ExitError extends Data.TaggedError("ExitError")<{ readonly input: string }> {}
|
|
1009
1021
|
*
|
|
1010
1022
|
* const exit = Exit.succeed(42)
|
|
1011
1023
|
* const mapped = Exit.mapBoth(exit, {
|
|
1012
1024
|
* onSuccess: (x) => String(x),
|
|
1013
|
-
* onFailure: (e: string) => new
|
|
1025
|
+
* onFailure: (e: string) => new ExitError({ input: e })
|
|
1014
1026
|
* })
|
|
1015
1027
|
* console.log(Exit.isSuccess(mapped) && mapped.value) // "42"
|
|
1016
1028
|
* ```
|
package/src/Fiber.ts
CHANGED
|
@@ -128,6 +128,7 @@ export interface Fiber<out A, out E = never> extends Pipeable {
|
|
|
128
128
|
readonly minimumLogLevel: LogLevel
|
|
129
129
|
readonly currentStackFrame?: StackFrame | undefined
|
|
130
130
|
readonly maxOpsBeforeYield: number
|
|
131
|
+
readonly currentPreventYield: boolean
|
|
131
132
|
readonly addObserver: (cb: (exit: Exit<A, E>) => void) => () => void
|
|
132
133
|
readonly interruptUnsafe: (
|
|
133
134
|
fiberId?: number | undefined,
|