MCPcopy Create free account
hub / github.com/anomalyco/opencode / streamEncodedDataSchema

Function streamEncodedDataSchema

packages/httpapi-codegen/src/index.ts:986–993  ·  view source on GitHub ↗
(schema: Extract<HttpApiSchema.StreamSchema, { readonly _tag: "StreamSse" }>)

Source from the content-addressed store, hash-verified

984}
985
986function streamEncodedDataSchema(schema: Extract<HttpApiSchema.StreamSchema, { readonly _tag: "StreamSse" }>) {
987 const data = streamDataAst(schema.events.ast)
988 const encodedAst = data.encoding?.at(-1)?.to
989 if (encodedAst === undefined) throw new GenerationError({ reason: "Invalid SSE data schema" })
990 const encoded = resolveContentSchema(encodedAst)
991 if (!SchemaAST.isAST(encoded)) throw new GenerationError({ reason: "Invalid SSE data schema" })
992 return Schema.make(encoded)
993}
994
995function streamDataAst(ast: SchemaAST.AST) {
996 if (!SchemaAST.isObjects(ast)) throw new GenerationError({ reason: "Invalid SSE data schema" })

Callers 1

renderPromiseTypesFunction · 0.85

Calls 3

streamDataAstFunction · 0.85
atMethod · 0.80
makeMethod · 0.45

Tested by

no test coverage detected