effect 4.0.0-beta.85 → 4.0.0-beta.87
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/ChannelSchema.d.ts +8 -8
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/Config.d.ts +2 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +10 -3
- package/dist/Config.js.map +1 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +4 -0
- package/dist/Cron.js.map +1 -1
- package/dist/Schema.d.ts +749 -393
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +95 -65
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +20 -29
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts +24 -24
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +43 -39
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +300 -300
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +5 -8
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/internal/effect.js +6 -7
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/matcher.js +0 -2
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/schema/representation.js +1 -5
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +9 -9
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +3 -2
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +2 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +4 -4
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +13 -6
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +4 -4
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +2 -2
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +2 -2
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +26 -26
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +8 -7
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +8 -7
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +1806 -168
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +0 -70
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +3 -4
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +0 -22
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +48 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +0 -6
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -3
- package/dist/unstable/cluster/Reply.d.ts +2 -2
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +6 -6
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +22 -22
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +12 -3
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +32 -32
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +13 -6
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +0 -13
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js +0 -68
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +0 -28
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +2 -2
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +6 -6
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +3 -3
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +3 -4
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +25 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +7 -0
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +20 -0
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +2 -2
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +10 -3
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +3 -3
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/schema/Model.d.ts +2 -2
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +16 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +1 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +4 -4
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +5 -5
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +1 -0
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +3 -0
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +18 -18
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +3 -3
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +3 -3
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ChannelSchema.ts +9 -9
- package/src/Config.ts +12 -5
- package/src/Cron.ts +4 -0
- package/src/Schema.ts +968 -689
- package/src/SchemaAST.ts +25 -35
- package/src/SchemaParser.ts +85 -77
- package/src/SchemaTransformation.ts +5 -6
- package/src/internal/effect.ts +6 -22
- package/src/internal/matcher.ts +0 -5
- package/src/internal/schema/arbitrary.ts +1 -1
- package/src/internal/schema/representation.ts +1 -5
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/TestSchema.ts +14 -13
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +7 -7
- package/src/unstable/ai/McpSchema.ts +16 -14
- package/src/unstable/ai/McpServer.ts +7 -7
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Response.ts +9 -5
- package/src/unstable/ai/Tool.ts +49 -47
- package/src/unstable/cli/Argument.ts +9 -8
- package/src/unstable/cli/Flag.ts +9 -8
- package/src/unstable/cli/Param.ts +6 -146
- package/src/unstable/cli/Primitive.ts +5 -6
- package/src/unstable/cli/internal/ansi.ts +0 -33
- package/src/unstable/cli/internal/config.ts +0 -8
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/MessageStorage.ts +1 -1
- package/src/unstable/cluster/Reply.ts +6 -2
- package/src/unstable/devtools/DevToolsSchema.ts +1 -1
- package/src/unstable/encoding/Msgpack.ts +9 -7
- package/src/unstable/encoding/Ndjson.ts +10 -10
- package/src/unstable/encoding/Sse.ts +1 -1
- package/src/unstable/eventlog/Event.ts +3 -3
- package/src/unstable/http/HttpBody.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +1 -1
- package/src/unstable/http/HttpIncomingMessage.ts +1 -1
- package/src/unstable/http/HttpMiddleware.ts +12 -3
- package/src/unstable/httpapi/HttpApi.ts +1 -1
- package/src/unstable/httpapi/HttpApiBuilder.ts +9 -5
- package/src/unstable/httpapi/HttpApiClient.ts +10 -10
- package/src/unstable/httpapi/HttpApiEndpoint.ts +45 -33
- package/src/unstable/httpapi/HttpApiMiddleware.ts +2 -2
- package/src/unstable/httpapi/HttpApiSchema.ts +16 -43
- package/src/unstable/httpapi/OpenApi.ts +5 -5
- package/src/unstable/observability/internal/otlpProtobuf.ts +0 -75
- package/src/unstable/observability/internal/protobuf.ts +0 -42
- package/src/unstable/persistence/KeyValueStore.ts +2 -2
- package/src/unstable/persistence/Persistable.ts +7 -7
- package/src/unstable/persistence/PersistedQueue.ts +3 -3
- package/src/unstable/persistence/Persistence.ts +5 -5
- package/src/unstable/reactivity/AsyncResult.ts +4 -4
- package/src/unstable/reactivity/Atom.ts +1 -1
- package/src/unstable/reactivity/AtomHttpApi.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +7 -8
- package/src/unstable/rpc/RpcClient.ts +26 -4
- package/src/unstable/rpc/RpcMessage.ts +19 -0
- package/src/unstable/rpc/RpcMiddleware.ts +2 -2
- package/src/unstable/rpc/RpcSchema.ts +12 -9
- package/src/unstable/rpc/RpcWorker.ts +3 -3
- package/src/unstable/schema/Model.ts +2 -2
- package/src/unstable/schema/VariantSchema.ts +19 -17
- package/src/unstable/sql/SqlConnection.ts +5 -0
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +6 -6
- package/src/unstable/sql/SqlSchema.ts +5 -5
- package/src/unstable/sql/Statement.ts +11 -0
- package/src/unstable/workflow/Activity.ts +6 -6
- package/src/unstable/workflow/DurableDeferred.ts +33 -33
- package/src/unstable/workflow/Workflow.ts +5 -5
- package/src/unstable/workflow/WorkflowEngine.ts +10 -10
- package/dist/internal/concurrency.d.ts +0 -2
- package/dist/internal/concurrency.d.ts.map +0 -1
- package/dist/internal/concurrency.js +0 -29
- package/dist/internal/concurrency.js.map +0 -1
- package/src/internal/concurrency.ts +0 -52
|
@@ -67,28 +67,28 @@ export class Persistence extends Context.Service<Persistence, {
|
|
|
67
67
|
* @since 4.0.0
|
|
68
68
|
*/
|
|
69
69
|
export interface PersistenceStore {
|
|
70
|
-
readonly get: <A extends Schema.
|
|
70
|
+
readonly get: <A extends Schema.Constraint, E extends Schema.Constraint>(
|
|
71
71
|
key: Persistable.Persistable<A, E>
|
|
72
72
|
) => Effect.Effect<
|
|
73
73
|
Exit.Exit<A["Type"], E["Type"]> | undefined,
|
|
74
74
|
PersistenceError | Schema.SchemaError,
|
|
75
75
|
A["DecodingServices"] | E["DecodingServices"]
|
|
76
76
|
>
|
|
77
|
-
readonly getMany: <A extends Schema.
|
|
77
|
+
readonly getMany: <A extends Schema.Constraint, E extends Schema.Constraint>(
|
|
78
78
|
keys: Iterable<Persistable.Persistable<A, E>>
|
|
79
79
|
) => Effect.Effect<
|
|
80
80
|
Array<Exit.Exit<A["Type"], E["Type"]> | undefined>,
|
|
81
81
|
PersistenceError | Schema.SchemaError,
|
|
82
82
|
A["DecodingServices"] | E["DecodingServices"]
|
|
83
83
|
>
|
|
84
|
-
readonly set: <A extends Schema.
|
|
84
|
+
readonly set: <A extends Schema.Constraint, E extends Schema.Constraint>(
|
|
85
85
|
key: Persistable.Persistable<A, E>,
|
|
86
86
|
value: Exit.Exit<A["Type"], E["Type"]>
|
|
87
87
|
) => Effect.Effect<void, PersistenceError | Schema.SchemaError, A["EncodingServices"] | E["EncodingServices"]>
|
|
88
|
-
readonly setMany: <A extends Schema.
|
|
88
|
+
readonly setMany: <A extends Schema.Constraint, E extends Schema.Constraint>(
|
|
89
89
|
entries: Iterable<readonly [Persistable.Persistable<A, E>, Exit.Exit<A["Type"], E["Type"]>]>
|
|
90
90
|
) => Effect.Effect<void, PersistenceError | Schema.SchemaError, A["EncodingServices"] | E["EncodingServices"]>
|
|
91
|
-
readonly remove: <A extends Schema.
|
|
91
|
+
readonly remove: <A extends Schema.Constraint, E extends Schema.Constraint>(
|
|
92
92
|
key: Persistable.Persistable<A, E>
|
|
93
93
|
) => Effect.Effect<void, PersistenceError>
|
|
94
94
|
readonly clear: Effect.Effect<void, PersistenceError>
|
|
@@ -1063,8 +1063,8 @@ class BuilderImpl<Out, A, E> {
|
|
|
1063
1063
|
* @since 4.0.0
|
|
1064
1064
|
*/
|
|
1065
1065
|
export interface Schema<
|
|
1066
|
-
Success extends Schema_.
|
|
1067
|
-
Error extends Schema_.
|
|
1066
|
+
Success extends Schema_.Constraint,
|
|
1067
|
+
Error extends Schema_.Constraint
|
|
1068
1068
|
> extends
|
|
1069
1069
|
Schema_.declareConstructor<
|
|
1070
1070
|
AsyncResult<Success["Type"], Error["Type"]>,
|
|
@@ -1083,8 +1083,8 @@ export interface Schema<
|
|
|
1083
1083
|
* @since 4.0.0
|
|
1084
1084
|
*/
|
|
1085
1085
|
export const Schema = <
|
|
1086
|
-
A extends Schema_.
|
|
1087
|
-
E extends Schema_.
|
|
1086
|
+
A extends Schema_.Constraint = Schema_.Never,
|
|
1087
|
+
E extends Schema_.Constraint = Schema_.Never
|
|
1088
1088
|
>(
|
|
1089
1089
|
options: {
|
|
1090
1090
|
readonly success?: A | undefined
|
|
@@ -2947,7 +2947,7 @@ export type SerializableTypeId = "~effect-atom/atom/Atom/Serializable"
|
|
|
2947
2947
|
* @category Serializable
|
|
2948
2948
|
* @since 4.0.0
|
|
2949
2949
|
*/
|
|
2950
|
-
export interface Serializable<S extends Schema.
|
|
2950
|
+
export interface Serializable<S extends Schema.Constraint> {
|
|
2951
2951
|
readonly [SerializableTypeId]: {
|
|
2952
2952
|
readonly key: string
|
|
2953
2953
|
readonly encode: (value: S["Type"]) => S["Encoded"]
|
|
@@ -343,7 +343,7 @@ type ResponseByMode<Success, ResponseMode extends HttpApiEndpoint.ClientResponse
|
|
|
343
343
|
: Success
|
|
344
344
|
|
|
345
345
|
type ErrorByMode<
|
|
346
|
-
Error extends Schema.
|
|
346
|
+
Error extends Schema.Constraint,
|
|
347
347
|
Middleware,
|
|
348
348
|
ResponseMode extends HttpApiEndpoint.ClientResponseMode
|
|
349
349
|
> =
|
package/src/unstable/rpc/Rpc.ts
CHANGED
|
@@ -51,7 +51,6 @@ export const isRpc = (u: unknown): u is Rpc<any, any, any> => Predicate.hasPrope
|
|
|
51
51
|
* @since 4.0.0
|
|
52
52
|
*/
|
|
53
53
|
export interface DefectSchema extends Schema.Top {
|
|
54
|
-
readonly Type: unknown
|
|
55
54
|
make(input: null, options?: Schema.MakeOptions): unknown
|
|
56
55
|
make(input: undefined, options?: Schema.MakeOptions): unknown
|
|
57
56
|
make(input: {}, options?: Schema.MakeOptions): unknown
|
|
@@ -807,7 +806,7 @@ const Proto = {
|
|
|
807
806
|
middlewares: this.middlewares
|
|
808
807
|
})
|
|
809
808
|
},
|
|
810
|
-
setPayload(this: AnyWithProps, payloadSchema: Schema.Struct<
|
|
809
|
+
setPayload(this: AnyWithProps, payloadSchema: Schema.Struct<Schema.Struct.Fields> | Schema.Struct.Fields) {
|
|
811
810
|
return makeProto({
|
|
812
811
|
_tag: this._tag,
|
|
813
812
|
payloadSchema: Schema.isSchema(payloadSchema) ? payloadSchema as any : Schema.Struct(payloadSchema as any),
|
|
@@ -876,7 +875,7 @@ const makeProto = <
|
|
|
876
875
|
readonly payloadSchema: Payload
|
|
877
876
|
readonly successSchema: Success
|
|
878
877
|
readonly errorSchema: Error
|
|
879
|
-
readonly defectSchema: Schema.
|
|
878
|
+
readonly defectSchema: Schema.Constraint
|
|
880
879
|
readonly annotations: Context.Context<never>
|
|
881
880
|
readonly middlewares: ReadonlySet<Middleware>
|
|
882
881
|
}): Rpc<Tag, Payload, Success, Error, Middleware, Requires> => {
|
|
@@ -971,7 +970,7 @@ export const make = <
|
|
|
971
970
|
* }
|
|
972
971
|
*
|
|
973
972
|
* // The type definition for the transformed success schema.
|
|
974
|
-
* export interface Paginated<S extends Schema.
|
|
973
|
+
* export interface Paginated<S extends Schema.Constraint> extends
|
|
975
974
|
* Schema.Struct<{
|
|
976
975
|
* readonly offset: Schema.Number
|
|
977
976
|
* readonly total: Schema.Number
|
|
@@ -1071,8 +1070,8 @@ export declare namespace Custom {
|
|
|
1071
1070
|
* @since 4.0.0
|
|
1072
1071
|
*/
|
|
1073
1072
|
export interface Out<
|
|
1074
|
-
Success extends Schema.
|
|
1075
|
-
Error extends Schema.
|
|
1073
|
+
Success extends Schema.Constraint,
|
|
1074
|
+
Error extends Schema.Constraint
|
|
1076
1075
|
> {
|
|
1077
1076
|
readonly success: Success
|
|
1078
1077
|
readonly error: Error
|
|
@@ -1097,8 +1096,8 @@ export declare namespace Custom {
|
|
|
1097
1096
|
*/
|
|
1098
1097
|
export type Kind<
|
|
1099
1098
|
Def extends Custom,
|
|
1100
|
-
Success extends Schema.
|
|
1101
|
-
Error extends Schema.
|
|
1099
|
+
Success extends Schema.Constraint,
|
|
1100
|
+
Error extends Schema.Constraint
|
|
1102
1101
|
> = (Def & {
|
|
1103
1102
|
readonly success: Success
|
|
1104
1103
|
readonly error: Error
|
|
@@ -43,7 +43,7 @@ import * as Rpc from "./Rpc.ts"
|
|
|
43
43
|
import { RpcClientDefect, RpcClientError } from "./RpcClientError.ts"
|
|
44
44
|
import type * as RpcGroup from "./RpcGroup.ts"
|
|
45
45
|
import type { FromClient, FromClientEncoded, FromServer, FromServerEncoded, Request } from "./RpcMessage.ts"
|
|
46
|
-
import { constPing, RequestId } from "./RpcMessage.ts"
|
|
46
|
+
import { constPing, isTerminalResponse, RequestId } from "./RpcMessage.ts"
|
|
47
47
|
import type * as RpcMiddleware from "./RpcMiddleware.ts"
|
|
48
48
|
import * as RpcSchema from "./RpcSchema.ts"
|
|
49
49
|
import * as RpcSerialization from "./RpcSerialization.ts"
|
|
@@ -901,6 +901,8 @@ export const makeProtocolHttp = (client: HttpClient.HttpClient): Effect.Effect<
|
|
|
901
901
|
})
|
|
902
902
|
const emptyResponseError = (request: FromClientEncoded) =>
|
|
903
903
|
protocolDefect("Received empty HTTP response from RPC server", request)
|
|
904
|
+
const incompleteResponseError = (request: FromClientEncoded) =>
|
|
905
|
+
protocolDefect("HTTP response ended before RPC request completed", request)
|
|
904
906
|
|
|
905
907
|
const send = Effect.fnUntraced(function*(clientId: number, request: FromClientEncoded) {
|
|
906
908
|
if (request._tag !== "Request") {
|
|
@@ -928,15 +930,27 @@ export const makeProtocolHttp = (client: HttpClient.HttpClient): Effect.Effect<
|
|
|
928
930
|
if (responses.length === 0) {
|
|
929
931
|
return yield* emptyResponseError(request)
|
|
930
932
|
}
|
|
933
|
+
let completed = false
|
|
931
934
|
let i = 0
|
|
932
|
-
|
|
935
|
+
yield* Effect.whileLoop({
|
|
933
936
|
while: () => i < responses.length,
|
|
934
|
-
body: () =>
|
|
937
|
+
body: () => {
|
|
938
|
+
const response = responses[i++]
|
|
939
|
+
if (isTerminalResponse(response)) {
|
|
940
|
+
completed = true
|
|
941
|
+
}
|
|
942
|
+
return writeResponse(clientId, response)
|
|
943
|
+
},
|
|
935
944
|
step: constVoid
|
|
936
945
|
})
|
|
946
|
+
if (!completed) {
|
|
947
|
+
return yield* incompleteResponseError(request)
|
|
948
|
+
}
|
|
949
|
+
return
|
|
937
950
|
}
|
|
938
951
|
|
|
939
952
|
let hasResponse = false
|
|
953
|
+
let completed = false
|
|
940
954
|
yield* Stream.runForEachArray(response.stream, (chunk) =>
|
|
941
955
|
Effect.try({
|
|
942
956
|
try: () => chunk.flatMap(parser.decode) as Array<FromServerEncoded>,
|
|
@@ -948,7 +962,13 @@ export const makeProtocolHttp = (client: HttpClient.HttpClient): Effect.Effect<
|
|
|
948
962
|
let i = 0
|
|
949
963
|
return Effect.whileLoop({
|
|
950
964
|
while: () => i < responses.length,
|
|
951
|
-
body: () =>
|
|
965
|
+
body: () => {
|
|
966
|
+
const response = responses[i++]
|
|
967
|
+
if (isTerminalResponse(response)) {
|
|
968
|
+
completed = true
|
|
969
|
+
}
|
|
970
|
+
return writeResponse(clientId, response)
|
|
971
|
+
},
|
|
952
972
|
step: constVoid
|
|
953
973
|
})
|
|
954
974
|
})
|
|
@@ -957,6 +977,8 @@ export const makeProtocolHttp = (client: HttpClient.HttpClient): Effect.Effect<
|
|
|
957
977
|
)
|
|
958
978
|
if (!hasResponse) {
|
|
959
979
|
return yield* emptyResponseError(request)
|
|
980
|
+
} else if (!completed) {
|
|
981
|
+
return yield* incompleteResponseError(request)
|
|
960
982
|
}
|
|
961
983
|
})
|
|
962
984
|
|
|
@@ -400,3 +400,22 @@ export interface Pong {
|
|
|
400
400
|
* @since 4.0.0
|
|
401
401
|
*/
|
|
402
402
|
export const constPong: Pong = { _tag: "Pong" }
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Checks if the response type is terminal.
|
|
406
|
+
*
|
|
407
|
+
* @category guards
|
|
408
|
+
* @since 4.0.0
|
|
409
|
+
*/
|
|
410
|
+
export const isTerminalResponse = (response: FromServerEncoded): boolean => {
|
|
411
|
+
switch (response._tag) {
|
|
412
|
+
case "Exit":
|
|
413
|
+
case "Defect":
|
|
414
|
+
case "ClientProtocolError": {
|
|
415
|
+
return true
|
|
416
|
+
}
|
|
417
|
+
default: {
|
|
418
|
+
return false
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
@@ -142,7 +142,7 @@ export interface ServiceClass<
|
|
|
142
142
|
Self,
|
|
143
143
|
Name extends string,
|
|
144
144
|
Provides,
|
|
145
|
-
E extends Schema.
|
|
145
|
+
E extends Schema.Constraint,
|
|
146
146
|
ClientError,
|
|
147
147
|
Requires,
|
|
148
148
|
RequiredForClient extends boolean
|
|
@@ -193,7 +193,7 @@ export type ApplyServices<A, R> = Exclude<R, Provides<A>> | Requires<A>
|
|
|
193
193
|
* @since 4.0.0
|
|
194
194
|
*/
|
|
195
195
|
export type ErrorSchema<A> = A extends { readonly [TypeId]: { readonly error: infer E } }
|
|
196
|
-
? E extends Schema.
|
|
196
|
+
? E extends Schema.Constraint ? E : never
|
|
197
197
|
: never
|
|
198
198
|
|
|
199
199
|
/**
|
|
@@ -26,12 +26,12 @@ const StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema"
|
|
|
26
26
|
* @category streams
|
|
27
27
|
* @since 4.0.0
|
|
28
28
|
*/
|
|
29
|
-
export function isStreamSchema(schema: Schema.
|
|
29
|
+
export function isStreamSchema(schema: Schema.Constraint): schema is Stream<Schema.Top, Schema.Top> {
|
|
30
30
|
return Predicate.hasProperty(schema, StreamSchemaTypeId)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** @internal */
|
|
34
|
-
export function getStreamSchemas(schema: Schema.
|
|
34
|
+
export function getStreamSchemas(schema: Schema.Constraint): Option.Option<{
|
|
35
35
|
readonly success: Schema.Top
|
|
36
36
|
readonly error: Schema.Top
|
|
37
37
|
}> {
|
|
@@ -50,17 +50,20 @@ export function getStreamSchemas(schema: Schema.Top): Option.Option<{
|
|
|
50
50
|
* @category streams
|
|
51
51
|
* @since 4.0.0
|
|
52
52
|
*/
|
|
53
|
-
export interface Stream<A extends Schema.
|
|
54
|
-
Schema.
|
|
55
|
-
Stream_.Stream<A["Type"], E["Type"]>,
|
|
56
|
-
Stream_.Stream<A["Encoded"], E["Encoded"]>,
|
|
57
|
-
A["DecodingServices"] | E["DecodingServices"],
|
|
58
|
-
A["EncodingServices"] | E["EncodingServices"],
|
|
53
|
+
export interface Stream<A extends Schema.Constraint, E extends Schema.Constraint> extends
|
|
54
|
+
Schema.BottomLazy<
|
|
59
55
|
SchemaAST.Declaration,
|
|
60
56
|
Stream<A, E>
|
|
61
57
|
>
|
|
62
58
|
{
|
|
59
|
+
readonly "Type": Stream_.Stream<A["Type"], E["Type"]>
|
|
60
|
+
readonly "Encoded": Stream_.Stream<A["Encoded"], E["Encoded"]>
|
|
61
|
+
readonly "DecodingServices": A["DecodingServices"] | E["DecodingServices"]
|
|
62
|
+
readonly "EncodingServices": A["EncodingServices"] | E["EncodingServices"]
|
|
63
63
|
readonly "Rebuild": Stream<A, E>
|
|
64
|
+
readonly "~type.make.in": Stream_.Stream<A["Type"], E["Type"]>
|
|
65
|
+
readonly "~type.make": Stream_.Stream<A["Type"], E["Type"]>
|
|
66
|
+
readonly "Iso": Stream_.Stream<A["Type"], E["Type"]>
|
|
64
67
|
readonly [StreamSchemaTypeId]: typeof StreamSchemaTypeId
|
|
65
68
|
readonly success: A
|
|
66
69
|
readonly error: E
|
|
@@ -75,7 +78,7 @@ const schema = Schema.declare(Stream_.isStream)
|
|
|
75
78
|
* @category streams
|
|
76
79
|
* @since 4.0.0
|
|
77
80
|
*/
|
|
78
|
-
export function Stream<A extends Schema.
|
|
81
|
+
export function Stream<A extends Schema.Constraint, E extends Schema.Constraint>(success: A, error: E): Stream<A, E> {
|
|
79
82
|
return Schema.make(schema.ast, { [StreamSchemaTypeId]: StreamSchemaTypeId, success, error })
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -64,7 +64,7 @@ const ProtocolTag = Context.Service<Protocol, Protocol["Service"]>(
|
|
|
64
64
|
* @category initial message
|
|
65
65
|
* @since 4.0.0
|
|
66
66
|
*/
|
|
67
|
-
export const makeInitialMessage = <S extends Schema.
|
|
67
|
+
export const makeInitialMessage = <S extends Schema.Constraint, E, R2>(
|
|
68
68
|
schema: S,
|
|
69
69
|
effect: Effect.Effect<S["Type"], E, R2>
|
|
70
70
|
): Effect.Effect<
|
|
@@ -89,7 +89,7 @@ export const makeInitialMessage = <S extends Schema.Top, E, R2>(
|
|
|
89
89
|
* @category initial message
|
|
90
90
|
* @since 4.0.0
|
|
91
91
|
*/
|
|
92
|
-
export const layerInitialMessage = <S extends Schema.
|
|
92
|
+
export const layerInitialMessage = <S extends Schema.Constraint, R2>(
|
|
93
93
|
schema: S,
|
|
94
94
|
build: Effect.Effect<S["Type"], never, R2>
|
|
95
95
|
): Layer.Layer<InitialMessage, never, S["EncodingServices"] | R2> =>
|
|
@@ -108,7 +108,7 @@ export const layerInitialMessage = <S extends Schema.Top, R2>(
|
|
|
108
108
|
* @category initial message
|
|
109
109
|
* @since 4.0.0
|
|
110
110
|
*/
|
|
111
|
-
export const initialMessage = <S extends Schema.
|
|
111
|
+
export const initialMessage = <S extends Schema.Constraint>(
|
|
112
112
|
schema: S
|
|
113
113
|
): Effect.Effect<S["Type"], NoSuchElementError | Schema.SchemaError, Protocol | S["DecodingServices"]> =>
|
|
114
114
|
ProtocolTag.pipe(
|
|
@@ -298,7 +298,7 @@ export const Sensitive = <S extends Schema.Top>(schema: S): Sensitive<S> =>
|
|
|
298
298
|
* @category optional
|
|
299
299
|
* @since 4.0.0
|
|
300
300
|
*/
|
|
301
|
-
export interface optionalOption<S extends Schema.
|
|
301
|
+
export interface optionalOption<S extends Schema.Constraint>
|
|
302
302
|
extends Schema.decodeTo<Schema.Option<Schema.toType<S>>, Schema.optionalKey<Schema.NullOr<S>>>
|
|
303
303
|
{}
|
|
304
304
|
|
|
@@ -309,7 +309,7 @@ export interface optionalOption<S extends Schema.Top>
|
|
|
309
309
|
* @category optional
|
|
310
310
|
* @since 4.0.0
|
|
311
311
|
*/
|
|
312
|
-
export const optionalOption = <S extends Schema.
|
|
312
|
+
export const optionalOption = <S extends Schema.Constraint>(schema: S): optionalOption<S> =>
|
|
313
313
|
Schema.optionalKey(Schema.NullOr(schema)).pipe(
|
|
314
314
|
Schema.decodeTo(
|
|
315
315
|
Schema.Option(Schema.toType(schema)),
|
|
@@ -262,17 +262,10 @@ export interface Class<
|
|
|
262
262
|
readonly fields: Schema.Struct.Fields
|
|
263
263
|
}
|
|
264
264
|
> extends
|
|
265
|
-
Schema.
|
|
266
|
-
Self,
|
|
267
|
-
S["Encoded"],
|
|
268
|
-
S["DecodingServices"],
|
|
269
|
-
S["EncodingServices"],
|
|
265
|
+
Schema.BottomLazy<
|
|
270
266
|
SchemaAST.Declaration,
|
|
271
267
|
Schema.decodeTo<Schema.declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>,
|
|
272
|
-
S["~type.make.in"],
|
|
273
|
-
S["Iso"],
|
|
274
268
|
readonly [S],
|
|
275
|
-
Self,
|
|
276
269
|
S["~type.mutability"],
|
|
277
270
|
S["~type.optionality"],
|
|
278
271
|
S["~type.constructor.default"],
|
|
@@ -281,6 +274,14 @@ export interface Class<
|
|
|
281
274
|
>,
|
|
282
275
|
Struct<Struct_.Simplify<Fields>>
|
|
283
276
|
{
|
|
277
|
+
readonly "Type": Self
|
|
278
|
+
readonly "Encoded": S["Encoded"]
|
|
279
|
+
readonly "DecodingServices": S["DecodingServices"]
|
|
280
|
+
readonly "EncodingServices": S["EncodingServices"]
|
|
281
|
+
readonly "~type.make.in": S["~type.make.in"]
|
|
282
|
+
readonly "~type.make": Self
|
|
283
|
+
readonly "Iso": S["Iso"]
|
|
284
|
+
|
|
284
285
|
new(
|
|
285
286
|
props: S["~type.make.in"],
|
|
286
287
|
options?: {
|
|
@@ -528,24 +529,25 @@ export const Override = <A>(value: A): A & Brand<"Override"> => value as any
|
|
|
528
529
|
* @since 4.0.0
|
|
529
530
|
*/
|
|
530
531
|
export interface Overrideable<S extends Schema.Top & Schema.WithoutConstructorDefault> extends
|
|
531
|
-
Schema.
|
|
532
|
-
S["Type"] & Brand<"Override">,
|
|
533
|
-
S["Encoded"],
|
|
534
|
-
S["DecodingServices"],
|
|
535
|
-
S["EncodingServices"],
|
|
532
|
+
Schema.BottomLazy<
|
|
536
533
|
S["ast"],
|
|
537
534
|
Overrideable<S>,
|
|
538
|
-
S["~type.make.in"],
|
|
539
|
-
(S["Type"] & Brand<"Override">) | undefined,
|
|
540
535
|
S["~type.parameters"],
|
|
541
|
-
(S["Type"] & Brand<"Override">) | undefined,
|
|
542
536
|
S["~type.mutability"],
|
|
543
537
|
"required",
|
|
544
538
|
"with-default",
|
|
545
539
|
S["~encoded.mutability"],
|
|
546
540
|
S["~encoded.optionality"]
|
|
547
541
|
>
|
|
548
|
-
{
|
|
542
|
+
{
|
|
543
|
+
readonly "Type": S["Type"] & Brand<"Override">
|
|
544
|
+
readonly "Encoded": S["Encoded"]
|
|
545
|
+
readonly "DecodingServices": S["DecodingServices"]
|
|
546
|
+
readonly "EncodingServices": S["EncodingServices"]
|
|
547
|
+
readonly "~type.make.in": S["~type.make.in"]
|
|
548
|
+
readonly "~type.make": (S["Type"] & Brand<"Override">) | undefined
|
|
549
|
+
readonly "Iso": (S["Type"] & Brand<"Override">) | undefined
|
|
550
|
+
}
|
|
549
551
|
|
|
550
552
|
/**
|
|
551
553
|
* Wraps a schema with an effectful constructor default while allowing explicit
|
|
@@ -50,6 +50,11 @@ export interface Connection {
|
|
|
50
50
|
params: ReadonlyArray<unknown>
|
|
51
51
|
) => Effect<ReadonlyArray<ReadonlyArray<unknown>>, SqlError>
|
|
52
52
|
|
|
53
|
+
readonly executeValuesUnprepared: (
|
|
54
|
+
sql: string,
|
|
55
|
+
params: ReadonlyArray<unknown>
|
|
56
|
+
) => Effect<ReadonlyArray<ReadonlyArray<unknown>>, SqlError>
|
|
57
|
+
|
|
53
58
|
readonly executeUnprepared: (
|
|
54
59
|
sql: string,
|
|
55
60
|
params: ReadonlyArray<unknown>,
|
|
@@ -77,7 +77,7 @@ export const makeRepository = <
|
|
|
77
77
|
> =>
|
|
78
78
|
Effect.gen(function*() {
|
|
79
79
|
const sql = yield* SqlClient
|
|
80
|
-
const idSchema = Model.fields[options.idColumn]
|
|
80
|
+
const idSchema = Model.fields[options.idColumn]
|
|
81
81
|
const idColumn = options.idColumn as string
|
|
82
82
|
const softDeleteColumn = options.softDeleteColumn as string | undefined
|
|
83
83
|
const withSoftDeleteFilter = (where: any) =>
|
|
@@ -274,7 +274,7 @@ export const makeResolvers = <
|
|
|
274
274
|
> =>
|
|
275
275
|
Effect.gen(function*() {
|
|
276
276
|
const sql = yield* SqlClient
|
|
277
|
-
const idSchema = Model.fields[options.idColumn]
|
|
277
|
+
const idSchema = Model.fields[options.idColumn]
|
|
278
278
|
const idColumn = options.idColumn as string
|
|
279
279
|
const softDeleteColumn = options.softDeleteColumn as string | undefined
|
|
280
280
|
const withSoftDeleteFilter = (where: any) =>
|
|
@@ -110,7 +110,7 @@ export const SqlRequest = <In, A, E, R>(payload: In): SqlRequest<In, A, E, R> =>
|
|
|
110
110
|
* @category resolvers
|
|
111
111
|
* @since 4.0.0
|
|
112
112
|
*/
|
|
113
|
-
export const ordered = <Req extends Schema.
|
|
113
|
+
export const ordered = <Req extends Schema.Constraint, Res extends Schema.Constraint, _, E, R>(
|
|
114
114
|
options: {
|
|
115
115
|
readonly Request: Req
|
|
116
116
|
readonly Result: Res
|
|
@@ -158,7 +158,7 @@ export const ordered = <Req extends Schema.Top, Res extends Schema.Top, _, E, R>
|
|
|
158
158
|
* @category resolvers
|
|
159
159
|
* @since 4.0.0
|
|
160
160
|
*/
|
|
161
|
-
export const grouped = <Req extends Schema.
|
|
161
|
+
export const grouped = <Req extends Schema.Constraint, Res extends Schema.Constraint, K, Row, E, R>(
|
|
162
162
|
options: {
|
|
163
163
|
readonly Request: Req
|
|
164
164
|
readonly RequestGroupKey: (request: Req["Type"]) => K
|
|
@@ -227,7 +227,7 @@ export const grouped = <Req extends Schema.Top, Res extends Schema.Top, K, Row,
|
|
|
227
227
|
* @category resolvers
|
|
228
228
|
* @since 4.0.0
|
|
229
229
|
*/
|
|
230
|
-
export const findById = <Id extends Schema.
|
|
230
|
+
export const findById = <Id extends Schema.Constraint, Res extends Schema.Constraint, Row, E, R>(
|
|
231
231
|
options: {
|
|
232
232
|
readonly Id: Id
|
|
233
233
|
readonly Result: Res
|
|
@@ -284,7 +284,7 @@ export const findById = <Id extends Schema.Top, Res extends Schema.Top, Row, E,
|
|
|
284
284
|
})
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
const void_ = <Req extends Schema.
|
|
287
|
+
const void_ = <Req extends Schema.Constraint, _, E, R>(
|
|
288
288
|
options: {
|
|
289
289
|
readonly Request: Req
|
|
290
290
|
readonly execute: (
|
|
@@ -334,7 +334,7 @@ const constNoSuchElement = Exit.fail(new Cause.NoSuchElementError())
|
|
|
334
334
|
|
|
335
335
|
const partitionRequests = function*<In, A, E, R, InE>(
|
|
336
336
|
requests: Arr.NonEmptyArray<Request.Entry<SqlRequest<In, A, E, R>>>,
|
|
337
|
-
schema: Schema.
|
|
337
|
+
schema: Schema.ConstraintCodec<In, InE, R, R>
|
|
338
338
|
) {
|
|
339
339
|
const len = requests.length
|
|
340
340
|
const inputs = Arr.empty<InE>()
|
|
@@ -359,7 +359,7 @@ const partitionRequests = function*<In, A, E, R, InE>(
|
|
|
359
359
|
|
|
360
360
|
const partitionRequestsById = function*<In, A, E, R, InE>(
|
|
361
361
|
requests: ReadonlyArray<Request.Entry<SqlRequest<In, A, E, R>>>,
|
|
362
|
-
schema: Schema.
|
|
362
|
+
schema: Schema.ConstraintCodec<In, InE, R, R>
|
|
363
363
|
) {
|
|
364
364
|
const len = requests.length
|
|
365
365
|
const inputs = Arr.empty<InE>()
|
|
@@ -30,7 +30,7 @@ import * as Schema from "../../Schema.ts"
|
|
|
30
30
|
* @category constructors
|
|
31
31
|
* @since 4.0.0
|
|
32
32
|
*/
|
|
33
|
-
export const findAll = <Req extends Schema.
|
|
33
|
+
export const findAll = <Req extends Schema.Constraint, Res extends Schema.Constraint, E, R>(
|
|
34
34
|
options: {
|
|
35
35
|
readonly Request: Req
|
|
36
36
|
readonly Result: Res
|
|
@@ -62,7 +62,7 @@ export const findAll = <Req extends Schema.Top, Res extends Schema.Top, E, R>(
|
|
|
62
62
|
* @category constructors
|
|
63
63
|
* @since 4.0.0
|
|
64
64
|
*/
|
|
65
|
-
export const findNonEmpty = <Req extends Schema.
|
|
65
|
+
export const findNonEmpty = <Req extends Schema.Constraint, Res extends Schema.Constraint, E, R>(
|
|
66
66
|
options: {
|
|
67
67
|
readonly Request: Req
|
|
68
68
|
readonly Result: Res
|
|
@@ -83,7 +83,7 @@ export const findNonEmpty = <Req extends Schema.Top, Res extends Schema.Top, E,
|
|
|
83
83
|
: Effect.fail(new Cause.NoSuchElementError()))
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const void_ = <Req extends Schema.
|
|
86
|
+
const void_ = <Req extends Schema.Constraint, E, R>(
|
|
87
87
|
options: {
|
|
88
88
|
readonly Request: Req
|
|
89
89
|
readonly execute: (request: Req["Encoded"]) => Effect.Effect<unknown, E, R>
|
|
@@ -112,7 +112,7 @@ export {
|
|
|
112
112
|
* @category constructors
|
|
113
113
|
* @since 4.0.0
|
|
114
114
|
*/
|
|
115
|
-
export const findOne = <Req extends Schema.
|
|
115
|
+
export const findOne = <Req extends Schema.Constraint, Res extends Schema.Constraint, E, R>(
|
|
116
116
|
options: {
|
|
117
117
|
readonly Request: Req
|
|
118
118
|
readonly Result: Res
|
|
@@ -145,7 +145,7 @@ export const findOne = <Req extends Schema.Top, Res extends Schema.Top, E, R>(
|
|
|
145
145
|
* @category constructors
|
|
146
146
|
* @since 4.0.0
|
|
147
147
|
*/
|
|
148
|
-
export const findOneOption = <Req extends Schema.
|
|
148
|
+
export const findOneOption = <Req extends Schema.Constraint, Res extends Schema.Constraint, E, R>(
|
|
149
149
|
options: {
|
|
150
150
|
readonly Request: Req
|
|
151
151
|
readonly Result: Res
|
|
@@ -72,6 +72,7 @@ export interface Statement<A> extends Fragment, Effect.Effect<ReadonlyArray<A>,
|
|
|
72
72
|
readonly withoutTransform: Effect.Effect<ReadonlyArray<A>, SqlError>
|
|
73
73
|
readonly stream: Stream.Stream<A, SqlError>
|
|
74
74
|
readonly values: Effect.Effect<ReadonlyArray<ReadonlyArray<unknown>>, SqlError>
|
|
75
|
+
readonly valuesUnprepared: Effect.Effect<ReadonlyArray<ReadonlyArray<unknown>>, SqlError>
|
|
75
76
|
readonly unprepared: Effect.Effect<ReadonlyArray<A>, SqlError>
|
|
76
77
|
readonly compile: (withoutTransform?: boolean | undefined) => readonly [
|
|
77
78
|
sql: string,
|
|
@@ -1368,6 +1369,16 @@ const StatementProto: Omit<
|
|
|
1368
1369
|
return this.withConnection("executeValues", (connection, sql, params) => connection.executeValues(sql, params))
|
|
1369
1370
|
},
|
|
1370
1371
|
|
|
1372
|
+
get valuesUnprepared(): Effect.Effect<
|
|
1373
|
+
ReadonlyArray<ReadonlyArray<unknown>>,
|
|
1374
|
+
SqlError
|
|
1375
|
+
> {
|
|
1376
|
+
return this.withConnection(
|
|
1377
|
+
"executeValuesUnprepared",
|
|
1378
|
+
(connection, sql, params) => connection.executeValuesUnprepared(sql, params)
|
|
1379
|
+
)
|
|
1380
|
+
},
|
|
1381
|
+
|
|
1371
1382
|
get unprepared(): Effect.Effect<ReadonlyArray<any>, SqlError> {
|
|
1372
1383
|
const self = this as StatementImpl<any>
|
|
1373
1384
|
return self.withConnection(
|
|
@@ -34,8 +34,8 @@ const TypeId = "~effect/workflow/Activity"
|
|
|
34
34
|
* @since 4.0.0
|
|
35
35
|
*/
|
|
36
36
|
export interface Activity<
|
|
37
|
-
Success extends Schema.
|
|
38
|
-
Error extends Schema.
|
|
37
|
+
Success extends Schema.Constraint = Schema.Void,
|
|
38
|
+
Error extends Schema.Constraint = Schema.Never,
|
|
39
39
|
R = never
|
|
40
40
|
> extends
|
|
41
41
|
Effect.Effect<
|
|
@@ -122,8 +122,8 @@ export interface AnyWithProps {
|
|
|
122
122
|
*/
|
|
123
123
|
export const make = <
|
|
124
124
|
R,
|
|
125
|
-
Success extends Schema.
|
|
126
|
-
Error extends Schema.
|
|
125
|
+
Success extends Schema.Constraint = Schema.Void,
|
|
126
|
+
Error extends Schema.Constraint = Schema.Never
|
|
127
127
|
>(options: {
|
|
128
128
|
readonly name: string
|
|
129
129
|
readonly success?: Success | undefined
|
|
@@ -312,8 +312,8 @@ const InstanceTag = Context.Service<WorkflowInstance, WorkflowInstance["Service"
|
|
|
312
312
|
|
|
313
313
|
const makeExecute = Effect.fnUntraced(function*<
|
|
314
314
|
R,
|
|
315
|
-
Success extends Schema.
|
|
316
|
-
Error extends Schema.
|
|
315
|
+
Success extends Schema.Constraint = typeof Schema.Void,
|
|
316
|
+
Error extends Schema.Constraint = typeof Schema.Never
|
|
317
317
|
>(activity: Activity<Success, Error, R>) {
|
|
318
318
|
const engine = yield* EngineTag
|
|
319
319
|
const instance = yield* InstanceTag
|