MCPcopy Index your code
hub / github.com/anomalyco/opencode / isDataEnvelope

Function isDataEnvelope

packages/httpapi-codegen/src/index.ts:967–976  ·  view source on GitHub ↗
(schema: Schema.Top)

Source from the content-addressed store, hash-verified

965}
966
967function isDataEnvelope(schema: Schema.Top) {
968 if (isStreamSchema(schema) || HttpApiSchema.isNoContent(schema.ast)) return false
969 const ast = Schema.toType(schema).ast
970 return (
971 SchemaAST.isObjects(ast) &&
972 ast.indexSignatures.length === 0 &&
973 ast.propertySignatures.length === 1 &&
974 ast.propertySignatures[0]?.name === "data"
975 )
976}
977
978function isStreamSchema(schema: Schema.Top): schema is HttpApiSchema.StreamSchema {
979 return "_tag" in schema && (schema._tag === "StreamSse" || schema._tag === "StreamUint8Array")

Callers 1

onEndpointFunction · 0.85

Calls 1

isStreamSchemaFunction · 0.85

Tested by

no test coverage detected