effect 4.0.0-beta.92 → 4.0.0-beta.94
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 +3 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js.map +1 -1
- package/dist/Config.d.ts +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js.map +1 -1
- package/dist/Effect.d.ts +130 -0
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +43 -0
- package/dist/Effect.js.map +1 -1
- package/dist/FileSystem.d.ts +7 -0
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +3 -0
- package/dist/FileSystem.js.map +1 -1
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +6 -3
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.js +1 -1
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +252 -0
- package/dist/LayerRef.d.ts.map +1 -0
- package/dist/LayerRef.js +171 -0
- package/dist/LayerRef.js.map +1 -0
- package/dist/Schema.d.ts +74 -30
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +3 -0
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaParser.d.ts +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/effect.js +10 -6
- package/dist/internal/effect.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +2 -2
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.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 +2 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -0
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +5 -3
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -1
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +3 -2
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +39 -14
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +2 -2
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +1 -1
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.js +2 -2
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +5 -4
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +5 -4
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +4 -4
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +8 -8
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +2 -2
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +29 -4
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +44 -2
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +2 -28
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +4 -46
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +2 -4
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +30 -15
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +7 -7
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +4 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +4 -4
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/package.json +1 -1
- package/src/Cause.ts +3 -1
- package/src/Config.ts +1 -1
- package/src/Effect.ts +131 -0
- package/src/FileSystem.ts +13 -0
- package/src/Layer.ts +6 -6
- package/src/LayerMap.ts +1 -1
- package/src/LayerRef.ts +379 -0
- package/src/Schema.ts +83 -33
- package/src/SchemaParser.ts +2 -2
- package/src/internal/core.ts +1 -1
- package/src/internal/effect.ts +33 -6
- package/src/testing/TestSchema.ts +2 -2
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +3 -3
- package/src/unstable/cli/Argument.ts +14 -7
- package/src/unstable/cli/Flag.ts +6 -3
- package/src/unstable/cli/Param.ts +6 -3
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +1 -0
- package/src/unstable/cluster/Entity.ts +13 -14
- package/src/unstable/cluster/Sharding.ts +134 -131
- package/src/unstable/cluster/internal/entityManager.ts +11 -9
- package/src/unstable/cluster/internal/resourceMap.ts +59 -25
- package/src/unstable/encoding/Sse.ts +3 -3
- package/src/unstable/http/HttpBody.ts +2 -2
- package/src/unstable/http/HttpClient.ts +2 -2
- package/src/unstable/http/HttpClientRequest.ts +8 -7
- package/src/unstable/http/HttpClientResponse.ts +2 -3
- package/src/unstable/http/HttpIncomingMessage.ts +4 -5
- package/src/unstable/http/HttpRouter.ts +8 -10
- package/src/unstable/http/HttpServerRequest.ts +20 -19
- package/src/unstable/http/HttpServerResponse.ts +2 -2
- package/src/unstable/http/Multipart.ts +3 -3
- package/src/unstable/http/Url.ts +62 -7
- package/src/unstable/http/UrlParams.ts +5 -58
- package/src/unstable/httpapi/HttpApi.ts +2 -4
- package/src/unstable/httpapi/HttpApiBuilder.ts +33 -21
- package/src/unstable/httpapi/HttpApiClient.ts +2 -2
- package/src/unstable/httpapi/HttpApiEndpoint.ts +7 -7
- package/src/unstable/httpapi/HttpApiSchema.ts +1 -1
- package/src/unstable/observability/OtlpTracer.ts +4 -3
- package/src/unstable/reactivity/Atom.ts +10 -7
|
@@ -21,6 +21,7 @@ import * as Layer from "../../Layer.ts"
|
|
|
21
21
|
import * as Option from "../../Option.ts"
|
|
22
22
|
import type { Path } from "../../Path.ts"
|
|
23
23
|
import { type Pipeable, pipeArguments } from "../../Pipeable.ts"
|
|
24
|
+
import { hasProperty } from "../../Predicate.ts"
|
|
24
25
|
import * as Redacted from "../../Redacted.ts"
|
|
25
26
|
import * as Result from "../../Result.ts"
|
|
26
27
|
import * as Schema from "../../Schema.ts"
|
|
@@ -603,13 +604,20 @@ function decodePayload(
|
|
|
603
604
|
)
|
|
604
605
|
}
|
|
605
606
|
case "Json":
|
|
606
|
-
|
|
607
|
+
return Effect.flatMap(Effect.orDie(httpRequest.text), (text) => {
|
|
607
608
|
if (text === "") {
|
|
608
|
-
return existing.nullOnEmpty ?
|
|
609
|
+
return decode(existing.nullOnEmpty ? null : undefined)
|
|
609
610
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
611
|
+
try {
|
|
612
|
+
return decode(JSON.parse(text))
|
|
613
|
+
} catch (cause) {
|
|
614
|
+
return Effect.fail(
|
|
615
|
+
new Schema.SchemaError(
|
|
616
|
+
new SchemaIssue.InvalidValue(Option.some(text), { message: `Invalid JSON: ${cause}` })
|
|
617
|
+
)
|
|
618
|
+
)
|
|
619
|
+
}
|
|
620
|
+
})
|
|
613
621
|
case "Text":
|
|
614
622
|
return Effect.flatMap(Effect.orDie(httpRequest.text), decode)
|
|
615
623
|
case "FormUrlEncoded": {
|
|
@@ -766,6 +774,7 @@ const makeSecurityMiddleware = (
|
|
|
766
774
|
readonly group: HttpApiGroup.AnyWithProps
|
|
767
775
|
readonly endpoint: HttpApiEndpoint.AnyWithProps
|
|
768
776
|
}) {
|
|
777
|
+
handler = Effect.mapError(handler, (error) => new HandlerError(error))
|
|
769
778
|
let lastResult: Result.Result<any, any> | undefined
|
|
770
779
|
for (let i = 0; i < entries.length; i++) {
|
|
771
780
|
const { decode, middleware } = entries[i]
|
|
@@ -776,6 +785,9 @@ const makeSecurityMiddleware = (
|
|
|
776
785
|
group: options.group
|
|
777
786
|
})))
|
|
778
787
|
if (Result.isFailure(result)) {
|
|
788
|
+
if (isHandlerError(result.failure)) {
|
|
789
|
+
return yield* Effect.fail(result.failure.error)
|
|
790
|
+
}
|
|
779
791
|
lastResult = result
|
|
780
792
|
continue
|
|
781
793
|
}
|
|
@@ -788,6 +800,16 @@ const makeSecurityMiddleware = (
|
|
|
788
800
|
return middleware
|
|
789
801
|
}
|
|
790
802
|
|
|
803
|
+
const HandlerErrorTypeId = "~effect/httpapi/HttpApiBuilder/HandlerError" as const
|
|
804
|
+
class HandlerError {
|
|
805
|
+
readonly [HandlerErrorTypeId] = HandlerErrorTypeId
|
|
806
|
+
readonly error: unknown
|
|
807
|
+
constructor(error: unknown) {
|
|
808
|
+
this.error = error
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
const isHandlerError = (value: unknown): value is HandlerError => hasProperty(value, HandlerErrorTypeId)
|
|
812
|
+
|
|
791
813
|
const $HttpServerResponse = Schema.declare(Response.isHttpServerResponse)
|
|
792
814
|
|
|
793
815
|
type StreamEncoder = (response: unknown, context: Context.Context<never>) =>
|
|
@@ -807,7 +829,9 @@ function makeStreamEncoder(endpoint: HttpApiEndpoint.AnyWithProps): StreamEncode
|
|
|
807
829
|
if (HttpApiSchema.isStreamUint8Array(streamSchema)) {
|
|
808
830
|
return (response, context) => {
|
|
809
831
|
if (!Stream.isStream(response)) {
|
|
810
|
-
return hasBuffered ? undefined :
|
|
832
|
+
return hasBuffered ? undefined : new Schema.SchemaError(
|
|
833
|
+
new SchemaIssue.InvalidValue(Option.some(response), { message: "Expected a streaming response" })
|
|
834
|
+
)
|
|
811
835
|
}
|
|
812
836
|
|
|
813
837
|
return Effect.succeed(Response.stream(
|
|
@@ -824,7 +848,9 @@ function makeStreamEncoder(endpoint: HttpApiEndpoint.AnyWithProps): StreamEncode
|
|
|
824
848
|
|
|
825
849
|
return (response, context) => {
|
|
826
850
|
if (!Stream.isStream(response)) {
|
|
827
|
-
return hasBuffered ? undefined :
|
|
851
|
+
return hasBuffered ? undefined : new Schema.SchemaError(
|
|
852
|
+
new SchemaIssue.InvalidValue(Option.some(response), { message: "Expected a streaming response" })
|
|
853
|
+
)
|
|
828
854
|
}
|
|
829
855
|
|
|
830
856
|
return Effect.succeed(Response.stream(
|
|
@@ -852,16 +878,6 @@ function hasBufferedSuccess(endpoint: HttpApiEndpoint.AnyWithProps): boolean {
|
|
|
852
878
|
return endpoint.success.size === 0
|
|
853
879
|
}
|
|
854
880
|
|
|
855
|
-
function expectedStreamResponse(response: unknown) {
|
|
856
|
-
return Effect.fail(
|
|
857
|
-
makeSchemaError(
|
|
858
|
-
new SchemaIssue.InvalidValue(Option.some(response), {
|
|
859
|
-
message: "Expected a streaming response"
|
|
860
|
-
})
|
|
861
|
-
)
|
|
862
|
-
)
|
|
863
|
-
}
|
|
864
|
-
|
|
865
881
|
interface SseStreamEncoder {
|
|
866
882
|
readonly sseMode: HttpApiSchema.StreamSseMode
|
|
867
883
|
readonly encodeEvents: (
|
|
@@ -922,10 +938,6 @@ function renderSseEvent(event: Sse.EventEncoded) {
|
|
|
922
938
|
})
|
|
923
939
|
}
|
|
924
940
|
|
|
925
|
-
function makeSchemaError(issue: SchemaIssue.Issue): Schema.SchemaError {
|
|
926
|
-
return new Schema.SchemaError(issue)
|
|
927
|
-
}
|
|
928
|
-
|
|
929
941
|
const toResponseSuccessSchema = toResponseSchema(HttpApiSchema.getStatusSuccess)
|
|
930
942
|
const toResponseErrorSchema = toResponseSchema(HttpApiSchema.getStatusError)
|
|
931
943
|
|
|
@@ -636,10 +636,10 @@ export const urlBuilder = <Api extends HttpApi.Any>(api: Api, options?: {
|
|
|
636
636
|
const makeUrl = compilePath(endpoint.path)
|
|
637
637
|
const encodeParams = endpoint.params === undefined
|
|
638
638
|
? undefined
|
|
639
|
-
: Schema.encodeSync(endpoint.params as Schema.
|
|
639
|
+
: Schema.encodeSync(endpoint.params as unknown as Schema.ConstraintEncoder<unknown>)
|
|
640
640
|
const encodeQuery = endpoint.query === undefined
|
|
641
641
|
? undefined
|
|
642
|
-
: Schema.encodeSync(endpoint.query as Schema.
|
|
642
|
+
: Schema.encodeSync(endpoint.query as unknown as Schema.ConstraintEncoder<unknown>)
|
|
643
643
|
|
|
644
644
|
const endpointBuilder = (request?: {
|
|
645
645
|
readonly params?: unknown
|
|
@@ -1037,8 +1037,8 @@ function makeProto<
|
|
|
1037
1037
|
* @since 4.0.0
|
|
1038
1038
|
*/
|
|
1039
1039
|
export type ParamsConstraint =
|
|
1040
|
-
| Record<string, Schema.
|
|
1041
|
-
| Schema.
|
|
1040
|
+
| Record<string, Schema.Encoder<string | undefined, unknown>>
|
|
1041
|
+
| Schema.Encoder<Record<string, string | undefined>, unknown>
|
|
1042
1042
|
|
|
1043
1043
|
/**
|
|
1044
1044
|
* Constraint for header schemas: each header must encode to `string | undefined`,
|
|
@@ -1048,8 +1048,8 @@ export type ParamsConstraint =
|
|
|
1048
1048
|
* @since 4.0.0
|
|
1049
1049
|
*/
|
|
1050
1050
|
export type HeadersConstraint =
|
|
1051
|
-
| Record<string, Schema.
|
|
1052
|
-
| Schema.
|
|
1051
|
+
| Record<string, Schema.Encoder<string | undefined, unknown>>
|
|
1052
|
+
| Schema.Encoder<Record<string, string | undefined>, unknown>
|
|
1053
1053
|
|
|
1054
1054
|
/**
|
|
1055
1055
|
* Constraint for query schemas: each field must encode to `string`, an array of
|
|
@@ -1059,8 +1059,8 @@ export type HeadersConstraint =
|
|
|
1059
1059
|
* @since 4.0.0
|
|
1060
1060
|
*/
|
|
1061
1061
|
export type QueryConstraint =
|
|
1062
|
-
| Record<string, Schema.
|
|
1063
|
-
| Schema.
|
|
1062
|
+
| Record<string, Schema.Encoder<string | ReadonlyArray<string> | undefined, unknown>>
|
|
1063
|
+
| Schema.Encoder<string | ReadonlyArray<string> | undefined, unknown>
|
|
1064
1064
|
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Payload schema depends on the HTTP method:
|
|
@@ -1075,7 +1075,7 @@ export type QueryConstraint =
|
|
|
1075
1075
|
*/
|
|
1076
1076
|
export type PayloadConstraint<Method extends HttpMethod> = Method extends HttpMethod.NoBody ? Record<
|
|
1077
1077
|
string,
|
|
1078
|
-
Schema.
|
|
1078
|
+
Schema.Encoder<string | ReadonlyArray<string> | undefined, unknown>
|
|
1079
1079
|
> :
|
|
1080
1080
|
Schema.Top | ReadonlyArray<Schema.Top>
|
|
1081
1081
|
|
|
@@ -17,7 +17,6 @@ import * as Duration from "../../Duration.ts"
|
|
|
17
17
|
import * as Effect from "../../Effect.ts"
|
|
18
18
|
import type * as Exit from "../../Exit.ts"
|
|
19
19
|
import { flow } from "../../Function.ts"
|
|
20
|
-
import { renderPrettyError } from "../../internal/effect.ts"
|
|
21
20
|
import * as Layer from "../../Layer.ts"
|
|
22
21
|
import * as Option from "../../Option.ts"
|
|
23
22
|
import type * as Scope from "../../Scope.ts"
|
|
@@ -285,7 +284,9 @@ const makeOtlpSpan = (self: SpanImpl): OtlpSpan => {
|
|
|
285
284
|
value: { boolValue: true }
|
|
286
285
|
})
|
|
287
286
|
} else {
|
|
288
|
-
const errors = Cause.prettyErrors(status.exit.cause
|
|
287
|
+
const errors = Cause.prettyErrors(status.exit.cause, {
|
|
288
|
+
includeCauseInStack: true
|
|
289
|
+
})
|
|
289
290
|
otelStatus = {
|
|
290
291
|
code: StatusCode.Error
|
|
291
292
|
}
|
|
@@ -312,7 +313,7 @@ const makeOtlpSpan = (self: SpanImpl): OtlpSpan => {
|
|
|
312
313
|
{
|
|
313
314
|
"key": "exception.stacktrace",
|
|
314
315
|
"value": {
|
|
315
|
-
"stringValue":
|
|
316
|
+
"stringValue": error.stack ?? "No stack trace available"
|
|
316
317
|
}
|
|
317
318
|
}
|
|
318
319
|
]
|
|
@@ -2604,7 +2604,7 @@ export const refreshOnWindowFocus: <A extends Atom<any>>(self: A) => WithoutSeri
|
|
|
2604
2604
|
* @category KeyValueStore
|
|
2605
2605
|
* @since 4.0.0
|
|
2606
2606
|
*/
|
|
2607
|
-
export const kvs = <S extends Schema.
|
|
2607
|
+
export const kvs = <S extends Schema.ConstraintCodec<any, any>, const Mode extends "sync" | "async" = never>(options: {
|
|
2608
2608
|
readonly runtime: AtomRuntime<KeyValueStore.KeyValueStore, any>
|
|
2609
2609
|
readonly key: string
|
|
2610
2610
|
readonly schema: S
|
|
@@ -2669,9 +2669,12 @@ export const kvs = <S extends Schema.Codec<any, any>, const Mode extends "sync"
|
|
|
2669
2669
|
* @category search params
|
|
2670
2670
|
* @since 4.0.0
|
|
2671
2671
|
*/
|
|
2672
|
-
export const searchParam = <S extends Schema.
|
|
2673
|
-
|
|
2674
|
-
|
|
2672
|
+
export const searchParam = <S extends Schema.ConstraintCodec<any, string> = never>(
|
|
2673
|
+
name: string,
|
|
2674
|
+
options?: {
|
|
2675
|
+
readonly schema?: S | undefined
|
|
2676
|
+
}
|
|
2677
|
+
): Writable<[S] extends [never] ? string : Option.Option<S["Type"]>> => {
|
|
2675
2678
|
const decode = options?.schema && Schema.decodeExit(options.schema)
|
|
2676
2679
|
const encode = options?.schema && Schema.encodeExit(options.schema)
|
|
2677
2680
|
return writable(
|
|
@@ -2986,7 +2989,7 @@ export const serializable: {
|
|
|
2986
2989
|
* @category combinators
|
|
2987
2990
|
* @since 4.0.0
|
|
2988
2991
|
*/
|
|
2989
|
-
<R extends Atom<any>, S extends Schema.
|
|
2992
|
+
<R extends Atom<any>, S extends Schema.ConstraintCodec<Type<R>, any>>(
|
|
2990
2993
|
options: {
|
|
2991
2994
|
readonly key: string
|
|
2992
2995
|
readonly schema: S
|
|
@@ -3003,7 +3006,7 @@ export const serializable: {
|
|
|
3003
3006
|
* @category combinators
|
|
3004
3007
|
* @since 4.0.0
|
|
3005
3008
|
*/
|
|
3006
|
-
<R extends Atom<any>, S extends Schema.
|
|
3009
|
+
<R extends Atom<any>, S extends Schema.ConstraintCodec<Type<R>, any>>(
|
|
3007
3010
|
self: R,
|
|
3008
3011
|
options: {
|
|
3009
3012
|
readonly key: string
|
|
@@ -3012,7 +3015,7 @@ export const serializable: {
|
|
|
3012
3015
|
): R & Serializable<S>
|
|
3013
3016
|
} = dual(2, <R extends Atom<any>, A, I>(self: R, options: {
|
|
3014
3017
|
readonly key: string
|
|
3015
|
-
readonly schema: Schema.
|
|
3018
|
+
readonly schema: Schema.ConstraintCodec<A, I>
|
|
3016
3019
|
}): R & Serializable<any> => {
|
|
3017
3020
|
const codecJson = Schema.toCodecJson(options.schema)
|
|
3018
3021
|
return Object.assign(Object.create(Object.getPrototypeOf(self)), {
|