MCPcopy
hub / github.com/Effect-TS/effect / StandardSchemaV1Class

Class StandardSchemaV1Class

packages/effect/src/Schema.ts:201–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199): StandardSchemaV1<I, A> & SchemaClass<A, I, never> => {
200 const decodeUnknown = ParseResult.decodeUnknown(schema, { errors: "all" })
201 return class StandardSchemaV1Class extends make<A, I, never>(schema.ast) {
202 static "~standard" = {
203 version: 1,
204 vendor: "effect",
205 validate(value) {
206 const scheduler = new scheduler_.SyncScheduler()
207 const fiber = Effect.runFork(
208 Effect.matchEffect(decodeUnknown(value, overrideOptions), {
209 onFailure: makeStandardFailureFromParseIssue,
210 onSuccess: (value) => Effect.succeed({ value })
211 }),
212 { scheduler }
213 )
214 scheduler.flush()
215 const exit = fiber.unsafePoll()
216 if (exit) {
217 return makeStandardResult(exit)
218 }
219 return new Promise((resolve) => {
220 fiber.addObserver((exit) => {
221 resolve(makeStandardResult(exit))
222 })
223 })
224 }
225 }
226 }
227}
228
229interface AllAnnotations<A, TypeParameters extends ReadonlyArray<any>>

Callers

nothing calls this directly

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…