import { Form, ThingInteraction } from "./thing-description"; import { Readable } from "stream"; import { ReadableStream as PolyfillStream } from "web-streams-polyfill"; import { ActionElement, EventElement, PropertyElement } from "wot-thing-description-types"; export interface IManagedStream { nodeStream: Readable; wotStream: ReadableStream; } export default class ProtocolHelpers { static updatePropertyFormWithTemplate(form: Form, property: PropertyElement): void; static updateActionFormWithTemplate(form: Form, action: ActionElement): void; static updateEventFormWithTemplate(form: Form, event: EventElement): void; static getPropertyContentType(td: WoT.ThingDescription, propertyName: string, uriScheme: string): string | undefined; static getActionContentType(td: WoT.ThingDescription, actionName: string, uriScheme: string): string | undefined; static getEventContentType(td: WoT.ThingDescription, eventName: string, uriScheme: string): string | undefined; static toWoTStream(stream: NodeJS.ReadableStream): ReadableStream | PolyfillStream; static toNodeStream(stream: ReadableStream | PolyfillStream | IManagedStream | Readable): Readable; static readStreamFully(stream: NodeJS.ReadableStream): Promise; static findRequestMatchingFormIndex(forms: Form[] | undefined, uriScheme: string, requestUrl: string | undefined, contentType?: string): number; static getFormIndexForOperation(interaction: ThingInteraction, type: "property" | "action" | "event", operationName?: "writeproperty" | "readproperty" | "invokeaction" | "subscribeevent" | "unsubscribeevent" | "unobserveproperty" | "observeproperty" | "readallproperties" | "readmultipleproperties", formIndex?: number): number; static getPropertyOpValues(property: PropertyElement): string[]; }