import type { HttpContentType } from './utils' import type { Byte } from '@principia/base/Byte' import type { Chunk } from '@principia/base/Chunk' import type { IO } from '@principia/base/IO' import * as I from '@principia/base/IO' import * as S from '@principia/base/Stream' export abstract class HttpEntity { readonly _R!: (_: R) => void readonly _E!: () => E readonly _A!: () => A abstract readonly contentType: HttpContentType abstract run(): IO } export class Strict extends HttpEntity> { readonly _tag = 'Strict' constructor(readonly contentType: HttpContentType, readonly data: ReadonlyArray) { super() } run() { return I.succeed(this.data) } } export class Stream extends HttpEntity> { readonly _tag = 'Stream' constructor(readonly contentType: HttpContentType, readonly stream: S.Stream) { super() } run() { return S.runCollect(this.stream) } }