@mochabug/adapt-web 0.0.65 → 0.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/genproto/mochabugapis/adapt/automations/v1/automations_pb.js +1 -1
- package/dist/cjs/genproto/mochabugapis/adapt/automations/v1/automations_pb.js.map +1 -1
- package/dist/cjs/index.js +5 -286
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pubsub-client.js +501 -0
- package/dist/cjs/pubsub-client.js.map +1 -0
- package/dist/esm/genproto/mochabugapis/adapt/automations/v1/automations_pb.js +1 -1
- package/dist/esm/genproto/mochabugapis/adapt/automations/v1/automations_pb.js.map +1 -1
- package/dist/esm/index.js +2 -281
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pubsub-client.js +494 -0
- package/dist/esm/pubsub-client.js.map +1 -0
- package/dist/types/genproto/mochabugapis/adapt/automations/v1/automations_pb.d.ts +2 -40
- package/dist/types/index.d.ts +2 -53
- package/dist/types/pubsub-client.d.ts +52 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ValueJson } from "@bufbuild/protobuf/wkt";
|
|
2
|
+
import { AutomationIdJson, SessionJson, UrlJson } from "./genproto/mochabugapis/adapt/automations/v1/automations_pb.js";
|
|
3
|
+
export interface Output {
|
|
4
|
+
vertex: string;
|
|
5
|
+
fork: string;
|
|
6
|
+
data: {
|
|
7
|
+
[key: string]: ValueJson;
|
|
8
|
+
};
|
|
9
|
+
created?: Date;
|
|
10
|
+
}
|
|
11
|
+
export interface MessageHandlers {
|
|
12
|
+
onOutput?: (output: Output) => void;
|
|
13
|
+
onSession?: (session: SessionJson) => void;
|
|
14
|
+
onUrl?: (url: UrlJson) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface SubscriptionOptions extends MessageHandlers {
|
|
17
|
+
sessionToken: string;
|
|
18
|
+
automation: AutomationIdJson;
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare enum ConnectionState {
|
|
22
|
+
DISCONNECTED = "disconnected",
|
|
23
|
+
CONNECTING = "connecting",
|
|
24
|
+
CONNECTED = "connected",
|
|
25
|
+
CLOSING = "closing"
|
|
26
|
+
}
|
|
27
|
+
export declare class PubsubClient {
|
|
28
|
+
private state;
|
|
29
|
+
private sessionConfig;
|
|
30
|
+
private readonly logger;
|
|
31
|
+
private readonly ackTracker;
|
|
32
|
+
private readonly reconnectManager;
|
|
33
|
+
private readonly wsManager;
|
|
34
|
+
private messageProcessor;
|
|
35
|
+
private shouldReconnect;
|
|
36
|
+
private sessionComplete;
|
|
37
|
+
constructor(debug?: boolean);
|
|
38
|
+
subscribe(opts: SubscriptionOptions): Promise<void>;
|
|
39
|
+
unsubscribe(): Promise<void>;
|
|
40
|
+
isConnected(): boolean;
|
|
41
|
+
getConnectionState(): ConnectionState;
|
|
42
|
+
private connect;
|
|
43
|
+
private handleOpen;
|
|
44
|
+
private handleMessage;
|
|
45
|
+
private handleClose;
|
|
46
|
+
private handleError;
|
|
47
|
+
private analyzeCloseCode;
|
|
48
|
+
private scheduleReconnect;
|
|
49
|
+
private cleanup;
|
|
50
|
+
private isSameSession;
|
|
51
|
+
private updateHandlers;
|
|
52
|
+
}
|
package/package.json
CHANGED