@viamrobotics/sdk 0.41.0 → 0.42.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/README.md CHANGED
@@ -35,8 +35,19 @@ To use this SDK with node, read the [documentation](https://github.com/viamrobot
35
35
 
36
36
  To use this SDK with React Native, read the [documentation](https://github.com/viamrobotics/viam-typescript-sdk/blob/main/ReactNative.md) or view the [example](https://github.com/viamrobotics/viam-typescript-sdk/tree/main/examples/react-native/)
37
37
 
38
+ ## Offline Mode
39
+
40
+ > [!WARNING]
41
+ > Using the typescript SDK in offline mode necessitates disabling TLS verification and so should be done with caution.
42
+
43
+ To use the browser on a local network with limited-or-no internet, follow these instructions:
44
+ ```
45
+ 1. start viam-server with the `-no-tls` flag
46
+ 2. set the signaling server in typescript to `http://{HOST}.local:8080`
47
+ ```
48
+
38
49
  ## License
39
50
 
40
- Copyright 2022-2024 Viam Inc.
51
+ Copyright 2022-2025 Viam Inc.
41
52
 
42
53
  Apache 2.0 - See [LICENSE](https://github.com/viamrobotics/viam-typescript-sdk/blob/main/LICENSE) file
@@ -1 +1 @@
1
- export declare const apiVersion = "v0.1.432";
1
+ export declare const apiVersion = "v0.1.436";
@@ -574,6 +574,15 @@ export declare class AppClient {
574
574
  *
575
575
  * ```ts
576
576
  * const robotPart = await appClient.getRobotPart('<YOUR-ROBOT-PART-ID>');
577
+ * // Get the part's address
578
+ * const address = robotPart.part.fqdn;
579
+ * // Check if machine is live (last access time less than 10 sec ago)
580
+ * if (
581
+ * Date.now() - Number(robotPart.part.lastAccess.seconds) * 1000 <=
582
+ * 10000
583
+ * ) {
584
+ * console.log('Machine is live');
585
+ * }
577
586
  * ```
578
587
  *
579
588
  * For more information, see [App
@@ -1,7 +1,9 @@
1
1
  import { type JsonValue } from '@bufbuild/protobuf';
2
- import { type Transport } from '@connectrpc/connect';
3
- import { BinaryID, CaptureMetadata, Filter, Order } from '../gen/app/data/v1/data_pb';
2
+ import { type PromiseClient, type Transport } from '@connectrpc/connect';
3
+ import { BinaryID, CaptureMetadata, Filter, Order, TabularDataSource } from '../gen/app/data/v1/data_pb';
4
4
  import type { Dataset as PBDataset } from '../gen/app/dataset/v1/dataset_pb';
5
+ import { DataPipelinesService } from '../gen/app/datapipelines/v1/data_pipelines_connect';
6
+ import { DataPipeline, DataPipelineRun } from '../gen/app/datapipelines/v1/data_pipelines_pb';
5
7
  export type FilterOptions = Partial<Filter> & {
6
8
  endTime?: Date;
7
9
  startTime?: Date;
@@ -35,6 +37,7 @@ export declare class DataClient {
35
37
  private dataClient;
36
38
  private datasetClient;
37
39
  private dataSyncClient;
40
+ private dataPipelinesClient;
38
41
  constructor(transport: Transport);
39
42
  /**
40
43
  * Obtain unified tabular data and metadata from the specified data source.
@@ -94,13 +97,7 @@ export declare class DataClient {
94
97
  * @example
95
98
  *
96
99
  * ```ts
97
- * type JsonValue =
98
- * | string
99
- * | number
100
- * | boolean
101
- * | null
102
- * | JsonValue[]
103
- * | { [key: string]: JsonValue };
100
+ * // {@link JsonValue} is imported from @bufbuild/protobuf
104
101
  * const mqlQuery: Record<string, JsonValue>[] = [
105
102
  * {
106
103
  * $match: {
@@ -124,10 +121,12 @@ export declare class DataClient {
124
121
  * @param organizationId The ID of the organization that owns the data
125
122
  * @param query The MQL query to run as a list of BSON documents
126
123
  * @param useRecentData Whether to query blob storage or your recent data
127
- * store. Defaults to false
124
+ * store. Defaults to false. Deprecated - use dataSource instead.
125
+ * @param dataSource The data source to query. Defaults to the standard data
126
+ * source.
128
127
  * @returns An array of data objects
129
128
  */
130
- tabularDataByMQL(organizationId: string, query: Uint8Array[] | Record<string, Date | JsonValue>[], useRecentData?: boolean): Promise<(Object | any[])[]>;
129
+ tabularDataByMQL(organizationId: string, query: Uint8Array[] | Record<string, Date | JsonValue>[], useRecentData?: boolean, tabularDataSource?: TabularDataSource): Promise<(Object | any[])[]>;
131
130
  /**
132
131
  * Filter and get a page of tabular data. The returned metadata might be empty
133
132
  * if the metadata index of the data is out of the bounds of the returned
@@ -778,6 +777,129 @@ export declare class DataClient {
778
777
  * captured data was over a year ago
779
778
  */
780
779
  getLatestTabularData(partId: string, resourceName: string, resourceSubtype: string, methodName: string): Promise<[Date, Date, Record<string, JsonValue>] | null>;
780
+ /**
781
+ * List all data pipelines for an organization.
782
+ *
783
+ * @example
784
+ *
785
+ * ```ts
786
+ * const pipelines = await dataClient.listDataPipelines(
787
+ * '123abc45-1234-5678-90ab-cdef12345678'
788
+ * );
789
+ * ```
790
+ *
791
+ * @param organizationId The ID of the organization
792
+ * @returns The list of data pipelines
793
+ */
794
+ listDataPipelines(organizationId: string): Promise<DataPipeline[]>;
795
+ /**
796
+ * Get a data pipeline configuration by its ID.
797
+ *
798
+ * @example
799
+ *
800
+ * ```ts
801
+ * const pipeline = await dataClient.getPipeline(
802
+ * '123abc45-1234-5678-90ab-cdef12345678'
803
+ * );
804
+ * ```
805
+ *
806
+ * @param pipelineId The ID of the data pipeline
807
+ * @returns The data pipeline configuration or null if it does not exist
808
+ */
809
+ getDataPipeline(pipelineId: string): Promise<DataPipeline | null>;
810
+ /**
811
+ * Creates a new data pipeline using the given query and schedule.
812
+ *
813
+ * @example
814
+ *
815
+ * ```ts
816
+ * // {@link JsonValue} is imported from @bufbuild/protobuf
817
+ * const mqlQuery: Record<string, JsonValue>[] = [
818
+ * {
819
+ * $match: {
820
+ * component_name: 'sensor-1',
821
+ * },
822
+ * },
823
+ * {
824
+ * $limit: 5,
825
+ * },
826
+ * ];
827
+ *
828
+ * const pipelineId = await dataClient.createDataPipeline(
829
+ * '123abc45-1234-5678-90ab-cdef12345678',
830
+ * 'my-pipeline',
831
+ * mqlQuery,
832
+ * '0 0 * * *'
833
+ * );
834
+ * ```
835
+ *
836
+ * @param organizationId The ID of the organization
837
+ * @param name The name of the data pipeline
838
+ * @param query The MQL query to run as a list of BSON documents
839
+ * @param schedule The schedule to run the query on (cron expression)
840
+ * @returns The ID of the created data pipeline
841
+ */
842
+ createDataPipeline(organizationId: string, name: string, query: Uint8Array[] | Record<string, Date | JsonValue>[], schedule: string): Promise<string>;
843
+ /**
844
+ * Deletes a data pipeline by its ID.
845
+ *
846
+ * @example
847
+ *
848
+ * ```ts
849
+ * await dataClient.deleteDataPipeline(
850
+ * '123abc45-1234-5678-90ab-cdef12345678'
851
+ * );
852
+ * ```
853
+ *
854
+ * @param pipelineId The ID of the data pipeline
855
+ */
856
+ deleteDataPipeline(pipelineId: string): Promise<void>;
857
+ /**
858
+ * List all runs of a data pipeline.
859
+ *
860
+ * @example
861
+ *
862
+ * ```ts
863
+ * const page = await dataClient.listDataPipelineRuns(
864
+ * '123abc45-1234-5678-90ab-cdef12345678'
865
+ * );
866
+ * page.runs.forEach((run) => {
867
+ * console.log(run);
868
+ * });
869
+ * page = await page.nextPage();
870
+ * page.runs.forEach((run) => {
871
+ * console.log(run);
872
+ * });
873
+ * ```
874
+ *
875
+ * @param pipelineId The ID of the data pipeline
876
+ * @param pageSize The number of runs to return per page
877
+ * @returns A page of data pipeline runs
878
+ */
879
+ listDataPipelineRuns(pipelineId: string, pageSize?: number): Promise<ListDataPipelineRunsPage>;
880
+ }
881
+ export declare class ListDataPipelineRunsPage {
882
+ private readonly dataPipelinesClient;
883
+ private readonly pipelineId;
884
+ readonly runs: DataPipelineRun[];
885
+ private readonly pageSize?;
886
+ private readonly nextPageToken?;
887
+ constructor(dataPipelinesClient: PromiseClient<typeof DataPipelinesService>, pipelineId: string, runs?: DataPipelineRun[], pageSize?: number | undefined, nextPageToken?: string | undefined);
888
+ /**
889
+ * Retrieves the next page of data pipeline runs.
890
+ *
891
+ * @example
892
+ *
893
+ * ```ts
894
+ * const page = await dataClient.listDataPipelineRuns(
895
+ * '123abc45-1234-5678-90ab-cdef12345678'
896
+ * );
897
+ * const nextPage = await page.nextPage();
898
+ * ```
899
+ *
900
+ * @returns A page of data pipeline runs
901
+ */
902
+ nextPage(): Promise<ListDataPipelineRunsPage>;
781
903
  }
782
904
  export { type BinaryID, type Order } from '../gen/app/data/v1/data_pb';
783
905
  export { type UploadMetadata } from '../gen/app/datasync/v1/data_sync_pb';
@@ -872,9 +872,9 @@ export declare class UpdateOrganizationNamespaceRequest extends Message<UpdateOr
872
872
  organizationId: string;
873
873
 
874
874
  /**
875
- * @generated from field: optional string new_public_namespace = 2;
875
+ * @generated from field: string new_public_namespace = 2;
876
876
  */
877
- newPublicNamespace?: string;
877
+ newPublicNamespace: string;
878
878
 
879
879
  constructor(data?: PartialMessage<UpdateOrganizationNamespaceRequest>);
880
880
 
@@ -5644,6 +5644,13 @@ export declare class ModuleVersion extends Message<ModuleVersion> {
5644
5644
  */
5645
5645
  markdownDescription?: string;
5646
5646
 
5647
+ /**
5648
+ * A list of applications associated with the module
5649
+ *
5650
+ * @generated from field: repeated viam.app.v1.App apps = 7;
5651
+ */
5652
+ apps: App[];
5653
+
5647
5654
  constructor(data?: PartialMessage<ModuleVersion>);
5648
5655
 
5649
5656
  static readonly runtime: typeof proto3;
@@ -5699,6 +5706,13 @@ export declare class ModuleMetadata extends Message<ModuleMetadata> {
5699
5706
  */
5700
5707
  markdownDescription?: string;
5701
5708
 
5709
+ /**
5710
+ * A list of applications associated with the module
5711
+ *
5712
+ * @generated from field: repeated viam.app.v1.App apps = 6;
5713
+ */
5714
+ apps: App[];
5715
+
5702
5716
  constructor(data?: PartialMessage<ModuleMetadata>);
5703
5717
 
5704
5718
  static readonly runtime: typeof proto3;
@@ -6640,6 +6654,13 @@ export declare class UpdateModuleMetadata extends Message<UpdateModuleMetadata>
6640
6654
  */
6641
6655
  entrypoint: string;
6642
6656
 
6657
+ /**
6658
+ * A list of applications associated with the module
6659
+ *
6660
+ * @generated from field: repeated viam.app.v1.App apps = 3;
6661
+ */
6662
+ apps: App[];
6663
+
6643
6664
  constructor(data?: PartialMessage<UpdateModuleMetadata>);
6644
6665
 
6645
6666
  static readonly runtime: typeof proto3;
@@ -7048,6 +7069,13 @@ export declare class Module extends Message<Module> {
7048
7069
  */
7049
7070
  markdownDescription?: string;
7050
7071
 
7072
+ /**
7073
+ * A list of applications associated with the module
7074
+ *
7075
+ * @generated from field: repeated viam.app.v1.App apps = 15;
7076
+ */
7077
+ apps: App[];
7078
+
7051
7079
  constructor(data?: PartialMessage<Module>);
7052
7080
 
7053
7081
  static readonly runtime: typeof proto3;
@@ -7109,6 +7137,13 @@ export declare class VersionHistory extends Message<VersionHistory> {
7109
7137
  */
7110
7138
  markdownDescription?: string;
7111
7139
 
7140
+ /**
7141
+ * A list of applications associated with the module
7142
+ *
7143
+ * @generated from field: repeated viam.app.v1.App apps = 7;
7144
+ */
7145
+ apps: App[];
7146
+
7112
7147
  constructor(data?: PartialMessage<VersionHistory>);
7113
7148
 
7114
7149
  static readonly runtime: typeof proto3;
@@ -306,8 +306,8 @@ export declare class TransformPoseResponse extends Message<TransformPoseResponse
306
306
  */
307
307
  export declare class TransformPCDRequest extends Message<TransformPCDRequest> {
308
308
  /**
309
- * the point clouds to transform. This should be in the PCD format
310
- * encoded into bytes: https://pointclouds.org/documentation/tutorials/pcd_file_format.html
309
+ * the point clouds to transform. This should be in the PCD format,
310
+ * [encoded into bytes](https://pointclouds.org/documentation/tutorials/pcd_file_format.html).
311
311
  *
312
312
  * @generated from field: bytes point_cloud_pcd = 1;
313
313
  */
@@ -155,8 +155,8 @@ export declare class GetPointCloudMapResponse extends Message<GetPointCloudMapRe
155
155
  * format where XY is the ground plane and positive Z is up, following
156
156
  * the Right Hand Rule.
157
157
  *
158
- * Read more about the pointcloud format here:
159
- * https://pointclouds.org/documentation/tutorials/pcd_file_format.html
158
+ * Read more about the pointcloud format
159
+ * [in the docs](https://pointclouds.org/documentation/tutorials/pcd_file_format.html)
160
160
  *
161
161
  * Viam expects pointcloud data with fields "x y z" or "x y z rgb", and for
162
162
  * this to be specified in the pointcloud header in the FIELDS entry. If color