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.
Files changed (162) hide show
  1. package/dist/Cause.d.ts +3 -1
  2. package/dist/Cause.d.ts.map +1 -1
  3. package/dist/Cause.js.map +1 -1
  4. package/dist/Config.d.ts +1 -1
  5. package/dist/Config.d.ts.map +1 -1
  6. package/dist/Config.js.map +1 -1
  7. package/dist/Effect.d.ts +130 -0
  8. package/dist/Effect.d.ts.map +1 -1
  9. package/dist/Effect.js +43 -0
  10. package/dist/Effect.js.map +1 -1
  11. package/dist/FileSystem.d.ts +7 -0
  12. package/dist/FileSystem.d.ts.map +1 -1
  13. package/dist/FileSystem.js +3 -0
  14. package/dist/FileSystem.js.map +1 -1
  15. package/dist/Layer.d.ts +1 -1
  16. package/dist/Layer.d.ts.map +1 -1
  17. package/dist/Layer.js +6 -3
  18. package/dist/Layer.js.map +1 -1
  19. package/dist/LayerMap.js +1 -1
  20. package/dist/LayerMap.js.map +1 -1
  21. package/dist/LayerRef.d.ts +252 -0
  22. package/dist/LayerRef.d.ts.map +1 -0
  23. package/dist/LayerRef.js +171 -0
  24. package/dist/LayerRef.js.map +1 -0
  25. package/dist/Schema.d.ts +74 -30
  26. package/dist/Schema.d.ts.map +1 -1
  27. package/dist/Schema.js +3 -0
  28. package/dist/Schema.js.map +1 -1
  29. package/dist/SchemaParser.d.ts +1 -1
  30. package/dist/SchemaParser.d.ts.map +1 -1
  31. package/dist/SchemaParser.js.map +1 -1
  32. package/dist/internal/core.js +1 -1
  33. package/dist/internal/effect.js +10 -6
  34. package/dist/internal/effect.js.map +1 -1
  35. package/dist/testing/TestSchema.d.ts +2 -2
  36. package/dist/testing/TestSchema.d.ts.map +1 -1
  37. package/dist/testing/TestSchema.js.map +1 -1
  38. package/dist/unstable/ai/Chat.d.ts +1 -1
  39. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  40. package/dist/unstable/ai/LanguageModel.d.ts +2 -2
  41. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  42. package/dist/unstable/cli/Argument.d.ts +2 -2
  43. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  44. package/dist/unstable/cli/Argument.js.map +1 -1
  45. package/dist/unstable/cli/Flag.d.ts +2 -2
  46. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  47. package/dist/unstable/cli/Flag.js.map +1 -1
  48. package/dist/unstable/cli/Param.d.ts +2 -2
  49. package/dist/unstable/cli/Param.d.ts.map +1 -1
  50. package/dist/unstable/cli/Param.js.map +1 -1
  51. package/dist/unstable/cli/Primitive.js.map +1 -1
  52. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  53. package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -0
  54. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  55. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  56. package/dist/unstable/cluster/Entity.js +5 -3
  57. package/dist/unstable/cluster/Entity.js.map +1 -1
  58. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  59. package/dist/unstable/cluster/Sharding.js +3 -1
  60. package/dist/unstable/cluster/Sharding.js.map +1 -1
  61. package/dist/unstable/cluster/internal/entityManager.js +3 -2
  62. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  63. package/dist/unstable/cluster/internal/resourceMap.js +39 -14
  64. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  65. package/dist/unstable/encoding/Sse.d.ts +2 -2
  66. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  67. package/dist/unstable/http/HttpBody.d.ts +1 -1
  68. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  69. package/dist/unstable/http/HttpBody.js +1 -1
  70. package/dist/unstable/http/HttpBody.js.map +1 -1
  71. package/dist/unstable/http/HttpClient.js +2 -2
  72. package/dist/unstable/http/HttpClient.js.map +1 -1
  73. package/dist/unstable/http/HttpClientRequest.d.ts +5 -4
  74. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  75. package/dist/unstable/http/HttpClientRequest.js +5 -4
  76. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  77. package/dist/unstable/http/HttpClientResponse.d.ts +1 -1
  78. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  79. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  80. package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -2
  81. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  82. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  83. package/dist/unstable/http/HttpRouter.d.ts +4 -4
  84. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  85. package/dist/unstable/http/HttpRouter.js.map +1 -1
  86. package/dist/unstable/http/HttpServerRequest.d.ts +8 -8
  87. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  88. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  89. package/dist/unstable/http/HttpServerResponse.d.ts +1 -1
  90. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  91. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  92. package/dist/unstable/http/Multipart.d.ts +2 -2
  93. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  94. package/dist/unstable/http/Multipart.js.map +1 -1
  95. package/dist/unstable/http/Url.d.ts +29 -4
  96. package/dist/unstable/http/Url.d.ts.map +1 -1
  97. package/dist/unstable/http/Url.js +44 -2
  98. package/dist/unstable/http/Url.js.map +1 -1
  99. package/dist/unstable/http/UrlParams.d.ts +2 -28
  100. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  101. package/dist/unstable/http/UrlParams.js +4 -46
  102. package/dist/unstable/http/UrlParams.js.map +1 -1
  103. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  104. package/dist/unstable/httpapi/HttpApi.js +2 -4
  105. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  106. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  107. package/dist/unstable/httpapi/HttpApiBuilder.js +30 -15
  108. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  109. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  110. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +7 -7
  111. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  112. package/dist/unstable/httpapi/HttpApiSchema.d.ts +1 -1
  113. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  114. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  115. package/dist/unstable/observability/OtlpTracer.js +4 -3
  116. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  117. package/dist/unstable/reactivity/Atom.d.ts +4 -4
  118. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  119. package/dist/unstable/reactivity/Atom.js.map +1 -1
  120. package/package.json +1 -1
  121. package/src/Cause.ts +3 -1
  122. package/src/Config.ts +1 -1
  123. package/src/Effect.ts +131 -0
  124. package/src/FileSystem.ts +13 -0
  125. package/src/Layer.ts +6 -6
  126. package/src/LayerMap.ts +1 -1
  127. package/src/LayerRef.ts +379 -0
  128. package/src/Schema.ts +83 -33
  129. package/src/SchemaParser.ts +2 -2
  130. package/src/internal/core.ts +1 -1
  131. package/src/internal/effect.ts +33 -6
  132. package/src/testing/TestSchema.ts +2 -2
  133. package/src/unstable/ai/Chat.ts +1 -1
  134. package/src/unstable/ai/LanguageModel.ts +3 -3
  135. package/src/unstable/cli/Argument.ts +14 -7
  136. package/src/unstable/cli/Flag.ts +6 -3
  137. package/src/unstable/cli/Param.ts +6 -3
  138. package/src/unstable/cli/Primitive.ts +2 -2
  139. package/src/unstable/cluster/ClusterWorkflowEngine.ts +1 -0
  140. package/src/unstable/cluster/Entity.ts +13 -14
  141. package/src/unstable/cluster/Sharding.ts +134 -131
  142. package/src/unstable/cluster/internal/entityManager.ts +11 -9
  143. package/src/unstable/cluster/internal/resourceMap.ts +59 -25
  144. package/src/unstable/encoding/Sse.ts +3 -3
  145. package/src/unstable/http/HttpBody.ts +2 -2
  146. package/src/unstable/http/HttpClient.ts +2 -2
  147. package/src/unstable/http/HttpClientRequest.ts +8 -7
  148. package/src/unstable/http/HttpClientResponse.ts +2 -3
  149. package/src/unstable/http/HttpIncomingMessage.ts +4 -5
  150. package/src/unstable/http/HttpRouter.ts +8 -10
  151. package/src/unstable/http/HttpServerRequest.ts +20 -19
  152. package/src/unstable/http/HttpServerResponse.ts +2 -2
  153. package/src/unstable/http/Multipart.ts +3 -3
  154. package/src/unstable/http/Url.ts +62 -7
  155. package/src/unstable/http/UrlParams.ts +5 -58
  156. package/src/unstable/httpapi/HttpApi.ts +2 -4
  157. package/src/unstable/httpapi/HttpApiBuilder.ts +33 -21
  158. package/src/unstable/httpapi/HttpApiClient.ts +2 -2
  159. package/src/unstable/httpapi/HttpApiEndpoint.ts +7 -7
  160. package/src/unstable/httpapi/HttpApiSchema.ts +1 -1
  161. package/src/unstable/observability/OtlpTracer.ts +4 -3
  162. 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
- const json = Effect.orDie(Effect.flatMap(httpRequest.text, (text) => {
607
+ return Effect.flatMap(Effect.orDie(httpRequest.text), (text) => {
607
608
  if (text === "") {
608
- return existing.nullOnEmpty ? Effect.succeed(null) : Effect.undefined
609
+ return decode(existing.nullOnEmpty ? null : undefined)
609
610
  }
610
- return Effect.succeed(JSON.parse(text))
611
- }))
612
- return Effect.flatMap(json, decode)
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 : expectedStreamResponse(response)
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 : expectedStreamResponse(response)
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.Codec<unknown, unknown>)
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.Codec<unknown, unknown>)
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.Codec<unknown, string | undefined, unknown, unknown>>
1041
- | Schema.Codec<unknown, Record<string, string | undefined>, unknown, unknown>
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.Codec<unknown, string | undefined, unknown, unknown>>
1052
- | Schema.Codec<unknown, Record<string, string | undefined>, unknown, unknown>
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.Codec<unknown, string | ReadonlyArray<string> | undefined, unknown, unknown>>
1063
- | Schema.Codec<unknown, string | ReadonlyArray<string> | undefined, unknown, unknown>
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.Codec<unknown, string | ReadonlyArray<string> | undefined, unknown, unknown>
1078
+ Schema.Encoder<string | ReadonlyArray<string> | undefined, unknown>
1079
1079
  > :
1080
1080
  Schema.Top | ReadonlyArray<Schema.Top>
1081
1081
 
@@ -325,7 +325,7 @@ export interface StreamSse<
325
325
  * @since 4.0.0
326
326
  */
327
327
  export interface SseEventFromData<Data extends Schema.Constraint> extends
328
- Schema.Codec<
328
+ Schema.ConstraintCodec<
329
329
  {
330
330
  readonly id: string | undefined
331
331
  readonly event: string
@@ -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": renderPrettyError(error) ?? "No stack trace available"
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.Codec<any, any>, const Mode extends "sync" | "async" = never>(options: {
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.Codec<any, string> = never>(name: string, options?: {
2673
- readonly schema?: S | undefined
2674
- }): Writable<[S] extends [never] ? string : Option.Option<S["Type"]>> => {
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.Codec<Type<R>, any>>(
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.Codec<Type<R>, any>>(
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.Codec<A, I>
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)), {