MCPcopy Create free account
hub / github.com/Effect-TS/effect / exitSchema

Function exitSchema

packages/effect/src/unstable/rpc/Rpc.ts:1123–1149  ·  view source on GitHub ↗
(
  self: R
)

Source from the content-addressed store, hash-verified

1121 * @since 4.0.0
1122 */
1123export const exitSchema = <R extends Any>(
1124 self: R
1125): Schema.Exit<
1126 SuccessExitSchema<R>,
1127 ErrorExitSchema<R>,
1128 DefectSchema
1129> => {
1130 if (exitSchemaCache.has(self)) {
1131 return exitSchemaCache.get(self) as any
1132 }
1133 const rpc = self as any as AnyWithProps
1134 const failures = new Set<Schema.Top>([rpc.errorSchema])
1135 const streamSchemas = RpcSchema.getStreamSchemas(rpc.successSchema)
1136 if (Option.isSome(streamSchemas)) {
1137 failures.add(streamSchemas.value.error)
1138 }
1139 for (const middleware of rpc.middlewares) {
1140 failures.add(middleware.error)
1141 }
1142 const schema = Schema.Exit(
1143 Option.isSome(streamSchemas) ? Schema.Void : rpc.successSchema,
1144 Schema.Union([...failures]),
1145 rpc.defectSchema
1146 )
1147 exitSchemaCache.set(self, schema as any)
1148 return schema as any
1149}
1150
1151const WrapperTypeId = "~effect/rpc/Rpc/Wrapper"
1152

Callers

nothing calls this directly

Calls 4

getMethod · 0.65
addMethod · 0.65
setMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected