/* @flow */
/* eslint no-unused-expressions: 0, flowtype/no-weak-types: 0 */

const socketTypes = { HTTP: 'HTTP', HTTPS: 'HTTPS' };
export type rxweb$SocketType = $Keys<typeof socketTypes>;
export const rxweb$HTTP: rxweb$SocketType = 'HTTP';
export const rxweb$HTTPS: rxweb$SocketType = 'HTTPS';

export type rxweb$FilterFunc = (task: rxweb$Task) => boolean;
export type rxweb$SubscribeFunc = (task: rxweb$Task) => void;

export type rxweb$Request = http$IncomingMessage & http$ClientRequest;
export type rxweb$Response = http$IncomingMessage &
  http$ClientRequest &
  http$ServerResponse &
  Koa$Response;

export class rxweb$Task {
  constructor(_request?: rxweb$Request, _response?: rxweb$Response) {
    _request && (this.request = _request);
    _response && (this.response = _response);
  }
  request: rxweb$Request;
  response: rxweb$Response;
  data: ?(string | Buffer | stream$Duplex | Object | Array<*> | number | bool);
  type: string;
}

export class rxweb$Middleware {
  constructor(
    _filterFunc?: rxweb$FilterFunc,
    _subscribeFunc?: rxweb$SubscribeFunc
  ) {
    _filterFunc && (this.filterFunc = _filterFunc);
    _subscribeFunc && (this.subscribeFunc = _subscribeFunc);
  }
  filterFunc: rxweb$FilterFunc;
  subscribeFunc: rxweb$SubscribeFunc;
}

declare module 'rxweb' {
  declare var SocketType: rxweb$SocketType;
  declare var Task: Class<rxweb$Task>;
  declare var Middleware: Class<rxweb$Middleware>;
  declare var FilterFunc: rxweb$FilterFunc;
  declare var SubscribeFunc: rxweb$SubscribeFunc;
}

@@ -40,16 +40,18 @@
 ions: 0,
+%0A 
  flowtyp
@@ -68,17 +68,73 @@
 types: 0
- 
+,%0A  flowtype/union-intersection-spacing: 0,%0A  max-len: 0%0A
 */%0A%0Acons
@@ -671,41 +671,191 @@
 ort 
-class rxweb$Task %7B%0A  constructor(
+type rxweb$Data = string%7CBuffer%7Cstream$Duplex%7CObject%7CArray%3C*%3E%7Cnumber%7Cbool;%0A%0Aexport class rxweb$Task %7B%0A  constructor(%0A    _type?: string = 'INITIAL',%0A    _data?: ?rxweb$Data = %7B%7D,%0A    
 _req
@@ -875,16 +875,20 @@
 Request,
+%0A   
  _respon
@@ -906,16 +906,19 @@
 Response
+%0A  
 ) %7B%0A    
@@ -1008,158 +1008,149 @@
 ;%0A  
-%7D%0A  request: rxweb$Request;%0A  response: rxweb$Response;%0A  data: ?(string %7C Buffer %7C stream$Duplex %7C Object %7C Array%3C*%3E %7C number %7C bool);%0A  type: string
+  this.type = _type;%0A    this.data = _data;    %0A  %7D%0A  type: string;%0A  data: ?rxweb$Data;%0A  request: rxweb$Request;%0A  response: rxweb$Response
 ;%0A%7D%0A

Allow type and data in Task constructor