Skip to content

Commit cbc46ec

Browse files
committed
fix(ci): test release
1 parent c91768d commit cbc46ec

3 files changed

Lines changed: 435 additions & 0 deletions

File tree

js-lib/src/WsLinkClient/index.d.ts

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
export interface vtkSubscription {
2+
unsubscribe(): void;
3+
}
4+
5+
/**
6+
* Bind optional dependency from WSLink to our current class.
7+
* This is mandatory when using that class
8+
*
9+
* ```
10+
* import SmartConnect from 'wslink/src/SmartConnect';
11+
* import vtkWSLinkClient from '@kitware/vtk.js/IO/Core/WSLinkClient';
12+
*
13+
* vtkWSLinkClient.setSmartConnectClass(SmartConnect);
14+
* ```
15+
*
16+
* @param smartConnectClass
17+
*/
18+
export function setSmartConnectClass(smartConnectClass: object): void;
19+
20+
export interface vtkWSLinkClient {
21+
/**
22+
* Virtually increase work load to maybe keep isBusy() on
23+
* while executing a synchronous task.
24+
*/
25+
beginBusy(): void;
26+
27+
/**
28+
* Virtually decreasing work load to maybe free isBusy()
29+
* after executing a synchronous task. Other async calls
30+
* could still keep the state as busy.
31+
*/
32+
endBusy(): void;
33+
34+
/**
35+
* Return the current state of busy.
36+
* Do we still have pending calls?
37+
*/
38+
isBusy(): boolean;
39+
40+
/**
41+
* Return true if the client is currently connected to a server
42+
*/
43+
isConnected(): boolean;
44+
45+
/**
46+
* Initiate the connection with the server
47+
* @param {Object} config
48+
* @param {Function} [configDecorator] (default: null)
49+
*/
50+
connect(
51+
config: object,
52+
configDecorator?: (config: object) => object,
53+
): Promise<vtkWSLinkClient>;
54+
55+
/**
56+
* Disconnect from server
57+
* @param {Number} timeout amount of second to wait before the server exit as well. If we want to avoid the server from quitting, `-1` should be provided. (default=60)
58+
*/
59+
disconnect(timeout: number): void;
60+
61+
/**
62+
* Register dynamically a protocol after being connected
63+
*
64+
* @param {String} name
65+
* @param {Function} protocol
66+
*/
67+
registerProtocol(name: string, protocol: (session: object) => object): void;
68+
69+
/**
70+
* Remove a given protocol from the available list
71+
*
72+
* @param {String} name
73+
*/
74+
unregisterProtocol(name: string): void;
75+
76+
// --- via macro --
77+
78+
/**
79+
* Assign protocols to the client. Those will only be used at connect time and therefore needs to be set before being connected otherwise `registerProtocol` should be used instead.
80+
* @returns {Boolean} true if the set method modified the object
81+
*/
82+
setProtocols(protocols: Record<string, any>): boolean;
83+
84+
/**
85+
* Get protocols that were either provided in `newInstance` or via its set
86+
*/
87+
getProtocols(): Record<string, any>;
88+
89+
/**
90+
* Update the list of methods that should be ignore from the busy state monitoring
91+
* @returns {Boolean} true if the set method modified the object
92+
*/
93+
setNotBusyList(methodList: [string]): boolean;
94+
95+
/**
96+
* @returns {object} the current set of methods to ignore from busy state
97+
*/
98+
getNotBusyList(): object;
99+
100+
/**
101+
* Should the client auto listen to image stream topic by creating its imageStream object
102+
* @param {Boolean} autoCreate (default: true)
103+
* @returns {Boolean} true if the set method modified the object
104+
*/
105+
setCreateImageStream(autoCreate: boolean): boolean;
106+
107+
/**
108+
* @returns {Boolean} the autoCreate state for imageStream
109+
*/
110+
getCreateImageStream(): boolean;
111+
112+
/**
113+
* Set a config decorator to possibly alternate the config object that get received from the launcher.
114+
* @param decorator function for config object
115+
*/
116+
setConfigDecorator(decorator: (config: object) => object): boolean;
117+
118+
/**
119+
* @returns {Function} configDecorator function if any was provided
120+
*/
121+
getConfigDecorator(): (config: object) => object;
122+
123+
/**
124+
*
125+
*/
126+
getConnection(): any;
127+
128+
/**
129+
*
130+
*/
131+
getConfig(): object;
132+
133+
/**
134+
*
135+
*/
136+
getRemote(): Record<string, any>;
137+
138+
/**
139+
*
140+
*/
141+
getImageStream(): vtkImageStream;
142+
143+
/**
144+
*
145+
* @param callback
146+
* @param priority
147+
*/
148+
onBusyChange(callback: Function, priority: number): vtkSubscription;
149+
150+
/**
151+
*
152+
*/
153+
invokeBusyChange(): void;
154+
155+
onConnectionReady(callback: (httpReq: any) => void): vtkSubscription;
156+
// invokeConnectionReady(): void
157+
158+
onConnectionError(callback: (httpReq: any) => void): vtkSubscription;
159+
// invokeConnectionError(): void
160+
161+
onConnectionClose(callback: (httpReq: any) => void): vtkSubscription;
162+
// invokeConnectionClose(): void
163+
}
164+
165+
/**
166+
* Method use to decorate a given object (publicAPI+model) with vtkWSLinkClient characteristics.
167+
*
168+
* @param publicAPI object on which methods will be bounds (public)
169+
* @param model object on which data structure will be bounds (protected)
170+
* @param {object} [initialValues] (default: {})
171+
*/
172+
export function extend(
173+
publicAPI: object,
174+
model: object,
175+
initialValues?: object,
176+
): void;
177+
178+
// ----------------------------------------------------------------------------
179+
180+
/**
181+
* Method use to create a new instance of vtkWSLinkClient
182+
* @param {object} [initialValues] for pre-setting some of its content
183+
*/
184+
export function newInstance(initialValues?: object): vtkWSLinkClient;
185+
186+
/**
187+
* vtkWSLinkClient is a WSLink client for talking to a server over WebSocket
188+
*/
189+
export declare const vtkWSLinkClient: {
190+
newInstance: typeof newInstance;
191+
extend: typeof extend;
192+
// static
193+
setSmartConnectClass: typeof setSmartConnectClass;
194+
};
195+
196+
export default vtkWSLinkClient;

0 commit comments

Comments
 (0)