(schema: Schema.Top)
| 965 | } |
| 966 | |
| 967 | function 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 | |
| 978 | function isStreamSchema(schema: Schema.Top): schema is HttpApiSchema.StreamSchema { |
| 979 | return "_tag" in schema && (schema._tag === "StreamSse" || schema._tag === "StreamUint8Array") |
no test coverage detected