import { type JsonValue, type PartialMessage } from '@bufbuild/protobuf'; import { type Client, type Transport } from '@connectrpc/connect'; import { BinaryID, CaptureMetadata, Filter, Index, IndexableCollection, Order, TabularDataSource, TabularDataSourceType, DeleteTabularFilter } from '../gen/app/data/v1/data_pb'; import { DataPipelinesService } from '../gen/app/datapipelines/v1/data_pipelines_connect'; import { DataPipeline, DataPipelineRun } from '../gen/app/datapipelines/v1/data_pipelines_pb'; import type { Dataset as PBDataset } from '../gen/app/dataset/v1/dataset_pb'; export type FilterOptions = Partial & { endTime?: Date; startTime?: Date; tags?: string[]; }; interface TabularData { data?: JsonValue; metadata?: CaptureMetadata; timeRequested?: Date; timeReceived?: Date; } interface TabularDataPoint { partId: string; resourceName: string; resourceSubtype: string; methodName: string; timeCaptured: Date; organizationId: string; locationId: string; robotName: string; robotId: string; partName: string; methodParameters: JsonValue; tags: string[]; payload: JsonValue; } /** Optional parameters for uploading files */ export interface FileUploadOptions { /** * Optional type of the component associated with the file (for example, * "movement_sensor"). */ componentType?: string; /** Optional name of the component associated with the file. */ componentName?: string; /** Optional name of the method associated with the file. */ methodName?: string; /** * Optional name of the file. The empty string `""` will be assigned as the * file name if one isn't provided. */ fileName?: string; /** * Optional file extension. The empty string `""` will be assigned as the file * extension if one isn't provided. Files with a `.jpeg`, `.jpg`, or `.png` * extension will be saved to the **Images** tab. */ fileExtension?: string; /** * Optional list of tags to allow for tag-based filtering when retrieving * data. */ tags?: string[]; /** Optional list of datasets to add the data to. */ datasetIds?: string[]; } /** Optional parameters for uploading binary sensor data. */ export interface BinaryDataCaptureUploadOptions { /** * Optional MIME type of the binary data (for example, "image/jpeg"). * * If provided, the backend will use this value. Otherwise, it may derive the * MIME type from the file extension. */ mimeType?: string; /** * Optional file extension of the binary data including the period, for * example ".jpg", ".png", or ".pcd". */ fileExtension?: string; /** * Optional list of tags to allow for tag-based filtering when retrieving * data. */ tags?: string[]; /** Optional list of dataset IDs to add the data to. */ datasetIds?: string[]; } export type Dataset = Partial & { created?: Date; }; export declare class DataClient { private dataClient; private datasetClient; private dataSyncClient; private dataPipelinesClient; static readonly UPLOAD_CHUNK_SIZE: number; constructor(transport: Transport); /** * Obtain unified tabular data and metadata from the specified data source. * * @example * * ```ts * const data = await dataClient.exportTabularData( * '123abc45-1234-5678-90ab-cdef12345678', * 'my-sensor', * 'rdk:component:sensor', * 'Readings', * new Date('2025-03-25'), * new Date('2024-03-27') * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#exporttabulardata). * * @param partId The ID of the part that owns the data * @param resourceName The name of the requested resource that captured the * data * @param resourceSubtype The subtype of the requested resource that captured * the data * @param methodName The data capture method name * @param startTime Optional start time (`Date` object) for requesting a * specific range of data * @param endTime Optional end time (`Date` object) for requesting a specific * range of data * @returns An array of unified tabular data and metadata. */ exportTabularData(partId: string, resourceName: string, resourceSubtype: string, methodName: string, startTime?: Date, endTime?: Date, additionalParams?: Record): Promise; /** * Obtain unified tabular data and metadata, queried with SQL. * * @example * * ```ts * const data = await dataClient.tabularDataBySQL( * '123abc45-1234-5678-90ab-cdef12345678', * 'SELECT * FROM readings LIMIT 5' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#exporttabulardata). * * @param organizationId The ID of the organization that owns the data * @param query The SQL query to run * @returns An array of data objects */ tabularDataBySQL(organizationId: string, query: string): Promise<(Object | any[])[]>; /** * Obtain unified tabular data and metadata, queried with MQL. * * @example * * ```ts * // {@link JsonValue} is imported from @bufbuild/protobuf * const mqlQuery: Record[] = [ * { * $match: { * component_name: 'sensor-1', * }, * }, * { * $limit: 5, * }, * ]; * * const data = await dataClient.tabularDataByMQL( * '123abc45-1234-5678-90ab-cdef12345678', * mqlQuery * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#tabulardatabymql). * * @param organizationId The ID of the organization that owns the data * @param query The MQL query to run as a list of BSON documents * @param useRecentData Whether to query blob storage or your recent data * store. Defaults to false. Deprecated - use dataSource instead. * @param dataSource The data source to query. Defaults to the standard data * source. * @param queryPrefixName Optional name of the query prefix. * @returns An array of data objects */ tabularDataByMQL(organizationId: string, query: Uint8Array[] | Record[], useRecentData?: boolean, tabularDataSource?: TabularDataSource, queryPrefixName?: string): Promise<(Object | any[])[]>; /** * Filter and get a page of tabular data. The returned metadata might be empty * if the metadata index of the data is out of the bounds of the returned * metadata list. The data will be paginated into pages of `limit` items, and * the pagination ID will be included in the returned tuple. * * @example * * ```ts * const data = await dataClient.tabularDataByFilter( * { * componentName: 'sensor-1', * componentType: 'rdk:component:sensor', * } as Filter, * 5 * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#tabulardatabyfilter). * * @param filter Optional `pb.Filter` specifying tabular data to retrieve. No * `filter` implies all tabular data. * @param limit The maximum number of entries to include in a page. Defaults * to 50 if unspecfied * @param sortOrder The desired sort order of the data * @param last Optional string indicating the ID of the last-returned data. If * provided, the server will return the next data entries after the `last` * ID. * @param countOnly Whether to return only the total count of entries * @param includeInternalData Whether to retun internal data. Internal data is * used for Viam-specific data ingestion, like cloud SLAM. Defaults to * `false`. * @returns An array of data objects, the count (number of entries), and the * last-returned page ID. */ tabularDataByFilter(filter?: Filter, limit?: number, sortOrder?: Order, last?: string, countOnly?: boolean, includeInternalData?: boolean): Promise<{ data: TabularData[]; count: bigint; last: string; }>; /** * Filter and get a page of binary data. The returned metadata might be empty * if the metadata index of the data is out of the bounds of the returned * metadata list. The data will be paginated into pages of `limit` items, and * the pagination ID will be included in the returned tuple. * * @example * * ```ts * const data = await dataClient.binaryDataByFilter( * { * componentName: 'camera-1', * componentType: 'rdk:component:camera', * } as Filter, * 1 * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#binarydatabyfilter). * * @param filter Optional `pb.Filter` specifying binary data to retrieve. No * `filter` implies all binary data. * @param limit The maximum number of entries to include in a page. Defaults * to 50 if unspecfied * @param sortOrder The desired sort order of the data * @param last Optional string indicating the ID of the last-returned data. If * provided, the server will return the next data entries after the `last` * ID. * @param includeBinary Whether to include binary file data with each * retrieved file * @param countOnly Whether to return only the total count of entries * @param includeInternalData Whether to retun internal data. Internal data is * used for Viam-specific data ingestion, like cloud SLAM. Defaults to * `false`. * @returns An array of data objects, the count (number of entries), and the * last-returned page ID. */ binaryDataByFilter(filter?: Filter, limit?: number, sortOrder?: Order, last?: string, includeBinary?: boolean, countOnly?: boolean, includeInternalData?: boolean): Promise<{ data: import("../gen/app/data/v1/data_pb").BinaryData[]; count: bigint; last: string; }>; /** * Get binary data using the binary data ID. * * @example * * ```ts * const data = await dataClient.binaryDataByIds([ * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * ]); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#binarydatabyids). * * @param ids The IDs of the requested binary data * @param includeBinary Whether to include binary file data with each * retrieved file * @returns An array of data objects */ binaryDataByIds(ids: string[] | BinaryID[], includeBinary?: boolean): Promise; /** * Create a signed URL for binary data. * * @example * * ```ts * const signedUrl = await dataClient.createBinaryDataSignedURL( * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#createbinarydatasignedurl). * * @param binaryDataId The ID of the binary data * @returns A signed URL string for accessing the binary data */ createBinaryDataSignedURL(binaryDataId: string, expirationMinutes?: number): Promise; /** * Delete tabular data older than a specified number of days. * * @example * * ```ts * const data = await dataClient.deleteTabularData( * '123abc45-1234-5678-90ab-cdef12345678', * 10 * ); * * // Delete with additional filter constraints * const data = await dataClient.deleteTabularData( * '123abc45-1234-5678-90ab-cdef12345678', * 10, * { * locationIds: ['location-id'], * componentName: 'camera', * } * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#deletetabulardata). * * @param organizationId The ID of organization to delete data from * @param deleteOlderThanDays Delete data that was captured more than this * many days ago. For example, a value of 10 deletes any data that was * captured more than 10 days ago. A value of 0 deletes all existing data. * @param filter Optional filter to further constrain which data is deleted. * If provided, only data matching the filter will be deleted. If omitted, * data is deleted based on organization_id and delete_older_than_days. * @returns The number of items deleted */ deleteTabularData(organizationId: string, deleteOlderThanDays: number, filter?: PartialMessage): Promise; /** * Filter and delete binary data. * * @example * * ```ts * const data = await dataClient.deleteBinaryDataByFilter({ * componentName: 'camera-1', * componentType: 'rdk:component:camera', * organizationIds: ['123abc45-1234-5678-90ab-cdef12345678'], * startTime: new Date('2025-03-19'), * endTime: new Date('2025-03-20'), * } as Filter); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#deletebinarydatabyfilter). * * @param filter Optional `pb.Filter` specifying binary data to delete. No * `filter` implies all binary data. * @param includeInternalData Whether or not to delete internal data. Default * is true * @returns The number of items deleted */ deleteBinaryDataByFilter(filter?: Filter, includeInternalData?: boolean): Promise; /** * Delete binary data, specified by ID. * * @example * * ```ts * const data = await dataClient.deleteBinaryDataByIds([ * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * ]); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#deletebinarydatabyids). * * @param ids The IDs of the data to be deleted. Must be non-empty. * @returns The number of items deleted */ deleteBinaryDataByIds(ids: string[] | BinaryID[]): Promise; /** * Add tags to binary data, specified by ID. * * @example * * ```ts * const data = await dataClient.addTagsToBinaryDataByIds( * ['tag1', 'tag2'], * [ * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * ] * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#addtagstobinarydatabyids). * * @param tags The list of tags to add to specified binary data. Must be * non-empty. * @param ids The IDs of the data to be tagged. Must be non-empty. */ addTagsToBinaryDataByIds(tags: string[], ids: string[] | BinaryID[]): Promise; /** * Add tags to binary data, specified by filter. * * @example * * ```ts * const data = await dataClient.addTagsToBinaryDataByFilter( * ['tag1', 'tag2'], * [ * { * componentName: 'camera-1', * } as Filter, * ] * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#addtagstobinarydatabyfilter). * * @param tags The tags to add to the data * @param filter Optional `pb.Filter` specifying binary data to add tags to. * No `filter` implies all binary data. */ addTagsToBinaryDataByFilter(tags: string[], filter?: Filter): Promise; /** * Remove tags from binary data, specified by ID. * * @example * * ```ts * const data = await dataClient.removeTagsFromBinaryDataByIds( * ['tag1', 'tag2'], * [ * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * ] * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#removetagsfrombinarydatabyids). * * @param tags List of tags to remove from specified binary data. Must be * non-empty. * @param ids The IDs of the data to be edited. Must be non-empty. * @returns The number of items deleted */ removeTagsFromBinaryDataByIds(tags: string[], ids: string[] | BinaryID[]): Promise; /** * Remove tags from binary data, specified by filter. * * @example * * ```ts * const data = await dataClient.removeTagsFromBinaryDataByFilter( * ['tag1', 'tag2'], * { * componentName: 'camera-1', * componentType: 'rdk:component:camera', * organizationIds: ['123abc45-1234-5678-90ab-cdef12345678'], * startTime: new Date('2025-03-19'), * endTime: new Date('2025-03-20'), * } as Filter * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#removetagsfrombinarydatabyfilter). * * @param tags List of tags to remove from specified binary data. Must be * non-empty. * @param filter Optional `pb.Filter` specifying binary data to add tags to. * No `filter` implies all binary data. * @returns The number of items deleted */ removeTagsFromBinaryDataByFilter(tags: string[], filter?: Filter): Promise; /** * Get a list of tags using a filter. * * @example * * ```ts * const data = await dataClient.tagsByFilter({ * componentName: 'camera-1', * } as Filter); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#tagsbyfilter). * * @param filter Optional `pb.Filter` specifying what data to get tags from. * No `filter` implies all data. * @returns The list of tags */ tagsByFilter(filter?: Filter): Promise; /** * Add bounding box to an image. * * @example * * ```ts * const bboxId = await dataClient.addBoundingBoxToImageById( * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * 'label1', * 0.3, * 0.3, * 0.6, * 0.6, * 0.4 * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#addboundingboxtoimagebyid). * * @param {string | BinaryID} binaryId The ID of the image to add the bounding * box to * @param {string} label A label for the bounding box * @param {number} xMinNormalized The min X value of the bounding box * normalized from 0 to 1 * @param {number} yMinNormalized The min Y value of the bounding box * normalized from 0 to 1 * @param {number} xMaxNormalized The max X value of the bounding box * normalized from 0 to 1 * @param {number} yMaxNormalized The max Y value of the bounding box * normalized from 0 to 1 * @param {number} [confidence] Model's confidence in a predicted bounding box * expressed as a normalized value from 0 to 1 * @returns The bounding box ID */ addBoundingBoxToImageById(binaryId: string | BinaryID, label: string, xMinNormalized: number, yMinNormalized: number, xMaxNormalized: number, yMaxNormalized: number, confidence?: number): Promise; /** * Remove a bounding box from an image. * * @example * * ```ts * await dataClient.removeBoundingBoxFromImageById( * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * '5Z9ryhkW7ULaXROjJO6ghPYulNllnH20QImda1iZFroZpQbjahK6igQ1WbYigXED' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#removeboundingboxfromimagebyid). * * @param binId The ID of the image to remove the bounding box from * @param bboxId The ID of the bounding box to remove */ removeBoundingBoxFromImageById(binId: string | BinaryID, bboxId: string): Promise; /** * Update an existing bounding box * * @example * * ```ts * await dataClient.updateBoundingBox( * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * '691361a6f124d202010cf415' * 'label1', * 0.3, * 0.3, * 0.6, * 0.6, * 0.4 * ); * ``` * * @param {string | BinaryID} binaryId The ID of the image that the target * bounding box is attached to * @param {string} bboxId The ID of the bounding box * @param {string} [label] A label for the bounding box * @param {number} [xMinNormalized] The min X value of the bounding box * normalized from 0 to 1 * @param {number} [yMinNormalized] The min Y value of the bounding box * normalized from 0 to 1 * @param {number} [xMaxNormalized] The max X value of the bounding box * normalized from 0 to 1 * @param {number} [yMaxNormalized] The max Y value of the bounding box * normalized from 0 to 1 * @param {number} [confidence] Model's confidence in a predicted bounding box * expressed as a normalized value from 0 to 1 */ updateBoundingBox(binaryId: string | BinaryID, bboxId: string, label: string, xMinNormalized: number, yMinNormalized: number, xMaxNormalized: number, yMaxNormalized: number, confidence?: number): Promise; /** * Get a list of bounding box labels using a Filter. * * @example * * ```ts * const data = await dataClient.boundingBoxLabelsByFilter({ * componentName: 'camera-1', * } as Filter); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#boundingboxlabelsbyfilter). * * @param filter Optional `pb.Filter` specifying what data to get tags from. * No `filter` implies all labels. * @returns The list of bounding box labels */ boundingBoxLabelsByFilter(filter?: Filter): Promise; /** * Configure a database user for the Viam organization's MongoDB Atlas Data * Federation instance. It can also be used to reset the password of the * existing database user. * * @example * * ```ts * await dataClient.configureDatabaseUser( * '123abc45-1234-5678-90ab-cdef12345678', * 'Password01!' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#configuredatabaseuser). * * @param organizationId The ID of the organization * @param password The password of the user */ configureDatabaseUser(organizationId: string, password: string): Promise; /** * Get a connection to access a MongoDB Atlas Data federation instance. * * @example * * ```ts * const hostname = await dataClient.getDatabaseConnection( * '123abc45-1234-5678-90ab-cdef12345678' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#getdatabaseconnection). * * @param organizationId Organization to retrieve connection for * @returns Hostname of the federated database */ getDatabaseConnection(organizationId: string): Promise; /** * Add BinaryData to the provided dataset. * * @example * * ```ts * await dataClient.addBinaryDataToDatasetByIds( * [ * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * ], * '12ab3de4f56a7bcd89ef0ab1' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#addbinarydatatodatasetbyids). * * @param ids The IDs of binary data to add to dataset * @param datasetId The ID of the dataset to be added to */ addBinaryDataToDatasetByIds(ids: string[] | BinaryID[], datasetId: string): Promise; /** * Remove BinaryData from the provided dataset. * * @example * * ```ts * await dataClient.removeBinaryDataFromDatasetByIds( * [ * 'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh', * ], * '12ab3de4f56a7bcd89ef0ab1' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#removebinarydatafromdatasetbyids). * * @param ids The IDs of the binary data to remove from dataset * @param datasetId The ID of the dataset to be removed from */ removeBinaryDataFromDatasetByIds(ids: string[] | BinaryID[], datasetId: string): Promise; /** * Create a new dataset. * * @example * * ```ts * const datasetId = await dataClient.createDataset( * 'my-new-dataset', * '123abc45-1234-5678-90ab-cdef12345678' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#createdataset). * * @param name The name of the new dataset * @param organizationId The ID of the organization the dataset is being * created in * @returns The ID of the dataset */ createDataset(name: string, organizationId: string): Promise; /** * Delete a dataset. * * @example * * ```ts * await dataClient.deleteDataset('12ab3de4f56a7bcd89ef0ab1'); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#deletedataset). * * @param id The ID of the dataset. */ deleteDataset(id: string): Promise; /** * Rename a dataset. * * @example * * ```ts * await dataClient.renameDataset( * '12ab3de4f56a7bcd89ef0ab1', * 'my-new-dataset' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#renamedataset). * * @param id The ID of the dataset * @param name The new name of the dataset */ renameDataset(id: string, name: string): Promise; /** * List all of the datasets for an organization. * * @example * * ```ts * const datasets = await dataClient.listDatasetsByOrganizationID( * '123abc45-1234-5678-90ab-cdef12345678' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#listdatasetsbyorganizationid). * * @param organizationId The ID of the organization * @returns The list of datasets in the organization */ listDatasetsByOrganizationID(organizationId: string): Promise; /** * List all of the datasets specified by the given dataset IDs. * * @example * * ```ts * const datasets = await dataClient.listDatasetsByIds([ * '12ab3de4f56a7bcd89ef0ab1', * ]); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#listdatasetsbyids). * * @param ids The list of IDs of the datasets * @returns The list of datasets */ listDatasetsByIds(ids: string[]): Promise; /** * Uploads the content and metadata for tabular data. * * Upload tabular data collected on a robot through a specific component (for * example, a motor) along with the relevant metadata to app.viam.com. Tabular * data can be found under the "Sensors" subtab of the Data tab on * app.viam.com. * * @example * * ```ts * const fileId = await dataClient.tabularDataCaptureUpload( * [ * { * readings: { * timestamp: '2025-03-26T10:00:00Z', * value: 10, * }, * }, * ], * '123abc45-1234-5678-90ab-cdef12345678', * 'rdk:component:sensor', * 'my-sensor', * 'Readings', * [ * [ * new Date('2025-03-26T10:00:00Z'), * new Date('2025-03-26T10:00:00Z'), * ], * ] * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#tabulardatacaptureupload). * * @param tabularData The list of data to be uploaded, represented tabularly * as an array. * @param partId The part ID of the component used to capture the data * @param componentType The type of the component used to capture the data * (for example, "movementSensor") * @param componentName The name of the component used to capture the data * @param methodName The name of the method used to capture the data. * @param tags The list of tags to allow for tag-based filtering when * retrieving data * @param dataRequestTimes Array of Date tuples, each containing two `Date` * objects denoting the times this data was requested[0] by the robot and * received[1] from the appropriate sensor. Passing a list of tabular data * and Timestamps with length n > 1 will result in n datapoints being * uploaded, all tied to the same metadata. * @returns The file ID of the uploaded data */ tabularDataCaptureUpload(tabularData: Record[], partId: string, componentType: string, componentName: string, methodName: string, dataRequestTimes: [Date, Date][], tags?: string[]): Promise; /** * Uploads the content and metadata for binary data. * * Upload binary data collected on a robot through a specific component (for * example, a motor) along with the relevant metadata to app.viam.com. binary * data can be found under the "Sensors" subtab of the Data tab on * app.viam.com. * * @example * * ```ts * const binaryDataId = await dataClient.binaryDataCaptureUpload( * binaryData, * '123abc45-1234-5678-90ab-cdef12345678', * 'rdk:component:camera', * 'my-camera', * 'ReadImage', * [new Date('2025-03-19'), new Date('2025-03-19')], * { mimeType: 'image/jpeg' } * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#binarydatacaptureupload). * * @param binaryData The data to be uploaded, represented in bytes * @param partId The part ID of the component used to capture the data * @param componentType The type of the component used to capture the data * (for example, "movementSensor") * @param componentName The name of the component used to capture the data * @param methodName The name of the method used to capture the data. * @param dataRequestTimes Tuple containing `Date` objects denoting the times * this data was requested[0] by the robot and received[1] from the * appropriate sensor. * @param options Optional parameters including `mimeType`, `fileExtension`, * `tags`, and `datasetIds`. * @returns The binary data ID of the uploaded data */ binaryDataCaptureUpload(binaryData: Uint8Array, partId: string, componentType: string, componentName: string, methodName: string, dataRequestTimes: [Date, Date], options?: BinaryDataCaptureUploadOptions): Promise; /** * Upload arbitrary file data. * * Upload file data that may be stored on a robot along with the relevant * metadata. File data can be found in the **Files** tab of the **DATA** * page. * * @example * * ```ts * const binaryDataId = await dataClient.fileUpload( * binaryData, * 'INSERT YOUR PART ID', * { * fileExtension: '.jpeg', * tags: ['tag_1', 'tag_2'], * } * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#fileupload). * * @param binaryData The data to be uploaded * @param partId The part ID of the machine that captured the data * @param options Options for the file upload * @returns The binary data ID of the uploaded data */ fileUpload(binaryData: Uint8Array, partId: string, options?: FileUploadOptions): Promise; /** * Create an async generator of FileUploadRequests to use with FileUpload * methods. * * @param metadata The file's metadata * @param data The binary data of the file */ private static fileUploadRequests; static createFilter(options: FilterOptions): Filter; /** * Gets the most recent tabular data captured from the specified data source, * as long as it was synced within the last year. * * @example * * ```ts * const data = await dataClient.getLatestTabularData( * '123abc45-1234-5678-90ab-cdef12345678', * 'my-sensor', * 'rdk:component:sensor', * 'Readings' * ); * ``` * * For more information, see [Data * API](https://docs.viam.com/dev/reference/apis/data-client/#getlatesttabulardata). * * @param partId The ID of the part that owns the data * @param resourceName The name of the requested resource that captured the * data. Ex: "my-sensor" * @param resourceSubtype The subtype of the requested resource that captured * the data. Ex: "rdk:component:sensor" * @param methodName The data capture method name. Ex: "Readings" * @returns A tuple containing [timeCaptured, timeSynced, payload] or null if * no data has been synced for the specified resource OR the most recently * captured data was over a year ago */ getLatestTabularData(partId: string, resourceName: string, resourceSubtype: string, methodName: string, additionalParams?: Record): Promise<[Date, Date, Record] | null>; /** * List all data pipelines for an organization. * * @example * * ```ts * const pipelines = await dataClient.listDataPipelines( * '123abc45-1234-5678-90ab-cdef12345678' * ); * ``` * * @param organizationId The ID of the organization * @returns The list of data pipelines */ listDataPipelines(organizationId: string): Promise; /** * Get a data pipeline configuration by its ID. * * @example * * ```ts * const pipeline = await dataClient.getPipeline( * '123abc45-1234-5678-90ab-cdef12345678' * ); * ``` * * @param pipelineId The ID of the data pipeline * @returns The data pipeline configuration or null if it does not exist */ getDataPipeline(pipelineId: string): Promise; /** * Creates a new data pipeline using the given query and schedule. * * @example * * ```ts * // {@link JsonValue} is imported from @bufbuild/protobuf * const mqlQuery: Record[] = [ * { * $match: { * component_name: 'sensor-1', * }, * }, * { * $limit: 5, * }, * ]; * * const pipelineId = await dataClient.createDataPipeline( * '123abc45-1234-5678-90ab-cdef12345678', * 'my-pipeline', * mqlQuery, * '0 0 * * *' * false, * 0 * ); * ``` * * @param organizationId The ID of the organization * @param name The name of the data pipeline * @param query The MQL query to run as a list of BSON documents * @param schedule The schedule to run the query on (cron expression) * @param dataSourceType The type of data source to use for the data pipeline * @param enableBackfill Whether to enable backfill for the data pipeline * @returns The ID of the created data pipeline */ createDataPipeline(organizationId: string, name: string, query: Uint8Array[] | Record[], schedule: string, enableBackfill: boolean, dataSourceType?: TabularDataSourceType): Promise; /** * Deletes a data pipeline by its ID. * * @example * * ```ts * await dataClient.deleteDataPipeline( * '123abc45-1234-5678-90ab-cdef12345678' * ); * ``` * * @param pipelineId The ID of the data pipeline */ deleteDataPipeline(pipelineId: string): Promise; /** * List all runs of a data pipeline. * * @example * * ```ts * const page = await dataClient.listDataPipelineRuns( * '123abc45-1234-5678-90ab-cdef12345678' * ); * page.runs.forEach((run) => { * console.log(run); * }); * page = await page.nextPage(); * page.runs.forEach((run) => { * console.log(run); * }); * ``` * * @param pipelineId The ID of the data pipeline * @param pageSize The number of runs to return per page * @returns A page of data pipeline runs */ listDataPipelineRuns(pipelineId: string, pageSize?: number): Promise; /** * CreateIndex starts a custom index build * * @example * * ```ts * await dataClient.createIndex( * '123abc45-1234-5678-90ab-cdef12345678', * IndexableCollection.HOT_STORE, * [new TextEncoder().encode(JSON.stringify({ field: 1 }))] * ); * ``` * * @param organizationId The ID of the organization * @param collectionType The type of collection to create the index on * @param indexSpec The MongoDB index specification in JSON format, as a * Uint8Array * @param pipelineName Optional name of the pipeline if collectionType is * PIPELINE_SINK */ createIndex(organizationId: string, collectionType: IndexableCollection, indexSpec: { keys: Record; options?: Record; }, pipelineName?: string): Promise; /** * ListIndexes returns all the indexes for a given collection * * @example * * ```ts * const indexes = await dataClient.listIndexes( * '123abc45-1234-5678-90ab-cdef12345678', * IndexableCollection.HOT_STORE * ); * ``` * * @param organizationId The ID of the organization * @param collectionType The type of collection to list indexes for * @param pipelineName Optional name of the pipeline if collectionType is * PIPELINE_SINK * @returns An array of indexes */ listIndexes(organizationId: string, collectionType: IndexableCollection, pipelineName?: string): Promise; /** * DeleteIndex drops the specified custom index from a collection * * @example * * ```ts * await dataClient.deleteIndex( * '123abc45-1234-5678-90ab-cdef12345678', * IndexableCollection.HOT_STORE, * 'my_index' * ); * ``` * * @param organizationId The ID of the organization * @param collectionType The type of collection to delete the index from * @param indexName The name of the index to delete * @param pipelineName Optional name of the pipeline if collectionType is * PIPELINE_SINK */ deleteIndex(organizationId: string, collectionType: IndexableCollection, indexName: string, pipelineName?: string): Promise; } export declare class ListDataPipelineRunsPage { private readonly dataPipelinesClient; private readonly pipelineId; readonly runs: DataPipelineRun[]; private readonly pageSize?; private readonly nextPageToken?; constructor(dataPipelinesClient: Client, pipelineId: string, runs?: DataPipelineRun[], pageSize?: number | undefined, nextPageToken?: string | undefined); /** * Retrieves the next page of data pipeline runs. * * @example * * ```ts * const page = await dataClient.listDataPipelineRuns( * '123abc45-1234-5678-90ab-cdef12345678' * ); * const nextPage = await page.nextPage(); * ``` * * @returns A page of data pipeline runs */ nextPage(): Promise; } export { type BinaryID, type IndexableCollection, type Order, } from '../gen/app/data/v1/data_pb'; export { type UploadMetadata } from '../gen/app/datasync/v1/data_sync_pb';