// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. import { DaemonProtocolError } from './DaemonProtocolError'; /** Validates optional stdin admission/EOF capability negotiation. @internal */ export function validateInputLifecycleCapability(payload: Record): void { if (payload.supportsInputLifecycle !== undefined && typeof payload.supportsInputLifecycle !== 'boolean') { throw new DaemonProtocolError( 'malformedControlMessage', 'Subscribe message payload.supportsInputLifecycle must be a boolean.' ); } } /** Validates optional request-lifecycle capability negotiation. @internal */ export function validateRequestLifecycleCapability(payload: Record): void { if ( payload.supportsRequestLifecycle !== undefined && typeof payload.supportsRequestLifecycle !== 'boolean' ) { throw new DaemonProtocolError( 'malformedControlMessage', 'Subscribe message payload.supportsRequestLifecycle must be a boolean.' ); } } /** Validates optional negotiation of the `requestStarted` notice. @internal */ export function validateRequestStartedCapability(payload: Record): void { if (payload.supportsRequestStarted !== undefined && typeof payload.supportsRequestStarted !== 'boolean') { throw new DaemonProtocolError( 'malformedControlMessage', 'Subscribe message payload.supportsRequestStarted must be a boolean.' ); } }