Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from runway/sam/updates
Browse files Browse the repository at this point in the history
commit dist
  • Loading branch information
samrunway authored Aug 23, 2022
2 parents aa727da + fbdcf4f commit 7cb32f6
Show file tree
Hide file tree
Showing 37 changed files with 3,631 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
.DS_Store
dist
coverage
typings
npm-debug.log
Expand Down
112 changes: 112 additions & 0 deletions dist/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import { ListenerFn } from "eventemitter3";
import { ExecutionResult } from "graphql/execution/execute";
import { DocumentNode } from "graphql/language/ast";
export interface Observer<T> {
next?: (value: T) => void;
error?: (error: Error) => void;
complete?: () => void;
}
export interface Observable<T> {
subscribe(observer: Observer<T>): {
unsubscribe: () => void;
};
}
export interface OperationOptions {
query?: string | DocumentNode;
variables?: Object;
operationName?: string;
[key: string]: any;
}
export declare type FormatedError = Error & {
originalError?: any;
};
export interface Operation {
options: OperationOptions;
handler: (error: Error[], result?: any) => void;
}
export interface Operations {
[id: string]: Operation;
}
export interface Middleware {
applyMiddleware(options: OperationOptions, next: Function): void;
}
export declare type ConnectionParams = {
[paramName: string]: any;
};
export declare type ConnectionParamsOptions = ConnectionParams | Function | Promise<ConnectionParams>;
export interface ClientOptions {
connectionParams?: ConnectionParamsOptions;
minTimeout?: number;
timeout?: number;
reconnect?: boolean;
reconnectionAttempts?: number;
connectionCallback?: (error: Error[], result?: any) => void;
lazy?: boolean;
inactivityTimeout?: number;
wsOptionArguments?: any[];
}
export declare class SubscriptionClient {
client: any;
operations: Operations;
private url;
private nextOperationId;
private connectionParams;
private minWsTimeout;
private wsTimeout;
private unsentMessagesQueue;
private reconnect;
private reconnecting;
private reconnectionAttempts;
private backoff;
private connectionCallback;
private eventEmitter;
private lazy;
private inactivityTimeout;
private inactivityTimeoutId;
private closedByUser;
private wsImpl;
private wsProtocols;
private wasKeepAliveReceived;
private tryReconnectTimeoutId;
private checkConnectionIntervalId;
private maxConnectTimeoutId;
private middlewares;
private maxConnectTimeGenerator;
private wsOptionArguments;
constructor(url: string, options?: ClientOptions, webSocketImpl?: any, webSocketProtocols?: string | string[]);
get status(): any;
close(isForced?: boolean, closedByUser?: boolean): void;
request(request: OperationOptions): Observable<ExecutionResult>;
on(eventName: string, callback: ListenerFn, context?: any): Function;
onConnected(callback: ListenerFn, context?: any): Function;
onConnecting(callback: ListenerFn, context?: any): Function;
onDisconnected(callback: ListenerFn, context?: any): Function;
onReconnected(callback: ListenerFn, context?: any): Function;
onReconnecting(callback: ListenerFn, context?: any): Function;
onError(callback: ListenerFn, context?: any): Function;
unsubscribeAll(): void;
applyMiddlewares(options: OperationOptions): Promise<OperationOptions>;
use(middlewares: Middleware[]): SubscriptionClient;
private getConnectionParams;
private executeOperation;
private getObserver;
private createMaxConnectTimeGenerator;
private clearCheckConnectionInterval;
private clearMaxConnectTimeout;
private clearTryReconnectTimeout;
private clearInactivityTimeout;
private setInactivityTimeout;
private checkOperationOptions;
private buildMessage;
private formatErrors;
private sendMessage;
private sendMessageRaw;
private generateOperationId;
private tryReconnect;
private flushUnsentMessagesQueue;
private checkConnection;
private checkMaxConnectTimeout;
private connect;
private processReceivedData;
private unsubscribe;
}
Loading

0 comments on commit 7cb32f6

Please sign in to comment.