botbuilder
Version:
Bot Builder is a framework for building rich bots on virtually any platform.
23 lines (18 loc) • 817 B
text/typescript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as z from 'zod';
import { INodeBuffer, INodeSocket } from 'botframework-streaming';
import { TurnContext } from 'botbuilder-core';
export const INodeBufferT = z.custom<INodeBuffer>(Buffer.isBuffer, { message: 'INodeBufferT' });
export const INodeSocketT = z.custom<INodeSocket>(
(val: any) =>
typeof val.emit === 'function' &&
typeof val.end === 'function' &&
typeof val.off === 'function' &&
typeof val.on === 'function' &&
typeof val.once === 'function' &&
typeof val.pipe === 'function' &&
typeof val.write === 'function',
{ message: 'INodeSocket' }
);
export const LogicT = z.custom<(context: TurnContext) => Promise<void>>((val) => typeof val === 'function');