@viamrobotics/sdk 0.1.0 → 0.2.0-pre.1

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.
@@ -0,0 +1,8 @@
1
+ import { EventDispatcher } from './events';
2
+ import type { ResponseStream } from './gen/robot/v1/robot_pb_service';
3
+ export declare class ViamResponseStream<T> extends EventDispatcher {
4
+ private stream;
5
+ constructor(stream: ResponseStream<any>);
6
+ on(type: string, handler: (message: any) => void): ResponseStream<T>;
7
+ cancel(): void;
8
+ }
@@ -20,12 +20,13 @@ import { SLAMServiceClient } from '../gen/service/slam/v1/slam_pb_service';
20
20
  import { SensorsServiceClient } from '../gen/service/sensors/v1/sensors_pb_service';
21
21
  import { ServoServiceClient } from '../gen/component/servo/v1/servo_pb_service';
22
22
  import { VisionServiceClient } from '../gen/service/vision/v1/vision_pb_service';
23
- import type { Robot } from './robot';
23
+ import type { Robot, RobotStatusStream } from './robot';
24
24
  interface WebRTCOptions {
25
25
  enabled: boolean;
26
26
  host: string;
27
27
  signalingAddress: string;
28
28
  rtcConfig: RTCConfiguration | undefined;
29
+ noReconnect?: boolean;
29
30
  }
30
31
  interface SessionOptions {
31
32
  disabled: boolean;
@@ -89,6 +90,7 @@ export declare class RobotClient implements Robot {
89
90
  get servoService(): ServoServiceClient;
90
91
  get slamService(): SLAMServiceClient;
91
92
  createServiceClient<T extends ServiceClient>(SC: new (serviceHost: string, options?: grpc.RpcOptions) => T): T;
93
+ get peerConnection(): RTCPeerConnection | undefined;
92
94
  disconnect(): Promise<void>;
93
95
  connect(authEntity?: string | undefined, creds?: Credentials | undefined): Promise<void>;
94
96
  getOperations(): Promise<proto.Operation[]>;
@@ -102,6 +104,6 @@ export declare class RobotClient implements Robot {
102
104
  resourceNames(): Promise<ResourceName.AsObject[]>;
103
105
  resourceRPCSubtypes(): Promise<proto.ResourceRPCSubtype[]>;
104
106
  getStatus(resourceNames: ResourceName[]): Promise<proto.Status[]>;
105
- streamStatus(resourceNames: ResourceName[], duration: Duration): Promise<proto.Status[]>;
107
+ streamStatus(resourceNames: ResourceName[], duration: Duration): RobotStatusStream;
106
108
  }
107
109
  export {};
@@ -8,6 +8,7 @@ export interface DialDirectConf {
8
8
  authEntity?: string;
9
9
  host: string;
10
10
  credential?: Credential;
11
+ disableSessions?: boolean;
11
12
  }
12
13
  interface ICEServer {
13
14
  urls: string;
@@ -19,8 +20,10 @@ export interface DialWebRTCConf {
19
20
  authEntity?: string;
20
21
  host: string;
21
22
  credential?: Credential;
23
+ disableSessions?: boolean;
22
24
  signalingAddress: string;
23
25
  iceServers?: ICEServer[];
26
+ noReconnect?: boolean;
24
27
  }
25
28
  /** Options required to dial a robot. */
26
29
  export type DialConf = DialDirectConf | DialWebRTCConf;
@@ -2,6 +2,8 @@ import type { Duration } from 'google-protobuf/google/protobuf/duration_pb';
2
2
  import type { PoseInFrame, ResourceName, Transform } from '../gen/common/v1/common_pb';
3
3
  import type { StructType } from '../types';
4
4
  import type proto from '../gen/robot/v1/robot_pb';
5
+ import type { ResponseStream } from '../gen/robot/v1/robot_pb_service';
6
+ export type RobotStatusStream = ResponseStream<proto.Status[]>;
5
7
  export interface Robot {
6
8
  /**
7
9
  * Get the list of operations currently running on the robot.
@@ -113,5 +115,5 @@ export interface Robot {
113
115
  * @group Status
114
116
  * @alpha
115
117
  */
116
- streamStatus(resourceNames: ResourceName[], duration: Duration): Promise<proto.Status[]>;
118
+ streamStatus(resourceNames: ResourceName[], duration: Duration): RobotStatusStream;
117
119
  }
package/dist/robot.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export type { Robot } from './robot/robot';
1
+ export type { Robot, RobotStatusStream } from './robot/robot';
2
2
  export { RobotClient } from './robot/client';
3
3
  export { type DialConf, type DialDirectConf, type DialWebRTCConf, createRobotClient, } from './robot/dial';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-pre.1",
4
4
  "description": "",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",
@@ -44,7 +44,8 @@
44
44
  },
45
45
  "homepage": "https://github.com/viamrobotics/viam-typescript-sdk#readme",
46
46
  "dependencies": {
47
- "@viamrobotics/rpc": "^0.1.36"
47
+ "@viamrobotics/rpc": "^0.1.37",
48
+ "exponential-backoff": "^3.1.1"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@bufbuild/buf": "^1.15.0-1",