effect 4.0.0-beta.65 → 4.0.0-beta.66
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 +4 -4
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Config.d.ts +1 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +7 -6
- package/dist/Config.js.map +1 -1
- package/dist/Context.d.ts +3 -4
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +10 -8
- package/dist/Context.js.map +1 -1
- package/dist/DateTime.d.ts +1 -1
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +2 -2
- package/dist/DateTime.js.map +1 -1
- package/dist/Effect.d.ts +337 -412
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +5 -32
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +1 -1
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +2 -3
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +1 -1
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/FiberHandle.d.ts +2 -2
- package/dist/FiberHandle.js +2 -2
- package/dist/FiberMap.d.ts +2 -2
- package/dist/FiberMap.js +2 -2
- package/dist/FiberSet.d.ts +1 -1
- package/dist/FiberSet.js +1 -1
- package/dist/Layer.js +1 -1
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +3 -3
- package/dist/LayerMap.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/Option.d.ts +11 -7
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +74 -0
- package/dist/Option.js.map +1 -1
- package/dist/Result.d.ts +11 -3
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js.map +1 -1
- package/dist/Schedule.js +1 -1
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +12 -12
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +6 -4
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaGetter.js +2 -2
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/Stream.d.ts +3 -3
- package/dist/Stream.js +1 -1
- package/dist/TxRef.js +1 -1
- package/dist/TxRef.js.map +1 -1
- package/dist/internal/concurrency.js +2 -2
- package/dist/internal/concurrency.js.map +1 -1
- package/dist/internal/core.js +8 -20
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +20 -19
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/executionPlan.js +2 -2
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/option.js +5 -8
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/result.js +5 -8
- package/dist/internal/result.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +5 -5
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +1 -1
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpServer.js +2 -2
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +5 -1
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +4 -4
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -3
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +28 -31
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +25 -5
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +1 -1
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +1 -2
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +8 -10
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +2 -6
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +7 -9
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.js +3 -3
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +1 -1
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +1 -1
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +4 -4
- package/dist/unstable/http/HttpBody.js +2 -2
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.js +1 -1
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -2
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +18 -21
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +1 -1
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +4 -4
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.js +1 -1
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +11 -11
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +5 -5
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.js +1 -1
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +3 -3
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +2 -0
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +2 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +3 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +2 -2
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +1 -1
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +2 -45
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +51 -7
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +4 -4
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +1 -1
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +1 -1
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +1 -1
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +1 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/Migrator.js +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -1
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +122 -0
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -0
- package/dist/unstable/workflow/DurableQueue.js +182 -0
- package/dist/unstable/workflow/DurableQueue.js.map +1 -0
- package/dist/unstable/workflow/Workflow.js +1 -1
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/index.d.ts +4 -0
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +4 -0
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Cause.ts +4 -4
- package/src/Config.ts +8 -8
- package/src/Context.ts +13 -14
- package/src/DateTime.ts +2 -2
- package/src/Effect.ts +340 -431
- package/src/Effectable.ts +2 -2
- package/src/ExecutionPlan.ts +3 -4
- package/src/FiberHandle.ts +2 -2
- package/src/FiberMap.ts +2 -2
- package/src/FiberSet.ts +1 -1
- package/src/Layer.ts +1 -1
- package/src/LayerMap.ts +3 -4
- package/src/ManagedRuntime.ts +1 -1
- package/src/Option.ts +14 -7
- package/src/Result.ts +14 -3
- package/src/Schedule.ts +1 -1
- package/src/Schema.ts +26 -24
- package/src/SchemaGetter.ts +3 -3
- package/src/Stream.ts +4 -4
- package/src/TxRef.ts +1 -1
- package/src/internal/concurrency.ts +2 -2
- package/src/internal/core.ts +12 -23
- package/src/internal/effect.ts +25 -29
- package/src/internal/executionPlan.ts +2 -2
- package/src/internal/option.ts +5 -8
- package/src/internal/result.ts +5 -8
- package/src/unstable/ai/LanguageModel.ts +12 -19
- package/src/unstable/ai/McpServer.ts +2 -2
- package/src/unstable/ai/Model.ts +15 -12
- package/src/unstable/ai/Toolkit.ts +30 -38
- package/src/unstable/cli/Command.ts +32 -13
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/Param.ts +1 -1
- package/src/unstable/cli/Prompt.ts +9 -13
- package/src/unstable/cli/internal/command.ts +12 -14
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +1 -1
- package/src/unstable/cluster/Entity.ts +3 -3
- package/src/unstable/cluster/MessageStorage.ts +1 -1
- package/src/unstable/cluster/ShardingConfig.ts +1 -1
- package/src/unstable/http/HttpBody.ts +2 -2
- package/src/unstable/http/HttpClient.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +2 -2
- package/src/unstable/http/HttpMiddleware.ts +4 -5
- package/src/unstable/http/HttpPlatform.ts +1 -1
- package/src/unstable/http/HttpRouter.ts +4 -5
- package/src/unstable/http/HttpServer.ts +1 -1
- package/src/unstable/http/HttpServerRequest.ts +11 -11
- package/src/unstable/http/HttpServerResponse.ts +5 -5
- package/src/unstable/http/Multipart.ts +1 -1
- package/src/unstable/httpapi/HttpApiBuilder.ts +4 -4
- package/src/unstable/httpapi/HttpApiClient.ts +1 -1
- package/src/unstable/httpapi/HttpApiMiddleware.ts +2 -1
- package/src/unstable/httpapi/HttpApiTest.ts +5 -2
- package/src/unstable/persistence/RateLimiter.ts +1 -1
- package/src/unstable/process/ChildProcess.ts +11 -14
- package/src/unstable/reactivity/Atom.ts +4 -4
- package/src/unstable/rpc/RpcClient.ts +1 -1
- package/src/unstable/rpc/RpcServer.ts +1 -2
- package/src/unstable/rpc/RpcWorker.ts +2 -2
- package/src/unstable/socket/Socket.ts +1 -1
- package/src/unstable/sql/Migrator.ts +1 -1
- package/src/unstable/workflow/Activity.ts +1 -1
- package/src/unstable/workflow/DurableQueue.ts +343 -0
- package/src/unstable/workflow/Workflow.ts +1 -1
- package/src/unstable/workflow/index.ts +5 -0
package/src/Effectable.ts
CHANGED
|
@@ -30,7 +30,7 @@ const Base: new<A, E, R>() => Effect.Effect<A, E, R> = (() => {
|
|
|
30
30
|
Base.prototype = Prototype({
|
|
31
31
|
label: "Effectable",
|
|
32
32
|
evaluate(_) {
|
|
33
|
-
return this
|
|
33
|
+
return this
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
36
|
return Base as any
|
|
@@ -43,5 +43,5 @@ const Base: new<A, E, R>() => Effect.Effect<A, E, R> = (() => {
|
|
|
43
43
|
* @category Constructors
|
|
44
44
|
*/
|
|
45
45
|
export abstract class Class<A, E = never, R = never> extends Base<A, E, R> {
|
|
46
|
-
abstract override
|
|
46
|
+
abstract override: Effect.Effect<A, E, R>
|
|
47
47
|
}
|
package/src/ExecutionPlan.ts
CHANGED
|
@@ -94,10 +94,9 @@ export interface ExecutionPlan<
|
|
|
94
94
|
}>
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* Returns an equivalent `ExecutionPlan` with the requirements satisfied,
|
|
98
|
-
* using the current context.
|
|
97
|
+
* Returns an equivalent `ExecutionPlan` with the requirements satisfied, using the current context.
|
|
99
98
|
*/
|
|
100
|
-
readonly
|
|
99
|
+
readonly captureRequirements: Effect.Effect<
|
|
101
100
|
ExecutionPlan<{
|
|
102
101
|
provides: Config["provides"]
|
|
103
102
|
input: Config["input"]
|
|
@@ -256,7 +255,7 @@ export declare namespace make {
|
|
|
256
255
|
|
|
257
256
|
const Proto: Omit<ExecutionPlan<any>, "steps"> = {
|
|
258
257
|
[TypeId]: TypeId,
|
|
259
|
-
get
|
|
258
|
+
get captureRequirements() {
|
|
260
259
|
const self = this as any as ExecutionPlan<any>
|
|
261
260
|
return effect.contextWith((context: Context.Context<any>) =>
|
|
262
261
|
effect.succeed(makeProto(self.steps.map((step) => ({
|
package/src/FiberHandle.ts
CHANGED
|
@@ -705,10 +705,10 @@ const runImpl = <A, E, R, XE extends E, XA extends A>(
|
|
|
705
705
|
* const run = yield* FiberHandle.runtime(handle)<Users>()
|
|
706
706
|
*
|
|
707
707
|
* // run an effect and set the fiber in the handle
|
|
708
|
-
* run(Effect.andThen(Users
|
|
708
|
+
* run(Effect.andThen(Users, (_) => _.getAll))
|
|
709
709
|
*
|
|
710
710
|
* // this will interrupt the previous fiber
|
|
711
|
-
* run(Effect.andThen(Users
|
|
711
|
+
* run(Effect.andThen(Users, (_) => _.getAll))
|
|
712
712
|
* }).pipe(
|
|
713
713
|
* Effect.scoped // The fiber will be interrupted when the scope is closed
|
|
714
714
|
* )
|
package/src/FiberMap.ts
CHANGED
|
@@ -1171,8 +1171,8 @@ const runImpl = <K, A, E, R, XE extends E, XA extends A>(
|
|
|
1171
1171
|
* const run = yield* FiberMap.runtime(map)<Users>()
|
|
1172
1172
|
*
|
|
1173
1173
|
* // run some effects and add the fibers to the map
|
|
1174
|
-
* run("effect-a", Effect.andThen(Users
|
|
1175
|
-
* run("effect-b", Effect.andThen(Users
|
|
1174
|
+
* run("effect-a", Effect.andThen(Users, (_) => _.getAll))
|
|
1175
|
+
* run("effect-b", Effect.andThen(Users, (_) => _.getAll))
|
|
1176
1176
|
* }).pipe(
|
|
1177
1177
|
* Effect.scoped // The fibers will be interrupted when the scope is closed
|
|
1178
1178
|
* )
|
package/src/FiberSet.ts
CHANGED
|
@@ -612,7 +612,7 @@ const runImpl = <A, E, R, XE extends E, XA extends A>(
|
|
|
612
612
|
* const run = yield* FiberSet.runtime(set)<Users>()
|
|
613
613
|
*
|
|
614
614
|
* // run some effects and add the fibers to the set
|
|
615
|
-
* run(Effect.andThen(Users
|
|
615
|
+
* run(Effect.andThen(Users, (_) => _.getAll))
|
|
616
616
|
* }).pipe(
|
|
617
617
|
* Effect.scoped // The fibers will be interrupted when the scope is closed
|
|
618
618
|
* )
|
package/src/Layer.ts
CHANGED
|
@@ -3077,7 +3077,7 @@ export const updateService: {
|
|
|
3077
3077
|
layer: Layer<A1, E1, R1>,
|
|
3078
3078
|
service: Context.Key<I, A>,
|
|
3079
3079
|
f: (a: Types.NoInfer<A>) => A
|
|
3080
|
-
): Layer<A1, E1, I | R1> => provide(layer, effect(service, internalEffect.map(service
|
|
3080
|
+
): Layer<A1, E1, I | R1> => provide(layer, effect(service, internalEffect.map(service, f)))
|
|
3081
3081
|
)
|
|
3082
3082
|
|
|
3083
3083
|
/**
|
package/src/LayerMap.ts
CHANGED
|
@@ -365,10 +365,9 @@ export const Service = <Self>() =>
|
|
|
365
365
|
Layer.provide(TagClass_.layerNoDeps, options.dependencies as any) :
|
|
366
366
|
TagClass_.layerNoDeps
|
|
367
367
|
|
|
368
|
-
TagClass_.get = (key: string) => Layer.unwrap(Effect.map(TagClass_
|
|
369
|
-
TagClass_.contextEffect = (key: string) =>
|
|
370
|
-
|
|
371
|
-
TagClass_.invalidate = (key: string) => Effect.flatMap(TagClass_.asEffect(), (layerMap) => layerMap.invalidate(key))
|
|
368
|
+
TagClass_.get = (key: string) => Layer.unwrap(Effect.map(TagClass_, (layerMap) => layerMap.get(key)))
|
|
369
|
+
TagClass_.contextEffect = (key: string) => Effect.flatMap(TagClass_, (layerMap) => layerMap.contextEffect(key))
|
|
370
|
+
TagClass_.invalidate = (key: string) => Effect.flatMap(TagClass_, (layerMap) => layerMap.invalidate(key))
|
|
372
371
|
|
|
373
372
|
return TagClass as any
|
|
374
373
|
}
|
package/src/ManagedRuntime.ts
CHANGED
|
@@ -148,7 +148,7 @@ export interface ManagedRuntime<in R, out ER> {
|
|
|
148
148
|
* async function main() {
|
|
149
149
|
* const runtime = ManagedRuntime.make(Notifications.layer)
|
|
150
150
|
* await runtime.runPromise(Effect.flatMap(
|
|
151
|
-
* Notifications
|
|
151
|
+
* Notifications,
|
|
152
152
|
* (_) => _.notify("Hello, world!")
|
|
153
153
|
* ))
|
|
154
154
|
* await runtime.dispose()
|
package/src/Option.ts
CHANGED
|
@@ -72,9 +72,7 @@
|
|
|
72
72
|
* @since 2.0.0
|
|
73
73
|
* @module
|
|
74
74
|
*/
|
|
75
|
-
import type { NoSuchElementError } from "./Cause.ts"
|
|
76
75
|
import * as Combiner from "./Combiner.ts"
|
|
77
|
-
import type { EffectIterator, Yieldable } from "./Effect.ts"
|
|
78
76
|
import * as Equal from "./Equal.ts"
|
|
79
77
|
import * as Equivalence from "./Equivalence.ts"
|
|
80
78
|
import type * as Filter from "./Filter.ts"
|
|
@@ -144,7 +142,6 @@ export type Option<A> = None<A> | Some<A>
|
|
|
144
142
|
* **Behavior**
|
|
145
143
|
*
|
|
146
144
|
* - `_tag` is always `"None"`
|
|
147
|
-
* - Yieldable in `Effect.gen` — yields `NoSuchElementError`
|
|
148
145
|
* - Implements `Pipeable`, `Inspectable`, and structural equality
|
|
149
146
|
*
|
|
150
147
|
* @see {@link isNone} to check if an `Option` is `None`
|
|
@@ -153,18 +150,29 @@ export type Option<A> = None<A> | Some<A>
|
|
|
153
150
|
* @category Models
|
|
154
151
|
* @since 2.0.0
|
|
155
152
|
*/
|
|
156
|
-
export interface None<out A> extends Pipeable, Inspectable
|
|
153
|
+
export interface None<out A> extends Pipeable, Inspectable {
|
|
157
154
|
readonly _tag: "None"
|
|
158
155
|
readonly _op: "None"
|
|
159
156
|
readonly valueOrUndefined: undefined
|
|
160
157
|
readonly [TypeId]: {
|
|
161
158
|
readonly _A: Covariant<A>
|
|
162
159
|
}
|
|
160
|
+
[Symbol.iterator](): OptionIterator<Option<A>>
|
|
163
161
|
[Unify.typeSymbol]?: unknown
|
|
164
162
|
[Unify.unifySymbol]?: OptionUnify<this>
|
|
165
163
|
[Unify.ignoreSymbol]?: OptionUnifyIgnore
|
|
166
164
|
}
|
|
167
165
|
|
|
166
|
+
/**
|
|
167
|
+
* @since 4.0.0
|
|
168
|
+
* @category Models
|
|
169
|
+
*/
|
|
170
|
+
export interface OptionIterator<T extends Option<any>> {
|
|
171
|
+
next(
|
|
172
|
+
...args: ReadonlyArray<any>
|
|
173
|
+
): IteratorResult<T, Option.Value<T>>
|
|
174
|
+
}
|
|
175
|
+
|
|
168
176
|
/**
|
|
169
177
|
* Represents the presence of a value within an {@link Option}.
|
|
170
178
|
*
|
|
@@ -177,7 +185,6 @@ export interface None<out A> extends Pipeable, Inspectable, Yieldable<Option<A>,
|
|
|
177
185
|
*
|
|
178
186
|
* - `_tag` is always `"Some"`
|
|
179
187
|
* - `.value` holds the contained value of type `A`
|
|
180
|
-
* - Yieldable in `Effect.gen` — yields the inner value
|
|
181
188
|
* - Implements `Pipeable`, `Inspectable`, and structural equality
|
|
182
189
|
*
|
|
183
190
|
* @see {@link isSome} to check if an `Option` is `Some`
|
|
@@ -186,7 +193,7 @@ export interface None<out A> extends Pipeable, Inspectable, Yieldable<Option<A>,
|
|
|
186
193
|
* @category Models
|
|
187
194
|
* @since 2.0.0
|
|
188
195
|
*/
|
|
189
|
-
export interface Some<out A> extends Pipeable, Inspectable
|
|
196
|
+
export interface Some<out A> extends Pipeable, Inspectable {
|
|
190
197
|
readonly _tag: "Some"
|
|
191
198
|
readonly _op: "Some"
|
|
192
199
|
readonly value: A
|
|
@@ -194,7 +201,7 @@ export interface Some<out A> extends Pipeable, Inspectable, Yieldable<Option<A>,
|
|
|
194
201
|
readonly [TypeId]: {
|
|
195
202
|
readonly _A: Covariant<A>
|
|
196
203
|
}
|
|
197
|
-
[Symbol.iterator]():
|
|
204
|
+
[Symbol.iterator](): OptionIterator<Option<A>>
|
|
198
205
|
[Unify.typeSymbol]?: unknown
|
|
199
206
|
[Unify.unifySymbol]?: OptionUnify<this>
|
|
200
207
|
[Unify.ignoreSymbol]?: OptionUnifyIgnore
|
package/src/Result.ts
CHANGED
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
* @since 4.0.0
|
|
69
69
|
*/
|
|
70
70
|
|
|
71
|
-
import type { Yieldable } from "./Effect.ts"
|
|
72
71
|
import * as Equivalence from "./Equivalence.ts"
|
|
73
72
|
import type { LazyArg } from "./Function.ts"
|
|
74
73
|
import { constNull, constUndefined, dual, identity } from "./Function.ts"
|
|
@@ -154,7 +153,7 @@ export type Result<A, E = never> = Success<A, E> | Failure<A, E>
|
|
|
154
153
|
* @category Models
|
|
155
154
|
* @since 4.0.0
|
|
156
155
|
*/
|
|
157
|
-
export interface Failure<out A, out E> extends Pipeable, Inspectable
|
|
156
|
+
export interface Failure<out A, out E> extends Pipeable, Inspectable {
|
|
158
157
|
readonly _tag: "Failure"
|
|
159
158
|
readonly _op: "Failure"
|
|
160
159
|
readonly failure: E
|
|
@@ -162,11 +161,22 @@ export interface Failure<out A, out E> extends Pipeable, Inspectable, Yieldable<
|
|
|
162
161
|
readonly _A: Covariant<E>
|
|
163
162
|
readonly _E: Covariant<A>
|
|
164
163
|
}
|
|
164
|
+
[Symbol.iterator](): ResultIterator<Result<A, E>>
|
|
165
165
|
[Unify.typeSymbol]?: unknown
|
|
166
166
|
[Unify.unifySymbol]?: ResultUnify<this>
|
|
167
167
|
[Unify.ignoreSymbol]?: ResultUnifyIgnore
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
/**
|
|
171
|
+
* @since 4.0.0
|
|
172
|
+
* @category Models
|
|
173
|
+
*/
|
|
174
|
+
export interface ResultIterator<T extends Result<any, any>> {
|
|
175
|
+
next(
|
|
176
|
+
...args: ReadonlyArray<any>
|
|
177
|
+
): IteratorResult<T, Result.Success<T>>
|
|
178
|
+
}
|
|
179
|
+
|
|
170
180
|
/**
|
|
171
181
|
* The success variant of {@link Result}. Wraps a value of type `A`.
|
|
172
182
|
*
|
|
@@ -194,7 +204,7 @@ export interface Failure<out A, out E> extends Pipeable, Inspectable, Yieldable<
|
|
|
194
204
|
* @category Models
|
|
195
205
|
* @since 4.0.0
|
|
196
206
|
*/
|
|
197
|
-
export interface Success<out A, out E> extends Pipeable, Inspectable
|
|
207
|
+
export interface Success<out A, out E> extends Pipeable, Inspectable {
|
|
198
208
|
readonly _tag: "Success"
|
|
199
209
|
readonly _op: "Success"
|
|
200
210
|
readonly success: A
|
|
@@ -202,6 +212,7 @@ export interface Success<out A, out E> extends Pipeable, Inspectable, Yieldable<
|
|
|
202
212
|
readonly _A: Covariant<E>
|
|
203
213
|
readonly _E: Covariant<A>
|
|
204
214
|
}
|
|
215
|
+
[Symbol.iterator](): ResultIterator<Result<A, E>>
|
|
205
216
|
[Unify.typeSymbol]?: unknown
|
|
206
217
|
[Unify.unifySymbol]?: ResultUnify<this>
|
|
207
218
|
[Unify.ignoreSymbol]?: ResultUnifyIgnore
|
package/src/Schedule.ts
CHANGED
|
@@ -2734,7 +2734,7 @@ export const cron: {
|
|
|
2734
2734
|
(expression: string, tz?: string | DateTime.TimeZone): Schedule<Duration.Duration, unknown, Cron.CronParseError>
|
|
2735
2735
|
} = (expression: string | Cron.Cron, tz?: string | DateTime.TimeZone) => {
|
|
2736
2736
|
const parsed = Cron.isCron(expression) ? Result.succeed(expression) : Cron.parse(expression, tz)
|
|
2737
|
-
return fromStep(effect.map(
|
|
2737
|
+
return fromStep(effect.map(effect.fromResult(parsed), (cron) => (now, _) =>
|
|
2738
2738
|
effect.sync(() => {
|
|
2739
2739
|
const next = Cron.next(cron, now).getTime()
|
|
2740
2740
|
const duration = Duration.millis(next - now)
|
package/src/Schema.ts
CHANGED
|
@@ -2298,10 +2298,10 @@ export declare namespace Struct {
|
|
|
2298
2298
|
O extends keyof F = TypeOptionalKeys<F>,
|
|
2299
2299
|
M extends keyof F = TypeMutableKeys<F>
|
|
2300
2300
|
> =
|
|
2301
|
-
& { readonly [K in
|
|
2302
|
-
& { readonly [K in
|
|
2303
|
-
& { [K in
|
|
2304
|
-
& { [K in M & O]?: F[K]["Type"] }
|
|
2301
|
+
& { readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Type"] }
|
|
2302
|
+
& { readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Type"] }
|
|
2303
|
+
& { -readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Type"] }
|
|
2304
|
+
& { -readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Type"] }
|
|
2305
2305
|
|
|
2306
2306
|
/**
|
|
2307
2307
|
* @since 4.0.0
|
|
@@ -2313,10 +2313,10 @@ export declare namespace Struct {
|
|
|
2313
2313
|
O extends keyof F = TypeOptionalKeys<F>,
|
|
2314
2314
|
M extends keyof F = TypeMutableKeys<F>
|
|
2315
2315
|
> =
|
|
2316
|
-
& { readonly [K in
|
|
2317
|
-
& { readonly [K in
|
|
2318
|
-
& { [K in
|
|
2319
|
-
& { [K in M & O]?: F[K]["Iso"] }
|
|
2316
|
+
& { readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Iso"] }
|
|
2317
|
+
& { readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Iso"] }
|
|
2318
|
+
& { -readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Iso"] }
|
|
2319
|
+
& { -readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Iso"] }
|
|
2320
2320
|
|
|
2321
2321
|
/**
|
|
2322
2322
|
* @since 4.0.0
|
|
@@ -2338,10 +2338,10 @@ export declare namespace Struct {
|
|
|
2338
2338
|
O extends keyof F = EncodedOptionalKeys<F>,
|
|
2339
2339
|
M extends keyof F = EncodedMutableKeys<F>
|
|
2340
2340
|
> =
|
|
2341
|
-
& { readonly [K in
|
|
2342
|
-
& { readonly [K in
|
|
2343
|
-
& { [K in
|
|
2344
|
-
& { [K in M & O]?: F[K]["Encoded"] }
|
|
2341
|
+
& { readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Encoded"] }
|
|
2342
|
+
& { readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Encoded"] }
|
|
2343
|
+
& { -readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Encoded"] }
|
|
2344
|
+
& { -readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Encoded"] }
|
|
2345
2345
|
|
|
2346
2346
|
/**
|
|
2347
2347
|
* @since 4.0.0
|
|
@@ -10942,13 +10942,14 @@ export const TaggedClass: {
|
|
|
10942
10942
|
schema: Struct.Fields | Struct<Struct.Fields>,
|
|
10943
10943
|
annotations?: Annotations.Declaration<any, readonly [Struct<Struct.Fields>]>
|
|
10944
10944
|
): any => {
|
|
10945
|
+
const struct = isStruct(schema) ?
|
|
10946
|
+
schema.mapFields((fields) => ({ _tag: tag(tagValue), ...fields }), {
|
|
10947
|
+
unsafePreserveChecks: true
|
|
10948
|
+
}) :
|
|
10949
|
+
TaggedStruct(tagValue, schema)
|
|
10945
10950
|
return Class<any, {}>(identifier ?? tagValue)(
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
unsafePreserveChecks: true
|
|
10949
|
-
}) :
|
|
10950
|
-
TaggedStruct(tagValue, schema),
|
|
10951
|
-
annotations
|
|
10951
|
+
struct,
|
|
10952
|
+
annotations as Annotations.Declaration<any, readonly [typeof struct]>
|
|
10952
10953
|
)
|
|
10953
10954
|
}
|
|
10954
10955
|
}
|
|
@@ -11186,13 +11187,14 @@ export const TaggedErrorClass: {
|
|
|
11186
11187
|
schema: Struct.Fields | Struct<Struct.Fields>,
|
|
11187
11188
|
annotations?: Annotations.Declaration<any, readonly [Struct<Struct.Fields>]>
|
|
11188
11189
|
): any => {
|
|
11190
|
+
const struct = isStruct(schema) ?
|
|
11191
|
+
schema.mapFields((fields) => ({ _tag: tag(tagValue), ...fields }), {
|
|
11192
|
+
unsafePreserveChecks: true
|
|
11193
|
+
}) :
|
|
11194
|
+
TaggedStruct(tagValue, schema)
|
|
11189
11195
|
return ErrorClass<any, {}>(identifier ?? tagValue)(
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
unsafePreserveChecks: true
|
|
11193
|
-
}) :
|
|
11194
|
-
TaggedStruct(tagValue, schema),
|
|
11195
|
-
annotations
|
|
11196
|
+
struct,
|
|
11197
|
+
annotations as Annotations.Declaration<any, readonly [typeof struct]>
|
|
11196
11198
|
)
|
|
11197
11199
|
}
|
|
11198
11200
|
}
|
package/src/SchemaGetter.ts
CHANGED
|
@@ -1291,10 +1291,10 @@ export function encodeHex<E extends Uint8Array | string>(): Getter<string, E> {
|
|
|
1291
1291
|
*/
|
|
1292
1292
|
export function decodeBase64<E extends string>(): Getter<Uint8Array, E> {
|
|
1293
1293
|
return transformOrFail((input) =>
|
|
1294
|
-
|
|
1295
|
-
Encoding.decodeBase64(input),
|
|
1294
|
+
Effect.mapErrorEager(
|
|
1295
|
+
Effect.fromResult(Encoding.decodeBase64(input)),
|
|
1296
1296
|
(e) => new Issue.InvalidValue(Option.some(input), { message: e.message })
|
|
1297
|
-
)
|
|
1297
|
+
)
|
|
1298
1298
|
)
|
|
1299
1299
|
}
|
|
1300
1300
|
|
package/src/Stream.ts
CHANGED
|
@@ -9172,7 +9172,7 @@ export const retry: {
|
|
|
9172
9172
|
* { provide: Service.Good }
|
|
9173
9173
|
* )
|
|
9174
9174
|
*
|
|
9175
|
-
* const stream = Stream.unwrap(Effect.map(Service
|
|
9175
|
+
* const stream = Stream.unwrap(Effect.map(Service, (_) => _.stream))
|
|
9176
9176
|
*
|
|
9177
9177
|
* const program = Effect.gen(function*() {
|
|
9178
9178
|
* const items = yield* stream.pipe(Stream.withExecutionPlan(plan), Stream.runCollect)
|
|
@@ -9214,7 +9214,7 @@ export const withExecutionPlan: {
|
|
|
9214
9214
|
* { provide: Service.Good }
|
|
9215
9215
|
* )
|
|
9216
9216
|
*
|
|
9217
|
-
* const stream = Stream.unwrap(Effect.map(Service
|
|
9217
|
+
* const stream = Stream.unwrap(Effect.map(Service, (_) => _.stream))
|
|
9218
9218
|
*
|
|
9219
9219
|
* const program = Effect.gen(function*() {
|
|
9220
9220
|
* const items = yield* stream.pipe(Stream.withExecutionPlan(plan), Stream.runCollect)
|
|
@@ -9259,7 +9259,7 @@ export const withExecutionPlan: {
|
|
|
9259
9259
|
* { provide: Service.Good }
|
|
9260
9260
|
* )
|
|
9261
9261
|
*
|
|
9262
|
-
* const stream = Stream.unwrap(Effect.map(Service
|
|
9262
|
+
* const stream = Stream.unwrap(Effect.map(Service, (_) => _.stream))
|
|
9263
9263
|
*
|
|
9264
9264
|
* const program = Effect.gen(function*() {
|
|
9265
9265
|
* const items = yield* stream.pipe(Stream.withExecutionPlan(plan), Stream.runCollect)
|
|
@@ -9334,7 +9334,7 @@ export const withExecutionPlan: {
|
|
|
9334
9334
|
* { provide: Service.Good }
|
|
9335
9335
|
* )
|
|
9336
9336
|
*
|
|
9337
|
-
* const stream = Stream.unwrap(Effect.map(Service
|
|
9337
|
+
* const stream = Stream.unwrap(Effect.map(Service, (_) => _.stream))
|
|
9338
9338
|
*
|
|
9339
9339
|
* const program = Effect.gen(function*() {
|
|
9340
9340
|
* const items = yield* stream.pipe(Stream.withExecutionPlan(plan), Stream.runCollect)
|
package/src/TxRef.ts
CHANGED
|
@@ -175,7 +175,7 @@ export const modify: {
|
|
|
175
175
|
self: TxRef<A>,
|
|
176
176
|
f: (current: A) => [returnValue: R, newValue: A]
|
|
177
177
|
): Effect.Effect<R> =>
|
|
178
|
-
Effect.Transaction.
|
|
178
|
+
Effect.Transaction.pipe(
|
|
179
179
|
Effect.flatMap((state) =>
|
|
180
180
|
Effect.sync(() => {
|
|
181
181
|
if (!state.journal.has(self)) {
|
|
@@ -16,7 +16,7 @@ export const match = <A, E, R>(
|
|
|
16
16
|
case "unbounded":
|
|
17
17
|
return unbounded()
|
|
18
18
|
case "inherit":
|
|
19
|
-
return effect.flatMap(CurrentConcurrency
|
|
19
|
+
return effect.flatMap(CurrentConcurrency, (concurrency) =>
|
|
20
20
|
concurrency === "unbounded"
|
|
21
21
|
? unbounded()
|
|
22
22
|
: concurrency > 1
|
|
@@ -40,7 +40,7 @@ export const matchSimple = <A, E, R>(
|
|
|
40
40
|
return concurrent()
|
|
41
41
|
case "inherit":
|
|
42
42
|
return effect.flatMap(
|
|
43
|
-
CurrentConcurrency
|
|
43
|
+
CurrentConcurrency,
|
|
44
44
|
(concurrency) =>
|
|
45
45
|
concurrency === "unbounded" || concurrency > 1
|
|
46
46
|
? concurrent()
|
package/src/internal/core.ts
CHANGED
|
@@ -95,21 +95,6 @@ export const StructuralProto = {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
/** @internal */
|
|
99
|
-
export const YieldableProto = {
|
|
100
|
-
[Symbol.iterator]() {
|
|
101
|
-
return new SingleShotGen(this) as any
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** @internal */
|
|
106
|
-
export const YieldableErrorProto = {
|
|
107
|
-
...YieldableProto,
|
|
108
|
-
pipe() {
|
|
109
|
-
return pipeArguments(this, arguments)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
98
|
/** @internal */
|
|
114
99
|
export const EffectProto = {
|
|
115
100
|
[EffectTypeId]: effectVariance,
|
|
@@ -117,9 +102,6 @@ export const EffectProto = {
|
|
|
117
102
|
[Symbol.iterator]() {
|
|
118
103
|
return new SingleShotGen(this) as any
|
|
119
104
|
},
|
|
120
|
-
asEffect(): any {
|
|
121
|
-
return this
|
|
122
|
-
},
|
|
123
105
|
toJSON(this: Primitive) {
|
|
124
106
|
return {
|
|
125
107
|
_id: "Effect",
|
|
@@ -584,12 +566,18 @@ export const YieldableError: new(
|
|
|
584
566
|
message?: string,
|
|
585
567
|
options?: ErrorOptions
|
|
586
568
|
) => Cause.YieldableError = (function() {
|
|
587
|
-
class YieldableError extends globalThis.Error {
|
|
588
|
-
|
|
569
|
+
class YieldableError extends globalThis.Error {}
|
|
570
|
+
const proto = makePrimitiveProto({
|
|
571
|
+
op: "YieldableError",
|
|
572
|
+
[evaluate]() {
|
|
589
573
|
return exitFail(this)
|
|
590
574
|
}
|
|
591
|
-
}
|
|
592
|
-
|
|
575
|
+
})
|
|
576
|
+
delete (proto as any).toString
|
|
577
|
+
Object.assign(
|
|
578
|
+
YieldableError.prototype,
|
|
579
|
+
proto
|
|
580
|
+
)
|
|
593
581
|
return YieldableError as any
|
|
594
582
|
})()
|
|
595
583
|
|
|
@@ -603,13 +591,14 @@ export const Error: new<A extends Record<string, any> = {}>(
|
|
|
603
591
|
super(args?.message, args?.cause ? { cause: args.cause } : undefined)
|
|
604
592
|
if (args) {
|
|
605
593
|
Object.assign(this, args)
|
|
594
|
+
// @effect-diagnostics-next-line floatingEffect:off
|
|
606
595
|
Object.defineProperty(this, plainArgsSymbol, {
|
|
607
596
|
value: args,
|
|
608
597
|
enumerable: false
|
|
609
598
|
})
|
|
610
599
|
}
|
|
611
600
|
}
|
|
612
|
-
toJSON() {
|
|
601
|
+
override toJSON() {
|
|
613
602
|
return { ...(this as any)[plainArgsSymbol], ...this }
|
|
614
603
|
}
|
|
615
604
|
} as any
|
package/src/internal/effect.ts
CHANGED
|
@@ -892,15 +892,16 @@ export const suspend: <A, E, R>(
|
|
|
892
892
|
})
|
|
893
893
|
|
|
894
894
|
/** @internal */
|
|
895
|
-
export const
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
/** @internal */
|
|
900
|
-
export const fromOption: <A>(option: Option.Option<A>) => Effect.Effect<A, Cause.NoSuchElementError> = fromYieldable
|
|
895
|
+
export const fromOption: <A>(option: Option.Option<A>) => Effect.Effect<A, Cause.NoSuchElementError> = Option.match({
|
|
896
|
+
onNone: () => fail(new NoSuchElementError("Effect.fromOption: Option.none")),
|
|
897
|
+
onSome: succeed
|
|
898
|
+
})
|
|
901
899
|
|
|
902
900
|
/** @internal */
|
|
903
|
-
export const fromResult: <A, E>(result: Result.Result<A, E>) => Effect.Effect<A, E> =
|
|
901
|
+
export const fromResult: <A, E>(result: Result.Result<A, E>) => Effect.Effect<A, E> = Result.match({
|
|
902
|
+
onFailure: fail,
|
|
903
|
+
onSuccess: succeed
|
|
904
|
+
})
|
|
904
905
|
|
|
905
906
|
/** @internal */
|
|
906
907
|
export const fromNullishOr = <A>(value: A): Effect.Effect<NonNullable<A>, Cause.NoSuchElementError> =>
|
|
@@ -1083,7 +1084,7 @@ export const never: Effect.Effect<never> = callback<never>(constVoid)
|
|
|
1083
1084
|
/** @internal */
|
|
1084
1085
|
export const gen = <
|
|
1085
1086
|
Self,
|
|
1086
|
-
Eff extends Effect.
|
|
1087
|
+
Eff extends Effect.Effect<any, any, any>,
|
|
1087
1088
|
AEff
|
|
1088
1089
|
>(
|
|
1089
1090
|
...args:
|
|
@@ -1092,10 +1093,10 @@ export const gen = <
|
|
|
1092
1093
|
): Effect.Effect<
|
|
1093
1094
|
AEff,
|
|
1094
1095
|
[Eff] extends [never] ? never
|
|
1095
|
-
: [Eff] extends [Effect.
|
|
1096
|
+
: [Eff] extends [Effect.Effect<infer _A, infer E, infer _R>] ? E
|
|
1096
1097
|
: never,
|
|
1097
1098
|
[Eff] extends [never] ? never
|
|
1098
|
-
: [Eff] extends [Effect.
|
|
1099
|
+
: [Eff] extends [Effect.Effect<infer _A, infer _E, infer R>] ? R
|
|
1099
1100
|
: never
|
|
1100
1101
|
> =>
|
|
1101
1102
|
suspend(() =>
|
|
@@ -1223,7 +1224,7 @@ export const fnUntracedEager: Effect.fn.Untraced = (
|
|
|
1223
1224
|
)
|
|
1224
1225
|
|
|
1225
1226
|
const fromIteratorEagerUnsafe = (
|
|
1226
|
-
evaluate: () => Iterator<Effect.
|
|
1227
|
+
evaluate: () => Iterator<Effect.Effect<any, any, any>>
|
|
1227
1228
|
): Effect.Effect<any, any, any> => {
|
|
1228
1229
|
try {
|
|
1229
1230
|
const iterator = evaluate()
|
|
@@ -1237,22 +1238,20 @@ const fromIteratorEagerUnsafe = (
|
|
|
1237
1238
|
return succeed(state.value)
|
|
1238
1239
|
}
|
|
1239
1240
|
|
|
1240
|
-
const
|
|
1241
|
-
const effect = yieldable.asEffect()
|
|
1242
|
-
const primitive = effect as any
|
|
1241
|
+
const primitive = state.value as any
|
|
1243
1242
|
|
|
1244
1243
|
if (primitive && primitive._tag === "Success") {
|
|
1245
1244
|
value = primitive.value
|
|
1246
1245
|
continue
|
|
1247
1246
|
} else if (primitive && primitive._tag === "Failure") {
|
|
1248
|
-
return
|
|
1247
|
+
return state.value
|
|
1249
1248
|
} else {
|
|
1250
1249
|
let isFirstExecution = true
|
|
1251
1250
|
|
|
1252
1251
|
return suspend(() => {
|
|
1253
1252
|
if (isFirstExecution) {
|
|
1254
1253
|
isFirstExecution = false
|
|
1255
|
-
return flatMap(
|
|
1254
|
+
return flatMap(state.value, (value) => fromIteratorUnsafe(iterator, value))
|
|
1256
1255
|
} else {
|
|
1257
1256
|
return suspend(() => fromIteratorUnsafe(evaluate()))
|
|
1258
1257
|
}
|
|
@@ -1265,7 +1264,7 @@ const fromIteratorEagerUnsafe = (
|
|
|
1265
1264
|
}
|
|
1266
1265
|
|
|
1267
1266
|
const fromIteratorUnsafe: (
|
|
1268
|
-
iterator: Iterator<Effect.
|
|
1267
|
+
iterator: Iterator<Effect.Effect<any, any, any>>,
|
|
1269
1268
|
initial?: undefined
|
|
1270
1269
|
) => Effect.Effect<any, any, any> = makePrimitive({
|
|
1271
1270
|
op: "Iterator",
|
|
@@ -1275,14 +1274,13 @@ const fromIteratorUnsafe: (
|
|
|
1275
1274
|
while (true) {
|
|
1276
1275
|
const state = iter.next(value)
|
|
1277
1276
|
if (state.done) return succeed(state.value)
|
|
1278
|
-
|
|
1279
|
-
if (!effectIsExit(eff)) {
|
|
1277
|
+
if (!effectIsExit(state.value)) {
|
|
1280
1278
|
fiber._stack.push(this)
|
|
1281
|
-
return
|
|
1282
|
-
} else if (
|
|
1283
|
-
return
|
|
1279
|
+
return state.value
|
|
1280
|
+
} else if (state.value._tag === "Failure") {
|
|
1281
|
+
return state.value
|
|
1284
1282
|
}
|
|
1285
|
-
value =
|
|
1283
|
+
value = state.value.value
|
|
1286
1284
|
}
|
|
1287
1285
|
},
|
|
1288
1286
|
[evaluate](this: any, fiber: FiberImpl) {
|
|
@@ -1968,9 +1966,7 @@ export const exitFindErrorOption = <A, E>(self: Exit.Exit<A, E>): Option.Option<
|
|
|
1968
1966
|
// ----------------------------------------------------------------------------
|
|
1969
1967
|
|
|
1970
1968
|
/** @internal */
|
|
1971
|
-
export const service:
|
|
1972
|
-
<I, S>(service: Context.Key<I, S>): Effect.Effect<S, never, I>
|
|
1973
|
-
} = fromYieldable as any
|
|
1969
|
+
export const service = <I, S>(service: Context.Key<I, S>): Effect.Effect<S, never, I> => service
|
|
1974
1970
|
|
|
1975
1971
|
/** @internal */
|
|
1976
1972
|
export const serviceOption = <I, S>(
|
|
@@ -3767,7 +3763,7 @@ export const scopeMake = (finalizerStrategy?: "sequential" | "parallel"): Effect
|
|
|
3767
3763
|
sync(() => scopeMakeUnsafe(finalizerStrategy))
|
|
3768
3764
|
|
|
3769
3765
|
/** @internal */
|
|
3770
|
-
export const scope: Effect.Effect<Scope.Scope, never, Scope.Scope> = scopeTag
|
|
3766
|
+
export const scope: Effect.Effect<Scope.Scope, never, Scope.Scope> = scopeTag
|
|
3771
3767
|
|
|
3772
3768
|
/** @internal */
|
|
3773
3769
|
export const provideScope: {
|
|
@@ -5570,10 +5566,10 @@ const provideSpanStackFrame = (name: string, stack: (() => string | undefined) |
|
|
|
5570
5566
|
}
|
|
5571
5567
|
|
|
5572
5568
|
/** @internal */
|
|
5573
|
-
export const spanAnnotations: Effect.Effect<Readonly<Record<string, unknown>>> = TracerSpanAnnotations
|
|
5569
|
+
export const spanAnnotations: Effect.Effect<Readonly<Record<string, unknown>>> = TracerSpanAnnotations
|
|
5574
5570
|
|
|
5575
5571
|
/** @internal */
|
|
5576
|
-
export const spanLinks: Effect.Effect<ReadonlyArray<Tracer.SpanLink>> = TracerSpanLinks
|
|
5572
|
+
export const spanLinks: Effect.Effect<ReadonlyArray<Tracer.SpanLink>> = TracerSpanLinks
|
|
5577
5573
|
|
|
5578
5574
|
/** @internal */
|
|
5579
5575
|
export const linkSpans: {
|
|
@@ -73,7 +73,7 @@ export const withExecutionPlan: {
|
|
|
73
73
|
nextEffect = effect.suspend(() => {
|
|
74
74
|
if (attempted) return wrapped
|
|
75
75
|
attempted = true
|
|
76
|
-
return result
|
|
76
|
+
return effect.fromResult(result!)
|
|
77
77
|
})
|
|
78
78
|
nextEffect = internalSchedule.retry(nextEffect, scheduleFromStep(step, false)!)
|
|
79
79
|
} else {
|
|
@@ -87,7 +87,7 @@ export const withExecutionPlan: {
|
|
|
87
87
|
i++
|
|
88
88
|
}
|
|
89
89
|
}),
|
|
90
|
-
() => result
|
|
90
|
+
() => effect.fromResult(result!)
|
|
91
91
|
)
|
|
92
92
|
}))
|
|
93
93
|
|