@viamrobotics/sdk 0.56.0 → 0.57.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.
Files changed (34) hide show
  1. package/dist/api-version.d.ts +1 -1
  2. package/dist/app/data-client.d.ts +18 -0
  3. package/dist/events.d.ts +2 -1
  4. package/dist/gen/app/data/v1/data_connect.d.ts +12 -1
  5. package/dist/gen/app/data/v1/data_pb.d.ts +67 -0
  6. package/dist/gen/app/mltraining/v1/ml_training_connect.d.ts +12 -1
  7. package/dist/gen/app/mltraining/v1/ml_training_pb.d.ts +107 -0
  8. package/dist/gen/app/v1/billing_pb.d.ts +10 -0
  9. package/dist/gen/app/v1/robot_pb.d.ts +7 -0
  10. package/dist/gen/common/v1/common_pb.d.ts +1 -1
  11. package/dist/gen/component/gantry/v1/gantry_connect.d.ts +10 -1
  12. package/dist/gen/google/api/routing_pb.d.ts +508 -0
  13. package/dist/gen/google/iam/v1/iam_policy_connect.d.ts +102 -0
  14. package/dist/gen/google/iam/v1/iam_policy_pb.d.ts +179 -0
  15. package/dist/gen/google/iam/v1/options_pb.d.ts +67 -0
  16. package/dist/gen/google/iam/v1/policy_pb.d.ts +668 -0
  17. package/dist/gen/robot/v1/robot_pb.d.ts +39 -0
  18. package/dist/main.es.js +4536 -4280
  19. package/dist/main.umd.js +7 -7
  20. package/dist/robot/client.d.ts +28 -15
  21. package/package.json +11 -7
  22. package/dist/__fixtures__/credentials.d.ts +0 -5
  23. package/dist/__fixtures__/test-constants.d.ts +0 -4
  24. package/dist/__mocks__/transports.d.ts +0 -2
  25. package/dist/__mocks__/webrtc.d.ts +0 -2
  26. package/dist/robot/__fixtures__/dial-configs.d.ts +0 -4
  27. package/dist/robot/__mocks__/robot-service.d.ts +0 -5
  28. package/dist/robot/__tests__/client.spec.d.ts +0 -1
  29. package/dist/robot/__tests__/grpc-connection-manager.spec.d.ts +0 -1
  30. package/dist/robot/__tests__/session-manager.spec.d.ts +0 -1
  31. package/dist/rpc/__fixtures__/dial-options.d.ts +0 -6
  32. package/dist/rpc/__fixtures__/dial-webrtc-options.d.ts +0 -8
  33. package/dist/rpc/__mocks__/signaling-exchanges.d.ts +0 -3
  34. package/dist/rpc/__tests__/dial.spec.d.ts +0 -1
@@ -94,6 +94,8 @@ export declare class RobotClient extends EventDispatcher implements Robot {
94
94
  private transport;
95
95
  private connecting;
96
96
  private connectResolve;
97
+ private dialing;
98
+ private currentDialAbortSignal;
97
99
  private savedCreds;
98
100
  private closed;
99
101
  private robotServiceClient;
@@ -159,7 +161,10 @@ export declare class RobotClient extends EventDispatcher implements Robot {
159
161
  readonly name: "CancelOperation";
160
162
  readonly I: typeof import("../gen/robot/v1/robot_pb").CancelOperationRequest;
161
163
  readonly O: typeof import("../gen/robot/v1/robot_pb").CancelOperationResponse;
162
- readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
164
+ readonly kind: import("@bufbuild/protobuf").MethodKind.Unary; /**
165
+ * Set timeout in milliseconds for dialing. Default is defined by
166
+ * DIAL_TIMEOUT. A value of 0 disables the timeout.
167
+ */
163
168
  };
164
169
  readonly blockForOperation: {
165
170
  readonly name: "BlockForOperation";
@@ -315,7 +320,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
315
320
  readonly I: typeof import("../gen/component/arm/v1/arm_pb").StopRequest;
316
321
  readonly O: typeof import("../gen/component/arm/v1/arm_pb").StopResponse;
317
322
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
318
- };
323
+ }; /** Options required to dial a robot. */
319
324
  readonly isMoving: {
320
325
  readonly name: "IsMoving";
321
326
  readonly I: typeof import("../gen/component/arm/v1/arm_pb").IsMovingRequest;
@@ -385,7 +390,10 @@ export declare class RobotClient extends EventDispatcher implements Robot {
385
390
  readonly name: "IsMoving";
386
391
  readonly I: typeof import("../gen/component/base/v1/base_pb").IsMovingRequest;
387
392
  readonly O: typeof import("../gen/component/base/v1/base_pb").IsMovingResponse;
388
- readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
393
+ readonly kind: import("@bufbuild/protobuf").MethodKind.Unary; /**
394
+ * Set timeout in milliseconds for dialing. Default is defined by
395
+ * DIAL_TIMEOUT. A value of 0 disables the timeout.
396
+ */
389
397
  };
390
398
  readonly doCommand: {
391
399
  readonly name: "DoCommand";
@@ -437,7 +445,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
437
445
  readonly pWMFrequency: {
438
446
  readonly name: "PWMFrequency";
439
447
  readonly I: typeof import("../gen/component/board/v1/board_pb").PWMFrequencyRequest;
440
- readonly O: typeof import("../gen/component/board/v1/board_pb").PWMFrequencyResponse; /** @default 10. */
448
+ readonly O: typeof import("../gen/component/board/v1/board_pb").PWMFrequencyResponse;
441
449
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
442
450
  };
443
451
  readonly setPWMFrequency: {
@@ -570,6 +578,12 @@ export declare class RobotClient extends EventDispatcher implements Robot {
570
578
  readonly O: typeof import("../gen/common/v1/common_pb").DoCommandResponse;
571
579
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
572
580
  };
581
+ readonly getKinematics: {
582
+ readonly name: "GetKinematics";
583
+ readonly I: typeof import("../gen/common/v1/common_pb").GetKinematicsRequest;
584
+ readonly O: typeof import("../gen/common/v1/common_pb").GetKinematicsResponse;
585
+ readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
586
+ };
573
587
  readonly getGeometries: {
574
588
  readonly name: "GetGeometries";
575
589
  readonly I: typeof import("../gen/common/v1/common_pb").GetGeometriesRequest;
@@ -630,10 +644,11 @@ export declare class RobotClient extends EventDispatcher implements Robot {
630
644
  };
631
645
  readonly doCommand: {
632
646
  readonly name: "DoCommand";
633
- readonly I: typeof import("../gen/common/v1/common_pb").DoCommandRequest; /** @default Number.POSITIVE_INFINITY */
647
+ readonly I: typeof import("../gen/common/v1/common_pb").DoCommandRequest;
634
648
  readonly O: typeof import("../gen/common/v1/common_pb").DoCommandResponse;
635
649
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
636
650
  };
651
+ /** @default Number.POSITIVE_INFINITY */
637
652
  readonly getGeometries: {
638
653
  readonly name: "GetGeometries";
639
654
  readonly I: typeof import("../gen/common/v1/common_pb").GetGeometriesRequest;
@@ -706,7 +721,6 @@ export declare class RobotClient extends EventDispatcher implements Robot {
706
721
  };
707
722
  readonly getAccuracy: {
708
723
  readonly name: "GetAccuracy";
709
- /** Options required to dial a robot via gRPC. */
710
724
  readonly I: typeof import("../gen/component/movementsensor/v1/movementsensor_pb").GetAccuracyRequest;
711
725
  readonly O: typeof import("../gen/component/movementsensor/v1/movementsensor_pb").GetAccuracyResponse;
712
726
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
@@ -838,10 +852,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
838
852
  readonly name: "SetRPM";
839
853
  readonly I: typeof import("../gen/component/motor/v1/motor_pb").SetRPMRequest;
840
854
  readonly O: typeof import("../gen/component/motor/v1/motor_pb").SetRPMResponse;
841
- readonly kind: import("@bufbuild/protobuf").MethodKind.Unary; /**
842
- * Set timeout in milliseconds for dialing. Default is defined by
843
- * DIAL_TIMEOUT. A value of 0 disables the timeout.
844
- */
855
+ readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
845
856
  };
846
857
  readonly resetZeroPosition: {
847
858
  readonly name: "ResetZeroPosition";
@@ -940,7 +951,6 @@ export declare class RobotClient extends EventDispatcher implements Robot {
940
951
  };
941
952
  readonly getPaths: {
942
953
  readonly name: "GetPaths";
943
- /** Options required to dial a robot via gRPC. */
944
954
  readonly I: typeof import("../gen/service/navigation/v1/navigation_pb").GetPathsRequest;
945
955
  readonly O: typeof import("../gen/service/navigation/v1/navigation_pb").GetPathsResponse;
946
956
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
@@ -1117,9 +1127,8 @@ export declare class RobotClient extends EventDispatcher implements Robot {
1117
1127
  };
1118
1128
  readonly getGeometries: {
1119
1129
  readonly name: "GetGeometries";
1120
- /** @default 10. */
1121
1130
  readonly I: typeof import("../gen/common/v1/common_pb").GetGeometriesRequest;
1122
- readonly O: typeof import("../gen/common/v1/common_pb").GetGeometriesResponse;
1131
+ readonly O: typeof import("../gen/common/v1/common_pb").GetGeometriesResponse; /** @default 10. */
1123
1132
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
1124
1133
  };
1125
1134
  };
@@ -1146,7 +1155,6 @@ export declare class RobotClient extends EventDispatcher implements Robot {
1146
1155
  readonly kind: import("@bufbuild/protobuf").MethodKind.ServerStreaming;
1147
1156
  };
1148
1157
  readonly getProperties: {
1149
- /** Options required to dial a robot via WebRTC. */
1150
1158
  readonly name: "GetProperties";
1151
1159
  readonly I: typeof import("../gen/service/slam/v1/slam_pb").GetPropertiesRequest;
1152
1160
  readonly O: typeof import("../gen/service/slam/v1/slam_pb").GetPropertiesResponse;
@@ -1194,7 +1202,12 @@ export declare class RobotClient extends EventDispatcher implements Robot {
1194
1202
  private get clientTransport();
1195
1203
  private dialWebRTC;
1196
1204
  private dialDirect;
1197
- dial(conf: DialConf): Promise<this>;
1205
+ private resetDialing;
1206
+ dial(conf: DialConf): Promise<RobotClient>;
1207
+ private createBackOffOpts;
1208
+ private tryWebRTCDial;
1209
+ private tryDirectDial;
1210
+ private performDial;
1198
1211
  disconnect(): Promise<void>;
1199
1212
  isConnected(): boolean;
1200
1213
  connect({ creds, priority, dialTimeout, }?: ConnectOptions): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.56.0",
3
+ "version": "0.57.0",
4
4
  "description": "",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",
@@ -29,15 +29,17 @@
29
29
  "lint": "concurrently -g npm:lint:*",
30
30
  "lint:prettier": "npm run _prettier -- --check",
31
31
  "lint:eslint": "npm run _eslint",
32
- "test": "vitest run",
33
- "test:watch": "vitest",
32
+ "test": "vitest run --config vite.config.ts",
33
+ "test:watch": "vitest --config vite.config.ts",
34
34
  "typecheck": "concurrently -g npm:typecheck:*",
35
35
  "typecheck:src": "tsc",
36
36
  "typecheck:node": "tsc --project tsconfig.node.json",
37
- "e2e:playwright": "playwright test",
38
- "e2e:playwright-ui": "playwright test --ui",
39
- "e2e:playwright-debug": "playwright test --debug",
40
- "e2e:playwright-install": "playwright install",
37
+ "e2e:browser": "playwright test",
38
+ "e2e:browser-ui": "playwright test --ui",
39
+ "e2e:browser-debug": "playwright test --debug",
40
+ "e2e:browser-install": "playwright install --with-deps",
41
+ "e2e:node": "vitest run --config e2e/vite.config.ts",
42
+ "e2e:node-watch": "vitest --config e2e/vite.config.ts",
41
43
  "e2e:test-harness": "vite e2e",
42
44
  "_eslint": "eslint '.*.cjs' '**/*.{ts,js,cjs}'",
43
45
  "_prettier": "prettier '.*.cjs' '**/*.{ts,js,cjs}'"
@@ -60,6 +62,7 @@
60
62
  },
61
63
  "devDependencies": {
62
64
  "@bufbuild/buf": "^1.15.0-1",
65
+ "@connectrpc/connect-node": "1.6.1",
63
66
  "@playwright/test": "1.56.1",
64
67
  "@types/node": "^20.11.10",
65
68
  "@typescript-eslint/eslint-plugin": "^6.17.0",
@@ -67,6 +70,7 @@
67
70
  "@viamrobotics/eslint-config": "^0.4.0",
68
71
  "@viamrobotics/prettier-config": "^0.3.4",
69
72
  "@viamrobotics/typescript-config": "^0.1.0",
73
+ "@vitest/ui": "^1.6.1",
70
74
  "concurrently": "^8.0.1",
71
75
  "copyfiles": "^2.4.1",
72
76
  "eslint": "^8.56.0",
@@ -1,5 +0,0 @@
1
- import type { Credential, AccessToken } from '../main';
2
- export declare const testCredential: Credential;
3
- export declare const differentCredential: Credential;
4
- export declare const testAccessToken: AccessToken;
5
- export declare const differentAccessToken: AccessToken;
@@ -1,4 +0,0 @@
1
- export declare const TEST_URL = "http://base.test";
2
- export declare const TEST_HOST = "test-host";
3
- export declare const TEST_AUTH_ENTITY = "test-entity";
4
- export declare const TEST_SIGNALING_ADDRESS = "https://signaling.test";
@@ -1,2 +0,0 @@
1
- import type { Transport } from '@connectrpc/connect';
2
- export declare const createMockTransport: () => Transport;
@@ -1,2 +0,0 @@
1
- export declare const createMockPeerConnection: (closeFn?: import("vitest").Mock<any, any>, addEventListenerFn?: import("vitest").Mock<any, any>, removeEventListenerFn?: import("vitest").Mock<any, any>, iceConnectionState?: RTCIceConnectionState) => RTCPeerConnection;
2
- export declare const createMockDataChannel: (closeFn?: import("vitest").Mock<any, any>, addEventListenerFn?: import("vitest").Mock<any, any>, removeEventListenerFn?: import("vitest").Mock<any, any>, readyState?: RTCDataChannelState) => RTCDataChannel;
@@ -1,4 +0,0 @@
1
- import type { DialConf } from '../../main';
2
- export declare const baseDialConfig: DialConf;
3
- export declare const withDisableSessions: DialConf;
4
- export declare const withNoReconnect: DialConf;
@@ -1,5 +0,0 @@
1
- import { type Transport } from '@connectrpc/connect';
2
- import type { PartialMessage } from '@bufbuild/protobuf';
3
- import type { Operation } from '../../gen/robot/v1/robot_pb';
4
- import type { ResourceName } from '../../gen/common/v1/common_pb';
5
- export declare const createMockRobotServiceTransport: (resources?: PartialMessage<ResourceName>[], operations?: PartialMessage<Operation>[]) => Transport;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import type { DialOptions } from '../dial';
2
- export { TEST_URL, TEST_HOST } from '../../__fixtures__/test-constants';
3
- export declare const withAccessToken: DialOptions;
4
- export declare const withCredentials: DialOptions;
5
- export declare const withSignalingAccessToken: DialOptions;
6
- export declare const withSignalingCredentials: DialOptions;
@@ -1,8 +0,0 @@
1
- export declare const withICEServers: {
2
- disableTrickleICE: false;
3
- rtcConfig: RTCConfiguration;
4
- additionalSdpFields: {
5
- 'custom-field': string;
6
- 'another-field': number;
7
- };
8
- };
@@ -1,3 +0,0 @@
1
- import { SignalingExchange } from '../signaling-exchange';
2
- import type { DialWebRTCOptions } from '../dial';
3
- export declare const createMockSignalingExchange: (transport?: import("@connectrpc/connect").Transport, peerConnection?: RTCPeerConnection, dataChannel?: RTCDataChannel, webrtcOptions?: DialWebRTCOptions) => SignalingExchange;
@@ -1 +0,0 @@
1
- export {};