@vertexvis/stream-api 0.12.0-canary.9 → 0.12.0
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/bundle.cjs.js +2671 -432
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +2415 -177
- package/dist/bundle.esm.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/streamApi.d.ts +37 -6
- package/dist/testing/fixtures/index.d.ts +3 -2
- package/dist/testing/fixtures/requests.d.ts +1 -1
- package/dist/testing/fixtures/responses.d.ts +20 -0
- package/dist/testing/webSocketClientMock.d.ts +5 -3
- package/dist/types.d.ts +13 -1
- package/dist/webSocketClient.d.ts +1 -0
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export * from './connection';
|
|
5
5
|
export * from './encoder';
|
|
6
|
-
export
|
|
6
|
+
export * from './errors';
|
|
7
|
+
export { AdaptiveRenderingSettings, FrameDeliverySettings, QualityOfServiceSettings, Settings, } from './settings';
|
|
7
8
|
export * from './streamApi';
|
|
8
9
|
export * from './testing';
|
|
9
10
|
export * from './time';
|
package/dist/streamApi.d.ts
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { WebSocketClient } from './webSocketClient';
|
|
2
|
-
import { ConnectionDescriptor } from './connection';
|
|
3
|
-
import { HitItemsPayload, ReconnectPayload, ReplaceCameraPayload, StartStreamPayload, ResponseResult, ResponseError, RequestMessage, ResponseMessage, SyncTimePayload, RecordPerformancePayload, UpdateCrossSectioningPayload, UpdateDimensionsPayload, UpdateStreamPayload, LoadSceneViewStatePayload, EventMessage } from './types';
|
|
4
1
|
import { vertexvis } from '@vertexvis/frame-streaming-protos';
|
|
5
2
|
import { Disposable } from '@vertexvis/utils';
|
|
3
|
+
import { ConnectionDescriptor } from './connection';
|
|
6
4
|
import { Settings } from './settings';
|
|
5
|
+
import { EventMessage, GetStencilBufferPayload, HitItemsPayload, LoadSceneViewStatePayload, ReconnectPayload, RecordPerformancePayload, ReplaceCameraPayload, RequestMessage, ResponseError, ResponseMessage, ResponseResult, StartStreamPayload, SyncTimePayload, UpdateCrossSectioningPayload, UpdateDimensionsPayload, UpdateStreamPayload } from './types';
|
|
6
|
+
import { WebSocketClient } from './webSocketClient';
|
|
7
7
|
export declare type RequestMessageHandler = (msg: RequestMessage) => void;
|
|
8
8
|
export declare type ResponseMessageHandler = (msg: ResponseMessage) => void;
|
|
9
9
|
export declare type EventMessageHandler = (msg: EventMessage) => void;
|
|
10
|
+
export declare type CloseEventHandler = (evt: CloseEvent) => void;
|
|
11
|
+
export interface StreamApiOptions {
|
|
12
|
+
loggingEnabled?: boolean;
|
|
13
|
+
}
|
|
10
14
|
/**
|
|
11
15
|
* The API client to interact with Vertex's streaming API.
|
|
12
16
|
*/
|
|
13
17
|
export declare class StreamApi {
|
|
14
18
|
private websocket;
|
|
15
|
-
private loggingEnabled;
|
|
16
19
|
private onResponseDispatcher;
|
|
17
20
|
private onRequestDispatcher;
|
|
18
21
|
private onEventDispatcher;
|
|
19
22
|
private messageSubscription?;
|
|
20
|
-
|
|
23
|
+
private opts;
|
|
24
|
+
constructor(websocket?: WebSocketClient, opts?: StreamApiOptions);
|
|
21
25
|
/**
|
|
22
26
|
* Initiates a websocket connection to Vertex's streaming API. Returns a
|
|
23
27
|
* promise that resolves once the connection is established and can begin
|
|
@@ -46,6 +50,12 @@ export declare class StreamApi {
|
|
|
46
50
|
* @param handler - A handler function.
|
|
47
51
|
*/
|
|
48
52
|
onEvent(handler: EventMessageHandler): Disposable;
|
|
53
|
+
/**
|
|
54
|
+
* Adds a callback that is invoked when the websocket connection is closed.
|
|
55
|
+
*
|
|
56
|
+
* @param handler A handler function.
|
|
57
|
+
*/
|
|
58
|
+
onClose(handler: CloseEventHandler): Disposable;
|
|
49
59
|
/**
|
|
50
60
|
* Sends a request to initiate a streaming session.
|
|
51
61
|
*
|
|
@@ -189,6 +199,19 @@ export declare class StreamApi {
|
|
|
189
199
|
* Defaults to `true`.
|
|
190
200
|
*/
|
|
191
201
|
createSceneAlteration(payload: vertexvis.protobuf.stream.ICreateSceneAlterationPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* Sends a request to reset all overrides for a given scene and optionally to
|
|
204
|
+
* reset the camera to that of the base scene.
|
|
205
|
+
*
|
|
206
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
207
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
208
|
+
* it'll complete when a response is received.
|
|
209
|
+
*
|
|
210
|
+
* @param payload The payload of the request.
|
|
211
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
212
|
+
* Defaults to `true`.
|
|
213
|
+
*/
|
|
214
|
+
resetSceneView(payload: vertexvis.protobuf.stream.IResetViewPlayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
192
215
|
/**
|
|
193
216
|
* Sends a request to tell the rendering pipeline that an interaction has
|
|
194
217
|
* ended.
|
|
@@ -242,7 +265,15 @@ export declare class StreamApi {
|
|
|
242
265
|
/**
|
|
243
266
|
* Sends a request to get a stencil buffer image for the current scene view.
|
|
244
267
|
*/
|
|
245
|
-
getStencilBuffer(withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
268
|
+
getStencilBuffer(payload: GetStencilBufferPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
269
|
+
/**
|
|
270
|
+
* Sends a request to retrieve a new token. This token can be used to
|
|
271
|
+
* authenticate with other Vertex services.
|
|
272
|
+
*
|
|
273
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
274
|
+
* @returns A promise that completes with the refreshed token.
|
|
275
|
+
*/
|
|
276
|
+
refreshToken(withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
246
277
|
/**
|
|
247
278
|
* Acknowledges a successful request by sending a reply back to the server
|
|
248
279
|
* with an optional result body.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RequestMessage } from '../../types';
|
|
2
1
|
import { vertexvis } from '@vertexvis/frame-streaming-protos';
|
|
2
|
+
import { RequestMessage } from '../../types';
|
|
3
3
|
declare type Metadata = Partial<Pick<RequestMessage, 'sentAtTime'>>;
|
|
4
4
|
interface RequestId {
|
|
5
5
|
requestId?: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { vertexvis } from '@vertexvis/frame-streaming-protos';
|
|
2
|
+
import { ResponseMessage } from '../../types';
|
|
3
|
+
declare type Metadata = Partial<Pick<ResponseMessage, 'sentAtTime'>>;
|
|
4
|
+
interface RequestId {
|
|
5
|
+
requestId?: string;
|
|
6
|
+
}
|
|
7
|
+
interface Result<T> {
|
|
8
|
+
result?: T;
|
|
9
|
+
}
|
|
10
|
+
declare type StartStreamResponse = RequestId & Result<vertexvis.protobuf.stream.IStartStreamResult>;
|
|
11
|
+
declare type SyncTimeResponse = RequestId & Result<vertexvis.protobuf.stream.ISyncTimeResult>;
|
|
12
|
+
declare type ReconnectResponse = RequestId & Result<vertexvis.protobuf.stream.IReconnectResult>;
|
|
13
|
+
declare type LoadSceneViewStateResponse = RequestId & Result<vertexvis.protobuf.stream.ILoadSceneViewStateResult>;
|
|
14
|
+
declare type RefreshTokenResponse = RequestId & Result<vertexvis.protobuf.stream.IRefreshTokenResult>;
|
|
15
|
+
export declare function startStream(res?: StartStreamResponse, meta?: Metadata): ResponseMessage;
|
|
16
|
+
export declare function syncTime(res?: SyncTimeResponse, meta?: Metadata): ResponseMessage;
|
|
17
|
+
export declare function reconnect(res?: ReconnectResponse, meta?: Metadata): ResponseMessage;
|
|
18
|
+
export declare function loadSceneViewState(res?: LoadSceneViewStateResponse, meta?: Metadata): ResponseMessage;
|
|
19
|
+
export declare function refreshToken(res?: RefreshTokenResponse, meta?: Metadata): ResponseMessage;
|
|
20
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { WebSocketClient, WebSocketSendData, MessageHandler } from '../webSocketClient';
|
|
2
|
-
import { ConnectionDescriptor } from '../connection';
|
|
3
1
|
import { Disposable } from '@vertexvis/utils';
|
|
2
|
+
import { ConnectionDescriptor } from '../connection';
|
|
3
|
+
import { CloseHandler, MessageHandler, WebSocketClient, WebSocketSendData } from '../webSocketClient';
|
|
4
4
|
export declare class WebSocketClientMock implements WebSocketClient {
|
|
5
|
-
private
|
|
5
|
+
private closeHandlers;
|
|
6
|
+
private msgHandlers;
|
|
6
7
|
private sentMessages;
|
|
7
8
|
close(): void;
|
|
8
9
|
connect(descriptor: ConnectionDescriptor): Promise<void>;
|
|
10
|
+
onClose(handler: CloseHandler): Disposable;
|
|
9
11
|
onMessage(handler: MessageHandler): Disposable;
|
|
10
12
|
send(data: WebSocketSendData): void;
|
|
11
13
|
reconnect(descriptor: ConnectionDescriptor): Promise<void>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeepRequired, RequiredAndNonNullable } from '@vertexvis/utils';
|
|
2
1
|
import { vertexvis } from '@vertexvis/frame-streaming-protos';
|
|
2
|
+
import { DeepRequired, RequiredAndNonNullable } from '@vertexvis/utils';
|
|
3
3
|
export declare type RequestMessage = RequiredAndNonNullable<Pick<vertexvis.protobuf.stream.IStreamMessage, 'request' | 'sentAtTime'>>;
|
|
4
4
|
export declare type ResponseMessage = RequiredAndNonNullable<Pick<vertexvis.protobuf.stream.IStreamMessage, 'response' | 'sentAtTime'>>;
|
|
5
5
|
export declare type EventMessage = RequiredAndNonNullable<Pick<vertexvis.protobuf.stream.IStreamMessage, 'event' | 'sentAtTime'>>;
|
|
@@ -32,7 +32,19 @@ export declare type RecordPerformancePayload = DeepRequired<vertexvis.protobuf.s
|
|
|
32
32
|
]>;
|
|
33
33
|
export declare type LoadSceneViewStatePayload = DeepRequired<vertexvis.protobuf.stream.ILoadSceneViewStatePayload, [
|
|
34
34
|
]>;
|
|
35
|
+
export declare type GetStencilBufferPayload = DeepRequired<vertexvis.protobuf.stream.IGetStencilBufferPayload, [
|
|
36
|
+
]>;
|
|
35
37
|
export declare type DrawFrameResult = DeepRequired<Pick<vertexvis.protobuf.stream.IStreamResponse, 'drawFrame'>, ['drawFrame', 'timing', 'receiveToPaintDuration'] | ['drawFrame', 'timing', 'sendToReceiveDuration']>;
|
|
38
|
+
export declare type StartStreamResult = DeepRequired<vertexvis.protobuf.stream.IStartStreamResult, [
|
|
39
|
+
]>;
|
|
40
|
+
export declare type SyncTimeResult = DeepRequired<vertexvis.protobuf.stream.ISyncTimeResult, [
|
|
41
|
+
]>;
|
|
42
|
+
export declare type ReconnectResult = DeepRequired<vertexvis.protobuf.stream.IReconnectResult, [
|
|
43
|
+
]>;
|
|
44
|
+
export declare type LoadSceneViewStateResult = DeepRequired<vertexvis.protobuf.stream.ILoadSceneViewStateResult, [
|
|
45
|
+
]>;
|
|
46
|
+
export declare type RefreshTokenResult = DeepRequired<vertexvis.protobuf.stream.IRefreshTokenResult, [
|
|
47
|
+
]>;
|
|
36
48
|
export declare type ResponseResult = DrawFrameResult;
|
|
37
49
|
export declare type ResponseError = vertexvis.protobuf.stream.IError;
|
|
38
50
|
export declare type AnimationCompletedEvent = DeepRequired<Pick<vertexvis.protobuf.stream.IAnimationCompletedEvent, 'animationId'>, [
|
|
@@ -7,6 +7,7 @@ export interface WebSocketClient {
|
|
|
7
7
|
close(): void;
|
|
8
8
|
connect(descriptor: ConnectionDescriptor): Promise<void>;
|
|
9
9
|
onMessage(handler: MessageHandler): Disposable;
|
|
10
|
+
onClose(handler: CloseHandler): Disposable;
|
|
10
11
|
send(data: WebSocketSendData): void;
|
|
11
12
|
}
|
|
12
13
|
export declare class WebSocketClientImpl implements WebSocketClient {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertexvis/stream-api",
|
|
3
|
-
"version": "0.12.0
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "A websocket client for interacting with Vertex's stream API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vertex Developers <support@vertexvis.com> (https://developer.vertexvis.com)",
|
|
@@ -35,26 +35,26 @@
|
|
|
35
35
|
"test:coverage": "yarn test --coverage"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@vertexvis/frame-streaming-protos": "^0.6.
|
|
38
|
+
"@vertexvis/frame-streaming-protos": "^0.6.16"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/jest": "^26.0.20",
|
|
42
|
-
"@vertexvis/eslint-config-vertexvis-typescript": "^0.
|
|
43
|
-
"@vertexvis/jest-config-vertexvis": "^0.5.
|
|
44
|
-
"@vertexvis/utils": "
|
|
45
|
-
"@vertexwebsdk/build": "
|
|
46
|
-
"eslint": "^
|
|
42
|
+
"@vertexvis/eslint-config-vertexvis-typescript": "^0.5.0",
|
|
43
|
+
"@vertexvis/jest-config-vertexvis": "^0.5.4",
|
|
44
|
+
"@vertexvis/utils": "0.12.0",
|
|
45
|
+
"@vertexwebsdk/build": "0.12.0",
|
|
46
|
+
"eslint": "^8.6.0",
|
|
47
47
|
"jest": "^26.6.3",
|
|
48
48
|
"protobufjs": "^6.9.0",
|
|
49
|
-
"rollup": "^2.
|
|
49
|
+
"rollup": "^2.63.0",
|
|
50
50
|
"ts-jest": "^26.5.2",
|
|
51
51
|
"tslib": "^2.1.0",
|
|
52
|
-
"typescript": "^4.
|
|
52
|
+
"typescript": "^4.5.4"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@vertexvis/utils": "^0.10.1",
|
|
56
56
|
"protobufjs": ">=6.9.0 <7.0.0",
|
|
57
57
|
"tslib": ">=2.1.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "9642bca08f9e57be8234032a62d6ae1e27233977"
|
|
60
60
|
}
|