/* * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ export * as httpbinding from "./httpbinding"; export * from "./accept"; export * from "./errors"; export * from "./validation"; export * from "./unique"; import { HttpRequest, HttpResponse } from "@smithy/protocol-http"; import { SerdeContext } from "@smithy/types"; import { ServiceException } from "./errors"; export type Operation = (input: I, context: Context) => Promise; export type OperationInput = T extends Operation ? I : never; export type OperationOutput = T extends Operation ? O : never; export interface OperationSerializer { serialize(input: OperationOutput, ctx: ServerSerdeContext): Promise; deserialize(input: HttpRequest, ctx: SerdeContext): Promise>; isOperationError(error: any): error is E; serializeError(error: E, ctx: ServerSerdeContext): Promise; } export interface ServiceHandler { handle(request: RequestType, context: Context): Promise; } export interface ServiceCoordinate { readonly service: S; readonly operation: O; } export interface Mux { match(req: HttpRequest): ServiceCoordinate | undefined; } export interface ServerSerdeContext extends Omit {}