effect 4.0.0-beta.64 → 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/eventlog/SqlEventLogServerUnencrypted.js +2 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +3 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +23 -3
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +62 -2
- package/dist/unstable/sql/SqlError.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/eventlog/SqlEventLogServerUnencrypted.ts +4 -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 +5 -2
- package/src/unstable/sql/SqlError.ts +72 -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/internal/option.ts
CHANGED
|
@@ -7,7 +7,8 @@ import * as Hash from "../Hash.ts"
|
|
|
7
7
|
import { toJson } from "../Inspectable.ts"
|
|
8
8
|
import type * as Option from "../Option.ts"
|
|
9
9
|
import { hasProperty } from "../Predicate.ts"
|
|
10
|
-
import {
|
|
10
|
+
import { SingleShotGen } from "../Utils.ts"
|
|
11
|
+
import { PipeInspectableProto } from "./core.ts"
|
|
11
12
|
|
|
12
13
|
const TypeId = "~effect/data/Option"
|
|
13
14
|
|
|
@@ -16,7 +17,9 @@ const CommonProto = {
|
|
|
16
17
|
_A: (_: never) => _
|
|
17
18
|
},
|
|
18
19
|
...PipeInspectableProto,
|
|
19
|
-
|
|
20
|
+
[Symbol.iterator]() {
|
|
21
|
+
return new SingleShotGen(this)
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
const SomeProto = Object.assign(Object.create(CommonProto), {
|
|
@@ -39,9 +42,6 @@ const SomeProto = Object.assign(Object.create(CommonProto), {
|
|
|
39
42
|
_tag: this._tag,
|
|
40
43
|
value: toJson(this.value)
|
|
41
44
|
}
|
|
42
|
-
},
|
|
43
|
-
asEffect(this: Option.Some<unknown>) {
|
|
44
|
-
return exitSucceed(this.value)
|
|
45
45
|
}
|
|
46
46
|
})
|
|
47
47
|
|
|
@@ -70,9 +70,6 @@ const NoneProto = Object.assign(Object.create(CommonProto), {
|
|
|
70
70
|
_id: "Option",
|
|
71
71
|
_tag: this._tag
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
asEffect<A>(this: Option.None<A>) {
|
|
75
|
-
return exitFail(new NoSuchElementError())
|
|
76
73
|
}
|
|
77
74
|
})
|
|
78
75
|
|
package/src/internal/result.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { toJson } from "../Inspectable.ts"
|
|
|
6
6
|
import type { Option } from "../Option.ts"
|
|
7
7
|
import { hasProperty } from "../Predicate.ts"
|
|
8
8
|
import type * as Result from "../Result.ts"
|
|
9
|
-
import {
|
|
9
|
+
import { SingleShotGen } from "../Utils.ts"
|
|
10
|
+
import { PipeInspectableProto } from "./core.ts"
|
|
10
11
|
import * as option from "./option.ts"
|
|
11
12
|
|
|
12
13
|
const TypeId = "~effect/data/Result"
|
|
@@ -18,7 +19,9 @@ const CommonProto = {
|
|
|
18
19
|
_E: (_: never) => _
|
|
19
20
|
},
|
|
20
21
|
...PipeInspectableProto,
|
|
21
|
-
|
|
22
|
+
[Symbol.iterator]() {
|
|
23
|
+
return new SingleShotGen(this)
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
const SuccessProto = Object.assign(Object.create(CommonProto), {
|
|
@@ -41,9 +44,6 @@ const SuccessProto = Object.assign(Object.create(CommonProto), {
|
|
|
41
44
|
_tag: this._tag,
|
|
42
45
|
value: toJson(this.success)
|
|
43
46
|
}
|
|
44
|
-
},
|
|
45
|
-
asEffect<L, R>(this: Result.Success<L, R>) {
|
|
46
|
-
return exitSucceed(this.success)
|
|
47
47
|
}
|
|
48
48
|
})
|
|
49
49
|
|
|
@@ -65,9 +65,6 @@ const FailureProto = Object.assign(Object.create(CommonProto), {
|
|
|
65
65
|
_tag: this._tag,
|
|
66
66
|
failure: toJson(this.failure)
|
|
67
67
|
}
|
|
68
|
-
},
|
|
69
|
-
asEffect<A, E>(this: Result.Failure<A, E>) {
|
|
70
|
-
return exitFail(this.failure)
|
|
71
68
|
}
|
|
72
69
|
})
|
|
73
70
|
|
|
@@ -528,8 +528,7 @@ export type ToolkitOption<
|
|
|
528
528
|
R = any
|
|
529
529
|
> = Tools extends any ? (
|
|
530
530
|
| Toolkit.WithHandler<Tools>
|
|
531
|
-
| Effect.
|
|
532
|
-
Toolkit.Toolkit<Tools>,
|
|
531
|
+
| Effect.Effect<
|
|
533
532
|
Toolkit.WithHandler<Tools>,
|
|
534
533
|
E,
|
|
535
534
|
R
|
|
@@ -554,20 +553,18 @@ export type ToolkitInput<
|
|
|
554
553
|
> =
|
|
555
554
|
| ToolkitOption<Tools, E, R>
|
|
556
555
|
| Toolkit.WithHandler<Tools>
|
|
557
|
-
| Effect.
|
|
558
|
-
Toolkit.Toolkit<Tools>,
|
|
556
|
+
| Effect.Effect<
|
|
559
557
|
Toolkit.WithHandler<Tools>,
|
|
560
558
|
E,
|
|
561
559
|
R
|
|
562
560
|
>
|
|
563
561
|
|
|
564
562
|
type ExtractToolsFromToolkitOption<ToolkitValue> = ToolkitValue extends Toolkit.WithHandler<infer Tools> ? Tools
|
|
565
|
-
: ToolkitValue extends Effect.
|
|
566
|
-
Toolkit.Toolkit<infer Tools>,
|
|
563
|
+
: ToolkitValue extends Effect.Effect<
|
|
567
564
|
Toolkit.WithHandler<infer _Tools>,
|
|
568
565
|
infer _E,
|
|
569
566
|
infer _R
|
|
570
|
-
> ?
|
|
567
|
+
> ? _Tools
|
|
571
568
|
: never
|
|
572
569
|
|
|
573
570
|
/**
|
|
@@ -585,20 +582,18 @@ type ExtractErrorFromToolkitOption<ToolkitValue, DisableToolCallResolution exten
|
|
|
585
582
|
Toolkit.WithHandler<infer Tools> ?
|
|
586
583
|
| AiError.AiError
|
|
587
584
|
| (DisableToolCallResolution extends true ? never : Tool.HandlerError<Tools[keyof Tools]>)
|
|
588
|
-
: ToolkitValue extends Effect.
|
|
589
|
-
Toolkit.Toolkit<infer Tools>,
|
|
585
|
+
: ToolkitValue extends Effect.Effect<
|
|
590
586
|
Toolkit.WithHandler<infer _Tools>,
|
|
591
587
|
infer E,
|
|
592
588
|
infer _R
|
|
593
|
-
> ? AiError.AiError | E | (DisableToolCallResolution extends true ? never : Tool.HandlerError<
|
|
589
|
+
> ? AiError.AiError | E | (DisableToolCallResolution extends true ? never : Tool.HandlerError<_Tools[keyof _Tools]>)
|
|
594
590
|
: AiError.AiError
|
|
595
591
|
|
|
596
592
|
type ExtractServicesFromToolkitOption<ToolkitValue> = ToolkitValue extends Toolkit.WithHandler<infer Tools> ?
|
|
597
593
|
| Tool.HandlerServices<Tools[keyof Tools]>
|
|
598
594
|
| Tool.ResultDecodingServices<Tools[keyof Tools]>
|
|
599
|
-
: ToolkitValue extends Effect.
|
|
600
|
-
Toolkit.
|
|
601
|
-
Toolkit.WithHandler<infer _Tools>,
|
|
595
|
+
: ToolkitValue extends Effect.Effect<
|
|
596
|
+
Toolkit.WithHandler<infer Tools>,
|
|
602
597
|
infer _E,
|
|
603
598
|
infer R
|
|
604
599
|
> ?
|
|
@@ -607,16 +602,14 @@ type ExtractServicesFromToolkitOption<ToolkitValue> = ToolkitValue extends Toolk
|
|
|
607
602
|
| R
|
|
608
603
|
: never
|
|
609
604
|
|
|
610
|
-
type ExtractToolkitResolutionError<ToolkitValue> = ToolkitValue extends Effect.
|
|
611
|
-
Toolkit.Toolkit<infer _Tools>,
|
|
605
|
+
type ExtractToolkitResolutionError<ToolkitValue> = ToolkitValue extends Effect.Effect<
|
|
612
606
|
Toolkit.WithHandler<infer _Tools>,
|
|
613
607
|
infer E,
|
|
614
608
|
infer _R
|
|
615
609
|
> ? E
|
|
616
610
|
: never
|
|
617
611
|
|
|
618
|
-
type ExtractToolkitResolutionServices<ToolkitValue> = ToolkitValue extends Effect.
|
|
619
|
-
Toolkit.Toolkit<infer _Tools>,
|
|
612
|
+
type ExtractToolkitResolutionServices<ToolkitValue> = ToolkitValue extends Effect.Effect<
|
|
620
613
|
Toolkit.WithHandler<infer _Tools>,
|
|
621
614
|
infer _E,
|
|
622
615
|
infer R
|
|
@@ -2163,8 +2156,8 @@ const resolveToolCalls = <Tools extends Record<string, Tool.Any>>(
|
|
|
2163
2156
|
const resolveToolkit = <Tools extends Record<string, Tool.Any>, E, R>(
|
|
2164
2157
|
toolkit: ToolkitInput<Tools, E, R>
|
|
2165
2158
|
): Effect.Effect<Toolkit.WithHandler<Tools>, E, R> =>
|
|
2166
|
-
(
|
|
2167
|
-
? toolkit
|
|
2159
|
+
(Effect.isEffect(toolkit)
|
|
2160
|
+
? toolkit
|
|
2168
2161
|
: Effect.succeed(toolkit as unknown as Toolkit.WithHandler<Tools>)) as any
|
|
2169
2162
|
|
|
2170
2163
|
/** @internal */
|
|
@@ -1280,9 +1280,9 @@ const layerHandlers = (serverInfo: {
|
|
|
1280
1280
|
Effect.provideService(CurrentLogLevel, currentLogLevel)
|
|
1281
1281
|
),
|
|
1282
1282
|
"resources/subscribe": () =>
|
|
1283
|
-
InternalError.notImplemented
|
|
1283
|
+
InternalError.notImplemented,
|
|
1284
1284
|
"resources/unsubscribe": () =>
|
|
1285
|
-
InternalError.notImplemented
|
|
1285
|
+
InternalError.notImplemented,
|
|
1286
1286
|
"resources/templates/list": (_, { client, headers }) =>
|
|
1287
1287
|
Effect.sync(() => {
|
|
1288
1288
|
const initialized = getInitializedClient(options.clientSessions, client.id, headers)
|
package/src/unstable/ai/Model.ts
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
import * as Context from "../../Context.ts"
|
|
32
32
|
import * as Effect from "../../Effect.ts"
|
|
33
33
|
import { identity } from "../../Function.ts"
|
|
34
|
-
import { PipeInspectableProto
|
|
34
|
+
import { PipeInspectableProto } from "../../internal/core.ts"
|
|
35
35
|
import * as Layer from "../../Layer.ts"
|
|
36
36
|
|
|
37
37
|
const TypeId = "~effect/ai/Model" as const
|
|
@@ -54,20 +54,23 @@ const TypeId = "~effect/ai/Model" as const
|
|
|
54
54
|
* @category models
|
|
55
55
|
*/
|
|
56
56
|
export interface Model<in out Provider, in out Provides, in out Requires>
|
|
57
|
-
extends
|
|
58
|
-
Layer.Layer<Provides | ProviderName | ModelName, never, Requires>,
|
|
59
|
-
Effect.Yieldable<
|
|
60
|
-
Model<Provider, Provides, Requires>,
|
|
61
|
-
Layer.Layer<Provides | ProviderName | ModelName>,
|
|
62
|
-
never,
|
|
63
|
-
Requires
|
|
64
|
-
>
|
|
57
|
+
extends Layer.Layer<Provides | ProviderName | ModelName, never, Requires>
|
|
65
58
|
{
|
|
66
59
|
readonly [TypeId]: typeof TypeId
|
|
60
|
+
|
|
67
61
|
/**
|
|
68
62
|
* The provider identifier (e.g., "openai", "anthropic", "amazon-bedrock").
|
|
69
63
|
*/
|
|
70
64
|
readonly provider: Provider
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns a `Layer` with the requirements satisfied, using the current context.
|
|
68
|
+
*/
|
|
69
|
+
readonly captureRequirements: Effect.Effect<
|
|
70
|
+
Layer.Layer<Provides | ProviderName | ModelName>,
|
|
71
|
+
never,
|
|
72
|
+
Requires
|
|
73
|
+
>
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
/**
|
|
@@ -99,7 +102,6 @@ export class ModelName extends Context.Service<ModelName, string>()(
|
|
|
99
102
|
) {}
|
|
100
103
|
|
|
101
104
|
const Proto = {
|
|
102
|
-
...YieldableProto,
|
|
103
105
|
...PipeInspectableProto,
|
|
104
106
|
[TypeId]: TypeId,
|
|
105
107
|
["~effect/Layer"]: {
|
|
@@ -107,9 +109,10 @@ const Proto = {
|
|
|
107
109
|
_E: identity,
|
|
108
110
|
_RIn: identity
|
|
109
111
|
},
|
|
110
|
-
|
|
112
|
+
get captureRequirements() {
|
|
113
|
+
const self = this as any as Model<any, any, any>
|
|
111
114
|
return Effect.contextWith((context: Context.Context<never>) =>
|
|
112
|
-
Effect.succeed(Layer.provide(
|
|
115
|
+
Effect.succeed(Layer.provide(self, Layer.succeedContext(context)))
|
|
113
116
|
)
|
|
114
117
|
},
|
|
115
118
|
toJSON(this: Model<any, any, any>): unknown {
|
|
@@ -41,12 +41,10 @@
|
|
|
41
41
|
import type * as Cause from "../../Cause.ts"
|
|
42
42
|
import * as Context from "../../Context.ts"
|
|
43
43
|
import * as Effect from "../../Effect.ts"
|
|
44
|
+
import * as Effectable from "../../Effectable.ts"
|
|
44
45
|
import * as Fiber from "../../Fiber.ts"
|
|
45
46
|
import { identity } from "../../Function.ts"
|
|
46
|
-
import type { Inspectable } from "../../Inspectable.ts"
|
|
47
|
-
import { PipeInspectableProto, YieldableProto } from "../../internal/core.ts"
|
|
48
47
|
import * as Layer from "../../Layer.ts"
|
|
49
|
-
import type { Pipeable } from "../../Pipeable.ts"
|
|
50
48
|
import * as Predicate from "../../Predicate.ts"
|
|
51
49
|
import * as Queue from "../../Queue.ts"
|
|
52
50
|
import * as Schema from "../../Schema.ts"
|
|
@@ -98,14 +96,11 @@ const TypeId = "~effect/ai/Toolkit" as const
|
|
|
98
96
|
* @category models
|
|
99
97
|
*/
|
|
100
98
|
export interface Toolkit<in out Tools extends Record<string, Tool.Any>> extends
|
|
101
|
-
Effect.
|
|
102
|
-
Toolkit<Tools>,
|
|
99
|
+
Effect.Effect<
|
|
103
100
|
WithHandler<Tools>,
|
|
104
101
|
never,
|
|
105
102
|
Tool.HandlersFor<Tools>
|
|
106
|
-
|
|
107
|
-
Inspectable,
|
|
108
|
-
Pipeable
|
|
103
|
+
>
|
|
109
104
|
{
|
|
110
105
|
new(_: never): {}
|
|
111
106
|
|
|
@@ -257,37 +252,11 @@ export interface WithHandler<in out Tools extends Record<string, Tool.Any>> {
|
|
|
257
252
|
export type WithHandlerTools<T> = T extends WithHandler<infer Tools> ? Tools : never
|
|
258
253
|
|
|
259
254
|
const Proto = {
|
|
260
|
-
...
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
of: identity,
|
|
264
|
-
toHandlers(
|
|
265
|
-
this: Toolkit<Record<string, Tool.Any>>,
|
|
266
|
-
build: Record<string, (params: any) => any> | Effect.Effect<Record<string, (params: any) => any>>
|
|
267
|
-
) {
|
|
268
|
-
return Effect.gen({ self: this }, function*() {
|
|
269
|
-
const services = yield* Effect.context<never>()
|
|
270
|
-
const handlers = Effect.isEffect(build) ? yield* build : build
|
|
271
|
-
const context = new Map<string, unknown>()
|
|
272
|
-
for (const [name, handler] of Object.entries(handlers)) {
|
|
273
|
-
const tool = this.tools[name]!
|
|
274
|
-
context.set(tool.id, { name, handler, context: services })
|
|
275
|
-
}
|
|
276
|
-
return Context.makeUnsafe(context)
|
|
277
|
-
})
|
|
278
|
-
},
|
|
279
|
-
toLayer(
|
|
280
|
-
this: Toolkit<Record<string, Tool.Any>>,
|
|
281
|
-
build: Record<string, (params: any) => any> | Effect.Effect<Record<string, (params: any) => any>>
|
|
282
|
-
) {
|
|
283
|
-
return Layer.effectContext(this.toHandlers(build))
|
|
284
|
-
},
|
|
285
|
-
asEffect(this: Toolkit<Record<string, Tool.Any>>) {
|
|
286
|
-
return Effect.gen({ self: this }, function*() {
|
|
255
|
+
...Effectable.Prototype({
|
|
256
|
+
label: "Toolkit",
|
|
257
|
+
evaluate: Effect.fnUntraced(function*(this: Toolkit<Record<string, Tool.Any>>, parent) {
|
|
287
258
|
const tools = this.tools
|
|
288
|
-
|
|
289
|
-
const services = yield* Effect.context<never>()
|
|
290
|
-
|
|
259
|
+
const services = parent.context
|
|
291
260
|
const schemasCache = new WeakMap<any, {
|
|
292
261
|
readonly context: Context.Context<never>
|
|
293
262
|
readonly handler: Tool.Handler<any>["handler"]
|
|
@@ -441,6 +410,29 @@ const Proto = {
|
|
|
441
410
|
handle: handle as any
|
|
442
411
|
} satisfies WithHandler<Record<string, any>>
|
|
443
412
|
})
|
|
413
|
+
}),
|
|
414
|
+
[TypeId]: TypeId,
|
|
415
|
+
of: identity,
|
|
416
|
+
toHandlers(
|
|
417
|
+
this: Toolkit<Record<string, Tool.Any>>,
|
|
418
|
+
build: Record<string, (params: any) => any> | Effect.Effect<Record<string, (params: any) => any>>
|
|
419
|
+
) {
|
|
420
|
+
return Effect.gen({ self: this }, function*() {
|
|
421
|
+
const services = yield* Effect.context<never>()
|
|
422
|
+
const handlers = Effect.isEffect(build) ? yield* build : build
|
|
423
|
+
const context = new Map<string, unknown>()
|
|
424
|
+
for (const [name, handler] of Object.entries(handlers)) {
|
|
425
|
+
const tool = this.tools[name]!
|
|
426
|
+
context.set(tool.id, { name, handler, context: services })
|
|
427
|
+
}
|
|
428
|
+
return Context.makeUnsafe(context)
|
|
429
|
+
})
|
|
430
|
+
},
|
|
431
|
+
toLayer(
|
|
432
|
+
this: Toolkit<Record<string, Tool.Any>>,
|
|
433
|
+
build: Record<string, (params: any) => any> | Effect.Effect<Record<string, (params: any) => any>>
|
|
434
|
+
) {
|
|
435
|
+
return Layer.effectContext(this.toHandlers(build))
|
|
444
436
|
},
|
|
445
437
|
toJSON(this: Toolkit<any>): unknown {
|
|
446
438
|
return {
|
|
@@ -10,13 +10,12 @@ import { dual } from "../../Function.ts"
|
|
|
10
10
|
import type * as Layer from "../../Layer.ts"
|
|
11
11
|
import * as Option from "../../Option.ts"
|
|
12
12
|
import type * as Path from "../../Path.ts"
|
|
13
|
-
import type { Pipeable } from "../../Pipeable.ts"
|
|
14
13
|
import * as Predicate from "../../Predicate.ts"
|
|
15
14
|
import * as References from "../../References.ts"
|
|
16
15
|
import * as Result from "../../Result.ts"
|
|
17
16
|
import * as Stdio from "../../Stdio.ts"
|
|
18
17
|
import * as Terminal from "../../Terminal.ts"
|
|
19
|
-
import type { NoInfer, Simplify } from "../../Types.ts"
|
|
18
|
+
import type { Contravariant, Covariant, NoInfer, Simplify } from "../../Types.ts"
|
|
20
19
|
import type { ChildProcessSpawner } from "../process/ChildProcessSpawner.ts"
|
|
21
20
|
import * as CliError from "./CliError.ts"
|
|
22
21
|
import * as CliOutput from "./CliOutput.ts"
|
|
@@ -77,17 +76,15 @@ import * as Param from "./Param.ts"
|
|
|
77
76
|
* @since 4.0.0
|
|
78
77
|
* @category models
|
|
79
78
|
*/
|
|
80
|
-
export interface Command<Name extends string, Input, ContextInput = {}, E = never, R = never>
|
|
79
|
+
export interface Command<in out Name extends string, in Input, out ContextInput = {}, out E = never, out R = never>
|
|
81
80
|
extends
|
|
82
|
-
|
|
83
|
-
Effect.Yieldable<
|
|
84
|
-
Command<Name, Input, ContextInput, E, R>,
|
|
81
|
+
Effect.Effect<
|
|
85
82
|
ContextInput,
|
|
86
83
|
never,
|
|
87
84
|
CommandContext<Name>
|
|
88
85
|
>
|
|
89
86
|
{
|
|
90
|
-
readonly [TypeId]:
|
|
87
|
+
readonly [TypeId]: Command.Variance<Input, E, R>
|
|
91
88
|
|
|
92
89
|
/**
|
|
93
90
|
* The name of the command.
|
|
@@ -132,6 +129,16 @@ export interface Command<Name extends string, Input, ContextInput = {}, E = neve
|
|
|
132
129
|
* @since 4.0.0
|
|
133
130
|
*/
|
|
134
131
|
export declare namespace Command {
|
|
132
|
+
/**
|
|
133
|
+
* @since 4.0.0
|
|
134
|
+
* @category models
|
|
135
|
+
*/
|
|
136
|
+
export interface Variance<in Input, out E, out R> {
|
|
137
|
+
readonly Input: Contravariant<Input>
|
|
138
|
+
readonly E: Covariant<E>
|
|
139
|
+
readonly R: Covariant<R>
|
|
140
|
+
}
|
|
141
|
+
|
|
135
142
|
/**
|
|
136
143
|
* Represents a concrete usage example for a command.
|
|
137
144
|
*
|
|
@@ -262,7 +269,19 @@ export declare namespace Command {
|
|
|
262
269
|
* @since 4.0.0
|
|
263
270
|
* @category models
|
|
264
271
|
*/
|
|
265
|
-
export
|
|
272
|
+
export interface Any extends Effect.Effect<any, never, any> {
|
|
273
|
+
readonly [TypeId]: any
|
|
274
|
+
readonly name: string
|
|
275
|
+
readonly description: string | undefined
|
|
276
|
+
readonly shortDescription: string | undefined
|
|
277
|
+
readonly alias: string | undefined
|
|
278
|
+
readonly examples: ReadonlyArray<Command.Example>
|
|
279
|
+
readonly subcommands: ReadonlyArray<{
|
|
280
|
+
readonly group: string | undefined
|
|
281
|
+
readonly commands: NonEmptyReadonlyArray<Command.Any>
|
|
282
|
+
}>
|
|
283
|
+
readonly annotations: Context.Context<never>
|
|
284
|
+
}
|
|
266
285
|
|
|
267
286
|
/**
|
|
268
287
|
* A grouped set of subcommands used by `Command.withSubcommands`.
|
|
@@ -719,7 +738,7 @@ export const withHandler: {
|
|
|
719
738
|
self: Command<Name, A, ContextInput, XE, XR>,
|
|
720
739
|
handler: (value: A) => Effect.Effect<void, E, R>
|
|
721
740
|
): Command<Name, A, ContextInput, E, Exclude<R, GlobalFlag.BuiltInSettingContext>> =>
|
|
722
|
-
makeCommand({ ...toImpl(self), handle: handler }))
|
|
741
|
+
makeCommand({ ...toImpl(self), handle: handler } as any))
|
|
723
742
|
|
|
724
743
|
interface SubcommandGroupInternal {
|
|
725
744
|
readonly group: string | undefined
|
|
@@ -931,7 +950,7 @@ export const withSubcommands: {
|
|
|
931
950
|
checkForDuplicateFlags(self, normalized.flat)
|
|
932
951
|
|
|
933
952
|
const impl = toImpl(self)
|
|
934
|
-
const byName = new Map(normalized.flat.map((s) => [s.name, toImpl(s)] as const))
|
|
953
|
+
const byName = new Map(normalized.flat.map((s) => [s.name, toImpl(s as any)] as const))
|
|
935
954
|
|
|
936
955
|
type NextInput = Simplify<Input | ContextInput>
|
|
937
956
|
const SubcommandStateSymbol = Symbol("effect/cli/SubcommandState")
|
|
@@ -984,7 +1003,7 @@ export const withSubcommands: {
|
|
|
984
1003
|
parse,
|
|
985
1004
|
parseContext: impl.parseContext,
|
|
986
1005
|
handle
|
|
987
|
-
})
|
|
1006
|
+
}) as any
|
|
988
1007
|
})
|
|
989
1008
|
|
|
990
1009
|
/**
|
|
@@ -1096,7 +1115,7 @@ export const withSharedFlags: {
|
|
|
1096
1115
|
parse,
|
|
1097
1116
|
parseContext,
|
|
1098
1117
|
handle
|
|
1099
|
-
})
|
|
1118
|
+
}) as any
|
|
1100
1119
|
}
|
|
1101
1120
|
)
|
|
1102
1121
|
|
|
@@ -1151,7 +1170,7 @@ export const withGlobalFlags: {
|
|
|
1151
1170
|
): Command<Name, Input, ContextInput, E, Exclude<R, ExtractGlobalFlagContext<GlobalFlags>>> => {
|
|
1152
1171
|
const impl = toImpl(self)
|
|
1153
1172
|
const next = Array.from(new Set([...impl.globalFlags, ...globalFlags]))
|
|
1154
|
-
return makeCommand({ ...impl, globalFlags: next })
|
|
1173
|
+
return makeCommand({ ...impl, globalFlags: next }) as any
|
|
1155
1174
|
}
|
|
1156
1175
|
)
|
|
1157
1176
|
|
|
@@ -25,7 +25,7 @@ import * as HelpInternal from "./internal/help.ts"
|
|
|
25
25
|
* @category models
|
|
26
26
|
*/
|
|
27
27
|
export interface HandlerContext {
|
|
28
|
-
readonly command: Command.Command
|
|
28
|
+
readonly command: Command.Command.Any
|
|
29
29
|
readonly commandPath: ReadonlyArray<string>
|
|
30
30
|
readonly version: string
|
|
31
31
|
}
|
|
@@ -1506,7 +1506,7 @@ export const withFallbackConfig: {
|
|
|
1506
1506
|
kind: error._tag === "MissingOption" ? "flag" : "argument"
|
|
1507
1507
|
})
|
|
1508
1508
|
const runConfig = (error: CliError.MissingOption | CliError.MissingArgument, args: ParsedArgs) =>
|
|
1509
|
-
Config.option(config).
|
|
1509
|
+
Config.option(config).pipe(
|
|
1510
1510
|
Effect.mapError((configError) => toInvalidValue(error, configError)),
|
|
1511
1511
|
Effect.flatMap(Option.match({
|
|
1512
1512
|
onNone: () => Effect.fail(error),
|
|
@@ -6,13 +6,12 @@ import type { NoSuchElementError } from "../../Cause.ts"
|
|
|
6
6
|
import type * as Cause from "../../Cause.ts"
|
|
7
7
|
import * as Data from "../../Data.ts"
|
|
8
8
|
import * as Effect from "../../Effect.ts"
|
|
9
|
+
import * as Effectable from "../../Effectable.ts"
|
|
9
10
|
import * as FileSystem from "../../FileSystem.ts"
|
|
10
11
|
import { dual, pipe } from "../../Function.ts"
|
|
11
|
-
import { YieldableProto } from "../../internal/core.ts"
|
|
12
12
|
import * as EffectNumber from "../../Number.ts"
|
|
13
13
|
import * as Option from "../../Option.ts"
|
|
14
14
|
import * as Path from "../../Path.ts"
|
|
15
|
-
import * as Pipeable from "../../Pipeable.ts"
|
|
16
15
|
import * as Predicate from "../../Predicate.ts"
|
|
17
16
|
import * as Queue from "../../Queue.ts"
|
|
18
17
|
import * as Redacted from "../../Redacted.ts"
|
|
@@ -27,9 +26,7 @@ const TypeId = "~effect/cli/Prompt"
|
|
|
27
26
|
* @since 4.0.0
|
|
28
27
|
* @category models
|
|
29
28
|
*/
|
|
30
|
-
export interface Prompt<Output>
|
|
31
|
-
extends Pipeable.Pipeable, Effect.Yieldable<Prompt<Output>, Output, Terminal.QuitError, Environment>
|
|
32
|
-
{
|
|
29
|
+
export interface Prompt<Output> extends Effect.Effect<Output, Terminal.QuitError, Environment> {
|
|
33
30
|
readonly [TypeId]: {
|
|
34
31
|
readonly _Output: Covariant<Output>
|
|
35
32
|
}
|
|
@@ -1060,15 +1057,14 @@ export const toggle = (options: ToggleOptions): Prompt<boolean> => {
|
|
|
1060
1057
|
}
|
|
1061
1058
|
|
|
1062
1059
|
const proto = {
|
|
1063
|
-
...
|
|
1060
|
+
...Effectable.Prototype<Prompt<any>>({
|
|
1061
|
+
label: "Prompt",
|
|
1062
|
+
evaluate() {
|
|
1063
|
+
return run(this)
|
|
1064
|
+
}
|
|
1065
|
+
}),
|
|
1064
1066
|
[TypeId]: {
|
|
1065
1067
|
_Output: (_: never) => _
|
|
1066
|
-
},
|
|
1067
|
-
asEffect(): Effect.Effect<unknown, Terminal.QuitError, Environment> {
|
|
1068
|
-
return run(this as any)
|
|
1069
|
-
},
|
|
1070
|
-
pipe() {
|
|
1071
|
-
return Pipeable.pipeArguments(this, arguments)
|
|
1072
1068
|
}
|
|
1073
1069
|
}
|
|
1074
1070
|
|
|
@@ -1882,7 +1878,7 @@ const resolveCurrentPath = (
|
|
|
1882
1878
|
}
|
|
1883
1879
|
if (Option.isSome(options.startingPath)) {
|
|
1884
1880
|
const startingPath = options.startingPath.value
|
|
1885
|
-
return Effect.flatMap(FileSystem.FileSystem
|
|
1881
|
+
return Effect.flatMap(FileSystem.FileSystem, (fs) =>
|
|
1886
1882
|
// Ensure the user provided starting path exists
|
|
1887
1883
|
Effect.orDie(fs.exists(startingPath)).pipe(
|
|
1888
1884
|
Effect.flatMap((exists) =>
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
import * as Arr from "../../../Array.ts"
|
|
9
9
|
import * as Context from "../../../Context.ts"
|
|
10
10
|
import * as Effect from "../../../Effect.ts"
|
|
11
|
-
import
|
|
11
|
+
import * as Effectable from "../../../Effectable.ts"
|
|
12
12
|
import * as Option from "../../../Option.ts"
|
|
13
|
-
import { pipeArguments } from "../../../Pipeable.ts"
|
|
14
13
|
import * as Predicate from "../../../Predicate.ts"
|
|
15
14
|
import * as CliError from "../CliError.ts"
|
|
16
15
|
import type * as GlobalFlag from "../GlobalFlag.ts"
|
|
@@ -73,14 +72,13 @@ export const toImpl = <Name extends string, Input, E, R, ContextInput = {}>(
|
|
|
73
72
|
/* Proto */
|
|
74
73
|
/* ========================================================================== */
|
|
75
74
|
|
|
76
|
-
export const Proto = {
|
|
77
|
-
...
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
75
|
+
export const Proto: Effect.Effect<any, never, any> = {
|
|
76
|
+
...Effectable.Prototype<Command.Any>({
|
|
77
|
+
label: "Command",
|
|
78
|
+
evaluate() {
|
|
79
|
+
return toImpl(this).service
|
|
80
|
+
}
|
|
81
|
+
})
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
/* ========================================================================== */
|
|
@@ -287,9 +285,9 @@ const parseParams: (parsedArgs: Param.ParsedArgs, params: ReadonlyArray<Param.An
|
|
|
287
285
|
/**
|
|
288
286
|
* Checks for duplicate flag names between parent and child commands.
|
|
289
287
|
*/
|
|
290
|
-
export const checkForDuplicateFlags = <Name extends string, Input, ContextInput>(
|
|
291
|
-
parent: Command<Name, Input, ContextInput,
|
|
292
|
-
subcommands: ReadonlyArray<Command
|
|
288
|
+
export const checkForDuplicateFlags = <Name extends string, Input, ContextInput, E, R>(
|
|
289
|
+
parent: Command<Name, Input, ContextInput, E, R>,
|
|
290
|
+
subcommands: ReadonlyArray<Command.Any>,
|
|
293
291
|
options?: {
|
|
294
292
|
readonly contextConfig?: ConfigInternal | undefined
|
|
295
293
|
} | undefined
|
|
@@ -309,7 +307,7 @@ export const checkForDuplicateFlags = <Name extends string, Input, ContextInput>
|
|
|
309
307
|
extractNames((options?.contextConfig ?? parentImpl.contextConfig).flags)
|
|
310
308
|
|
|
311
309
|
for (const subcommand of subcommands) {
|
|
312
|
-
const subImpl = toImpl(subcommand)
|
|
310
|
+
const subImpl = toImpl(subcommand as any)
|
|
313
311
|
for (const option of subImpl.config.flags) {
|
|
314
312
|
const singles = Param.extractSingleParams(option)
|
|
315
313
|
for (const single of singles) {
|
|
@@ -502,7 +502,7 @@ export const make = Effect.gen(function*() {
|
|
|
502
502
|
),
|
|
503
503
|
|
|
504
504
|
deferredResult: (deferred) =>
|
|
505
|
-
WorkflowEngine.WorkflowInstance.
|
|
505
|
+
WorkflowEngine.WorkflowInstance.pipe(
|
|
506
506
|
Effect.flatMap((instance) =>
|
|
507
507
|
requestReply({
|
|
508
508
|
workflow: instance.workflow,
|
|
@@ -221,10 +221,10 @@ const Proto = {
|
|
|
221
221
|
return fromRpcGroup(this.type, this.protocol.annotateRpcsMerge(annotations))
|
|
222
222
|
},
|
|
223
223
|
getShardId(this: Entity<string, any>, entityId: EntityId) {
|
|
224
|
-
return Effect.map(shardingTag
|
|
224
|
+
return Effect.map(shardingTag, (sharding) => sharding.getShardId(entityId, this.getShardGroup(entityId)))
|
|
225
225
|
},
|
|
226
226
|
get client() {
|
|
227
|
-
return shardingTag.
|
|
227
|
+
return shardingTag.pipe(
|
|
228
228
|
Effect.flatMap((sharding) => sharding.makeClient(this as any))
|
|
229
229
|
)
|
|
230
230
|
},
|
|
@@ -253,7 +253,7 @@ const Proto = {
|
|
|
253
253
|
| Rpc.Middleware<Rpcs>
|
|
254
254
|
| Sharding
|
|
255
255
|
> {
|
|
256
|
-
return shardingTag.
|
|
256
|
+
return shardingTag.pipe(
|
|
257
257
|
Effect.flatMap((sharding) =>
|
|
258
258
|
sharding.registerEntity(
|
|
259
259
|
this,
|
|
@@ -929,7 +929,7 @@ export const layerMemory: Layer.Layer<
|
|
|
929
929
|
MessageStorage | MemoryDriver,
|
|
930
930
|
never,
|
|
931
931
|
ShardingConfig
|
|
932
|
-
> = Layer.effect(MessageStorage, Effect.map(MemoryDriver
|
|
932
|
+
> = Layer.effect(MessageStorage, Effect.map(MemoryDriver, (_) => _.storage)).pipe(
|
|
933
933
|
Layer.provideMerge(MemoryDriver.layer)
|
|
934
934
|
)
|
|
935
935
|
|
|
@@ -263,7 +263,7 @@ export const config: Config.Config<ShardingConfig["Service"]> = Config.all({
|
|
|
263
263
|
* @since 4.0.0
|
|
264
264
|
* @category Config
|
|
265
265
|
*/
|
|
266
|
-
export const configFromEnv = config.
|
|
266
|
+
export const configFromEnv = config.pipe(
|
|
267
267
|
Effect.provideService(
|
|
268
268
|
ConfigProvider.ConfigProvider,
|
|
269
269
|
ConfigProvider.fromEnv().pipe(
|
|
@@ -192,7 +192,7 @@ export const makeStorage = (options?: {
|
|
|
192
192
|
VALUES (1, ${created})
|
|
193
193
|
`.pipe(
|
|
194
194
|
Effect.catchIf(
|
|
195
|
-
|
|
195
|
+
isConstraintConflict,
|
|
196
196
|
() => Effect.void
|
|
197
197
|
),
|
|
198
198
|
Effect.andThen(selectRemoteId),
|
|
@@ -504,3 +504,6 @@ const decodeSessionAuthBindings = (
|
|
|
504
504
|
): Effect.Effect<ReadonlyArray<SessionAuthBindingSql>, Schema.SchemaError> => decodeSessionAuthBindingRows(rows)
|
|
505
505
|
|
|
506
506
|
const withTracerDisabled = Effect.withTracerEnabled(false)
|
|
507
|
+
|
|
508
|
+
const isConstraintConflict = (error: SqlError.SqlError): boolean =>
|
|
509
|
+
error.reason._tag === "ConstraintError" || error.reason._tag === "UniqueViolation"
|