@viamrobotics/sdk 0.65.0 → 0.66.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 (36) hide show
  1. package/dist/components/arm/client.d.ts +1 -1
  2. package/dist/components/audio-in/audio-in.d.ts +1 -1
  3. package/dist/components/audio-in/client.d.ts +2 -2
  4. package/dist/components/audio-out/audio-out.d.ts +1 -1
  5. package/dist/components/audio-out/client.d.ts +2 -2
  6. package/dist/components/base/client.d.ts +1 -1
  7. package/dist/components/board/client.d.ts +1 -1
  8. package/dist/components/button/client.d.ts +1 -1
  9. package/dist/components/camera/client.d.ts +1 -1
  10. package/dist/components/encoder/client.d.ts +1 -1
  11. package/dist/components/gantry/client.d.ts +1 -1
  12. package/dist/components/generic/client.d.ts +1 -1
  13. package/dist/components/gripper/client.d.ts +1 -1
  14. package/dist/components/input-controller/client.d.ts +1 -1
  15. package/dist/components/motor/client.d.ts +1 -1
  16. package/dist/components/movement-sensor/client.d.ts +1 -1
  17. package/dist/components/pose-tracker/client.d.ts +1 -1
  18. package/dist/components/power-sensor/client.d.ts +1 -1
  19. package/dist/components/sensor/client.d.ts +1 -1
  20. package/dist/components/servo/client.d.ts +1 -1
  21. package/dist/components/switch/client.d.ts +1 -1
  22. package/dist/main.es.js +21 -19
  23. package/dist/main.umd.js +2 -2
  24. package/dist/services/data-manager/client.d.ts +1 -1
  25. package/dist/services/discovery/client.d.ts +1 -1
  26. package/dist/services/generic/client.d.ts +1 -1
  27. package/dist/services/motion/client.d.ts +1 -1
  28. package/dist/services/navigation/client.d.ts +1 -1
  29. package/dist/services/slam/client.d.ts +1 -1
  30. package/dist/services/video/client.d.ts +1 -1
  31. package/dist/services/video/video.d.ts +1 -1
  32. package/dist/services/vision/client.d.ts +1 -1
  33. package/dist/services/world-state-store/client.d.ts +1 -1
  34. package/dist/types.d.ts +10 -5
  35. package/dist/utils.d.ts +23 -2
  36. package/package.json +1 -1
@@ -49,7 +49,7 @@ export declare class DataManagerClient implements DataManager {
49
49
  * @param command - The command to do.
50
50
  * @param callOptions - Call options for the command.
51
51
  */
52
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
52
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
53
53
  /**
54
54
  * Uploads binary data to specified datasets.
55
55
  *
@@ -15,5 +15,5 @@ export declare class DiscoveryClient implements Discovery {
15
15
  callOptions: CallOptions;
16
16
  constructor(client: RobotClient, name: string, options?: Options);
17
17
  discoverResources(extra?: {}, callOptions?: CallOptions): Promise<import("../../gen/app/v1/robot_pb").ComponentConfig[]>;
18
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
18
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
19
19
  }
@@ -14,5 +14,5 @@ export declare class GenericClient implements Generic {
14
14
  private readonly options;
15
15
  callOptions: CallOptions;
16
16
  constructor(client: RobotClient, name: string, options?: Options);
17
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
17
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
18
18
  }
@@ -23,5 +23,5 @@ export declare class MotionClient implements Motion {
23
23
  listPlanStatuses(onlyActivePlans?: boolean, extra?: {}, callOptions?: CallOptions): Promise<import("../../gen/service/motion/v1/motion_pb").ListPlanStatusesResponse>;
24
24
  /** @deprecated Use `RobotClient.getPose` instead. */
25
25
  getPose(componentName: string, destinationFrame: string, supplementalTransforms: Transform[], extra?: {}, callOptions?: CallOptions): Promise<import("../../gen/common/v1/common_pb").PoseInFrame>;
26
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
26
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
27
27
  }
@@ -24,5 +24,5 @@ export declare class NavigationClient implements Navigation {
24
24
  getObstacles(extra?: {}, callOptions?: CallOptions): Promise<import("../../gen/common/v1/common_pb").GeoGeometry[]>;
25
25
  getPaths(extra?: {}, callOptions?: CallOptions): Promise<import("../../gen/service/navigation/v1/navigation_pb").Path[]>;
26
26
  getProperties(callOptions?: CallOptions): Promise<import("../../gen/service/navigation/v1/navigation_pb").GetPropertiesResponse>;
27
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
27
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
28
28
  }
@@ -18,5 +18,5 @@ export declare class SlamClient implements Slam {
18
18
  getPointCloudMap(returnEditedMap?: boolean, callOptions?: CallOptions): Promise<Uint8Array>;
19
19
  getInternalState(callOptions?: CallOptions): Promise<Uint8Array>;
20
20
  getProperties(callOptions?: CallOptions): Promise<import("../../gen/service/slam/v1/slam_pb").GetPropertiesResponse>;
21
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
21
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
22
22
  }
@@ -16,5 +16,5 @@ export declare class VideoClient implements Video {
16
16
  callOptions: CallOptions;
17
17
  constructor(client: RobotClient, name: string, options?: Options);
18
18
  getVideo(startTimestamp?: Date, endTimestamp?: Date, videoCodec?: string, videoContainer?: string, extra?: {}, callOptions?: CallOptions): AsyncIterable<VideoChunk>;
19
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
19
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
20
20
  }
@@ -40,5 +40,5 @@ export interface Video extends Resource {
40
40
  * @param command - The command to execute.
41
41
  * @returns The result of the command.
42
42
  */
43
- doCommand: (command: Struct) => Promise<JsonValue>;
43
+ doCommand: (command: Struct | Record<string, JsonValue>) => Promise<JsonValue>;
44
44
  }
@@ -33,5 +33,5 @@ export declare class VisionClient implements Vision {
33
33
  objectPointClouds: import("../../gen/common/v1/common_pb").PointCloudObject[];
34
34
  extra: Struct | undefined;
35
35
  }>;
36
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
36
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
37
37
  }
@@ -18,5 +18,5 @@ export declare class WorldStateStoreClient implements WorldStateStore {
18
18
  listUUIDs(extra?: {}, callOptions?: CallOptions): Promise<string[]>;
19
19
  getTransform(uuid: string, extra?: {}, callOptions?: CallOptions): Promise<import("./types").TransformWithUUID>;
20
20
  streamTransformChanges(extra?: {}, callOptions?: CallOptions): AsyncGenerator<TransformChangeEvent, void>;
21
- doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
21
+ doCommand(command: Struct | Record<string, JsonValue>, callOptions?: CallOptions): Promise<JsonValue>;
22
22
  }
package/dist/types.d.ts CHANGED
@@ -13,18 +13,23 @@ export interface Resource {
13
13
  * @example
14
14
  *
15
15
  * ```ts
16
+ * // Plain object (recommended)
17
+ * const result = await resource.doCommand({
18
+ * myCommand: { key: 'value' },
19
+ * });
20
+ *
21
+ * // Struct (still supported)
16
22
  * import { Struct } from '@viamrobotics/sdk';
17
23
  *
18
24
  * const result = await resource.doCommand(
19
- * Struct.fromJson({
20
- * myCommand: { key: 'value' },
21
- * })
25
+ * Struct.fromJson({ myCommand: { key: 'value' } })
22
26
  * );
23
27
  * ```
24
28
  *
25
- * @param command - The command to execute.
29
+ * @param command - The command to execute. Accepts either a {@link Struct} or
30
+ * a plain object, which will be converted automatically.
26
31
  */
27
- doCommand(command: Struct): Promise<JsonValue>;
32
+ doCommand(command: Struct | Record<string, JsonValue>): Promise<JsonValue>;
28
33
  }
29
34
  import * as commonApi from './gen/common/v1/common_pb';
30
35
  export type Capsule = PlainMessage<commonApi.Capsule>;
package/dist/utils.d.ts CHANGED
@@ -5,8 +5,29 @@ import type { Options, Vector3 } from './types';
5
5
  import type { Frame } from './gen/app/v1/robot_pb';
6
6
  export declare const clientHeaders: Headers;
7
7
  type doCommand = (request: PartialMessage<DoCommandRequest>, options?: CallOptions) => Promise<DoCommandResponse>;
8
- /** Send/Receive an arbitrary command using a resource client */
9
- export declare const doCommandFromClient: (doCommander: doCommand, name: string, command: Struct, options?: Options, callOptions?: CallOptions) => Promise<JsonValue>;
8
+ /**
9
+ * Send/Receive an arbitrary command using a resource client.
10
+ *
11
+ * @example
12
+ *
13
+ * ```ts
14
+ * // Plain object (recommended)
15
+ * const result = await doCommandFromClient(doFn, name, {
16
+ * myCommand: { key: 'value' },
17
+ * });
18
+ *
19
+ * // Struct (still supported)
20
+ * const result = await doCommandFromClient(
21
+ * doFn,
22
+ * name,
23
+ * Struct.fromJson({ myCommand: { key: 'value' } })
24
+ * );
25
+ * ```
26
+ *
27
+ * @param command - The command to execute. Accepts either a {@link Struct} or a
28
+ * plain object, which will be converted automatically.
29
+ */
30
+ export declare const doCommandFromClient: (doCommander: doCommand, name: string, command: Struct | Record<string, JsonValue>, options?: Options, callOptions?: CallOptions) => Promise<JsonValue>;
10
31
  export declare const enableDebugLogging: (key?: string, opts?: CallOptions) => CallOptions;
11
32
  export declare const disableDebugLogging: (opts: CallOptions) => void;
12
33
  export declare const addMetadata: (key: string, value: string, opts?: CallOptions) => CallOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.65.0",
3
+ "version": "0.66.0",
4
4
  "description": "",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",