in lib/eventstream_rpc.ts [1144:1161]
function serializeMessage(model: EventstreamRpcServiceModel, operationName: string, message: any, shapeSelector: OperationShapeSelector) : eventstream.Message {
let operation = model.operations.get(operationName);
if (!operation) {
throw createRpcError(RpcErrorType.InternalError, `No operation named '${operationName}' exists in the service model`);
}
let shapeName : string | undefined = shapeSelector(operation);
if (!shapeName) {
throw createRpcError(RpcErrorType.InternalError, `Operation '${operationName}' does not have a defined selection shape`);
}
let serializer = model.serializers.get(shapeName);
if (!serializer) {
throw createRpcError(RpcErrorType.InternalError, `No top-level shape serializer for '${shapeName}' exists in the service model`);
}
return serializer(message);
}